diff --git a/clients/pom.xml b/clients/pom.xml index 78ddf7e..b4f12ea 100644 --- a/clients/pom.xml +++ b/clients/pom.xml @@ -5,7 +5,7 @@ binance-connector-java-clients pom binance-connector-java-clients - 1.1.2 + 1.1.3 https://github.com/binance/binance-connector-java Java connector to Binance APIs @@ -365,7 +365,7 @@ org.eclipse.jetty.websocket websocket-jetty-client - 11.0.26 + ${jetty.version} @@ -377,7 +377,7 @@ 2.12.1 3.18.0 0.2.6 - 2.19.0 + 2.22.1 3.0.0 3.1.1 5.10.3 @@ -385,5 +385,6 @@ 1.1.1 UTF-8 2.44.4 + 11.0.26 diff --git a/clients/web3-common/pom.xml b/clients/web3-common/pom.xml index 3b0f519..136b9c4 100644 --- a/clients/web3-common/pom.xml +++ b/clients/web3-common/pom.xml @@ -5,7 +5,7 @@ io.github.binance binance-connector-java-clients - 1.1.2 + 1.1.3 binance-web3-common diff --git a/clients/web3-wallet/CHANGELOG.md b/clients/web3-wallet/CHANGELOG.md index 474f8a3..fb3007b 100644 --- a/clients/web3-wallet/CHANGELOG.md +++ b/clients/web3-wallet/CHANGELOG.md @@ -1,5 +1,15 @@ # Changelog +## 4.2.0 - 2026-09-02 + +### Added (1) + +- `getWebSocketAuthToken()` (`GET /api/v1/dex/market/wss/auth/token`) + +### Changed (1) + +- Added response schema `getWebSocketAuthTokenResponse` + ## 4.1.0 - 2026-08-07 ### Added (1) diff --git a/clients/web3-wallet/docs/AddressResp.md b/clients/web3-wallet/docs/AddressResp.md new file mode 100644 index 0000000..1f56e66 --- /dev/null +++ b/clients/web3-wallet/docs/AddressResp.md @@ -0,0 +1,16 @@ + + +# AddressResp + +Address-level aggregation. Groups the protocol-level position summaries of one wallet address. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**address** | **String** | Wallet address. | [optional] | +|**addressTotalValue** | **String** | Total DeFi position value of this address across all chains (USD). Same raw precision as the position values. | [optional] | +|**protocolList** | [**List<AddressRespProtocolListInner>**](AddressRespProtocolListInner.md) | Protocol-level position summaries of this address. | [optional] | + + + diff --git a/clients/web3-wallet/docs/AddressRespProtocolListInner.md b/clients/web3-wallet/docs/AddressRespProtocolListInner.md new file mode 100644 index 0000000..8996985 --- /dev/null +++ b/clients/web3-wallet/docs/AddressRespProtocolListInner.md @@ -0,0 +1,18 @@ + + +# AddressRespProtocolListInner + +Protocol-level position summary for one address on one chain. `binanceChainId` + `defiProtocolId` uniquely identify a protocol on a chain. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**binanceChainId** | **String** | Binance chain ID (e.g. \"56\"=BSC). | [optional] | +|**defiProtocolId** | **String** | Protocol identifier consistent with `POST /api/v1/defi/data/protocol/list`. Use this value when calling investment/list, transaction endpoints, etc. | [optional] | +|**protocolName** | **String** | Protocol display name. | [optional] | +|**protocolTotalValue** | **String** | Total position value in this protocol (USD). | [optional] | +|**poolList** | [**List<ProtocolRespPoolListInner>**](ProtocolRespPoolListInner.md) | Pools with positions in this protocol. | [optional] | + + + diff --git a/clients/web3-wallet/docs/B402ApiErrorEnvelope.md b/clients/web3-wallet/docs/B402ApiErrorEnvelope.md new file mode 100644 index 0000000..f508515 --- /dev/null +++ b/clients/web3-wallet/docs/B402ApiErrorEnvelope.md @@ -0,0 +1,19 @@ + + +# B402ApiErrorEnvelope + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**status** | **String** | | [optional] | +|**type** | **String** | | [optional] | +|**code** | **String** | | [optional] | +|**errorData** | **String** | | [optional] | +|**data** | **Object** | | [optional] | +|**subData** | **Object** | | [optional] | +|**params** | **Object** | | [optional] | + + + diff --git a/clients/web3-wallet/docs/B402BazaarExtension.md b/clients/web3-wallet/docs/B402BazaarExtension.md new file mode 100644 index 0000000..e67dc69 --- /dev/null +++ b/clients/web3-wallet/docs/B402BazaarExtension.md @@ -0,0 +1,16 @@ + + +# B402BazaarExtension + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**info** | **Map<String, Object>** | | | +|**schema** | **Map<String, Object>** | | | +|**routeTemplate** | **String** | | [optional] | +|**description** | **String** | | [optional] | + + + diff --git a/clients/web3-wallet/docs/B402Eip3009Authorization.md b/clients/web3-wallet/docs/B402Eip3009Authorization.md new file mode 100644 index 0000000..2bbf9d1 --- /dev/null +++ b/clients/web3-wallet/docs/B402Eip3009Authorization.md @@ -0,0 +1,18 @@ + + +# B402Eip3009Authorization + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**from** | **String** | | | +|**to** | **String** | | | +|**value** | **String** | | | +|**validAfter** | **String** | | | +|**validBefore** | **String** | | | +|**nonce** | **String** | | | + + + diff --git a/clients/web3-wallet/docs/B402PayloadDetail.md b/clients/web3-wallet/docs/B402PayloadDetail.md new file mode 100644 index 0000000..93d9914 --- /dev/null +++ b/clients/web3-wallet/docs/B402PayloadDetail.md @@ -0,0 +1,15 @@ + + +# B402PayloadDetail + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**signature** | **String** | | | +|**authorization** | [**B402PayloadDetailAuthorization**](B402PayloadDetailAuthorization.md) | | [optional] | +|**permit2Authorization** | [**B402PayloadDetailPermit2Authorization**](B402PayloadDetailPermit2Authorization.md) | | [optional] | + + + diff --git a/clients/web3-wallet/docs/B402PayloadDetailAuthorization.md b/clients/web3-wallet/docs/B402PayloadDetailAuthorization.md new file mode 100644 index 0000000..7b0a7ed --- /dev/null +++ b/clients/web3-wallet/docs/B402PayloadDetailAuthorization.md @@ -0,0 +1,18 @@ + + +# B402PayloadDetailAuthorization + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**from** | **String** | | | +|**to** | **String** | | | +|**value** | **String** | | | +|**validAfter** | **String** | | | +|**validBefore** | **String** | | | +|**nonce** | **String** | | | + + + diff --git a/clients/web3-wallet/docs/B402PayloadDetailPermit2Authorization.md b/clients/web3-wallet/docs/B402PayloadDetailPermit2Authorization.md new file mode 100644 index 0000000..6ae2bcd --- /dev/null +++ b/clients/web3-wallet/docs/B402PayloadDetailPermit2Authorization.md @@ -0,0 +1,18 @@ + + +# B402PayloadDetailPermit2Authorization + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**permitted** | [**B402Permit2AuthorizationPermitted**](B402Permit2AuthorizationPermitted.md) | | | +|**from** | **String** | | | +|**spender** | **String** | | | +|**nonce** | **String** | | | +|**deadline** | **String** | | | +|**witness** | [**B402Permit2AuthorizationWitness**](B402Permit2AuthorizationWitness.md) | | | + + + diff --git a/clients/web3-wallet/docs/B402PaymentKindExtraV1.md b/clients/web3-wallet/docs/B402PaymentKindExtraV1.md new file mode 100644 index 0000000..bfa1a89 --- /dev/null +++ b/clients/web3-wallet/docs/B402PaymentKindExtraV1.md @@ -0,0 +1,26 @@ + + +# B402PaymentKindExtraV1 + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **String** | | [optional] | +|**version** | **String** | | [optional] | +|**assetTransferMethod** | [**AssetTransferMethodEnum**](#AssetTransferMethodEnum) | | [optional] | +|**facilitatorAddress** | **String** | | [optional] | + + + +## Enum: AssetTransferMethodEnum + +| Name | Value | +|---- | -----| +| EIP3009 | "eip3009" | +| PERMIT2_EXACT | "permit2-exact" | +| PERMIT2_UPTO | "permit2-upto" | + + + diff --git a/clients/web3-wallet/docs/B402PaymentKindExtraV2.md b/clients/web3-wallet/docs/B402PaymentKindExtraV2.md new file mode 100644 index 0000000..689fa70 --- /dev/null +++ b/clients/web3-wallet/docs/B402PaymentKindExtraV2.md @@ -0,0 +1,27 @@ + + +# B402PaymentKindExtraV2 + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **String** | | | +|**version** | **String** | | | +|**assetTransferMethod** | [**AssetTransferMethodEnum**](#AssetTransferMethodEnum) | | | +|**signerAddress** | **String** | | | +|**spenderAddress** | **String** | | [optional] | + + + +## Enum: AssetTransferMethodEnum + +| Name | Value | +|---- | -----| +| EIP3009 | "eip3009" | +| PERMIT2_EXACT | "permit2-exact" | +| PERMIT2_UPTO | "permit2-upto" | + + + diff --git a/clients/web3-wallet/docs/B402PaymentKindV1.md b/clients/web3-wallet/docs/B402PaymentKindV1.md new file mode 100644 index 0000000..135d9f9 --- /dev/null +++ b/clients/web3-wallet/docs/B402PaymentKindV1.md @@ -0,0 +1,32 @@ + + +# B402PaymentKindV1 + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**x402Version** | [**X402VersionEnum**](#X402VersionEnum) | | [optional] | +|**scheme** | [**SchemeEnum**](#SchemeEnum) | | [optional] | +|**network** | **String** | | [optional] | +|**extra** | [**B402PaymentKindV1Extra**](B402PaymentKindV1Extra.md) | | [optional] | + + + +## Enum: X402VersionEnum + +| Name | Value | +|---- | -----| +| X402_VERSION_1 | 1 | + + + +## Enum: SchemeEnum + +| Name | Value | +|---- | -----| +| exact | "exact" | + + + diff --git a/clients/web3-wallet/docs/B402PaymentKindV1Extra.md b/clients/web3-wallet/docs/B402PaymentKindV1Extra.md new file mode 100644 index 0000000..dbfef7d --- /dev/null +++ b/clients/web3-wallet/docs/B402PaymentKindV1Extra.md @@ -0,0 +1,26 @@ + + +# B402PaymentKindV1Extra + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **String** | | [optional] | +|**version** | **String** | | [optional] | +|**assetTransferMethod** | [**AssetTransferMethodEnum**](#AssetTransferMethodEnum) | | [optional] | +|**facilitatorAddress** | **String** | | [optional] | + + + +## Enum: AssetTransferMethodEnum + +| Name | Value | +|---- | -----| +| EIP3009 | "eip3009" | +| PERMIT2_EXACT | "permit2-exact" | +| PERMIT2_UPTO | "permit2-upto" | + + + diff --git a/clients/web3-wallet/docs/B402PaymentKindV2.md b/clients/web3-wallet/docs/B402PaymentKindV2.md new file mode 100644 index 0000000..47d53b6 --- /dev/null +++ b/clients/web3-wallet/docs/B402PaymentKindV2.md @@ -0,0 +1,33 @@ + + +# B402PaymentKindV2 + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**x402Version** | [**X402VersionEnum**](#X402VersionEnum) | | | +|**scheme** | [**SchemeEnum**](#SchemeEnum) | | | +|**network** | **String** | | | +|**extra** | [**B402PaymentKindV2Extra**](B402PaymentKindV2Extra.md) | | | + + + +## Enum: X402VersionEnum + +| Name | Value | +|---- | -----| +| X402_VERSION_2 | 2 | + + + +## Enum: SchemeEnum + +| Name | Value | +|---- | -----| +| exact | "exact" | +| upto | "upto" | + + + diff --git a/clients/web3-wallet/docs/B402PaymentKindV2Extra.md b/clients/web3-wallet/docs/B402PaymentKindV2Extra.md new file mode 100644 index 0000000..8ba1961 --- /dev/null +++ b/clients/web3-wallet/docs/B402PaymentKindV2Extra.md @@ -0,0 +1,27 @@ + + +# B402PaymentKindV2Extra + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **String** | | | +|**version** | **String** | | | +|**assetTransferMethod** | [**AssetTransferMethodEnum**](#AssetTransferMethodEnum) | | | +|**signerAddress** | **String** | | | +|**spenderAddress** | **String** | | [optional] | + + + +## Enum: AssetTransferMethodEnum + +| Name | Value | +|---- | -----| +| EIP3009 | "eip3009" | +| PERMIT2_EXACT | "permit2-exact" | +| PERMIT2_UPTO | "permit2-upto" | + + + diff --git a/clients/web3-wallet/docs/B402PaymentPayloadV1.md b/clients/web3-wallet/docs/B402PaymentPayloadV1.md new file mode 100644 index 0000000..cb7d4ce --- /dev/null +++ b/clients/web3-wallet/docs/B402PaymentPayloadV1.md @@ -0,0 +1,32 @@ + + +# B402PaymentPayloadV1 + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**x402Version** | [**X402VersionEnum**](#X402VersionEnum) | | | +|**scheme** | [**SchemeEnum**](#SchemeEnum) | | | +|**network** | **String** | | | +|**payload** | [**B402PaymentPayloadV2Payload**](B402PaymentPayloadV2Payload.md) | | | + + + +## Enum: X402VersionEnum + +| Name | Value | +|---- | -----| +| X402_VERSION_1 | 1 | + + + +## Enum: SchemeEnum + +| Name | Value | +|---- | -----| +| exact | "exact" | + + + diff --git a/clients/web3-wallet/docs/B402PaymentPayloadV2.md b/clients/web3-wallet/docs/B402PaymentPayloadV2.md new file mode 100644 index 0000000..3d85d02 --- /dev/null +++ b/clients/web3-wallet/docs/B402PaymentPayloadV2.md @@ -0,0 +1,25 @@ + + +# B402PaymentPayloadV2 + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**x402Version** | [**X402VersionEnum**](#X402VersionEnum) | | | +|**resource** | [**B402PaymentPayloadV2Resource**](B402PaymentPayloadV2Resource.md) | | | +|**accepted** | [**B402PaymentPayloadV2Accepted**](B402PaymentPayloadV2Accepted.md) | | | +|**payload** | [**B402PaymentPayloadV2Payload**](B402PaymentPayloadV2Payload.md) | | | +|**extensions** | **B402PaymentPayloadV2Extensions** | | [optional] | + + + +## Enum: X402VersionEnum + +| Name | Value | +|---- | -----| +| X402_VERSION_2 | 2 | + + + diff --git a/clients/web3-wallet/docs/B402PaymentPayloadV2Accepted.md b/clients/web3-wallet/docs/B402PaymentPayloadV2Accepted.md new file mode 100644 index 0000000..01912fe --- /dev/null +++ b/clients/web3-wallet/docs/B402PaymentPayloadV2Accepted.md @@ -0,0 +1,28 @@ + + +# B402PaymentPayloadV2Accepted + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**scheme** | [**SchemeEnum**](#SchemeEnum) | | | +|**network** | **String** | | | +|**amount** | **String** | | | +|**asset** | **String** | | | +|**payTo** | **String** | | | +|**maxTimeoutSeconds** | **Integer** | | | +|**extra** | [**B402PaymentRequirementsV2Extra**](B402PaymentRequirementsV2Extra.md) | | | + + + +## Enum: SchemeEnum + +| Name | Value | +|---- | -----| +| exact | "exact" | +| upto | "upto" | + + + diff --git a/clients/web3-wallet/docs/B402PaymentPayloadV2Extensions.md b/clients/web3-wallet/docs/B402PaymentPayloadV2Extensions.md new file mode 100644 index 0000000..04a2bdc --- /dev/null +++ b/clients/web3-wallet/docs/B402PaymentPayloadV2Extensions.md @@ -0,0 +1,13 @@ + + +# B402PaymentPayloadV2Extensions + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**bazaar** | [**B402PaymentPayloadV2ExtensionsBazaar**](B402PaymentPayloadV2ExtensionsBazaar.md) | | [optional] | + + + diff --git a/clients/web3-wallet/docs/B402PaymentPayloadV2ExtensionsBazaar.md b/clients/web3-wallet/docs/B402PaymentPayloadV2ExtensionsBazaar.md new file mode 100644 index 0000000..28016a7 --- /dev/null +++ b/clients/web3-wallet/docs/B402PaymentPayloadV2ExtensionsBazaar.md @@ -0,0 +1,16 @@ + + +# B402PaymentPayloadV2ExtensionsBazaar + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**info** | **Map<String, Object>** | | | +|**schema** | **Map<String, Object>** | | | +|**routeTemplate** | **String** | | [optional] | +|**description** | **String** | | [optional] | + + + diff --git a/clients/web3-wallet/docs/B402PaymentPayloadV2Payload.md b/clients/web3-wallet/docs/B402PaymentPayloadV2Payload.md new file mode 100644 index 0000000..1a6166e --- /dev/null +++ b/clients/web3-wallet/docs/B402PaymentPayloadV2Payload.md @@ -0,0 +1,15 @@ + + +# B402PaymentPayloadV2Payload + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**signature** | **String** | | | +|**authorization** | [**B402PayloadDetailAuthorization**](B402PayloadDetailAuthorization.md) | | [optional] | +|**permit2Authorization** | [**B402PayloadDetailPermit2Authorization**](B402PayloadDetailPermit2Authorization.md) | | [optional] | + + + diff --git a/clients/web3-wallet/docs/B402PaymentPayloadV2Resource.md b/clients/web3-wallet/docs/B402PaymentPayloadV2Resource.md new file mode 100644 index 0000000..25b6236 --- /dev/null +++ b/clients/web3-wallet/docs/B402PaymentPayloadV2Resource.md @@ -0,0 +1,15 @@ + + +# B402PaymentPayloadV2Resource + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**url** | **URI** | | | +|**description** | **String** | | [optional] | +|**mimeType** | **String** | | [optional] | + + + diff --git a/clients/web3-wallet/docs/B402PaymentRequirementsExtraV2.md b/clients/web3-wallet/docs/B402PaymentRequirementsExtraV2.md new file mode 100644 index 0000000..49bb779 --- /dev/null +++ b/clients/web3-wallet/docs/B402PaymentRequirementsExtraV2.md @@ -0,0 +1,27 @@ + + +# B402PaymentRequirementsExtraV2 + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **String** | | | +|**version** | **String** | | | +|**assetTransferMethod** | [**AssetTransferMethodEnum**](#AssetTransferMethodEnum) | | | +|**signerAddress** | **String** | | | +|**spenderAddress** | **String** | | [optional] | + + + +## Enum: AssetTransferMethodEnum + +| Name | Value | +|---- | -----| +| EIP3009 | "eip3009" | +| PERMIT2_EXACT | "permit2-exact" | +| PERMIT2_UPTO | "permit2-upto" | + + + diff --git a/clients/web3-wallet/docs/B402PaymentRequirementsV1.md b/clients/web3-wallet/docs/B402PaymentRequirementsV1.md new file mode 100644 index 0000000..388adb9 --- /dev/null +++ b/clients/web3-wallet/docs/B402PaymentRequirementsV1.md @@ -0,0 +1,31 @@ + + +# B402PaymentRequirementsV1 + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**scheme** | [**SchemeEnum**](#SchemeEnum) | | | +|**network** | **String** | | | +|**amount** | **String** | | | +|**resource** | **URI** | | [optional] | +|**description** | **String** | | [optional] | +|**payTo** | **String** | | | +|**asset** | **String** | | | +|**maxTimeoutSeconds** | **Integer** | | | +|**mimeType** | **String** | | [optional] | +|**outputSchema** | **Map<String, Object>** | | [optional] | +|**extra** | [**B402PaymentKindV1Extra**](B402PaymentKindV1Extra.md) | | [optional] | + + + +## Enum: SchemeEnum + +| Name | Value | +|---- | -----| +| exact | "exact" | + + + diff --git a/clients/web3-wallet/docs/B402PaymentRequirementsV2.md b/clients/web3-wallet/docs/B402PaymentRequirementsV2.md new file mode 100644 index 0000000..0efce5d --- /dev/null +++ b/clients/web3-wallet/docs/B402PaymentRequirementsV2.md @@ -0,0 +1,28 @@ + + +# B402PaymentRequirementsV2 + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**scheme** | [**SchemeEnum**](#SchemeEnum) | | | +|**network** | **String** | | | +|**amount** | **String** | | | +|**asset** | **String** | | | +|**payTo** | **String** | | | +|**maxTimeoutSeconds** | **Integer** | | | +|**extra** | [**B402PaymentRequirementsV2Extra**](B402PaymentRequirementsV2Extra.md) | | | + + + +## Enum: SchemeEnum + +| Name | Value | +|---- | -----| +| exact | "exact" | +| upto | "upto" | + + + diff --git a/clients/web3-wallet/docs/B402PaymentRequirementsV2Extra.md b/clients/web3-wallet/docs/B402PaymentRequirementsV2Extra.md new file mode 100644 index 0000000..0a7e85d --- /dev/null +++ b/clients/web3-wallet/docs/B402PaymentRequirementsV2Extra.md @@ -0,0 +1,27 @@ + + +# B402PaymentRequirementsV2Extra + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **String** | | | +|**version** | **String** | | | +|**assetTransferMethod** | [**AssetTransferMethodEnum**](#AssetTransferMethodEnum) | | | +|**signerAddress** | **String** | | | +|**spenderAddress** | **String** | | [optional] | + + + +## Enum: AssetTransferMethodEnum + +| Name | Value | +|---- | -----| +| EIP3009 | "eip3009" | +| PERMIT2_EXACT | "permit2-exact" | +| PERMIT2_UPTO | "permit2-upto" | + + + diff --git a/clients/web3-wallet/docs/B402PaymentsApi.md b/clients/web3-wallet/docs/B402PaymentsApi.md new file mode 100644 index 0000000..31c04ff --- /dev/null +++ b/clients/web3-wallet/docs/B402PaymentsApi.md @@ -0,0 +1,452 @@ +# B402PaymentsApi + +All URIs are relative to *https://web3.binance.com/build* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**getB402SupportedConfigurationsV1**](B402PaymentsApi.md#getB402SupportedConfigurationsV1) | **POST** /api/v1/b402/supported | Get B402 Supported Configurations V1 | +| [**getB402SupportedConfigurationsV2**](B402PaymentsApi.md#getB402SupportedConfigurationsV2) | **POST** /api/v2/b402/supported | Get B402 Supported Configurations V2 | +| [**settleB402PaymentV1**](B402PaymentsApi.md#settleB402PaymentV1) | **POST** /api/v1/b402/settle | Settle B402 Payment V1 | +| [**settleB402PaymentV2**](B402PaymentsApi.md#settleB402PaymentV2) | **POST** /api/v2/b402/settle | Settle B402 Payment V2 | +| [**verifyB402PaymentV1**](B402PaymentsApi.md#verifyB402PaymentV1) | **POST** /api/v1/b402/verify | Verify B402 Payment V1 | +| [**verifyB402PaymentV2**](B402PaymentsApi.md#verifyB402PaymentV2) | **POST** /api/v2/b402/verify | Verify B402 Payment V2 | + + + +# **getB402SupportedConfigurationsV1** +> GetB402SupportedConfigurationsV1Response getB402SupportedConfigurationsV1(getB402SupportedConfigurationsV1Request).recvWindow(recvWindow).nonce(nonce).execute(); + +Get B402 Supported Configurations V1 + +Legacy V1 compatibility endpoint. New integrations should use V2. V1 returns `x402Version=1`, method-specific `facilitatorAddress`, and V1 signer-map semantics. + +### Example +```java +// Import classes: +import com.binance.connector.client.web3_wallet.ApiClient; +import com.binance.connector.client.web3_wallet.ApiException; +import com.binance.connector.client.web3_wallet.Configuration; +import com.binance.connector.client.web3_wallet.models.*; +import com.binance.connector.client.web3_wallet.rest.api.B402PaymentsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://web3.binance.com/build"); + + B402PaymentsApi apiInstance = new B402PaymentsApi(defaultClient); + GetB402SupportedConfigurationsV1Request getB402SupportedConfigurationsV1Request = new GetB402SupportedConfigurationsV1Request(); // GetB402SupportedConfigurationsV1Request | + Long recvWindow = 5000L; // Long | Allowed time deviation in milliseconds (default: 5000, max: 60000). + String nonce = "unique-nonce-string"; // String | Unique request identifier for anti-replay; falls back to X-OC-SIGN if omitted. + try { + GetB402SupportedConfigurationsV1Response result = apiInstance.getB402SupportedConfigurationsV1(getB402SupportedConfigurationsV1Request) + .recvWindow(recvWindow) + .nonce(nonce) + .execute(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling B402PaymentsApi#getB402SupportedConfigurationsV1"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **getB402SupportedConfigurationsV1Request** | [**GetB402SupportedConfigurationsV1Request**](GetB402SupportedConfigurationsV1Request.md)| | | +| **recvWindow** | **Long**| Allowed time deviation in milliseconds (default: 5000, max: 60000). | [optional] | +| **nonce** | **String**| Unique request identifier for anti-replay; falls back to X-OC-SIGN if omitted. | [optional] | + +### Return type + +[**GetB402SupportedConfigurationsV1Response**](GetB402SupportedConfigurationsV1Response.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Legacy supported configurations or a B402 business error envelope. | - | +| **401** | Unauthorized. The request is missing or contains invalid Web3 API credentials. | - | +| **403** | Forbidden. Check the API Key's B402 Payments permission, IP whitelist, and endpoint allowlist. | - | +| **429** | Rate limit exceeded. | - | +| **503** | B402 is temporarily unavailable. | - | + + +# **getB402SupportedConfigurationsV2** +> GetB402SupportedConfigurationsV2Response getB402SupportedConfigurationsV2(getB402SupportedConfigurationsV2Request).recvWindow(recvWindow).nonce(nonce).execute(); + +Get B402 Supported Configurations V2 + +Return the live x402 V2 payment kinds available to the authenticated Developer Portal project. Use the result to construct HTTP 402 payment requirements. Copy the selected `extra` object verbatim and refresh cached configuration periodically. + +### Example +```java +// Import classes: +import com.binance.connector.client.web3_wallet.ApiClient; +import com.binance.connector.client.web3_wallet.ApiException; +import com.binance.connector.client.web3_wallet.Configuration; +import com.binance.connector.client.web3_wallet.models.*; +import com.binance.connector.client.web3_wallet.rest.api.B402PaymentsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://web3.binance.com/build"); + + B402PaymentsApi apiInstance = new B402PaymentsApi(defaultClient); + GetB402SupportedConfigurationsV2Request getB402SupportedConfigurationsV2Request = new GetB402SupportedConfigurationsV2Request(); // GetB402SupportedConfigurationsV2Request | + Long recvWindow = 5000L; // Long | Allowed time deviation in milliseconds (default: 5000, max: 60000). + String nonce = "unique-nonce-string"; // String | Unique request identifier for anti-replay; falls back to X-OC-SIGN if omitted. + try { + GetB402SupportedConfigurationsV2Response result = apiInstance.getB402SupportedConfigurationsV2(getB402SupportedConfigurationsV2Request) + .recvWindow(recvWindow) + .nonce(nonce) + .execute(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling B402PaymentsApi#getB402SupportedConfigurationsV2"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **getB402SupportedConfigurationsV2Request** | [**GetB402SupportedConfigurationsV2Request**](GetB402SupportedConfigurationsV2Request.md)| | | +| **recvWindow** | **Long**| Allowed time deviation in milliseconds (default: 5000, max: 60000). | [optional] | +| **nonce** | **String**| Unique request identifier for anti-replay; falls back to X-OC-SIGN if omitted. | [optional] | + +### Return type + +[**GetB402SupportedConfigurationsV2Response**](GetB402SupportedConfigurationsV2Response.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Supported configurations returned, or a B402 business error envelope. | - | +| **401** | Unauthorized. The request is missing or contains invalid Web3 API credentials. | - | +| **403** | Forbidden. Check the API Key's B402 Payments permission, IP whitelist, and endpoint allowlist. | - | +| **429** | Rate limit exceeded. | - | +| **503** | B402 is temporarily unavailable. | - | + + +# **settleB402PaymentV1** +> SettleB402PaymentV1Response settleB402PaymentV1(settleB402PaymentV1Request).recvWindow(recvWindow).nonce(nonce).execute(); + +Settle B402 Payment V1 + +Legacy V1 on-chain settlement endpoint. New integrations should use V2. This operation can move real funds and is irreversible. V1 additionally returns `confirmations` in the settlement result. + +### Example +```java +// Import classes: +import com.binance.connector.client.web3_wallet.ApiClient; +import com.binance.connector.client.web3_wallet.ApiException; +import com.binance.connector.client.web3_wallet.Configuration; +import com.binance.connector.client.web3_wallet.models.*; +import com.binance.connector.client.web3_wallet.rest.api.B402PaymentsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://web3.binance.com/build"); + + B402PaymentsApi apiInstance = new B402PaymentsApi(defaultClient); + SettleB402PaymentV1Request settleB402PaymentV1Request = new SettleB402PaymentV1Request(); // SettleB402PaymentV1Request | + Long recvWindow = 5000L; // Long | Allowed time deviation in milliseconds (default: 5000, max: 60000). + String nonce = "unique-nonce-string"; // String | Unique request identifier for anti-replay; falls back to X-OC-SIGN if omitted. + try { + SettleB402PaymentV1Response result = apiInstance.settleB402PaymentV1(settleB402PaymentV1Request) + .recvWindow(recvWindow) + .nonce(nonce) + .execute(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling B402PaymentsApi#settleB402PaymentV1"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **settleB402PaymentV1Request** | [**SettleB402PaymentV1Request**](SettleB402PaymentV1Request.md)| | | +| **recvWindow** | **Long**| Allowed time deviation in milliseconds (default: 5000, max: 60000). | [optional] | +| **nonce** | **String**| Unique request identifier for anti-replay; falls back to X-OC-SIGN if omitted. | [optional] | + +### Return type + +[**SettleB402PaymentV1Response**](SettleB402PaymentV1Response.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Legacy settlement result or a B402 business error envelope. | - | +| **401** | Unauthorized. The request is missing or contains invalid Web3 API credentials. | - | +| **403** | Forbidden. Check the API Key's B402 Payments permission, IP whitelist, and endpoint allowlist. | - | +| **429** | Rate limit exceeded. | - | +| **503** | B402 is temporarily unavailable. | - | + + +# **settleB402PaymentV2** +> SettleB402PaymentV2Response settleB402PaymentV2(settleB402PaymentV2Request).recvWindow(recvWindow).nonce(nonce).execute(); + +Settle B402 Payment V2 + +Submit a verified x402 V2 authorization on-chain. This operation can move real funds and is irreversible. For `permit2-upto`, provide `settleAmount` in atomic units. Business failure is returned as HTTP 200 with `data.success=false`; reconcile any non-empty transaction hash before retrying. + +### Example +```java +// Import classes: +import com.binance.connector.client.web3_wallet.ApiClient; +import com.binance.connector.client.web3_wallet.ApiException; +import com.binance.connector.client.web3_wallet.Configuration; +import com.binance.connector.client.web3_wallet.models.*; +import com.binance.connector.client.web3_wallet.rest.api.B402PaymentsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://web3.binance.com/build"); + + B402PaymentsApi apiInstance = new B402PaymentsApi(defaultClient); + SettleB402PaymentV2Request settleB402PaymentV2Request = new SettleB402PaymentV2Request(); // SettleB402PaymentV2Request | + Long recvWindow = 5000L; // Long | Allowed time deviation in milliseconds (default: 5000, max: 60000). + String nonce = "unique-nonce-string"; // String | Unique request identifier for anti-replay; falls back to X-OC-SIGN if omitted. + try { + SettleB402PaymentV2Response result = apiInstance.settleB402PaymentV2(settleB402PaymentV2Request) + .recvWindow(recvWindow) + .nonce(nonce) + .execute(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling B402PaymentsApi#settleB402PaymentV2"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **settleB402PaymentV2Request** | [**SettleB402PaymentV2Request**](SettleB402PaymentV2Request.md)| | | +| **recvWindow** | **Long**| Allowed time deviation in milliseconds (default: 5000, max: 60000). | [optional] | +| **nonce** | **String**| Unique request identifier for anti-replay; falls back to X-OC-SIGN if omitted. | [optional] | + +### Return type + +[**SettleB402PaymentV2Response**](SettleB402PaymentV2Response.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Settlement result, or a B402 business error envelope. | - | +| **401** | Unauthorized. The request is missing or contains invalid Web3 API credentials. | - | +| **403** | Forbidden. Check the API Key's B402 Payments permission, IP whitelist, and endpoint allowlist. | - | +| **429** | Rate limit exceeded. | - | +| **503** | B402 is temporarily unavailable. | - | + + +# **verifyB402PaymentV1** +> VerifyB402PaymentV1Response verifyB402PaymentV1(verifyB402PaymentV1Request).recvWindow(recvWindow).nonce(nonce).execute(); + +Verify B402 Payment V1 + +Legacy V1 off-chain verification endpoint. New integrations should use V2. Portal identity is resolved from the API Key project, so `merchantId` is omitted from the external request. + +### Example +```java +// Import classes: +import com.binance.connector.client.web3_wallet.ApiClient; +import com.binance.connector.client.web3_wallet.ApiException; +import com.binance.connector.client.web3_wallet.Configuration; +import com.binance.connector.client.web3_wallet.models.*; +import com.binance.connector.client.web3_wallet.rest.api.B402PaymentsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://web3.binance.com/build"); + + B402PaymentsApi apiInstance = new B402PaymentsApi(defaultClient); + VerifyB402PaymentV1Request verifyB402PaymentV1Request = new VerifyB402PaymentV1Request(); // VerifyB402PaymentV1Request | + Long recvWindow = 5000L; // Long | Allowed time deviation in milliseconds (default: 5000, max: 60000). + String nonce = "unique-nonce-string"; // String | Unique request identifier for anti-replay; falls back to X-OC-SIGN if omitted. + try { + VerifyB402PaymentV1Response result = apiInstance.verifyB402PaymentV1(verifyB402PaymentV1Request) + .recvWindow(recvWindow) + .nonce(nonce) + .execute(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling B402PaymentsApi#verifyB402PaymentV1"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **verifyB402PaymentV1Request** | [**VerifyB402PaymentV1Request**](VerifyB402PaymentV1Request.md)| | | +| **recvWindow** | **Long**| Allowed time deviation in milliseconds (default: 5000, max: 60000). | [optional] | +| **nonce** | **String**| Unique request identifier for anti-replay; falls back to X-OC-SIGN if omitted. | [optional] | + +### Return type + +[**VerifyB402PaymentV1Response**](VerifyB402PaymentV1Response.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Legacy verification result or a B402 business error envelope. | - | +| **401** | Unauthorized. The request is missing or contains invalid Web3 API credentials. | - | +| **403** | Forbidden. Check the API Key's B402 Payments permission, IP whitelist, and endpoint allowlist. | - | +| **429** | Rate limit exceeded. | - | +| **503** | B402 is temporarily unavailable. | - | + + +# **verifyB402PaymentV2** +> VerifyB402PaymentV2Response verifyB402PaymentV2(verifyB402PaymentV2Request).recvWindow(recvWindow).nonce(nonce).execute(); + +Verify B402 Payment V2 + +Validate an x402 V2 payment authorization off-chain without spending funds or broadcasting a transaction. Portal identity is resolved from the authenticated API Key project; omit `merchantId`. A validation failure is returned as HTTP 200 with `data.isValid=false`. + +### Example +```java +// Import classes: +import com.binance.connector.client.web3_wallet.ApiClient; +import com.binance.connector.client.web3_wallet.ApiException; +import com.binance.connector.client.web3_wallet.Configuration; +import com.binance.connector.client.web3_wallet.models.*; +import com.binance.connector.client.web3_wallet.rest.api.B402PaymentsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://web3.binance.com/build"); + + B402PaymentsApi apiInstance = new B402PaymentsApi(defaultClient); + VerifyB402PaymentV2Request verifyB402PaymentV2Request = new VerifyB402PaymentV2Request(); // VerifyB402PaymentV2Request | + Long recvWindow = 5000L; // Long | Allowed time deviation in milliseconds (default: 5000, max: 60000). + String nonce = "unique-nonce-string"; // String | Unique request identifier for anti-replay; falls back to X-OC-SIGN if omitted. + try { + VerifyB402PaymentV2Response result = apiInstance.verifyB402PaymentV2(verifyB402PaymentV2Request) + .recvWindow(recvWindow) + .nonce(nonce) + .execute(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling B402PaymentsApi#verifyB402PaymentV2"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **verifyB402PaymentV2Request** | [**VerifyB402PaymentV2Request**](VerifyB402PaymentV2Request.md)| | | +| **recvWindow** | **Long**| Allowed time deviation in milliseconds (default: 5000, max: 60000). | [optional] | +| **nonce** | **String**| Unique request identifier for anti-replay; falls back to X-OC-SIGN if omitted. | [optional] | + +### Return type + +[**VerifyB402PaymentV2Response**](VerifyB402PaymentV2Response.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Verification result, or a B402 business error envelope. | - | +| **401** | Unauthorized. The request is missing or contains invalid Web3 API credentials. | - | +| **403** | Forbidden. Check the API Key's B402 Payments permission, IP whitelist, and endpoint allowlist. | - | +| **429** | Rate limit exceeded. | - | +| **503** | B402 is temporarily unavailable. | - | + diff --git a/clients/web3-wallet/docs/B402Permit2Authorization.md b/clients/web3-wallet/docs/B402Permit2Authorization.md new file mode 100644 index 0000000..434dfd2 --- /dev/null +++ b/clients/web3-wallet/docs/B402Permit2Authorization.md @@ -0,0 +1,18 @@ + + +# B402Permit2Authorization + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**permitted** | [**B402Permit2AuthorizationPermitted**](B402Permit2AuthorizationPermitted.md) | | | +|**from** | **String** | | | +|**spender** | **String** | | | +|**nonce** | **String** | | | +|**deadline** | **String** | | | +|**witness** | [**B402Permit2AuthorizationWitness**](B402Permit2AuthorizationWitness.md) | | | + + + diff --git a/clients/web3-wallet/docs/B402Permit2AuthorizationPermitted.md b/clients/web3-wallet/docs/B402Permit2AuthorizationPermitted.md new file mode 100644 index 0000000..23b037a --- /dev/null +++ b/clients/web3-wallet/docs/B402Permit2AuthorizationPermitted.md @@ -0,0 +1,14 @@ + + +# B402Permit2AuthorizationPermitted + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**token** | **String** | | | +|**amount** | **String** | | | + + + diff --git a/clients/web3-wallet/docs/B402Permit2AuthorizationWitness.md b/clients/web3-wallet/docs/B402Permit2AuthorizationWitness.md new file mode 100644 index 0000000..c578cec --- /dev/null +++ b/clients/web3-wallet/docs/B402Permit2AuthorizationWitness.md @@ -0,0 +1,15 @@ + + +# B402Permit2AuthorizationWitness + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**to** | **String** | | | +|**facilitator** | **String** | | [optional] | +|**validAfter** | **String** | | | + + + diff --git a/clients/web3-wallet/docs/B402Permit2Permitted.md b/clients/web3-wallet/docs/B402Permit2Permitted.md new file mode 100644 index 0000000..8ae68ab --- /dev/null +++ b/clients/web3-wallet/docs/B402Permit2Permitted.md @@ -0,0 +1,14 @@ + + +# B402Permit2Permitted + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**token** | **String** | | | +|**amount** | **String** | | | + + + diff --git a/clients/web3-wallet/docs/B402Permit2Witness.md b/clients/web3-wallet/docs/B402Permit2Witness.md new file mode 100644 index 0000000..71365fc --- /dev/null +++ b/clients/web3-wallet/docs/B402Permit2Witness.md @@ -0,0 +1,15 @@ + + +# B402Permit2Witness + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**to** | **String** | | | +|**facilitator** | **String** | | [optional] | +|**validAfter** | **String** | | | + + + diff --git a/clients/web3-wallet/docs/B402RequestEnvelopeSupported.md b/clients/web3-wallet/docs/B402RequestEnvelopeSupported.md new file mode 100644 index 0000000..be7a9e0 --- /dev/null +++ b/clients/web3-wallet/docs/B402RequestEnvelopeSupported.md @@ -0,0 +1,13 @@ + + +# B402RequestEnvelopeSupported + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**body** | **Object** | | | + + + diff --git a/clients/web3-wallet/docs/B402ResourceInfoV2.md b/clients/web3-wallet/docs/B402ResourceInfoV2.md new file mode 100644 index 0000000..7a5a6c4 --- /dev/null +++ b/clients/web3-wallet/docs/B402ResourceInfoV2.md @@ -0,0 +1,15 @@ + + +# B402ResourceInfoV2 + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**url** | **URI** | | | +|**description** | **String** | | [optional] | +|**mimeType** | **String** | | [optional] | + + + diff --git a/clients/web3-wallet/docs/B402SettleDataV1.md b/clients/web3-wallet/docs/B402SettleDataV1.md new file mode 100644 index 0000000..04d8195 --- /dev/null +++ b/clients/web3-wallet/docs/B402SettleDataV1.md @@ -0,0 +1,20 @@ + + +# B402SettleDataV1 + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**success** | **Boolean** | | | +|**transaction** | **String** | | [optional] | +|**payer** | **String** | | [optional] | +|**network** | **String** | | [optional] | +|**amount** | **String** | | [optional] | +|**confirmations** | **Integer** | | [optional] | +|**errorReason** | **String** | | [optional] | +|**errorMessage** | **String** | | [optional] | + + + diff --git a/clients/web3-wallet/docs/B402SettleDataV2.md b/clients/web3-wallet/docs/B402SettleDataV2.md new file mode 100644 index 0000000..9672cda --- /dev/null +++ b/clients/web3-wallet/docs/B402SettleDataV2.md @@ -0,0 +1,20 @@ + + +# B402SettleDataV2 + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**success** | **Boolean** | | | +|**transaction** | **String** | | | +|**payer** | **String** | | [optional] | +|**network** | **String** | | | +|**amount** | **String** | | [optional] | +|**errorReason** | **String** | | [optional] | +|**errorMessage** | **String** | | [optional] | +|**extensions** | **Map<String, Object>** | | [optional] | + + + diff --git a/clients/web3-wallet/docs/B402SettleEnvelopeV1.md b/clients/web3-wallet/docs/B402SettleEnvelopeV1.md new file mode 100644 index 0000000..86ea149 --- /dev/null +++ b/clients/web3-wallet/docs/B402SettleEnvelopeV1.md @@ -0,0 +1,13 @@ + + +# B402SettleEnvelopeV1 + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**body** | [**B402SettleEnvelopeV1Body**](B402SettleEnvelopeV1Body.md) | | | + + + diff --git a/clients/web3-wallet/docs/B402SettleEnvelopeV1Body.md b/clients/web3-wallet/docs/B402SettleEnvelopeV1Body.md new file mode 100644 index 0000000..fc6440e --- /dev/null +++ b/clients/web3-wallet/docs/B402SettleEnvelopeV1Body.md @@ -0,0 +1,24 @@ + + +# B402SettleEnvelopeV1Body + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**x402Version** | [**X402VersionEnum**](#X402VersionEnum) | | | +|**paymentPayload** | [**B402SettleRequestV1AllOfPaymentPayload**](B402SettleRequestV1AllOfPaymentPayload.md) | | | +|**paymentRequirements** | [**B402SettleRequestV1AllOfPaymentRequirements**](B402SettleRequestV1AllOfPaymentRequirements.md) | | | +|**settleAmount** | **String** | | [optional] | + + + +## Enum: X402VersionEnum + +| Name | Value | +|---- | -----| +| X402_VERSION_1 | 1 | + + + diff --git a/clients/web3-wallet/docs/B402SettleEnvelopeV2.md b/clients/web3-wallet/docs/B402SettleEnvelopeV2.md new file mode 100644 index 0000000..a2c9571 --- /dev/null +++ b/clients/web3-wallet/docs/B402SettleEnvelopeV2.md @@ -0,0 +1,13 @@ + + +# B402SettleEnvelopeV2 + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**body** | [**B402SettleEnvelopeV2Body**](B402SettleEnvelopeV2Body.md) | | | + + + diff --git a/clients/web3-wallet/docs/B402SettleEnvelopeV2Body.md b/clients/web3-wallet/docs/B402SettleEnvelopeV2Body.md new file mode 100644 index 0000000..072c1c6 --- /dev/null +++ b/clients/web3-wallet/docs/B402SettleEnvelopeV2Body.md @@ -0,0 +1,24 @@ + + +# B402SettleEnvelopeV2Body + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**x402Version** | [**X402VersionEnum**](#X402VersionEnum) | | | +|**paymentPayload** | [**B402SettleEnvelopeV2BodyAllOfPaymentPayload**](B402SettleEnvelopeV2BodyAllOfPaymentPayload.md) | | | +|**paymentRequirements** | [**B402SettleEnvelopeV2BodyAllOfPaymentPayloadAccepted**](B402SettleEnvelopeV2BodyAllOfPaymentPayloadAccepted.md) | | | +|**settleAmount** | **String** | | [optional] | + + + +## Enum: X402VersionEnum + +| Name | Value | +|---- | -----| +| X402_VERSION_2 | 2 | + + + diff --git a/clients/web3-wallet/docs/B402SettleEnvelopeV2BodyAllOfPaymentPayload.md b/clients/web3-wallet/docs/B402SettleEnvelopeV2BodyAllOfPaymentPayload.md new file mode 100644 index 0000000..7d99c5a --- /dev/null +++ b/clients/web3-wallet/docs/B402SettleEnvelopeV2BodyAllOfPaymentPayload.md @@ -0,0 +1,25 @@ + + +# B402SettleEnvelopeV2BodyAllOfPaymentPayload + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**x402Version** | [**X402VersionEnum**](#X402VersionEnum) | | | +|**resource** | [**B402SettleRequestV2AllOfPaymentPayloadResource**](B402SettleRequestV2AllOfPaymentPayloadResource.md) | | | +|**accepted** | [**B402SettleEnvelopeV2BodyAllOfPaymentPayloadAccepted**](B402SettleEnvelopeV2BodyAllOfPaymentPayloadAccepted.md) | | | +|**payload** | [**B402SettleRequestV2AllOfPaymentPayloadPayload**](B402SettleRequestV2AllOfPaymentPayloadPayload.md) | | | +|**extensions** | **B402PaymentPayloadV2Extensions** | | [optional] | + + + +## Enum: X402VersionEnum + +| Name | Value | +|---- | -----| +| X402_VERSION_2 | 2 | + + + diff --git a/clients/web3-wallet/docs/B402SettleEnvelopeV2BodyAllOfPaymentPayloadAccepted.md b/clients/web3-wallet/docs/B402SettleEnvelopeV2BodyAllOfPaymentPayloadAccepted.md new file mode 100644 index 0000000..f8c49b4 --- /dev/null +++ b/clients/web3-wallet/docs/B402SettleEnvelopeV2BodyAllOfPaymentPayloadAccepted.md @@ -0,0 +1,28 @@ + + +# B402SettleEnvelopeV2BodyAllOfPaymentPayloadAccepted + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**scheme** | [**SchemeEnum**](#SchemeEnum) | | | +|**network** | **String** | | | +|**amount** | **String** | | | +|**asset** | **String** | | | +|**payTo** | **String** | | | +|**maxTimeoutSeconds** | **Integer** | | | +|**extra** | [**B402PaymentRequirementsV2Extra**](B402PaymentRequirementsV2Extra.md) | | | + + + +## Enum: SchemeEnum + +| Name | Value | +|---- | -----| +| exact | "exact" | +| upto | "upto" | + + + diff --git a/clients/web3-wallet/docs/B402SettleRequestV1.md b/clients/web3-wallet/docs/B402SettleRequestV1.md new file mode 100644 index 0000000..9307835 --- /dev/null +++ b/clients/web3-wallet/docs/B402SettleRequestV1.md @@ -0,0 +1,24 @@ + + +# B402SettleRequestV1 + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**x402Version** | [**X402VersionEnum**](#X402VersionEnum) | | | +|**paymentPayload** | [**B402SettleRequestV1AllOfPaymentPayload**](B402SettleRequestV1AllOfPaymentPayload.md) | | | +|**paymentRequirements** | [**B402SettleRequestV1AllOfPaymentRequirements**](B402SettleRequestV1AllOfPaymentRequirements.md) | | | +|**settleAmount** | **String** | | [optional] | + + + +## Enum: X402VersionEnum + +| Name | Value | +|---- | -----| +| X402_VERSION_1 | 1 | + + + diff --git a/clients/web3-wallet/docs/B402SettleRequestV1AllOfPaymentPayload.md b/clients/web3-wallet/docs/B402SettleRequestV1AllOfPaymentPayload.md new file mode 100644 index 0000000..587044a --- /dev/null +++ b/clients/web3-wallet/docs/B402SettleRequestV1AllOfPaymentPayload.md @@ -0,0 +1,32 @@ + + +# B402SettleRequestV1AllOfPaymentPayload + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**x402Version** | [**X402VersionEnum**](#X402VersionEnum) | | | +|**scheme** | [**SchemeEnum**](#SchemeEnum) | | | +|**network** | **String** | | | +|**payload** | [**B402SettleRequestV2AllOfPaymentPayloadPayload**](B402SettleRequestV2AllOfPaymentPayloadPayload.md) | | | + + + +## Enum: X402VersionEnum + +| Name | Value | +|---- | -----| +| X402_VERSION_1 | 1 | + + + +## Enum: SchemeEnum + +| Name | Value | +|---- | -----| +| exact | "exact" | + + + diff --git a/clients/web3-wallet/docs/B402SettleRequestV1AllOfPaymentRequirements.md b/clients/web3-wallet/docs/B402SettleRequestV1AllOfPaymentRequirements.md new file mode 100644 index 0000000..8606e8c --- /dev/null +++ b/clients/web3-wallet/docs/B402SettleRequestV1AllOfPaymentRequirements.md @@ -0,0 +1,31 @@ + + +# B402SettleRequestV1AllOfPaymentRequirements + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**scheme** | [**SchemeEnum**](#SchemeEnum) | | | +|**network** | **String** | | | +|**amount** | **String** | | | +|**resource** | **URI** | | [optional] | +|**description** | **String** | | [optional] | +|**payTo** | **String** | | | +|**asset** | **String** | | | +|**maxTimeoutSeconds** | **Integer** | | | +|**mimeType** | **String** | | [optional] | +|**outputSchema** | **Map<String, Object>** | | [optional] | +|**extra** | [**B402PaymentKindV1Extra**](B402PaymentKindV1Extra.md) | | [optional] | + + + +## Enum: SchemeEnum + +| Name | Value | +|---- | -----| +| exact | "exact" | + + + diff --git a/clients/web3-wallet/docs/B402SettleRequestV2.md b/clients/web3-wallet/docs/B402SettleRequestV2.md new file mode 100644 index 0000000..f303572 --- /dev/null +++ b/clients/web3-wallet/docs/B402SettleRequestV2.md @@ -0,0 +1,24 @@ + + +# B402SettleRequestV2 + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**x402Version** | [**X402VersionEnum**](#X402VersionEnum) | | | +|**paymentPayload** | [**B402SettleRequestV2AllOfPaymentPayload**](B402SettleRequestV2AllOfPaymentPayload.md) | | | +|**paymentRequirements** | [**B402SettleRequestV2AllOfPaymentPayloadAccepted**](B402SettleRequestV2AllOfPaymentPayloadAccepted.md) | | | +|**settleAmount** | **String** | | [optional] | + + + +## Enum: X402VersionEnum + +| Name | Value | +|---- | -----| +| X402_VERSION_2 | 2 | + + + diff --git a/clients/web3-wallet/docs/B402SettleRequestV2AllOfPaymentPayload.md b/clients/web3-wallet/docs/B402SettleRequestV2AllOfPaymentPayload.md new file mode 100644 index 0000000..7e10225 --- /dev/null +++ b/clients/web3-wallet/docs/B402SettleRequestV2AllOfPaymentPayload.md @@ -0,0 +1,25 @@ + + +# B402SettleRequestV2AllOfPaymentPayload + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**x402Version** | [**X402VersionEnum**](#X402VersionEnum) | | | +|**resource** | [**B402SettleRequestV2AllOfPaymentPayloadResource**](B402SettleRequestV2AllOfPaymentPayloadResource.md) | | | +|**accepted** | [**B402SettleRequestV2AllOfPaymentPayloadAccepted**](B402SettleRequestV2AllOfPaymentPayloadAccepted.md) | | | +|**payload** | [**B402SettleRequestV2AllOfPaymentPayloadPayload**](B402SettleRequestV2AllOfPaymentPayloadPayload.md) | | | +|**extensions** | **Map<String, Object>** | | [optional] | + + + +## Enum: X402VersionEnum + +| Name | Value | +|---- | -----| +| X402_VERSION_2 | 2 | + + + diff --git a/clients/web3-wallet/docs/B402SettleRequestV2AllOfPaymentPayloadAccepted.md b/clients/web3-wallet/docs/B402SettleRequestV2AllOfPaymentPayloadAccepted.md new file mode 100644 index 0000000..14ce1a1 --- /dev/null +++ b/clients/web3-wallet/docs/B402SettleRequestV2AllOfPaymentPayloadAccepted.md @@ -0,0 +1,28 @@ + + +# B402SettleRequestV2AllOfPaymentPayloadAccepted + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**scheme** | [**SchemeEnum**](#SchemeEnum) | | | +|**network** | **String** | | | +|**amount** | **String** | | | +|**asset** | **String** | | | +|**payTo** | **String** | | | +|**maxTimeoutSeconds** | **Integer** | | | +|**extra** | [**Object**](Object.md) | | | + + + +## Enum: SchemeEnum + +| Name | Value | +|---- | -----| +| exact | "exact" | +| upto | "upto" | + + + diff --git a/clients/web3-wallet/docs/B402SettleRequestV2AllOfPaymentPayloadPayload.md b/clients/web3-wallet/docs/B402SettleRequestV2AllOfPaymentPayloadPayload.md new file mode 100644 index 0000000..4c28a1c --- /dev/null +++ b/clients/web3-wallet/docs/B402SettleRequestV2AllOfPaymentPayloadPayload.md @@ -0,0 +1,15 @@ + + +# B402SettleRequestV2AllOfPaymentPayloadPayload + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**signature** | **String** | | | +|**authorization** | [**B402PayloadDetailAuthorization**](B402PayloadDetailAuthorization.md) | | [optional] | +|**permit2Authorization** | [**B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2Authorization**](B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2Authorization.md) | | [optional] | + + + diff --git a/clients/web3-wallet/docs/B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2Authorization.md b/clients/web3-wallet/docs/B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2Authorization.md new file mode 100644 index 0000000..7724af3 --- /dev/null +++ b/clients/web3-wallet/docs/B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2Authorization.md @@ -0,0 +1,18 @@ + + +# B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2Authorization + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**permitted** | [**B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationPermitted**](B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationPermitted.md) | | | +|**from** | **String** | | | +|**spender** | **String** | | | +|**nonce** | **String** | | | +|**deadline** | **String** | | | +|**witness** | [**B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationWitness**](B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationWitness.md) | | | + + + diff --git a/clients/web3-wallet/docs/B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationPermitted.md b/clients/web3-wallet/docs/B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationPermitted.md new file mode 100644 index 0000000..e862ca9 --- /dev/null +++ b/clients/web3-wallet/docs/B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationPermitted.md @@ -0,0 +1,14 @@ + + +# B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationPermitted + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**token** | **String** | | | +|**amount** | **String** | | | + + + diff --git a/clients/web3-wallet/docs/B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationWitness.md b/clients/web3-wallet/docs/B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationWitness.md new file mode 100644 index 0000000..efc1186 --- /dev/null +++ b/clients/web3-wallet/docs/B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationWitness.md @@ -0,0 +1,15 @@ + + +# B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationWitness + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**to** | **String** | | | +|**facilitator** | **String** | | [optional] | +|**validAfter** | **String** | | | + + + diff --git a/clients/web3-wallet/docs/B402SettleRequestV2AllOfPaymentPayloadResource.md b/clients/web3-wallet/docs/B402SettleRequestV2AllOfPaymentPayloadResource.md new file mode 100644 index 0000000..b6ceb92 --- /dev/null +++ b/clients/web3-wallet/docs/B402SettleRequestV2AllOfPaymentPayloadResource.md @@ -0,0 +1,15 @@ + + +# B402SettleRequestV2AllOfPaymentPayloadResource + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**url** | **URI** | | | +|**description** | **String** | | [optional] | +|**mimeType** | **String** | | [optional] | + + + diff --git a/clients/web3-wallet/docs/B402SettleResponseV1.md b/clients/web3-wallet/docs/B402SettleResponseV1.md new file mode 100644 index 0000000..267c6e9 --- /dev/null +++ b/clients/web3-wallet/docs/B402SettleResponseV1.md @@ -0,0 +1,19 @@ + + +# B402SettleResponseV1 + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**status** | **String** | | [optional] | +|**type** | **String** | | [optional] | +|**code** | **String** | | [optional] | +|**errorData** | **String** | | [optional] | +|**data** | [**B402SettleResponseV1Data**](B402SettleResponseV1Data.md) | | [optional] | +|**subData** | **Object** | | [optional] | +|**params** | **Object** | | [optional] | + + + diff --git a/clients/web3-wallet/docs/B402SettleResponseV1Data.md b/clients/web3-wallet/docs/B402SettleResponseV1Data.md new file mode 100644 index 0000000..7ea0469 --- /dev/null +++ b/clients/web3-wallet/docs/B402SettleResponseV1Data.md @@ -0,0 +1,20 @@ + + +# B402SettleResponseV1Data + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**success** | **Boolean** | | | +|**transaction** | **String** | | [optional] | +|**payer** | **String** | | [optional] | +|**network** | **String** | | [optional] | +|**amount** | **String** | | [optional] | +|**confirmations** | **Integer** | | [optional] | +|**errorReason** | **String** | | [optional] | +|**errorMessage** | **String** | | [optional] | + + + diff --git a/clients/web3-wallet/docs/B402SettleResponseV2.md b/clients/web3-wallet/docs/B402SettleResponseV2.md new file mode 100644 index 0000000..22ccb4f --- /dev/null +++ b/clients/web3-wallet/docs/B402SettleResponseV2.md @@ -0,0 +1,19 @@ + + +# B402SettleResponseV2 + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**status** | **String** | | [optional] | +|**type** | **String** | | [optional] | +|**code** | **String** | | [optional] | +|**errorData** | **String** | | [optional] | +|**data** | [**B402SettleResponseV2Data**](B402SettleResponseV2Data.md) | | [optional] | +|**subData** | **Object** | | [optional] | +|**params** | **Object** | | [optional] | + + + diff --git a/clients/web3-wallet/docs/B402SettleResponseV2Data.md b/clients/web3-wallet/docs/B402SettleResponseV2Data.md new file mode 100644 index 0000000..314beae --- /dev/null +++ b/clients/web3-wallet/docs/B402SettleResponseV2Data.md @@ -0,0 +1,20 @@ + + +# B402SettleResponseV2Data + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**success** | **Boolean** | | | +|**transaction** | **String** | | | +|**payer** | **String** | | [optional] | +|**network** | **String** | | | +|**amount** | **String** | | [optional] | +|**errorReason** | **String** | | [optional] | +|**errorMessage** | **String** | | [optional] | +|**extensions** | **Map<String, Object>** | | [optional] | + + + diff --git a/clients/web3-wallet/docs/B402SupportedDataV1.md b/clients/web3-wallet/docs/B402SupportedDataV1.md new file mode 100644 index 0000000..6a6ca61 --- /dev/null +++ b/clients/web3-wallet/docs/B402SupportedDataV1.md @@ -0,0 +1,15 @@ + + +# B402SupportedDataV1 + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**kinds** | [**List<B402SupportedDataV1KindsInner>**](B402SupportedDataV1KindsInner.md) | | [optional] | +|**extensions** | **List<String>** | | [optional] | +|**signers** | **Map<String, List<String>>** | | [optional] | + + + diff --git a/clients/web3-wallet/docs/B402SupportedDataV1KindsInner.md b/clients/web3-wallet/docs/B402SupportedDataV1KindsInner.md new file mode 100644 index 0000000..c19a0e7 --- /dev/null +++ b/clients/web3-wallet/docs/B402SupportedDataV1KindsInner.md @@ -0,0 +1,32 @@ + + +# B402SupportedDataV1KindsInner + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**x402Version** | [**X402VersionEnum**](#X402VersionEnum) | | [optional] | +|**scheme** | [**SchemeEnum**](#SchemeEnum) | | [optional] | +|**network** | **String** | | [optional] | +|**extra** | [**B402PaymentKindV1Extra**](B402PaymentKindV1Extra.md) | | [optional] | + + + +## Enum: X402VersionEnum + +| Name | Value | +|---- | -----| +| X402_VERSION_1 | 1 | + + + +## Enum: SchemeEnum + +| Name | Value | +|---- | -----| +| exact | "exact" | + + + diff --git a/clients/web3-wallet/docs/B402SupportedDataV2.md b/clients/web3-wallet/docs/B402SupportedDataV2.md new file mode 100644 index 0000000..46aaeae --- /dev/null +++ b/clients/web3-wallet/docs/B402SupportedDataV2.md @@ -0,0 +1,15 @@ + + +# B402SupportedDataV2 + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**kinds** | [**List<B402SupportedDataV2KindsInner>**](B402SupportedDataV2KindsInner.md) | | | +|**extensions** | **List<String>** | | | +|**signers** | **Map<String, List<String>>** | | | + + + diff --git a/clients/web3-wallet/docs/B402SupportedDataV2KindsInner.md b/clients/web3-wallet/docs/B402SupportedDataV2KindsInner.md new file mode 100644 index 0000000..f375223 --- /dev/null +++ b/clients/web3-wallet/docs/B402SupportedDataV2KindsInner.md @@ -0,0 +1,33 @@ + + +# B402SupportedDataV2KindsInner + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**x402Version** | [**X402VersionEnum**](#X402VersionEnum) | | | +|**scheme** | [**SchemeEnum**](#SchemeEnum) | | | +|**network** | **String** | | | +|**extra** | [**B402SupportedDataV2KindsInnerExtra**](B402SupportedDataV2KindsInnerExtra.md) | | | + + + +## Enum: X402VersionEnum + +| Name | Value | +|---- | -----| +| X402_VERSION_2 | 2 | + + + +## Enum: SchemeEnum + +| Name | Value | +|---- | -----| +| exact | "exact" | +| upto | "upto" | + + + diff --git a/clients/web3-wallet/docs/B402SupportedDataV2KindsInnerExtra.md b/clients/web3-wallet/docs/B402SupportedDataV2KindsInnerExtra.md new file mode 100644 index 0000000..f4b946c --- /dev/null +++ b/clients/web3-wallet/docs/B402SupportedDataV2KindsInnerExtra.md @@ -0,0 +1,27 @@ + + +# B402SupportedDataV2KindsInnerExtra + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **String** | | | +|**version** | **String** | | | +|**assetTransferMethod** | [**AssetTransferMethodEnum**](#AssetTransferMethodEnum) | | | +|**signerAddress** | **String** | | | +|**spenderAddress** | **String** | | [optional] | + + + +## Enum: AssetTransferMethodEnum + +| Name | Value | +|---- | -----| +| EIP3009 | "eip3009" | +| PERMIT2_EXACT | "permit2-exact" | +| PERMIT2_UPTO | "permit2-upto" | + + + diff --git a/clients/web3-wallet/docs/B402SupportedResponseV1.md b/clients/web3-wallet/docs/B402SupportedResponseV1.md new file mode 100644 index 0000000..a7fade5 --- /dev/null +++ b/clients/web3-wallet/docs/B402SupportedResponseV1.md @@ -0,0 +1,19 @@ + + +# B402SupportedResponseV1 + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**status** | **String** | | [optional] | +|**type** | **String** | | [optional] | +|**code** | **String** | | [optional] | +|**errorData** | **String** | | [optional] | +|**data** | [**B402SupportedResponseV1Data**](B402SupportedResponseV1Data.md) | | [optional] | +|**subData** | **Object** | | [optional] | +|**params** | **Object** | | [optional] | + + + diff --git a/clients/web3-wallet/docs/B402SupportedResponseV1Data.md b/clients/web3-wallet/docs/B402SupportedResponseV1Data.md new file mode 100644 index 0000000..74f5e2d --- /dev/null +++ b/clients/web3-wallet/docs/B402SupportedResponseV1Data.md @@ -0,0 +1,15 @@ + + +# B402SupportedResponseV1Data + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**kinds** | [**List<B402SupportedDataV1KindsInner>**](B402SupportedDataV1KindsInner.md) | | [optional] | +|**extensions** | **List<String>** | | [optional] | +|**signers** | **Map<String, List<String>>** | | [optional] | + + + diff --git a/clients/web3-wallet/docs/B402SupportedResponseV2.md b/clients/web3-wallet/docs/B402SupportedResponseV2.md new file mode 100644 index 0000000..0c7fea2 --- /dev/null +++ b/clients/web3-wallet/docs/B402SupportedResponseV2.md @@ -0,0 +1,19 @@ + + +# B402SupportedResponseV2 + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**status** | **String** | | [optional] | +|**type** | **String** | | [optional] | +|**code** | **String** | | [optional] | +|**errorData** | **String** | | [optional] | +|**data** | [**B402SupportedResponseV2Data**](B402SupportedResponseV2Data.md) | | [optional] | +|**subData** | **Object** | | [optional] | +|**params** | **Object** | | [optional] | + + + diff --git a/clients/web3-wallet/docs/B402SupportedResponseV2Data.md b/clients/web3-wallet/docs/B402SupportedResponseV2Data.md new file mode 100644 index 0000000..30ba8e7 --- /dev/null +++ b/clients/web3-wallet/docs/B402SupportedResponseV2Data.md @@ -0,0 +1,15 @@ + + +# B402SupportedResponseV2Data + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**kinds** | [**List<B402SupportedDataV2KindsInner>**](B402SupportedDataV2KindsInner.md) | | | +|**extensions** | **List<String>** | | | +|**signers** | **Map<String, List<String>>** | | | + + + diff --git a/clients/web3-wallet/docs/B402VerifyDataV2.md b/clients/web3-wallet/docs/B402VerifyDataV2.md new file mode 100644 index 0000000..6681010 --- /dev/null +++ b/clients/web3-wallet/docs/B402VerifyDataV2.md @@ -0,0 +1,16 @@ + + +# B402VerifyDataV2 + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**isValid** | **Boolean** | | | +|**payer** | **String** | | [optional] | +|**invalidReason** | **String** | | [optional] | +|**invalidMessage** | **String** | | [optional] | + + + diff --git a/clients/web3-wallet/docs/B402VerifyEnvelopeV1.md b/clients/web3-wallet/docs/B402VerifyEnvelopeV1.md new file mode 100644 index 0000000..300ca18 --- /dev/null +++ b/clients/web3-wallet/docs/B402VerifyEnvelopeV1.md @@ -0,0 +1,13 @@ + + +# B402VerifyEnvelopeV1 + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**body** | [**B402VerifyEnvelopeV1Body**](B402VerifyEnvelopeV1Body.md) | | | + + + diff --git a/clients/web3-wallet/docs/B402VerifyEnvelopeV1Body.md b/clients/web3-wallet/docs/B402VerifyEnvelopeV1Body.md new file mode 100644 index 0000000..dbef69d --- /dev/null +++ b/clients/web3-wallet/docs/B402VerifyEnvelopeV1Body.md @@ -0,0 +1,23 @@ + + +# B402VerifyEnvelopeV1Body + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**x402Version** | [**X402VersionEnum**](#X402VersionEnum) | | | +|**paymentPayload** | [**B402VerifyRequestV1PaymentPayload**](B402VerifyRequestV1PaymentPayload.md) | | | +|**paymentRequirements** | [**B402VerifyRequestV1PaymentRequirements**](B402VerifyRequestV1PaymentRequirements.md) | | | + + + +## Enum: X402VersionEnum + +| Name | Value | +|---- | -----| +| X402_VERSION_1 | 1 | + + + diff --git a/clients/web3-wallet/docs/B402VerifyEnvelopeV2.md b/clients/web3-wallet/docs/B402VerifyEnvelopeV2.md new file mode 100644 index 0000000..481d492 --- /dev/null +++ b/clients/web3-wallet/docs/B402VerifyEnvelopeV2.md @@ -0,0 +1,13 @@ + + +# B402VerifyEnvelopeV2 + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**body** | [**B402VerifyEnvelopeV2Body**](B402VerifyEnvelopeV2Body.md) | | | + + + diff --git a/clients/web3-wallet/docs/B402VerifyEnvelopeV2Body.md b/clients/web3-wallet/docs/B402VerifyEnvelopeV2Body.md new file mode 100644 index 0000000..cc0166d --- /dev/null +++ b/clients/web3-wallet/docs/B402VerifyEnvelopeV2Body.md @@ -0,0 +1,23 @@ + + +# B402VerifyEnvelopeV2Body + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**x402Version** | [**X402VersionEnum**](#X402VersionEnum) | | | +|**paymentPayload** | [**B402VerifyRequestV2PaymentPayload**](B402VerifyRequestV2PaymentPayload.md) | | | +|**paymentRequirements** | [**B402PaymentPayloadV2Accepted**](B402PaymentPayloadV2Accepted.md) | | | + + + +## Enum: X402VersionEnum + +| Name | Value | +|---- | -----| +| X402_VERSION_2 | 2 | + + + diff --git a/clients/web3-wallet/docs/B402VerifyRequestV1.md b/clients/web3-wallet/docs/B402VerifyRequestV1.md new file mode 100644 index 0000000..ed599f9 --- /dev/null +++ b/clients/web3-wallet/docs/B402VerifyRequestV1.md @@ -0,0 +1,23 @@ + + +# B402VerifyRequestV1 + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**x402Version** | [**X402VersionEnum**](#X402VersionEnum) | | | +|**paymentPayload** | [**B402VerifyRequestV1PaymentPayload**](B402VerifyRequestV1PaymentPayload.md) | | | +|**paymentRequirements** | [**B402VerifyRequestV1PaymentRequirements**](B402VerifyRequestV1PaymentRequirements.md) | | | + + + +## Enum: X402VersionEnum + +| Name | Value | +|---- | -----| +| X402_VERSION_1 | 1 | + + + diff --git a/clients/web3-wallet/docs/B402VerifyRequestV1PaymentPayload.md b/clients/web3-wallet/docs/B402VerifyRequestV1PaymentPayload.md new file mode 100644 index 0000000..2b682ab --- /dev/null +++ b/clients/web3-wallet/docs/B402VerifyRequestV1PaymentPayload.md @@ -0,0 +1,32 @@ + + +# B402VerifyRequestV1PaymentPayload + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**x402Version** | [**X402VersionEnum**](#X402VersionEnum) | | | +|**scheme** | [**SchemeEnum**](#SchemeEnum) | | | +|**network** | **String** | | | +|**payload** | [**B402PaymentPayloadV2Payload**](B402PaymentPayloadV2Payload.md) | | | + + + +## Enum: X402VersionEnum + +| Name | Value | +|---- | -----| +| X402_VERSION_1 | 1 | + + + +## Enum: SchemeEnum + +| Name | Value | +|---- | -----| +| exact | "exact" | + + + diff --git a/clients/web3-wallet/docs/B402VerifyRequestV1PaymentRequirements.md b/clients/web3-wallet/docs/B402VerifyRequestV1PaymentRequirements.md new file mode 100644 index 0000000..014c0a4 --- /dev/null +++ b/clients/web3-wallet/docs/B402VerifyRequestV1PaymentRequirements.md @@ -0,0 +1,31 @@ + + +# B402VerifyRequestV1PaymentRequirements + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**scheme** | [**SchemeEnum**](#SchemeEnum) | | | +|**network** | **String** | | | +|**amount** | **String** | | | +|**resource** | **URI** | | [optional] | +|**description** | **String** | | [optional] | +|**payTo** | **String** | | | +|**asset** | **String** | | | +|**maxTimeoutSeconds** | **Integer** | | | +|**mimeType** | **String** | | [optional] | +|**outputSchema** | **Map<String, Object>** | | [optional] | +|**extra** | [**B402PaymentKindV1Extra**](B402PaymentKindV1Extra.md) | | [optional] | + + + +## Enum: SchemeEnum + +| Name | Value | +|---- | -----| +| exact | "exact" | + + + diff --git a/clients/web3-wallet/docs/B402VerifyRequestV2.md b/clients/web3-wallet/docs/B402VerifyRequestV2.md new file mode 100644 index 0000000..9d5e198 --- /dev/null +++ b/clients/web3-wallet/docs/B402VerifyRequestV2.md @@ -0,0 +1,23 @@ + + +# B402VerifyRequestV2 + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**x402Version** | [**X402VersionEnum**](#X402VersionEnum) | | | +|**paymentPayload** | [**B402VerifyRequestV2PaymentPayload**](B402VerifyRequestV2PaymentPayload.md) | | | +|**paymentRequirements** | [**B402PaymentPayloadV2Accepted**](B402PaymentPayloadV2Accepted.md) | | | + + + +## Enum: X402VersionEnum + +| Name | Value | +|---- | -----| +| X402_VERSION_2 | 2 | + + + diff --git a/clients/web3-wallet/docs/B402VerifyRequestV2PaymentPayload.md b/clients/web3-wallet/docs/B402VerifyRequestV2PaymentPayload.md new file mode 100644 index 0000000..82ed0d9 --- /dev/null +++ b/clients/web3-wallet/docs/B402VerifyRequestV2PaymentPayload.md @@ -0,0 +1,25 @@ + + +# B402VerifyRequestV2PaymentPayload + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**x402Version** | [**X402VersionEnum**](#X402VersionEnum) | | | +|**resource** | [**B402PaymentPayloadV2Resource**](B402PaymentPayloadV2Resource.md) | | | +|**accepted** | [**B402PaymentPayloadV2Accepted**](B402PaymentPayloadV2Accepted.md) | | | +|**payload** | [**B402PaymentPayloadV2Payload**](B402PaymentPayloadV2Payload.md) | | | +|**extensions** | **B402PaymentPayloadV2Extensions** | | [optional] | + + + +## Enum: X402VersionEnum + +| Name | Value | +|---- | -----| +| X402_VERSION_2 | 2 | + + + diff --git a/clients/web3-wallet/docs/B402VerifyResponseV1.md b/clients/web3-wallet/docs/B402VerifyResponseV1.md new file mode 100644 index 0000000..19f5c29 --- /dev/null +++ b/clients/web3-wallet/docs/B402VerifyResponseV1.md @@ -0,0 +1,19 @@ + + +# B402VerifyResponseV1 + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**status** | **String** | | [optional] | +|**type** | **String** | | [optional] | +|**code** | **String** | | [optional] | +|**errorData** | **String** | | [optional] | +|**data** | [**B402VerifyResponseV2Data**](B402VerifyResponseV2Data.md) | | [optional] | +|**subData** | **Object** | | [optional] | +|**params** | **Object** | | [optional] | + + + diff --git a/clients/web3-wallet/docs/B402VerifyResponseV2.md b/clients/web3-wallet/docs/B402VerifyResponseV2.md new file mode 100644 index 0000000..e84b6f2 --- /dev/null +++ b/clients/web3-wallet/docs/B402VerifyResponseV2.md @@ -0,0 +1,19 @@ + + +# B402VerifyResponseV2 + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**status** | **String** | | [optional] | +|**type** | **String** | | [optional] | +|**code** | **String** | | [optional] | +|**errorData** | **String** | | [optional] | +|**data** | [**B402VerifyResponseV2Data**](B402VerifyResponseV2Data.md) | | [optional] | +|**subData** | **Object** | | [optional] | +|**params** | **Object** | | [optional] | + + + diff --git a/clients/web3-wallet/docs/B402VerifyResponseV2Data.md b/clients/web3-wallet/docs/B402VerifyResponseV2Data.md new file mode 100644 index 0000000..d2184c3 --- /dev/null +++ b/clients/web3-wallet/docs/B402VerifyResponseV2Data.md @@ -0,0 +1,16 @@ + + +# B402VerifyResponseV2Data + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**isValid** | **Boolean** | | | +|**payer** | **String** | | [optional] | +|**invalidReason** | **String** | | [optional] | +|**invalidMessage** | **String** | | [optional] | + + + diff --git a/clients/web3-wallet/docs/BuildDeFiClaimTransactionRequest.md b/clients/web3-wallet/docs/BuildDeFiClaimTransactionRequest.md new file mode 100644 index 0000000..ebdbdd7 --- /dev/null +++ b/clients/web3-wallet/docs/BuildDeFiClaimTransactionRequest.md @@ -0,0 +1,32 @@ + + +# BuildDeFiClaimTransactionRequest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**address** | **String** | User wallet address (the signer / sender). | | +|**binanceChainId** | **String** | Binance chain ID. For `REWARD_PROTOCOL` (which does not use `investmentId`) this is the only chain signal and is required. For all other claim types the chain is resolved from `investmentId` and any client-supplied value is silently ignored — the call still executes on the `investmentId` chain, so a different chainId does not redirect the claim. | [optional] | +|**claimType** | [**ClaimTypeEnum**](#ClaimTypeEnum) | Claim routing type. Determines which companion fields are required: - `REWARD_PROTOCOL`: protocol-level rewards (e.g. Aave incentive, Radiant) — requires `defiProtocolId` + `binanceChainId` - `REWARD_INVESTMENT`: per-investment rewards — requires `investmentId` - `LP_FEE`: Uniswap V3/V4 LP fees — requires `investmentId` + `nftId` - `REDEMPTION`: redeem principal (Lista / Aster / Solv etc.) — requires `investmentId` + `redemptionId` **Protocol constraints** — not every `claimType` is valid for every protocol; an invalid combination is rejected (`40453` or `40454`): - `REWARD_PROTOCOL` is **not** supported for LP (liquidity-pool) protocols in this release. - `REWARD_INVESTMENT` is not supported for PancakeSwap V3 farming positions; use `LP_FEE` to claim farming incentives there. - `LP_FEE` applies only to concentrated-liquidity (V3/V4) LP positions. - `REDEMPTION` applies only to protocols with a redemption / lock-up flow (Lista, Aster, Solv). The valid `claimType`s for a specific position are returned in that position's `positionDetail.claimTypes` (see the position list) — branch on that rather than hard-coding the mapping. Note: error messages may surface the protocol id with a chain prefix (e.g. `bsc_pancakeswap4`); the canonical id in API fields is the un-prefixed form (e.g. `pancakeswap4`). | | +|**investmentId** | **String** | Required for `REWARD_INVESTMENT`, `LP_FEE`, and `REDEMPTION`. Not used for `REWARD_PROTOCOL` (which keys off `defiProtocolId`). | [optional] | +|**defiProtocolId** | **String** | Required for `REWARD_PROTOCOL` (e.g. `pancakeswap3`). | [optional] | +|**nftId** | **String** | Required for `LP_FEE`. The NFT token ID as a decimal string (e.g. `\"7225901\"` or `\"#7225901\"`). The `#` prefix returned by the position list may be passed as-is — the service strips it automatically. | [optional] | +|**redemptionId** | **String** | Required for `REDEMPTION`. Maps to the `redemptionId` returned in the position list (the on-line position index). | [optional] | +|**tokenAddressList** | **List<String>** | Optional token address filter to narrow the claim scope. | [optional] | +|**simulate** | **Boolean** | When `true`, the response also includes a `preview` object. Default `false`. If the simulated transaction reverts, the request returns `40485` for a specific classified revert reason or `40484` for any other revert (see Error Codes). | [optional] | + + + +## Enum: ClaimTypeEnum + +| Name | Value | +|---- | -----| +| REWARD_PROTOCOL | "REWARD_PROTOCOL" | +| REWARD_INVESTMENT | "REWARD_INVESTMENT" | +| LP_FEE | "LP_FEE" | +| REDEMPTION | "REDEMPTION" | + + + diff --git a/clients/web3-wallet/docs/BuildDeFiClaimTransactionResponse.md b/clients/web3-wallet/docs/BuildDeFiClaimTransactionResponse.md new file mode 100644 index 0000000..21c797f --- /dev/null +++ b/clients/web3-wallet/docs/BuildDeFiClaimTransactionResponse.md @@ -0,0 +1,17 @@ + + +# BuildDeFiClaimTransactionResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**code** | **Integer** | Business status code. 0 indicates success. | [optional] | +|**msg** | **String** | Human-readable status message. | [optional] | +|**data** | [**BuildDeFiDepositTransactionResponseData**](BuildDeFiDepositTransactionResponseData.md) | | [optional] | +|**timestamp** | **Long** | Server timestamp in milliseconds. | [optional] | +|**success** | **Boolean** | Whether the request succeeded (mirrors `code == 0`). | [optional] | + + + diff --git a/clients/web3-wallet/docs/BuildDeFiDepositTransactionRequest.md b/clients/web3-wallet/docs/BuildDeFiDepositTransactionRequest.md new file mode 100644 index 0000000..c9399f5 --- /dev/null +++ b/clients/web3-wallet/docs/BuildDeFiDepositTransactionRequest.md @@ -0,0 +1,16 @@ + + +# BuildDeFiDepositTransactionRequest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**address** | **String** | User wallet address (the signer / sender). | | +|**investmentId** | **String** | Investment product ID (chain-agnostic). The service resolves the chain from this ID. | | +|**token** | [**BuildDeFiDepositTransactionRequestToken**](BuildDeFiDepositTransactionRequestToken.md) | | | +|**simulate** | **Boolean** | When `true`, the response also includes a `preview` object. Default `false`. If the simulated transaction reverts, the request returns `40485` for a specific classified revert reason or `40484` for any other revert (see Error Codes). | [optional] | + + + diff --git a/clients/web3-wallet/docs/BuildDeFiDepositTransactionRequestToken.md b/clients/web3-wallet/docs/BuildDeFiDepositTransactionRequestToken.md new file mode 100644 index 0000000..dd516af --- /dev/null +++ b/clients/web3-wallet/docs/BuildDeFiDepositTransactionRequestToken.md @@ -0,0 +1,15 @@ + + +# BuildDeFiDepositTransactionRequestToken + +A `(tokenAddress, amount)` pair. `amount` is a human-readable decimal string (NOT the token's smallest unit); the service converts it according to the token's decimals. For the native asset use the sentinel `0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee` (40 `e`s). + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**tokenAddress** | **String** | Token contract address; the native-asset sentinel for the native coin. | | +|**amount** | **String** | Human-readable amount as a decimal string, e.g. \"1.5\", \"100\". | | + + + diff --git a/clients/web3-wallet/docs/BuildDeFiDepositTransactionResponse.md b/clients/web3-wallet/docs/BuildDeFiDepositTransactionResponse.md new file mode 100644 index 0000000..23d5807 --- /dev/null +++ b/clients/web3-wallet/docs/BuildDeFiDepositTransactionResponse.md @@ -0,0 +1,17 @@ + + +# BuildDeFiDepositTransactionResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**code** | **Integer** | Business status code. 0 indicates success. | [optional] | +|**msg** | **String** | Human-readable status message. | [optional] | +|**data** | [**BuildDeFiDepositTransactionResponseData**](BuildDeFiDepositTransactionResponseData.md) | | [optional] | +|**timestamp** | **Long** | Server timestamp in milliseconds. | [optional] | +|**success** | **Boolean** | Whether the request succeeded (mirrors `code == 0`). | [optional] | + + + diff --git a/clients/web3-wallet/docs/BuildDeFiDepositTransactionResponseData.md b/clients/web3-wallet/docs/BuildDeFiDepositTransactionResponseData.md new file mode 100644 index 0000000..da7d229 --- /dev/null +++ b/clients/web3-wallet/docs/BuildDeFiDepositTransactionResponseData.md @@ -0,0 +1,16 @@ + + +# BuildDeFiDepositTransactionResponseData + +Unified response of the five build endpoints (deposit / redeem / lp-add / lp-remove / claim). `dataList` is ordered: APPROVE items come first, the main action follows — sign and broadcast each item in order. `preview` is non-null only when the request set `simulate=true`. `redeemDelayDays` is populated only by `/transaction/redeem`. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**dataList** | [**List<BuildDeFiDepositTransactionResponseDataDataListInner>**](BuildDeFiDepositTransactionResponseDataDataListInner.md) | Ordered unsigned transactions; APPROVE precedes the main action. | [optional] | +|**preview** | [**BuildDeFiDepositTransactionResponseDataPreview**](BuildDeFiDepositTransactionResponseDataPreview.md) | | [optional] | +|**redeemDelayDays** | **List<String>** | Redeem waiting period as a `[min, max]` day pair of decimal strings. Populated **only** by `/transaction/redeem`; `null` on the other build endpoints or when unavailable. Interpretation: `[]` (empty) = instant, no waiting period; `[\"7\",\"7\"]` = fixed 7 days; `[\"7\",\"10\"]` = 7–10 days. The wait starts after the redeem transaction is confirmed on-chain. | [optional] | + + + diff --git a/clients/web3-wallet/docs/BuildDeFiDepositTransactionResponseDataDataListInner.md b/clients/web3-wallet/docs/BuildDeFiDepositTransactionResponseDataDataListInner.md new file mode 100644 index 0000000..bf75d06 --- /dev/null +++ b/clients/web3-wallet/docs/BuildDeFiDepositTransactionResponseDataDataListInner.md @@ -0,0 +1,22 @@ + + +# BuildDeFiDepositTransactionResponseDataDataListInner + +A single unsigned transaction to sign and broadcast. The `dataList` is ordered: APPROVE items precede the main action. EVM chains return `to`/`value` (hex) and hex calldata in `data`. **Number-format conventions for this object** — `value` is a `0x`-prefixed hex string; `gasLimit`, `gasPrice`, `maxPriorityFeePerGas`, and `maxFeePerGas` are decimal strings. Mixed hex/decimal within the same object is by design (it mirrors the on-chain transaction fields); always parse gas fields with base-10 and `value` with base-16. **BSC and EIP-1559**: this release is BSC only. BSC is an EIP-1559 chain, so build responses populate `maxFeePerGas` and `maxPriorityFeePerGas`; `gasPrice` is `null` (legacy-only). The nullable markers below are retained so the schema also describes non-1559 chains in later releases — on BSC the 1559 fields are present and the legacy `gasPrice` is `null`. `to` and `value` are non-null for every action item on BSC. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**callDataType** | **String** | Action kind of this item: - `APPROVE` — ERC-20 approval, must be signed/broadcast and confirmed before the main action - `DEPOSIT` / `REDEEM` / `LP_ADD` / `LP_REMOVE` / `CLAIM` — the main action. `LP_ADD` / `LP_REMOVE` are the LP add / remove legs (the same build path as deposit / redeem for liquidity-pool investments; the kind reflects the on-chain action, not the entry endpoint). | [optional] | +|**from** | **String** | User wallet address (the signer / sender). EIP-55 checksummed — normalize with `to_checksum_address` before signing if your signer requires it. | [optional] | +|**to** | **String** | Target contract address. EIP-55 checksummed, same format as `from`. Non-null on BSC for every action item. | [optional] | +|**value** | **String** | Native-asset value as a `0x`-prefixed hex string. Non-null on BSC for action items. | [optional] | +|**data** | **String** | Serialized transaction data, as a `0x`-prefixed hex calldata string. | [optional] | +|**gasLimit** | **String** | Suggested gas limit (decimal string). `null` when estimation fails. | [optional] | +|**gasPrice** | **String** | Legacy gas price, decimal string. `null` on EIP-1559 chains such as BSC (use `maxFeePerGas` / `maxPriorityFeePerGas` instead). | [optional] | +|**maxPriorityFeePerGas** | **String** | EIP-1559 priority fee in wei (decimal string). `null` on non-1559 chains. | [optional] | +|**maxFeePerGas** | **String** | EIP-1559 max fee per gas in wei (decimal string). `null` on non-1559 chains. | [optional] | + + + diff --git a/clients/web3-wallet/docs/BuildDeFiDepositTransactionResponseDataPreview.md b/clients/web3-wallet/docs/BuildDeFiDepositTransactionResponseDataPreview.md new file mode 100644 index 0000000..ab013f0 --- /dev/null +++ b/clients/web3-wallet/docs/BuildDeFiDepositTransactionResponseDataPreview.md @@ -0,0 +1,19 @@ + + +# BuildDeFiDepositTransactionResponseDataPreview + +Simulation result returned by the build endpoints when `simulate=true`. Includes whether the action is expected to succeed, the projected balance change, the estimated network fee, and — for lending protocols — the health-factor change. `balanceChange`, `feeAndContract`, `healthFactor`, and `warnings` each have a fixed structure (see below); the number of entries and some inner values vary by protocol. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**success** | **Boolean** | Whether the simulated transaction is expected to succeed on-chain. | [optional] | +|**balanceChange** | [**List<DefiPreviewBalanceChangeInner>**](DefiPreviewBalanceChangeInner.md) | Signed token balance deltas from the simulation. Each entry has `tokenType`, `tokenSymbol`, `tokenAddress`, `tokenDecimals`, `amount` (positive = received, negative = spent), `valueUsd`, and an optional `tokenId`. | [optional] | +|**feeAndContract** | [**DefiPreviewFeeAndContract**](DefiPreviewFeeAndContract.md) | | [optional] | +|**healthFactor** | [**DefiPreviewHealthFactor**](DefiPreviewHealthFactor.md) | | [optional] | +|**warnings** | [**List<DefiPreviewWarningsInner>**](DefiPreviewWarningsInner.md) | Non-blocking risk warnings. Empty array when there are no warnings. | [optional] | +|**errorMessage** | **String** | Error message when the simulated transaction is expected to fail. | [optional] | + + + diff --git a/clients/web3-wallet/docs/BuildDeFiRedeemTransactionRequest.md b/clients/web3-wallet/docs/BuildDeFiRedeemTransactionRequest.md new file mode 100644 index 0000000..ca0c148 --- /dev/null +++ b/clients/web3-wallet/docs/BuildDeFiRedeemTransactionRequest.md @@ -0,0 +1,18 @@ + + +# BuildDeFiRedeemTransactionRequest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**address** | **String** | User wallet address (the signer / sender). | | +|**investmentId** | **String** | Investment product ID (chain-agnostic). The service resolves the chain from this ID. | | +|**token** | [**BuildDeFiRedeemTransactionRequestToken**](BuildDeFiRedeemTransactionRequestToken.md) | | [optional] | +|**ratio** | **String** | Redeem ratio, mutually exclusive with `token`. Omitted / blank → exact-amount redeem via `token` (`tokenAddress` + `amount`, position not queried). Present → must parse as a decimal in `(0, 1]`; the service queries the on-chain position under `investmentId` and scales each token amount by `ratio` (floored to decimals). `\"1\"` = full (max) redeem; in this mode `token` is ignored. | [optional] | +|**slippageBps** | **String** | Slippage tolerance in basis points (e.g. `300` = 3%). | [optional] | +|**simulate** | **Boolean** | When `true`, the response also includes a `preview` object. Default `false`. If the simulated transaction reverts, the request returns an error code instead of a `200` with `preview.success=false`: `40485` when the redeem amount exceeds the current position, `40484` for any other revert (see Error Codes). | [optional] | + + + diff --git a/clients/web3-wallet/docs/BuildDeFiRedeemTransactionRequestToken.md b/clients/web3-wallet/docs/BuildDeFiRedeemTransactionRequestToken.md new file mode 100644 index 0000000..25a37ff --- /dev/null +++ b/clients/web3-wallet/docs/BuildDeFiRedeemTransactionRequestToken.md @@ -0,0 +1,15 @@ + + +# BuildDeFiRedeemTransactionRequestToken + +A `(tokenAddress, amount)` pair. `amount` is a human-readable decimal string (NOT the token's smallest unit); the service converts it according to the token's decimals. For the native asset use the sentinel `0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee` (40 `e`s). + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**tokenAddress** | **String** | Token contract address; the native-asset sentinel for the native coin. | | +|**amount** | **String** | Human-readable amount as a decimal string, e.g. \"1.5\", \"100\". | | + + + diff --git a/clients/web3-wallet/docs/BuildDeFiRedeemTransactionResponse.md b/clients/web3-wallet/docs/BuildDeFiRedeemTransactionResponse.md new file mode 100644 index 0000000..91ad54a --- /dev/null +++ b/clients/web3-wallet/docs/BuildDeFiRedeemTransactionResponse.md @@ -0,0 +1,17 @@ + + +# BuildDeFiRedeemTransactionResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**code** | **Integer** | Business status code. 0 indicates success. | [optional] | +|**msg** | **String** | Human-readable status message. | [optional] | +|**data** | [**BuildDeFiDepositTransactionResponseData**](BuildDeFiDepositTransactionResponseData.md) | | [optional] | +|**timestamp** | **Long** | Server timestamp in milliseconds. | [optional] | +|**success** | **Boolean** | Whether the request succeeded (mirrors `code == 0`). | [optional] | + + + diff --git a/clients/web3-wallet/docs/BuildLpAddTransactionRequest.md b/clients/web3-wallet/docs/BuildLpAddTransactionRequest.md new file mode 100644 index 0000000..8ab1a8d --- /dev/null +++ b/clients/web3-wallet/docs/BuildLpAddTransactionRequest.md @@ -0,0 +1,21 @@ + + +# BuildLpAddTransactionRequest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**address** | **String** | User wallet address (the signer / sender). | | +|**investmentId** | **String** | LP investment product ID (chain-agnostic). | | +|**tokenList** | [**List<BuildLpAddTransactionRequestTokenListInner>**](BuildLpAddTransactionRequestTokenListInner.md) | Tokens to supply. Two tokens for a standard LP add. | | +|**tickLower** | **String** | Lower tick bound (raw `int24`) for a new position. MUST be aligned to the pool's `tickSpacing`. Pick exactly one tick-range source: `tickLower`+`tickUpper`, `priceRange`, or `nftId` (to append to an existing position). If several are supplied, the lowest-priority ones are ignored (priority: `nftId` > `priceRange` > explicit tick pair). | [optional] | +|**tickUpper** | **String** | Upper tick bound (raw `int24`) for a new position. MUST be aligned to the pool's `tickSpacing`. See `tickLower` for the pick-exactly-one rule. | [optional] | +|**priceRange** | **String** | Price range as a percentage (e.g. `\"5\"` = ±5%) for a new position. Alternative to `tickLower`+`tickUpper`; see `tickLower` for the pick-exactly-one rule. | [optional] | +|**nftId** | **String** | LP NFT token ID, decimal string (e.g. `\"7225901\"` or `\"#7225901\"`). Required when appending to an existing position (reuses its range); omit for a new position. Highest-priority tick-range source — see `tickLower` for the pick-exactly-one rule. The `#` prefix returned by the position list may be passed as-is — the service strips it automatically. | [optional] | +|**slippageBps** | **String** | Slippage tolerance for the LP leg, in basis points (e.g. `300` = 3%). | [optional] | +|**simulate** | **Boolean** | When `true`, the response also includes a `preview` object. Default `false`. If the simulated transaction reverts, the request returns `40485` for a specific classified revert reason or `40484` for any other revert (see Error Codes). | [optional] | + + + diff --git a/clients/web3-wallet/docs/BuildLpAddTransactionRequestTokenListInner.md b/clients/web3-wallet/docs/BuildLpAddTransactionRequestTokenListInner.md new file mode 100644 index 0000000..c379b82 --- /dev/null +++ b/clients/web3-wallet/docs/BuildLpAddTransactionRequestTokenListInner.md @@ -0,0 +1,15 @@ + + +# BuildLpAddTransactionRequestTokenListInner + +A `(tokenAddress, amount)` pair. `amount` is a human-readable decimal string (NOT the token's smallest unit); the service converts it according to the token's decimals. For the native asset use the sentinel `0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee` (40 `e`s). + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**tokenAddress** | **String** | Token contract address; the native-asset sentinel for the native coin. | | +|**amount** | **String** | Human-readable amount as a decimal string, e.g. \"1.5\", \"100\". | | + + + diff --git a/clients/web3-wallet/docs/BuildLpAddTransactionResponse.md b/clients/web3-wallet/docs/BuildLpAddTransactionResponse.md new file mode 100644 index 0000000..c95a151 --- /dev/null +++ b/clients/web3-wallet/docs/BuildLpAddTransactionResponse.md @@ -0,0 +1,17 @@ + + +# BuildLpAddTransactionResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**code** | **Integer** | Business status code. 0 indicates success. | [optional] | +|**msg** | **String** | Human-readable status message. | [optional] | +|**data** | [**BuildDeFiDepositTransactionResponseData**](BuildDeFiDepositTransactionResponseData.md) | | [optional] | +|**timestamp** | **Long** | Server timestamp in milliseconds. | [optional] | +|**success** | **Boolean** | Whether the request succeeded (mirrors `code == 0`). | [optional] | + + + diff --git a/clients/web3-wallet/docs/BuildLpRemoveTransactionRequest.md b/clients/web3-wallet/docs/BuildLpRemoveTransactionRequest.md new file mode 100644 index 0000000..0699e6e --- /dev/null +++ b/clients/web3-wallet/docs/BuildLpRemoveTransactionRequest.md @@ -0,0 +1,18 @@ + + +# BuildLpRemoveTransactionRequest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**address** | **String** | User wallet address (the signer / sender). | | +|**investmentId** | **String** | LP investment product ID (chain-agnostic). | | +|**nftId** | **String** | LP NFT token ID identifying the position to remove, decimal string (e.g. `\"7225901\"` or `\"#7225901\"`). The `#` prefix returned by the position list may be passed as-is — the service strips it automatically. | | +|**ratio** | **String** | Removal ratio in the range `(0, 1]` as a decimal string (e.g. `\"0.04\"`, `\"1\"`). | | +|**slippageBps** | **String** | Slippage tolerance for the LP leg, in basis points (e.g. `300` = 3%). | [optional] | +|**simulate** | **Boolean** | When `true`, the response also includes a `preview` object. Default `false`. If the simulated transaction reverts, the request returns `40485` for a specific classified revert reason or `40484` for any other revert (see Error Codes). | [optional] | + + + diff --git a/clients/web3-wallet/docs/BuildLpRemoveTransactionResponse.md b/clients/web3-wallet/docs/BuildLpRemoveTransactionResponse.md new file mode 100644 index 0000000..a4bb0f8 --- /dev/null +++ b/clients/web3-wallet/docs/BuildLpRemoveTransactionResponse.md @@ -0,0 +1,17 @@ + + +# BuildLpRemoveTransactionResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**code** | **Integer** | Business status code. 0 indicates success. | [optional] | +|**msg** | **String** | Human-readable status message. | [optional] | +|**data** | [**BuildDeFiDepositTransactionResponseData**](BuildDeFiDepositTransactionResponseData.md) | | [optional] | +|**timestamp** | **Long** | Server timestamp in milliseconds. | [optional] | +|**success** | **Boolean** | Whether the request succeeded (mirrors `code == 0`). | [optional] | + + + diff --git a/clients/web3-wallet/docs/CalculateLpAddPairedAmountsRequest.md b/clients/web3-wallet/docs/CalculateLpAddPairedAmountsRequest.md new file mode 100644 index 0000000..446af8f --- /dev/null +++ b/clients/web3-wallet/docs/CalculateLpAddPairedAmountsRequest.md @@ -0,0 +1,19 @@ + + +# CalculateLpAddPairedAmountsRequest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**address** | **String** | User wallet address. | | +|**investmentId** | **String** | LP investment product ID (chain-agnostic). | | +|**tickLower** | **String** | Lower tick bound (raw `int24`), aligned to the pool's `tickSpacing`. | [optional] | +|**tickUpper** | **String** | Upper tick bound (raw `int24`), aligned to the pool's `tickSpacing`. | [optional] | +|**priceRange** | **String** | Price range as a percentage (e.g. `\"5\"` = ±5%). | [optional] | +|**nftId** | **String** | Required when calculating for an existing LP position. | [optional] | +|**inputToken** | [**BuildDeFiDepositTransactionRequestToken**](BuildDeFiDepositTransactionRequestToken.md) | | | + + + diff --git a/clients/web3-wallet/docs/CalculateLpAddPairedAmountsResponse.md b/clients/web3-wallet/docs/CalculateLpAddPairedAmountsResponse.md new file mode 100644 index 0000000..1efdd23 --- /dev/null +++ b/clients/web3-wallet/docs/CalculateLpAddPairedAmountsResponse.md @@ -0,0 +1,17 @@ + + +# CalculateLpAddPairedAmountsResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**code** | **Integer** | Business status code. 0 indicates success. | [optional] | +|**msg** | **String** | Human-readable status message. | [optional] | +|**data** | [**CalculateLpAddPairedAmountsResponseData**](CalculateLpAddPairedAmountsResponseData.md) | | [optional] | +|**timestamp** | **Long** | Server timestamp in milliseconds. | [optional] | +|**success** | **Boolean** | Whether the request succeeded (mirrors `code == 0`). | [optional] | + + + diff --git a/clients/web3-wallet/docs/CalculateLpAddPairedAmountsResponseData.md b/clients/web3-wallet/docs/CalculateLpAddPairedAmountsResponseData.md new file mode 100644 index 0000000..b45a833 --- /dev/null +++ b/clients/web3-wallet/docs/CalculateLpAddPairedAmountsResponseData.md @@ -0,0 +1,16 @@ + + +# CalculateLpAddPairedAmountsResponseData + +Result of `/transaction/lp-add/calculate`. Returns the paired token amounts derived from the single input token. This endpoint is pure computation — it does not touch the chain and does not deduct any fee. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**inputTokenAmount** | **String** | Echo of the input token amount (human-readable). | [optional] | +|**pairedTokenAddress** | **String** | The paired token contract address derived from the investment. | [optional] | +|**pairedTokenAmount** | **String** | Calculated paired token amount (human-readable). | [optional] | + + + diff --git a/clients/web3-wallet/docs/DefiCallDataItem.md b/clients/web3-wallet/docs/DefiCallDataItem.md new file mode 100644 index 0000000..b5603a1 --- /dev/null +++ b/clients/web3-wallet/docs/DefiCallDataItem.md @@ -0,0 +1,35 @@ + + +# DefiCallDataItem + +A single unsigned transaction to sign and broadcast. The `dataList` is ordered: APPROVE items precede the main action. EVM chains return `to`/`value` (hex) and hex calldata in `data`. **Number-format conventions for this object** — `value` is a `0x`-prefixed hex string; `gasLimit`, `gasPrice`, `maxPriorityFeePerGas`, and `maxFeePerGas` are decimal strings. Mixed hex/decimal within the same object is by design (it mirrors the on-chain transaction fields); always parse gas fields with base-10 and `value` with base-16. **BSC and EIP-1559**: this release is BSC only. BSC is an EIP-1559 chain, so build responses populate `maxFeePerGas` and `maxPriorityFeePerGas`; `gasPrice` is `null` (legacy-only). The nullable markers below are retained so the schema also describes non-1559 chains in later releases — on BSC the 1559 fields are present and the legacy `gasPrice` is `null`. `to` and `value` are non-null for every action item on BSC. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**callDataType** | [**CallDataTypeEnum**](#CallDataTypeEnum) | Action kind of this item: - `APPROVE` — ERC-20 approval, must be signed/broadcast and confirmed before the main action - `DEPOSIT` / `REDEEM` / `LP_ADD` / `LP_REMOVE` / `CLAIM` — the main action. `LP_ADD` / `LP_REMOVE` are the LP add / remove legs (the same build path as deposit / redeem for liquidity-pool investments; the kind reflects the on-chain action, not the entry endpoint). | [optional] | +|**from** | **String** | User wallet address (the signer / sender). EIP-55 checksummed — normalize with `to_checksum_address` before signing if your signer requires it. | [optional] | +|**to** | **String** | Target contract address. EIP-55 checksummed, same format as `from`. Non-null on BSC for every action item. | [optional] | +|**value** | **String** | Native-asset value as a `0x`-prefixed hex string. Non-null on BSC for action items. | [optional] | +|**data** | **String** | Serialized transaction data, as a `0x`-prefixed hex calldata string. | [optional] | +|**gasLimit** | **String** | Suggested gas limit (decimal string). `null` when estimation fails. | [optional] | +|**gasPrice** | **String** | Legacy gas price, decimal string. `null` on EIP-1559 chains such as BSC (use `maxFeePerGas` / `maxPriorityFeePerGas` instead). | [optional] | +|**maxPriorityFeePerGas** | **String** | EIP-1559 priority fee in wei (decimal string). `null` on non-1559 chains. | [optional] | +|**maxFeePerGas** | **String** | EIP-1559 max fee per gas in wei (decimal string). `null` on non-1559 chains. | [optional] | + + + +## Enum: CallDataTypeEnum + +| Name | Value | +|---- | -----| +| APPROVE | "APPROVE" | +| DEPOSIT | "DEPOSIT" | +| REDEEM | "REDEEM" | +| LP_ADD | "LP_ADD" | +| LP_REMOVE | "LP_REMOVE" | +| CLAIM | "CLAIM" | + + + diff --git a/clients/web3-wallet/docs/DefiClaimType.md b/clients/web3-wallet/docs/DefiClaimType.md new file mode 100644 index 0000000..7d8608f --- /dev/null +++ b/clients/web3-wallet/docs/DefiClaimType.md @@ -0,0 +1,17 @@ + + +# DefiClaimType + +## Enum + + +* `REWARD_PROTOCOL` (value: `"REWARD_PROTOCOL"`) + +* `REWARD_INVESTMENT` (value: `"REWARD_INVESTMENT"`) + +* `LP_FEE` (value: `"LP_FEE"`) + +* `REDEMPTION` (value: `"REDEMPTION"`) + + + diff --git a/clients/web3-wallet/docs/DefiDataApi.md b/clients/web3-wallet/docs/DefiDataApi.md new file mode 100644 index 0000000..e4f487f --- /dev/null +++ b/clients/web3-wallet/docs/DefiDataApi.md @@ -0,0 +1,374 @@ +# DefiDataApi + +All URIs are relative to *https://web3.binance.com/build* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**getDeFiPositions**](DefiDataApi.md#getDeFiPositions) | **POST** /api/v1/defi/data/position/list | Get DeFi Positions | +| [**getInvestmentDetail**](DefiDataApi.md#getInvestmentDetail) | **POST** /api/v1/defi/data/investment/detail | Get Investment Detail | +| [**getProtocolDetail**](DefiDataApi.md#getProtocolDetail) | **POST** /api/v1/defi/data/protocol/detail | Get Protocol Detail | +| [**listDeFiInvestments**](DefiDataApi.md#listDeFiInvestments) | **POST** /api/v1/defi/data/investment/list | List DeFi Investments | +| [**listDeFiProtocols**](DefiDataApi.md#listDeFiProtocols) | **POST** /api/v1/defi/data/protocol/list | List DeFi Protocols | + + + +# **getDeFiPositions** +> GetDeFiPositionsResponse getDeFiPositions(getDeFiPositionsRequest).recvWindow(recvWindow).nonce(nonce).execute(); + +Get DeFi Positions + +Query DeFi positions for one or more wallet addresses on BSC. Returns protocol-level position summaries with token breakdowns. Optionally filter by specific chains via `binanceChainIds`. Position coverage is wider than the protocol list used by data queries and transaction building — see [Supported Chains & Protocols](../supported-chains) for the difference. + +### Example +```java +// Import classes: +import com.binance.connector.client.web3_wallet.ApiClient; +import com.binance.connector.client.web3_wallet.ApiException; +import com.binance.connector.client.web3_wallet.Configuration; +import com.binance.connector.client.web3_wallet.models.*; +import com.binance.connector.client.web3_wallet.rest.api.DefiDataApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://web3.binance.com/build"); + + DefiDataApi apiInstance = new DefiDataApi(defaultClient); + GetDeFiPositionsRequest getDeFiPositionsRequest = new GetDeFiPositionsRequest(); // GetDeFiPositionsRequest | + Long recvWindow = 5000L; // Long | Allowed time deviation in milliseconds (default: 5000, max: 60000). + String nonce = "unique-nonce-string"; // String | Unique request identifier for anti-replay; falls back to X-OC-SIGN if omitted. + try { + GetDeFiPositionsResponse result = apiInstance.getDeFiPositions(getDeFiPositionsRequest) + .recvWindow(recvWindow) + .nonce(nonce) + .execute(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DefiDataApi#getDeFiPositions"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **getDeFiPositionsRequest** | [**GetDeFiPositionsRequest**](GetDeFiPositionsRequest.md)| | | +| **recvWindow** | **Long**| Allowed time deviation in milliseconds (default: 5000, max: 60000). | [optional] | +| **nonce** | **String**| Unique request identifier for anti-replay; falls back to X-OC-SIGN if omitted. | [optional] | + +### Return type + +[**GetDeFiPositionsResponse**](GetDeFiPositionsResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | DeFi positions returned successfully. | - | +| **401** | Unauthorized. The request is missing or contains an invalid API key. | - | +| **403** | Forbidden. The API key does not have permission to access this endpoint. | - | +| **404** | Not Found. The requested resource or endpoint does not exist. | - | + + +# **getInvestmentDetail** +> GetInvestmentDetailResponse getInvestmentDetail(getInvestmentDetailRequest).recvWindow(recvWindow).nonce(nonce).execute(); + +Get Investment Detail + +Get detailed information for a specific DeFi investment product, including APY, TVL, supported tokens (asset / reward / LP / borrow), pool address, fee rate, and investability. + +### Example +```java +// Import classes: +import com.binance.connector.client.web3_wallet.ApiClient; +import com.binance.connector.client.web3_wallet.ApiException; +import com.binance.connector.client.web3_wallet.Configuration; +import com.binance.connector.client.web3_wallet.models.*; +import com.binance.connector.client.web3_wallet.rest.api.DefiDataApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://web3.binance.com/build"); + + DefiDataApi apiInstance = new DefiDataApi(defaultClient); + GetInvestmentDetailRequest getInvestmentDetailRequest = new GetInvestmentDetailRequest(); // GetInvestmentDetailRequest | + Long recvWindow = 5000L; // Long | Allowed time deviation in milliseconds (default: 5000, max: 60000). + String nonce = "unique-nonce-string"; // String | Unique request identifier for anti-replay; falls back to X-OC-SIGN if omitted. + try { + GetInvestmentDetailResponse result = apiInstance.getInvestmentDetail(getInvestmentDetailRequest) + .recvWindow(recvWindow) + .nonce(nonce) + .execute(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DefiDataApi#getInvestmentDetail"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **getInvestmentDetailRequest** | [**GetInvestmentDetailRequest**](GetInvestmentDetailRequest.md)| | | +| **recvWindow** | **Long**| Allowed time deviation in milliseconds (default: 5000, max: 60000). | [optional] | +| **nonce** | **String**| Unique request identifier for anti-replay; falls back to X-OC-SIGN if omitted. | [optional] | + +### Return type + +[**GetInvestmentDetailResponse**](GetInvestmentDetailResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Investment detail returned successfully. | - | +| **401** | Unauthorized. The request is missing or contains an invalid API key. | - | +| **403** | Forbidden. The API key does not have permission to access this endpoint. | - | +| **404** | Not Found. The requested resource or endpoint does not exist. | - | + + +# **getProtocolDetail** +> GetProtocolDetailResponse getProtocolDetail(getProtocolDetailRequest).recvWindow(recvWindow).nonce(nonce).execute(); + +Get Protocol Detail + +Get detailed information for a specific DeFi protocol, including description, highlights, CertiK security scores, team, fundraising, social links, and FAQ. + +### Example +```java +// Import classes: +import com.binance.connector.client.web3_wallet.ApiClient; +import com.binance.connector.client.web3_wallet.ApiException; +import com.binance.connector.client.web3_wallet.Configuration; +import com.binance.connector.client.web3_wallet.models.*; +import com.binance.connector.client.web3_wallet.rest.api.DefiDataApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://web3.binance.com/build"); + + DefiDataApi apiInstance = new DefiDataApi(defaultClient); + GetProtocolDetailRequest getProtocolDetailRequest = new GetProtocolDetailRequest(); // GetProtocolDetailRequest | + Long recvWindow = 5000L; // Long | Allowed time deviation in milliseconds (default: 5000, max: 60000). + String nonce = "unique-nonce-string"; // String | Unique request identifier for anti-replay; falls back to X-OC-SIGN if omitted. + try { + GetProtocolDetailResponse result = apiInstance.getProtocolDetail(getProtocolDetailRequest) + .recvWindow(recvWindow) + .nonce(nonce) + .execute(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DefiDataApi#getProtocolDetail"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **getProtocolDetailRequest** | [**GetProtocolDetailRequest**](GetProtocolDetailRequest.md)| | | +| **recvWindow** | **Long**| Allowed time deviation in milliseconds (default: 5000, max: 60000). | [optional] | +| **nonce** | **String**| Unique request identifier for anti-replay; falls back to X-OC-SIGN if omitted. | [optional] | + +### Return type + +[**GetProtocolDetailResponse**](GetProtocolDetailResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Protocol detail returned successfully. | - | +| **401** | Unauthorized. The request is missing or contains an invalid API key. | - | +| **403** | Forbidden. The API key does not have permission to access this endpoint. | - | +| **404** | Not Found. The requested resource or endpoint does not exist. | - | + + +# **listDeFiInvestments** +> ListDeFiInvestmentsResponse listDeFiInvestments(listDeFiInvestmentsRequest).recvWindow(recvWindow).nonce(nonce).execute(); + +List DeFi Investments + +List available DeFi investment products. Filter by protocol, chain, investment type, or contract address. Results are paginated and sortable. + +### Example +```java +// Import classes: +import com.binance.connector.client.web3_wallet.ApiClient; +import com.binance.connector.client.web3_wallet.ApiException; +import com.binance.connector.client.web3_wallet.Configuration; +import com.binance.connector.client.web3_wallet.models.*; +import com.binance.connector.client.web3_wallet.rest.api.DefiDataApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://web3.binance.com/build"); + + DefiDataApi apiInstance = new DefiDataApi(defaultClient); + ListDeFiInvestmentsRequest listDeFiInvestmentsRequest = new ListDeFiInvestmentsRequest(); // ListDeFiInvestmentsRequest | + Long recvWindow = 5000L; // Long | Allowed time deviation in milliseconds (default: 5000, max: 60000). + String nonce = "unique-nonce-string"; // String | Unique request identifier for anti-replay; falls back to X-OC-SIGN if omitted. + try { + ListDeFiInvestmentsResponse result = apiInstance.listDeFiInvestments(listDeFiInvestmentsRequest) + .recvWindow(recvWindow) + .nonce(nonce) + .execute(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DefiDataApi#listDeFiInvestments"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **listDeFiInvestmentsRequest** | [**ListDeFiInvestmentsRequest**](ListDeFiInvestmentsRequest.md)| | | +| **recvWindow** | **Long**| Allowed time deviation in milliseconds (default: 5000, max: 60000). | [optional] | +| **nonce** | **String**| Unique request identifier for anti-replay; falls back to X-OC-SIGN if omitted. | [optional] | + +### Return type + +[**ListDeFiInvestmentsResponse**](ListDeFiInvestmentsResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Investment list returned successfully. | - | +| **401** | Unauthorized. The request is missing or contains an invalid API key. | - | +| **403** | Forbidden. The API key does not have permission to access this endpoint. | - | +| **404** | Not Found. The requested resource or endpoint does not exist. | - | + + +# **listDeFiProtocols** +> ListDeFiProtocolsResponse listDeFiProtocols().recvWindow(recvWindow).nonce(nonce).listDeFiProtocolsRequest(listDeFiProtocolsRequest).execute(); + +List DeFi Protocols + +List supported DeFi protocols with optional filtering by chain and investment type. Results are paginated and sortable. + +### Example +```java +// Import classes: +import com.binance.connector.client.web3_wallet.ApiClient; +import com.binance.connector.client.web3_wallet.ApiException; +import com.binance.connector.client.web3_wallet.Configuration; +import com.binance.connector.client.web3_wallet.models.*; +import com.binance.connector.client.web3_wallet.rest.api.DefiDataApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://web3.binance.com/build"); + + DefiDataApi apiInstance = new DefiDataApi(defaultClient); + Long recvWindow = 5000L; // Long | Allowed time deviation in milliseconds (default: 5000, max: 60000). + String nonce = "unique-nonce-string"; // String | Unique request identifier for anti-replay; falls back to X-OC-SIGN if omitted. + ListDeFiProtocolsRequest listDeFiProtocolsRequest = new ListDeFiProtocolsRequest(); // ListDeFiProtocolsRequest | + try { + ListDeFiProtocolsResponse result = apiInstance.listDeFiProtocols() + .recvWindow(recvWindow) + .nonce(nonce) + .listDeFiProtocolsRequest(listDeFiProtocolsRequest) + .execute(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DefiDataApi#listDeFiProtocols"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **recvWindow** | **Long**| Allowed time deviation in milliseconds (default: 5000, max: 60000). | [optional] | +| **nonce** | **String**| Unique request identifier for anti-replay; falls back to X-OC-SIGN if omitted. | [optional] | +| **listDeFiProtocolsRequest** | [**ListDeFiProtocolsRequest**](ListDeFiProtocolsRequest.md)| | [optional] | + +### Return type + +[**ListDeFiProtocolsResponse**](ListDeFiProtocolsResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Protocol list returned successfully. | - | +| **401** | Unauthorized. The request is missing or contains an invalid API key. | - | +| **403** | Forbidden. The API key does not have permission to access this endpoint. | - | +| **404** | Not Found. The requested resource or endpoint does not exist. | - | + diff --git a/clients/web3-wallet/docs/DefiInvestmentDto.md b/clients/web3-wallet/docs/DefiInvestmentDto.md new file mode 100644 index 0000000..5dd3d9c --- /dev/null +++ b/clients/web3-wallet/docs/DefiInvestmentDto.md @@ -0,0 +1,23 @@ + + +# DefiInvestmentDto + +DeFi investment product summary (list item). + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**binanceChainId** | **String** | Binance chain ID. | [optional] | +|**defiProtocolId** | **String** | Parent DeFi protocol identifier. | [optional] | +|**protocolName** | **String** | Protocol display name. | [optional] | +|**investmentId** | **String** | Investment product identifier (64-char hex, no `0x` prefix). Same format as the `investmentIds` returned by `POST /api/v1/defi/data/position/list` and accepted by the transaction build endpoints. | [optional] | +|**investmentName** | **String** | Investment display name. | [optional] | +|**investType** | **String** | Investment type of this product — a single string here (each product has exactly one). Note: the protocol-level investType (in protocol list/detail) is an array. Known values: Earn, LiquidityPool. | [optional] | +|**apyType** | **String** | Rate yield type. Known values: APY, APR. | [optional] | +|**apyBps** | **Long** | Annual percentage yield in basis points (1 bps = 0.01%). Integer value — use this for sorting / comparing / filtering, never the raw decimal. | [optional] | +|**apyDisplay** | **String** | Pre-formatted, human-readable APY string for display (e.g. \"1,562.65%\"). Quote as-is; do not re-compute or transform. | [optional] | +|**tvl** | **String** | Total value locked in this investment (USD). String, raw precision from the data source. | [optional] | + + + diff --git a/clients/web3-wallet/docs/DefiInvestmentInfoDto.md b/clients/web3-wallet/docs/DefiInvestmentInfoDto.md new file mode 100644 index 0000000..a32792d --- /dev/null +++ b/clients/web3-wallet/docs/DefiInvestmentInfoDto.md @@ -0,0 +1,31 @@ + + +# DefiInvestmentInfoDto + +DeFi investment product detail. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**binanceChainId** | **String** | Binance chain ID. | [optional] | +|**defiProtocolId** | **String** | Parent DeFi protocol identifier. | [optional] | +|**protocolName** | **String** | Protocol display name. | [optional] | +|**protocolLogo** | **String** | Protocol logo image URL (full URL; quote as-is). | [optional] | +|**investmentId** | **String** | Investment product identifier (64-char hex, no `0x` prefix). Same format as the `investmentIds` returned by `POST /api/v1/defi/data/position/list` and accepted by the transaction build endpoints. | [optional] | +|**investmentName** | **String** | Investment display name. | [optional] | +|**investType** | **String** | Investment type of this product — a single string here (each product has exactly one). Note: the protocol-level investType (in protocol list/detail) is an array. Known values: Earn, LiquidityPool. | [optional] | +|**investable** | **Boolean** | Whether this investment is currently investable. | [optional] | +|**apyBps** | **Long** | Annual percentage yield in basis points (1 bps = 0.01%). Integer value — use this for sorting / comparing / filtering, never the raw decimal. | [optional] | +|**apyDisplay** | **String** | Pre-formatted, human-readable APY string for display (e.g. \"1,562.65%\"). Quote as-is; do not re-compute or transform. | [optional] | +|**apyType** | **String** | Rate yield type. Known values: APY, APR. | [optional] | +|**tvl** | **String** | Total value locked (USD). String, raw precision from the data source. | [optional] | +|**poolAddress** | **String** | Pool / strategy contract address. | [optional] | +|**feeRate** | **String** | Fee rate string (e.g. \"0.001\" = 0.1%). | [optional] | +|**assetTokenList** | [**List<DefiInvestmentInfoDtoAssetTokenListInner>**](DefiInvestmentInfoDtoAssetTokenListInner.md) | Tokens to supply / deposit. | [optional] | +|**rewardTokenList** | [**List<DefiInvestmentInfoDtoAssetTokenListInner>**](DefiInvestmentInfoDtoAssetTokenListInner.md) | Reward tokens. | [optional] | +|**lpTokenList** | [**List<DefiInvestmentInfoDtoAssetTokenListInner>**](DefiInvestmentInfoDtoAssetTokenListInner.md) | LP tokens (for liquidity positions). | [optional] | +|**borrowTokenList** | [**List<DefiInvestmentInfoDtoAssetTokenListInner>**](DefiInvestmentInfoDtoAssetTokenListInner.md) | Borrow tokens (for lending borrow positions). | [optional] | + + + diff --git a/clients/web3-wallet/docs/DefiInvestmentInfoDtoAssetTokenListInner.md b/clients/web3-wallet/docs/DefiInvestmentInfoDtoAssetTokenListInner.md new file mode 100644 index 0000000..ba37a26 --- /dev/null +++ b/clients/web3-wallet/docs/DefiInvestmentInfoDtoAssetTokenListInner.md @@ -0,0 +1,16 @@ + + +# DefiInvestmentInfoDtoAssetTokenListInner + +Token in an investment product. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**tokenAddress** | **String** | Token contract address. The native-asset sentinel for native coins. | [optional] | +|**tokenName** | **String** | Token name. | [optional] | +|**tokenSymbol** | **String** | Token symbol. | [optional] | + + + diff --git a/clients/web3-wallet/docs/DefiInvestmentTokenDto.md b/clients/web3-wallet/docs/DefiInvestmentTokenDto.md new file mode 100644 index 0000000..85bdf48 --- /dev/null +++ b/clients/web3-wallet/docs/DefiInvestmentTokenDto.md @@ -0,0 +1,16 @@ + + +# DefiInvestmentTokenDto + +Token in an investment product. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**tokenAddress** | **String** | Token contract address. The native-asset sentinel for native coins. | [optional] | +|**tokenName** | **String** | Token name. | [optional] | +|**tokenSymbol** | **String** | Token symbol. | [optional] | + + + diff --git a/clients/web3-wallet/docs/DefiPreview.md b/clients/web3-wallet/docs/DefiPreview.md new file mode 100644 index 0000000..b671b46 --- /dev/null +++ b/clients/web3-wallet/docs/DefiPreview.md @@ -0,0 +1,19 @@ + + +# DefiPreview + +Simulation result returned by the build endpoints when `simulate=true`. Includes whether the action is expected to succeed, the projected balance change, the estimated network fee, and — for lending protocols — the health-factor change. `balanceChange`, `feeAndContract`, `healthFactor`, and `warnings` each have a fixed structure (see below); the number of entries and some inner values vary by protocol. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**success** | **Boolean** | Whether the simulated transaction is expected to succeed on-chain. | [optional] | +|**balanceChange** | [**List<DefiPreviewBalanceChangeInner>**](DefiPreviewBalanceChangeInner.md) | Signed token balance deltas from the simulation. Each entry has `tokenType`, `tokenSymbol`, `tokenAddress`, `tokenDecimals`, `amount` (positive = received, negative = spent), `valueUsd`, and an optional `tokenId`. | [optional] | +|**feeAndContract** | [**DefiPreviewFeeAndContract**](DefiPreviewFeeAndContract.md) | | [optional] | +|**healthFactor** | [**DefiPreviewHealthFactor**](DefiPreviewHealthFactor.md) | | [optional] | +|**warnings** | [**List<DefiPreviewWarningsInner>**](DefiPreviewWarningsInner.md) | Non-blocking risk warnings. Empty array when there are no warnings. | [optional] | +|**errorMessage** | **String** | Error message when the simulated transaction is expected to fail. | [optional] | + + + diff --git a/clients/web3-wallet/docs/DefiPreviewBalanceChangeInner.md b/clients/web3-wallet/docs/DefiPreviewBalanceChangeInner.md new file mode 100644 index 0000000..86aa3ff --- /dev/null +++ b/clients/web3-wallet/docs/DefiPreviewBalanceChangeInner.md @@ -0,0 +1,19 @@ + + +# DefiPreviewBalanceChangeInner + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**tokenType** | **String** | Token role / type tag from the simulation. | [optional] | +|**tokenSymbol** | **String** | Token symbol. | [optional] | +|**tokenAddress** | **String** | Token contract address. | [optional] | +|**tokenDecimals** | **String** | Token decimals. | [optional] | +|**amount** | **String** | Signed delta (positive = received, negative = spent). | [optional] | +|**valueUsd** | **String** | USD value of the delta. | [optional] | +|**tokenId** | **String** | Optional NFT / position token ID when applicable. | [optional] | + + + diff --git a/clients/web3-wallet/docs/DefiPreviewFeeAndContract.md b/clients/web3-wallet/docs/DefiPreviewFeeAndContract.md new file mode 100644 index 0000000..382cc6c --- /dev/null +++ b/clients/web3-wallet/docs/DefiPreviewFeeAndContract.md @@ -0,0 +1,15 @@ + + +# DefiPreviewFeeAndContract + +Estimated network fee and the contract the action interacts with. Contains `estimatedNetworkFee` and `interactWith`. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**estimatedNetworkFee** | [**DefiPreviewFeeAndContractEstimatedNetworkFee**](DefiPreviewFeeAndContractEstimatedNetworkFee.md) | | [optional] | +|**interactWith** | [**DefiPreviewFeeAndContractInteractWith**](DefiPreviewFeeAndContractInteractWith.md) | | [optional] | + + + diff --git a/clients/web3-wallet/docs/DefiPreviewFeeAndContractEstimatedNetworkFee.md b/clients/web3-wallet/docs/DefiPreviewFeeAndContractEstimatedNetworkFee.md new file mode 100644 index 0000000..f6f1cfb --- /dev/null +++ b/clients/web3-wallet/docs/DefiPreviewFeeAndContractEstimatedNetworkFee.md @@ -0,0 +1,19 @@ + + +# DefiPreviewFeeAndContractEstimatedNetworkFee + +Estimated gas cost for the action. Fields may be `null` when estimation is not available (e.g. a failed simulation). + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**amount** | **String** | Estimated gas fee in the gas-paying token (human-readable). | [optional] | +|**tokenSymbol** | **String** | Symbol of the fee-paying token (native coin, e.g. BNB). | [optional] | +|**valueUsd** | **String** | USD value of the estimated fee. | [optional] | +|**rentFeeAmount** | **String** | Storage / rent fee portion (human-readable), if applicable. | [optional] | +|**rentFeeValueUsd** | **String** | USD value of the storage / rent fee, if applicable. | [optional] | +|**priorityFeeAmount** | **String** | Priority fee portion (human-readable), if broken out. | [optional] | + + + diff --git a/clients/web3-wallet/docs/DefiPreviewFeeAndContractInteractWith.md b/clients/web3-wallet/docs/DefiPreviewFeeAndContractInteractWith.md new file mode 100644 index 0000000..ab9841f --- /dev/null +++ b/clients/web3-wallet/docs/DefiPreviewFeeAndContractInteractWith.md @@ -0,0 +1,14 @@ + + +# DefiPreviewFeeAndContractInteractWith + +The contract the action interacts with. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**address** | **String** | Target contract address. | [optional] | + + + diff --git a/clients/web3-wallet/docs/DefiPreviewHealthFactor.md b/clients/web3-wallet/docs/DefiPreviewHealthFactor.md new file mode 100644 index 0000000..9db8a26 --- /dev/null +++ b/clients/web3-wallet/docs/DefiPreviewHealthFactor.md @@ -0,0 +1,15 @@ + + +# DefiPreviewHealthFactor + +Lending health-factor change. Contains `before` / `after` values for lending protocols (e.g. Aave / Venus); `null` for non-lending protocols or when health factor is unavailable. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**before** | **String** | Health factor before this transaction. Null when unavailable. | [optional] | +|**after** | **String** | Health factor after this transaction. Null when unavailable. | [optional] | + + + diff --git a/clients/web3-wallet/docs/DefiPreviewWarningsInner.md b/clients/web3-wallet/docs/DefiPreviewWarningsInner.md new file mode 100644 index 0000000..6856478 --- /dev/null +++ b/clients/web3-wallet/docs/DefiPreviewWarningsInner.md @@ -0,0 +1,16 @@ + + +# DefiPreviewWarningsInner + +A single non-blocking risk warning. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**code** | **String** | Warning code. Known values: `HEALTH_FACTOR_WARNING`, `HEALTH_FACTOR_DANGER`, `HIGH_SLIPPAGE`, `DELAYED_REDEMPTION`, `LP_OUT_OF_RANGE`. Branch on `code` for control flow; display `message` as-is. | [optional] | +|**level** | **String** | Severity level — INFO / WARN / DANGER. | [optional] | +|**message** | **String** | Human-readable warning text. | [optional] | + + + diff --git a/clients/web3-wallet/docs/DefiProtocolDimensionScoresDto.md b/clients/web3-wallet/docs/DefiProtocolDimensionScoresDto.md new file mode 100644 index 0000000..5387c93 --- /dev/null +++ b/clients/web3-wallet/docs/DefiProtocolDimensionScoresDto.md @@ -0,0 +1,19 @@ + + +# DefiProtocolDimensionScoresDto + +CertiK six-dimension security scores. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**codeSecurity** | **String** | Code security score. | [optional] | +|**fundamentalHealth** | **String** | Fundamental health score. | [optional] | +|**operationalResilience** | **String** | Operational resilience score. | [optional] | +|**communityTrust** | **String** | Community trust score. | [optional] | +|**governanceStrength** | **String** | Governance strength score. | [optional] | +|**marketStability** | **String** | Market stability score. | [optional] | + + + diff --git a/clients/web3-wallet/docs/DefiProtocolDto.md b/clients/web3-wallet/docs/DefiProtocolDto.md new file mode 100644 index 0000000..895dbf5 --- /dev/null +++ b/clients/web3-wallet/docs/DefiProtocolDto.md @@ -0,0 +1,21 @@ + + +# DefiProtocolDto + +DeFi protocol summary (list item). + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**defiProtocolId** | **String** | DeFi protocol identifier. | [optional] | +|**protocolName** | **String** | Protocol display name. | [optional] | +|**protocolLogo** | **String** | Protocol logo image URL (full URL; quote as-is). | [optional] | +|**tvl** | **String** | Total value locked in the protocol (USD). String, raw precision from the data source. | [optional] | +|**apyBps** | **Long** | Highest APY across the protocol's investments, in basis points (1 bps = 0.01%). Integer value — use this for sorting / comparing / filtering, never the raw decimal. | [optional] | +|**apyDisplay** | **String** | Pre-formatted, human-readable APY string for display (e.g. \"12.35%\"). Quote as-is; do not re-compute or transform. | [optional] | +|**investType** | **List<String>** | Investment types supported by this protocol — an array here (a protocol may support several). Note: the investment-level investType (in investment list/detail) is a single string. Known values: Earn, LiquidityPool. | [optional] | +|**supportedChains** | **List<String>** | Supported Binance chain IDs. | [optional] | + + + diff --git a/clients/web3-wallet/docs/DefiProtocolFaqDto.md b/clients/web3-wallet/docs/DefiProtocolFaqDto.md new file mode 100644 index 0000000..9463a75 --- /dev/null +++ b/clients/web3-wallet/docs/DefiProtocolFaqDto.md @@ -0,0 +1,15 @@ + + +# DefiProtocolFaqDto + +FAQ entry. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**title** | **String** | FAQ question text (already translated; quote as-is). | [optional] | +|**answer** | **String** | FAQ answer text (already translated; quote as-is). May contain line-break markup `<Br/>` and paragraph-gap markup `<Gap/>` — interpret them as line / paragraph breaks. | [optional] | + + + diff --git a/clients/web3-wallet/docs/DefiProtocolFundRaisingDto.md b/clients/web3-wallet/docs/DefiProtocolFundRaisingDto.md new file mode 100644 index 0000000..ae57e50 --- /dev/null +++ b/clients/web3-wallet/docs/DefiProtocolFundRaisingDto.md @@ -0,0 +1,17 @@ + + +# DefiProtocolFundRaisingDto + +Fundraising round. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**round** | **String** | Round name (e.g. \"Strategic\"). | [optional] | +|**amount** | **String** | Amount raised. Null when not disclosed. | [optional] | +|**date** | **String** | Round date. | [optional] | +|**investors** | **List<String>** | Investor names. | [optional] | + + + diff --git a/clients/web3-wallet/docs/DefiProtocolInfoDto.md b/clients/web3-wallet/docs/DefiProtocolInfoDto.md new file mode 100644 index 0000000..9073e79 --- /dev/null +++ b/clients/web3-wallet/docs/DefiProtocolInfoDto.md @@ -0,0 +1,32 @@ + + +# DefiProtocolInfoDto + +DeFi protocol detail. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**defiProtocolId** | **String** | DeFi protocol identifier. | [optional] | +|**protocolName** | **String** | Protocol display name. | [optional] | +|**protocolLogo** | **String** | Protocol logo image URL (full URL under `https://bin.bnbstatic.com`). | [optional] | +|**description** | **String** | Protocol description (already translated; quote as-is). | [optional] | +|**websiteUrl** | **String** | Official website URL. | [optional] | +|**investType** | **List<String>** | Investment types supported by this protocol — an array here (a protocol may support several). Note: the investment-level investType (in investment list/detail) is a single string. Known values: Earn, LiquidityPool. | [optional] | +|**supportedChains** | **List<String>** | Supported Binance chain IDs. | [optional] | +|**tvl** | **String** | Total value locked (USD). String, raw precision from the data source. | [optional] | +|**tags** | **List<String>** | Protocol tags / categories. | [optional] | +|**founded** | **String** | Founding year (YYYY). | [optional] | +|**fdv** | **String** | Fully diluted valuation. | [optional] | +|**totalFunding** | **String** | Total funding raised. Null when not disclosed. | [optional] | +|**socialLinks** | [**DefiProtocolInfoDtoSocialLinks**](DefiProtocolInfoDtoSocialLinks.md) | | [optional] | +|**team** | [**List<DefiProtocolInfoDtoTeamInner>**](DefiProtocolInfoDtoTeamInner.md) | Team members. | [optional] | +|**fundRaising** | [**List<DefiProtocolInfoDtoFundRaisingInner>**](DefiProtocolInfoDtoFundRaisingInner.md) | Fundraising history. | [optional] | +|**securityScore** | **String** | Overall CertiK security score. | [optional] | +|**dimensionScores** | [**DefiProtocolInfoDtoDimensionScores**](DefiProtocolInfoDtoDimensionScores.md) | | [optional] | +|**highlights** | **List<String>** | Protocol highlights (already translated; quote as-is). | [optional] | +|**faq** | [**List<DefiProtocolInfoDtoFaqInner>**](DefiProtocolInfoDtoFaqInner.md) | FAQ entries (question and answer text, already translated). | [optional] | + + + diff --git a/clients/web3-wallet/docs/DefiProtocolInfoDtoDimensionScores.md b/clients/web3-wallet/docs/DefiProtocolInfoDtoDimensionScores.md new file mode 100644 index 0000000..466b1d7 --- /dev/null +++ b/clients/web3-wallet/docs/DefiProtocolInfoDtoDimensionScores.md @@ -0,0 +1,19 @@ + + +# DefiProtocolInfoDtoDimensionScores + +CertiK six-dimension security scores. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**codeSecurity** | **String** | Code security score. | [optional] | +|**fundamentalHealth** | **String** | Fundamental health score. | [optional] | +|**operationalResilience** | **String** | Operational resilience score. | [optional] | +|**communityTrust** | **String** | Community trust score. | [optional] | +|**governanceStrength** | **String** | Governance strength score. | [optional] | +|**marketStability** | **String** | Market stability score. | [optional] | + + + diff --git a/clients/web3-wallet/docs/DefiProtocolInfoDtoFaqInner.md b/clients/web3-wallet/docs/DefiProtocolInfoDtoFaqInner.md new file mode 100644 index 0000000..70d1c34 --- /dev/null +++ b/clients/web3-wallet/docs/DefiProtocolInfoDtoFaqInner.md @@ -0,0 +1,15 @@ + + +# DefiProtocolInfoDtoFaqInner + +FAQ entry. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**title** | **String** | FAQ question text (already translated; quote as-is). | [optional] | +|**answer** | **String** | FAQ answer text (already translated; quote as-is). May contain line-break markup `<Br/>` and paragraph-gap markup `<Gap/>` — interpret them as line / paragraph breaks. | [optional] | + + + diff --git a/clients/web3-wallet/docs/DefiProtocolInfoDtoFundRaisingInner.md b/clients/web3-wallet/docs/DefiProtocolInfoDtoFundRaisingInner.md new file mode 100644 index 0000000..bae968f --- /dev/null +++ b/clients/web3-wallet/docs/DefiProtocolInfoDtoFundRaisingInner.md @@ -0,0 +1,17 @@ + + +# DefiProtocolInfoDtoFundRaisingInner + +Fundraising round. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**round** | **String** | Round name (e.g. \"Strategic\"). | [optional] | +|**amount** | **String** | Amount raised. Null when not disclosed. | [optional] | +|**date** | **String** | Round date. | [optional] | +|**investors** | **List<String>** | Investor names. | [optional] | + + + diff --git a/clients/web3-wallet/docs/DefiProtocolInfoDtoSocialLinks.md b/clients/web3-wallet/docs/DefiProtocolInfoDtoSocialLinks.md new file mode 100644 index 0000000..35731ef --- /dev/null +++ b/clients/web3-wallet/docs/DefiProtocolInfoDtoSocialLinks.md @@ -0,0 +1,20 @@ + + +# DefiProtocolInfoDtoSocialLinks + +Protocol social media links. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**xLowerCase** | **String** | X (Twitter) profile URL. Null when not available. | [optional] | +|**discord** | **String** | Discord invite URL. Null when not available. | [optional] | +|**github** | **String** | GitHub organization URL. Null when not available. | [optional] | +|**linkedin** | **String** | LinkedIn company URL. Null when not available. | [optional] | +|**telegram** | **String** | Telegram channel URL. Null when not available. | [optional] | +|**gitbook** | **String** | GitBook documentation URL. Empty string or null when not available. | [optional] | +|**website** | **String** | Official website URL. | [optional] | + + + diff --git a/clients/web3-wallet/docs/DefiProtocolInfoDtoTeamInner.md b/clients/web3-wallet/docs/DefiProtocolInfoDtoTeamInner.md new file mode 100644 index 0000000..24145d5 --- /dev/null +++ b/clients/web3-wallet/docs/DefiProtocolInfoDtoTeamInner.md @@ -0,0 +1,18 @@ + + +# DefiProtocolInfoDtoTeamInner + +Protocol team member. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **String** | Member name. | [optional] | +|**role** | **String** | Member role / title. | [optional] | +|**twitter** | **String** | Member's X (Twitter) handle URL. Null when not available. | [optional] | +|**linkedin** | **String** | Member's LinkedIn URL. Null when not available. | [optional] | +|**bio** | **String** | Member biography. Null when not available. | [optional] | + + + diff --git a/clients/web3-wallet/docs/DefiProtocolSocialLinksDto.md b/clients/web3-wallet/docs/DefiProtocolSocialLinksDto.md new file mode 100644 index 0000000..0c67185 --- /dev/null +++ b/clients/web3-wallet/docs/DefiProtocolSocialLinksDto.md @@ -0,0 +1,20 @@ + + +# DefiProtocolSocialLinksDto + +Protocol social media links. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**xLowerCase** | **String** | X (Twitter) profile URL. Null when not available. | [optional] | +|**discord** | **String** | Discord invite URL. Null when not available. | [optional] | +|**github** | **String** | GitHub organization URL. Null when not available. | [optional] | +|**linkedin** | **String** | LinkedIn company URL. Null when not available. | [optional] | +|**telegram** | **String** | Telegram channel URL. Null when not available. | [optional] | +|**gitbook** | **String** | GitBook documentation URL. Empty string or null when not available. | [optional] | +|**website** | **String** | Official website URL. | [optional] | + + + diff --git a/clients/web3-wallet/docs/DefiProtocolTeamMemberDto.md b/clients/web3-wallet/docs/DefiProtocolTeamMemberDto.md new file mode 100644 index 0000000..faeb9d5 --- /dev/null +++ b/clients/web3-wallet/docs/DefiProtocolTeamMemberDto.md @@ -0,0 +1,18 @@ + + +# DefiProtocolTeamMemberDto + +Protocol team member. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **String** | Member name. | [optional] | +|**role** | **String** | Member role / title. | [optional] | +|**twitter** | **String** | Member's X (Twitter) handle URL. Null when not available. | [optional] | +|**linkedin** | **String** | Member's LinkedIn URL. Null when not available. | [optional] | +|**bio** | **String** | Member biography. Null when not available. | [optional] | + + + diff --git a/clients/web3-wallet/docs/DefiTokenItem.md b/clients/web3-wallet/docs/DefiTokenItem.md new file mode 100644 index 0000000..eaf655c --- /dev/null +++ b/clients/web3-wallet/docs/DefiTokenItem.md @@ -0,0 +1,15 @@ + + +# DefiTokenItem + +A `(tokenAddress, amount)` pair. `amount` is a human-readable decimal string (NOT the token's smallest unit); the service converts it according to the token's decimals. For the native asset use the sentinel `0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee` (40 `e`s). + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**tokenAddress** | **String** | Token contract address; the native-asset sentinel for the native coin. | | +|**amount** | **String** | Human-readable amount as a decimal string, e.g. \"1.5\", \"100\". | | + + + diff --git a/clients/web3-wallet/docs/DefiTransactionApi.md b/clients/web3-wallet/docs/DefiTransactionApi.md new file mode 100644 index 0000000..e5c30b3 --- /dev/null +++ b/clients/web3-wallet/docs/DefiTransactionApi.md @@ -0,0 +1,446 @@ +# DefiTransactionApi + +All URIs are relative to *https://web3.binance.com/build* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**buildDeFiClaimTransaction**](DefiTransactionApi.md#buildDeFiClaimTransaction) | **POST** /api/v1/defi/transaction/claim | Build DeFi Claim Transaction | +| [**buildDeFiDepositTransaction**](DefiTransactionApi.md#buildDeFiDepositTransaction) | **POST** /api/v1/defi/transaction/deposit | Build DeFi Deposit Transaction | +| [**buildDeFiRedeemTransaction**](DefiTransactionApi.md#buildDeFiRedeemTransaction) | **POST** /api/v1/defi/transaction/redeem | Build DeFi Redeem Transaction | +| [**buildLpAddTransaction**](DefiTransactionApi.md#buildLpAddTransaction) | **POST** /api/v1/defi/transaction/lp-add | Build LP Add Transaction | +| [**buildLpRemoveTransaction**](DefiTransactionApi.md#buildLpRemoveTransaction) | **POST** /api/v1/defi/transaction/lp-remove | Build LP Remove Transaction | +| [**calculateLpAddPairedAmounts**](DefiTransactionApi.md#calculateLpAddPairedAmounts) | **POST** /api/v1/defi/transaction/lp-add/calculate | Calculate LP Add Paired Amounts | + + + +# **buildDeFiClaimTransaction** +> BuildDeFiClaimTransactionResponse buildDeFiClaimTransaction(buildDeFiClaimTransactionRequest).recvWindow(recvWindow).nonce(nonce).execute(); + +Build DeFi Claim Transaction + +Build the unsigned claim calldata for one of four claim types — see `DefiClaimType` for which companion fields each type requires **and which protocol constraints apply** (e.g. `REWARD_PROTOCOL` is not supported for LP protocols; PancakeSwap V3 farming uses `LP_FEE`, not `REWARD_INVESTMENT`). Returns an ordered `dataList` (typically `[CLAIM]`). **`binanceChainId` resolution rules**: - Normally resolved from `investmentId`; the call always executes on that chain. - For claim types other than `REWARD_PROTOCOL`, any client-supplied `binanceChainId` is **silently ignored** — passing a different chainId will not redirect the claim. - **Exception**: `REWARD_PROTOCOL` with no `investmentId` — the client MUST pass `binanceChainId` (it is the only chain signal). `tokenAddressList` optionally narrows the claim scope. Set `simulate=true` to also receive `preview`. + +### Example +```java +// Import classes: +import com.binance.connector.client.web3_wallet.ApiClient; +import com.binance.connector.client.web3_wallet.ApiException; +import com.binance.connector.client.web3_wallet.Configuration; +import com.binance.connector.client.web3_wallet.models.*; +import com.binance.connector.client.web3_wallet.rest.api.DefiTransactionApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://web3.binance.com/build"); + + DefiTransactionApi apiInstance = new DefiTransactionApi(defaultClient); + BuildDeFiClaimTransactionRequest buildDeFiClaimTransactionRequest = new BuildDeFiClaimTransactionRequest(); // BuildDeFiClaimTransactionRequest | + Long recvWindow = 5000L; // Long | Allowed time deviation in milliseconds (default: 5000, max: 60000). + String nonce = "unique-nonce-string"; // String | Unique request identifier for anti-replay; falls back to X-OC-SIGN if omitted. + try { + BuildDeFiClaimTransactionResponse result = apiInstance.buildDeFiClaimTransaction(buildDeFiClaimTransactionRequest) + .recvWindow(recvWindow) + .nonce(nonce) + .execute(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DefiTransactionApi#buildDeFiClaimTransaction"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **buildDeFiClaimTransactionRequest** | [**BuildDeFiClaimTransactionRequest**](BuildDeFiClaimTransactionRequest.md)| | | +| **recvWindow** | **Long**| Allowed time deviation in milliseconds (default: 5000, max: 60000). | [optional] | +| **nonce** | **String**| Unique request identifier for anti-replay; falls back to X-OC-SIGN if omitted. | [optional] | + +### Return type + +[**BuildDeFiClaimTransactionResponse**](BuildDeFiClaimTransactionResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Claim transaction calldata returned successfully. | - | +| **401** | Unauthorized. The request is missing or contains an invalid API key. | - | +| **403** | Forbidden. The API key does not have permission to access this endpoint. | - | +| **404** | Not Found. The requested resource or endpoint does not exist. | - | + + +# **buildDeFiDepositTransaction** +> BuildDeFiDepositTransactionResponse buildDeFiDepositTransaction(buildDeFiDepositTransactionRequest).recvWindow(recvWindow).nonce(nonce).execute(); + +Build DeFi Deposit Transaction + +Build the unsigned transaction calldata for a DeFi deposit / stake. Returns an ordered `dataList` (typically `[APPROVE, DEPOSIT]`, or `[DEPOSIT]` when the allowance is already sufficient) for the caller to sign and broadcast. The caller does NOT pass `binanceChainId` — the service resolves it from `investmentId`. Set `simulate=true` to also receive a `preview` (projected balance change, estimated gas, and lending health-factor change) without broadcasting. + +### Example +```java +// Import classes: +import com.binance.connector.client.web3_wallet.ApiClient; +import com.binance.connector.client.web3_wallet.ApiException; +import com.binance.connector.client.web3_wallet.Configuration; +import com.binance.connector.client.web3_wallet.models.*; +import com.binance.connector.client.web3_wallet.rest.api.DefiTransactionApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://web3.binance.com/build"); + + DefiTransactionApi apiInstance = new DefiTransactionApi(defaultClient); + BuildDeFiDepositTransactionRequest buildDeFiDepositTransactionRequest = new BuildDeFiDepositTransactionRequest(); // BuildDeFiDepositTransactionRequest | + Long recvWindow = 5000L; // Long | Allowed time deviation in milliseconds (default: 5000, max: 60000). + String nonce = "unique-nonce-string"; // String | Unique request identifier for anti-replay; falls back to X-OC-SIGN if omitted. + try { + BuildDeFiDepositTransactionResponse result = apiInstance.buildDeFiDepositTransaction(buildDeFiDepositTransactionRequest) + .recvWindow(recvWindow) + .nonce(nonce) + .execute(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DefiTransactionApi#buildDeFiDepositTransaction"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **buildDeFiDepositTransactionRequest** | [**BuildDeFiDepositTransactionRequest**](BuildDeFiDepositTransactionRequest.md)| | | +| **recvWindow** | **Long**| Allowed time deviation in milliseconds (default: 5000, max: 60000). | [optional] | +| **nonce** | **String**| Unique request identifier for anti-replay; falls back to X-OC-SIGN if omitted. | [optional] | + +### Return type + +[**BuildDeFiDepositTransactionResponse**](BuildDeFiDepositTransactionResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Deposit transaction calldata returned successfully. | - | +| **401** | Unauthorized. The request is missing or contains an invalid API key. | - | +| **403** | Forbidden. The API key does not have permission to access this endpoint. | - | +| **404** | Not Found. The requested resource or endpoint does not exist. | - | + + +# **buildDeFiRedeemTransaction** +> BuildDeFiRedeemTransactionResponse buildDeFiRedeemTransaction(buildDeFiRedeemTransactionRequest).recvWindow(recvWindow).nonce(nonce).execute(); + +Build DeFi Redeem Transaction + +Build the unsigned transaction calldata for a DeFi redeem / withdraw. Returns an ordered `dataList` (typically `[REDEEM]` or `[APPROVE, REDEEM]`). **Redeem amount is decided by exactly one of `ratio` or `token`** (mutually exclusive): - `ratio` omitted / blank → **exact-amount redeem**: the amount comes from `token` (`tokenAddress` + `amount`); the position is *not* queried. `token` is required in this mode (omitting `token`, or leaving `amount` blank, is rejected with `40001`, `Parameter error`; both `ratio` and `token` absent is also rejected with `40001`). - `ratio` present → **proportional redeem**: must parse as a decimal in `(0, 1]`. The service queries the user's on-chain position under `investmentId` and scales each token's amount by `ratio` (floored to the token's decimals). `ratio=\"1\"` is a full (max) redeem. In this mode `token` is **ignored** — the output tokens and amounts are derived from the position. `slippageBps` is the slippage tolerance in basis points (e.g. `300` = 3%). The caller does NOT pass `binanceChainId` — resolved from `investmentId`. Set `simulate=true` to also receive `preview`. The response also carries `redeemDelayDays` — the redeem waiting period as a `[min, max]` day pair (e.g. `[\"7\",\"10\"]` = 7–10 days, `[]` = instant). The wait starts after the redeem tx is confirmed on-chain. See the `redeemDelayDays` field on `DefiTxResponse`. + +### Example +```java +// Import classes: +import com.binance.connector.client.web3_wallet.ApiClient; +import com.binance.connector.client.web3_wallet.ApiException; +import com.binance.connector.client.web3_wallet.Configuration; +import com.binance.connector.client.web3_wallet.models.*; +import com.binance.connector.client.web3_wallet.rest.api.DefiTransactionApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://web3.binance.com/build"); + + DefiTransactionApi apiInstance = new DefiTransactionApi(defaultClient); + BuildDeFiRedeemTransactionRequest buildDeFiRedeemTransactionRequest = new BuildDeFiRedeemTransactionRequest(); // BuildDeFiRedeemTransactionRequest | + Long recvWindow = 5000L; // Long | Allowed time deviation in milliseconds (default: 5000, max: 60000). + String nonce = "unique-nonce-string"; // String | Unique request identifier for anti-replay; falls back to X-OC-SIGN if omitted. + try { + BuildDeFiRedeemTransactionResponse result = apiInstance.buildDeFiRedeemTransaction(buildDeFiRedeemTransactionRequest) + .recvWindow(recvWindow) + .nonce(nonce) + .execute(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DefiTransactionApi#buildDeFiRedeemTransaction"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **buildDeFiRedeemTransactionRequest** | [**BuildDeFiRedeemTransactionRequest**](BuildDeFiRedeemTransactionRequest.md)| | | +| **recvWindow** | **Long**| Allowed time deviation in milliseconds (default: 5000, max: 60000). | [optional] | +| **nonce** | **String**| Unique request identifier for anti-replay; falls back to X-OC-SIGN if omitted. | [optional] | + +### Return type + +[**BuildDeFiRedeemTransactionResponse**](BuildDeFiRedeemTransactionResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Redeem transaction calldata returned successfully. | - | +| **401** | Unauthorized. The request is missing or contains an invalid API key. | - | +| **403** | Forbidden. The API key does not have permission to access this endpoint. | - | +| **404** | Not Found. The requested resource or endpoint does not exist. | - | + + +# **buildLpAddTransaction** +> BuildLpAddTransactionResponse buildLpAddTransaction(buildLpAddTransactionRequest).recvWindow(recvWindow).nonce(nonce).execute(); + +Build LP Add Transaction + +Build the unsigned transaction calldata for adding liquidity. `tokenList` supports multiple tokens. Returns an ordered `dataList` (typically `[APPROVE, LP_ADD]`). **Tick range source (provide exactly one group)**: 1. `nftId` — append to an existing LP position (reuses its range). 2. `priceRange` — percentage band (e.g. `\"5\"` = ±5%) for a new position. 3. `tickLower` + `tickUpper` — explicit raw `int24` pair for a new position. **Rules**: - If more than one group is supplied, only the highest-priority one above is used and the others are silently ignored (priority: `nftId` > `priceRange` > explicit tick pair). - If none is supplied, the request is rejected (`40453`). - `tickLower` / `tickUpper` are raw `int24` values and MUST be aligned to the pool's `tickSpacing`, otherwise the request is rejected (`40453`). - The caller does NOT pass `binanceChainId` — resolved from `investmentId`. + +### Example +```java +// Import classes: +import com.binance.connector.client.web3_wallet.ApiClient; +import com.binance.connector.client.web3_wallet.ApiException; +import com.binance.connector.client.web3_wallet.Configuration; +import com.binance.connector.client.web3_wallet.models.*; +import com.binance.connector.client.web3_wallet.rest.api.DefiTransactionApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://web3.binance.com/build"); + + DefiTransactionApi apiInstance = new DefiTransactionApi(defaultClient); + BuildLpAddTransactionRequest buildLpAddTransactionRequest = new BuildLpAddTransactionRequest(); // BuildLpAddTransactionRequest | + Long recvWindow = 5000L; // Long | Allowed time deviation in milliseconds (default: 5000, max: 60000). + String nonce = "unique-nonce-string"; // String | Unique request identifier for anti-replay; falls back to X-OC-SIGN if omitted. + try { + BuildLpAddTransactionResponse result = apiInstance.buildLpAddTransaction(buildLpAddTransactionRequest) + .recvWindow(recvWindow) + .nonce(nonce) + .execute(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DefiTransactionApi#buildLpAddTransaction"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **buildLpAddTransactionRequest** | [**BuildLpAddTransactionRequest**](BuildLpAddTransactionRequest.md)| | | +| **recvWindow** | **Long**| Allowed time deviation in milliseconds (default: 5000, max: 60000). | [optional] | +| **nonce** | **String**| Unique request identifier for anti-replay; falls back to X-OC-SIGN if omitted. | [optional] | + +### Return type + +[**BuildLpAddTransactionResponse**](BuildLpAddTransactionResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | LP add transaction calldata returned successfully. | - | +| **401** | Unauthorized. The request is missing or contains an invalid API key. | - | +| **403** | Forbidden. The API key does not have permission to access this endpoint. | - | +| **404** | Not Found. The requested resource or endpoint does not exist. | - | + + +# **buildLpRemoveTransaction** +> BuildLpRemoveTransactionResponse buildLpRemoveTransaction(buildLpRemoveTransactionRequest).recvWindow(recvWindow).nonce(nonce).execute(); + +Build LP Remove Transaction + +Build the unsigned transaction calldata for removing liquidity. Removal is by `nftId` + `ratio` (range `(0, 1]`) — no `tokenList` is needed; the per-token amounts are derived from the on-chain position. Returns an ordered `dataList` (typically `[LP_REMOVE]`). `slippageBps` is the LP-leg slippage tolerance in basis points. The caller does NOT pass `binanceChainId` — resolved from `investmentId`. + +### Example +```java +// Import classes: +import com.binance.connector.client.web3_wallet.ApiClient; +import com.binance.connector.client.web3_wallet.ApiException; +import com.binance.connector.client.web3_wallet.Configuration; +import com.binance.connector.client.web3_wallet.models.*; +import com.binance.connector.client.web3_wallet.rest.api.DefiTransactionApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://web3.binance.com/build"); + + DefiTransactionApi apiInstance = new DefiTransactionApi(defaultClient); + BuildLpRemoveTransactionRequest buildLpRemoveTransactionRequest = new BuildLpRemoveTransactionRequest(); // BuildLpRemoveTransactionRequest | + Long recvWindow = 5000L; // Long | Allowed time deviation in milliseconds (default: 5000, max: 60000). + String nonce = "unique-nonce-string"; // String | Unique request identifier for anti-replay; falls back to X-OC-SIGN if omitted. + try { + BuildLpRemoveTransactionResponse result = apiInstance.buildLpRemoveTransaction(buildLpRemoveTransactionRequest) + .recvWindow(recvWindow) + .nonce(nonce) + .execute(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DefiTransactionApi#buildLpRemoveTransaction"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **buildLpRemoveTransactionRequest** | [**BuildLpRemoveTransactionRequest**](BuildLpRemoveTransactionRequest.md)| | | +| **recvWindow** | **Long**| Allowed time deviation in milliseconds (default: 5000, max: 60000). | [optional] | +| **nonce** | **String**| Unique request identifier for anti-replay; falls back to X-OC-SIGN if omitted. | [optional] | + +### Return type + +[**BuildLpRemoveTransactionResponse**](BuildLpRemoveTransactionResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | LP remove transaction calldata returned successfully. | - | +| **401** | Unauthorized. The request is missing or contains an invalid API key. | - | +| **403** | Forbidden. The API key does not have permission to access this endpoint. | - | +| **404** | Not Found. The requested resource or endpoint does not exist. | - | + + +# **calculateLpAddPairedAmounts** +> CalculateLpAddPairedAmountsResponse calculateLpAddPairedAmounts(calculateLpAddPairedAmountsRequest).recvWindow(recvWindow).nonce(nonce).execute(); + +Calculate LP Add Paired Amounts + +Given a single input token, calculate the paired token amount needed for an LP add. This is a **pure computation endpoint** — it does not touch the chain and does not deduct any fee. Use it before `/transaction/lp-add` to size the paired token when only one side is supplied. Tick range source rules are the same as `/lp-add` — provide exactly one group: `nftId` (existing position), `priceRange`, or `tickLower`+`tickUpper`. - If more than one group is supplied, only the highest-priority one is used and the others are silently ignored (priority: `nftId` > `priceRange` > explicit tick pair). - If none is supplied, the request is rejected. - The caller does NOT pass `binanceChainId` — resolved from `investmentId`. + +### Example +```java +// Import classes: +import com.binance.connector.client.web3_wallet.ApiClient; +import com.binance.connector.client.web3_wallet.ApiException; +import com.binance.connector.client.web3_wallet.Configuration; +import com.binance.connector.client.web3_wallet.models.*; +import com.binance.connector.client.web3_wallet.rest.api.DefiTransactionApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://web3.binance.com/build"); + + DefiTransactionApi apiInstance = new DefiTransactionApi(defaultClient); + CalculateLpAddPairedAmountsRequest calculateLpAddPairedAmountsRequest = new CalculateLpAddPairedAmountsRequest(); // CalculateLpAddPairedAmountsRequest | + Long recvWindow = 5000L; // Long | Allowed time deviation in milliseconds (default: 5000, max: 60000). + String nonce = "unique-nonce-string"; // String | Unique request identifier for anti-replay; falls back to X-OC-SIGN if omitted. + try { + CalculateLpAddPairedAmountsResponse result = apiInstance.calculateLpAddPairedAmounts(calculateLpAddPairedAmountsRequest) + .recvWindow(recvWindow) + .nonce(nonce) + .execute(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DefiTransactionApi#calculateLpAddPairedAmounts"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **calculateLpAddPairedAmountsRequest** | [**CalculateLpAddPairedAmountsRequest**](CalculateLpAddPairedAmountsRequest.md)| | | +| **recvWindow** | **Long**| Allowed time deviation in milliseconds (default: 5000, max: 60000). | [optional] | +| **nonce** | **String**| Unique request identifier for anti-replay; falls back to X-OC-SIGN if omitted. | [optional] | + +### Return type + +[**CalculateLpAddPairedAmountsResponse**](CalculateLpAddPairedAmountsResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Paired token amounts returned successfully. | - | +| **401** | Unauthorized. The request is missing or contains an invalid API key. | - | +| **403** | Forbidden. The API key does not have permission to access this endpoint. | - | +| **404** | Not Found. The requested resource or endpoint does not exist. | - | + diff --git a/clients/web3-wallet/docs/DefiTxResponse.md b/clients/web3-wallet/docs/DefiTxResponse.md new file mode 100644 index 0000000..5711807 --- /dev/null +++ b/clients/web3-wallet/docs/DefiTxResponse.md @@ -0,0 +1,16 @@ + + +# DefiTxResponse + +Unified response of the five build endpoints (deposit / redeem / lp-add / lp-remove / claim). `dataList` is ordered: APPROVE items come first, the main action follows — sign and broadcast each item in order. `preview` is non-null only when the request set `simulate=true`. `redeemDelayDays` is populated only by `/transaction/redeem`. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**dataList** | [**List<DefiTxResponseDataListInner>**](DefiTxResponseDataListInner.md) | Ordered unsigned transactions; APPROVE precedes the main action. | [optional] | +|**preview** | [**DefiTxResponsePreview**](DefiTxResponsePreview.md) | | [optional] | +|**redeemDelayDays** | **List<String>** | Redeem waiting period as a `[min, max]` day pair of decimal strings. Populated **only** by `/transaction/redeem`; `null` on the other build endpoints or when unavailable. Interpretation: `[]` (empty) = instant, no waiting period; `[\"7\",\"7\"]` = fixed 7 days; `[\"7\",\"10\"]` = 7–10 days. The wait starts after the redeem transaction is confirmed on-chain. | [optional] | + + + diff --git a/clients/web3-wallet/docs/DefiTxResponseDataListInner.md b/clients/web3-wallet/docs/DefiTxResponseDataListInner.md new file mode 100644 index 0000000..979726e --- /dev/null +++ b/clients/web3-wallet/docs/DefiTxResponseDataListInner.md @@ -0,0 +1,35 @@ + + +# DefiTxResponseDataListInner + +A single unsigned transaction to sign and broadcast. The `dataList` is ordered: APPROVE items precede the main action. EVM chains return `to`/`value` (hex) and hex calldata in `data`. **Number-format conventions for this object** — `value` is a `0x`-prefixed hex string; `gasLimit`, `gasPrice`, `maxPriorityFeePerGas`, and `maxFeePerGas` are decimal strings. Mixed hex/decimal within the same object is by design (it mirrors the on-chain transaction fields); always parse gas fields with base-10 and `value` with base-16. **BSC and EIP-1559**: this release is BSC only. BSC is an EIP-1559 chain, so build responses populate `maxFeePerGas` and `maxPriorityFeePerGas`; `gasPrice` is `null` (legacy-only). The nullable markers below are retained so the schema also describes non-1559 chains in later releases — on BSC the 1559 fields are present and the legacy `gasPrice` is `null`. `to` and `value` are non-null for every action item on BSC. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**callDataType** | [**CallDataTypeEnum**](#CallDataTypeEnum) | Action kind of this item: - `APPROVE` — ERC-20 approval, must be signed/broadcast and confirmed before the main action - `DEPOSIT` / `REDEEM` / `LP_ADD` / `LP_REMOVE` / `CLAIM` — the main action. `LP_ADD` / `LP_REMOVE` are the LP add / remove legs (the same build path as deposit / redeem for liquidity-pool investments; the kind reflects the on-chain action, not the entry endpoint). | [optional] | +|**from** | **String** | User wallet address (the signer / sender). EIP-55 checksummed — normalize with `to_checksum_address` before signing if your signer requires it. | [optional] | +|**to** | **String** | Target contract address. EIP-55 checksummed, same format as `from`. Non-null on BSC for every action item. | [optional] | +|**value** | **String** | Native-asset value as a `0x`-prefixed hex string. Non-null on BSC for action items. | [optional] | +|**data** | **String** | Serialized transaction data, as a `0x`-prefixed hex calldata string. | [optional] | +|**gasLimit** | **String** | Suggested gas limit (decimal string). `null` when estimation fails. | [optional] | +|**gasPrice** | **String** | Legacy gas price, decimal string. `null` on EIP-1559 chains such as BSC (use `maxFeePerGas` / `maxPriorityFeePerGas` instead). | [optional] | +|**maxPriorityFeePerGas** | **String** | EIP-1559 priority fee in wei (decimal string). `null` on non-1559 chains. | [optional] | +|**maxFeePerGas** | **String** | EIP-1559 max fee per gas in wei (decimal string). `null` on non-1559 chains. | [optional] | + + + +## Enum: CallDataTypeEnum + +| Name | Value | +|---- | -----| +| APPROVE | "APPROVE" | +| DEPOSIT | "DEPOSIT" | +| REDEEM | "REDEEM" | +| LP_ADD | "LP_ADD" | +| LP_REMOVE | "LP_REMOVE" | +| CLAIM | "CLAIM" | + + + diff --git a/clients/web3-wallet/docs/DefiTxResponsePreview.md b/clients/web3-wallet/docs/DefiTxResponsePreview.md new file mode 100644 index 0000000..8bfa5c4 --- /dev/null +++ b/clients/web3-wallet/docs/DefiTxResponsePreview.md @@ -0,0 +1,19 @@ + + +# DefiTxResponsePreview + +Simulation result returned by the build endpoints when `simulate=true`. Includes whether the action is expected to succeed, the projected balance change, the estimated network fee, and — for lending protocols — the health-factor change. `balanceChange`, `feeAndContract`, `healthFactor`, and `warnings` each have a fixed structure (see below); the number of entries and some inner values vary by protocol. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**success** | **Boolean** | Whether the simulated transaction is expected to succeed on-chain. | [optional] | +|**balanceChange** | [**List<DefiPreviewBalanceChangeInner>**](DefiPreviewBalanceChangeInner.md) | Signed token balance deltas from the simulation. Each entry has `tokenType`, `tokenSymbol`, `tokenAddress`, `tokenDecimals`, `amount` (positive = received, negative = spent), `valueUsd`, and an optional `tokenId`. | [optional] | +|**feeAndContract** | [**DefiPreviewFeeAndContract**](DefiPreviewFeeAndContract.md) | | [optional] | +|**healthFactor** | [**DefiPreviewHealthFactor**](DefiPreviewHealthFactor.md) | | [optional] | +|**warnings** | [**List<DefiPreviewWarningsInner>**](DefiPreviewWarningsInner.md) | Non-blocking risk warnings. Empty array when there are no warnings. | [optional] | +|**errorMessage** | **String** | Error message when the simulated transaction is expected to fail. | [optional] | + + + diff --git a/clients/web3-wallet/docs/GetB402SupportedConfigurationsV1Request.md b/clients/web3-wallet/docs/GetB402SupportedConfigurationsV1Request.md new file mode 100644 index 0000000..3a28507 --- /dev/null +++ b/clients/web3-wallet/docs/GetB402SupportedConfigurationsV1Request.md @@ -0,0 +1,13 @@ + + +# GetB402SupportedConfigurationsV1Request + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**body** | **Object** | | | + + + diff --git a/clients/web3-wallet/docs/GetB402SupportedConfigurationsV1Response.md b/clients/web3-wallet/docs/GetB402SupportedConfigurationsV1Response.md new file mode 100644 index 0000000..d07d935 --- /dev/null +++ b/clients/web3-wallet/docs/GetB402SupportedConfigurationsV1Response.md @@ -0,0 +1,19 @@ + + +# GetB402SupportedConfigurationsV1Response + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**status** | **String** | | [optional] | +|**type** | **String** | | [optional] | +|**code** | **String** | | [optional] | +|**errorData** | **String** | | [optional] | +|**data** | **Object** | | [optional] | +|**subData** | **Object** | | [optional] | +|**params** | **Object** | | [optional] | + + + diff --git a/clients/web3-wallet/docs/GetB402SupportedConfigurationsV1Response1.md b/clients/web3-wallet/docs/GetB402SupportedConfigurationsV1Response1.md new file mode 100644 index 0000000..29851a8 --- /dev/null +++ b/clients/web3-wallet/docs/GetB402SupportedConfigurationsV1Response1.md @@ -0,0 +1,19 @@ + + +# GetB402SupportedConfigurationsV1Response1 + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**status** | **String** | | [optional] | +|**type** | **String** | | [optional] | +|**code** | **String** | | [optional] | +|**errorData** | **String** | | [optional] | +|**data** | [**GetB402SupportedConfigurationsV1Response1Data**](GetB402SupportedConfigurationsV1Response1Data.md) | | [optional] | +|**subData** | **Object** | | [optional] | +|**params** | **Object** | | [optional] | + + + diff --git a/clients/web3-wallet/docs/GetB402SupportedConfigurationsV1Response1Data.md b/clients/web3-wallet/docs/GetB402SupportedConfigurationsV1Response1Data.md new file mode 100644 index 0000000..4d5e6dd --- /dev/null +++ b/clients/web3-wallet/docs/GetB402SupportedConfigurationsV1Response1Data.md @@ -0,0 +1,15 @@ + + +# GetB402SupportedConfigurationsV1Response1Data + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**kinds** | [**List<GetB402SupportedConfigurationsV1Response1DataKindsInner>**](GetB402SupportedConfigurationsV1Response1DataKindsInner.md) | | [optional] | +|**extensions** | **List<String>** | | [optional] | +|**signers** | **Map<String, List<String>>** | | [optional] | + + + diff --git a/clients/web3-wallet/docs/GetB402SupportedConfigurationsV1Response1DataKindsInner.md b/clients/web3-wallet/docs/GetB402SupportedConfigurationsV1Response1DataKindsInner.md new file mode 100644 index 0000000..c5ca869 --- /dev/null +++ b/clients/web3-wallet/docs/GetB402SupportedConfigurationsV1Response1DataKindsInner.md @@ -0,0 +1,16 @@ + + +# GetB402SupportedConfigurationsV1Response1DataKindsInner + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**x402Version** | **Integer** | | [optional] | +|**scheme** | **String** | | [optional] | +|**network** | **String** | | [optional] | +|**extra** | [**GetB402SupportedConfigurationsV1Response1DataKindsInnerExtra**](GetB402SupportedConfigurationsV1Response1DataKindsInnerExtra.md) | | [optional] | + + + diff --git a/clients/web3-wallet/docs/GetB402SupportedConfigurationsV1Response1DataKindsInnerExtra.md b/clients/web3-wallet/docs/GetB402SupportedConfigurationsV1Response1DataKindsInnerExtra.md new file mode 100644 index 0000000..d9927ac --- /dev/null +++ b/clients/web3-wallet/docs/GetB402SupportedConfigurationsV1Response1DataKindsInnerExtra.md @@ -0,0 +1,16 @@ + + +# GetB402SupportedConfigurationsV1Response1DataKindsInnerExtra + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **String** | | [optional] | +|**version** | **String** | | [optional] | +|**assetTransferMethod** | **String** | | [optional] | +|**facilitatorAddress** | **String** | | [optional] | + + + diff --git a/clients/web3-wallet/docs/GetB402SupportedConfigurationsV1Response2.md b/clients/web3-wallet/docs/GetB402SupportedConfigurationsV1Response2.md new file mode 100644 index 0000000..28e2760 --- /dev/null +++ b/clients/web3-wallet/docs/GetB402SupportedConfigurationsV1Response2.md @@ -0,0 +1,19 @@ + + +# GetB402SupportedConfigurationsV1Response2 + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**status** | **String** | | [optional] | +|**type** | **String** | | [optional] | +|**code** | **String** | | [optional] | +|**errorData** | **String** | | [optional] | +|**data** | **Object** | | [optional] | +|**subData** | **Object** | | [optional] | +|**params** | **Object** | | [optional] | + + + diff --git a/clients/web3-wallet/docs/GetB402SupportedConfigurationsV2Request.md b/clients/web3-wallet/docs/GetB402SupportedConfigurationsV2Request.md new file mode 100644 index 0000000..095afc4 --- /dev/null +++ b/clients/web3-wallet/docs/GetB402SupportedConfigurationsV2Request.md @@ -0,0 +1,13 @@ + + +# GetB402SupportedConfigurationsV2Request + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**body** | **Object** | | | + + + diff --git a/clients/web3-wallet/docs/GetB402SupportedConfigurationsV2Response.md b/clients/web3-wallet/docs/GetB402SupportedConfigurationsV2Response.md new file mode 100644 index 0000000..2832ae3 --- /dev/null +++ b/clients/web3-wallet/docs/GetB402SupportedConfigurationsV2Response.md @@ -0,0 +1,19 @@ + + +# GetB402SupportedConfigurationsV2Response + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**status** | **String** | | [optional] | +|**type** | **String** | | [optional] | +|**code** | **String** | | [optional] | +|**errorData** | **String** | | [optional] | +|**data** | **Object** | | [optional] | +|**subData** | **Object** | | [optional] | +|**params** | **Object** | | [optional] | + + + diff --git a/clients/web3-wallet/docs/GetB402SupportedConfigurationsV2Response1.md b/clients/web3-wallet/docs/GetB402SupportedConfigurationsV2Response1.md new file mode 100644 index 0000000..98483dc --- /dev/null +++ b/clients/web3-wallet/docs/GetB402SupportedConfigurationsV2Response1.md @@ -0,0 +1,19 @@ + + +# GetB402SupportedConfigurationsV2Response1 + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**status** | **String** | | [optional] | +|**type** | **String** | | [optional] | +|**code** | **String** | | [optional] | +|**errorData** | **String** | | [optional] | +|**data** | [**GetB402SupportedConfigurationsV2Response1Data**](GetB402SupportedConfigurationsV2Response1Data.md) | | [optional] | +|**subData** | **Object** | | [optional] | +|**params** | **Object** | | [optional] | + + + diff --git a/clients/web3-wallet/docs/GetB402SupportedConfigurationsV2Response1Data.md b/clients/web3-wallet/docs/GetB402SupportedConfigurationsV2Response1Data.md new file mode 100644 index 0000000..df6807b --- /dev/null +++ b/clients/web3-wallet/docs/GetB402SupportedConfigurationsV2Response1Data.md @@ -0,0 +1,15 @@ + + +# GetB402SupportedConfigurationsV2Response1Data + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**kinds** | [**List<GetB402SupportedConfigurationsV2Response1DataKindsInner>**](GetB402SupportedConfigurationsV2Response1DataKindsInner.md) | | | +|**extensions** | **List<String>** | | | +|**signers** | **Map<String, List<String>>** | | | + + + diff --git a/clients/web3-wallet/docs/GetB402SupportedConfigurationsV2Response1DataKindsInner.md b/clients/web3-wallet/docs/GetB402SupportedConfigurationsV2Response1DataKindsInner.md new file mode 100644 index 0000000..2a9d60a --- /dev/null +++ b/clients/web3-wallet/docs/GetB402SupportedConfigurationsV2Response1DataKindsInner.md @@ -0,0 +1,16 @@ + + +# GetB402SupportedConfigurationsV2Response1DataKindsInner + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**x402Version** | **Integer** | | | +|**scheme** | **String** | | | +|**network** | **String** | | | +|**extra** | [**GetB402SupportedConfigurationsV2Response1DataKindsInnerExtra**](GetB402SupportedConfigurationsV2Response1DataKindsInnerExtra.md) | | | + + + diff --git a/clients/web3-wallet/docs/GetB402SupportedConfigurationsV2Response1DataKindsInnerExtra.md b/clients/web3-wallet/docs/GetB402SupportedConfigurationsV2Response1DataKindsInnerExtra.md new file mode 100644 index 0000000..7a50538 --- /dev/null +++ b/clients/web3-wallet/docs/GetB402SupportedConfigurationsV2Response1DataKindsInnerExtra.md @@ -0,0 +1,17 @@ + + +# GetB402SupportedConfigurationsV2Response1DataKindsInnerExtra + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **String** | | | +|**version** | **String** | | | +|**assetTransferMethod** | **String** | | | +|**signerAddress** | **String** | | | +|**spenderAddress** | **String** | | [optional] | + + + diff --git a/clients/web3-wallet/docs/GetB402SupportedConfigurationsV2Response2.md b/clients/web3-wallet/docs/GetB402SupportedConfigurationsV2Response2.md new file mode 100644 index 0000000..7b4eb57 --- /dev/null +++ b/clients/web3-wallet/docs/GetB402SupportedConfigurationsV2Response2.md @@ -0,0 +1,19 @@ + + +# GetB402SupportedConfigurationsV2Response2 + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**status** | **String** | | [optional] | +|**type** | **String** | | [optional] | +|**code** | **String** | | [optional] | +|**errorData** | **String** | | [optional] | +|**data** | **Object** | | [optional] | +|**subData** | **Object** | | [optional] | +|**params** | **Object** | | [optional] | + + + diff --git a/clients/web3-wallet/docs/GetDeFiPositionsRequest.md b/clients/web3-wallet/docs/GetDeFiPositionsRequest.md new file mode 100644 index 0000000..8e75ee5 --- /dev/null +++ b/clients/web3-wallet/docs/GetDeFiPositionsRequest.md @@ -0,0 +1,14 @@ + + +# GetDeFiPositionsRequest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**addresses** | **List<String>** | Wallet addresses to query positions for. Up to 3 addresses per request (server-side configured and subject to change). | | +|**binanceChainIds** | **List<String>** | Optional chain filter. When set, only positions on the specified chains are returned. This release supports BSC (\"56\") only. | [optional] | + + + diff --git a/clients/web3-wallet/docs/GetDeFiPositionsResponse.md b/clients/web3-wallet/docs/GetDeFiPositionsResponse.md new file mode 100644 index 0000000..a693643 --- /dev/null +++ b/clients/web3-wallet/docs/GetDeFiPositionsResponse.md @@ -0,0 +1,17 @@ + + +# GetDeFiPositionsResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**code** | **Integer** | Business status code. 0 indicates success. | [optional] | +|**msg** | **String** | Human-readable status message. | [optional] | +|**data** | [**GetDeFiPositionsResponseData**](GetDeFiPositionsResponseData.md) | | [optional] | +|**timestamp** | **Long** | Server timestamp in milliseconds. | [optional] | +|**success** | **Boolean** | Whether the request succeeded (mirrors `code == 0`). | [optional] | + + + diff --git a/clients/web3-wallet/docs/GetDeFiPositionsResponseData.md b/clients/web3-wallet/docs/GetDeFiPositionsResponseData.md new file mode 100644 index 0000000..9c43a67 --- /dev/null +++ b/clients/web3-wallet/docs/GetDeFiPositionsResponseData.md @@ -0,0 +1,15 @@ + + +# GetDeFiPositionsResponseData + +Aggregated DeFi positions response. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**totalValue** | **String** | Total value of all DeFi positions of all queried addresses (USD). Same raw precision as addressTotalValue. | [optional] | +|**addressList** | [**List<GetDeFiPositionsResponseDataAddressListInner>**](GetDeFiPositionsResponseDataAddressListInner.md) | Address-level position summaries. | [optional] | + + + diff --git a/clients/web3-wallet/docs/GetDeFiPositionsResponseDataAddressListInner.md b/clients/web3-wallet/docs/GetDeFiPositionsResponseDataAddressListInner.md new file mode 100644 index 0000000..d4badac --- /dev/null +++ b/clients/web3-wallet/docs/GetDeFiPositionsResponseDataAddressListInner.md @@ -0,0 +1,16 @@ + + +# GetDeFiPositionsResponseDataAddressListInner + +Address-level aggregation. Groups the protocol-level position summaries of one wallet address. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**address** | **String** | Wallet address. | [optional] | +|**addressTotalValue** | **String** | Total DeFi position value of this address across all chains (USD). Same raw precision as the position values. | [optional] | +|**protocolList** | [**List<GetDeFiPositionsResponseDataAddressListInnerProtocolListInner>**](GetDeFiPositionsResponseDataAddressListInnerProtocolListInner.md) | Protocol-level position summaries of this address. | [optional] | + + + diff --git a/clients/web3-wallet/docs/GetDeFiPositionsResponseDataAddressListInnerProtocolListInner.md b/clients/web3-wallet/docs/GetDeFiPositionsResponseDataAddressListInnerProtocolListInner.md new file mode 100644 index 0000000..bf9ab86 --- /dev/null +++ b/clients/web3-wallet/docs/GetDeFiPositionsResponseDataAddressListInnerProtocolListInner.md @@ -0,0 +1,18 @@ + + +# GetDeFiPositionsResponseDataAddressListInnerProtocolListInner + +Protocol-level position summary for one address on one chain. `binanceChainId` + `defiProtocolId` uniquely identify a protocol on a chain. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**binanceChainId** | **String** | Binance chain ID (e.g. \"56\"=BSC). | [optional] | +|**defiProtocolId** | **String** | Protocol identifier consistent with `POST /api/v1/defi/data/protocol/list`. Use this value when calling investment/list, transaction endpoints, etc. | [optional] | +|**protocolName** | **String** | Protocol display name. | [optional] | +|**protocolTotalValue** | **String** | Total position value in this protocol (USD). | [optional] | +|**poolList** | [**List<GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInner>**](GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInner.md) | Pools with positions in this protocol. | [optional] | + + + diff --git a/clients/web3-wallet/docs/GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInner.md b/clients/web3-wallet/docs/GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInner.md new file mode 100644 index 0000000..54cada3 --- /dev/null +++ b/clients/web3-wallet/docs/GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInner.md @@ -0,0 +1,18 @@ + + +# GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInner + +A pool containing position collections. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**bnPoolId** | **String** | Pool identifier (`0x` + 64-char hex). | [optional] | +|**poolCa** | **String** | Pool contract address. | [optional] | +|**poolType** | **String** | Pool type. Complete value set: `Lending` (supply/borrow market), `Staked` (native staking), `Yield` (yield vault / receipt token), `Deposit` (fixed deposit), `Rewards` (reward claims, e.g. PancakeSwap Infinity), `Liquidity Pool` (AMM / concentrated liquidity), `Farming` (MasterChef farming), `Locked` (locked staking with unlock time), `Vesting` (vesting schedule). Treat unknown values as generic display. | [optional] | +|**positionCollectionList** | [**List<GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInner>**](GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInner.md) | | [optional] | +|**poolDetail** | [**GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPoolDetail**](GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPoolDetail.md) | | [optional] | + + + diff --git a/clients/web3-wallet/docs/GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPoolDetail.md b/clients/web3-wallet/docs/GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPoolDetail.md new file mode 100644 index 0000000..1579d36 --- /dev/null +++ b/clients/web3-wallet/docs/GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPoolDetail.md @@ -0,0 +1,27 @@ + + +# GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPoolDetail + +Pool-level metadata. Fields are null when not applicable to the pool type (e.g. `tickSpacing`/`hooks` only for concentrated-liquidity pools). + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**expiry** | **Long** | Pool expiry timestamp (Unix seconds). Null if no expiry. | [optional] | +|**feeTier** | **String** | Fee tier. For PancakeSwap V3-style pools this is the encoded fee (e.g. \"500\" = 0.05%); for V4-style pools a flag-encoded value. | [optional] | +|**lpFee** | **String** | LP fee portion in basis points (V4-style pools). | [optional] | +|**tickSpacing** | **String** | Tick spacing for concentrated-liquidity pools. | [optional] | +|**isDynamicFee** | **Boolean** | Whether the pool uses a dynamic (hook-managed) fee (V4-style pools). | [optional] | +|**hookFee** | **String** | Hook fee portion in basis points (V4-style pools). | [optional] | +|**tick** | **String** | Current pool tick (V4-style pools). | [optional] | +|**hooks** | **String** | Hook contract address (V4-style pools). Zero address when no hook. | [optional] | +|**swapProtocolFee** | **String** | Protocol fee on swaps in basis points (V4-style pools). | [optional] | +|**parameters** | **String** | Encoded pool parameters, e.g. `0x` + 64-char hex (V4-style pools). | [optional] | +|**fee** | **String** | Total pool fee in basis points (V4-style pools). | [optional] | +|**spokeName** | **String** | Spoke pool name (e.g. across-protocol bridges). | [optional] | +|**reserveCount** | **String** | Number of reserves in multi-asset pools. | [optional] | +|**vaultName** | **String** | Vault name for vault-style protocols. | [optional] | + + + diff --git a/clients/web3-wallet/docs/GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInner.md b/clients/web3-wallet/docs/GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInner.md new file mode 100644 index 0000000..e128319 --- /dev/null +++ b/clients/web3-wallet/docs/GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInner.md @@ -0,0 +1,17 @@ + + +# GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInner + +A collection of positions grouped under the same underlying asset. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**positionCollectionId** | **String** | Collection unique identifier (64-char hex, no `0x` prefix). | [optional] | +|**positionCollectionDetail** | [**GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionCollectionDetail**](GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionCollectionDetail.md) | | [optional] | +|**positionCollectionTotalValue** | **String** | Total value of all positions in this collection (USD). | [optional] | +|**positionList** | [**List<GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInner>**](GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInner.md) | List of positions in this collection. | [optional] | + + + diff --git a/clients/web3-wallet/docs/GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionCollectionDetail.md b/clients/web3-wallet/docs/GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionCollectionDetail.md new file mode 100644 index 0000000..91d0cb1 --- /dev/null +++ b/clients/web3-wallet/docs/GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionCollectionDetail.md @@ -0,0 +1,16 @@ + + +# GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionCollectionDetail + +Collection metadata. Null when the collection has no metadata. Fields are null when not applicable. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**collectionIndex** | **String** | Index of this collection within the pool. For single-asset collections this is the ABI-encoded (left-padded) token address; other pools use their own index format. | [optional] | +|**collectionDisplayName** | **String** | Human-readable collection name. | [optional] | +|**healthFactor** | **String** | Health factor for lending positions. Null for non-lending positions. | [optional] | + + + diff --git a/clients/web3-wallet/docs/GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInner.md b/clients/web3-wallet/docs/GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInner.md new file mode 100644 index 0000000..9e83a2a --- /dev/null +++ b/clients/web3-wallet/docs/GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInner.md @@ -0,0 +1,21 @@ + + +# GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInner + +A single DeFi position with underlying asset and token breakdown. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**positionId** | **String** | Unique position identifier (64-char hex, no `0x` prefix). | [optional] | +|**underlyingAssetName** | **String** | Display name of the underlying asset (e.g. \"USDT-USDC\", \"lisUSD\"). | [optional] | +|**underlyingAssetId** | **String** | Underlying asset identifier (64-char hex, no `0x` prefix). Hashed from the pool and underlying token addresses. | [optional] | +|**assetType** | **String** | Asset structure type. Null for a regular position; `locked` for a locked position (e.g. locked staking — check `unlockTime` on positionDetail); `farming` for a MasterChef-style farming position (rewards accrue under the `farming_reward` token group). | [optional] | +|**investmentIds** | **List<String>** | Related investment IDs (64-char hex, no `0x` prefix). Use with `POST /api/v1/defi/data/investment/detail`. Usually a single entry; a position can relate to several investments when the pool stacks products on top of each other (e.g. a farming position wraps the underlying LP investment plus its incentive product, or a staked vault layers a receipt token over the base deposit). When there are several, query each with investment/detail and pick by the action you want to perform — redeeming the principal uses the base investment, claiming farming incentives uses the incentive one. | [optional] | +|**positionDetail** | [**GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInnerPositionDetail**](GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInnerPositionDetail.md) | | [optional] | +|**positionValue** | **String** | Total position value in USD (sum of all token values; may be negative for borrow positions). | [optional] | +|**tokenList** | [**PositionRespTokenList**](PositionRespTokenList.md) | | [optional] | + + + diff --git a/clients/web3-wallet/docs/GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInnerPositionDetail.md b/clients/web3-wallet/docs/GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInnerPositionDetail.md new file mode 100644 index 0000000..6589fc4 --- /dev/null +++ b/clients/web3-wallet/docs/GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInnerPositionDetail.md @@ -0,0 +1,24 @@ + + +# GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInnerPositionDetail + +Position-level metadata. Present for concentrated-liquidity / locked / farming positions; null otherwise. Fields are null when not applicable to the position type. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**positionIndex** | **String** | Position index (e.g. the Uniswap-V3-style position number). | [optional] | +|**nftId** | **String** | NFT token ID for concentrated-liquidity positions, prefixed with `#` (e.g. `\"#7225901\"`). Null for non-NFT positions. The `#` prefix may be passed as-is to a transaction build endpoint (`lp-add` / `lp-remove` / `claim` `LP_FEE`) — the service strips it automatically; passing the raw id without `#` is also accepted. | [optional] | +|**unlockTime** | **String** | Unix timestamp (seconds) when the position unlocks. Null if no lock. | [optional] | +|**unlockTimeReached** | **Boolean** | Whether the unlock time has been reached. | [optional] | +|**tickLower** | **String** | Lower tick bound for concentrated-liquidity positions. | [optional] | +|**tickUpper** | **String** | Upper tick bound for concentrated-liquidity positions. | [optional] | +|**active** | **Boolean** | Whether the position is currently in-range (active). | [optional] | +|**proofs** | **Map<String, List<String>>** | Merkle proofs keyed by reward token address. Required when claiming PancakeSwap Infinity (V4) rewards. | [optional] | +|**stakeState** | **String** | Staking lifecycle state. Complete value set: active (earning), deactivating (unstaking in progress, rewards stop), inactive (fully unstaked). | [optional] | +|**claimTypes** | **List<String>** | Claim types available for this position. Values map to the `claimType` field of `POST /transaction/claim` and determine which companion fields a claim requires. | [optional] | +|**redemptionId** | **String** | Redemption record ID (for pending redemptions). Null when not a pending redemption. | [optional] | + + + diff --git a/clients/web3-wallet/docs/GetInvestmentDetailRequest.md b/clients/web3-wallet/docs/GetInvestmentDetailRequest.md new file mode 100644 index 0000000..bdffd46 --- /dev/null +++ b/clients/web3-wallet/docs/GetInvestmentDetailRequest.md @@ -0,0 +1,13 @@ + + +# GetInvestmentDetailRequest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**investmentId** | **String** | Investment product identifier (64-char hex, no `0x` prefix). Same format as the `investmentIds` returned by `POST /api/v1/defi/data/position/list`. | | + + + diff --git a/clients/web3-wallet/docs/GetInvestmentDetailResponse.md b/clients/web3-wallet/docs/GetInvestmentDetailResponse.md new file mode 100644 index 0000000..3dee4e1 --- /dev/null +++ b/clients/web3-wallet/docs/GetInvestmentDetailResponse.md @@ -0,0 +1,17 @@ + + +# GetInvestmentDetailResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**code** | **Integer** | Business status code. 0 indicates success. | [optional] | +|**msg** | **String** | Human-readable status message. | [optional] | +|**data** | [**GetInvestmentDetailResponseData**](GetInvestmentDetailResponseData.md) | | [optional] | +|**timestamp** | **Long** | Server timestamp in milliseconds. | [optional] | +|**success** | **Boolean** | Whether the request succeeded (mirrors `code == 0`). | [optional] | + + + diff --git a/clients/web3-wallet/docs/GetInvestmentDetailResponseData.md b/clients/web3-wallet/docs/GetInvestmentDetailResponseData.md new file mode 100644 index 0000000..8f25e7a --- /dev/null +++ b/clients/web3-wallet/docs/GetInvestmentDetailResponseData.md @@ -0,0 +1,31 @@ + + +# GetInvestmentDetailResponseData + +DeFi investment product detail. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**binanceChainId** | **String** | Binance chain ID. | [optional] | +|**defiProtocolId** | **String** | Parent DeFi protocol identifier. | [optional] | +|**protocolName** | **String** | Protocol display name. | [optional] | +|**protocolLogo** | **String** | Protocol logo image URL (full URL; quote as-is). | [optional] | +|**investmentId** | **String** | Investment product identifier (64-char hex, no `0x` prefix). Same format as the `investmentIds` returned by `POST /api/v1/defi/data/position/list` and accepted by the transaction build endpoints. | [optional] | +|**investmentName** | **String** | Investment display name. | [optional] | +|**investType** | **String** | Investment type of this product — a single string here (each product has exactly one). Note: the protocol-level investType (in protocol list/detail) is an array. Known values: Earn, LiquidityPool. | [optional] | +|**investable** | **Boolean** | Whether this investment is currently investable. | [optional] | +|**apyBps** | **Long** | Annual percentage yield in basis points (1 bps = 0.01%). Integer value — use this for sorting / comparing / filtering, never the raw decimal. | [optional] | +|**apyDisplay** | **String** | Pre-formatted, human-readable APY string for display (e.g. \"1,562.65%\"). Quote as-is; do not re-compute or transform. | [optional] | +|**apyType** | **String** | Rate yield type. Known values: APY, APR. | [optional] | +|**tvl** | **String** | Total value locked (USD). String, raw precision from the data source. | [optional] | +|**poolAddress** | **String** | Pool / strategy contract address. | [optional] | +|**feeRate** | **String** | Fee rate string (e.g. \"0.001\" = 0.1%). | [optional] | +|**assetTokenList** | [**List<DefiInvestmentInfoDtoAssetTokenListInner>**](DefiInvestmentInfoDtoAssetTokenListInner.md) | Tokens to supply / deposit. | [optional] | +|**rewardTokenList** | [**List<DefiInvestmentInfoDtoAssetTokenListInner>**](DefiInvestmentInfoDtoAssetTokenListInner.md) | Reward tokens. | [optional] | +|**lpTokenList** | [**List<DefiInvestmentInfoDtoAssetTokenListInner>**](DefiInvestmentInfoDtoAssetTokenListInner.md) | LP tokens (for liquidity positions). | [optional] | +|**borrowTokenList** | [**List<DefiInvestmentInfoDtoAssetTokenListInner>**](DefiInvestmentInfoDtoAssetTokenListInner.md) | Borrow tokens (for lending borrow positions). | [optional] | + + + diff --git a/clients/web3-wallet/docs/GetProtocolDetailRequest.md b/clients/web3-wallet/docs/GetProtocolDetailRequest.md new file mode 100644 index 0000000..d03640f --- /dev/null +++ b/clients/web3-wallet/docs/GetProtocolDetailRequest.md @@ -0,0 +1,13 @@ + + +# GetProtocolDetailRequest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**defiProtocolId** | **String** | DeFi protocol identifier. | | + + + diff --git a/clients/web3-wallet/docs/GetProtocolDetailResponse.md b/clients/web3-wallet/docs/GetProtocolDetailResponse.md new file mode 100644 index 0000000..6364549 --- /dev/null +++ b/clients/web3-wallet/docs/GetProtocolDetailResponse.md @@ -0,0 +1,17 @@ + + +# GetProtocolDetailResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**code** | **Integer** | Business status code. 0 indicates success. | [optional] | +|**msg** | **String** | Human-readable status message. | [optional] | +|**data** | [**GetProtocolDetailResponseData**](GetProtocolDetailResponseData.md) | | [optional] | +|**timestamp** | **Long** | Server timestamp in milliseconds. | [optional] | +|**success** | **Boolean** | Whether the request succeeded (mirrors `code == 0`). | [optional] | + + + diff --git a/clients/web3-wallet/docs/GetProtocolDetailResponseData.md b/clients/web3-wallet/docs/GetProtocolDetailResponseData.md new file mode 100644 index 0000000..784d69a --- /dev/null +++ b/clients/web3-wallet/docs/GetProtocolDetailResponseData.md @@ -0,0 +1,32 @@ + + +# GetProtocolDetailResponseData + +DeFi protocol detail. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**defiProtocolId** | **String** | DeFi protocol identifier. | [optional] | +|**protocolName** | **String** | Protocol display name. | [optional] | +|**protocolLogo** | **String** | Protocol logo image URL (full URL under `https://bin.bnbstatic.com`). | [optional] | +|**description** | **String** | Protocol description (already translated; quote as-is). | [optional] | +|**websiteUrl** | **String** | Official website URL. | [optional] | +|**investType** | **List<String>** | Investment types supported by this protocol — an array here (a protocol may support several). Note: the investment-level investType (in investment list/detail) is a single string. Known values: Earn, LiquidityPool. | [optional] | +|**supportedChains** | **List<String>** | Supported Binance chain IDs. | [optional] | +|**tvl** | **String** | Total value locked (USD). String, raw precision from the data source. | [optional] | +|**tags** | **List<String>** | Protocol tags / categories. | [optional] | +|**founded** | **String** | Founding year (YYYY). | [optional] | +|**fdv** | **String** | Fully diluted valuation. | [optional] | +|**totalFunding** | **String** | Total funding raised. Null when not disclosed. | [optional] | +|**socialLinks** | [**GetProtocolDetailResponseDataSocialLinks**](GetProtocolDetailResponseDataSocialLinks.md) | | [optional] | +|**team** | [**List<DefiProtocolInfoDtoTeamInner>**](DefiProtocolInfoDtoTeamInner.md) | Team members. | [optional] | +|**fundRaising** | [**List<DefiProtocolInfoDtoFundRaisingInner>**](DefiProtocolInfoDtoFundRaisingInner.md) | Fundraising history. | [optional] | +|**securityScore** | **String** | Overall CertiK security score. | [optional] | +|**dimensionScores** | [**GetProtocolDetailResponseDataDimensionScores**](GetProtocolDetailResponseDataDimensionScores.md) | | [optional] | +|**highlights** | **List<String>** | Protocol highlights (already translated; quote as-is). | [optional] | +|**faq** | [**List<DefiProtocolInfoDtoFaqInner>**](DefiProtocolInfoDtoFaqInner.md) | FAQ entries (question and answer text, already translated). | [optional] | + + + diff --git a/clients/web3-wallet/docs/GetProtocolDetailResponseDataDimensionScores.md b/clients/web3-wallet/docs/GetProtocolDetailResponseDataDimensionScores.md new file mode 100644 index 0000000..634f9e8 --- /dev/null +++ b/clients/web3-wallet/docs/GetProtocolDetailResponseDataDimensionScores.md @@ -0,0 +1,19 @@ + + +# GetProtocolDetailResponseDataDimensionScores + +CertiK six-dimension security scores. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**codeSecurity** | **String** | Code security score. | [optional] | +|**fundamentalHealth** | **String** | Fundamental health score. | [optional] | +|**operationalResilience** | **String** | Operational resilience score. | [optional] | +|**communityTrust** | **String** | Community trust score. | [optional] | +|**governanceStrength** | **String** | Governance strength score. | [optional] | +|**marketStability** | **String** | Market stability score. | [optional] | + + + diff --git a/clients/web3-wallet/docs/GetProtocolDetailResponseDataSocialLinks.md b/clients/web3-wallet/docs/GetProtocolDetailResponseDataSocialLinks.md new file mode 100644 index 0000000..fd905c6 --- /dev/null +++ b/clients/web3-wallet/docs/GetProtocolDetailResponseDataSocialLinks.md @@ -0,0 +1,20 @@ + + +# GetProtocolDetailResponseDataSocialLinks + +Protocol social media links. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**xLowerCase** | **String** | X (Twitter) profile URL. Null when not available. | [optional] | +|**discord** | **String** | Discord invite URL. Null when not available. | [optional] | +|**github** | **String** | GitHub organization URL. Null when not available. | [optional] | +|**linkedin** | **String** | LinkedIn company URL. Null when not available. | [optional] | +|**telegram** | **String** | Telegram channel URL. Null when not available. | [optional] | +|**gitbook** | **String** | GitBook documentation URL. Empty string or null when not available. | [optional] | +|**website** | **String** | Official website URL. | [optional] | + + + diff --git a/clients/web3-wallet/docs/GetWebSocketAuthTokenResponse.md b/clients/web3-wallet/docs/GetWebSocketAuthTokenResponse.md new file mode 100644 index 0000000..4cbb668 --- /dev/null +++ b/clients/web3-wallet/docs/GetWebSocketAuthTokenResponse.md @@ -0,0 +1,17 @@ + + +# GetWebSocketAuthTokenResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**code** | **Integer** | Response code. 0 indicates success. | [optional] | +|**msg** | **String** | Response message. | [optional] | +|**data** | [**GetWebSocketAuthTokenResponseData**](GetWebSocketAuthTokenResponseData.md) | | [optional] | +|**timestamp** | **Long** | Server timestamp in milliseconds. | [optional] | +|**success** | **Boolean** | Whether the request was successful. | [optional] | + + + diff --git a/clients/web3-wallet/docs/GetWebSocketAuthTokenResponseData.md b/clients/web3-wallet/docs/GetWebSocketAuthTokenResponseData.md new file mode 100644 index 0000000..075a8fd --- /dev/null +++ b/clients/web3-wallet/docs/GetWebSocketAuthTokenResponseData.md @@ -0,0 +1,13 @@ + + +# GetWebSocketAuthTokenResponseData + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**token** | **String** | WebSocket auth token (JWT). | [optional] | + + + diff --git a/clients/web3-wallet/docs/InvestmentPageResult.md b/clients/web3-wallet/docs/InvestmentPageResult.md new file mode 100644 index 0000000..772e07b --- /dev/null +++ b/clients/web3-wallet/docs/InvestmentPageResult.md @@ -0,0 +1,17 @@ + + +# InvestmentPageResult + +Paginated investment list result. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**page** | **Integer** | Current page number (1-based). | [optional] | +|**size** | **Integer** | Page size. | [optional] | +|**total** | **Long** | Total number of records. | [optional] | +|**_list** | [**List<InvestmentPageResultListInner>**](InvestmentPageResultListInner.md) | Investments for the current page. | [optional] | + + + diff --git a/clients/web3-wallet/docs/InvestmentPageResultListInner.md b/clients/web3-wallet/docs/InvestmentPageResultListInner.md new file mode 100644 index 0000000..377050b --- /dev/null +++ b/clients/web3-wallet/docs/InvestmentPageResultListInner.md @@ -0,0 +1,23 @@ + + +# InvestmentPageResultListInner + +DeFi investment product summary (list item). + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**binanceChainId** | **String** | Binance chain ID. | [optional] | +|**defiProtocolId** | **String** | Parent DeFi protocol identifier. | [optional] | +|**protocolName** | **String** | Protocol display name. | [optional] | +|**investmentId** | **String** | Investment product identifier (64-char hex, no `0x` prefix). Same format as the `investmentIds` returned by `POST /api/v1/defi/data/position/list` and accepted by the transaction build endpoints. | [optional] | +|**investmentName** | **String** | Investment display name. | [optional] | +|**investType** | **String** | Investment type of this product — a single string here (each product has exactly one). Note: the protocol-level investType (in protocol list/detail) is an array. Known values: Earn, LiquidityPool. | [optional] | +|**apyType** | **String** | Rate yield type. Known values: APY, APR. | [optional] | +|**apyBps** | **Long** | Annual percentage yield in basis points (1 bps = 0.01%). Integer value — use this for sorting / comparing / filtering, never the raw decimal. | [optional] | +|**apyDisplay** | **String** | Pre-formatted, human-readable APY string for display (e.g. \"1,562.65%\"). Quote as-is; do not re-compute or transform. | [optional] | +|**tvl** | **String** | Total value locked in this investment (USD). String, raw precision from the data source. | [optional] | + + + diff --git a/clients/web3-wallet/docs/ListDeFiInvestmentsRequest.md b/clients/web3-wallet/docs/ListDeFiInvestmentsRequest.md new file mode 100644 index 0000000..cc70169 --- /dev/null +++ b/clients/web3-wallet/docs/ListDeFiInvestmentsRequest.md @@ -0,0 +1,38 @@ + + +# ListDeFiInvestmentsRequest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**investType** | [**InvestTypeEnum**](#InvestTypeEnum) | Filter by investment type. Required. Known values: `Earn`, `LiquidityPool`. | | +|**defiProtocolId** | **String** | Filter by DeFi protocol ID. | [optional] | +|**tokenAddressList** | **List<String>** | Filter by token addresses. | [optional] | +|**binanceChainId** | **String** | Filter by Binance chain ID (e.g. \"56\"=BSC). | [optional] | +|**sortField** | **String** | Field to sort by. Only two values are accepted: `tvl`, `apy`. Note: sorting by APY uses `apy` (the server-side field name), even though the response exposes `apyBps` / `apyDisplay`. Other values are not supported. | [optional] | +|**sortDirection** | [**SortDirectionEnum**](#SortDirectionEnum) | Sort direction. | [optional] | +|**page** | **Integer** | Page number (1-based). | [optional] | +|**size** | **Integer** | Page size. Max: 100. | [optional] | + + + +## Enum: InvestTypeEnum + +| Name | Value | +|---- | -----| +| Earn | "Earn" | +| LiquidityPool | "LiquidityPool" | + + + +## Enum: SortDirectionEnum + +| Name | Value | +|---- | -----| +| ASC | "ASC" | +| DESC | "DESC" | + + + diff --git a/clients/web3-wallet/docs/ListDeFiInvestmentsResponse.md b/clients/web3-wallet/docs/ListDeFiInvestmentsResponse.md new file mode 100644 index 0000000..d4eea3c --- /dev/null +++ b/clients/web3-wallet/docs/ListDeFiInvestmentsResponse.md @@ -0,0 +1,17 @@ + + +# ListDeFiInvestmentsResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**code** | **Integer** | Business status code. 0 indicates success. | [optional] | +|**msg** | **String** | Human-readable status message. | [optional] | +|**data** | [**ListDeFiInvestmentsResponseData**](ListDeFiInvestmentsResponseData.md) | | [optional] | +|**timestamp** | **Long** | Server timestamp in milliseconds. | [optional] | +|**success** | **Boolean** | Whether the request succeeded (mirrors `code == 0`). | [optional] | + + + diff --git a/clients/web3-wallet/docs/ListDeFiInvestmentsResponseData.md b/clients/web3-wallet/docs/ListDeFiInvestmentsResponseData.md new file mode 100644 index 0000000..ad9d3f5 --- /dev/null +++ b/clients/web3-wallet/docs/ListDeFiInvestmentsResponseData.md @@ -0,0 +1,17 @@ + + +# ListDeFiInvestmentsResponseData + +Paginated investment list result. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**page** | **Integer** | Current page number (1-based). | [optional] | +|**size** | **Integer** | Page size. | [optional] | +|**total** | **Long** | Total number of records. | [optional] | +|**_list** | [**List<InvestmentPageResultListInner>**](InvestmentPageResultListInner.md) | Investments for the current page. | [optional] | + + + diff --git a/clients/web3-wallet/docs/ListDeFiProtocolsRequest.md b/clients/web3-wallet/docs/ListDeFiProtocolsRequest.md new file mode 100644 index 0000000..4194056 --- /dev/null +++ b/clients/web3-wallet/docs/ListDeFiProtocolsRequest.md @@ -0,0 +1,36 @@ + + +# ListDeFiProtocolsRequest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**binanceChainId** | **String** | Filter by Binance chain ID (e.g. \"56\"=BSC). | [optional] | +|**investType** | [**InvestTypeEnum**](#InvestTypeEnum) | Filter by investment type. Known values: `Earn`, `LiquidityPool`. | [optional] | +|**sortField** | **String** | Field to sort by. Only two values are accepted: `tvl`, `apy`. Note: sorting by APY uses `apy` (the server-side field name), even though the response exposes `apyBps` / `apyDisplay`. Other values are not supported. | [optional] | +|**sortDirection** | [**SortDirectionEnum**](#SortDirectionEnum) | Sort direction. | [optional] | +|**page** | **Integer** | Page number (1-based). | [optional] | +|**size** | **Integer** | Page size. Max: 200. | [optional] | + + + +## Enum: InvestTypeEnum + +| Name | Value | +|---- | -----| +| Earn | "Earn" | +| LiquidityPool | "LiquidityPool" | + + + +## Enum: SortDirectionEnum + +| Name | Value | +|---- | -----| +| ASC | "ASC" | +| DESC | "DESC" | + + + diff --git a/clients/web3-wallet/docs/ListDeFiProtocolsResponse.md b/clients/web3-wallet/docs/ListDeFiProtocolsResponse.md new file mode 100644 index 0000000..a579d76 --- /dev/null +++ b/clients/web3-wallet/docs/ListDeFiProtocolsResponse.md @@ -0,0 +1,17 @@ + + +# ListDeFiProtocolsResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**code** | **Integer** | Business status code. 0 indicates success. | [optional] | +|**msg** | **String** | Human-readable status message. | [optional] | +|**data** | [**ListDeFiProtocolsResponseData**](ListDeFiProtocolsResponseData.md) | | [optional] | +|**timestamp** | **Long** | Server timestamp in milliseconds. | [optional] | +|**success** | **Boolean** | Whether the request succeeded (mirrors `code == 0`). | [optional] | + + + diff --git a/clients/web3-wallet/docs/ListDeFiProtocolsResponseData.md b/clients/web3-wallet/docs/ListDeFiProtocolsResponseData.md new file mode 100644 index 0000000..1065133 --- /dev/null +++ b/clients/web3-wallet/docs/ListDeFiProtocolsResponseData.md @@ -0,0 +1,17 @@ + + +# ListDeFiProtocolsResponseData + +Paginated protocol list result. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**page** | **Integer** | Current page number (1-based). | [optional] | +|**size** | **Integer** | Page size. | [optional] | +|**total** | **Long** | Total number of records. | [optional] | +|**_list** | [**List<ProtocolPageResultListInner>**](ProtocolPageResultListInner.md) | Protocols for the current page. | [optional] | + + + diff --git a/clients/web3-wallet/docs/LpAddCalculateResponse.md b/clients/web3-wallet/docs/LpAddCalculateResponse.md new file mode 100644 index 0000000..8312710 --- /dev/null +++ b/clients/web3-wallet/docs/LpAddCalculateResponse.md @@ -0,0 +1,16 @@ + + +# LpAddCalculateResponse + +Result of `/transaction/lp-add/calculate`. Returns the paired token amounts derived from the single input token. This endpoint is pure computation — it does not touch the chain and does not deduct any fee. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**inputTokenAmount** | **String** | Echo of the input token amount (human-readable). | [optional] | +|**pairedTokenAddress** | **String** | The paired token contract address derived from the investment. | [optional] | +|**pairedTokenAmount** | **String** | Calculated paired token amount (human-readable). | [optional] | + + + diff --git a/clients/web3-wallet/docs/PoolDetailResp.md b/clients/web3-wallet/docs/PoolDetailResp.md new file mode 100644 index 0000000..a376057 --- /dev/null +++ b/clients/web3-wallet/docs/PoolDetailResp.md @@ -0,0 +1,27 @@ + + +# PoolDetailResp + +Pool-level metadata. Fields are null when not applicable to the pool type (e.g. `tickSpacing`/`hooks` only for concentrated-liquidity pools). + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**expiry** | **Long** | Pool expiry timestamp (Unix seconds). Null if no expiry. | [optional] | +|**feeTier** | **String** | Fee tier. For PancakeSwap V3-style pools this is the encoded fee (e.g. \"500\" = 0.05%); for V4-style pools a flag-encoded value. | [optional] | +|**lpFee** | **String** | LP fee portion in basis points (V4-style pools). | [optional] | +|**tickSpacing** | **String** | Tick spacing for concentrated-liquidity pools. | [optional] | +|**isDynamicFee** | **Boolean** | Whether the pool uses a dynamic (hook-managed) fee (V4-style pools). | [optional] | +|**hookFee** | **String** | Hook fee portion in basis points (V4-style pools). | [optional] | +|**tick** | **String** | Current pool tick (V4-style pools). | [optional] | +|**hooks** | **String** | Hook contract address (V4-style pools). Zero address when no hook. | [optional] | +|**swapProtocolFee** | **String** | Protocol fee on swaps in basis points (V4-style pools). | [optional] | +|**parameters** | **String** | Encoded pool parameters, e.g. `0x` + 64-char hex (V4-style pools). | [optional] | +|**fee** | **String** | Total pool fee in basis points (V4-style pools). | [optional] | +|**spokeName** | **String** | Spoke pool name (e.g. across-protocol bridges). | [optional] | +|**reserveCount** | **String** | Number of reserves in multi-asset pools. | [optional] | +|**vaultName** | **String** | Vault name for vault-style protocols. | [optional] | + + + diff --git a/clients/web3-wallet/docs/PoolResp.md b/clients/web3-wallet/docs/PoolResp.md new file mode 100644 index 0000000..a014796 --- /dev/null +++ b/clients/web3-wallet/docs/PoolResp.md @@ -0,0 +1,18 @@ + + +# PoolResp + +A pool containing position collections. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**bnPoolId** | **String** | Pool identifier (`0x` + 64-char hex). | [optional] | +|**poolCa** | **String** | Pool contract address. | [optional] | +|**poolType** | **String** | Pool type. Complete value set: `Lending` (supply/borrow market), `Staked` (native staking), `Yield` (yield vault / receipt token), `Deposit` (fixed deposit), `Rewards` (reward claims, e.g. PancakeSwap Infinity), `Liquidity Pool` (AMM / concentrated liquidity), `Farming` (MasterChef farming), `Locked` (locked staking with unlock time), `Vesting` (vesting schedule). Treat unknown values as generic display. | [optional] | +|**positionCollectionList** | [**List<PoolRespPositionCollectionListInner>**](PoolRespPositionCollectionListInner.md) | | [optional] | +|**poolDetail** | [**PoolRespPoolDetail**](PoolRespPoolDetail.md) | | [optional] | + + + diff --git a/clients/web3-wallet/docs/PoolRespPoolDetail.md b/clients/web3-wallet/docs/PoolRespPoolDetail.md new file mode 100644 index 0000000..76b1590 --- /dev/null +++ b/clients/web3-wallet/docs/PoolRespPoolDetail.md @@ -0,0 +1,27 @@ + + +# PoolRespPoolDetail + +Pool-level metadata. Fields are null when not applicable to the pool type (e.g. `tickSpacing`/`hooks` only for concentrated-liquidity pools). + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**expiry** | **Long** | Pool expiry timestamp (Unix seconds). Null if no expiry. | [optional] | +|**feeTier** | **String** | Fee tier. For PancakeSwap V3-style pools this is the encoded fee (e.g. \"500\" = 0.05%); for V4-style pools a flag-encoded value. | [optional] | +|**lpFee** | **String** | LP fee portion in basis points (V4-style pools). | [optional] | +|**tickSpacing** | **String** | Tick spacing for concentrated-liquidity pools. | [optional] | +|**isDynamicFee** | **Boolean** | Whether the pool uses a dynamic (hook-managed) fee (V4-style pools). | [optional] | +|**hookFee** | **String** | Hook fee portion in basis points (V4-style pools). | [optional] | +|**tick** | **String** | Current pool tick (V4-style pools). | [optional] | +|**hooks** | **String** | Hook contract address (V4-style pools). Zero address when no hook. | [optional] | +|**swapProtocolFee** | **String** | Protocol fee on swaps in basis points (V4-style pools). | [optional] | +|**parameters** | **String** | Encoded pool parameters, e.g. `0x` + 64-char hex (V4-style pools). | [optional] | +|**fee** | **String** | Total pool fee in basis points (V4-style pools). | [optional] | +|**spokeName** | **String** | Spoke pool name (e.g. across-protocol bridges). | [optional] | +|**reserveCount** | **String** | Number of reserves in multi-asset pools. | [optional] | +|**vaultName** | **String** | Vault name for vault-style protocols. | [optional] | + + + diff --git a/clients/web3-wallet/docs/PoolRespPositionCollectionListInner.md b/clients/web3-wallet/docs/PoolRespPositionCollectionListInner.md new file mode 100644 index 0000000..b1351f0 --- /dev/null +++ b/clients/web3-wallet/docs/PoolRespPositionCollectionListInner.md @@ -0,0 +1,17 @@ + + +# PoolRespPositionCollectionListInner + +A collection of positions grouped under the same underlying asset. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**positionCollectionId** | **String** | Collection unique identifier (64-char hex, no `0x` prefix). | [optional] | +|**positionCollectionDetail** | [**PositionCollectionRespPositionCollectionDetail**](PositionCollectionRespPositionCollectionDetail.md) | | [optional] | +|**positionCollectionTotalValue** | **String** | Total value of all positions in this collection (USD). | [optional] | +|**positionList** | [**List<PositionCollectionRespPositionListInner>**](PositionCollectionRespPositionListInner.md) | List of positions in this collection. | [optional] | + + + diff --git a/clients/web3-wallet/docs/PositionCollectionResp.md b/clients/web3-wallet/docs/PositionCollectionResp.md new file mode 100644 index 0000000..c9756ca --- /dev/null +++ b/clients/web3-wallet/docs/PositionCollectionResp.md @@ -0,0 +1,17 @@ + + +# PositionCollectionResp + +A collection of positions grouped under the same underlying asset. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**positionCollectionId** | **String** | Collection unique identifier (64-char hex, no `0x` prefix). | [optional] | +|**positionCollectionDetail** | [**PositionCollectionRespPositionCollectionDetail**](PositionCollectionRespPositionCollectionDetail.md) | | [optional] | +|**positionCollectionTotalValue** | **String** | Total value of all positions in this collection (USD). | [optional] | +|**positionList** | [**List<PositionCollectionRespPositionListInner>**](PositionCollectionRespPositionListInner.md) | List of positions in this collection. | [optional] | + + + diff --git a/clients/web3-wallet/docs/PositionCollectionRespPositionCollectionDetail.md b/clients/web3-wallet/docs/PositionCollectionRespPositionCollectionDetail.md new file mode 100644 index 0000000..1c28e72 --- /dev/null +++ b/clients/web3-wallet/docs/PositionCollectionRespPositionCollectionDetail.md @@ -0,0 +1,16 @@ + + +# PositionCollectionRespPositionCollectionDetail + +Collection metadata. Null when the collection has no metadata. Fields are null when not applicable. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**collectionIndex** | **String** | Index of this collection within the pool. For single-asset collections this is the ABI-encoded (left-padded) token address; other pools use their own index format. | [optional] | +|**collectionDisplayName** | **String** | Human-readable collection name. | [optional] | +|**healthFactor** | **String** | Health factor for lending positions. Null for non-lending positions. | [optional] | + + + diff --git a/clients/web3-wallet/docs/PositionCollectionRespPositionListInner.md b/clients/web3-wallet/docs/PositionCollectionRespPositionListInner.md new file mode 100644 index 0000000..045ab12 --- /dev/null +++ b/clients/web3-wallet/docs/PositionCollectionRespPositionListInner.md @@ -0,0 +1,21 @@ + + +# PositionCollectionRespPositionListInner + +A single DeFi position with underlying asset and token breakdown. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**positionId** | **String** | Unique position identifier (64-char hex, no `0x` prefix). | [optional] | +|**underlyingAssetName** | **String** | Display name of the underlying asset (e.g. \"USDT-USDC\", \"lisUSD\"). | [optional] | +|**underlyingAssetId** | **String** | Underlying asset identifier (64-char hex, no `0x` prefix). Hashed from the pool and underlying token addresses. | [optional] | +|**assetType** | **String** | Asset structure type. Null for a regular position; `locked` for a locked position (e.g. locked staking — check `unlockTime` on positionDetail); `farming` for a MasterChef-style farming position (rewards accrue under the `farming_reward` token group). | [optional] | +|**investmentIds** | **List<String>** | Related investment IDs (64-char hex, no `0x` prefix). Use with `POST /api/v1/defi/data/investment/detail`. Usually a single entry; a position can relate to several investments when the pool stacks products on top of each other (e.g. a farming position wraps the underlying LP investment plus its incentive product, or a staked vault layers a receipt token over the base deposit). When there are several, query each with investment/detail and pick by the action you want to perform — redeeming the principal uses the base investment, claiming farming incentives uses the incentive one. | [optional] | +|**positionDetail** | [**PositionRespPositionDetail**](PositionRespPositionDetail.md) | | [optional] | +|**positionValue** | **String** | Total position value in USD (sum of all token values; may be negative for borrow positions). | [optional] | +|**tokenList** | [**PositionRespTokenList**](PositionRespTokenList.md) | | [optional] | + + + diff --git a/clients/web3-wallet/docs/PositionDetailResp.md b/clients/web3-wallet/docs/PositionDetailResp.md new file mode 100644 index 0000000..a8e16fb --- /dev/null +++ b/clients/web3-wallet/docs/PositionDetailResp.md @@ -0,0 +1,35 @@ + + +# PositionDetailResp + +Position-level metadata. Present for concentrated-liquidity / locked / farming positions; null otherwise. Fields are null when not applicable to the position type. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**positionIndex** | **String** | Position index (e.g. the Uniswap-V3-style position number). | [optional] | +|**nftId** | **String** | NFT token ID for concentrated-liquidity positions, prefixed with `#` (e.g. `\"#7225901\"`). Null for non-NFT positions. The `#` prefix may be passed as-is to a transaction build endpoint (`lp-add` / `lp-remove` / `claim` `LP_FEE`) — the service strips it automatically; passing the raw id without `#` is also accepted. | [optional] | +|**unlockTime** | **String** | Unix timestamp (seconds) when the position unlocks. Null if no lock. | [optional] | +|**unlockTimeReached** | **Boolean** | Whether the unlock time has been reached. | [optional] | +|**tickLower** | **String** | Lower tick bound for concentrated-liquidity positions. | [optional] | +|**tickUpper** | **String** | Upper tick bound for concentrated-liquidity positions. | [optional] | +|**active** | **Boolean** | Whether the position is currently in-range (active). | [optional] | +|**proofs** | **Map<String, List<String>>** | Merkle proofs keyed by reward token address. Required when claiming PancakeSwap Infinity (V4) rewards. | [optional] | +|**stakeState** | **String** | Staking lifecycle state. Complete value set: active (earning), deactivating (unstaking in progress, rewards stop), inactive (fully unstaked). | [optional] | +|**claimTypes** | [**List<ClaimTypesEnum>**](#List<ClaimTypesEnum>) | Claim types available for this position. Values map to the `claimType` field of `POST /transaction/claim` and determine which companion fields a claim requires. | [optional] | +|**redemptionId** | **String** | Redemption record ID (for pending redemptions). Null when not a pending redemption. | [optional] | + + + +## Enum: List<ClaimTypesEnum> + +| Name | Value | +|---- | -----| +| REWARD_PROTOCOL | "REWARD_PROTOCOL" | +| REWARD_INVESTMENT | "REWARD_INVESTMENT" | +| LP_FEE | "LP_FEE" | +| REDEMPTION | "REDEMPTION" | + + + diff --git a/clients/web3-wallet/docs/PositionListResp.md b/clients/web3-wallet/docs/PositionListResp.md new file mode 100644 index 0000000..010b909 --- /dev/null +++ b/clients/web3-wallet/docs/PositionListResp.md @@ -0,0 +1,15 @@ + + +# PositionListResp + +Aggregated DeFi positions response. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**totalValue** | **String** | Total value of all DeFi positions of all queried addresses (USD). Same raw precision as addressTotalValue. | [optional] | +|**addressList** | [**List<PositionListRespAddressListInner>**](PositionListRespAddressListInner.md) | Address-level position summaries. | [optional] | + + + diff --git a/clients/web3-wallet/docs/PositionListRespAddressListInner.md b/clients/web3-wallet/docs/PositionListRespAddressListInner.md new file mode 100644 index 0000000..7c6f8f8 --- /dev/null +++ b/clients/web3-wallet/docs/PositionListRespAddressListInner.md @@ -0,0 +1,16 @@ + + +# PositionListRespAddressListInner + +Address-level aggregation. Groups the protocol-level position summaries of one wallet address. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**address** | **String** | Wallet address. | [optional] | +|**addressTotalValue** | **String** | Total DeFi position value of this address across all chains (USD). Same raw precision as the position values. | [optional] | +|**protocolList** | [**List<AddressRespProtocolListInner>**](AddressRespProtocolListInner.md) | Protocol-level position summaries of this address. | [optional] | + + + diff --git a/clients/web3-wallet/docs/PositionResp.md b/clients/web3-wallet/docs/PositionResp.md new file mode 100644 index 0000000..b2ee881 --- /dev/null +++ b/clients/web3-wallet/docs/PositionResp.md @@ -0,0 +1,21 @@ + + +# PositionResp + +A single DeFi position with underlying asset and token breakdown. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**positionId** | **String** | Unique position identifier (64-char hex, no `0x` prefix). | [optional] | +|**underlyingAssetName** | **String** | Display name of the underlying asset (e.g. \"USDT-USDC\", \"lisUSD\"). | [optional] | +|**underlyingAssetId** | **String** | Underlying asset identifier (64-char hex, no `0x` prefix). Hashed from the pool and underlying token addresses. | [optional] | +|**assetType** | **String** | Asset structure type. Null for a regular position; `locked` for a locked position (e.g. locked staking — check `unlockTime` on positionDetail); `farming` for a MasterChef-style farming position (rewards accrue under the `farming_reward` token group). | [optional] | +|**investmentIds** | **List<String>** | Related investment IDs (64-char hex, no `0x` prefix). Use with `POST /api/v1/defi/data/investment/detail`. Usually a single entry; a position can relate to several investments when the pool stacks products on top of each other (e.g. a farming position wraps the underlying LP investment plus its incentive product, or a staked vault layers a receipt token over the base deposit). When there are several, query each with investment/detail and pick by the action you want to perform — redeeming the principal uses the base investment, claiming farming incentives uses the incentive one. | [optional] | +|**positionDetail** | [**PositionRespPositionDetail**](PositionRespPositionDetail.md) | | [optional] | +|**positionValue** | **String** | Total position value in USD (sum of all token values; may be negative for borrow positions). | [optional] | +|**tokenList** | [**PositionRespTokenList**](PositionRespTokenList.md) | | [optional] | + + + diff --git a/clients/web3-wallet/docs/PositionRespPositionDetail.md b/clients/web3-wallet/docs/PositionRespPositionDetail.md new file mode 100644 index 0000000..29ad2b4 --- /dev/null +++ b/clients/web3-wallet/docs/PositionRespPositionDetail.md @@ -0,0 +1,35 @@ + + +# PositionRespPositionDetail + +Position-level metadata. Present for concentrated-liquidity / locked / farming positions; null otherwise. Fields are null when not applicable to the position type. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**positionIndex** | **String** | Position index (e.g. the Uniswap-V3-style position number). | [optional] | +|**nftId** | **String** | NFT token ID for concentrated-liquidity positions, prefixed with `#` (e.g. `\"#7225901\"`). Null for non-NFT positions. The `#` prefix may be passed as-is to a transaction build endpoint (`lp-add` / `lp-remove` / `claim` `LP_FEE`) — the service strips it automatically; passing the raw id without `#` is also accepted. | [optional] | +|**unlockTime** | **String** | Unix timestamp (seconds) when the position unlocks. Null if no lock. | [optional] | +|**unlockTimeReached** | **Boolean** | Whether the unlock time has been reached. | [optional] | +|**tickLower** | **String** | Lower tick bound for concentrated-liquidity positions. | [optional] | +|**tickUpper** | **String** | Upper tick bound for concentrated-liquidity positions. | [optional] | +|**active** | **Boolean** | Whether the position is currently in-range (active). | [optional] | +|**proofs** | **Map<String, List<String>>** | Merkle proofs keyed by reward token address. Required when claiming PancakeSwap Infinity (V4) rewards. | [optional] | +|**stakeState** | **String** | Staking lifecycle state. Complete value set: active (earning), deactivating (unstaking in progress, rewards stop), inactive (fully unstaked). | [optional] | +|**claimTypes** | [**List<ClaimTypesEnum>**](#List<ClaimTypesEnum>) | Claim types available for this position. Values map to the `claimType` field of `POST /transaction/claim` and determine which companion fields a claim requires. | [optional] | +|**redemptionId** | **String** | Redemption record ID (for pending redemptions). Null when not a pending redemption. | [optional] | + + + +## Enum: List<ClaimTypesEnum> + +| Name | Value | +|---- | -----| +| REWARD_PROTOCOL | "REWARD_PROTOCOL" | +| REWARD_INVESTMENT | "REWARD_INVESTMENT" | +| LP_FEE | "LP_FEE" | +| REDEMPTION | "REDEMPTION" | + + + diff --git a/clients/web3-wallet/docs/PositionRespTokenList.md b/clients/web3-wallet/docs/PositionRespTokenList.md new file mode 100644 index 0000000..1e8f102 --- /dev/null +++ b/clients/web3-wallet/docs/PositionRespTokenList.md @@ -0,0 +1,17 @@ + + +# PositionRespTokenList + +Token breakdown grouped by role. Keys: `supply` (supplied assets), `borrow` (borrowed assets, lending positions), `reward` (claimable rewards), `farming_reward` (MasterChef farming incentives). A key is absent when the position has no tokens in that role. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**supply** | [**List<PositionRespTokenListSupplyInner>**](PositionRespTokenListSupplyInner.md) | | [optional] | +|**borrow** | [**List<PositionRespTokenListSupplyInner>**](PositionRespTokenListSupplyInner.md) | | [optional] | +|**reward** | [**List<PositionRespTokenListSupplyInner>**](PositionRespTokenListSupplyInner.md) | | [optional] | +|**farmingReward** | [**List<PositionRespTokenListSupplyInner>**](PositionRespTokenListSupplyInner.md) | | [optional] | + + + diff --git a/clients/web3-wallet/docs/PositionRespTokenListSupplyInner.md b/clients/web3-wallet/docs/PositionRespTokenListSupplyInner.md new file mode 100644 index 0000000..31c7ceb --- /dev/null +++ b/clients/web3-wallet/docs/PositionRespTokenListSupplyInner.md @@ -0,0 +1,20 @@ + + +# PositionRespTokenListSupplyInner + +Token balance information within a position. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**tokenAddress** | **String** | Token contract address. The native-asset sentinel `0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee` (40 `e`s) for native coins. | [optional] | +|**tokenName** | **String** | Token name. | [optional] | +|**tokenSymbol** | **String** | Token symbol. | [optional] | +|**tokenAmount** | **String** | Human-readable token amount (NOT the smallest unit). | [optional] | +|**tokenPrice** | **String** | Current token price in USD. | [optional] | +|**tokenValue** | **String** | Token value in USD (amount × price). | [optional] | +|**tokenDecimals** | **String** | Token decimals (string). | [optional] | + + + diff --git a/clients/web3-wallet/docs/ProtocolPageResult.md b/clients/web3-wallet/docs/ProtocolPageResult.md new file mode 100644 index 0000000..39d6ac5 --- /dev/null +++ b/clients/web3-wallet/docs/ProtocolPageResult.md @@ -0,0 +1,17 @@ + + +# ProtocolPageResult + +Paginated protocol list result. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**page** | **Integer** | Current page number (1-based). | [optional] | +|**size** | **Integer** | Page size. | [optional] | +|**total** | **Long** | Total number of records. | [optional] | +|**_list** | [**List<ProtocolPageResultListInner>**](ProtocolPageResultListInner.md) | Protocols for the current page. | [optional] | + + + diff --git a/clients/web3-wallet/docs/ProtocolPageResultListInner.md b/clients/web3-wallet/docs/ProtocolPageResultListInner.md new file mode 100644 index 0000000..0cd9c64 --- /dev/null +++ b/clients/web3-wallet/docs/ProtocolPageResultListInner.md @@ -0,0 +1,21 @@ + + +# ProtocolPageResultListInner + +DeFi protocol summary (list item). + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**defiProtocolId** | **String** | DeFi protocol identifier. | [optional] | +|**protocolName** | **String** | Protocol display name. | [optional] | +|**protocolLogo** | **String** | Protocol logo image URL (full URL; quote as-is). | [optional] | +|**tvl** | **String** | Total value locked in the protocol (USD). String, raw precision from the data source. | [optional] | +|**apyBps** | **Long** | Highest APY across the protocol's investments, in basis points (1 bps = 0.01%). Integer value — use this for sorting / comparing / filtering, never the raw decimal. | [optional] | +|**apyDisplay** | **String** | Pre-formatted, human-readable APY string for display (e.g. \"12.35%\"). Quote as-is; do not re-compute or transform. | [optional] | +|**investType** | **List<String>** | Investment types supported by this protocol — an array here (a protocol may support several). Note: the investment-level investType (in investment list/detail) is a single string. Known values: Earn, LiquidityPool. | [optional] | +|**supportedChains** | **List<String>** | Supported Binance chain IDs. | [optional] | + + + diff --git a/clients/web3-wallet/docs/ProtocolResp.md b/clients/web3-wallet/docs/ProtocolResp.md new file mode 100644 index 0000000..f62f966 --- /dev/null +++ b/clients/web3-wallet/docs/ProtocolResp.md @@ -0,0 +1,18 @@ + + +# ProtocolResp + +Protocol-level position summary for one address on one chain. `binanceChainId` + `defiProtocolId` uniquely identify a protocol on a chain. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**binanceChainId** | **String** | Binance chain ID (e.g. \"56\"=BSC). | [optional] | +|**defiProtocolId** | **String** | Protocol identifier consistent with `POST /api/v1/defi/data/protocol/list`. Use this value when calling investment/list, transaction endpoints, etc. | [optional] | +|**protocolName** | **String** | Protocol display name. | [optional] | +|**protocolTotalValue** | **String** | Total position value in this protocol (USD). | [optional] | +|**poolList** | [**List<ProtocolRespPoolListInner>**](ProtocolRespPoolListInner.md) | Pools with positions in this protocol. | [optional] | + + + diff --git a/clients/web3-wallet/docs/ProtocolRespPoolListInner.md b/clients/web3-wallet/docs/ProtocolRespPoolListInner.md new file mode 100644 index 0000000..0b39f1e --- /dev/null +++ b/clients/web3-wallet/docs/ProtocolRespPoolListInner.md @@ -0,0 +1,18 @@ + + +# ProtocolRespPoolListInner + +A pool containing position collections. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**bnPoolId** | **String** | Pool identifier (`0x` + 64-char hex). | [optional] | +|**poolCa** | **String** | Pool contract address. | [optional] | +|**poolType** | **String** | Pool type. Complete value set: `Lending` (supply/borrow market), `Staked` (native staking), `Yield` (yield vault / receipt token), `Deposit` (fixed deposit), `Rewards` (reward claims, e.g. PancakeSwap Infinity), `Liquidity Pool` (AMM / concentrated liquidity), `Farming` (MasterChef farming), `Locked` (locked staking with unlock time), `Vesting` (vesting schedule). Treat unknown values as generic display. | [optional] | +|**positionCollectionList** | [**List<PoolRespPositionCollectionListInner>**](PoolRespPositionCollectionListInner.md) | | [optional] | +|**poolDetail** | [**PoolRespPoolDetail**](PoolRespPoolDetail.md) | | [optional] | + + + diff --git a/clients/web3-wallet/docs/SettleB402PaymentV1Request.md b/clients/web3-wallet/docs/SettleB402PaymentV1Request.md new file mode 100644 index 0000000..c483d63 --- /dev/null +++ b/clients/web3-wallet/docs/SettleB402PaymentV1Request.md @@ -0,0 +1,13 @@ + + +# SettleB402PaymentV1Request + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**body** | [**B402SettleEnvelopeV1Body**](B402SettleEnvelopeV1Body.md) | | | + + + diff --git a/clients/web3-wallet/docs/SettleB402PaymentV1Response.md b/clients/web3-wallet/docs/SettleB402PaymentV1Response.md new file mode 100644 index 0000000..8a6cf96 --- /dev/null +++ b/clients/web3-wallet/docs/SettleB402PaymentV1Response.md @@ -0,0 +1,19 @@ + + +# SettleB402PaymentV1Response + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**status** | **String** | | [optional] | +|**type** | **String** | | [optional] | +|**code** | **String** | | [optional] | +|**errorData** | **String** | | [optional] | +|**data** | **Object** | | [optional] | +|**subData** | **Object** | | [optional] | +|**params** | **Object** | | [optional] | + + + diff --git a/clients/web3-wallet/docs/SettleB402PaymentV1Response1.md b/clients/web3-wallet/docs/SettleB402PaymentV1Response1.md new file mode 100644 index 0000000..22ba0a7 --- /dev/null +++ b/clients/web3-wallet/docs/SettleB402PaymentV1Response1.md @@ -0,0 +1,19 @@ + + +# SettleB402PaymentV1Response1 + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**status** | **String** | | [optional] | +|**type** | **String** | | [optional] | +|**code** | **String** | | [optional] | +|**errorData** | **String** | | [optional] | +|**data** | [**SettleB402PaymentV1Response1Data**](SettleB402PaymentV1Response1Data.md) | | [optional] | +|**subData** | **Object** | | [optional] | +|**params** | **Object** | | [optional] | + + + diff --git a/clients/web3-wallet/docs/SettleB402PaymentV1Response1Data.md b/clients/web3-wallet/docs/SettleB402PaymentV1Response1Data.md new file mode 100644 index 0000000..a3d5241 --- /dev/null +++ b/clients/web3-wallet/docs/SettleB402PaymentV1Response1Data.md @@ -0,0 +1,20 @@ + + +# SettleB402PaymentV1Response1Data + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**success** | **Boolean** | | | +|**transaction** | **String** | | [optional] | +|**payer** | **String** | | [optional] | +|**network** | **String** | | [optional] | +|**amount** | **String** | | [optional] | +|**confirmations** | **Integer** | | [optional] | +|**errorReason** | **String** | | [optional] | +|**errorMessage** | **String** | | [optional] | + + + diff --git a/clients/web3-wallet/docs/SettleB402PaymentV1Response2.md b/clients/web3-wallet/docs/SettleB402PaymentV1Response2.md new file mode 100644 index 0000000..f9f4f08 --- /dev/null +++ b/clients/web3-wallet/docs/SettleB402PaymentV1Response2.md @@ -0,0 +1,19 @@ + + +# SettleB402PaymentV1Response2 + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**status** | **String** | | [optional] | +|**type** | **String** | | [optional] | +|**code** | **String** | | [optional] | +|**errorData** | **String** | | [optional] | +|**data** | **Object** | | [optional] | +|**subData** | **Object** | | [optional] | +|**params** | **Object** | | [optional] | + + + diff --git a/clients/web3-wallet/docs/SettleB402PaymentV2Request.md b/clients/web3-wallet/docs/SettleB402PaymentV2Request.md new file mode 100644 index 0000000..010b746 --- /dev/null +++ b/clients/web3-wallet/docs/SettleB402PaymentV2Request.md @@ -0,0 +1,13 @@ + + +# SettleB402PaymentV2Request + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**body** | [**B402SettleEnvelopeV2Body**](B402SettleEnvelopeV2Body.md) | | | + + + diff --git a/clients/web3-wallet/docs/SettleB402PaymentV2Response.md b/clients/web3-wallet/docs/SettleB402PaymentV2Response.md new file mode 100644 index 0000000..0d4ead8 --- /dev/null +++ b/clients/web3-wallet/docs/SettleB402PaymentV2Response.md @@ -0,0 +1,19 @@ + + +# SettleB402PaymentV2Response + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**status** | **String** | | [optional] | +|**type** | **String** | | [optional] | +|**code** | **String** | | [optional] | +|**errorData** | **String** | | [optional] | +|**data** | **Object** | | [optional] | +|**subData** | **Object** | | [optional] | +|**params** | **Object** | | [optional] | + + + diff --git a/clients/web3-wallet/docs/SettleB402PaymentV2Response1.md b/clients/web3-wallet/docs/SettleB402PaymentV2Response1.md new file mode 100644 index 0000000..42dd78b --- /dev/null +++ b/clients/web3-wallet/docs/SettleB402PaymentV2Response1.md @@ -0,0 +1,19 @@ + + +# SettleB402PaymentV2Response1 + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**status** | **String** | | [optional] | +|**type** | **String** | | [optional] | +|**code** | **String** | | [optional] | +|**errorData** | **String** | | [optional] | +|**data** | [**SettleB402PaymentV2Response1Data**](SettleB402PaymentV2Response1Data.md) | | [optional] | +|**subData** | **Object** | | [optional] | +|**params** | **Object** | | [optional] | + + + diff --git a/clients/web3-wallet/docs/SettleB402PaymentV2Response1Data.md b/clients/web3-wallet/docs/SettleB402PaymentV2Response1Data.md new file mode 100644 index 0000000..41fcead --- /dev/null +++ b/clients/web3-wallet/docs/SettleB402PaymentV2Response1Data.md @@ -0,0 +1,20 @@ + + +# SettleB402PaymentV2Response1Data + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**success** | **Boolean** | | | +|**transaction** | **String** | | | +|**payer** | **String** | | [optional] | +|**network** | **String** | | | +|**amount** | **String** | | [optional] | +|**errorReason** | **String** | | [optional] | +|**errorMessage** | **String** | | [optional] | +|**extensions** | **Map<String, Object>** | | [optional] | + + + diff --git a/clients/web3-wallet/docs/SettleB402PaymentV2Response2.md b/clients/web3-wallet/docs/SettleB402PaymentV2Response2.md new file mode 100644 index 0000000..f3f3058 --- /dev/null +++ b/clients/web3-wallet/docs/SettleB402PaymentV2Response2.md @@ -0,0 +1,19 @@ + + +# SettleB402PaymentV2Response2 + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**status** | **String** | | [optional] | +|**type** | **String** | | [optional] | +|**code** | **String** | | [optional] | +|**errorData** | **String** | | [optional] | +|**data** | **Object** | | [optional] | +|**subData** | **Object** | | [optional] | +|**params** | **Object** | | [optional] | + + + diff --git a/clients/web3-wallet/docs/TokenResp.md b/clients/web3-wallet/docs/TokenResp.md new file mode 100644 index 0000000..e6cd7f1 --- /dev/null +++ b/clients/web3-wallet/docs/TokenResp.md @@ -0,0 +1,20 @@ + + +# TokenResp + +Token balance information within a position. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**tokenAddress** | **String** | Token contract address. The native-asset sentinel `0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee` (40 `e`s) for native coins. | [optional] | +|**tokenName** | **String** | Token name. | [optional] | +|**tokenSymbol** | **String** | Token symbol. | [optional] | +|**tokenAmount** | **String** | Human-readable token amount (NOT the smallest unit). | [optional] | +|**tokenPrice** | **String** | Current token price in USD. | [optional] | +|**tokenValue** | **String** | Token value in USD (amount × price). | [optional] | +|**tokenDecimals** | **String** | Token decimals (string). | [optional] | + + + diff --git a/clients/web3-wallet/docs/VerifyB402PaymentV1Request.md b/clients/web3-wallet/docs/VerifyB402PaymentV1Request.md new file mode 100644 index 0000000..52ae971 --- /dev/null +++ b/clients/web3-wallet/docs/VerifyB402PaymentV1Request.md @@ -0,0 +1,13 @@ + + +# VerifyB402PaymentV1Request + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**body** | [**VerifyB402PaymentV1RequestBody**](VerifyB402PaymentV1RequestBody.md) | | | + + + diff --git a/clients/web3-wallet/docs/VerifyB402PaymentV1RequestBody.md b/clients/web3-wallet/docs/VerifyB402PaymentV1RequestBody.md new file mode 100644 index 0000000..5cc63ab --- /dev/null +++ b/clients/web3-wallet/docs/VerifyB402PaymentV1RequestBody.md @@ -0,0 +1,23 @@ + + +# VerifyB402PaymentV1RequestBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**x402Version** | [**X402VersionEnum**](#X402VersionEnum) | | | +|**paymentPayload** | [**VerifyB402PaymentV1RequestBodyPaymentPayload**](VerifyB402PaymentV1RequestBodyPaymentPayload.md) | | | +|**paymentRequirements** | [**VerifyB402PaymentV1RequestBodyPaymentRequirements**](VerifyB402PaymentV1RequestBodyPaymentRequirements.md) | | | + + + +## Enum: X402VersionEnum + +| Name | Value | +|---- | -----| +| X402_VERSION_1 | 1 | + + + diff --git a/clients/web3-wallet/docs/VerifyB402PaymentV1RequestBodyPaymentPayload.md b/clients/web3-wallet/docs/VerifyB402PaymentV1RequestBodyPaymentPayload.md new file mode 100644 index 0000000..8782e36 --- /dev/null +++ b/clients/web3-wallet/docs/VerifyB402PaymentV1RequestBodyPaymentPayload.md @@ -0,0 +1,32 @@ + + +# VerifyB402PaymentV1RequestBodyPaymentPayload + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**x402Version** | [**X402VersionEnum**](#X402VersionEnum) | | | +|**scheme** | [**SchemeEnum**](#SchemeEnum) | | | +|**network** | **String** | | | +|**payload** | [**VerifyB402PaymentV2RequestBodyPaymentPayloadPayload**](VerifyB402PaymentV2RequestBodyPaymentPayloadPayload.md) | | | + + + +## Enum: X402VersionEnum + +| Name | Value | +|---- | -----| +| X402_VERSION_1 | 1 | + + + +## Enum: SchemeEnum + +| Name | Value | +|---- | -----| +| exact | "exact" | + + + diff --git a/clients/web3-wallet/docs/VerifyB402PaymentV1RequestBodyPaymentRequirements.md b/clients/web3-wallet/docs/VerifyB402PaymentV1RequestBodyPaymentRequirements.md new file mode 100644 index 0000000..f7bd467 --- /dev/null +++ b/clients/web3-wallet/docs/VerifyB402PaymentV1RequestBodyPaymentRequirements.md @@ -0,0 +1,31 @@ + + +# VerifyB402PaymentV1RequestBodyPaymentRequirements + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**scheme** | [**SchemeEnum**](#SchemeEnum) | | | +|**network** | **String** | | | +|**amount** | **String** | | | +|**resource** | **URI** | | [optional] | +|**description** | **String** | | [optional] | +|**payTo** | **String** | | | +|**asset** | **String** | | | +|**maxTimeoutSeconds** | **Integer** | | | +|**mimeType** | **String** | | [optional] | +|**outputSchema** | **Map<String, Object>** | | [optional] | +|**extra** | [**VerifyB402PaymentV1RequestBodyPaymentRequirementsExtra**](VerifyB402PaymentV1RequestBodyPaymentRequirementsExtra.md) | | [optional] | + + + +## Enum: SchemeEnum + +| Name | Value | +|---- | -----| +| exact | "exact" | + + + diff --git a/clients/web3-wallet/docs/VerifyB402PaymentV1RequestBodyPaymentRequirementsExtra.md b/clients/web3-wallet/docs/VerifyB402PaymentV1RequestBodyPaymentRequirementsExtra.md new file mode 100644 index 0000000..601d3f2 --- /dev/null +++ b/clients/web3-wallet/docs/VerifyB402PaymentV1RequestBodyPaymentRequirementsExtra.md @@ -0,0 +1,26 @@ + + +# VerifyB402PaymentV1RequestBodyPaymentRequirementsExtra + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **String** | | [optional] | +|**version** | **String** | | [optional] | +|**assetTransferMethod** | [**AssetTransferMethodEnum**](#AssetTransferMethodEnum) | | [optional] | +|**facilitatorAddress** | **String** | | [optional] | + + + +## Enum: AssetTransferMethodEnum + +| Name | Value | +|---- | -----| +| EIP3009 | "eip3009" | +| PERMIT2_EXACT | "permit2-exact" | +| PERMIT2_UPTO | "permit2-upto" | + + + diff --git a/clients/web3-wallet/docs/VerifyB402PaymentV1Response.md b/clients/web3-wallet/docs/VerifyB402PaymentV1Response.md new file mode 100644 index 0000000..411cce9 --- /dev/null +++ b/clients/web3-wallet/docs/VerifyB402PaymentV1Response.md @@ -0,0 +1,19 @@ + + +# VerifyB402PaymentV1Response + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**status** | **String** | | [optional] | +|**type** | **String** | | [optional] | +|**code** | **String** | | [optional] | +|**errorData** | **String** | | [optional] | +|**data** | **Object** | | [optional] | +|**subData** | **Object** | | [optional] | +|**params** | **Object** | | [optional] | + + + diff --git a/clients/web3-wallet/docs/VerifyB402PaymentV1Response1.md b/clients/web3-wallet/docs/VerifyB402PaymentV1Response1.md new file mode 100644 index 0000000..253a994 --- /dev/null +++ b/clients/web3-wallet/docs/VerifyB402PaymentV1Response1.md @@ -0,0 +1,19 @@ + + +# VerifyB402PaymentV1Response1 + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**status** | **String** | | [optional] | +|**type** | **String** | | [optional] | +|**code** | **String** | | [optional] | +|**errorData** | **String** | | [optional] | +|**data** | [**B402VerifyResponseV2Data**](B402VerifyResponseV2Data.md) | | [optional] | +|**subData** | **Object** | | [optional] | +|**params** | **Object** | | [optional] | + + + diff --git a/clients/web3-wallet/docs/VerifyB402PaymentV1Response2.md b/clients/web3-wallet/docs/VerifyB402PaymentV1Response2.md new file mode 100644 index 0000000..ad838d7 --- /dev/null +++ b/clients/web3-wallet/docs/VerifyB402PaymentV1Response2.md @@ -0,0 +1,19 @@ + + +# VerifyB402PaymentV1Response2 + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**status** | **String** | | [optional] | +|**type** | **String** | | [optional] | +|**code** | **String** | | [optional] | +|**errorData** | **String** | | [optional] | +|**data** | **Object** | | [optional] | +|**subData** | **Object** | | [optional] | +|**params** | **Object** | | [optional] | + + + diff --git a/clients/web3-wallet/docs/VerifyB402PaymentV2Request.md b/clients/web3-wallet/docs/VerifyB402PaymentV2Request.md new file mode 100644 index 0000000..3b7ea8c --- /dev/null +++ b/clients/web3-wallet/docs/VerifyB402PaymentV2Request.md @@ -0,0 +1,13 @@ + + +# VerifyB402PaymentV2Request + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**body** | [**VerifyB402PaymentV2RequestBody**](VerifyB402PaymentV2RequestBody.md) | | | + + + diff --git a/clients/web3-wallet/docs/VerifyB402PaymentV2RequestBody.md b/clients/web3-wallet/docs/VerifyB402PaymentV2RequestBody.md new file mode 100644 index 0000000..4739354 --- /dev/null +++ b/clients/web3-wallet/docs/VerifyB402PaymentV2RequestBody.md @@ -0,0 +1,23 @@ + + +# VerifyB402PaymentV2RequestBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**x402Version** | [**X402VersionEnum**](#X402VersionEnum) | | | +|**paymentPayload** | [**VerifyB402PaymentV2RequestBodyPaymentPayload**](VerifyB402PaymentV2RequestBodyPaymentPayload.md) | | | +|**paymentRequirements** | [**VerifyB402PaymentV2RequestBodyPaymentPayloadAccepted**](VerifyB402PaymentV2RequestBodyPaymentPayloadAccepted.md) | | | + + + +## Enum: X402VersionEnum + +| Name | Value | +|---- | -----| +| X402_VERSION_2 | 2 | + + + diff --git a/clients/web3-wallet/docs/VerifyB402PaymentV2RequestBodyPaymentPayload.md b/clients/web3-wallet/docs/VerifyB402PaymentV2RequestBodyPaymentPayload.md new file mode 100644 index 0000000..1032da6 --- /dev/null +++ b/clients/web3-wallet/docs/VerifyB402PaymentV2RequestBodyPaymentPayload.md @@ -0,0 +1,25 @@ + + +# VerifyB402PaymentV2RequestBodyPaymentPayload + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**x402Version** | [**X402VersionEnum**](#X402VersionEnum) | | | +|**resource** | [**VerifyB402PaymentV2RequestBodyPaymentPayloadResource**](VerifyB402PaymentV2RequestBodyPaymentPayloadResource.md) | | | +|**accepted** | [**VerifyB402PaymentV2RequestBodyPaymentPayloadAccepted**](VerifyB402PaymentV2RequestBodyPaymentPayloadAccepted.md) | | | +|**payload** | [**VerifyB402PaymentV2RequestBodyPaymentPayloadPayload**](VerifyB402PaymentV2RequestBodyPaymentPayloadPayload.md) | | | +|**extensions** | **VerifyB402PaymentV2RequestBodyPaymentPayloadExtensions** | | [optional] | + + + +## Enum: X402VersionEnum + +| Name | Value | +|---- | -----| +| X402_VERSION_2 | 2 | + + + diff --git a/clients/web3-wallet/docs/VerifyB402PaymentV2RequestBodyPaymentPayloadAccepted.md b/clients/web3-wallet/docs/VerifyB402PaymentV2RequestBodyPaymentPayloadAccepted.md new file mode 100644 index 0000000..9687cf4 --- /dev/null +++ b/clients/web3-wallet/docs/VerifyB402PaymentV2RequestBodyPaymentPayloadAccepted.md @@ -0,0 +1,28 @@ + + +# VerifyB402PaymentV2RequestBodyPaymentPayloadAccepted + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**scheme** | [**SchemeEnum**](#SchemeEnum) | | | +|**network** | **String** | | | +|**amount** | **String** | | | +|**asset** | **String** | | | +|**payTo** | **String** | | | +|**maxTimeoutSeconds** | **Integer** | | | +|**extra** | [**B402PaymentRequirementsV2Extra**](B402PaymentRequirementsV2Extra.md) | | | + + + +## Enum: SchemeEnum + +| Name | Value | +|---- | -----| +| exact | "exact" | +| upto | "upto" | + + + diff --git a/clients/web3-wallet/docs/VerifyB402PaymentV2RequestBodyPaymentPayloadExtensions.md b/clients/web3-wallet/docs/VerifyB402PaymentV2RequestBodyPaymentPayloadExtensions.md new file mode 100644 index 0000000..69a7731 --- /dev/null +++ b/clients/web3-wallet/docs/VerifyB402PaymentV2RequestBodyPaymentPayloadExtensions.md @@ -0,0 +1,13 @@ + + +# VerifyB402PaymentV2RequestBodyPaymentPayloadExtensions + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**bazaar** | [**VerifyB402PaymentV2RequestBodyPaymentPayloadExtensionsBazaar**](VerifyB402PaymentV2RequestBodyPaymentPayloadExtensionsBazaar.md) | | [optional] | + + + diff --git a/clients/web3-wallet/docs/VerifyB402PaymentV2RequestBodyPaymentPayloadExtensionsBazaar.md b/clients/web3-wallet/docs/VerifyB402PaymentV2RequestBodyPaymentPayloadExtensionsBazaar.md new file mode 100644 index 0000000..63d752a --- /dev/null +++ b/clients/web3-wallet/docs/VerifyB402PaymentV2RequestBodyPaymentPayloadExtensionsBazaar.md @@ -0,0 +1,16 @@ + + +# VerifyB402PaymentV2RequestBodyPaymentPayloadExtensionsBazaar + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**info** | **Map<String, Object>** | | | +|**schema** | **Map<String, Object>** | | | +|**routeTemplate** | **String** | | [optional] | +|**description** | **String** | | [optional] | + + + diff --git a/clients/web3-wallet/docs/VerifyB402PaymentV2RequestBodyPaymentPayloadPayload.md b/clients/web3-wallet/docs/VerifyB402PaymentV2RequestBodyPaymentPayloadPayload.md new file mode 100644 index 0000000..439d3c9 --- /dev/null +++ b/clients/web3-wallet/docs/VerifyB402PaymentV2RequestBodyPaymentPayloadPayload.md @@ -0,0 +1,15 @@ + + +# VerifyB402PaymentV2RequestBodyPaymentPayloadPayload + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**signature** | **String** | | | +|**authorization** | [**VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadAuthorization**](VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadAuthorization.md) | | [optional] | +|**permit2Authorization** | [**VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2Authorization**](VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2Authorization.md) | | [optional] | + + + diff --git a/clients/web3-wallet/docs/VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadAuthorization.md b/clients/web3-wallet/docs/VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadAuthorization.md new file mode 100644 index 0000000..4d447e3 --- /dev/null +++ b/clients/web3-wallet/docs/VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadAuthorization.md @@ -0,0 +1,18 @@ + + +# VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadAuthorization + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**from** | **String** | | | +|**to** | **String** | | | +|**value** | **String** | | | +|**validAfter** | **String** | | | +|**validBefore** | **String** | | | +|**nonce** | **String** | | | + + + diff --git a/clients/web3-wallet/docs/VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2Authorization.md b/clients/web3-wallet/docs/VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2Authorization.md new file mode 100644 index 0000000..c16cd28 --- /dev/null +++ b/clients/web3-wallet/docs/VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2Authorization.md @@ -0,0 +1,18 @@ + + +# VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2Authorization + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**permitted** | [**VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationPermitted**](VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationPermitted.md) | | | +|**from** | **String** | | | +|**spender** | **String** | | | +|**nonce** | **String** | | | +|**deadline** | **String** | | | +|**witness** | [**VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationWitness**](VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationWitness.md) | | | + + + diff --git a/clients/web3-wallet/docs/VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationPermitted.md b/clients/web3-wallet/docs/VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationPermitted.md new file mode 100644 index 0000000..e2c2287 --- /dev/null +++ b/clients/web3-wallet/docs/VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationPermitted.md @@ -0,0 +1,14 @@ + + +# VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationPermitted + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**token** | **String** | | | +|**amount** | **String** | | | + + + diff --git a/clients/web3-wallet/docs/VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationWitness.md b/clients/web3-wallet/docs/VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationWitness.md new file mode 100644 index 0000000..10791f8 --- /dev/null +++ b/clients/web3-wallet/docs/VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationWitness.md @@ -0,0 +1,15 @@ + + +# VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationWitness + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**to** | **String** | | | +|**facilitator** | **String** | | [optional] | +|**validAfter** | **String** | | | + + + diff --git a/clients/web3-wallet/docs/VerifyB402PaymentV2RequestBodyPaymentPayloadResource.md b/clients/web3-wallet/docs/VerifyB402PaymentV2RequestBodyPaymentPayloadResource.md new file mode 100644 index 0000000..0566056 --- /dev/null +++ b/clients/web3-wallet/docs/VerifyB402PaymentV2RequestBodyPaymentPayloadResource.md @@ -0,0 +1,15 @@ + + +# VerifyB402PaymentV2RequestBodyPaymentPayloadResource + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**url** | **URI** | | | +|**description** | **String** | | [optional] | +|**mimeType** | **String** | | [optional] | + + + diff --git a/clients/web3-wallet/docs/VerifyB402PaymentV2Response.md b/clients/web3-wallet/docs/VerifyB402PaymentV2Response.md new file mode 100644 index 0000000..63c9678 --- /dev/null +++ b/clients/web3-wallet/docs/VerifyB402PaymentV2Response.md @@ -0,0 +1,19 @@ + + +# VerifyB402PaymentV2Response + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**status** | **String** | | [optional] | +|**type** | **String** | | [optional] | +|**code** | **String** | | [optional] | +|**errorData** | **String** | | [optional] | +|**data** | **Object** | | [optional] | +|**subData** | **Object** | | [optional] | +|**params** | **Object** | | [optional] | + + + diff --git a/clients/web3-wallet/docs/VerifyB402PaymentV2Response1.md b/clients/web3-wallet/docs/VerifyB402PaymentV2Response1.md new file mode 100644 index 0000000..d9b3a3c --- /dev/null +++ b/clients/web3-wallet/docs/VerifyB402PaymentV2Response1.md @@ -0,0 +1,19 @@ + + +# VerifyB402PaymentV2Response1 + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**status** | **String** | | [optional] | +|**type** | **String** | | [optional] | +|**code** | **String** | | [optional] | +|**errorData** | **String** | | [optional] | +|**data** | [**VerifyB402PaymentV2Response1Data**](VerifyB402PaymentV2Response1Data.md) | | [optional] | +|**subData** | **Object** | | [optional] | +|**params** | **Object** | | [optional] | + + + diff --git a/clients/web3-wallet/docs/VerifyB402PaymentV2Response1Data.md b/clients/web3-wallet/docs/VerifyB402PaymentV2Response1Data.md new file mode 100644 index 0000000..6ed2a0e --- /dev/null +++ b/clients/web3-wallet/docs/VerifyB402PaymentV2Response1Data.md @@ -0,0 +1,16 @@ + + +# VerifyB402PaymentV2Response1Data + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**isValid** | **Boolean** | | | +|**payer** | **String** | | [optional] | +|**invalidReason** | **String** | | [optional] | +|**invalidMessage** | **String** | | [optional] | + + + diff --git a/clients/web3-wallet/docs/VerifyB402PaymentV2Response2.md b/clients/web3-wallet/docs/VerifyB402PaymentV2Response2.md new file mode 100644 index 0000000..d61cd82 --- /dev/null +++ b/clients/web3-wallet/docs/VerifyB402PaymentV2Response2.md @@ -0,0 +1,19 @@ + + +# VerifyB402PaymentV2Response2 + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**status** | **String** | | [optional] | +|**type** | **String** | | [optional] | +|**code** | **String** | | [optional] | +|**errorData** | **String** | | [optional] | +|**data** | **Object** | | [optional] | +|**subData** | **Object** | | [optional] | +|**params** | **Object** | | [optional] | + + + diff --git a/clients/web3-wallet/docs/WalletApi.md b/clients/web3-wallet/docs/WalletApi.md index baabf7f..317760f 100644 --- a/clients/web3-wallet/docs/WalletApi.md +++ b/clients/web3-wallet/docs/WalletApi.md @@ -17,7 +17,7 @@ All URIs are relative to *https://web3.binance.com/build* Get All Token Balances by Address -Return all token balances held by an address across one or more chains, with pagination support. Set `excludeRiskToken=true` to filter out airdrop-risk and honeypot tokens (honeypot detection currently applies only to ETH / BSC / SOL / BASE). +Return all token balances held by an address on a single chain, with pagination support. Set `excludeRiskToken=true` to filter out airdrop-risk and honeypot tokens (honeypot detection currently applies only to ETH / BSC / SOL / BASE). ### Example ```java @@ -37,7 +37,7 @@ public class Example { Long recvWindow = 5000L; // Long | Allowed time deviation in milliseconds (default: 5000, max: 60000). String nonce = "unique-nonce-string"; // String | Unique request identifier for anti-replay; falls back to X-OC-SIGN if omitted. String address = "0xed0c6079229e2d407672a117c22b62064f4a4312"; // String | Wallet address to query. - String chains = "1,56"; // String | Comma-separated list of chain identifiers. + String chains = "1"; // String | Currently only a single chain is supported. Passing multiple comma-separated chain IDs returns an error; multi-chain support may be added in the future. Boolean excludeRiskToken = true; // Boolean | Whether to exclude risk-flagged tokens. Long page = 1L; // Long | Page number. Defaults to 1. Integer pageSize = 20; // Integer | Page size. Range 1–100. Defaults to 20. @@ -70,7 +70,7 @@ public class Example { | **recvWindow** | **Long**| Allowed time deviation in milliseconds (default: 5000, max: 60000). | [optional] | | **nonce** | **String**| Unique request identifier for anti-replay; falls back to X-OC-SIGN if omitted. | [optional] | | **address** | **String**| Wallet address to query. | [optional] | -| **chains** | **String**| Comma-separated list of chain identifiers. | [optional] | +| **chains** | **String**| Currently only a single chain is supported. Passing multiple comma-separated chain IDs returns an error; multi-chain support may be added in the future. | [optional] | | **excludeRiskToken** | **Boolean**| Whether to exclude risk-flagged tokens. | [optional] | | **page** | **Long**| Page number. Defaults to 1. | [optional] | | **pageSize** | **Integer**| Page size. Range 1–100. Defaults to 20. | [optional] | diff --git a/clients/web3-wallet/docs/WebSocketApi.md b/clients/web3-wallet/docs/WebSocketApi.md new file mode 100644 index 0000000..79349e5 --- /dev/null +++ b/clients/web3-wallet/docs/WebSocketApi.md @@ -0,0 +1,76 @@ +# WebSocketApi + +All URIs are relative to *https://web3.binance.com/build* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**getWebSocketAuthToken**](WebSocketApi.md#getWebSocketAuthToken) | **GET** /api/v1/dex/market/wss/auth/token | Get WebSocket Auth Token | + + + +# **getWebSocketAuthToken** +> GetWebSocketAuthTokenResponse getWebSocketAuthToken().recvWindow(recvWindow).nonce(nonce).execute(); + +Get WebSocket Auth Token + +Get a WebSocket auth token before connecting to the WebSocket stream service. + +### Example +```java +// Import classes: +import com.binance.connector.client.web3_wallet.ApiClient; +import com.binance.connector.client.web3_wallet.ApiException; +import com.binance.connector.client.web3_wallet.Configuration; +import com.binance.connector.client.web3_wallet.models.*; +import com.binance.connector.client.web3_wallet.rest.api.WebSocketApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://web3.binance.com/build"); + + WebSocketApi apiInstance = new WebSocketApi(defaultClient); + Long recvWindow = 5000L; // Long | Allowed time deviation in milliseconds (default: 5000, max: 60000). + String nonce = "unique-nonce-string"; // String | Unique request identifier for anti-replay; falls back to X-OC-SIGN if omitted. + try { + GetWebSocketAuthTokenResponse result = apiInstance.getWebSocketAuthToken() + .recvWindow(recvWindow) + .nonce(nonce) + .execute(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling WebSocketApi#getWebSocketAuthToken"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **recvWindow** | **Long**| Allowed time deviation in milliseconds (default: 5000, max: 60000). | [optional] | +| **nonce** | **String**| Unique request identifier for anti-replay; falls back to X-OC-SIGN if omitted. | [optional] | + +### Return type + +[**GetWebSocketAuthTokenResponse**](GetWebSocketAuthTokenResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | WebSocket auth token returned successfully. | - | + diff --git a/clients/web3-wallet/example_rest.md b/clients/web3-wallet/example_rest.md index a6e3067..d15727c 100644 --- a/clients/web3-wallet/example_rest.md +++ b/clients/web3-wallet/example_rest.md @@ -14,6 +14,46 @@ [GET /api/v1/dex/market/address-tracker/trades](https://web3.binance.com/en/dev-docs/catalog/web3-wallet/api/rest-api/address-portfolio#get-tracked-trades) - getTrackedTrades - [GetTrackedTradesExample.java:38](/examples/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/addressportfolio/GetTrackedTradesExample.java#L38) +## B402Payments + +[POST /api/v1/b402/supported](https://web3.binance.com/en/dev-docs/catalog/web3-wallet/api/rest-api/b402-payments#get-b402-supported-configurations-v1) - getB402SupportedConfigurationsV1 - [GetB402SupportedConfigurationsV1Example.java:38](/examples/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/b402payments/GetB402SupportedConfigurationsV1Example.java#L38) + +[POST /api/v2/b402/supported](https://web3.binance.com/en/dev-docs/catalog/web3-wallet/api/rest-api/b402-payments#get-b402-supported-configurations-v2) - getB402SupportedConfigurationsV2 - [GetB402SupportedConfigurationsV2Example.java:38](/examples/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/b402payments/GetB402SupportedConfigurationsV2Example.java#L38) + +[POST /api/v1/b402/settle](https://web3.binance.com/en/dev-docs/catalog/web3-wallet/api/rest-api/b402-payments#settle-b402-payment-v1) - settleB402PaymentV1 - [SettleB402PaymentV1Example.java:38](/examples/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/b402payments/SettleB402PaymentV1Example.java#L38) + +[POST /api/v2/b402/settle](https://web3.binance.com/en/dev-docs/catalog/web3-wallet/api/rest-api/b402-payments#settle-b402-payment-v2) - settleB402PaymentV2 - [SettleB402PaymentV2Example.java:39](/examples/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/b402payments/SettleB402PaymentV2Example.java#L39) + +[POST /api/v1/b402/verify](https://web3.binance.com/en/dev-docs/catalog/web3-wallet/api/rest-api/b402-payments#verify-b402-payment-v1) - verifyB402PaymentV1 - [VerifyB402PaymentV1Example.java:38](/examples/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/b402payments/VerifyB402PaymentV1Example.java#L38) + +[POST /api/v2/b402/verify](https://web3.binance.com/en/dev-docs/catalog/web3-wallet/api/rest-api/b402-payments#verify-b402-payment-v2) - verifyB402PaymentV2 - [VerifyB402PaymentV2Example.java:39](/examples/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/b402payments/VerifyB402PaymentV2Example.java#L39) + +## DefiData + +[POST /api/v1/defi/data/position/list](https://web3.binance.com/en/dev-docs/catalog/web3-wallet/api/rest-api/defi-data#get-de-fi-positions) - getDeFiPositions - []() + +[POST /api/v1/defi/data/investment/detail](https://web3.binance.com/en/dev-docs/catalog/web3-wallet/api/rest-api/defi-data#get-investment-detail) - getInvestmentDetail - []() + +[POST /api/v1/defi/data/protocol/detail](https://web3.binance.com/en/dev-docs/catalog/web3-wallet/api/rest-api/defi-data#get-protocol-detail) - getProtocolDetail - []() + +[POST /api/v1/defi/data/investment/list](https://web3.binance.com/en/dev-docs/catalog/web3-wallet/api/rest-api/defi-data#list-de-fi-investments) - listDeFiInvestments - []() + +[POST /api/v1/defi/data/protocol/list](https://web3.binance.com/en/dev-docs/catalog/web3-wallet/api/rest-api/defi-data#list-de-fi-protocols) - listDeFiProtocols - []() + +## DefiTransaction + +[POST /api/v1/defi/transaction/claim](https://web3.binance.com/en/dev-docs/catalog/web3-wallet/api/rest-api/defi-transaction#build-de-fi-claim-transaction) - buildDeFiClaimTransaction - []() + +[POST /api/v1/defi/transaction/deposit](https://web3.binance.com/en/dev-docs/catalog/web3-wallet/api/rest-api/defi-transaction#build-de-fi-deposit-transaction) - buildDeFiDepositTransaction - []() + +[POST /api/v1/defi/transaction/redeem](https://web3.binance.com/en/dev-docs/catalog/web3-wallet/api/rest-api/defi-transaction#build-de-fi-redeem-transaction) - buildDeFiRedeemTransaction - []() + +[POST /api/v1/defi/transaction/lp-add](https://web3.binance.com/en/dev-docs/catalog/web3-wallet/api/rest-api/defi-transaction#build-lp-add-transaction) - buildLpAddTransaction - []() + +[POST /api/v1/defi/transaction/lp-remove](https://web3.binance.com/en/dev-docs/catalog/web3-wallet/api/rest-api/defi-transaction#build-lp-remove-transaction) - buildLpRemoveTransaction - []() + +[POST /api/v1/defi/transaction/lp-add/calculate](https://web3.binance.com/en/dev-docs/catalog/web3-wallet/api/rest-api/defi-transaction#calculate-lp-add-paired-amounts) - calculateLpAddPairedAmounts - []() + ## GeneralData [GET /api/v1/dex/market/candles](https://web3.binance.com/en/dev-docs/catalog/web3-wallet/api/rest-api/general-data#get-candles) - getCandles - [GetCandlesExample.java:37](/examples/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/generaldata/GetCandlesExample.java#L37) @@ -104,3 +144,7 @@ [GET /api/v1/dex/balance/supported/chain](https://web3.binance.com/en/dev-docs/catalog/web3-wallet/api/rest-api/wallet-api#get-wallet-supported-chains) - getWalletSupportedChains - []() +## WebSocket + +[GET /api/v1/dex/market/wss/auth/token](https://web3.binance.com/en/dev-docs/catalog/web3-wallet/api/rest-api/web-socket-api#get-web-socket-auth-token) - getWebSocketAuthToken - [GetWebSocketAuthTokenExample.java:36](/examples/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/websocket/GetWebSocketAuthTokenExample.java#L36) + diff --git a/clients/web3-wallet/pom.xml b/clients/web3-wallet/pom.xml index 7ea55ae..1e2383e 100644 --- a/clients/web3-wallet/pom.xml +++ b/clients/web3-wallet/pom.xml @@ -5,13 +5,13 @@ 4.0.0 binance-web3-wallet web3-wallet - 4.1.0 + 4.2.0 jar io.github.binance binance-connector-java-clients - 1.1.2 + 1.1.3 diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/JSON.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/JSON.java index cdc846e..110a9d4 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/JSON.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/JSON.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * @@ -108,6 +108,241 @@ private static Class getClassByDiscriminator( gsonBuilder.registerTypeAdapter(OffsetDateTime.class, offsetDateTimeTypeAdapter); gsonBuilder.registerTypeAdapter(LocalDate.class, localDateTypeAdapter); gsonBuilder.registerTypeAdapter(byte[].class, byteArrayAdapter); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.AddressResp + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.AddressRespProtocolListInner + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.B402ApiErrorEnvelope + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.B402BazaarExtension + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.B402Eip3009Authorization + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.B402PayloadDetail + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .B402PayloadDetailAuthorization.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .B402PayloadDetailPermit2Authorization.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.B402PaymentKindExtraV1 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.B402PaymentKindExtraV2 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.B402PaymentKindV1 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.B402PaymentKindV1Extra + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.B402PaymentKindV2 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.B402PaymentKindV2Extra + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.B402PaymentPayloadV1 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.B402PaymentPayloadV2 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.B402PaymentPayloadV2Accepted + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .B402PaymentPayloadV2Extensions.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .B402PaymentPayloadV2ExtensionsBazaar.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.B402PaymentPayloadV2Payload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.B402PaymentPayloadV2Resource + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .B402PaymentRequirementsExtraV2.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.B402PaymentRequirementsV1 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.B402PaymentRequirementsV2 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .B402PaymentRequirementsV2Extra.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.B402Permit2Authorization + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .B402Permit2AuthorizationPermitted.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .B402Permit2AuthorizationWitness.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.B402Permit2Permitted + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.B402Permit2Witness + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.B402RequestEnvelopeSupported + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.B402ResourceInfoV2 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.B402SettleDataV1 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.B402SettleDataV2 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.B402SettleEnvelopeV1 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.B402SettleEnvelopeV1Body + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.B402SettleEnvelopeV2 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.B402SettleEnvelopeV2Body + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .B402SettleEnvelopeV2BodyAllOfPaymentPayload.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .B402SettleEnvelopeV2BodyAllOfPaymentPayloadAccepted + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.B402SettleRequestV1 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .B402SettleRequestV1AllOfPaymentPayload.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .B402SettleRequestV1AllOfPaymentRequirements.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.B402SettleRequestV2 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .B402SettleRequestV2AllOfPaymentPayload.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .B402SettleRequestV2AllOfPaymentPayloadAccepted.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .B402SettleRequestV2AllOfPaymentPayloadPayload.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2Authorization + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationPermitted + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationWitness + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .B402SettleRequestV2AllOfPaymentPayloadResource.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.B402SettleResponseV1 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.B402SettleResponseV1Data + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.B402SettleResponseV2 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.B402SettleResponseV2Data + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.B402SupportedDataV1 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .B402SupportedDataV1KindsInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.B402SupportedDataV2 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .B402SupportedDataV2KindsInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .B402SupportedDataV2KindsInnerExtra.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.B402SupportedResponseV1 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.B402SupportedResponseV1Data + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.B402SupportedResponseV2 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.B402SupportedResponseV2Data + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.B402VerifyDataV2 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.B402VerifyEnvelopeV1 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.B402VerifyEnvelopeV1Body + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.B402VerifyEnvelopeV2 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.B402VerifyEnvelopeV2Body + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.B402VerifyRequestV1 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .B402VerifyRequestV1PaymentPayload.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .B402VerifyRequestV1PaymentRequirements.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.B402VerifyRequestV2 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .B402VerifyRequestV2PaymentPayload.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.B402VerifyResponseV1 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.B402VerifyResponseV2 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.B402VerifyResponseV2Data + .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( new com.binance.connector.client.web3_wallet.rest.model.BroadcastTransactionsRequest .CustomTypeAdapterFactory()); @@ -117,6 +352,55 @@ private static Class getClassByDiscriminator( gsonBuilder.registerTypeAdapterFactory( new com.binance.connector.client.web3_wallet.rest.model .BroadcastTransactionsResponseData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .BuildDeFiClaimTransactionRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .BuildDeFiClaimTransactionResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .BuildDeFiDepositTransactionRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .BuildDeFiDepositTransactionRequestToken.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .BuildDeFiDepositTransactionResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .BuildDeFiDepositTransactionResponseData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .BuildDeFiDepositTransactionResponseDataDataListInner + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .BuildDeFiDepositTransactionResponseDataPreview.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .BuildDeFiRedeemTransactionRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .BuildDeFiRedeemTransactionRequestToken.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .BuildDeFiRedeemTransactionResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.BuildLpAddTransactionRequest + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .BuildLpAddTransactionRequestTokenListInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .BuildLpAddTransactionResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .BuildLpRemoveTransactionRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .BuildLpRemoveTransactionResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( new com.binance.connector.client.web3_wallet.rest.model .BuildSolanaSwapInstructionsResponse.CustomTypeAdapterFactory()); @@ -201,6 +485,99 @@ private static Class getClassByDiscriminator( gsonBuilder.registerTypeAdapterFactory( new com.binance.connector.client.web3_wallet.rest.model .BuildSwapTransactionResponseDataTx.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .CalculateLpAddPairedAmountsRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .CalculateLpAddPairedAmountsResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .CalculateLpAddPairedAmountsResponseData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.DefiCallDataItem + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.DefiInvestmentDto + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.DefiInvestmentInfoDto + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .DefiInvestmentInfoDtoAssetTokenListInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.DefiInvestmentTokenDto + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.DefiPreview + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .DefiPreviewBalanceChangeInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.DefiPreviewFeeAndContract + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .DefiPreviewFeeAndContractEstimatedNetworkFee.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .DefiPreviewFeeAndContractInteractWith.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.DefiPreviewHealthFactor + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.DefiPreviewWarningsInner + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .DefiProtocolDimensionScoresDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.DefiProtocolDto + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.DefiProtocolFaqDto + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.DefiProtocolFundRaisingDto + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.DefiProtocolInfoDto + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .DefiProtocolInfoDtoDimensionScores.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.DefiProtocolInfoDtoFaqInner + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .DefiProtocolInfoDtoFundRaisingInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .DefiProtocolInfoDtoSocialLinks.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.DefiProtocolInfoDtoTeamInner + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.DefiProtocolSocialLinksDto + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.DefiProtocolTeamMemberDto + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.DefiTokenItem + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.DefiTxResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.DefiTxResponseDataListInner + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.DefiTxResponsePreview + .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( new com.binance.connector.client.web3_wallet.rest.model .GetAddressPnLForSpecificTokenResponse.CustomTypeAdapterFactory()); @@ -282,6 +659,52 @@ private static Class getClassByDiscriminator( new com.binance.connector.client.web3_wallet.rest.model .GetAllTokenBalancesByAddressResponseDataInnerTokenAssetsInner .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .GetB402SupportedConfigurationsV1Request.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .GetB402SupportedConfigurationsV1Response.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .GetB402SupportedConfigurationsV1Response1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .GetB402SupportedConfigurationsV1Response1Data.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .GetB402SupportedConfigurationsV1Response1DataKindsInner + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .GetB402SupportedConfigurationsV1Response1DataKindsInnerExtra + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .GetB402SupportedConfigurationsV1Response2.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .GetB402SupportedConfigurationsV2Request.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .GetB402SupportedConfigurationsV2Response.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .GetB402SupportedConfigurationsV2Response1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .GetB402SupportedConfigurationsV2Response1Data.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .GetB402SupportedConfigurationsV2Response1DataKindsInner + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .GetB402SupportedConfigurationsV2Response1DataKindsInnerExtra + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .GetB402SupportedConfigurationsV2Response2.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( new com.binance.connector.client.web3_wallet.rest.model.GetBroadcastOrdersResponse .CustomTypeAdapterFactory()); @@ -294,6 +717,46 @@ private static Class getClassByDiscriminator( gsonBuilder.registerTypeAdapterFactory( new com.binance.connector.client.web3_wallet.rest.model.GetCandlesResponse .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.GetDeFiPositionsRequest + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.GetDeFiPositionsResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.GetDeFiPositionsResponseData + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .GetDeFiPositionsResponseDataAddressListInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .GetDeFiPositionsResponseDataAddressListInnerProtocolListInner + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInner + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPoolDetail + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInner + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionCollectionDetail + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInner + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInnerPositionDetail + .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( new com.binance.connector.client.web3_wallet.rest.model.GetDexTradeHistoryResponse .CustomTypeAdapterFactory()); @@ -369,6 +832,15 @@ private static Class getClassByDiscriminator( gsonBuilder.registerTypeAdapterFactory( new com.binance.connector.client.web3_wallet.rest.model .GetHotTokenListResponseDataItemsInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.GetInvestmentDetailRequest + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.GetInvestmentDetailResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .GetInvestmentDetailResponseData.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( new com.binance.connector.client.web3_wallet.rest.model.GetLatestBlockHeightResponse .CustomTypeAdapterFactory()); @@ -402,6 +874,21 @@ private static Class getClassByDiscriminator( gsonBuilder.registerTypeAdapterFactory( new com.binance.connector.client.web3_wallet.rest.model .GetPortfolioSupportedChainsResponseDataInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.GetProtocolDetailRequest + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.GetProtocolDetailResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .GetProtocolDetailResponseData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .GetProtocolDetailResponseDataDimensionScores.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .GetProtocolDetailResponseDataSocialLinks.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( new com.binance.connector.client.web3_wallet.rest.model.GetRfqOrderStatusResponse .CustomTypeAdapterFactory()); @@ -620,6 +1107,93 @@ private static Class getClassByDiscriminator( gsonBuilder.registerTypeAdapterFactory( new com.binance.connector.client.web3_wallet.rest.model .GetWalletSupportedChainsResponseDataInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .GetWebSocketAuthTokenResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .GetWebSocketAuthTokenResponseData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.InvestmentPageResult + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .InvestmentPageResultListInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.ListDeFiInvestmentsRequest + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.ListDeFiInvestmentsResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .ListDeFiInvestmentsResponseData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.ListDeFiProtocolsRequest + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.ListDeFiProtocolsResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .ListDeFiProtocolsResponseData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.LpAddCalculateResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.PoolDetailResp + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.PoolResp + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.PoolRespPoolDetail + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .PoolRespPositionCollectionListInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.PositionCollectionResp + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .PositionCollectionRespPositionCollectionDetail.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .PositionCollectionRespPositionListInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.PositionDetailResp + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.PositionListResp + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .PositionListRespAddressListInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.PositionResp + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.PositionRespPositionDetail + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.PositionRespTokenList + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .PositionRespTokenListSupplyInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.ProtocolPageResult + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.ProtocolPageResultListInner + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.ProtocolResp + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.ProtocolRespPoolListInner + .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( new com.binance.connector.client.web3_wallet.rest.model .QuoteAndBuildSwapTransactionResponse.CustomTypeAdapterFactory()); @@ -644,6 +1218,36 @@ private static Class getClassByDiscriminator( gsonBuilder.registerTypeAdapterFactory( new com.binance.connector.client.web3_wallet.rest.model.SearchTokenResponseDataInner .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.SettleB402PaymentV1Request + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.SettleB402PaymentV1Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.SettleB402PaymentV1Response1 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .SettleB402PaymentV1Response1Data.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.SettleB402PaymentV1Response2 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.SettleB402PaymentV2Request + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.SettleB402PaymentV2Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.SettleB402PaymentV2Response1 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .SettleB402PaymentV2Response1Data.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.SettleB402PaymentV2Response2 + .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( new com.binance.connector.client.web3_wallet.rest.model.SimulateTransactionsRequest .CustomTypeAdapterFactory()); @@ -685,9 +1289,95 @@ private static Class getClassByDiscriminator( gsonBuilder.registerTypeAdapterFactory( new com.binance.connector.client.web3_wallet.rest.model.TokenBasicInfo .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.TokenResp + .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( new com.binance.connector.client.web3_wallet.rest.model.TokenTagInformation .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.VerifyB402PaymentV1Request + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .VerifyB402PaymentV1RequestBody.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .VerifyB402PaymentV1RequestBodyPaymentPayload.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .VerifyB402PaymentV1RequestBodyPaymentRequirements + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .VerifyB402PaymentV1RequestBodyPaymentRequirementsExtra + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.VerifyB402PaymentV1Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.VerifyB402PaymentV1Response1 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.VerifyB402PaymentV1Response2 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.VerifyB402PaymentV2Request + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .VerifyB402PaymentV2RequestBody.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .VerifyB402PaymentV2RequestBodyPaymentPayload.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .VerifyB402PaymentV2RequestBodyPaymentPayloadAccepted + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .VerifyB402PaymentV2RequestBodyPaymentPayloadExtensions + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .VerifyB402PaymentV2RequestBodyPaymentPayloadExtensionsBazaar + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .VerifyB402PaymentV2RequestBodyPaymentPayloadPayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadAuthorization + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2Authorization + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationPermitted + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationWitness + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .VerifyB402PaymentV2RequestBodyPaymentPayloadResource + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.VerifyB402PaymentV2Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.VerifyB402PaymentV2Response1 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model + .VerifyB402PaymentV2Response1Data.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.web3_wallet.rest.model.VerifyB402PaymentV2Response2 + .CustomTypeAdapterFactory()); gson = gsonBuilder.create(); } diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/api/AddressPortfolioApi.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/api/AddressPortfolioApi.java index 49b15e0..0ba346d 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/api/AddressPortfolioApi.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/api/AddressPortfolioApi.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * @@ -53,7 +53,7 @@ public class AddressPortfolioApi { private static final String USER_AGENT = String.format( - "binance-web3-wallet/4.1.0 (Java/%s; %s; %s)", + "binance-web3-wallet/4.2.0 (Java/%s; %s; %s)", SystemUtil.getJavaVersion(), SystemUtil.getOs(), SystemUtil.getArch()); private static final boolean HAS_TIME_UNIT = false; diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/api/B402PaymentsApi.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/api/B402PaymentsApi.java new file mode 100644 index 0000000..8633886 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/api/B402PaymentsApi.java @@ -0,0 +1,836 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.api; + +import com.binance.connector.client.common.ApiException; +import com.binance.connector.client.common.ApiResponse; +import com.binance.connector.client.common.JSON; +import com.binance.connector.client.common.Pair; +import com.binance.connector.client.common.SystemUtil; +import com.binance.connector.client.common.configuration.ClientConfiguration; +import com.binance.connector.client.common.exception.ConstraintViolationException; +import com.binance.connector.client.web3.common.ApiClient; +import com.binance.connector.client.web3_wallet.rest.model.GetB402SupportedConfigurationsV1Request; +import com.binance.connector.client.web3_wallet.rest.model.GetB402SupportedConfigurationsV1Response; +import com.binance.connector.client.web3_wallet.rest.model.GetB402SupportedConfigurationsV2Request; +import com.binance.connector.client.web3_wallet.rest.model.GetB402SupportedConfigurationsV2Response; +import com.binance.connector.client.web3_wallet.rest.model.SettleB402PaymentV1Request; +import com.binance.connector.client.web3_wallet.rest.model.SettleB402PaymentV1Response; +import com.binance.connector.client.web3_wallet.rest.model.SettleB402PaymentV2Request; +import com.binance.connector.client.web3_wallet.rest.model.SettleB402PaymentV2Response; +import com.binance.connector.client.web3_wallet.rest.model.VerifyB402PaymentV1Request; +import com.binance.connector.client.web3_wallet.rest.model.VerifyB402PaymentV1Response; +import com.binance.connector.client.web3_wallet.rest.model.VerifyB402PaymentV2Request; +import com.binance.connector.client.web3_wallet.rest.model.VerifyB402PaymentV2Response; +import com.google.gson.reflect.TypeToken; +import jakarta.validation.ConstraintViolation; +import jakarta.validation.Valid; +import jakarta.validation.Validation; +import jakarta.validation.Validator; +import jakarta.validation.constraints.*; +import jakarta.validation.executable.ExecutableValidator; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator; + +public class B402PaymentsApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + private static final String USER_AGENT = + String.format( + "binance-web3-wallet/4.2.0 (Java/%s; %s; %s)", + SystemUtil.getJavaVersion(), SystemUtil.getOs(), SystemUtil.getArch()); + private static final boolean HAS_TIME_UNIT = false; + + public B402PaymentsApi(ClientConfiguration clientConfiguration) { + this(new ApiClient(clientConfiguration)); + } + + public B402PaymentsApi(ApiClient apiClient) { + apiClient.setUserAgent(USER_AGENT); + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + private okhttp3.Call getB402SupportedConfigurationsV1Call( + GetB402SupportedConfigurationsV1Request getB402SupportedConfigurationsV1Request, + Long recvWindow, + String nonce) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/api/v1/b402/supported"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (getB402SupportedConfigurationsV1Request.getBody() != null) { + localVarFormParams.put("body", getB402SupportedConfigurationsV1Request.getBody()); + } + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {"application/x-www-form-urlencoded"}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (!localVarFormParams.isEmpty() && localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (recvWindow != null) { + localVarHeaderParams.put("recvWindow", localVarApiClient.parameterToString(recvWindow)); + } + + if (nonce != null) { + localVarHeaderParams.put("nonce", localVarApiClient.parameterToString(nonce)); + } + + Set localVarAuthNames = new HashSet<>(); + localVarAuthNames.add("binanceWeb3Signature"); + if (HAS_TIME_UNIT) { + localVarAuthNames.add("timeUnit"); + } + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getB402SupportedConfigurationsV1ValidateBeforeCall( + GetB402SupportedConfigurationsV1Request getB402SupportedConfigurationsV1Request, + Long recvWindow, + String nonce) + throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + ExecutableValidator executableValidator = validator.forExecutables(); + + Object[] parameterValues = {getB402SupportedConfigurationsV1Request, recvWindow, nonce}; + Method method = + this.getClass() + .getMethod( + "getB402SupportedConfigurationsV1", + GetB402SupportedConfigurationsV1Request.class, + Long.class, + String.class); + Set> violations = + executableValidator.validateParameters(this, method, parameterValues); + + if (violations.size() == 0) { + return getB402SupportedConfigurationsV1Call( + getB402SupportedConfigurationsV1Request, recvWindow, nonce); + } else { + throw new ConstraintViolationException((Set) violations); + } + } catch (NoSuchMethodException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } catch (SecurityException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } + } + + public ApiResponse getB402SupportedConfigurationsV1( + @Valid @NotNull + GetB402SupportedConfigurationsV1Request getB402SupportedConfigurationsV1Request, + Long recvWindow, + String nonce) + throws ApiException { + okhttp3.Call localVarCall = + getB402SupportedConfigurationsV1ValidateBeforeCall( + getB402SupportedConfigurationsV1Request, recvWindow, nonce); + java.lang.reflect.Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getB402SupportedConfigurationsV2Call( + GetB402SupportedConfigurationsV2Request getB402SupportedConfigurationsV2Request, + Long recvWindow, + String nonce) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/api/v2/b402/supported"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (getB402SupportedConfigurationsV2Request.getBody() != null) { + localVarFormParams.put("body", getB402SupportedConfigurationsV2Request.getBody()); + } + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {"application/x-www-form-urlencoded"}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (!localVarFormParams.isEmpty() && localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (recvWindow != null) { + localVarHeaderParams.put("recvWindow", localVarApiClient.parameterToString(recvWindow)); + } + + if (nonce != null) { + localVarHeaderParams.put("nonce", localVarApiClient.parameterToString(nonce)); + } + + Set localVarAuthNames = new HashSet<>(); + localVarAuthNames.add("binanceWeb3Signature"); + if (HAS_TIME_UNIT) { + localVarAuthNames.add("timeUnit"); + } + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getB402SupportedConfigurationsV2ValidateBeforeCall( + GetB402SupportedConfigurationsV2Request getB402SupportedConfigurationsV2Request, + Long recvWindow, + String nonce) + throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + ExecutableValidator executableValidator = validator.forExecutables(); + + Object[] parameterValues = {getB402SupportedConfigurationsV2Request, recvWindow, nonce}; + Method method = + this.getClass() + .getMethod( + "getB402SupportedConfigurationsV2", + GetB402SupportedConfigurationsV2Request.class, + Long.class, + String.class); + Set> violations = + executableValidator.validateParameters(this, method, parameterValues); + + if (violations.size() == 0) { + return getB402SupportedConfigurationsV2Call( + getB402SupportedConfigurationsV2Request, recvWindow, nonce); + } else { + throw new ConstraintViolationException((Set) violations); + } + } catch (NoSuchMethodException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } catch (SecurityException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } + } + + public ApiResponse getB402SupportedConfigurationsV2( + @Valid @NotNull + GetB402SupportedConfigurationsV2Request getB402SupportedConfigurationsV2Request, + Long recvWindow, + String nonce) + throws ApiException { + okhttp3.Call localVarCall = + getB402SupportedConfigurationsV2ValidateBeforeCall( + getB402SupportedConfigurationsV2Request, recvWindow, nonce); + java.lang.reflect.Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call settleB402PaymentV1Call( + SettleB402PaymentV1Request settleB402PaymentV1Request, Long recvWindow, String nonce) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/api/v1/b402/settle"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (settleB402PaymentV1Request.getBody() != null) { + String json = JSON.getGson().toJson(settleB402PaymentV1Request.getBody()); + localVarFormParams.put("body", json); + } + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {"application/x-www-form-urlencoded"}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (!localVarFormParams.isEmpty() && localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (recvWindow != null) { + localVarHeaderParams.put("recvWindow", localVarApiClient.parameterToString(recvWindow)); + } + + if (nonce != null) { + localVarHeaderParams.put("nonce", localVarApiClient.parameterToString(nonce)); + } + + Set localVarAuthNames = new HashSet<>(); + localVarAuthNames.add("binanceWeb3Signature"); + if (HAS_TIME_UNIT) { + localVarAuthNames.add("timeUnit"); + } + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call settleB402PaymentV1ValidateBeforeCall( + SettleB402PaymentV1Request settleB402PaymentV1Request, Long recvWindow, String nonce) + throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + ExecutableValidator executableValidator = validator.forExecutables(); + + Object[] parameterValues = {settleB402PaymentV1Request, recvWindow, nonce}; + Method method = + this.getClass() + .getMethod( + "settleB402PaymentV1", + SettleB402PaymentV1Request.class, + Long.class, + String.class); + Set> violations = + executableValidator.validateParameters(this, method, parameterValues); + + if (violations.size() == 0) { + return settleB402PaymentV1Call(settleB402PaymentV1Request, recvWindow, nonce); + } else { + throw new ConstraintViolationException((Set) violations); + } + } catch (NoSuchMethodException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } catch (SecurityException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } + } + + public ApiResponse settleB402PaymentV1( + @Valid @NotNull SettleB402PaymentV1Request settleB402PaymentV1Request, + Long recvWindow, + String nonce) + throws ApiException { + okhttp3.Call localVarCall = + settleB402PaymentV1ValidateBeforeCall( + settleB402PaymentV1Request, recvWindow, nonce); + java.lang.reflect.Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call settleB402PaymentV2Call( + SettleB402PaymentV2Request settleB402PaymentV2Request, Long recvWindow, String nonce) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/api/v2/b402/settle"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (settleB402PaymentV2Request.getBody() != null) { + String json = JSON.getGson().toJson(settleB402PaymentV2Request.getBody()); + localVarFormParams.put("body", json); + } + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {"application/x-www-form-urlencoded"}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (!localVarFormParams.isEmpty() && localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (recvWindow != null) { + localVarHeaderParams.put("recvWindow", localVarApiClient.parameterToString(recvWindow)); + } + + if (nonce != null) { + localVarHeaderParams.put("nonce", localVarApiClient.parameterToString(nonce)); + } + + Set localVarAuthNames = new HashSet<>(); + localVarAuthNames.add("binanceWeb3Signature"); + if (HAS_TIME_UNIT) { + localVarAuthNames.add("timeUnit"); + } + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call settleB402PaymentV2ValidateBeforeCall( + SettleB402PaymentV2Request settleB402PaymentV2Request, Long recvWindow, String nonce) + throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + ExecutableValidator executableValidator = validator.forExecutables(); + + Object[] parameterValues = {settleB402PaymentV2Request, recvWindow, nonce}; + Method method = + this.getClass() + .getMethod( + "settleB402PaymentV2", + SettleB402PaymentV2Request.class, + Long.class, + String.class); + Set> violations = + executableValidator.validateParameters(this, method, parameterValues); + + if (violations.size() == 0) { + return settleB402PaymentV2Call(settleB402PaymentV2Request, recvWindow, nonce); + } else { + throw new ConstraintViolationException((Set) violations); + } + } catch (NoSuchMethodException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } catch (SecurityException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } + } + + public ApiResponse settleB402PaymentV2( + @Valid @NotNull SettleB402PaymentV2Request settleB402PaymentV2Request, + Long recvWindow, + String nonce) + throws ApiException { + okhttp3.Call localVarCall = + settleB402PaymentV2ValidateBeforeCall( + settleB402PaymentV2Request, recvWindow, nonce); + java.lang.reflect.Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call verifyB402PaymentV1Call( + VerifyB402PaymentV1Request verifyB402PaymentV1Request, Long recvWindow, String nonce) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/api/v1/b402/verify"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (verifyB402PaymentV1Request.getBody() != null) { + String json = JSON.getGson().toJson(verifyB402PaymentV1Request.getBody()); + localVarFormParams.put("body", json); + } + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {"application/x-www-form-urlencoded"}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (!localVarFormParams.isEmpty() && localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (recvWindow != null) { + localVarHeaderParams.put("recvWindow", localVarApiClient.parameterToString(recvWindow)); + } + + if (nonce != null) { + localVarHeaderParams.put("nonce", localVarApiClient.parameterToString(nonce)); + } + + Set localVarAuthNames = new HashSet<>(); + localVarAuthNames.add("binanceWeb3Signature"); + if (HAS_TIME_UNIT) { + localVarAuthNames.add("timeUnit"); + } + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call verifyB402PaymentV1ValidateBeforeCall( + VerifyB402PaymentV1Request verifyB402PaymentV1Request, Long recvWindow, String nonce) + throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + ExecutableValidator executableValidator = validator.forExecutables(); + + Object[] parameterValues = {verifyB402PaymentV1Request, recvWindow, nonce}; + Method method = + this.getClass() + .getMethod( + "verifyB402PaymentV1", + VerifyB402PaymentV1Request.class, + Long.class, + String.class); + Set> violations = + executableValidator.validateParameters(this, method, parameterValues); + + if (violations.size() == 0) { + return verifyB402PaymentV1Call(verifyB402PaymentV1Request, recvWindow, nonce); + } else { + throw new ConstraintViolationException((Set) violations); + } + } catch (NoSuchMethodException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } catch (SecurityException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } + } + + public ApiResponse verifyB402PaymentV1( + @Valid @NotNull VerifyB402PaymentV1Request verifyB402PaymentV1Request, + Long recvWindow, + String nonce) + throws ApiException { + okhttp3.Call localVarCall = + verifyB402PaymentV1ValidateBeforeCall( + verifyB402PaymentV1Request, recvWindow, nonce); + java.lang.reflect.Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call verifyB402PaymentV2Call( + VerifyB402PaymentV2Request verifyB402PaymentV2Request, Long recvWindow, String nonce) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/api/v2/b402/verify"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (verifyB402PaymentV2Request.getBody() != null) { + String json = JSON.getGson().toJson(verifyB402PaymentV2Request.getBody()); + localVarFormParams.put("body", json); + } + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {"application/x-www-form-urlencoded"}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (!localVarFormParams.isEmpty() && localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (recvWindow != null) { + localVarHeaderParams.put("recvWindow", localVarApiClient.parameterToString(recvWindow)); + } + + if (nonce != null) { + localVarHeaderParams.put("nonce", localVarApiClient.parameterToString(nonce)); + } + + Set localVarAuthNames = new HashSet<>(); + localVarAuthNames.add("binanceWeb3Signature"); + if (HAS_TIME_UNIT) { + localVarAuthNames.add("timeUnit"); + } + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call verifyB402PaymentV2ValidateBeforeCall( + VerifyB402PaymentV2Request verifyB402PaymentV2Request, Long recvWindow, String nonce) + throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + ExecutableValidator executableValidator = validator.forExecutables(); + + Object[] parameterValues = {verifyB402PaymentV2Request, recvWindow, nonce}; + Method method = + this.getClass() + .getMethod( + "verifyB402PaymentV2", + VerifyB402PaymentV2Request.class, + Long.class, + String.class); + Set> violations = + executableValidator.validateParameters(this, method, parameterValues); + + if (violations.size() == 0) { + return verifyB402PaymentV2Call(verifyB402PaymentV2Request, recvWindow, nonce); + } else { + throw new ConstraintViolationException((Set) violations); + } + } catch (NoSuchMethodException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } catch (SecurityException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } + } + + public ApiResponse verifyB402PaymentV2( + @Valid @NotNull VerifyB402PaymentV2Request verifyB402PaymentV2Request, + Long recvWindow, + String nonce) + throws ApiException { + okhttp3.Call localVarCall = + verifyB402PaymentV2ValidateBeforeCall( + verifyB402PaymentV2Request, recvWindow, nonce); + java.lang.reflect.Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/api/DefiDataApi.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/api/DefiDataApi.java new file mode 100644 index 0000000..7859348 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/api/DefiDataApi.java @@ -0,0 +1,808 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.api; + +import com.binance.connector.client.common.ApiException; +import com.binance.connector.client.common.ApiResponse; +import com.binance.connector.client.common.Pair; +import com.binance.connector.client.common.SystemUtil; +import com.binance.connector.client.common.configuration.ClientConfiguration; +import com.binance.connector.client.common.exception.ConstraintViolationException; +import com.binance.connector.client.web3.common.ApiClient; +import com.binance.connector.client.web3_wallet.rest.model.GetDeFiPositionsRequest; +import com.binance.connector.client.web3_wallet.rest.model.GetDeFiPositionsResponse; +import com.binance.connector.client.web3_wallet.rest.model.GetInvestmentDetailRequest; +import com.binance.connector.client.web3_wallet.rest.model.GetInvestmentDetailResponse; +import com.binance.connector.client.web3_wallet.rest.model.GetProtocolDetailRequest; +import com.binance.connector.client.web3_wallet.rest.model.GetProtocolDetailResponse; +import com.binance.connector.client.web3_wallet.rest.model.ListDeFiInvestmentsRequest; +import com.binance.connector.client.web3_wallet.rest.model.ListDeFiInvestmentsResponse; +import com.binance.connector.client.web3_wallet.rest.model.ListDeFiProtocolsRequest; +import com.binance.connector.client.web3_wallet.rest.model.ListDeFiProtocolsResponse; +import com.google.gson.reflect.TypeToken; +import jakarta.validation.ConstraintViolation; +import jakarta.validation.Valid; +import jakarta.validation.Validation; +import jakarta.validation.Validator; +import jakarta.validation.constraints.*; +import jakarta.validation.executable.ExecutableValidator; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator; + +public class DefiDataApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + private static final String USER_AGENT = + String.format( + "binance-web3-wallet/4.2.0 (Java/%s; %s; %s)", + SystemUtil.getJavaVersion(), SystemUtil.getOs(), SystemUtil.getArch()); + private static final boolean HAS_TIME_UNIT = false; + + public DefiDataApi(ClientConfiguration clientConfiguration) { + this(new ApiClient(clientConfiguration)); + } + + public DefiDataApi(ApiClient apiClient) { + apiClient.setUserAgent(USER_AGENT); + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + private okhttp3.Call getDeFiPositionsCall( + GetDeFiPositionsRequest getDeFiPositionsRequest, Long recvWindow, String nonce) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/api/v1/defi/data/position/list"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (getDeFiPositionsRequest.getAddresses() != null) { + localVarFormParams.put("addresses", getDeFiPositionsRequest.getAddresses()); + } + + if (getDeFiPositionsRequest.getBinanceChainIds() != null) { + localVarFormParams.put("binanceChainIds", getDeFiPositionsRequest.getBinanceChainIds()); + } + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {"application/x-www-form-urlencoded"}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (!localVarFormParams.isEmpty() && localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (recvWindow != null) { + localVarHeaderParams.put("recvWindow", localVarApiClient.parameterToString(recvWindow)); + } + + if (nonce != null) { + localVarHeaderParams.put("nonce", localVarApiClient.parameterToString(nonce)); + } + + Set localVarAuthNames = new HashSet<>(); + localVarAuthNames.add("binanceWeb3Signature"); + if (HAS_TIME_UNIT) { + localVarAuthNames.add("timeUnit"); + } + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getDeFiPositionsValidateBeforeCall( + GetDeFiPositionsRequest getDeFiPositionsRequest, Long recvWindow, String nonce) + throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + ExecutableValidator executableValidator = validator.forExecutables(); + + Object[] parameterValues = {getDeFiPositionsRequest, recvWindow, nonce}; + Method method = + this.getClass() + .getMethod( + "getDeFiPositions", + GetDeFiPositionsRequest.class, + Long.class, + String.class); + Set> violations = + executableValidator.validateParameters(this, method, parameterValues); + + if (violations.size() == 0) { + return getDeFiPositionsCall(getDeFiPositionsRequest, recvWindow, nonce); + } else { + throw new ConstraintViolationException((Set) violations); + } + } catch (NoSuchMethodException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } catch (SecurityException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } + } + + public ApiResponse getDeFiPositions( + @Valid @NotNull GetDeFiPositionsRequest getDeFiPositionsRequest, + Long recvWindow, + String nonce) + throws ApiException { + okhttp3.Call localVarCall = + getDeFiPositionsValidateBeforeCall(getDeFiPositionsRequest, recvWindow, nonce); + java.lang.reflect.Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getInvestmentDetailCall( + GetInvestmentDetailRequest getInvestmentDetailRequest, Long recvWindow, String nonce) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/api/v1/defi/data/investment/detail"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (getInvestmentDetailRequest.getInvestmentId() != null) { + localVarFormParams.put("investmentId", getInvestmentDetailRequest.getInvestmentId()); + } + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {"application/x-www-form-urlencoded"}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (!localVarFormParams.isEmpty() && localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (recvWindow != null) { + localVarHeaderParams.put("recvWindow", localVarApiClient.parameterToString(recvWindow)); + } + + if (nonce != null) { + localVarHeaderParams.put("nonce", localVarApiClient.parameterToString(nonce)); + } + + Set localVarAuthNames = new HashSet<>(); + localVarAuthNames.add("binanceWeb3Signature"); + if (HAS_TIME_UNIT) { + localVarAuthNames.add("timeUnit"); + } + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getInvestmentDetailValidateBeforeCall( + GetInvestmentDetailRequest getInvestmentDetailRequest, Long recvWindow, String nonce) + throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + ExecutableValidator executableValidator = validator.forExecutables(); + + Object[] parameterValues = {getInvestmentDetailRequest, recvWindow, nonce}; + Method method = + this.getClass() + .getMethod( + "getInvestmentDetail", + GetInvestmentDetailRequest.class, + Long.class, + String.class); + Set> violations = + executableValidator.validateParameters(this, method, parameterValues); + + if (violations.size() == 0) { + return getInvestmentDetailCall(getInvestmentDetailRequest, recvWindow, nonce); + } else { + throw new ConstraintViolationException((Set) violations); + } + } catch (NoSuchMethodException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } catch (SecurityException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } + } + + public ApiResponse getInvestmentDetail( + @Valid @NotNull GetInvestmentDetailRequest getInvestmentDetailRequest, + Long recvWindow, + String nonce) + throws ApiException { + okhttp3.Call localVarCall = + getInvestmentDetailValidateBeforeCall( + getInvestmentDetailRequest, recvWindow, nonce); + java.lang.reflect.Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getProtocolDetailCall( + GetProtocolDetailRequest getProtocolDetailRequest, Long recvWindow, String nonce) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/api/v1/defi/data/protocol/detail"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (getProtocolDetailRequest.getDefiProtocolId() != null) { + localVarFormParams.put("defiProtocolId", getProtocolDetailRequest.getDefiProtocolId()); + } + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {"application/x-www-form-urlencoded"}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (!localVarFormParams.isEmpty() && localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (recvWindow != null) { + localVarHeaderParams.put("recvWindow", localVarApiClient.parameterToString(recvWindow)); + } + + if (nonce != null) { + localVarHeaderParams.put("nonce", localVarApiClient.parameterToString(nonce)); + } + + Set localVarAuthNames = new HashSet<>(); + localVarAuthNames.add("binanceWeb3Signature"); + if (HAS_TIME_UNIT) { + localVarAuthNames.add("timeUnit"); + } + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getProtocolDetailValidateBeforeCall( + GetProtocolDetailRequest getProtocolDetailRequest, Long recvWindow, String nonce) + throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + ExecutableValidator executableValidator = validator.forExecutables(); + + Object[] parameterValues = {getProtocolDetailRequest, recvWindow, nonce}; + Method method = + this.getClass() + .getMethod( + "getProtocolDetail", + GetProtocolDetailRequest.class, + Long.class, + String.class); + Set> violations = + executableValidator.validateParameters(this, method, parameterValues); + + if (violations.size() == 0) { + return getProtocolDetailCall(getProtocolDetailRequest, recvWindow, nonce); + } else { + throw new ConstraintViolationException((Set) violations); + } + } catch (NoSuchMethodException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } catch (SecurityException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } + } + + public ApiResponse getProtocolDetail( + @Valid @NotNull GetProtocolDetailRequest getProtocolDetailRequest, + Long recvWindow, + String nonce) + throws ApiException { + okhttp3.Call localVarCall = + getProtocolDetailValidateBeforeCall(getProtocolDetailRequest, recvWindow, nonce); + java.lang.reflect.Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call listDeFiInvestmentsCall( + ListDeFiInvestmentsRequest listDeFiInvestmentsRequest, Long recvWindow, String nonce) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/api/v1/defi/data/investment/list"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (listDeFiInvestmentsRequest.getInvestType() != null) { + localVarFormParams.put("investType", listDeFiInvestmentsRequest.getInvestType()); + } + + if (listDeFiInvestmentsRequest.getDefiProtocolId() != null) { + localVarFormParams.put( + "defiProtocolId", listDeFiInvestmentsRequest.getDefiProtocolId()); + } + + if (listDeFiInvestmentsRequest.getTokenAddressList() != null) { + localVarFormParams.put( + "tokenAddressList", listDeFiInvestmentsRequest.getTokenAddressList()); + } + + if (listDeFiInvestmentsRequest.getBinanceChainId() != null) { + localVarFormParams.put( + "binanceChainId", listDeFiInvestmentsRequest.getBinanceChainId()); + } + + if (listDeFiInvestmentsRequest.getSortField() != null) { + localVarFormParams.put("sortField", listDeFiInvestmentsRequest.getSortField()); + } + + if (listDeFiInvestmentsRequest.getSortDirection() != null) { + localVarFormParams.put("sortDirection", listDeFiInvestmentsRequest.getSortDirection()); + } + + if (listDeFiInvestmentsRequest.getPage() != null) { + localVarFormParams.put("page", listDeFiInvestmentsRequest.getPage()); + } + + if (listDeFiInvestmentsRequest.getSize() != null) { + localVarFormParams.put("size", listDeFiInvestmentsRequest.getSize()); + } + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {"application/x-www-form-urlencoded"}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (!localVarFormParams.isEmpty() && localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (recvWindow != null) { + localVarHeaderParams.put("recvWindow", localVarApiClient.parameterToString(recvWindow)); + } + + if (nonce != null) { + localVarHeaderParams.put("nonce", localVarApiClient.parameterToString(nonce)); + } + + Set localVarAuthNames = new HashSet<>(); + localVarAuthNames.add("binanceWeb3Signature"); + if (HAS_TIME_UNIT) { + localVarAuthNames.add("timeUnit"); + } + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call listDeFiInvestmentsValidateBeforeCall( + ListDeFiInvestmentsRequest listDeFiInvestmentsRequest, Long recvWindow, String nonce) + throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + ExecutableValidator executableValidator = validator.forExecutables(); + + Object[] parameterValues = {listDeFiInvestmentsRequest, recvWindow, nonce}; + Method method = + this.getClass() + .getMethod( + "listDeFiInvestments", + ListDeFiInvestmentsRequest.class, + Long.class, + String.class); + Set> violations = + executableValidator.validateParameters(this, method, parameterValues); + + if (violations.size() == 0) { + return listDeFiInvestmentsCall(listDeFiInvestmentsRequest, recvWindow, nonce); + } else { + throw new ConstraintViolationException((Set) violations); + } + } catch (NoSuchMethodException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } catch (SecurityException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } + } + + public ApiResponse listDeFiInvestments( + @Valid @NotNull ListDeFiInvestmentsRequest listDeFiInvestmentsRequest, + Long recvWindow, + String nonce) + throws ApiException { + okhttp3.Call localVarCall = + listDeFiInvestmentsValidateBeforeCall( + listDeFiInvestmentsRequest, recvWindow, nonce); + java.lang.reflect.Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call listDeFiProtocolsCall( + Long recvWindow, String nonce, com.binance.connector.client.web3_wallet.rest.model.ListDeFiProtocolsRequest listDeFiProtocolsRequest) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/api/v1/defi/data/protocol/list"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (listDeFiProtocolsRequest.getBinanceChainId() != null) { + localVarFormParams.put("binanceChainId", listDeFiProtocolsRequest.getBinanceChainId()); + } + + if (listDeFiProtocolsRequest.getInvestType() != null) { + localVarFormParams.put("investType", listDeFiProtocolsRequest.getInvestType()); + } + + if (listDeFiProtocolsRequest.getSortField() != null) { + localVarFormParams.put("sortField", listDeFiProtocolsRequest.getSortField()); + } + + if (listDeFiProtocolsRequest.getSortDirection() != null) { + localVarFormParams.put("sortDirection", listDeFiProtocolsRequest.getSortDirection()); + } + + if (listDeFiProtocolsRequest.getPage() != null) { + localVarFormParams.put("page", listDeFiProtocolsRequest.getPage()); + } + + if (listDeFiProtocolsRequest.getSize() != null) { + localVarFormParams.put("size", listDeFiProtocolsRequest.getSize()); + } + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {"application/x-www-form-urlencoded"}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (!localVarFormParams.isEmpty() && localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (recvWindow != null) { + localVarHeaderParams.put("recvWindow", localVarApiClient.parameterToString(recvWindow)); + } + + if (nonce != null) { + localVarHeaderParams.put("nonce", localVarApiClient.parameterToString(nonce)); + } + + Set localVarAuthNames = new HashSet<>(); + localVarAuthNames.add("binanceWeb3Signature"); + if (HAS_TIME_UNIT) { + localVarAuthNames.add("timeUnit"); + } + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call listDeFiProtocolsValidateBeforeCall( + Long recvWindow, String nonce, com.binance.connector.client.web3_wallet.rest.model.ListDeFiProtocolsRequest listDeFiProtocolsRequest) + throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + ExecutableValidator executableValidator = validator.forExecutables(); + + Object[] parameterValues = {recvWindow, nonce, listDeFiProtocolsRequest}; + Method method = + this.getClass() + .getMethod( + "listDeFiProtocols", + Long.class, + String.class, + ListDeFiProtocolsRequest.class); + Set> violations = + executableValidator.validateParameters(this, method, parameterValues); + + if (violations.size() == 0) { + return listDeFiProtocolsCall(recvWindow, nonce, listDeFiProtocolsRequest); + } else { + throw new ConstraintViolationException((Set) violations); + } + } catch (NoSuchMethodException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } catch (SecurityException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } + } + + public ApiResponse listDeFiProtocols( + Long recvWindow, String nonce, @Valid com.binance.connector.client.web3_wallet.rest.model.ListDeFiProtocolsRequest listDeFiProtocolsRequest) + throws ApiException { + okhttp3.Call localVarCall = + listDeFiProtocolsValidateBeforeCall(recvWindow, nonce, listDeFiProtocolsRequest); + java.lang.reflect.Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + public ApiResponse listDeFiProtocols( + ListDeFiProtocolsRequest request) { + return listDeFiProtocols( + request.getRecvWindow(), request.getNonce(), request.getListDeFiProtocolsRequest()); + } + + public static class ListDeFiProtocolsRequest { + private Long recvWindow; + private String nonce; + private com.binance.connector.client.web3_wallet.rest.model.ListDeFiProtocolsRequest listDeFiProtocolsRequest; + + public Long getRecvWindow() { + return recvWindow; + } + + public String getNonce() { + return nonce; + } + + public com.binance.connector.client.web3_wallet.rest.model.ListDeFiProtocolsRequest getListDeFiProtocolsRequest() { + return listDeFiProtocolsRequest; + } + + public ListDeFiProtocolsRequest() {} + + /** + * Set recvWindow + * + * @param recvWindow Allowed time deviation in milliseconds (default: 5000, max: 60000). + * (optional) + * @return ListDeFiProtocolsRequest + */ + public ListDeFiProtocolsRequest recvWindow(Long recvWindow) { + this.recvWindow = recvWindow; + return this; + } + + /** + * Set nonce + * + * @param nonce Unique request identifier for anti-replay; falls back to X-OC-SIGN if + * omitted. (optional) + * @return ListDeFiProtocolsRequest + */ + public ListDeFiProtocolsRequest nonce(String nonce) { + this.nonce = nonce; + return this; + } + + /** + * Set listDeFiProtocolsRequest + * + * @param listDeFiProtocolsRequest (optional) + * @return ListDeFiProtocolsRequest + */ + public ListDeFiProtocolsRequest listDeFiProtocolsRequest( + com.binance.connector.client.web3_wallet.rest.model.ListDeFiProtocolsRequest listDeFiProtocolsRequest) { + this.listDeFiProtocolsRequest = listDeFiProtocolsRequest; + return this; + } + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/api/DefiTransactionApi.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/api/DefiTransactionApi.java new file mode 100644 index 0000000..7d0e960 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/api/DefiTransactionApi.java @@ -0,0 +1,1004 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.api; + +import com.binance.connector.client.common.ApiException; +import com.binance.connector.client.common.ApiResponse; +import com.binance.connector.client.common.JSON; +import com.binance.connector.client.common.Pair; +import com.binance.connector.client.common.SystemUtil; +import com.binance.connector.client.common.configuration.ClientConfiguration; +import com.binance.connector.client.common.exception.ConstraintViolationException; +import com.binance.connector.client.web3.common.ApiClient; +import com.binance.connector.client.web3_wallet.rest.model.BuildDeFiClaimTransactionRequest; +import com.binance.connector.client.web3_wallet.rest.model.BuildDeFiClaimTransactionResponse; +import com.binance.connector.client.web3_wallet.rest.model.BuildDeFiDepositTransactionRequest; +import com.binance.connector.client.web3_wallet.rest.model.BuildDeFiDepositTransactionResponse; +import com.binance.connector.client.web3_wallet.rest.model.BuildDeFiRedeemTransactionRequest; +import com.binance.connector.client.web3_wallet.rest.model.BuildDeFiRedeemTransactionResponse; +import com.binance.connector.client.web3_wallet.rest.model.BuildLpAddTransactionRequest; +import com.binance.connector.client.web3_wallet.rest.model.BuildLpAddTransactionResponse; +import com.binance.connector.client.web3_wallet.rest.model.BuildLpRemoveTransactionRequest; +import com.binance.connector.client.web3_wallet.rest.model.BuildLpRemoveTransactionResponse; +import com.binance.connector.client.web3_wallet.rest.model.CalculateLpAddPairedAmountsRequest; +import com.binance.connector.client.web3_wallet.rest.model.CalculateLpAddPairedAmountsResponse; +import com.google.gson.reflect.TypeToken; +import jakarta.validation.ConstraintViolation; +import jakarta.validation.Valid; +import jakarta.validation.Validation; +import jakarta.validation.Validator; +import jakarta.validation.constraints.*; +import jakarta.validation.executable.ExecutableValidator; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator; + +public class DefiTransactionApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + private static final String USER_AGENT = + String.format( + "binance-web3-wallet/4.2.0 (Java/%s; %s; %s)", + SystemUtil.getJavaVersion(), SystemUtil.getOs(), SystemUtil.getArch()); + private static final boolean HAS_TIME_UNIT = false; + + public DefiTransactionApi(ClientConfiguration clientConfiguration) { + this(new ApiClient(clientConfiguration)); + } + + public DefiTransactionApi(ApiClient apiClient) { + apiClient.setUserAgent(USER_AGENT); + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + private okhttp3.Call buildDeFiClaimTransactionCall( + BuildDeFiClaimTransactionRequest buildDeFiClaimTransactionRequest, + Long recvWindow, + String nonce) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/api/v1/defi/transaction/claim"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (buildDeFiClaimTransactionRequest.getAddress() != null) { + localVarFormParams.put("address", buildDeFiClaimTransactionRequest.getAddress()); + } + + if (buildDeFiClaimTransactionRequest.getBinanceChainId() != null) { + localVarFormParams.put( + "binanceChainId", buildDeFiClaimTransactionRequest.getBinanceChainId()); + } + + if (buildDeFiClaimTransactionRequest.getClaimType() != null) { + localVarFormParams.put("claimType", buildDeFiClaimTransactionRequest.getClaimType()); + } + + if (buildDeFiClaimTransactionRequest.getInvestmentId() != null) { + localVarFormParams.put( + "investmentId", buildDeFiClaimTransactionRequest.getInvestmentId()); + } + + if (buildDeFiClaimTransactionRequest.getDefiProtocolId() != null) { + localVarFormParams.put( + "defiProtocolId", buildDeFiClaimTransactionRequest.getDefiProtocolId()); + } + + if (buildDeFiClaimTransactionRequest.getNftId() != null) { + localVarFormParams.put("nftId", buildDeFiClaimTransactionRequest.getNftId()); + } + + if (buildDeFiClaimTransactionRequest.getRedemptionId() != null) { + localVarFormParams.put( + "redemptionId", buildDeFiClaimTransactionRequest.getRedemptionId()); + } + + if (buildDeFiClaimTransactionRequest.getTokenAddressList() != null) { + localVarFormParams.put( + "tokenAddressList", buildDeFiClaimTransactionRequest.getTokenAddressList()); + } + + if (buildDeFiClaimTransactionRequest.getSimulate() != null) { + localVarFormParams.put("simulate", buildDeFiClaimTransactionRequest.getSimulate()); + } + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {"application/x-www-form-urlencoded"}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (!localVarFormParams.isEmpty() && localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (recvWindow != null) { + localVarHeaderParams.put("recvWindow", localVarApiClient.parameterToString(recvWindow)); + } + + if (nonce != null) { + localVarHeaderParams.put("nonce", localVarApiClient.parameterToString(nonce)); + } + + Set localVarAuthNames = new HashSet<>(); + localVarAuthNames.add("binanceWeb3Signature"); + if (HAS_TIME_UNIT) { + localVarAuthNames.add("timeUnit"); + } + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call buildDeFiClaimTransactionValidateBeforeCall( + BuildDeFiClaimTransactionRequest buildDeFiClaimTransactionRequest, + Long recvWindow, + String nonce) + throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + ExecutableValidator executableValidator = validator.forExecutables(); + + Object[] parameterValues = {buildDeFiClaimTransactionRequest, recvWindow, nonce}; + Method method = + this.getClass() + .getMethod( + "buildDeFiClaimTransaction", + BuildDeFiClaimTransactionRequest.class, + Long.class, + String.class); + Set> violations = + executableValidator.validateParameters(this, method, parameterValues); + + if (violations.size() == 0) { + return buildDeFiClaimTransactionCall( + buildDeFiClaimTransactionRequest, recvWindow, nonce); + } else { + throw new ConstraintViolationException((Set) violations); + } + } catch (NoSuchMethodException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } catch (SecurityException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } + } + + public ApiResponse buildDeFiClaimTransaction( + @Valid @NotNull BuildDeFiClaimTransactionRequest buildDeFiClaimTransactionRequest, + Long recvWindow, + String nonce) + throws ApiException { + okhttp3.Call localVarCall = + buildDeFiClaimTransactionValidateBeforeCall( + buildDeFiClaimTransactionRequest, recvWindow, nonce); + java.lang.reflect.Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call buildDeFiDepositTransactionCall( + BuildDeFiDepositTransactionRequest buildDeFiDepositTransactionRequest, + Long recvWindow, + String nonce) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/api/v1/defi/transaction/deposit"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (buildDeFiDepositTransactionRequest.getAddress() != null) { + localVarFormParams.put("address", buildDeFiDepositTransactionRequest.getAddress()); + } + + if (buildDeFiDepositTransactionRequest.getInvestmentId() != null) { + localVarFormParams.put( + "investmentId", buildDeFiDepositTransactionRequest.getInvestmentId()); + } + + if (buildDeFiDepositTransactionRequest.getToken() != null) { + String json = JSON.getGson().toJson(buildDeFiDepositTransactionRequest.getToken()); + localVarFormParams.put("token", json); + } + + if (buildDeFiDepositTransactionRequest.getSimulate() != null) { + localVarFormParams.put("simulate", buildDeFiDepositTransactionRequest.getSimulate()); + } + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {"application/x-www-form-urlencoded"}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (!localVarFormParams.isEmpty() && localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (recvWindow != null) { + localVarHeaderParams.put("recvWindow", localVarApiClient.parameterToString(recvWindow)); + } + + if (nonce != null) { + localVarHeaderParams.put("nonce", localVarApiClient.parameterToString(nonce)); + } + + Set localVarAuthNames = new HashSet<>(); + localVarAuthNames.add("binanceWeb3Signature"); + if (HAS_TIME_UNIT) { + localVarAuthNames.add("timeUnit"); + } + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call buildDeFiDepositTransactionValidateBeforeCall( + BuildDeFiDepositTransactionRequest buildDeFiDepositTransactionRequest, + Long recvWindow, + String nonce) + throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + ExecutableValidator executableValidator = validator.forExecutables(); + + Object[] parameterValues = {buildDeFiDepositTransactionRequest, recvWindow, nonce}; + Method method = + this.getClass() + .getMethod( + "buildDeFiDepositTransaction", + BuildDeFiDepositTransactionRequest.class, + Long.class, + String.class); + Set> violations = + executableValidator.validateParameters(this, method, parameterValues); + + if (violations.size() == 0) { + return buildDeFiDepositTransactionCall( + buildDeFiDepositTransactionRequest, recvWindow, nonce); + } else { + throw new ConstraintViolationException((Set) violations); + } + } catch (NoSuchMethodException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } catch (SecurityException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } + } + + public ApiResponse buildDeFiDepositTransaction( + @Valid @NotNull BuildDeFiDepositTransactionRequest buildDeFiDepositTransactionRequest, + Long recvWindow, + String nonce) + throws ApiException { + okhttp3.Call localVarCall = + buildDeFiDepositTransactionValidateBeforeCall( + buildDeFiDepositTransactionRequest, recvWindow, nonce); + java.lang.reflect.Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call buildDeFiRedeemTransactionCall( + BuildDeFiRedeemTransactionRequest buildDeFiRedeemTransactionRequest, + Long recvWindow, + String nonce) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/api/v1/defi/transaction/redeem"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (buildDeFiRedeemTransactionRequest.getAddress() != null) { + localVarFormParams.put("address", buildDeFiRedeemTransactionRequest.getAddress()); + } + + if (buildDeFiRedeemTransactionRequest.getInvestmentId() != null) { + localVarFormParams.put( + "investmentId", buildDeFiRedeemTransactionRequest.getInvestmentId()); + } + + if (buildDeFiRedeemTransactionRequest.getToken() != null) { + String json = JSON.getGson().toJson(buildDeFiRedeemTransactionRequest.getToken()); + localVarFormParams.put("token", json); + } + + if (buildDeFiRedeemTransactionRequest.getRatio() != null) { + localVarFormParams.put("ratio", buildDeFiRedeemTransactionRequest.getRatio()); + } + + if (buildDeFiRedeemTransactionRequest.getSlippageBps() != null) { + localVarFormParams.put( + "slippageBps", buildDeFiRedeemTransactionRequest.getSlippageBps()); + } + + if (buildDeFiRedeemTransactionRequest.getSimulate() != null) { + localVarFormParams.put("simulate", buildDeFiRedeemTransactionRequest.getSimulate()); + } + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {"application/x-www-form-urlencoded"}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (!localVarFormParams.isEmpty() && localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (recvWindow != null) { + localVarHeaderParams.put("recvWindow", localVarApiClient.parameterToString(recvWindow)); + } + + if (nonce != null) { + localVarHeaderParams.put("nonce", localVarApiClient.parameterToString(nonce)); + } + + Set localVarAuthNames = new HashSet<>(); + localVarAuthNames.add("binanceWeb3Signature"); + if (HAS_TIME_UNIT) { + localVarAuthNames.add("timeUnit"); + } + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call buildDeFiRedeemTransactionValidateBeforeCall( + BuildDeFiRedeemTransactionRequest buildDeFiRedeemTransactionRequest, + Long recvWindow, + String nonce) + throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + ExecutableValidator executableValidator = validator.forExecutables(); + + Object[] parameterValues = {buildDeFiRedeemTransactionRequest, recvWindow, nonce}; + Method method = + this.getClass() + .getMethod( + "buildDeFiRedeemTransaction", + BuildDeFiRedeemTransactionRequest.class, + Long.class, + String.class); + Set> violations = + executableValidator.validateParameters(this, method, parameterValues); + + if (violations.size() == 0) { + return buildDeFiRedeemTransactionCall( + buildDeFiRedeemTransactionRequest, recvWindow, nonce); + } else { + throw new ConstraintViolationException((Set) violations); + } + } catch (NoSuchMethodException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } catch (SecurityException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } + } + + public ApiResponse buildDeFiRedeemTransaction( + @Valid @NotNull BuildDeFiRedeemTransactionRequest buildDeFiRedeemTransactionRequest, + Long recvWindow, + String nonce) + throws ApiException { + okhttp3.Call localVarCall = + buildDeFiRedeemTransactionValidateBeforeCall( + buildDeFiRedeemTransactionRequest, recvWindow, nonce); + java.lang.reflect.Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call buildLpAddTransactionCall( + BuildLpAddTransactionRequest buildLpAddTransactionRequest, + Long recvWindow, + String nonce) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/api/v1/defi/transaction/lp-add"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (buildLpAddTransactionRequest.getAddress() != null) { + localVarFormParams.put("address", buildLpAddTransactionRequest.getAddress()); + } + + if (buildLpAddTransactionRequest.getInvestmentId() != null) { + localVarFormParams.put("investmentId", buildLpAddTransactionRequest.getInvestmentId()); + } + + if (buildLpAddTransactionRequest.getTokenList() != null) { + String json = JSON.getGson().toJson(buildLpAddTransactionRequest.getTokenList()); + localVarFormParams.put("tokenList", json); + } + + if (buildLpAddTransactionRequest.getTickLower() != null) { + localVarFormParams.put("tickLower", buildLpAddTransactionRequest.getTickLower()); + } + + if (buildLpAddTransactionRequest.getTickUpper() != null) { + localVarFormParams.put("tickUpper", buildLpAddTransactionRequest.getTickUpper()); + } + + if (buildLpAddTransactionRequest.getPriceRange() != null) { + localVarFormParams.put("priceRange", buildLpAddTransactionRequest.getPriceRange()); + } + + if (buildLpAddTransactionRequest.getNftId() != null) { + localVarFormParams.put("nftId", buildLpAddTransactionRequest.getNftId()); + } + + if (buildLpAddTransactionRequest.getSlippageBps() != null) { + localVarFormParams.put("slippageBps", buildLpAddTransactionRequest.getSlippageBps()); + } + + if (buildLpAddTransactionRequest.getSimulate() != null) { + localVarFormParams.put("simulate", buildLpAddTransactionRequest.getSimulate()); + } + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {"application/x-www-form-urlencoded"}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (!localVarFormParams.isEmpty() && localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (recvWindow != null) { + localVarHeaderParams.put("recvWindow", localVarApiClient.parameterToString(recvWindow)); + } + + if (nonce != null) { + localVarHeaderParams.put("nonce", localVarApiClient.parameterToString(nonce)); + } + + Set localVarAuthNames = new HashSet<>(); + localVarAuthNames.add("binanceWeb3Signature"); + if (HAS_TIME_UNIT) { + localVarAuthNames.add("timeUnit"); + } + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call buildLpAddTransactionValidateBeforeCall( + BuildLpAddTransactionRequest buildLpAddTransactionRequest, + Long recvWindow, + String nonce) + throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + ExecutableValidator executableValidator = validator.forExecutables(); + + Object[] parameterValues = {buildLpAddTransactionRequest, recvWindow, nonce}; + Method method = + this.getClass() + .getMethod( + "buildLpAddTransaction", + BuildLpAddTransactionRequest.class, + Long.class, + String.class); + Set> violations = + executableValidator.validateParameters(this, method, parameterValues); + + if (violations.size() == 0) { + return buildLpAddTransactionCall(buildLpAddTransactionRequest, recvWindow, nonce); + } else { + throw new ConstraintViolationException((Set) violations); + } + } catch (NoSuchMethodException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } catch (SecurityException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } + } + + public ApiResponse buildLpAddTransaction( + @Valid @NotNull BuildLpAddTransactionRequest buildLpAddTransactionRequest, + Long recvWindow, + String nonce) + throws ApiException { + okhttp3.Call localVarCall = + buildLpAddTransactionValidateBeforeCall( + buildLpAddTransactionRequest, recvWindow, nonce); + java.lang.reflect.Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call buildLpRemoveTransactionCall( + BuildLpRemoveTransactionRequest buildLpRemoveTransactionRequest, + Long recvWindow, + String nonce) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/api/v1/defi/transaction/lp-remove"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (buildLpRemoveTransactionRequest.getAddress() != null) { + localVarFormParams.put("address", buildLpRemoveTransactionRequest.getAddress()); + } + + if (buildLpRemoveTransactionRequest.getInvestmentId() != null) { + localVarFormParams.put( + "investmentId", buildLpRemoveTransactionRequest.getInvestmentId()); + } + + if (buildLpRemoveTransactionRequest.getNftId() != null) { + localVarFormParams.put("nftId", buildLpRemoveTransactionRequest.getNftId()); + } + + if (buildLpRemoveTransactionRequest.getRatio() != null) { + localVarFormParams.put("ratio", buildLpRemoveTransactionRequest.getRatio()); + } + + if (buildLpRemoveTransactionRequest.getSlippageBps() != null) { + localVarFormParams.put("slippageBps", buildLpRemoveTransactionRequest.getSlippageBps()); + } + + if (buildLpRemoveTransactionRequest.getSimulate() != null) { + localVarFormParams.put("simulate", buildLpRemoveTransactionRequest.getSimulate()); + } + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {"application/x-www-form-urlencoded"}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (!localVarFormParams.isEmpty() && localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (recvWindow != null) { + localVarHeaderParams.put("recvWindow", localVarApiClient.parameterToString(recvWindow)); + } + + if (nonce != null) { + localVarHeaderParams.put("nonce", localVarApiClient.parameterToString(nonce)); + } + + Set localVarAuthNames = new HashSet<>(); + localVarAuthNames.add("binanceWeb3Signature"); + if (HAS_TIME_UNIT) { + localVarAuthNames.add("timeUnit"); + } + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call buildLpRemoveTransactionValidateBeforeCall( + BuildLpRemoveTransactionRequest buildLpRemoveTransactionRequest, + Long recvWindow, + String nonce) + throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + ExecutableValidator executableValidator = validator.forExecutables(); + + Object[] parameterValues = {buildLpRemoveTransactionRequest, recvWindow, nonce}; + Method method = + this.getClass() + .getMethod( + "buildLpRemoveTransaction", + BuildLpRemoveTransactionRequest.class, + Long.class, + String.class); + Set> violations = + executableValidator.validateParameters(this, method, parameterValues); + + if (violations.size() == 0) { + return buildLpRemoveTransactionCall( + buildLpRemoveTransactionRequest, recvWindow, nonce); + } else { + throw new ConstraintViolationException((Set) violations); + } + } catch (NoSuchMethodException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } catch (SecurityException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } + } + + public ApiResponse buildLpRemoveTransaction( + @Valid @NotNull BuildLpRemoveTransactionRequest buildLpRemoveTransactionRequest, + Long recvWindow, + String nonce) + throws ApiException { + okhttp3.Call localVarCall = + buildLpRemoveTransactionValidateBeforeCall( + buildLpRemoveTransactionRequest, recvWindow, nonce); + java.lang.reflect.Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call calculateLpAddPairedAmountsCall( + CalculateLpAddPairedAmountsRequest calculateLpAddPairedAmountsRequest, + Long recvWindow, + String nonce) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/api/v1/defi/transaction/lp-add/calculate"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (calculateLpAddPairedAmountsRequest.getAddress() != null) { + localVarFormParams.put("address", calculateLpAddPairedAmountsRequest.getAddress()); + } + + if (calculateLpAddPairedAmountsRequest.getInvestmentId() != null) { + localVarFormParams.put( + "investmentId", calculateLpAddPairedAmountsRequest.getInvestmentId()); + } + + if (calculateLpAddPairedAmountsRequest.getTickLower() != null) { + localVarFormParams.put("tickLower", calculateLpAddPairedAmountsRequest.getTickLower()); + } + + if (calculateLpAddPairedAmountsRequest.getTickUpper() != null) { + localVarFormParams.put("tickUpper", calculateLpAddPairedAmountsRequest.getTickUpper()); + } + + if (calculateLpAddPairedAmountsRequest.getPriceRange() != null) { + localVarFormParams.put( + "priceRange", calculateLpAddPairedAmountsRequest.getPriceRange()); + } + + if (calculateLpAddPairedAmountsRequest.getNftId() != null) { + localVarFormParams.put("nftId", calculateLpAddPairedAmountsRequest.getNftId()); + } + + if (calculateLpAddPairedAmountsRequest.getInputToken() != null) { + String json = JSON.getGson().toJson(calculateLpAddPairedAmountsRequest.getInputToken()); + localVarFormParams.put("inputToken", json); + } + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {"application/x-www-form-urlencoded"}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (!localVarFormParams.isEmpty() && localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (recvWindow != null) { + localVarHeaderParams.put("recvWindow", localVarApiClient.parameterToString(recvWindow)); + } + + if (nonce != null) { + localVarHeaderParams.put("nonce", localVarApiClient.parameterToString(nonce)); + } + + Set localVarAuthNames = new HashSet<>(); + localVarAuthNames.add("binanceWeb3Signature"); + if (HAS_TIME_UNIT) { + localVarAuthNames.add("timeUnit"); + } + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call calculateLpAddPairedAmountsValidateBeforeCall( + CalculateLpAddPairedAmountsRequest calculateLpAddPairedAmountsRequest, + Long recvWindow, + String nonce) + throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + ExecutableValidator executableValidator = validator.forExecutables(); + + Object[] parameterValues = {calculateLpAddPairedAmountsRequest, recvWindow, nonce}; + Method method = + this.getClass() + .getMethod( + "calculateLpAddPairedAmounts", + CalculateLpAddPairedAmountsRequest.class, + Long.class, + String.class); + Set> violations = + executableValidator.validateParameters(this, method, parameterValues); + + if (violations.size() == 0) { + return calculateLpAddPairedAmountsCall( + calculateLpAddPairedAmountsRequest, recvWindow, nonce); + } else { + throw new ConstraintViolationException((Set) violations); + } + } catch (NoSuchMethodException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } catch (SecurityException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } + } + + public ApiResponse calculateLpAddPairedAmounts( + @Valid @NotNull CalculateLpAddPairedAmountsRequest calculateLpAddPairedAmountsRequest, + Long recvWindow, + String nonce) + throws ApiException { + okhttp3.Call localVarCall = + calculateLpAddPairedAmountsValidateBeforeCall( + calculateLpAddPairedAmountsRequest, recvWindow, nonce); + java.lang.reflect.Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/api/GeneralDataApi.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/api/GeneralDataApi.java index eb3f098..a51833e 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/api/GeneralDataApi.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/api/GeneralDataApi.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * @@ -58,7 +58,7 @@ public class GeneralDataApi { private static final String USER_AGENT = String.format( - "binance-web3-wallet/4.1.0 (Java/%s; %s; %s)", + "binance-web3-wallet/4.2.0 (Java/%s; %s; %s)", SystemUtil.getJavaVersion(), SystemUtil.getOs(), SystemUtil.getArch()); private static final boolean HAS_TIME_UNIT = false; diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/api/RwaDataApi.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/api/RwaDataApi.java index ff55ffb..82c54d8 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/api/RwaDataApi.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/api/RwaDataApi.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * @@ -48,7 +48,7 @@ public class RwaDataApi { private static final String USER_AGENT = String.format( - "binance-web3-wallet/4.1.0 (Java/%s; %s; %s)", + "binance-web3-wallet/4.2.0 (Java/%s; %s; %s)", SystemUtil.getJavaVersion(), SystemUtil.getOs(), SystemUtil.getArch()); private static final boolean HAS_TIME_UNIT = false; diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/api/TradingApi.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/api/TradingApi.java index d3496c7..3d1565c 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/api/TradingApi.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/api/TradingApi.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * @@ -58,7 +58,7 @@ public class TradingApi { private static final String USER_AGENT = String.format( - "binance-web3-wallet/4.1.0 (Java/%s; %s; %s)", + "binance-web3-wallet/4.2.0 (Java/%s; %s; %s)", SystemUtil.getJavaVersion(), SystemUtil.getOs(), SystemUtil.getArch()); private static final boolean HAS_TIME_UNIT = false; diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/api/TransactionApi.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/api/TransactionApi.java index 9192ad8..27e2d99 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/api/TransactionApi.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/api/TransactionApi.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * @@ -53,7 +53,7 @@ public class TransactionApi { private static final String USER_AGENT = String.format( - "binance-web3-wallet/4.1.0 (Java/%s; %s; %s)", + "binance-web3-wallet/4.2.0 (Java/%s; %s; %s)", SystemUtil.getJavaVersion(), SystemUtil.getOs(), SystemUtil.getArch()); private static final boolean HAS_TIME_UNIT = false; diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/api/WalletApi.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/api/WalletApi.java index 4240dfc..b67c9c7 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/api/WalletApi.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/api/WalletApi.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * @@ -49,7 +49,7 @@ public class WalletApi { private static final String USER_AGENT = String.format( - "binance-web3-wallet/4.1.0 (Java/%s; %s; %s)", + "binance-web3-wallet/4.2.0 (Java/%s; %s; %s)", SystemUtil.getJavaVersion(), SystemUtil.getOs(), SystemUtil.getArch()); private static final boolean HAS_TIME_UNIT = false; @@ -336,7 +336,9 @@ public GetAllTokenBalancesByAddressRequest address(String address) { /** * Set chains * - * @param chains Comma-separated list of chain identifiers. (optional) + * @param chains Currently only a single chain is supported. Passing multiple + * comma-separated chain IDs returns an error; multi-chain support may be added in the + * future. (optional) * @return GetAllTokenBalancesByAddressRequest */ public GetAllTokenBalancesByAddressRequest chains(String chains) { diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/api/Web3WalletRestApi.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/api/Web3WalletRestApi.java index 14cbeec..3969f42 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/api/Web3WalletRestApi.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/api/Web3WalletRestApi.java @@ -11,8 +11,20 @@ import com.binance.connector.client.web3_wallet.rest.model.BinanceChainId; import com.binance.connector.client.web3_wallet.rest.model.BroadcastTransactionsRequest; import com.binance.connector.client.web3_wallet.rest.model.BroadcastTransactionsResponse; +import com.binance.connector.client.web3_wallet.rest.model.BuildDeFiClaimTransactionRequest; +import com.binance.connector.client.web3_wallet.rest.model.BuildDeFiClaimTransactionResponse; +import com.binance.connector.client.web3_wallet.rest.model.BuildDeFiDepositTransactionRequest; +import com.binance.connector.client.web3_wallet.rest.model.BuildDeFiDepositTransactionResponse; +import com.binance.connector.client.web3_wallet.rest.model.BuildDeFiRedeemTransactionRequest; +import com.binance.connector.client.web3_wallet.rest.model.BuildDeFiRedeemTransactionResponse; +import com.binance.connector.client.web3_wallet.rest.model.BuildLpAddTransactionRequest; +import com.binance.connector.client.web3_wallet.rest.model.BuildLpAddTransactionResponse; +import com.binance.connector.client.web3_wallet.rest.model.BuildLpRemoveTransactionRequest; +import com.binance.connector.client.web3_wallet.rest.model.BuildLpRemoveTransactionResponse; import com.binance.connector.client.web3_wallet.rest.model.BuildSolanaSwapInstructionsResponse; import com.binance.connector.client.web3_wallet.rest.model.BuildSwapTransactionResponse; +import com.binance.connector.client.web3_wallet.rest.model.CalculateLpAddPairedAmountsRequest; +import com.binance.connector.client.web3_wallet.rest.model.CalculateLpAddPairedAmountsResponse; import com.binance.connector.client.web3_wallet.rest.model.FeeSource; import com.binance.connector.client.web3_wallet.rest.model.GasLevel; import com.binance.connector.client.web3_wallet.rest.model.GetAddressPnLForSpecificTokenResponse; @@ -21,8 +33,14 @@ import com.binance.connector.client.web3_wallet.rest.model.GetAggregatedQuoteResponse; import com.binance.connector.client.web3_wallet.rest.model.GetAggregatorSupportedChainsResponse; import com.binance.connector.client.web3_wallet.rest.model.GetAllTokenBalancesByAddressResponse; +import com.binance.connector.client.web3_wallet.rest.model.GetB402SupportedConfigurationsV1Request; +import com.binance.connector.client.web3_wallet.rest.model.GetB402SupportedConfigurationsV1Response; +import com.binance.connector.client.web3_wallet.rest.model.GetB402SupportedConfigurationsV2Request; +import com.binance.connector.client.web3_wallet.rest.model.GetB402SupportedConfigurationsV2Response; import com.binance.connector.client.web3_wallet.rest.model.GetBroadcastOrdersResponse; import com.binance.connector.client.web3_wallet.rest.model.GetCandlesResponse; +import com.binance.connector.client.web3_wallet.rest.model.GetDeFiPositionsRequest; +import com.binance.connector.client.web3_wallet.rest.model.GetDeFiPositionsResponse; import com.binance.connector.client.web3_wallet.rest.model.GetDexTradeHistoryResponse; import com.binance.connector.client.web3_wallet.rest.model.GetErc20ApproveTransactionResponse; import com.binance.connector.client.web3_wallet.rest.model.GetGasLimitRequest; @@ -30,9 +48,13 @@ import com.binance.connector.client.web3_wallet.rest.model.GetGasPriceResponse; import com.binance.connector.client.web3_wallet.rest.model.GetHoldersRankingResponse; import com.binance.connector.client.web3_wallet.rest.model.GetHotTokenListResponse; +import com.binance.connector.client.web3_wallet.rest.model.GetInvestmentDetailRequest; +import com.binance.connector.client.web3_wallet.rest.model.GetInvestmentDetailResponse; import com.binance.connector.client.web3_wallet.rest.model.GetLatestBlockHeightResponse; import com.binance.connector.client.web3_wallet.rest.model.GetLeaderboardResponse; import com.binance.connector.client.web3_wallet.rest.model.GetPortfolioSupportedChainsResponse; +import com.binance.connector.client.web3_wallet.rest.model.GetProtocolDetailRequest; +import com.binance.connector.client.web3_wallet.rest.model.GetProtocolDetailResponse; import com.binance.connector.client.web3_wallet.rest.model.GetRfqOrderStatusResponse; import com.binance.connector.client.web3_wallet.rest.model.GetRwaTokenIssuancePlatformsResponse; import com.binance.connector.client.web3_wallet.rest.model.GetRwaTokenListResponse; @@ -56,6 +78,11 @@ import com.binance.connector.client.web3_wallet.rest.model.GetTransactionSupportedChainsResponse; import com.binance.connector.client.web3_wallet.rest.model.GetTransactionsByAddressResponse; import com.binance.connector.client.web3_wallet.rest.model.GetWalletSupportedChainsResponse; +import com.binance.connector.client.web3_wallet.rest.model.GetWebSocketAuthTokenResponse; +import com.binance.connector.client.web3_wallet.rest.model.ListDeFiInvestmentsRequest; +import com.binance.connector.client.web3_wallet.rest.model.ListDeFiInvestmentsResponse; +import com.binance.connector.client.web3_wallet.rest.model.ListDeFiProtocolsRequest; +import com.binance.connector.client.web3_wallet.rest.model.ListDeFiProtocolsResponse; import com.binance.connector.client.web3_wallet.rest.model.OrderType; import com.binance.connector.client.web3_wallet.rest.model.PlatformId; import com.binance.connector.client.web3_wallet.rest.model.QuoteAndBuildSwapTransactionResponse; @@ -63,6 +90,10 @@ import com.binance.connector.client.web3_wallet.rest.model.RankingTimeFrame; import com.binance.connector.client.web3_wallet.rest.model.SearchRwaTokenResponse; import com.binance.connector.client.web3_wallet.rest.model.SearchTokenResponse; +import com.binance.connector.client.web3_wallet.rest.model.SettleB402PaymentV1Request; +import com.binance.connector.client.web3_wallet.rest.model.SettleB402PaymentV1Response; +import com.binance.connector.client.web3_wallet.rest.model.SettleB402PaymentV2Request; +import com.binance.connector.client.web3_wallet.rest.model.SettleB402PaymentV2Response; import com.binance.connector.client.web3_wallet.rest.model.SimulateTransactionsRequest; import com.binance.connector.client.web3_wallet.rest.model.SimulateTransactionsResponse; import com.binance.connector.client.web3_wallet.rest.model.SortBy; @@ -72,16 +103,24 @@ import com.binance.connector.client.web3_wallet.rest.model.TimeFrame; import com.binance.connector.client.web3_wallet.rest.model.TrackerType; import com.binance.connector.client.web3_wallet.rest.model.Vendor; +import com.binance.connector.client.web3_wallet.rest.model.VerifyB402PaymentV1Request; +import com.binance.connector.client.web3_wallet.rest.model.VerifyB402PaymentV1Response; +import com.binance.connector.client.web3_wallet.rest.model.VerifyB402PaymentV2Request; +import com.binance.connector.client.web3_wallet.rest.model.VerifyB402PaymentV2Response; import com.binance.connector.client.web3_wallet.rest.model.WalletType; public class Web3WalletRestApi { private final AddressPortfolioApi addressPortfolioApi; + private final B402PaymentsApi b402PaymentsApi; + private final DefiDataApi defiDataApi; + private final DefiTransactionApi defiTransactionApi; private final GeneralDataApi generalDataApi; private final RwaDataApi rwaDataApi; private final TradingApi tradingApi; private final TransactionApi transactionApi; private final WalletApi walletApi; + private final WebSocketApi webSocketApi; public Web3WalletRestApi(ClientConfiguration configuration) { this(Web3WalletRestApiUtil.getDefaultClient(configuration)); @@ -89,11 +128,15 @@ public Web3WalletRestApi(ClientConfiguration configuration) { public Web3WalletRestApi(ApiClient apiClient) { this.addressPortfolioApi = new AddressPortfolioApi(apiClient); + this.b402PaymentsApi = new B402PaymentsApi(apiClient); + this.defiDataApi = new DefiDataApi(apiClient); + this.defiTransactionApi = new DefiTransactionApi(apiClient); this.generalDataApi = new GeneralDataApi(apiClient); this.rwaDataApi = new RwaDataApi(apiClient); this.tradingApi = new TradingApi(apiClient); this.transactionApi = new TransactionApi(apiClient); this.walletApi = new WalletApi(apiClient); + this.webSocketApi = new WebSocketApi(apiClient); } public ApiResponse getAddressPnLForSpecificToken( @@ -509,6 +552,658 @@ public ApiResponse getTrackedTrades( limit); } + /** + * Get B402 Supported Configurations V1 Legacy V1 compatibility endpoint. New integrations + * should use V2. V1 returns `x402Version=1`, method-specific + * `facilitatorAddress`, and V1 signer-map semantics. + * + * @param getB402SupportedConfigurationsV1Request (required) + * @param recvWindow Allowed time deviation in milliseconds (default: 5000, max: 60000). + * (optional) + * @param nonce Unique request identifier for anti-replay; falls back to X-OC-SIGN if omitted. + * (optional) + * @return ApiResponse<GetB402SupportedConfigurationsV1Response> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Legacy supported configurations or a B402 business error envelope. -
401 Unauthorized. The request is missing or contains invalid Web3 API credentials. -
403 Forbidden. Check the API Key's B402 Payments permission, IP whitelist, and endpoint allowlist. -
429 Rate limit exceeded. -
503 B402 is temporarily unavailable. -
+ * + * @see Get + * B402 Supported Configurations V1 Documentation + */ + public ApiResponse getB402SupportedConfigurationsV1( + GetB402SupportedConfigurationsV1Request getB402SupportedConfigurationsV1Request, + Long recvWindow, + String nonce) + throws ApiException { + return b402PaymentsApi.getB402SupportedConfigurationsV1( + getB402SupportedConfigurationsV1Request, recvWindow, nonce); + } + + /** + * Get B402 Supported Configurations V2 Return the live x402 V2 payment kinds available to the + * authenticated Developer Portal project. Use the result to construct HTTP 402 payment + * requirements. Copy the selected `extra` object verbatim and refresh cached + * configuration periodically. + * + * @param getB402SupportedConfigurationsV2Request (required) + * @param recvWindow Allowed time deviation in milliseconds (default: 5000, max: 60000). + * (optional) + * @param nonce Unique request identifier for anti-replay; falls back to X-OC-SIGN if omitted. + * (optional) + * @return ApiResponse<GetB402SupportedConfigurationsV2Response> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Supported configurations returned, or a B402 business error envelope. -
401 Unauthorized. The request is missing or contains invalid Web3 API credentials. -
403 Forbidden. Check the API Key's B402 Payments permission, IP whitelist, and endpoint allowlist. -
429 Rate limit exceeded. -
503 B402 is temporarily unavailable. -
+ * + * @see Get + * B402 Supported Configurations V2 Documentation + */ + public ApiResponse getB402SupportedConfigurationsV2( + GetB402SupportedConfigurationsV2Request getB402SupportedConfigurationsV2Request, + Long recvWindow, + String nonce) + throws ApiException { + return b402PaymentsApi.getB402SupportedConfigurationsV2( + getB402SupportedConfigurationsV2Request, recvWindow, nonce); + } + + /** + * Settle B402 Payment V1 Legacy V1 on-chain settlement endpoint. New integrations should use + * V2. This operation can move real funds and is irreversible. V1 additionally returns + * `confirmations` in the settlement result. + * + * @param settleB402PaymentV1Request (required) + * @param recvWindow Allowed time deviation in milliseconds (default: 5000, max: 60000). + * (optional) + * @param nonce Unique request identifier for anti-replay; falls back to X-OC-SIGN if omitted. + * (optional) + * @return ApiResponse<SettleB402PaymentV1Response> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Legacy settlement result or a B402 business error envelope. -
401 Unauthorized. The request is missing or contains invalid Web3 API credentials. -
403 Forbidden. Check the API Key's B402 Payments permission, IP whitelist, and endpoint allowlist. -
429 Rate limit exceeded. -
503 B402 is temporarily unavailable. -
+ * + * @see Settle + * B402 Payment V1 Documentation + */ + public ApiResponse settleB402PaymentV1( + SettleB402PaymentV1Request settleB402PaymentV1Request, Long recvWindow, String nonce) + throws ApiException { + return b402PaymentsApi.settleB402PaymentV1(settleB402PaymentV1Request, recvWindow, nonce); + } + + /** + * Settle B402 Payment V2 Submit a verified x402 V2 authorization on-chain. This operation can + * move real funds and is irreversible. For `permit2-upto`, provide + * `settleAmount` in atomic units. Business failure is returned as HTTP 200 with + * `data.success=false`; reconcile any non-empty transaction hash before + * retrying. + * + * @param settleB402PaymentV2Request (required) + * @param recvWindow Allowed time deviation in milliseconds (default: 5000, max: 60000). + * (optional) + * @param nonce Unique request identifier for anti-replay; falls back to X-OC-SIGN if omitted. + * (optional) + * @return ApiResponse<SettleB402PaymentV2Response> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Settlement result, or a B402 business error envelope. -
401 Unauthorized. The request is missing or contains invalid Web3 API credentials. -
403 Forbidden. Check the API Key's B402 Payments permission, IP whitelist, and endpoint allowlist. -
429 Rate limit exceeded. -
503 B402 is temporarily unavailable. -
+ * + * @see Settle + * B402 Payment V2 Documentation + */ + public ApiResponse settleB402PaymentV2( + SettleB402PaymentV2Request settleB402PaymentV2Request, Long recvWindow, String nonce) + throws ApiException { + return b402PaymentsApi.settleB402PaymentV2(settleB402PaymentV2Request, recvWindow, nonce); + } + + /** + * Verify B402 Payment V1 Legacy V1 off-chain verification endpoint. New integrations should use + * V2. Portal identity is resolved from the API Key project, so `merchantId` is + * omitted from the external request. + * + * @param verifyB402PaymentV1Request (required) + * @param recvWindow Allowed time deviation in milliseconds (default: 5000, max: 60000). + * (optional) + * @param nonce Unique request identifier for anti-replay; falls back to X-OC-SIGN if omitted. + * (optional) + * @return ApiResponse<VerifyB402PaymentV1Response> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Legacy verification result or a B402 business error envelope. -
401 Unauthorized. The request is missing or contains invalid Web3 API credentials. -
403 Forbidden. Check the API Key's B402 Payments permission, IP whitelist, and endpoint allowlist. -
429 Rate limit exceeded. -
503 B402 is temporarily unavailable. -
+ * + * @see Verify + * B402 Payment V1 Documentation + */ + public ApiResponse verifyB402PaymentV1( + VerifyB402PaymentV1Request verifyB402PaymentV1Request, Long recvWindow, String nonce) + throws ApiException { + return b402PaymentsApi.verifyB402PaymentV1(verifyB402PaymentV1Request, recvWindow, nonce); + } + + /** + * Verify B402 Payment V2 Validate an x402 V2 payment authorization off-chain without spending + * funds or broadcasting a transaction. Portal identity is resolved from the authenticated API + * Key project; omit `merchantId`. A validation failure is returned as HTTP 200 with + * `data.isValid=false`. + * + * @param verifyB402PaymentV2Request (required) + * @param recvWindow Allowed time deviation in milliseconds (default: 5000, max: 60000). + * (optional) + * @param nonce Unique request identifier for anti-replay; falls back to X-OC-SIGN if omitted. + * (optional) + * @return ApiResponse<VerifyB402PaymentV2Response> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Verification result, or a B402 business error envelope. -
401 Unauthorized. The request is missing or contains invalid Web3 API credentials. -
403 Forbidden. Check the API Key's B402 Payments permission, IP whitelist, and endpoint allowlist. -
429 Rate limit exceeded. -
503 B402 is temporarily unavailable. -
+ * + * @see Verify + * B402 Payment V2 Documentation + */ + public ApiResponse verifyB402PaymentV2( + VerifyB402PaymentV2Request verifyB402PaymentV2Request, Long recvWindow, String nonce) + throws ApiException { + return b402PaymentsApi.verifyB402PaymentV2(verifyB402PaymentV2Request, recvWindow, nonce); + } + + /** + * Get DeFi Positions Query DeFi positions for one or more wallet addresses on BSC. Returns + * protocol-level position summaries with token breakdowns. Optionally filter by specific chains + * via `binanceChainIds`. Position coverage is wider than the protocol list used by + * data queries and transaction building — see [Supported Chains & + * Protocols](../supported-chains) for the difference. + * + * @param getDeFiPositionsRequest (required) + * @param recvWindow Allowed time deviation in milliseconds (default: 5000, max: 60000). + * (optional) + * @param nonce Unique request identifier for anti-replay; falls back to X-OC-SIGN if omitted. + * (optional) + * @return ApiResponse<GetDeFiPositionsResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 DeFi positions returned successfully. -
401 Unauthorized. The request is missing or contains an invalid API key. -
403 Forbidden. The API key does not have permission to access this endpoint. -
404 Not Found. The requested resource or endpoint does not exist. -
+ * + * @see Get + * DeFi Positions Documentation + */ + public ApiResponse getDeFiPositions( + GetDeFiPositionsRequest getDeFiPositionsRequest, Long recvWindow, String nonce) + throws ApiException { + return defiDataApi.getDeFiPositions(getDeFiPositionsRequest, recvWindow, nonce); + } + + /** + * Get Investment Detail Get detailed information for a specific DeFi investment product, + * including APY, TVL, supported tokens (asset / reward / LP / borrow), pool address, fee rate, + * and investability. + * + * @param getInvestmentDetailRequest (required) + * @param recvWindow Allowed time deviation in milliseconds (default: 5000, max: 60000). + * (optional) + * @param nonce Unique request identifier for anti-replay; falls back to X-OC-SIGN if omitted. + * (optional) + * @return ApiResponse<GetInvestmentDetailResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Investment detail returned successfully. -
401 Unauthorized. The request is missing or contains an invalid API key. -
403 Forbidden. The API key does not have permission to access this endpoint. -
404 Not Found. The requested resource or endpoint does not exist. -
+ * + * @see Get + * Investment Detail Documentation + */ + public ApiResponse getInvestmentDetail( + GetInvestmentDetailRequest getInvestmentDetailRequest, Long recvWindow, String nonce) + throws ApiException { + return defiDataApi.getInvestmentDetail(getInvestmentDetailRequest, recvWindow, nonce); + } + + /** + * Get Protocol Detail Get detailed information for a specific DeFi protocol, including + * description, highlights, CertiK security scores, team, fundraising, social links, and FAQ. + * + * @param getProtocolDetailRequest (required) + * @param recvWindow Allowed time deviation in milliseconds (default: 5000, max: 60000). + * (optional) + * @param nonce Unique request identifier for anti-replay; falls back to X-OC-SIGN if omitted. + * (optional) + * @return ApiResponse<GetProtocolDetailResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Protocol detail returned successfully. -
401 Unauthorized. The request is missing or contains an invalid API key. -
403 Forbidden. The API key does not have permission to access this endpoint. -
404 Not Found. The requested resource or endpoint does not exist. -
+ * + * @see Get + * Protocol Detail Documentation + */ + public ApiResponse getProtocolDetail( + GetProtocolDetailRequest getProtocolDetailRequest, Long recvWindow, String nonce) + throws ApiException { + return defiDataApi.getProtocolDetail(getProtocolDetailRequest, recvWindow, nonce); + } + + /** + * List DeFi Investments List available DeFi investment products. Filter by protocol, chain, + * investment type, or contract address. Results are paginated and sortable. + * + * @param listDeFiInvestmentsRequest (required) + * @param recvWindow Allowed time deviation in milliseconds (default: 5000, max: 60000). + * (optional) + * @param nonce Unique request identifier for anti-replay; falls back to X-OC-SIGN if omitted. + * (optional) + * @return ApiResponse<ListDeFiInvestmentsResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Investment list returned successfully. -
401 Unauthorized. The request is missing or contains an invalid API key. -
403 Forbidden. The API key does not have permission to access this endpoint. -
404 Not Found. The requested resource or endpoint does not exist. -
+ * + * @see List + * DeFi Investments Documentation + */ + public ApiResponse listDeFiInvestments( + ListDeFiInvestmentsRequest listDeFiInvestmentsRequest, Long recvWindow, String nonce) + throws ApiException { + return defiDataApi.listDeFiInvestments(listDeFiInvestmentsRequest, recvWindow, nonce); + } + + public ApiResponse listDeFiProtocols( + DefiDataApi.ListDeFiProtocolsRequest request) { + return defiDataApi.listDeFiProtocols(request); + } + + /** + * List DeFi Protocols List supported DeFi protocols with optional filtering by chain and + * investment type. Results are paginated and sortable. + * + * @param recvWindow Allowed time deviation in milliseconds (default: 5000, max: 60000). + * (optional) + * @param nonce Unique request identifier for anti-replay; falls back to X-OC-SIGN if omitted. + * (optional) + * @param listDeFiProtocolsRequest (optional) + * @return ApiResponse<ListDeFiProtocolsResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Protocol list returned successfully. -
401 Unauthorized. The request is missing or contains an invalid API key. -
403 Forbidden. The API key does not have permission to access this endpoint. -
404 Not Found. The requested resource or endpoint does not exist. -
+ * + * @see List + * DeFi Protocols Documentation + */ + public ApiResponse listDeFiProtocols( + Long recvWindow, String nonce, ListDeFiProtocolsRequest listDeFiProtocolsRequest) + throws ApiException { + return defiDataApi.listDeFiProtocols(recvWindow, nonce, listDeFiProtocolsRequest); + } + + /** + * Build DeFi Claim Transaction Build the unsigned claim calldata for one of four claim types — + * see `DefiClaimType` for which companion fields each type requires **and which + * protocol constraints apply** (e.g. `REWARD_PROTOCOL` is not supported for LP + * protocols; PancakeSwap V3 farming uses `LP_FEE`, not + * `REWARD_INVESTMENT`). Returns an ordered `dataList` (typically + * `[CLAIM]`). **`binanceChainId` resolution rules**: - Normally resolved + * from `investmentId`; the call always executes on that chain. - For claim types + * other than `REWARD_PROTOCOL`, any client-supplied `binanceChainId` is + * **silently ignored** — passing a different chainId will not redirect the claim. - + * **Exception**: `REWARD_PROTOCOL` with no `investmentId` — the client MUST + * pass `binanceChainId` (it is the only chain signal). `tokenAddressList` + * optionally narrows the claim scope. Set `simulate=true` to also receive + * `preview`. + * + * @param buildDeFiClaimTransactionRequest (required) + * @param recvWindow Allowed time deviation in milliseconds (default: 5000, max: 60000). + * (optional) + * @param nonce Unique request identifier for anti-replay; falls back to X-OC-SIGN if omitted. + * (optional) + * @return ApiResponse<BuildDeFiClaimTransactionResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Claim transaction calldata returned successfully. -
401 Unauthorized. The request is missing or contains an invalid API key. -
403 Forbidden. The API key does not have permission to access this endpoint. -
404 Not Found. The requested resource or endpoint does not exist. -
+ * + * @see Build + * DeFi Claim Transaction Documentation + */ + public ApiResponse buildDeFiClaimTransaction( + BuildDeFiClaimTransactionRequest buildDeFiClaimTransactionRequest, + Long recvWindow, + String nonce) + throws ApiException { + return defiTransactionApi.buildDeFiClaimTransaction( + buildDeFiClaimTransactionRequest, recvWindow, nonce); + } + + /** + * Build DeFi Deposit Transaction Build the unsigned transaction calldata for a DeFi deposit / + * stake. Returns an ordered `dataList` (typically `[APPROVE, DEPOSIT]`, or + * `[DEPOSIT]` when the allowance is already sufficient) for the caller to sign and + * broadcast. The caller does NOT pass `binanceChainId` — the service resolves it from + * `investmentId`. Set `simulate=true` to also receive a + * `preview` (projected balance change, estimated gas, and lending health-factor + * change) without broadcasting. + * + * @param buildDeFiDepositTransactionRequest (required) + * @param recvWindow Allowed time deviation in milliseconds (default: 5000, max: 60000). + * (optional) + * @param nonce Unique request identifier for anti-replay; falls back to X-OC-SIGN if omitted. + * (optional) + * @return ApiResponse<BuildDeFiDepositTransactionResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Deposit transaction calldata returned successfully. -
401 Unauthorized. The request is missing or contains an invalid API key. -
403 Forbidden. The API key does not have permission to access this endpoint. -
404 Not Found. The requested resource or endpoint does not exist. -
+ * + * @see Build + * DeFi Deposit Transaction Documentation + */ + public ApiResponse buildDeFiDepositTransaction( + BuildDeFiDepositTransactionRequest buildDeFiDepositTransactionRequest, + Long recvWindow, + String nonce) + throws ApiException { + return defiTransactionApi.buildDeFiDepositTransaction( + buildDeFiDepositTransactionRequest, recvWindow, nonce); + } + + /** + * Build DeFi Redeem Transaction Build the unsigned transaction calldata for a DeFi redeem / + * withdraw. Returns an ordered `dataList` (typically `[REDEEM]` or + * `[APPROVE, REDEEM]`). **Redeem amount is decided by exactly one of + * `ratio` or `token`** (mutually exclusive): - `ratio` omitted / + * blank → **exact-amount redeem**: the amount comes from `token` + * (`tokenAddress` + `amount`); the position is *not* queried. + * `token` is required in this mode (omitting `token`, or leaving + * `amount` blank, is rejected with `40001`, `Parameter error`; + * both `ratio` and `token` absent is also rejected with `40001`). + * - `ratio` present → **proportional redeem**: must parse as a decimal in `(0, + * 1]`. The service queries the user's on-chain position under `investmentId` + * and scales each token's amount by `ratio` (floored to the token's + * decimals). `ratio=\"1\"` is a full (max) redeem. In this mode + * `token` is **ignored** — the output tokens and amounts are derived from the + * position. `slippageBps` is the slippage tolerance in basis points (e.g. + * `300` = 3%). The caller does NOT pass `binanceChainId` — resolved + * from `investmentId`. Set `simulate=true` to also receive + * `preview`. The response also carries `redeemDelayDays` — the redeem + * waiting period as a `[min, max]` day pair (e.g. + * `[\"7\",\"10\"]` = 7–10 days, `[]` = + * instant). The wait starts after the redeem tx is confirmed on-chain. See the + * `redeemDelayDays` field on `DefiTxResponse`. + * + * @param buildDeFiRedeemTransactionRequest (required) + * @param recvWindow Allowed time deviation in milliseconds (default: 5000, max: 60000). + * (optional) + * @param nonce Unique request identifier for anti-replay; falls back to X-OC-SIGN if omitted. + * (optional) + * @return ApiResponse<BuildDeFiRedeemTransactionResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Redeem transaction calldata returned successfully. -
401 Unauthorized. The request is missing or contains an invalid API key. -
403 Forbidden. The API key does not have permission to access this endpoint. -
404 Not Found. The requested resource or endpoint does not exist. -
+ * + * @see Build + * DeFi Redeem Transaction Documentation + */ + public ApiResponse buildDeFiRedeemTransaction( + BuildDeFiRedeemTransactionRequest buildDeFiRedeemTransactionRequest, + Long recvWindow, + String nonce) + throws ApiException { + return defiTransactionApi.buildDeFiRedeemTransaction( + buildDeFiRedeemTransactionRequest, recvWindow, nonce); + } + + /** + * Build LP Add Transaction Build the unsigned transaction calldata for adding liquidity. + * `tokenList` supports multiple tokens. Returns an ordered `dataList` + * (typically `[APPROVE, LP_ADD]`). **Tick range source (provide exactly one group)**: + * 1. `nftId` — append to an existing LP position (reuses its range). 2. + * `priceRange` — percentage band (e.g. `\"5\"` = ±5%) for a + * new position. 3. `tickLower` + `tickUpper` — explicit raw + * `int24` pair for a new position. **Rules**: - If more than one group is supplied, + * only the highest-priority one above is used and the others are silently ignored (priority: + * `nftId` > `priceRange` > explicit tick pair). - If none is + * supplied, the request is rejected (`40453`). - `tickLower` / + * `tickUpper` are raw `int24` values and MUST be aligned to the pool's + * `tickSpacing`, otherwise the request is rejected (`40453`). - The caller + * does NOT pass `binanceChainId` — resolved from `investmentId`. + * + * @param buildLpAddTransactionRequest (required) + * @param recvWindow Allowed time deviation in milliseconds (default: 5000, max: 60000). + * (optional) + * @param nonce Unique request identifier for anti-replay; falls back to X-OC-SIGN if omitted. + * (optional) + * @return ApiResponse<BuildLpAddTransactionResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 LP add transaction calldata returned successfully. -
401 Unauthorized. The request is missing or contains an invalid API key. -
403 Forbidden. The API key does not have permission to access this endpoint. -
404 Not Found. The requested resource or endpoint does not exist. -
+ * + * @see Build + * LP Add Transaction Documentation + */ + public ApiResponse buildLpAddTransaction( + BuildLpAddTransactionRequest buildLpAddTransactionRequest, + Long recvWindow, + String nonce) + throws ApiException { + return defiTransactionApi.buildLpAddTransaction( + buildLpAddTransactionRequest, recvWindow, nonce); + } + + /** + * Build LP Remove Transaction Build the unsigned transaction calldata for removing liquidity. + * Removal is by `nftId` + `ratio` (range `(0, 1]`) — no + * `tokenList` is needed; the per-token amounts are derived from the on-chain + * position. Returns an ordered `dataList` (typically `[LP_REMOVE]`). + * `slippageBps` is the LP-leg slippage tolerance in basis points. The caller does NOT + * pass `binanceChainId` — resolved from `investmentId`. + * + * @param buildLpRemoveTransactionRequest (required) + * @param recvWindow Allowed time deviation in milliseconds (default: 5000, max: 60000). + * (optional) + * @param nonce Unique request identifier for anti-replay; falls back to X-OC-SIGN if omitted. + * (optional) + * @return ApiResponse<BuildLpRemoveTransactionResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 LP remove transaction calldata returned successfully. -
401 Unauthorized. The request is missing or contains an invalid API key. -
403 Forbidden. The API key does not have permission to access this endpoint. -
404 Not Found. The requested resource or endpoint does not exist. -
+ * + * @see Build + * LP Remove Transaction Documentation + */ + public ApiResponse buildLpRemoveTransaction( + BuildLpRemoveTransactionRequest buildLpRemoveTransactionRequest, + Long recvWindow, + String nonce) + throws ApiException { + return defiTransactionApi.buildLpRemoveTransaction( + buildLpRemoveTransactionRequest, recvWindow, nonce); + } + + /** + * Calculate LP Add Paired Amounts Given a single input token, calculate the paired token amount + * needed for an LP add. This is a **pure computation endpoint** — it does not touch the chain + * and does not deduct any fee. Use it before `/transaction/lp-add` to size the paired + * token when only one side is supplied. Tick range source rules are the same as + * `/lp-add` — provide exactly one group: `nftId` (existing position), + * `priceRange`, or `tickLower`+`tickUpper`. - If more than one + * group is supplied, only the highest-priority one is used and the others are silently ignored + * (priority: `nftId` > `priceRange` > explicit tick pair). - If none + * is supplied, the request is rejected. - The caller does NOT pass `binanceChainId` — + * resolved from `investmentId`. + * + * @param calculateLpAddPairedAmountsRequest (required) + * @param recvWindow Allowed time deviation in milliseconds (default: 5000, max: 60000). + * (optional) + * @param nonce Unique request identifier for anti-replay; falls back to X-OC-SIGN if omitted. + * (optional) + * @return ApiResponse<CalculateLpAddPairedAmountsResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Paired token amounts returned successfully. -
401 Unauthorized. The request is missing or contains an invalid API key. -
403 Forbidden. The API key does not have permission to access this endpoint. -
404 Not Found. The requested resource or endpoint does not exist. -
+ * + * @see Calculate + * LP Add Paired Amounts Documentation + */ + public ApiResponse calculateLpAddPairedAmounts( + CalculateLpAddPairedAmountsRequest calculateLpAddPairedAmountsRequest, + Long recvWindow, + String nonce) + throws ApiException { + return defiTransactionApi.calculateLpAddPairedAmounts( + calculateLpAddPairedAmountsRequest, recvWindow, nonce); + } + public ApiResponse getCandles(GeneralDataApi.GetCandlesRequest request) { return generalDataApi.getCandles(request); } @@ -2535,17 +3230,18 @@ public ApiResponse getAllTokenBalancesByAd } /** - * Get All Token Balances by Address Return all token balances held by an address across one or - * more chains, with pagination support. Set `excludeRiskToken=true` to filter - * out airdrop-risk and honeypot tokens (honeypot detection currently applies only to ETH / BSC - * / SOL / BASE). + * Get All Token Balances by Address Return all token balances held by an address on a single + * chain, with pagination support. Set `excludeRiskToken=true` to filter out + * airdrop-risk and honeypot tokens (honeypot detection currently applies only to ETH / BSC / + * SOL / BASE). * * @param recvWindow Allowed time deviation in milliseconds (default: 5000, max: 60000). * (optional) * @param nonce Unique request identifier for anti-replay; falls back to X-OC-SIGN if omitted. * (optional) * @param address Wallet address to query. (optional) - * @param chains Comma-separated list of chain identifiers. (optional) + * @param chains Currently only a single chain is supported. Passing multiple comma-separated + * chain IDs returns an error; multi-chain support may be added in the future. (optional) * @param excludeRiskToken Whether to exclude risk-flagged tokens. (optional) * @param page Page number. Defaults to 1. (optional) * @param pageSize Page size. Range 1–100. Defaults to 20. (optional) @@ -2758,4 +3454,36 @@ public ApiResponse getWalletSupportedChains( Long recvWindow, String nonce, String binanceChainId) throws ApiException { return walletApi.getWalletSupportedChains(recvWindow, nonce, binanceChainId); } + + public ApiResponse getWebSocketAuthToken( + WebSocketApi.GetWebSocketAuthTokenRequest request) { + return webSocketApi.getWebSocketAuthToken(request); + } + + /** + * Get WebSocket Auth Token Get a WebSocket auth token before connecting to the WebSocket stream + * service. + * + * @param recvWindow Allowed time deviation in milliseconds (default: 5000, max: 60000). + * (optional) + * @param nonce Unique request identifier for anti-replay; falls back to X-OC-SIGN if omitted. + * (optional) + * @return ApiResponse<GetWebSocketAuthTokenResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 WebSocket auth token returned successfully. -
+ * + * @see Get + * WebSocket Auth Token Documentation + */ + public ApiResponse getWebSocketAuthToken( + Long recvWindow, String nonce) throws ApiException { + return webSocketApi.getWebSocketAuthToken(recvWindow, nonce); + } } diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/api/WebSocketApi.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/api/WebSocketApi.java new file mode 100644 index 0000000..bb5faf7 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/api/WebSocketApi.java @@ -0,0 +1,230 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.api; + +import com.binance.connector.client.common.ApiException; +import com.binance.connector.client.common.ApiResponse; +import com.binance.connector.client.common.Pair; +import com.binance.connector.client.common.SystemUtil; +import com.binance.connector.client.common.configuration.ClientConfiguration; +import com.binance.connector.client.common.exception.ConstraintViolationException; +import com.binance.connector.client.web3.common.ApiClient; +import com.binance.connector.client.web3_wallet.rest.model.GetWebSocketAuthTokenResponse; +import com.google.gson.reflect.TypeToken; +import jakarta.validation.ConstraintViolation; +import jakarta.validation.Validation; +import jakarta.validation.Validator; +import jakarta.validation.constraints.*; +import jakarta.validation.executable.ExecutableValidator; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator; + +public class WebSocketApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + private static final String USER_AGENT = + String.format( + "binance-web3-wallet/4.2.0 (Java/%s; %s; %s)", + SystemUtil.getJavaVersion(), SystemUtil.getOs(), SystemUtil.getArch()); + private static final boolean HAS_TIME_UNIT = false; + + public WebSocketApi(ClientConfiguration clientConfiguration) { + this(new ApiClient(clientConfiguration)); + } + + public WebSocketApi(ApiClient apiClient) { + apiClient.setUserAgent(USER_AGENT); + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + private okhttp3.Call getWebSocketAuthTokenCall(Long recvWindow, String nonce) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/api/v1/dex/market/wss/auth/token"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {"application/x-www-form-urlencoded"}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (!localVarFormParams.isEmpty() && localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (recvWindow != null) { + localVarHeaderParams.put("recvWindow", localVarApiClient.parameterToString(recvWindow)); + } + + if (nonce != null) { + localVarHeaderParams.put("nonce", localVarApiClient.parameterToString(nonce)); + } + + Set localVarAuthNames = new HashSet<>(); + localVarAuthNames.add("binanceWeb3Signature"); + if (HAS_TIME_UNIT) { + localVarAuthNames.add("timeUnit"); + } + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getWebSocketAuthTokenValidateBeforeCall(Long recvWindow, String nonce) + throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + ExecutableValidator executableValidator = validator.forExecutables(); + + Object[] parameterValues = {recvWindow, nonce}; + Method method = + this.getClass().getMethod("getWebSocketAuthToken", Long.class, String.class); + Set> violations = + executableValidator.validateParameters(this, method, parameterValues); + + if (violations.size() == 0) { + return getWebSocketAuthTokenCall(recvWindow, nonce); + } else { + throw new ConstraintViolationException((Set) violations); + } + } catch (NoSuchMethodException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } catch (SecurityException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } + } + + public ApiResponse getWebSocketAuthToken( + Long recvWindow, String nonce) throws ApiException { + okhttp3.Call localVarCall = getWebSocketAuthTokenValidateBeforeCall(recvWindow, nonce); + java.lang.reflect.Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + public ApiResponse getWebSocketAuthToken( + GetWebSocketAuthTokenRequest request) { + return getWebSocketAuthToken(request.getRecvWindow(), request.getNonce()); + } + + public static class GetWebSocketAuthTokenRequest { + private Long recvWindow; + private String nonce; + + public Long getRecvWindow() { + return recvWindow; + } + + public String getNonce() { + return nonce; + } + + public GetWebSocketAuthTokenRequest() {} + + /** + * Set recvWindow + * + * @param recvWindow Allowed time deviation in milliseconds (default: 5000, max: 60000). + * (optional) + * @return GetWebSocketAuthTokenRequest + */ + public GetWebSocketAuthTokenRequest recvWindow(Long recvWindow) { + this.recvWindow = recvWindow; + return this; + } + + /** + * Set nonce + * + * @param nonce Unique request identifier for anti-replay; falls back to X-OC-SIGN if + * omitted. (optional) + * @return GetWebSocketAuthTokenRequest + */ + public GetWebSocketAuthTokenRequest nonce(String nonce) { + this.nonce = nonce; + return this; + } + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/AddressResp.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/AddressResp.java new file mode 100644 index 0000000..88dad40 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/AddressResp.java @@ -0,0 +1,326 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; +import org.hibernate.validator.constraints.*; + +/** + * Address-level aggregation. Groups the protocol-level position summaries of one wallet address. + */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class AddressResp { + public static final String SERIALIZED_NAME_ADDRESS = "address"; + + @SerializedName(SERIALIZED_NAME_ADDRESS) + @jakarta.annotation.Nullable + private String address; + + public static final String SERIALIZED_NAME_ADDRESS_TOTAL_VALUE = "addressTotalValue"; + + @SerializedName(SERIALIZED_NAME_ADDRESS_TOTAL_VALUE) + @jakarta.annotation.Nullable + private String addressTotalValue; + + public static final String SERIALIZED_NAME_PROTOCOL_LIST = "protocolList"; + + @SerializedName(SERIALIZED_NAME_PROTOCOL_LIST) + @jakarta.annotation.Nullable + private List<@Valid AddressRespProtocolListInner> protocolList; + + public AddressResp() {} + + public AddressResp address(@jakarta.annotation.Nullable String address) { + this.address = address; + return this; + } + + /** + * Wallet address. + * + * @return address + */ + @jakarta.annotation.Nullable + public String getAddress() { + return address; + } + + public void setAddress(@jakarta.annotation.Nullable String address) { + this.address = address; + } + + public AddressResp addressTotalValue(@jakarta.annotation.Nullable String addressTotalValue) { + this.addressTotalValue = addressTotalValue; + return this; + } + + /** + * Total DeFi position value of this address across all chains (USD). Same raw precision as the + * position values. + * + * @return addressTotalValue + */ + @jakarta.annotation.Nullable + public String getAddressTotalValue() { + return addressTotalValue; + } + + public void setAddressTotalValue(@jakarta.annotation.Nullable String addressTotalValue) { + this.addressTotalValue = addressTotalValue; + } + + public AddressResp protocolList( + @jakarta.annotation.Nullable List<@Valid AddressRespProtocolListInner> protocolList) { + this.protocolList = protocolList; + return this; + } + + public AddressResp addProtocolListItem(AddressRespProtocolListInner protocolListItem) { + if (this.protocolList == null) { + this.protocolList = new ArrayList<>(); + } + this.protocolList.add(protocolListItem); + return this; + } + + /** + * Protocol-level position summaries of this address. + * + * @return protocolList + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid AddressRespProtocolListInner> getProtocolList() { + return protocolList; + } + + public void setProtocolList( + @jakarta.annotation.Nullable List<@Valid AddressRespProtocolListInner> protocolList) { + this.protocolList = protocolList; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AddressResp addressResp = (AddressResp) o; + return Objects.equals(this.address, addressResp.address) + && Objects.equals(this.addressTotalValue, addressResp.addressTotalValue) + && Objects.equals(this.protocolList, addressResp.protocolList); + } + + @Override + public int hashCode() { + return Objects.hash(address, addressTotalValue, protocolList); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AddressResp {\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append(" addressTotalValue: ").append(toIndentedString(addressTotalValue)).append("\n"); + sb.append(" protocolList: ").append(toIndentedString(protocolList)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object addressValue = getAddress(); + String addressValueAsString = ""; + addressValueAsString = addressValue.toString(); + sb.append("address=").append(urlEncode(addressValueAsString)).append(""); + Object addressTotalValueValue = getAddressTotalValue(); + String addressTotalValueValueAsString = ""; + addressTotalValueValueAsString = addressTotalValueValue.toString(); + sb.append("addressTotalValue=") + .append(urlEncode(addressTotalValueValueAsString)) + .append(""); + Object protocolListValue = getProtocolList(); + String protocolListValueAsString = ""; + protocolListValueAsString = + (String) + ((Collection) protocolListValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("protocolList=").append(urlEncode(protocolListValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("address"); + openapiFields.add("addressTotalValue"); + openapiFields.add("protocolList"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AddressResp + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AddressResp.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in AddressResp is not found in the empty" + + " JSON string", + AddressResp.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("address") != null && !jsonObj.get("address").isJsonNull()) + && !jsonObj.get("address").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `address` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("address").toString())); + } + if ((jsonObj.get("addressTotalValue") != null + && !jsonObj.get("addressTotalValue").isJsonNull()) + && !jsonObj.get("addressTotalValue").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `addressTotalValue` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("addressTotalValue").toString())); + } + if (jsonObj.get("protocolList") != null && !jsonObj.get("protocolList").isJsonNull()) { + JsonArray jsonArrayprotocolList = jsonObj.getAsJsonArray("protocolList"); + if (jsonArrayprotocolList != null) { + // ensure the json data is an array + if (!jsonObj.get("protocolList").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `protocolList` to be an array in the JSON" + + " string but got `%s`", + jsonObj.get("protocolList").toString())); + } + + // validate the optional field `protocolList` (array) + for (int i = 0; i < jsonArrayprotocolList.size(); i++) { + AddressRespProtocolListInner.validateJsonElement(jsonArrayprotocolList.get(i)); + } + ; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AddressResp.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AddressResp' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(AddressResp.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, AddressResp value) throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AddressResp read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of AddressResp given an JSON string + * + * @param jsonString JSON string + * @return An instance of AddressResp + * @throws IOException if the JSON string is invalid with respect to AddressResp + */ + public static AddressResp fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AddressResp.class); + } + + /** + * Convert an instance of AddressResp to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/AddressRespProtocolListInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/AddressRespProtocolListInner.java new file mode 100644 index 0000000..e352857 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/AddressRespProtocolListInner.java @@ -0,0 +1,421 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; +import org.hibernate.validator.constraints.*; + +/** + * Protocol-level position summary for one address on one chain. `binanceChainId` + + * `defiProtocolId` uniquely identify a protocol on a chain. + */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class AddressRespProtocolListInner { + public static final String SERIALIZED_NAME_BINANCE_CHAIN_ID = "binanceChainId"; + + @SerializedName(SERIALIZED_NAME_BINANCE_CHAIN_ID) + @jakarta.annotation.Nullable + private String binanceChainId; + + public static final String SERIALIZED_NAME_DEFI_PROTOCOL_ID = "defiProtocolId"; + + @SerializedName(SERIALIZED_NAME_DEFI_PROTOCOL_ID) + @jakarta.annotation.Nullable + private String defiProtocolId; + + public static final String SERIALIZED_NAME_PROTOCOL_NAME = "protocolName"; + + @SerializedName(SERIALIZED_NAME_PROTOCOL_NAME) + @jakarta.annotation.Nullable + private String protocolName; + + public static final String SERIALIZED_NAME_PROTOCOL_TOTAL_VALUE = "protocolTotalValue"; + + @SerializedName(SERIALIZED_NAME_PROTOCOL_TOTAL_VALUE) + @jakarta.annotation.Nullable + private String protocolTotalValue; + + public static final String SERIALIZED_NAME_POOL_LIST = "poolList"; + + @SerializedName(SERIALIZED_NAME_POOL_LIST) + @jakarta.annotation.Nullable + private List<@Valid ProtocolRespPoolListInner> poolList; + + public AddressRespProtocolListInner() {} + + public AddressRespProtocolListInner binanceChainId( + @jakarta.annotation.Nullable String binanceChainId) { + this.binanceChainId = binanceChainId; + return this; + } + + /** + * Binance chain ID (e.g. \"56\"=BSC). + * + * @return binanceChainId + */ + @jakarta.annotation.Nullable + public String getBinanceChainId() { + return binanceChainId; + } + + public void setBinanceChainId(@jakarta.annotation.Nullable String binanceChainId) { + this.binanceChainId = binanceChainId; + } + + public AddressRespProtocolListInner defiProtocolId( + @jakarta.annotation.Nullable String defiProtocolId) { + this.defiProtocolId = defiProtocolId; + return this; + } + + /** + * Protocol identifier consistent with `POST /api/v1/defi/data/protocol/list`. Use + * this value when calling investment/list, transaction endpoints, etc. + * + * @return defiProtocolId + */ + @jakarta.annotation.Nullable + public String getDefiProtocolId() { + return defiProtocolId; + } + + public void setDefiProtocolId(@jakarta.annotation.Nullable String defiProtocolId) { + this.defiProtocolId = defiProtocolId; + } + + public AddressRespProtocolListInner protocolName( + @jakarta.annotation.Nullable String protocolName) { + this.protocolName = protocolName; + return this; + } + + /** + * Protocol display name. + * + * @return protocolName + */ + @jakarta.annotation.Nullable + public String getProtocolName() { + return protocolName; + } + + public void setProtocolName(@jakarta.annotation.Nullable String protocolName) { + this.protocolName = protocolName; + } + + public AddressRespProtocolListInner protocolTotalValue( + @jakarta.annotation.Nullable String protocolTotalValue) { + this.protocolTotalValue = protocolTotalValue; + return this; + } + + /** + * Total position value in this protocol (USD). + * + * @return protocolTotalValue + */ + @jakarta.annotation.Nullable + public String getProtocolTotalValue() { + return protocolTotalValue; + } + + public void setProtocolTotalValue(@jakarta.annotation.Nullable String protocolTotalValue) { + this.protocolTotalValue = protocolTotalValue; + } + + public AddressRespProtocolListInner poolList( + @jakarta.annotation.Nullable List<@Valid ProtocolRespPoolListInner> poolList) { + this.poolList = poolList; + return this; + } + + public AddressRespProtocolListInner addPoolListItem(ProtocolRespPoolListInner poolListItem) { + if (this.poolList == null) { + this.poolList = new ArrayList<>(); + } + this.poolList.add(poolListItem); + return this; + } + + /** + * Pools with positions in this protocol. + * + * @return poolList + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid ProtocolRespPoolListInner> getPoolList() { + return poolList; + } + + public void setPoolList( + @jakarta.annotation.Nullable List<@Valid ProtocolRespPoolListInner> poolList) { + this.poolList = poolList; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AddressRespProtocolListInner addressRespProtocolListInner = + (AddressRespProtocolListInner) o; + return Objects.equals(this.binanceChainId, addressRespProtocolListInner.binanceChainId) + && Objects.equals(this.defiProtocolId, addressRespProtocolListInner.defiProtocolId) + && Objects.equals(this.protocolName, addressRespProtocolListInner.protocolName) + && Objects.equals( + this.protocolTotalValue, addressRespProtocolListInner.protocolTotalValue) + && Objects.equals(this.poolList, addressRespProtocolListInner.poolList); + } + + @Override + public int hashCode() { + return Objects.hash( + binanceChainId, defiProtocolId, protocolName, protocolTotalValue, poolList); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AddressRespProtocolListInner {\n"); + sb.append(" binanceChainId: ").append(toIndentedString(binanceChainId)).append("\n"); + sb.append(" defiProtocolId: ").append(toIndentedString(defiProtocolId)).append("\n"); + sb.append(" protocolName: ").append(toIndentedString(protocolName)).append("\n"); + sb.append(" protocolTotalValue: ") + .append(toIndentedString(protocolTotalValue)) + .append("\n"); + sb.append(" poolList: ").append(toIndentedString(poolList)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object binanceChainIdValue = getBinanceChainId(); + String binanceChainIdValueAsString = ""; + binanceChainIdValueAsString = binanceChainIdValue.toString(); + sb.append("binanceChainId=").append(urlEncode(binanceChainIdValueAsString)).append(""); + Object defiProtocolIdValue = getDefiProtocolId(); + String defiProtocolIdValueAsString = ""; + defiProtocolIdValueAsString = defiProtocolIdValue.toString(); + sb.append("defiProtocolId=").append(urlEncode(defiProtocolIdValueAsString)).append(""); + Object protocolNameValue = getProtocolName(); + String protocolNameValueAsString = ""; + protocolNameValueAsString = protocolNameValue.toString(); + sb.append("protocolName=").append(urlEncode(protocolNameValueAsString)).append(""); + Object protocolTotalValueValue = getProtocolTotalValue(); + String protocolTotalValueValueAsString = ""; + protocolTotalValueValueAsString = protocolTotalValueValue.toString(); + sb.append("protocolTotalValue=") + .append(urlEncode(protocolTotalValueValueAsString)) + .append(""); + Object poolListValue = getPoolList(); + String poolListValueAsString = ""; + poolListValueAsString = + (String) + ((Collection) poolListValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("poolList=").append(urlEncode(poolListValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("binanceChainId"); + openapiFields.add("defiProtocolId"); + openapiFields.add("protocolName"); + openapiFields.add("protocolTotalValue"); + openapiFields.add("poolList"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * AddressRespProtocolListInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AddressRespProtocolListInner.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in AddressRespProtocolListInner is not" + + " found in the empty JSON string", + AddressRespProtocolListInner.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("binanceChainId") != null && !jsonObj.get("binanceChainId").isJsonNull()) + && !jsonObj.get("binanceChainId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `binanceChainId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("binanceChainId").toString())); + } + if ((jsonObj.get("defiProtocolId") != null && !jsonObj.get("defiProtocolId").isJsonNull()) + && !jsonObj.get("defiProtocolId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `defiProtocolId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("defiProtocolId").toString())); + } + if ((jsonObj.get("protocolName") != null && !jsonObj.get("protocolName").isJsonNull()) + && !jsonObj.get("protocolName").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `protocolName` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("protocolName").toString())); + } + if ((jsonObj.get("protocolTotalValue") != null + && !jsonObj.get("protocolTotalValue").isJsonNull()) + && !jsonObj.get("protocolTotalValue").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `protocolTotalValue` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("protocolTotalValue").toString())); + } + if (jsonObj.get("poolList") != null && !jsonObj.get("poolList").isJsonNull()) { + JsonArray jsonArraypoolList = jsonObj.getAsJsonArray("poolList"); + if (jsonArraypoolList != null) { + // ensure the json data is an array + if (!jsonObj.get("poolList").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `poolList` to be an array in the JSON" + + " string but got `%s`", + jsonObj.get("poolList").toString())); + } + + // validate the optional field `poolList` (array) + for (int i = 0; i < jsonArraypoolList.size(); i++) { + ProtocolRespPoolListInner.validateJsonElement(jsonArraypoolList.get(i)); + } + ; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AddressRespProtocolListInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AddressRespProtocolListInner' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(AddressRespProtocolListInner.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, AddressRespProtocolListInner value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AddressRespProtocolListInner read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of AddressRespProtocolListInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of AddressRespProtocolListInner + * @throws IOException if the JSON string is invalid with respect to + * AddressRespProtocolListInner + */ + public static AddressRespProtocolListInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AddressRespProtocolListInner.class); + } + + /** + * Convert an instance of AddressRespProtocolListInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/ApproveTransaction.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/ApproveTransaction.java index a325336..1b66d54 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/ApproveTransaction.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/ApproveTransaction.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/AutoSlippage.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/AutoSlippage.java index e02f667..04e08fe 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/AutoSlippage.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/AutoSlippage.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402ApiErrorEnvelope.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402ApiErrorEnvelope.java new file mode 100644 index 0000000..4daf9ee --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402ApiErrorEnvelope.java @@ -0,0 +1,444 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** B402ApiErrorEnvelope */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402ApiErrorEnvelope { + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + @jakarta.annotation.Nullable + private String status; + + public static final String SERIALIZED_NAME_TYPE = "type"; + + @SerializedName(SERIALIZED_NAME_TYPE) + @jakarta.annotation.Nullable + private String type; + + public static final String SERIALIZED_NAME_CODE = "code"; + + @SerializedName(SERIALIZED_NAME_CODE) + @jakarta.annotation.Nullable + private String code; + + public static final String SERIALIZED_NAME_ERROR_DATA = "errorData"; + + @SerializedName(SERIALIZED_NAME_ERROR_DATA) + @jakarta.annotation.Nullable + private String errorData; + + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + @jakarta.annotation.Nullable + private Object data; + + public static final String SERIALIZED_NAME_SUB_DATA = "subData"; + + @SerializedName(SERIALIZED_NAME_SUB_DATA) + @jakarta.annotation.Nullable + private Object subData; + + public static final String SERIALIZED_NAME_PARAMS = "params"; + + @SerializedName(SERIALIZED_NAME_PARAMS) + @jakarta.annotation.Nullable + private Object params; + + public B402ApiErrorEnvelope() {} + + public B402ApiErrorEnvelope status(@jakarta.annotation.Nullable String status) { + this.status = status; + return this; + } + + /** + * Get status + * + * @return status + */ + @jakarta.annotation.Nullable + public String getStatus() { + return status; + } + + public void setStatus(@jakarta.annotation.Nullable String status) { + this.status = status; + } + + public B402ApiErrorEnvelope type(@jakarta.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * + * @return type + */ + @jakarta.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@jakarta.annotation.Nullable String type) { + this.type = type; + } + + public B402ApiErrorEnvelope code(@jakarta.annotation.Nullable String code) { + this.code = code; + return this; + } + + /** + * Get code + * + * @return code + */ + @jakarta.annotation.Nullable + public String getCode() { + return code; + } + + public void setCode(@jakarta.annotation.Nullable String code) { + this.code = code; + } + + public B402ApiErrorEnvelope errorData(@jakarta.annotation.Nullable String errorData) { + this.errorData = errorData; + return this; + } + + /** + * Get errorData + * + * @return errorData + */ + @jakarta.annotation.Nullable + public String getErrorData() { + return errorData; + } + + public void setErrorData(@jakarta.annotation.Nullable String errorData) { + this.errorData = errorData; + } + + public B402ApiErrorEnvelope data(@jakarta.annotation.Nullable Object data) { + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @jakarta.annotation.Nullable + public Object getData() { + return data; + } + + public void setData(@jakarta.annotation.Nullable Object data) { + this.data = data; + } + + public B402ApiErrorEnvelope subData(@jakarta.annotation.Nullable Object subData) { + this.subData = subData; + return this; + } + + /** + * Get subData + * + * @return subData + */ + @jakarta.annotation.Nullable + public Object getSubData() { + return subData; + } + + public void setSubData(@jakarta.annotation.Nullable Object subData) { + this.subData = subData; + } + + public B402ApiErrorEnvelope params(@jakarta.annotation.Nullable Object params) { + this.params = params; + return this; + } + + /** + * Get params + * + * @return params + */ + @jakarta.annotation.Nullable + public Object getParams() { + return params; + } + + public void setParams(@jakarta.annotation.Nullable Object params) { + this.params = params; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402ApiErrorEnvelope b402ApiErrorEnvelope = (B402ApiErrorEnvelope) o; + return Objects.equals(this.status, b402ApiErrorEnvelope.status) + && Objects.equals(this.type, b402ApiErrorEnvelope.type) + && Objects.equals(this.code, b402ApiErrorEnvelope.code) + && Objects.equals(this.errorData, b402ApiErrorEnvelope.errorData) + && Objects.equals(this.data, b402ApiErrorEnvelope.data) + && Objects.equals(this.subData, b402ApiErrorEnvelope.subData) + && Objects.equals(this.params, b402ApiErrorEnvelope.params); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(status, type, code, errorData, data, subData, params); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402ApiErrorEnvelope {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" errorData: ").append(toIndentedString(errorData)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" subData: ").append(toIndentedString(subData)).append("\n"); + sb.append(" params: ").append(toIndentedString(params)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object statusValue = getStatus(); + String statusValueAsString = ""; + statusValueAsString = statusValue.toString(); + sb.append("status=").append(urlEncode(statusValueAsString)).append(""); + Object typeValue = getType(); + String typeValueAsString = ""; + typeValueAsString = typeValue.toString(); + sb.append("type=").append(urlEncode(typeValueAsString)).append(""); + Object codeValue = getCode(); + String codeValueAsString = ""; + codeValueAsString = codeValue.toString(); + sb.append("code=").append(urlEncode(codeValueAsString)).append(""); + Object errorDataValue = getErrorData(); + String errorDataValueAsString = ""; + errorDataValueAsString = errorDataValue.toString(); + sb.append("errorData=").append(urlEncode(errorDataValueAsString)).append(""); + Object dataValue = getData(); + String dataValueAsString = ""; + dataValueAsString = dataValue.toString(); + sb.append("data=").append(urlEncode(dataValueAsString)).append(""); + Object subDataValue = getSubData(); + String subDataValueAsString = ""; + subDataValueAsString = subDataValue.toString(); + sb.append("subData=").append(urlEncode(subDataValueAsString)).append(""); + Object paramsValue = getParams(); + String paramsValueAsString = ""; + paramsValueAsString = paramsValue.toString(); + sb.append("params=").append(urlEncode(paramsValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("status"); + openapiFields.add("type"); + openapiFields.add("code"); + openapiFields.add("errorData"); + openapiFields.add("data"); + openapiFields.add("subData"); + openapiFields.add("params"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to B402ApiErrorEnvelope + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402ApiErrorEnvelope.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in B402ApiErrorEnvelope is not found in" + + " the empty JSON string", + B402ApiErrorEnvelope.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) + && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `status` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("status").toString())); + } + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) + && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `type` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("type").toString())); + } + if ((jsonObj.get("code") != null && !jsonObj.get("code").isJsonNull()) + && !jsonObj.get("code").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `code` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("code").toString())); + } + if ((jsonObj.get("errorData") != null && !jsonObj.get("errorData").isJsonNull()) + && !jsonObj.get("errorData").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `errorData` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("errorData").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402ApiErrorEnvelope.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'B402ApiErrorEnvelope' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(B402ApiErrorEnvelope.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, B402ApiErrorEnvelope value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402ApiErrorEnvelope read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402ApiErrorEnvelope given an JSON string + * + * @param jsonString JSON string + * @return An instance of B402ApiErrorEnvelope + * @throws IOException if the JSON string is invalid with respect to B402ApiErrorEnvelope + */ + public static B402ApiErrorEnvelope fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, B402ApiErrorEnvelope.class); + } + + /** + * Convert an instance of B402ApiErrorEnvelope to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402BazaarExtension.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402BazaarExtension.java new file mode 100644 index 0000000..c63c53f --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402BazaarExtension.java @@ -0,0 +1,346 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** B402BazaarExtension */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402BazaarExtension { + public static final String SERIALIZED_NAME_INFO = "info"; + + @SerializedName(SERIALIZED_NAME_INFO) + @jakarta.annotation.Nonnull + private Map info; + + public static final String SERIALIZED_NAME_SCHEMA = "schema"; + + @SerializedName(SERIALIZED_NAME_SCHEMA) + @jakarta.annotation.Nonnull + private Map schema; + + public static final String SERIALIZED_NAME_ROUTE_TEMPLATE = "routeTemplate"; + + @SerializedName(SERIALIZED_NAME_ROUTE_TEMPLATE) + @jakarta.annotation.Nullable + private String routeTemplate; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @jakarta.annotation.Nullable + private String description; + + public B402BazaarExtension() {} + + public B402BazaarExtension info(@jakarta.annotation.Nonnull Map info) { + this.info = info; + return this; + } + + public B402BazaarExtension putInfoItem(String key, Object infoItem) { + if (this.info == null) { + this.info = new HashMap<>(); + } + this.info.put(key, infoItem); + return this; + } + + /** + * Get info + * + * @return info + */ + @jakarta.annotation.Nonnull + @NotNull + public Map getInfo() { + return info; + } + + public void setInfo(@jakarta.annotation.Nonnull Map info) { + this.info = info; + } + + public B402BazaarExtension schema(@jakarta.annotation.Nonnull Map schema) { + this.schema = schema; + return this; + } + + public B402BazaarExtension putSchemaItem(String key, Object schemaItem) { + if (this.schema == null) { + this.schema = new HashMap<>(); + } + this.schema.put(key, schemaItem); + return this; + } + + /** + * Get schema + * + * @return schema + */ + @jakarta.annotation.Nonnull + @NotNull + public Map getSchema() { + return schema; + } + + public void setSchema(@jakarta.annotation.Nonnull Map schema) { + this.schema = schema; + } + + public B402BazaarExtension routeTemplate(@jakarta.annotation.Nullable String routeTemplate) { + this.routeTemplate = routeTemplate; + return this; + } + + /** + * Get routeTemplate + * + * @return routeTemplate + */ + @jakarta.annotation.Nullable + public String getRouteTemplate() { + return routeTemplate; + } + + public void setRouteTemplate(@jakarta.annotation.Nullable String routeTemplate) { + this.routeTemplate = routeTemplate; + } + + public B402BazaarExtension description(@jakarta.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Get description + * + * @return description + */ + @jakarta.annotation.Nullable + public String getDescription() { + return description; + } + + public void setDescription(@jakarta.annotation.Nullable String description) { + this.description = description; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402BazaarExtension b402BazaarExtension = (B402BazaarExtension) o; + return Objects.equals(this.info, b402BazaarExtension.info) + && Objects.equals(this.schema, b402BazaarExtension.schema) + && Objects.equals(this.routeTemplate, b402BazaarExtension.routeTemplate) + && Objects.equals(this.description, b402BazaarExtension.description); + } + + @Override + public int hashCode() { + return Objects.hash(info, schema, routeTemplate, description); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402BazaarExtension {\n"); + sb.append(" info: ").append(toIndentedString(info)).append("\n"); + sb.append(" schema: ").append(toIndentedString(schema)).append("\n"); + sb.append(" routeTemplate: ").append(toIndentedString(routeTemplate)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object infoValue = getInfo(); + String infoValueAsString = ""; + infoValueAsString = infoValue.toString(); + sb.append("info=").append(urlEncode(infoValueAsString)).append(""); + Object schemaValue = getSchema(); + String schemaValueAsString = ""; + schemaValueAsString = schemaValue.toString(); + sb.append("schema=").append(urlEncode(schemaValueAsString)).append(""); + Object routeTemplateValue = getRouteTemplate(); + String routeTemplateValueAsString = ""; + routeTemplateValueAsString = routeTemplateValue.toString(); + sb.append("routeTemplate=").append(urlEncode(routeTemplateValueAsString)).append(""); + Object descriptionValue = getDescription(); + String descriptionValueAsString = ""; + descriptionValueAsString = descriptionValue.toString(); + sb.append("description=").append(urlEncode(descriptionValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("info"); + openapiFields.add("schema"); + openapiFields.add("routeTemplate"); + openapiFields.add("description"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("info"); + openapiRequiredFields.add("schema"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to B402BazaarExtension + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402BazaarExtension.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in B402BazaarExtension is not found in" + + " the empty JSON string", + B402BazaarExtension.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : B402BazaarExtension.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("routeTemplate") != null && !jsonObj.get("routeTemplate").isJsonNull()) + && !jsonObj.get("routeTemplate").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `routeTemplate` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("routeTemplate").toString())); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) + && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `description` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("description").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402BazaarExtension.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'B402BazaarExtension' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(B402BazaarExtension.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, B402BazaarExtension value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402BazaarExtension read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402BazaarExtension given an JSON string + * + * @param jsonString JSON string + * @return An instance of B402BazaarExtension + * @throws IOException if the JSON string is invalid with respect to B402BazaarExtension + */ + public static B402BazaarExtension fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, B402BazaarExtension.class); + } + + /** + * Convert an instance of B402BazaarExtension to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402Eip3009Authorization.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402Eip3009Authorization.java new file mode 100644 index 0000000..48abc85 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402Eip3009Authorization.java @@ -0,0 +1,427 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** B402Eip3009Authorization */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402Eip3009Authorization { + public static final String SERIALIZED_NAME_FROM = "from"; + + @SerializedName(SERIALIZED_NAME_FROM) + @jakarta.annotation.Nonnull + private String from; + + public static final String SERIALIZED_NAME_TO = "to"; + + @SerializedName(SERIALIZED_NAME_TO) + @jakarta.annotation.Nonnull + private String to; + + public static final String SERIALIZED_NAME_VALUE = "value"; + + @SerializedName(SERIALIZED_NAME_VALUE) + @jakarta.annotation.Nonnull + private String value; + + public static final String SERIALIZED_NAME_VALID_AFTER = "validAfter"; + + @SerializedName(SERIALIZED_NAME_VALID_AFTER) + @jakarta.annotation.Nonnull + private String validAfter; + + public static final String SERIALIZED_NAME_VALID_BEFORE = "validBefore"; + + @SerializedName(SERIALIZED_NAME_VALID_BEFORE) + @jakarta.annotation.Nonnull + private String validBefore; + + public static final String SERIALIZED_NAME_NONCE = "nonce"; + + @SerializedName(SERIALIZED_NAME_NONCE) + @jakarta.annotation.Nonnull + private String nonce; + + public B402Eip3009Authorization() {} + + public B402Eip3009Authorization from(@jakarta.annotation.Nonnull String from) { + this.from = from; + return this; + } + + /** + * Get from + * + * @return from + */ + @jakarta.annotation.Nonnull + @NotNull + public String getFrom() { + return from; + } + + public void setFrom(@jakarta.annotation.Nonnull String from) { + this.from = from; + } + + public B402Eip3009Authorization to(@jakarta.annotation.Nonnull String to) { + this.to = to; + return this; + } + + /** + * Get to + * + * @return to + */ + @jakarta.annotation.Nonnull + @NotNull + public String getTo() { + return to; + } + + public void setTo(@jakarta.annotation.Nonnull String to) { + this.to = to; + } + + public B402Eip3009Authorization value(@jakarta.annotation.Nonnull String value) { + this.value = value; + return this; + } + + /** + * Get value + * + * @return value + */ + @jakarta.annotation.Nonnull + @NotNull + public String getValue() { + return value; + } + + public void setValue(@jakarta.annotation.Nonnull String value) { + this.value = value; + } + + public B402Eip3009Authorization validAfter(@jakarta.annotation.Nonnull String validAfter) { + this.validAfter = validAfter; + return this; + } + + /** + * Get validAfter + * + * @return validAfter + */ + @jakarta.annotation.Nonnull + @NotNull + public String getValidAfter() { + return validAfter; + } + + public void setValidAfter(@jakarta.annotation.Nonnull String validAfter) { + this.validAfter = validAfter; + } + + public B402Eip3009Authorization validBefore(@jakarta.annotation.Nonnull String validBefore) { + this.validBefore = validBefore; + return this; + } + + /** + * Get validBefore + * + * @return validBefore + */ + @jakarta.annotation.Nonnull + @NotNull + public String getValidBefore() { + return validBefore; + } + + public void setValidBefore(@jakarta.annotation.Nonnull String validBefore) { + this.validBefore = validBefore; + } + + public B402Eip3009Authorization nonce(@jakarta.annotation.Nonnull String nonce) { + this.nonce = nonce; + return this; + } + + /** + * Get nonce + * + * @return nonce + */ + @jakarta.annotation.Nonnull + @NotNull + public String getNonce() { + return nonce; + } + + public void setNonce(@jakarta.annotation.Nonnull String nonce) { + this.nonce = nonce; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402Eip3009Authorization b402Eip3009Authorization = (B402Eip3009Authorization) o; + return Objects.equals(this.from, b402Eip3009Authorization.from) + && Objects.equals(this.to, b402Eip3009Authorization.to) + && Objects.equals(this.value, b402Eip3009Authorization.value) + && Objects.equals(this.validAfter, b402Eip3009Authorization.validAfter) + && Objects.equals(this.validBefore, b402Eip3009Authorization.validBefore) + && Objects.equals(this.nonce, b402Eip3009Authorization.nonce); + } + + @Override + public int hashCode() { + return Objects.hash(from, to, value, validAfter, validBefore, nonce); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402Eip3009Authorization {\n"); + sb.append(" from: ").append(toIndentedString(from)).append("\n"); + sb.append(" to: ").append(toIndentedString(to)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" validAfter: ").append(toIndentedString(validAfter)).append("\n"); + sb.append(" validBefore: ").append(toIndentedString(validBefore)).append("\n"); + sb.append(" nonce: ").append(toIndentedString(nonce)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object fromValue = getFrom(); + String fromValueAsString = ""; + fromValueAsString = fromValue.toString(); + sb.append("from=").append(urlEncode(fromValueAsString)).append(""); + Object toValue = getTo(); + String toValueAsString = ""; + toValueAsString = toValue.toString(); + sb.append("to=").append(urlEncode(toValueAsString)).append(""); + Object valueValue = getValue(); + String valueValueAsString = ""; + valueValueAsString = valueValue.toString(); + sb.append("value=").append(urlEncode(valueValueAsString)).append(""); + Object validAfterValue = getValidAfter(); + String validAfterValueAsString = ""; + validAfterValueAsString = validAfterValue.toString(); + sb.append("validAfter=").append(urlEncode(validAfterValueAsString)).append(""); + Object validBeforeValue = getValidBefore(); + String validBeforeValueAsString = ""; + validBeforeValueAsString = validBeforeValue.toString(); + sb.append("validBefore=").append(urlEncode(validBeforeValueAsString)).append(""); + Object nonceValue = getNonce(); + String nonceValueAsString = ""; + nonceValueAsString = nonceValue.toString(); + sb.append("nonce=").append(urlEncode(nonceValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("from"); + openapiFields.add("to"); + openapiFields.add("value"); + openapiFields.add("validAfter"); + openapiFields.add("validBefore"); + openapiFields.add("nonce"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("from"); + openapiRequiredFields.add("to"); + openapiRequiredFields.add("value"); + openapiRequiredFields.add("validAfter"); + openapiRequiredFields.add("validBefore"); + openapiRequiredFields.add("nonce"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to B402Eip3009Authorization + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402Eip3009Authorization.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in B402Eip3009Authorization is not found" + + " in the empty JSON string", + B402Eip3009Authorization.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : B402Eip3009Authorization.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("from").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `from` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("from").toString())); + } + if (!jsonObj.get("to").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `to` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("to").toString())); + } + if (!jsonObj.get("value").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `value` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("value").toString())); + } + if (!jsonObj.get("validAfter").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `validAfter` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("validAfter").toString())); + } + if (!jsonObj.get("validBefore").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `validBefore` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("validBefore").toString())); + } + if (!jsonObj.get("nonce").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `nonce` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("nonce").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402Eip3009Authorization.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'B402Eip3009Authorization' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(B402Eip3009Authorization.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, B402Eip3009Authorization value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402Eip3009Authorization read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402Eip3009Authorization given an JSON string + * + * @param jsonString JSON string + * @return An instance of B402Eip3009Authorization + * @throws IOException if the JSON string is invalid with respect to B402Eip3009Authorization + */ + public static B402Eip3009Authorization fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, B402Eip3009Authorization.class); + } + + /** + * Convert an instance of B402Eip3009Authorization to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402PayloadDetail.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402PayloadDetail.java new file mode 100644 index 0000000..ea798f5 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402PayloadDetail.java @@ -0,0 +1,309 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** B402PayloadDetail */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402PayloadDetail { + public static final String SERIALIZED_NAME_SIGNATURE = "signature"; + + @SerializedName(SERIALIZED_NAME_SIGNATURE) + @jakarta.annotation.Nonnull + private String signature; + + public static final String SERIALIZED_NAME_AUTHORIZATION = "authorization"; + + @SerializedName(SERIALIZED_NAME_AUTHORIZATION) + @jakarta.annotation.Nullable + private B402PayloadDetailAuthorization authorization; + + public static final String SERIALIZED_NAME_PERMIT2_AUTHORIZATION = "permit2Authorization"; + + @SerializedName(SERIALIZED_NAME_PERMIT2_AUTHORIZATION) + @jakarta.annotation.Nullable + private B402PayloadDetailPermit2Authorization permit2Authorization; + + public B402PayloadDetail() {} + + public B402PayloadDetail signature(@jakarta.annotation.Nonnull String signature) { + this.signature = signature; + return this; + } + + /** + * Get signature + * + * @return signature + */ + @jakarta.annotation.Nonnull + @NotNull + public String getSignature() { + return signature; + } + + public void setSignature(@jakarta.annotation.Nonnull String signature) { + this.signature = signature; + } + + public B402PayloadDetail authorization( + @jakarta.annotation.Nullable B402PayloadDetailAuthorization authorization) { + this.authorization = authorization; + return this; + } + + /** + * Get authorization + * + * @return authorization + */ + @jakarta.annotation.Nullable + @Valid + public B402PayloadDetailAuthorization getAuthorization() { + return authorization; + } + + public void setAuthorization( + @jakarta.annotation.Nullable B402PayloadDetailAuthorization authorization) { + this.authorization = authorization; + } + + public B402PayloadDetail permit2Authorization( + @jakarta.annotation.Nullable + B402PayloadDetailPermit2Authorization permit2Authorization) { + this.permit2Authorization = permit2Authorization; + return this; + } + + /** + * Get permit2Authorization + * + * @return permit2Authorization + */ + @jakarta.annotation.Nullable + @Valid + public B402PayloadDetailPermit2Authorization getPermit2Authorization() { + return permit2Authorization; + } + + public void setPermit2Authorization( + @jakarta.annotation.Nullable + B402PayloadDetailPermit2Authorization permit2Authorization) { + this.permit2Authorization = permit2Authorization; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402PayloadDetail b402PayloadDetail = (B402PayloadDetail) o; + return Objects.equals(this.signature, b402PayloadDetail.signature) + && Objects.equals(this.authorization, b402PayloadDetail.authorization) + && Objects.equals( + this.permit2Authorization, b402PayloadDetail.permit2Authorization); + } + + @Override + public int hashCode() { + return Objects.hash(signature, authorization, permit2Authorization); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402PayloadDetail {\n"); + sb.append(" signature: ").append(toIndentedString(signature)).append("\n"); + sb.append(" authorization: ").append(toIndentedString(authorization)).append("\n"); + sb.append(" permit2Authorization: ") + .append(toIndentedString(permit2Authorization)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object signatureValue = getSignature(); + String signatureValueAsString = ""; + signatureValueAsString = signatureValue.toString(); + sb.append("signature=").append(urlEncode(signatureValueAsString)).append(""); + Object authorizationValue = getAuthorization(); + String authorizationValueAsString = ""; + authorizationValueAsString = authorizationValue.toString(); + sb.append("authorization=").append(urlEncode(authorizationValueAsString)).append(""); + Object permit2AuthorizationValue = getPermit2Authorization(); + String permit2AuthorizationValueAsString = ""; + permit2AuthorizationValueAsString = permit2AuthorizationValue.toString(); + sb.append("permit2Authorization=") + .append(urlEncode(permit2AuthorizationValueAsString)) + .append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("signature"); + openapiFields.add("authorization"); + openapiFields.add("permit2Authorization"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("signature"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to B402PayloadDetail + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402PayloadDetail.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in B402PayloadDetail is not found in the" + + " empty JSON string", + B402PayloadDetail.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : B402PayloadDetail.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("signature").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `signature` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("signature").toString())); + } + // validate the optional field `authorization` + if (jsonObj.get("authorization") != null && !jsonObj.get("authorization").isJsonNull()) { + B402PayloadDetailAuthorization.validateJsonElement(jsonObj.get("authorization")); + } + // validate the optional field `permit2Authorization` + if (jsonObj.get("permit2Authorization") != null + && !jsonObj.get("permit2Authorization").isJsonNull()) { + B402PayloadDetailPermit2Authorization.validateJsonElement( + jsonObj.get("permit2Authorization")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402PayloadDetail.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'B402PayloadDetail' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(B402PayloadDetail.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, B402PayloadDetail value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402PayloadDetail read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402PayloadDetail given an JSON string + * + * @param jsonString JSON string + * @return An instance of B402PayloadDetail + * @throws IOException if the JSON string is invalid with respect to B402PayloadDetail + */ + public static B402PayloadDetail fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, B402PayloadDetail.class); + } + + /** + * Convert an instance of B402PayloadDetail to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402PayloadDetailAuthorization.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402PayloadDetailAuthorization.java new file mode 100644 index 0000000..1ff7e4a --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402PayloadDetailAuthorization.java @@ -0,0 +1,434 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** B402PayloadDetailAuthorization */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402PayloadDetailAuthorization { + public static final String SERIALIZED_NAME_FROM = "from"; + + @SerializedName(SERIALIZED_NAME_FROM) + @jakarta.annotation.Nonnull + private String from; + + public static final String SERIALIZED_NAME_TO = "to"; + + @SerializedName(SERIALIZED_NAME_TO) + @jakarta.annotation.Nonnull + private String to; + + public static final String SERIALIZED_NAME_VALUE = "value"; + + @SerializedName(SERIALIZED_NAME_VALUE) + @jakarta.annotation.Nonnull + private String value; + + public static final String SERIALIZED_NAME_VALID_AFTER = "validAfter"; + + @SerializedName(SERIALIZED_NAME_VALID_AFTER) + @jakarta.annotation.Nonnull + private String validAfter; + + public static final String SERIALIZED_NAME_VALID_BEFORE = "validBefore"; + + @SerializedName(SERIALIZED_NAME_VALID_BEFORE) + @jakarta.annotation.Nonnull + private String validBefore; + + public static final String SERIALIZED_NAME_NONCE = "nonce"; + + @SerializedName(SERIALIZED_NAME_NONCE) + @jakarta.annotation.Nonnull + private String nonce; + + public B402PayloadDetailAuthorization() {} + + public B402PayloadDetailAuthorization from(@jakarta.annotation.Nonnull String from) { + this.from = from; + return this; + } + + /** + * Get from + * + * @return from + */ + @jakarta.annotation.Nonnull + @NotNull + public String getFrom() { + return from; + } + + public void setFrom(@jakarta.annotation.Nonnull String from) { + this.from = from; + } + + public B402PayloadDetailAuthorization to(@jakarta.annotation.Nonnull String to) { + this.to = to; + return this; + } + + /** + * Get to + * + * @return to + */ + @jakarta.annotation.Nonnull + @NotNull + public String getTo() { + return to; + } + + public void setTo(@jakarta.annotation.Nonnull String to) { + this.to = to; + } + + public B402PayloadDetailAuthorization value(@jakarta.annotation.Nonnull String value) { + this.value = value; + return this; + } + + /** + * Get value + * + * @return value + */ + @jakarta.annotation.Nonnull + @NotNull + public String getValue() { + return value; + } + + public void setValue(@jakarta.annotation.Nonnull String value) { + this.value = value; + } + + public B402PayloadDetailAuthorization validAfter( + @jakarta.annotation.Nonnull String validAfter) { + this.validAfter = validAfter; + return this; + } + + /** + * Get validAfter + * + * @return validAfter + */ + @jakarta.annotation.Nonnull + @NotNull + public String getValidAfter() { + return validAfter; + } + + public void setValidAfter(@jakarta.annotation.Nonnull String validAfter) { + this.validAfter = validAfter; + } + + public B402PayloadDetailAuthorization validBefore( + @jakarta.annotation.Nonnull String validBefore) { + this.validBefore = validBefore; + return this; + } + + /** + * Get validBefore + * + * @return validBefore + */ + @jakarta.annotation.Nonnull + @NotNull + public String getValidBefore() { + return validBefore; + } + + public void setValidBefore(@jakarta.annotation.Nonnull String validBefore) { + this.validBefore = validBefore; + } + + public B402PayloadDetailAuthorization nonce(@jakarta.annotation.Nonnull String nonce) { + this.nonce = nonce; + return this; + } + + /** + * Get nonce + * + * @return nonce + */ + @jakarta.annotation.Nonnull + @NotNull + public String getNonce() { + return nonce; + } + + public void setNonce(@jakarta.annotation.Nonnull String nonce) { + this.nonce = nonce; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402PayloadDetailAuthorization b402PayloadDetailAuthorization = + (B402PayloadDetailAuthorization) o; + return Objects.equals(this.from, b402PayloadDetailAuthorization.from) + && Objects.equals(this.to, b402PayloadDetailAuthorization.to) + && Objects.equals(this.value, b402PayloadDetailAuthorization.value) + && Objects.equals(this.validAfter, b402PayloadDetailAuthorization.validAfter) + && Objects.equals(this.validBefore, b402PayloadDetailAuthorization.validBefore) + && Objects.equals(this.nonce, b402PayloadDetailAuthorization.nonce); + } + + @Override + public int hashCode() { + return Objects.hash(from, to, value, validAfter, validBefore, nonce); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402PayloadDetailAuthorization {\n"); + sb.append(" from: ").append(toIndentedString(from)).append("\n"); + sb.append(" to: ").append(toIndentedString(to)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" validAfter: ").append(toIndentedString(validAfter)).append("\n"); + sb.append(" validBefore: ").append(toIndentedString(validBefore)).append("\n"); + sb.append(" nonce: ").append(toIndentedString(nonce)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object fromValue = getFrom(); + String fromValueAsString = ""; + fromValueAsString = fromValue.toString(); + sb.append("from=").append(urlEncode(fromValueAsString)).append(""); + Object toValue = getTo(); + String toValueAsString = ""; + toValueAsString = toValue.toString(); + sb.append("to=").append(urlEncode(toValueAsString)).append(""); + Object valueValue = getValue(); + String valueValueAsString = ""; + valueValueAsString = valueValue.toString(); + sb.append("value=").append(urlEncode(valueValueAsString)).append(""); + Object validAfterValue = getValidAfter(); + String validAfterValueAsString = ""; + validAfterValueAsString = validAfterValue.toString(); + sb.append("validAfter=").append(urlEncode(validAfterValueAsString)).append(""); + Object validBeforeValue = getValidBefore(); + String validBeforeValueAsString = ""; + validBeforeValueAsString = validBeforeValue.toString(); + sb.append("validBefore=").append(urlEncode(validBeforeValueAsString)).append(""); + Object nonceValue = getNonce(); + String nonceValueAsString = ""; + nonceValueAsString = nonceValue.toString(); + sb.append("nonce=").append(urlEncode(nonceValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("from"); + openapiFields.add("to"); + openapiFields.add("value"); + openapiFields.add("validAfter"); + openapiFields.add("validBefore"); + openapiFields.add("nonce"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("from"); + openapiRequiredFields.add("to"); + openapiRequiredFields.add("value"); + openapiRequiredFields.add("validAfter"); + openapiRequiredFields.add("validBefore"); + openapiRequiredFields.add("nonce"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * B402PayloadDetailAuthorization + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402PayloadDetailAuthorization.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in B402PayloadDetailAuthorization is not" + + " found in the empty JSON string", + B402PayloadDetailAuthorization.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : B402PayloadDetailAuthorization.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("from").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `from` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("from").toString())); + } + if (!jsonObj.get("to").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `to` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("to").toString())); + } + if (!jsonObj.get("value").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `value` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("value").toString())); + } + if (!jsonObj.get("validAfter").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `validAfter` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("validAfter").toString())); + } + if (!jsonObj.get("validBefore").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `validBefore` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("validBefore").toString())); + } + if (!jsonObj.get("nonce").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `nonce` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("nonce").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402PayloadDetailAuthorization.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'B402PayloadDetailAuthorization' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(B402PayloadDetailAuthorization.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, B402PayloadDetailAuthorization value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402PayloadDetailAuthorization read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402PayloadDetailAuthorization given an JSON string + * + * @param jsonString JSON string + * @return An instance of B402PayloadDetailAuthorization + * @throws IOException if the JSON string is invalid with respect to + * B402PayloadDetailAuthorization + */ + public static B402PayloadDetailAuthorization fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, B402PayloadDetailAuthorization.class); + } + + /** + * Convert an instance of B402PayloadDetailAuthorization to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402PayloadDetailPermit2Authorization.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402PayloadDetailPermit2Authorization.java new file mode 100644 index 0000000..05b18b6 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402PayloadDetailPermit2Authorization.java @@ -0,0 +1,433 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** B402PayloadDetailPermit2Authorization */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402PayloadDetailPermit2Authorization { + public static final String SERIALIZED_NAME_PERMITTED = "permitted"; + + @SerializedName(SERIALIZED_NAME_PERMITTED) + @jakarta.annotation.Nonnull + private B402Permit2AuthorizationPermitted permitted; + + public static final String SERIALIZED_NAME_FROM = "from"; + + @SerializedName(SERIALIZED_NAME_FROM) + @jakarta.annotation.Nonnull + private String from; + + public static final String SERIALIZED_NAME_SPENDER = "spender"; + + @SerializedName(SERIALIZED_NAME_SPENDER) + @jakarta.annotation.Nonnull + private String spender; + + public static final String SERIALIZED_NAME_NONCE = "nonce"; + + @SerializedName(SERIALIZED_NAME_NONCE) + @jakarta.annotation.Nonnull + private String nonce; + + public static final String SERIALIZED_NAME_DEADLINE = "deadline"; + + @SerializedName(SERIALIZED_NAME_DEADLINE) + @jakarta.annotation.Nonnull + private String deadline; + + public static final String SERIALIZED_NAME_WITNESS = "witness"; + + @SerializedName(SERIALIZED_NAME_WITNESS) + @jakarta.annotation.Nonnull + private B402Permit2AuthorizationWitness witness; + + public B402PayloadDetailPermit2Authorization() {} + + public B402PayloadDetailPermit2Authorization permitted( + @jakarta.annotation.Nonnull B402Permit2AuthorizationPermitted permitted) { + this.permitted = permitted; + return this; + } + + /** + * Get permitted + * + * @return permitted + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public B402Permit2AuthorizationPermitted getPermitted() { + return permitted; + } + + public void setPermitted( + @jakarta.annotation.Nonnull B402Permit2AuthorizationPermitted permitted) { + this.permitted = permitted; + } + + public B402PayloadDetailPermit2Authorization from(@jakarta.annotation.Nonnull String from) { + this.from = from; + return this; + } + + /** + * Get from + * + * @return from + */ + @jakarta.annotation.Nonnull + @NotNull + public String getFrom() { + return from; + } + + public void setFrom(@jakarta.annotation.Nonnull String from) { + this.from = from; + } + + public B402PayloadDetailPermit2Authorization spender( + @jakarta.annotation.Nonnull String spender) { + this.spender = spender; + return this; + } + + /** + * Get spender + * + * @return spender + */ + @jakarta.annotation.Nonnull + @NotNull + public String getSpender() { + return spender; + } + + public void setSpender(@jakarta.annotation.Nonnull String spender) { + this.spender = spender; + } + + public B402PayloadDetailPermit2Authorization nonce(@jakarta.annotation.Nonnull String nonce) { + this.nonce = nonce; + return this; + } + + /** + * Get nonce + * + * @return nonce + */ + @jakarta.annotation.Nonnull + @NotNull + public String getNonce() { + return nonce; + } + + public void setNonce(@jakarta.annotation.Nonnull String nonce) { + this.nonce = nonce; + } + + public B402PayloadDetailPermit2Authorization deadline( + @jakarta.annotation.Nonnull String deadline) { + this.deadline = deadline; + return this; + } + + /** + * Get deadline + * + * @return deadline + */ + @jakarta.annotation.Nonnull + @NotNull + public String getDeadline() { + return deadline; + } + + public void setDeadline(@jakarta.annotation.Nonnull String deadline) { + this.deadline = deadline; + } + + public B402PayloadDetailPermit2Authorization witness( + @jakarta.annotation.Nonnull B402Permit2AuthorizationWitness witness) { + this.witness = witness; + return this; + } + + /** + * Get witness + * + * @return witness + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public B402Permit2AuthorizationWitness getWitness() { + return witness; + } + + public void setWitness(@jakarta.annotation.Nonnull B402Permit2AuthorizationWitness witness) { + this.witness = witness; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402PayloadDetailPermit2Authorization b402PayloadDetailPermit2Authorization = + (B402PayloadDetailPermit2Authorization) o; + return Objects.equals(this.permitted, b402PayloadDetailPermit2Authorization.permitted) + && Objects.equals(this.from, b402PayloadDetailPermit2Authorization.from) + && Objects.equals(this.spender, b402PayloadDetailPermit2Authorization.spender) + && Objects.equals(this.nonce, b402PayloadDetailPermit2Authorization.nonce) + && Objects.equals(this.deadline, b402PayloadDetailPermit2Authorization.deadline) + && Objects.equals(this.witness, b402PayloadDetailPermit2Authorization.witness); + } + + @Override + public int hashCode() { + return Objects.hash(permitted, from, spender, nonce, deadline, witness); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402PayloadDetailPermit2Authorization {\n"); + sb.append(" permitted: ").append(toIndentedString(permitted)).append("\n"); + sb.append(" from: ").append(toIndentedString(from)).append("\n"); + sb.append(" spender: ").append(toIndentedString(spender)).append("\n"); + sb.append(" nonce: ").append(toIndentedString(nonce)).append("\n"); + sb.append(" deadline: ").append(toIndentedString(deadline)).append("\n"); + sb.append(" witness: ").append(toIndentedString(witness)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object permittedValue = getPermitted(); + String permittedValueAsString = ""; + permittedValueAsString = permittedValue.toString(); + sb.append("permitted=").append(urlEncode(permittedValueAsString)).append(""); + Object fromValue = getFrom(); + String fromValueAsString = ""; + fromValueAsString = fromValue.toString(); + sb.append("from=").append(urlEncode(fromValueAsString)).append(""); + Object spenderValue = getSpender(); + String spenderValueAsString = ""; + spenderValueAsString = spenderValue.toString(); + sb.append("spender=").append(urlEncode(spenderValueAsString)).append(""); + Object nonceValue = getNonce(); + String nonceValueAsString = ""; + nonceValueAsString = nonceValue.toString(); + sb.append("nonce=").append(urlEncode(nonceValueAsString)).append(""); + Object deadlineValue = getDeadline(); + String deadlineValueAsString = ""; + deadlineValueAsString = deadlineValue.toString(); + sb.append("deadline=").append(urlEncode(deadlineValueAsString)).append(""); + Object witnessValue = getWitness(); + String witnessValueAsString = ""; + witnessValueAsString = witnessValue.toString(); + sb.append("witness=").append(urlEncode(witnessValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("permitted"); + openapiFields.add("from"); + openapiFields.add("spender"); + openapiFields.add("nonce"); + openapiFields.add("deadline"); + openapiFields.add("witness"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("permitted"); + openapiRequiredFields.add("from"); + openapiRequiredFields.add("spender"); + openapiRequiredFields.add("nonce"); + openapiRequiredFields.add("deadline"); + openapiRequiredFields.add("witness"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * B402PayloadDetailPermit2Authorization + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402PayloadDetailPermit2Authorization.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in B402PayloadDetailPermit2Authorization" + + " is not found in the empty JSON string", + B402PayloadDetailPermit2Authorization.openapiRequiredFields + .toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : B402PayloadDetailPermit2Authorization.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `permitted` + B402Permit2AuthorizationPermitted.validateJsonElement(jsonObj.get("permitted")); + if (!jsonObj.get("from").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `from` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("from").toString())); + } + if (!jsonObj.get("spender").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `spender` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("spender").toString())); + } + if (!jsonObj.get("nonce").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `nonce` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("nonce").toString())); + } + if (!jsonObj.get("deadline").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `deadline` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("deadline").toString())); + } + // validate the required field `witness` + B402Permit2AuthorizationWitness.validateJsonElement(jsonObj.get("witness")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402PayloadDetailPermit2Authorization.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'B402PayloadDetailPermit2Authorization' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(B402PayloadDetailPermit2Authorization.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, B402PayloadDetailPermit2Authorization value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402PayloadDetailPermit2Authorization read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402PayloadDetailPermit2Authorization given an JSON string + * + * @param jsonString JSON string + * @return An instance of B402PayloadDetailPermit2Authorization + * @throws IOException if the JSON string is invalid with respect to + * B402PayloadDetailPermit2Authorization + */ + public static B402PayloadDetailPermit2Authorization fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, B402PayloadDetailPermit2Authorization.class); + } + + /** + * Convert an instance of B402PayloadDetailPermit2Authorization to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402PaymentKindExtraV1.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402PaymentKindExtraV1.java new file mode 100644 index 0000000..7a2df17 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402PaymentKindExtraV1.java @@ -0,0 +1,405 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** B402PaymentKindExtraV1 */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402PaymentKindExtraV1 { + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @jakarta.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_VERSION = "version"; + + @SerializedName(SERIALIZED_NAME_VERSION) + @jakarta.annotation.Nullable + private String version; + + /** Gets or Sets assetTransferMethod */ + @JsonAdapter(AssetTransferMethodEnum.Adapter.class) + public enum AssetTransferMethodEnum { + EIP3009("eip3009"), + + PERMIT2_EXACT("permit2-exact"), + + PERMIT2_UPTO("permit2-upto"); + + private String value; + + AssetTransferMethodEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static AssetTransferMethodEnum fromValue(String value) { + for (AssetTransferMethodEnum b : AssetTransferMethodEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write( + final JsonWriter jsonWriter, final AssetTransferMethodEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public AssetTransferMethodEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return AssetTransferMethodEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + AssetTransferMethodEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_ASSET_TRANSFER_METHOD = "assetTransferMethod"; + + @SerializedName(SERIALIZED_NAME_ASSET_TRANSFER_METHOD) + @jakarta.annotation.Nullable + private AssetTransferMethodEnum assetTransferMethod; + + public static final String SERIALIZED_NAME_FACILITATOR_ADDRESS = "facilitatorAddress"; + + @SerializedName(SERIALIZED_NAME_FACILITATOR_ADDRESS) + @jakarta.annotation.Nullable + private String facilitatorAddress; + + public B402PaymentKindExtraV1() {} + + public B402PaymentKindExtraV1 name(@jakarta.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * + * @return name + */ + @jakarta.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@jakarta.annotation.Nullable String name) { + this.name = name; + } + + public B402PaymentKindExtraV1 version(@jakarta.annotation.Nullable String version) { + this.version = version; + return this; + } + + /** + * Get version + * + * @return version + */ + @jakarta.annotation.Nullable + public String getVersion() { + return version; + } + + public void setVersion(@jakarta.annotation.Nullable String version) { + this.version = version; + } + + public B402PaymentKindExtraV1 assetTransferMethod( + @jakarta.annotation.Nullable AssetTransferMethodEnum assetTransferMethod) { + this.assetTransferMethod = assetTransferMethod; + return this; + } + + /** + * Get assetTransferMethod + * + * @return assetTransferMethod + */ + @jakarta.annotation.Nullable + public AssetTransferMethodEnum getAssetTransferMethod() { + return assetTransferMethod; + } + + public void setAssetTransferMethod( + @jakarta.annotation.Nullable AssetTransferMethodEnum assetTransferMethod) { + this.assetTransferMethod = assetTransferMethod; + } + + public B402PaymentKindExtraV1 facilitatorAddress( + @jakarta.annotation.Nullable String facilitatorAddress) { + this.facilitatorAddress = facilitatorAddress; + return this; + } + + /** + * Get facilitatorAddress + * + * @return facilitatorAddress + */ + @jakarta.annotation.Nullable + public String getFacilitatorAddress() { + return facilitatorAddress; + } + + public void setFacilitatorAddress(@jakarta.annotation.Nullable String facilitatorAddress) { + this.facilitatorAddress = facilitatorAddress; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402PaymentKindExtraV1 b402PaymentKindExtraV1 = (B402PaymentKindExtraV1) o; + return Objects.equals(this.name, b402PaymentKindExtraV1.name) + && Objects.equals(this.version, b402PaymentKindExtraV1.version) + && Objects.equals( + this.assetTransferMethod, b402PaymentKindExtraV1.assetTransferMethod) + && Objects.equals( + this.facilitatorAddress, b402PaymentKindExtraV1.facilitatorAddress); + } + + @Override + public int hashCode() { + return Objects.hash(name, version, assetTransferMethod, facilitatorAddress); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402PaymentKindExtraV1 {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).append("\n"); + sb.append(" assetTransferMethod: ") + .append(toIndentedString(assetTransferMethod)) + .append("\n"); + sb.append(" facilitatorAddress: ") + .append(toIndentedString(facilitatorAddress)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object nameValue = getName(); + String nameValueAsString = ""; + nameValueAsString = nameValue.toString(); + sb.append("name=").append(urlEncode(nameValueAsString)).append(""); + Object versionValue = getVersion(); + String versionValueAsString = ""; + versionValueAsString = versionValue.toString(); + sb.append("version=").append(urlEncode(versionValueAsString)).append(""); + Object assetTransferMethodValue = getAssetTransferMethod(); + String assetTransferMethodValueAsString = ""; + assetTransferMethodValueAsString = assetTransferMethodValue.toString(); + sb.append("assetTransferMethod=") + .append(urlEncode(assetTransferMethodValueAsString)) + .append(""); + Object facilitatorAddressValue = getFacilitatorAddress(); + String facilitatorAddressValueAsString = ""; + facilitatorAddressValueAsString = facilitatorAddressValue.toString(); + sb.append("facilitatorAddress=") + .append(urlEncode(facilitatorAddressValueAsString)) + .append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("version"); + openapiFields.add("assetTransferMethod"); + openapiFields.add("facilitatorAddress"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to B402PaymentKindExtraV1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402PaymentKindExtraV1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in B402PaymentKindExtraV1 is not found in" + + " the empty JSON string", + B402PaymentKindExtraV1.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) + && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `name` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("name").toString())); + } + if ((jsonObj.get("version") != null && !jsonObj.get("version").isJsonNull()) + && !jsonObj.get("version").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `version` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("version").toString())); + } + if ((jsonObj.get("assetTransferMethod") != null + && !jsonObj.get("assetTransferMethod").isJsonNull()) + && !jsonObj.get("assetTransferMethod").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `assetTransferMethod` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("assetTransferMethod").toString())); + } + // validate the optional field `assetTransferMethod` + if (jsonObj.get("assetTransferMethod") != null + && !jsonObj.get("assetTransferMethod").isJsonNull()) { + AssetTransferMethodEnum.validateJsonElement(jsonObj.get("assetTransferMethod")); + } + if ((jsonObj.get("facilitatorAddress") != null + && !jsonObj.get("facilitatorAddress").isJsonNull()) + && !jsonObj.get("facilitatorAddress").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `facilitatorAddress` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("facilitatorAddress").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402PaymentKindExtraV1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'B402PaymentKindExtraV1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(B402PaymentKindExtraV1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, B402PaymentKindExtraV1 value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402PaymentKindExtraV1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402PaymentKindExtraV1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of B402PaymentKindExtraV1 + * @throws IOException if the JSON string is invalid with respect to B402PaymentKindExtraV1 + */ + public static B402PaymentKindExtraV1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, B402PaymentKindExtraV1.class); + } + + /** + * Convert an instance of B402PaymentKindExtraV1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402PaymentKindExtraV2.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402PaymentKindExtraV2.java new file mode 100644 index 0000000..9d3cf91 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402PaymentKindExtraV2.java @@ -0,0 +1,467 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** B402PaymentKindExtraV2 */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402PaymentKindExtraV2 { + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @jakarta.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_VERSION = "version"; + + @SerializedName(SERIALIZED_NAME_VERSION) + @jakarta.annotation.Nonnull + private String version; + + /** Gets or Sets assetTransferMethod */ + @JsonAdapter(AssetTransferMethodEnum.Adapter.class) + public enum AssetTransferMethodEnum { + EIP3009("eip3009"), + + PERMIT2_EXACT("permit2-exact"), + + PERMIT2_UPTO("permit2-upto"); + + private String value; + + AssetTransferMethodEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static AssetTransferMethodEnum fromValue(String value) { + for (AssetTransferMethodEnum b : AssetTransferMethodEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write( + final JsonWriter jsonWriter, final AssetTransferMethodEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public AssetTransferMethodEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return AssetTransferMethodEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + AssetTransferMethodEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_ASSET_TRANSFER_METHOD = "assetTransferMethod"; + + @SerializedName(SERIALIZED_NAME_ASSET_TRANSFER_METHOD) + @jakarta.annotation.Nonnull + private AssetTransferMethodEnum assetTransferMethod; + + public static final String SERIALIZED_NAME_SIGNER_ADDRESS = "signerAddress"; + + @SerializedName(SERIALIZED_NAME_SIGNER_ADDRESS) + @jakarta.annotation.Nonnull + private String signerAddress; + + public static final String SERIALIZED_NAME_SPENDER_ADDRESS = "spenderAddress"; + + @SerializedName(SERIALIZED_NAME_SPENDER_ADDRESS) + @jakarta.annotation.Nullable + private String spenderAddress; + + public B402PaymentKindExtraV2() {} + + public B402PaymentKindExtraV2 name(@jakarta.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * + * @return name + */ + @jakarta.annotation.Nonnull + @NotNull + public String getName() { + return name; + } + + public void setName(@jakarta.annotation.Nonnull String name) { + this.name = name; + } + + public B402PaymentKindExtraV2 version(@jakarta.annotation.Nonnull String version) { + this.version = version; + return this; + } + + /** + * Get version + * + * @return version + */ + @jakarta.annotation.Nonnull + @NotNull + public String getVersion() { + return version; + } + + public void setVersion(@jakarta.annotation.Nonnull String version) { + this.version = version; + } + + public B402PaymentKindExtraV2 assetTransferMethod( + @jakarta.annotation.Nonnull AssetTransferMethodEnum assetTransferMethod) { + this.assetTransferMethod = assetTransferMethod; + return this; + } + + /** + * Get assetTransferMethod + * + * @return assetTransferMethod + */ + @jakarta.annotation.Nonnull + @NotNull + public AssetTransferMethodEnum getAssetTransferMethod() { + return assetTransferMethod; + } + + public void setAssetTransferMethod( + @jakarta.annotation.Nonnull AssetTransferMethodEnum assetTransferMethod) { + this.assetTransferMethod = assetTransferMethod; + } + + public B402PaymentKindExtraV2 signerAddress(@jakarta.annotation.Nonnull String signerAddress) { + this.signerAddress = signerAddress; + return this; + } + + /** + * Get signerAddress + * + * @return signerAddress + */ + @jakarta.annotation.Nonnull + @NotNull + public String getSignerAddress() { + return signerAddress; + } + + public void setSignerAddress(@jakarta.annotation.Nonnull String signerAddress) { + this.signerAddress = signerAddress; + } + + public B402PaymentKindExtraV2 spenderAddress( + @jakarta.annotation.Nullable String spenderAddress) { + this.spenderAddress = spenderAddress; + return this; + } + + /** + * Get spenderAddress + * + * @return spenderAddress + */ + @jakarta.annotation.Nullable + public String getSpenderAddress() { + return spenderAddress; + } + + public void setSpenderAddress(@jakarta.annotation.Nullable String spenderAddress) { + this.spenderAddress = spenderAddress; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402PaymentKindExtraV2 b402PaymentKindExtraV2 = (B402PaymentKindExtraV2) o; + return Objects.equals(this.name, b402PaymentKindExtraV2.name) + && Objects.equals(this.version, b402PaymentKindExtraV2.version) + && Objects.equals( + this.assetTransferMethod, b402PaymentKindExtraV2.assetTransferMethod) + && Objects.equals(this.signerAddress, b402PaymentKindExtraV2.signerAddress) + && Objects.equals(this.spenderAddress, b402PaymentKindExtraV2.spenderAddress); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(name, version, assetTransferMethod, signerAddress, spenderAddress); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402PaymentKindExtraV2 {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).append("\n"); + sb.append(" assetTransferMethod: ") + .append(toIndentedString(assetTransferMethod)) + .append("\n"); + sb.append(" signerAddress: ").append(toIndentedString(signerAddress)).append("\n"); + sb.append(" spenderAddress: ").append(toIndentedString(spenderAddress)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object nameValue = getName(); + String nameValueAsString = ""; + nameValueAsString = nameValue.toString(); + sb.append("name=").append(urlEncode(nameValueAsString)).append(""); + Object versionValue = getVersion(); + String versionValueAsString = ""; + versionValueAsString = versionValue.toString(); + sb.append("version=").append(urlEncode(versionValueAsString)).append(""); + Object assetTransferMethodValue = getAssetTransferMethod(); + String assetTransferMethodValueAsString = ""; + assetTransferMethodValueAsString = assetTransferMethodValue.toString(); + sb.append("assetTransferMethod=") + .append(urlEncode(assetTransferMethodValueAsString)) + .append(""); + Object signerAddressValue = getSignerAddress(); + String signerAddressValueAsString = ""; + signerAddressValueAsString = signerAddressValue.toString(); + sb.append("signerAddress=").append(urlEncode(signerAddressValueAsString)).append(""); + Object spenderAddressValue = getSpenderAddress(); + String spenderAddressValueAsString = ""; + spenderAddressValueAsString = spenderAddressValue.toString(); + sb.append("spenderAddress=").append(urlEncode(spenderAddressValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("version"); + openapiFields.add("assetTransferMethod"); + openapiFields.add("signerAddress"); + openapiFields.add("spenderAddress"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("version"); + openapiRequiredFields.add("assetTransferMethod"); + openapiRequiredFields.add("signerAddress"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to B402PaymentKindExtraV2 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402PaymentKindExtraV2.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in B402PaymentKindExtraV2 is not found in" + + " the empty JSON string", + B402PaymentKindExtraV2.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : B402PaymentKindExtraV2.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `name` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("name").toString())); + } + if (!jsonObj.get("version").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `version` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("version").toString())); + } + if (!jsonObj.get("assetTransferMethod").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `assetTransferMethod` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("assetTransferMethod").toString())); + } + // validate the required field `assetTransferMethod` + AssetTransferMethodEnum.validateJsonElement(jsonObj.get("assetTransferMethod")); + if (!jsonObj.get("signerAddress").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `signerAddress` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("signerAddress").toString())); + } + if ((jsonObj.get("spenderAddress") != null && !jsonObj.get("spenderAddress").isJsonNull()) + && !jsonObj.get("spenderAddress").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `spenderAddress` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("spenderAddress").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402PaymentKindExtraV2.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'B402PaymentKindExtraV2' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(B402PaymentKindExtraV2.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, B402PaymentKindExtraV2 value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402PaymentKindExtraV2 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402PaymentKindExtraV2 given an JSON string + * + * @param jsonString JSON string + * @return An instance of B402PaymentKindExtraV2 + * @throws IOException if the JSON string is invalid with respect to B402PaymentKindExtraV2 + */ + public static B402PaymentKindExtraV2 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, B402PaymentKindExtraV2.class); + } + + /** + * Convert an instance of B402PaymentKindExtraV2 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402PaymentKindV1.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402PaymentKindV1.java new file mode 100644 index 0000000..1835e9e --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402PaymentKindV1.java @@ -0,0 +1,427 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** B402PaymentKindV1 */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402PaymentKindV1 { + /** Gets or Sets x402Version */ + @JsonAdapter(X402VersionEnum.Adapter.class) + public enum X402VersionEnum { + X402_VERSION_1(1); + + private Integer value; + + X402VersionEnum(Integer value) { + this.value = value; + } + + public Integer getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static X402VersionEnum fromValue(Integer value) { + for (X402VersionEnum b : X402VersionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final X402VersionEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public X402VersionEnum read(final JsonReader jsonReader) throws IOException { + Integer value = jsonReader.nextInt(); + return X402VersionEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + Integer value = jsonElement.getAsInt(); + X402VersionEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_X402_VERSION = "x402Version"; + + @SerializedName(SERIALIZED_NAME_X402_VERSION) + @jakarta.annotation.Nullable + private X402VersionEnum x402Version; + + /** Gets or Sets scheme */ + @JsonAdapter(SchemeEnum.Adapter.class) + public enum SchemeEnum { + exact("exact"); + + private String value; + + SchemeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static SchemeEnum fromValue(String value) { + for (SchemeEnum b : SchemeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final SchemeEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public SchemeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return SchemeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + SchemeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_SCHEME = "scheme"; + + @SerializedName(SERIALIZED_NAME_SCHEME) + @jakarta.annotation.Nullable + private SchemeEnum scheme; + + public static final String SERIALIZED_NAME_NETWORK = "network"; + + @SerializedName(SERIALIZED_NAME_NETWORK) + @jakarta.annotation.Nullable + private String network; + + public static final String SERIALIZED_NAME_EXTRA = "extra"; + + @SerializedName(SERIALIZED_NAME_EXTRA) + @jakarta.annotation.Nullable + private B402PaymentKindV1Extra extra; + + public B402PaymentKindV1() {} + + public B402PaymentKindV1 x402Version(@jakarta.annotation.Nullable X402VersionEnum x402Version) { + this.x402Version = x402Version; + return this; + } + + /** + * Get x402Version + * + * @return x402Version + */ + @jakarta.annotation.Nullable + public X402VersionEnum getX402Version() { + return x402Version; + } + + public void setX402Version(@jakarta.annotation.Nullable X402VersionEnum x402Version) { + this.x402Version = x402Version; + } + + public B402PaymentKindV1 scheme(@jakarta.annotation.Nullable SchemeEnum scheme) { + this.scheme = scheme; + return this; + } + + /** + * Get scheme + * + * @return scheme + */ + @jakarta.annotation.Nullable + public SchemeEnum getScheme() { + return scheme; + } + + public void setScheme(@jakarta.annotation.Nullable SchemeEnum scheme) { + this.scheme = scheme; + } + + public B402PaymentKindV1 network(@jakarta.annotation.Nullable String network) { + this.network = network; + return this; + } + + /** + * Get network + * + * @return network + */ + @jakarta.annotation.Nullable + public String getNetwork() { + return network; + } + + public void setNetwork(@jakarta.annotation.Nullable String network) { + this.network = network; + } + + public B402PaymentKindV1 extra(@jakarta.annotation.Nullable B402PaymentKindV1Extra extra) { + this.extra = extra; + return this; + } + + /** + * Get extra + * + * @return extra + */ + @jakarta.annotation.Nullable + @Valid + public B402PaymentKindV1Extra getExtra() { + return extra; + } + + public void setExtra(@jakarta.annotation.Nullable B402PaymentKindV1Extra extra) { + this.extra = extra; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402PaymentKindV1 b402PaymentKindV1 = (B402PaymentKindV1) o; + return Objects.equals(this.x402Version, b402PaymentKindV1.x402Version) + && Objects.equals(this.scheme, b402PaymentKindV1.scheme) + && Objects.equals(this.network, b402PaymentKindV1.network) + && Objects.equals(this.extra, b402PaymentKindV1.extra); + } + + @Override + public int hashCode() { + return Objects.hash(x402Version, scheme, network, extra); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402PaymentKindV1 {\n"); + sb.append(" x402Version: ").append(toIndentedString(x402Version)).append("\n"); + sb.append(" scheme: ").append(toIndentedString(scheme)).append("\n"); + sb.append(" network: ").append(toIndentedString(network)).append("\n"); + sb.append(" extra: ").append(toIndentedString(extra)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object x402VersionValue = getX402Version(); + String x402VersionValueAsString = ""; + x402VersionValueAsString = x402VersionValue.toString(); + sb.append("x402Version=").append(urlEncode(x402VersionValueAsString)).append(""); + Object schemeValue = getScheme(); + String schemeValueAsString = ""; + schemeValueAsString = schemeValue.toString(); + sb.append("scheme=").append(urlEncode(schemeValueAsString)).append(""); + Object networkValue = getNetwork(); + String networkValueAsString = ""; + networkValueAsString = networkValue.toString(); + sb.append("network=").append(urlEncode(networkValueAsString)).append(""); + Object extraValue = getExtra(); + String extraValueAsString = ""; + extraValueAsString = extraValue.toString(); + sb.append("extra=").append(urlEncode(extraValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("x402Version"); + openapiFields.add("scheme"); + openapiFields.add("network"); + openapiFields.add("extra"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to B402PaymentKindV1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402PaymentKindV1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in B402PaymentKindV1 is not found in the" + + " empty JSON string", + B402PaymentKindV1.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `x402Version` + if (jsonObj.get("x402Version") != null && !jsonObj.get("x402Version").isJsonNull()) { + X402VersionEnum.validateJsonElement(jsonObj.get("x402Version")); + } + if ((jsonObj.get("scheme") != null && !jsonObj.get("scheme").isJsonNull()) + && !jsonObj.get("scheme").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `scheme` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("scheme").toString())); + } + // validate the optional field `scheme` + if (jsonObj.get("scheme") != null && !jsonObj.get("scheme").isJsonNull()) { + SchemeEnum.validateJsonElement(jsonObj.get("scheme")); + } + if ((jsonObj.get("network") != null && !jsonObj.get("network").isJsonNull()) + && !jsonObj.get("network").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `network` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("network").toString())); + } + // validate the optional field `extra` + if (jsonObj.get("extra") != null && !jsonObj.get("extra").isJsonNull()) { + B402PaymentKindV1Extra.validateJsonElement(jsonObj.get("extra")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402PaymentKindV1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'B402PaymentKindV1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(B402PaymentKindV1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, B402PaymentKindV1 value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402PaymentKindV1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402PaymentKindV1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of B402PaymentKindV1 + * @throws IOException if the JSON string is invalid with respect to B402PaymentKindV1 + */ + public static B402PaymentKindV1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, B402PaymentKindV1.class); + } + + /** + * Convert an instance of B402PaymentKindV1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402PaymentKindV1Extra.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402PaymentKindV1Extra.java new file mode 100644 index 0000000..8659db7 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402PaymentKindV1Extra.java @@ -0,0 +1,405 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** B402PaymentKindV1Extra */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402PaymentKindV1Extra { + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @jakarta.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_VERSION = "version"; + + @SerializedName(SERIALIZED_NAME_VERSION) + @jakarta.annotation.Nullable + private String version; + + /** Gets or Sets assetTransferMethod */ + @JsonAdapter(AssetTransferMethodEnum.Adapter.class) + public enum AssetTransferMethodEnum { + EIP3009("eip3009"), + + PERMIT2_EXACT("permit2-exact"), + + PERMIT2_UPTO("permit2-upto"); + + private String value; + + AssetTransferMethodEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static AssetTransferMethodEnum fromValue(String value) { + for (AssetTransferMethodEnum b : AssetTransferMethodEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write( + final JsonWriter jsonWriter, final AssetTransferMethodEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public AssetTransferMethodEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return AssetTransferMethodEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + AssetTransferMethodEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_ASSET_TRANSFER_METHOD = "assetTransferMethod"; + + @SerializedName(SERIALIZED_NAME_ASSET_TRANSFER_METHOD) + @jakarta.annotation.Nullable + private AssetTransferMethodEnum assetTransferMethod; + + public static final String SERIALIZED_NAME_FACILITATOR_ADDRESS = "facilitatorAddress"; + + @SerializedName(SERIALIZED_NAME_FACILITATOR_ADDRESS) + @jakarta.annotation.Nullable + private String facilitatorAddress; + + public B402PaymentKindV1Extra() {} + + public B402PaymentKindV1Extra name(@jakarta.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * + * @return name + */ + @jakarta.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@jakarta.annotation.Nullable String name) { + this.name = name; + } + + public B402PaymentKindV1Extra version(@jakarta.annotation.Nullable String version) { + this.version = version; + return this; + } + + /** + * Get version + * + * @return version + */ + @jakarta.annotation.Nullable + public String getVersion() { + return version; + } + + public void setVersion(@jakarta.annotation.Nullable String version) { + this.version = version; + } + + public B402PaymentKindV1Extra assetTransferMethod( + @jakarta.annotation.Nullable AssetTransferMethodEnum assetTransferMethod) { + this.assetTransferMethod = assetTransferMethod; + return this; + } + + /** + * Get assetTransferMethod + * + * @return assetTransferMethod + */ + @jakarta.annotation.Nullable + public AssetTransferMethodEnum getAssetTransferMethod() { + return assetTransferMethod; + } + + public void setAssetTransferMethod( + @jakarta.annotation.Nullable AssetTransferMethodEnum assetTransferMethod) { + this.assetTransferMethod = assetTransferMethod; + } + + public B402PaymentKindV1Extra facilitatorAddress( + @jakarta.annotation.Nullable String facilitatorAddress) { + this.facilitatorAddress = facilitatorAddress; + return this; + } + + /** + * Get facilitatorAddress + * + * @return facilitatorAddress + */ + @jakarta.annotation.Nullable + public String getFacilitatorAddress() { + return facilitatorAddress; + } + + public void setFacilitatorAddress(@jakarta.annotation.Nullable String facilitatorAddress) { + this.facilitatorAddress = facilitatorAddress; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402PaymentKindV1Extra b402PaymentKindV1Extra = (B402PaymentKindV1Extra) o; + return Objects.equals(this.name, b402PaymentKindV1Extra.name) + && Objects.equals(this.version, b402PaymentKindV1Extra.version) + && Objects.equals( + this.assetTransferMethod, b402PaymentKindV1Extra.assetTransferMethod) + && Objects.equals( + this.facilitatorAddress, b402PaymentKindV1Extra.facilitatorAddress); + } + + @Override + public int hashCode() { + return Objects.hash(name, version, assetTransferMethod, facilitatorAddress); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402PaymentKindV1Extra {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).append("\n"); + sb.append(" assetTransferMethod: ") + .append(toIndentedString(assetTransferMethod)) + .append("\n"); + sb.append(" facilitatorAddress: ") + .append(toIndentedString(facilitatorAddress)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object nameValue = getName(); + String nameValueAsString = ""; + nameValueAsString = nameValue.toString(); + sb.append("name=").append(urlEncode(nameValueAsString)).append(""); + Object versionValue = getVersion(); + String versionValueAsString = ""; + versionValueAsString = versionValue.toString(); + sb.append("version=").append(urlEncode(versionValueAsString)).append(""); + Object assetTransferMethodValue = getAssetTransferMethod(); + String assetTransferMethodValueAsString = ""; + assetTransferMethodValueAsString = assetTransferMethodValue.toString(); + sb.append("assetTransferMethod=") + .append(urlEncode(assetTransferMethodValueAsString)) + .append(""); + Object facilitatorAddressValue = getFacilitatorAddress(); + String facilitatorAddressValueAsString = ""; + facilitatorAddressValueAsString = facilitatorAddressValue.toString(); + sb.append("facilitatorAddress=") + .append(urlEncode(facilitatorAddressValueAsString)) + .append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("version"); + openapiFields.add("assetTransferMethod"); + openapiFields.add("facilitatorAddress"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to B402PaymentKindV1Extra + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402PaymentKindV1Extra.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in B402PaymentKindV1Extra is not found in" + + " the empty JSON string", + B402PaymentKindV1Extra.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) + && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `name` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("name").toString())); + } + if ((jsonObj.get("version") != null && !jsonObj.get("version").isJsonNull()) + && !jsonObj.get("version").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `version` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("version").toString())); + } + if ((jsonObj.get("assetTransferMethod") != null + && !jsonObj.get("assetTransferMethod").isJsonNull()) + && !jsonObj.get("assetTransferMethod").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `assetTransferMethod` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("assetTransferMethod").toString())); + } + // validate the optional field `assetTransferMethod` + if (jsonObj.get("assetTransferMethod") != null + && !jsonObj.get("assetTransferMethod").isJsonNull()) { + AssetTransferMethodEnum.validateJsonElement(jsonObj.get("assetTransferMethod")); + } + if ((jsonObj.get("facilitatorAddress") != null + && !jsonObj.get("facilitatorAddress").isJsonNull()) + && !jsonObj.get("facilitatorAddress").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `facilitatorAddress` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("facilitatorAddress").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402PaymentKindV1Extra.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'B402PaymentKindV1Extra' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(B402PaymentKindV1Extra.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, B402PaymentKindV1Extra value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402PaymentKindV1Extra read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402PaymentKindV1Extra given an JSON string + * + * @param jsonString JSON string + * @return An instance of B402PaymentKindV1Extra + * @throws IOException if the JSON string is invalid with respect to B402PaymentKindV1Extra + */ + public static B402PaymentKindV1Extra fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, B402PaymentKindV1Extra.class); + } + + /** + * Convert an instance of B402PaymentKindV1Extra to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402PaymentKindV2.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402PaymentKindV2.java new file mode 100644 index 0000000..4d03ef7 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402PaymentKindV2.java @@ -0,0 +1,439 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** B402PaymentKindV2 */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402PaymentKindV2 { + /** Gets or Sets x402Version */ + @JsonAdapter(X402VersionEnum.Adapter.class) + public enum X402VersionEnum { + X402_VERSION_2(2); + + private Integer value; + + X402VersionEnum(Integer value) { + this.value = value; + } + + public Integer getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static X402VersionEnum fromValue(Integer value) { + for (X402VersionEnum b : X402VersionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final X402VersionEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public X402VersionEnum read(final JsonReader jsonReader) throws IOException { + Integer value = jsonReader.nextInt(); + return X402VersionEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + Integer value = jsonElement.getAsInt(); + X402VersionEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_X402_VERSION = "x402Version"; + + @SerializedName(SERIALIZED_NAME_X402_VERSION) + @jakarta.annotation.Nonnull + private X402VersionEnum x402Version; + + /** Gets or Sets scheme */ + @JsonAdapter(SchemeEnum.Adapter.class) + public enum SchemeEnum { + exact("exact"), + + upto("upto"); + + private String value; + + SchemeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static SchemeEnum fromValue(String value) { + for (SchemeEnum b : SchemeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final SchemeEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public SchemeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return SchemeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + SchemeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_SCHEME = "scheme"; + + @SerializedName(SERIALIZED_NAME_SCHEME) + @jakarta.annotation.Nonnull + private SchemeEnum scheme; + + public static final String SERIALIZED_NAME_NETWORK = "network"; + + @SerializedName(SERIALIZED_NAME_NETWORK) + @jakarta.annotation.Nonnull + private String network; + + public static final String SERIALIZED_NAME_EXTRA = "extra"; + + @SerializedName(SERIALIZED_NAME_EXTRA) + @jakarta.annotation.Nonnull + private B402PaymentKindV2Extra extra; + + public B402PaymentKindV2() {} + + public B402PaymentKindV2 x402Version(@jakarta.annotation.Nonnull X402VersionEnum x402Version) { + this.x402Version = x402Version; + return this; + } + + /** + * Get x402Version + * + * @return x402Version + */ + @jakarta.annotation.Nonnull + @NotNull + public X402VersionEnum getX402Version() { + return x402Version; + } + + public void setX402Version(@jakarta.annotation.Nonnull X402VersionEnum x402Version) { + this.x402Version = x402Version; + } + + public B402PaymentKindV2 scheme(@jakarta.annotation.Nonnull SchemeEnum scheme) { + this.scheme = scheme; + return this; + } + + /** + * Get scheme + * + * @return scheme + */ + @jakarta.annotation.Nonnull + @NotNull + public SchemeEnum getScheme() { + return scheme; + } + + public void setScheme(@jakarta.annotation.Nonnull SchemeEnum scheme) { + this.scheme = scheme; + } + + public B402PaymentKindV2 network(@jakarta.annotation.Nonnull String network) { + this.network = network; + return this; + } + + /** + * Get network + * + * @return network + */ + @jakarta.annotation.Nonnull + @NotNull + public String getNetwork() { + return network; + } + + public void setNetwork(@jakarta.annotation.Nonnull String network) { + this.network = network; + } + + public B402PaymentKindV2 extra(@jakarta.annotation.Nonnull B402PaymentKindV2Extra extra) { + this.extra = extra; + return this; + } + + /** + * Get extra + * + * @return extra + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public B402PaymentKindV2Extra getExtra() { + return extra; + } + + public void setExtra(@jakarta.annotation.Nonnull B402PaymentKindV2Extra extra) { + this.extra = extra; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402PaymentKindV2 b402PaymentKindV2 = (B402PaymentKindV2) o; + return Objects.equals(this.x402Version, b402PaymentKindV2.x402Version) + && Objects.equals(this.scheme, b402PaymentKindV2.scheme) + && Objects.equals(this.network, b402PaymentKindV2.network) + && Objects.equals(this.extra, b402PaymentKindV2.extra); + } + + @Override + public int hashCode() { + return Objects.hash(x402Version, scheme, network, extra); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402PaymentKindV2 {\n"); + sb.append(" x402Version: ").append(toIndentedString(x402Version)).append("\n"); + sb.append(" scheme: ").append(toIndentedString(scheme)).append("\n"); + sb.append(" network: ").append(toIndentedString(network)).append("\n"); + sb.append(" extra: ").append(toIndentedString(extra)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object x402VersionValue = getX402Version(); + String x402VersionValueAsString = ""; + x402VersionValueAsString = x402VersionValue.toString(); + sb.append("x402Version=").append(urlEncode(x402VersionValueAsString)).append(""); + Object schemeValue = getScheme(); + String schemeValueAsString = ""; + schemeValueAsString = schemeValue.toString(); + sb.append("scheme=").append(urlEncode(schemeValueAsString)).append(""); + Object networkValue = getNetwork(); + String networkValueAsString = ""; + networkValueAsString = networkValue.toString(); + sb.append("network=").append(urlEncode(networkValueAsString)).append(""); + Object extraValue = getExtra(); + String extraValueAsString = ""; + extraValueAsString = extraValue.toString(); + sb.append("extra=").append(urlEncode(extraValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("x402Version"); + openapiFields.add("scheme"); + openapiFields.add("network"); + openapiFields.add("extra"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("x402Version"); + openapiRequiredFields.add("scheme"); + openapiRequiredFields.add("network"); + openapiRequiredFields.add("extra"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to B402PaymentKindV2 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402PaymentKindV2.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in B402PaymentKindV2 is not found in the" + + " empty JSON string", + B402PaymentKindV2.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : B402PaymentKindV2.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `x402Version` + X402VersionEnum.validateJsonElement(jsonObj.get("x402Version")); + if (!jsonObj.get("scheme").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `scheme` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("scheme").toString())); + } + // validate the required field `scheme` + SchemeEnum.validateJsonElement(jsonObj.get("scheme")); + if (!jsonObj.get("network").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `network` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("network").toString())); + } + // validate the required field `extra` + B402PaymentKindV2Extra.validateJsonElement(jsonObj.get("extra")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402PaymentKindV2.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'B402PaymentKindV2' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(B402PaymentKindV2.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, B402PaymentKindV2 value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402PaymentKindV2 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402PaymentKindV2 given an JSON string + * + * @param jsonString JSON string + * @return An instance of B402PaymentKindV2 + * @throws IOException if the JSON string is invalid with respect to B402PaymentKindV2 + */ + public static B402PaymentKindV2 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, B402PaymentKindV2.class); + } + + /** + * Convert an instance of B402PaymentKindV2 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402PaymentKindV2Extra.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402PaymentKindV2Extra.java new file mode 100644 index 0000000..f63678a --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402PaymentKindV2Extra.java @@ -0,0 +1,467 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** B402PaymentKindV2Extra */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402PaymentKindV2Extra { + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @jakarta.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_VERSION = "version"; + + @SerializedName(SERIALIZED_NAME_VERSION) + @jakarta.annotation.Nonnull + private String version; + + /** Gets or Sets assetTransferMethod */ + @JsonAdapter(AssetTransferMethodEnum.Adapter.class) + public enum AssetTransferMethodEnum { + EIP3009("eip3009"), + + PERMIT2_EXACT("permit2-exact"), + + PERMIT2_UPTO("permit2-upto"); + + private String value; + + AssetTransferMethodEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static AssetTransferMethodEnum fromValue(String value) { + for (AssetTransferMethodEnum b : AssetTransferMethodEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write( + final JsonWriter jsonWriter, final AssetTransferMethodEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public AssetTransferMethodEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return AssetTransferMethodEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + AssetTransferMethodEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_ASSET_TRANSFER_METHOD = "assetTransferMethod"; + + @SerializedName(SERIALIZED_NAME_ASSET_TRANSFER_METHOD) + @jakarta.annotation.Nonnull + private AssetTransferMethodEnum assetTransferMethod; + + public static final String SERIALIZED_NAME_SIGNER_ADDRESS = "signerAddress"; + + @SerializedName(SERIALIZED_NAME_SIGNER_ADDRESS) + @jakarta.annotation.Nonnull + private String signerAddress; + + public static final String SERIALIZED_NAME_SPENDER_ADDRESS = "spenderAddress"; + + @SerializedName(SERIALIZED_NAME_SPENDER_ADDRESS) + @jakarta.annotation.Nullable + private String spenderAddress; + + public B402PaymentKindV2Extra() {} + + public B402PaymentKindV2Extra name(@jakarta.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * + * @return name + */ + @jakarta.annotation.Nonnull + @NotNull + public String getName() { + return name; + } + + public void setName(@jakarta.annotation.Nonnull String name) { + this.name = name; + } + + public B402PaymentKindV2Extra version(@jakarta.annotation.Nonnull String version) { + this.version = version; + return this; + } + + /** + * Get version + * + * @return version + */ + @jakarta.annotation.Nonnull + @NotNull + public String getVersion() { + return version; + } + + public void setVersion(@jakarta.annotation.Nonnull String version) { + this.version = version; + } + + public B402PaymentKindV2Extra assetTransferMethod( + @jakarta.annotation.Nonnull AssetTransferMethodEnum assetTransferMethod) { + this.assetTransferMethod = assetTransferMethod; + return this; + } + + /** + * Get assetTransferMethod + * + * @return assetTransferMethod + */ + @jakarta.annotation.Nonnull + @NotNull + public AssetTransferMethodEnum getAssetTransferMethod() { + return assetTransferMethod; + } + + public void setAssetTransferMethod( + @jakarta.annotation.Nonnull AssetTransferMethodEnum assetTransferMethod) { + this.assetTransferMethod = assetTransferMethod; + } + + public B402PaymentKindV2Extra signerAddress(@jakarta.annotation.Nonnull String signerAddress) { + this.signerAddress = signerAddress; + return this; + } + + /** + * Get signerAddress + * + * @return signerAddress + */ + @jakarta.annotation.Nonnull + @NotNull + public String getSignerAddress() { + return signerAddress; + } + + public void setSignerAddress(@jakarta.annotation.Nonnull String signerAddress) { + this.signerAddress = signerAddress; + } + + public B402PaymentKindV2Extra spenderAddress( + @jakarta.annotation.Nullable String spenderAddress) { + this.spenderAddress = spenderAddress; + return this; + } + + /** + * Get spenderAddress + * + * @return spenderAddress + */ + @jakarta.annotation.Nullable + public String getSpenderAddress() { + return spenderAddress; + } + + public void setSpenderAddress(@jakarta.annotation.Nullable String spenderAddress) { + this.spenderAddress = spenderAddress; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402PaymentKindV2Extra b402PaymentKindV2Extra = (B402PaymentKindV2Extra) o; + return Objects.equals(this.name, b402PaymentKindV2Extra.name) + && Objects.equals(this.version, b402PaymentKindV2Extra.version) + && Objects.equals( + this.assetTransferMethod, b402PaymentKindV2Extra.assetTransferMethod) + && Objects.equals(this.signerAddress, b402PaymentKindV2Extra.signerAddress) + && Objects.equals(this.spenderAddress, b402PaymentKindV2Extra.spenderAddress); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(name, version, assetTransferMethod, signerAddress, spenderAddress); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402PaymentKindV2Extra {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).append("\n"); + sb.append(" assetTransferMethod: ") + .append(toIndentedString(assetTransferMethod)) + .append("\n"); + sb.append(" signerAddress: ").append(toIndentedString(signerAddress)).append("\n"); + sb.append(" spenderAddress: ").append(toIndentedString(spenderAddress)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object nameValue = getName(); + String nameValueAsString = ""; + nameValueAsString = nameValue.toString(); + sb.append("name=").append(urlEncode(nameValueAsString)).append(""); + Object versionValue = getVersion(); + String versionValueAsString = ""; + versionValueAsString = versionValue.toString(); + sb.append("version=").append(urlEncode(versionValueAsString)).append(""); + Object assetTransferMethodValue = getAssetTransferMethod(); + String assetTransferMethodValueAsString = ""; + assetTransferMethodValueAsString = assetTransferMethodValue.toString(); + sb.append("assetTransferMethod=") + .append(urlEncode(assetTransferMethodValueAsString)) + .append(""); + Object signerAddressValue = getSignerAddress(); + String signerAddressValueAsString = ""; + signerAddressValueAsString = signerAddressValue.toString(); + sb.append("signerAddress=").append(urlEncode(signerAddressValueAsString)).append(""); + Object spenderAddressValue = getSpenderAddress(); + String spenderAddressValueAsString = ""; + spenderAddressValueAsString = spenderAddressValue.toString(); + sb.append("spenderAddress=").append(urlEncode(spenderAddressValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("version"); + openapiFields.add("assetTransferMethod"); + openapiFields.add("signerAddress"); + openapiFields.add("spenderAddress"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("version"); + openapiRequiredFields.add("assetTransferMethod"); + openapiRequiredFields.add("signerAddress"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to B402PaymentKindV2Extra + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402PaymentKindV2Extra.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in B402PaymentKindV2Extra is not found in" + + " the empty JSON string", + B402PaymentKindV2Extra.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : B402PaymentKindV2Extra.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `name` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("name").toString())); + } + if (!jsonObj.get("version").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `version` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("version").toString())); + } + if (!jsonObj.get("assetTransferMethod").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `assetTransferMethod` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("assetTransferMethod").toString())); + } + // validate the required field `assetTransferMethod` + AssetTransferMethodEnum.validateJsonElement(jsonObj.get("assetTransferMethod")); + if (!jsonObj.get("signerAddress").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `signerAddress` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("signerAddress").toString())); + } + if ((jsonObj.get("spenderAddress") != null && !jsonObj.get("spenderAddress").isJsonNull()) + && !jsonObj.get("spenderAddress").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `spenderAddress` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("spenderAddress").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402PaymentKindV2Extra.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'B402PaymentKindV2Extra' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(B402PaymentKindV2Extra.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, B402PaymentKindV2Extra value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402PaymentKindV2Extra read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402PaymentKindV2Extra given an JSON string + * + * @param jsonString JSON string + * @return An instance of B402PaymentKindV2Extra + * @throws IOException if the JSON string is invalid with respect to B402PaymentKindV2Extra + */ + public static B402PaymentKindV2Extra fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, B402PaymentKindV2Extra.class); + } + + /** + * Convert an instance of B402PaymentKindV2Extra to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402PaymentPayloadV1.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402PaymentPayloadV1.java new file mode 100644 index 0000000..fe5dc5c --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402PaymentPayloadV1.java @@ -0,0 +1,439 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** B402PaymentPayloadV1 */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402PaymentPayloadV1 { + /** Gets or Sets x402Version */ + @JsonAdapter(X402VersionEnum.Adapter.class) + public enum X402VersionEnum { + X402_VERSION_1(1); + + private Integer value; + + X402VersionEnum(Integer value) { + this.value = value; + } + + public Integer getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static X402VersionEnum fromValue(Integer value) { + for (X402VersionEnum b : X402VersionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final X402VersionEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public X402VersionEnum read(final JsonReader jsonReader) throws IOException { + Integer value = jsonReader.nextInt(); + return X402VersionEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + Integer value = jsonElement.getAsInt(); + X402VersionEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_X402_VERSION = "x402Version"; + + @SerializedName(SERIALIZED_NAME_X402_VERSION) + @jakarta.annotation.Nonnull + private X402VersionEnum x402Version; + + /** Gets or Sets scheme */ + @JsonAdapter(SchemeEnum.Adapter.class) + public enum SchemeEnum { + exact("exact"); + + private String value; + + SchemeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static SchemeEnum fromValue(String value) { + for (SchemeEnum b : SchemeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final SchemeEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public SchemeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return SchemeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + SchemeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_SCHEME = "scheme"; + + @SerializedName(SERIALIZED_NAME_SCHEME) + @jakarta.annotation.Nonnull + private SchemeEnum scheme; + + public static final String SERIALIZED_NAME_NETWORK = "network"; + + @SerializedName(SERIALIZED_NAME_NETWORK) + @jakarta.annotation.Nonnull + private String network; + + public static final String SERIALIZED_NAME_PAYLOAD = "payload"; + + @SerializedName(SERIALIZED_NAME_PAYLOAD) + @jakarta.annotation.Nonnull + private B402PaymentPayloadV2Payload payload; + + public B402PaymentPayloadV1() {} + + public B402PaymentPayloadV1 x402Version( + @jakarta.annotation.Nonnull X402VersionEnum x402Version) { + this.x402Version = x402Version; + return this; + } + + /** + * Get x402Version + * + * @return x402Version + */ + @jakarta.annotation.Nonnull + @NotNull + public X402VersionEnum getX402Version() { + return x402Version; + } + + public void setX402Version(@jakarta.annotation.Nonnull X402VersionEnum x402Version) { + this.x402Version = x402Version; + } + + public B402PaymentPayloadV1 scheme(@jakarta.annotation.Nonnull SchemeEnum scheme) { + this.scheme = scheme; + return this; + } + + /** + * Get scheme + * + * @return scheme + */ + @jakarta.annotation.Nonnull + @NotNull + public SchemeEnum getScheme() { + return scheme; + } + + public void setScheme(@jakarta.annotation.Nonnull SchemeEnum scheme) { + this.scheme = scheme; + } + + public B402PaymentPayloadV1 network(@jakarta.annotation.Nonnull String network) { + this.network = network; + return this; + } + + /** + * Get network + * + * @return network + */ + @jakarta.annotation.Nonnull + @NotNull + public String getNetwork() { + return network; + } + + public void setNetwork(@jakarta.annotation.Nonnull String network) { + this.network = network; + } + + public B402PaymentPayloadV1 payload( + @jakarta.annotation.Nonnull B402PaymentPayloadV2Payload payload) { + this.payload = payload; + return this; + } + + /** + * Get payload + * + * @return payload + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public B402PaymentPayloadV2Payload getPayload() { + return payload; + } + + public void setPayload(@jakarta.annotation.Nonnull B402PaymentPayloadV2Payload payload) { + this.payload = payload; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402PaymentPayloadV1 b402PaymentPayloadV1 = (B402PaymentPayloadV1) o; + return Objects.equals(this.x402Version, b402PaymentPayloadV1.x402Version) + && Objects.equals(this.scheme, b402PaymentPayloadV1.scheme) + && Objects.equals(this.network, b402PaymentPayloadV1.network) + && Objects.equals(this.payload, b402PaymentPayloadV1.payload); + } + + @Override + public int hashCode() { + return Objects.hash(x402Version, scheme, network, payload); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402PaymentPayloadV1 {\n"); + sb.append(" x402Version: ").append(toIndentedString(x402Version)).append("\n"); + sb.append(" scheme: ").append(toIndentedString(scheme)).append("\n"); + sb.append(" network: ").append(toIndentedString(network)).append("\n"); + sb.append(" payload: ").append(toIndentedString(payload)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object x402VersionValue = getX402Version(); + String x402VersionValueAsString = ""; + x402VersionValueAsString = x402VersionValue.toString(); + sb.append("x402Version=").append(urlEncode(x402VersionValueAsString)).append(""); + Object schemeValue = getScheme(); + String schemeValueAsString = ""; + schemeValueAsString = schemeValue.toString(); + sb.append("scheme=").append(urlEncode(schemeValueAsString)).append(""); + Object networkValue = getNetwork(); + String networkValueAsString = ""; + networkValueAsString = networkValue.toString(); + sb.append("network=").append(urlEncode(networkValueAsString)).append(""); + Object payloadValue = getPayload(); + String payloadValueAsString = ""; + payloadValueAsString = payloadValue.toString(); + sb.append("payload=").append(urlEncode(payloadValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("x402Version"); + openapiFields.add("scheme"); + openapiFields.add("network"); + openapiFields.add("payload"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("x402Version"); + openapiRequiredFields.add("scheme"); + openapiRequiredFields.add("network"); + openapiRequiredFields.add("payload"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to B402PaymentPayloadV1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402PaymentPayloadV1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in B402PaymentPayloadV1 is not found in" + + " the empty JSON string", + B402PaymentPayloadV1.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : B402PaymentPayloadV1.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `x402Version` + X402VersionEnum.validateJsonElement(jsonObj.get("x402Version")); + if (!jsonObj.get("scheme").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `scheme` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("scheme").toString())); + } + // validate the required field `scheme` + SchemeEnum.validateJsonElement(jsonObj.get("scheme")); + if (!jsonObj.get("network").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `network` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("network").toString())); + } + // validate the required field `payload` + B402PaymentPayloadV2Payload.validateJsonElement(jsonObj.get("payload")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402PaymentPayloadV1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'B402PaymentPayloadV1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(B402PaymentPayloadV1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, B402PaymentPayloadV1 value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402PaymentPayloadV1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402PaymentPayloadV1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of B402PaymentPayloadV1 + * @throws IOException if the JSON string is invalid with respect to B402PaymentPayloadV1 + */ + public static B402PaymentPayloadV1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, B402PaymentPayloadV1.class); + } + + /** + * Convert an instance of B402PaymentPayloadV1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402PaymentPayloadV2.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402PaymentPayloadV2.java new file mode 100644 index 0000000..f342f02 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402PaymentPayloadV2.java @@ -0,0 +1,417 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** B402PaymentPayloadV2 */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402PaymentPayloadV2 { + /** Gets or Sets x402Version */ + @JsonAdapter(X402VersionEnum.Adapter.class) + public enum X402VersionEnum { + X402_VERSION_2(2); + + private Integer value; + + X402VersionEnum(Integer value) { + this.value = value; + } + + public Integer getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static X402VersionEnum fromValue(Integer value) { + for (X402VersionEnum b : X402VersionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final X402VersionEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public X402VersionEnum read(final JsonReader jsonReader) throws IOException { + Integer value = jsonReader.nextInt(); + return X402VersionEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + Integer value = jsonElement.getAsInt(); + X402VersionEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_X402_VERSION = "x402Version"; + + @SerializedName(SERIALIZED_NAME_X402_VERSION) + @jakarta.annotation.Nonnull + private X402VersionEnum x402Version; + + public static final String SERIALIZED_NAME_RESOURCE = "resource"; + + @SerializedName(SERIALIZED_NAME_RESOURCE) + @jakarta.annotation.Nonnull + private B402PaymentPayloadV2Resource resource; + + public static final String SERIALIZED_NAME_ACCEPTED = "accepted"; + + @SerializedName(SERIALIZED_NAME_ACCEPTED) + @jakarta.annotation.Nonnull + private B402PaymentPayloadV2Accepted accepted; + + public static final String SERIALIZED_NAME_PAYLOAD = "payload"; + + @SerializedName(SERIALIZED_NAME_PAYLOAD) + @jakarta.annotation.Nonnull + private B402PaymentPayloadV2Payload payload; + + public static final String SERIALIZED_NAME_EXTENSIONS = "extensions"; + + @SerializedName(SERIALIZED_NAME_EXTENSIONS) + @jakarta.annotation.Nullable + private B402PaymentPayloadV2Extensions extensions; + + public B402PaymentPayloadV2() {} + + public B402PaymentPayloadV2 x402Version( + @jakarta.annotation.Nonnull X402VersionEnum x402Version) { + this.x402Version = x402Version; + return this; + } + + /** + * Get x402Version + * + * @return x402Version + */ + @jakarta.annotation.Nonnull + @NotNull + public X402VersionEnum getX402Version() { + return x402Version; + } + + public void setX402Version(@jakarta.annotation.Nonnull X402VersionEnum x402Version) { + this.x402Version = x402Version; + } + + public B402PaymentPayloadV2 resource( + @jakarta.annotation.Nonnull B402PaymentPayloadV2Resource resource) { + this.resource = resource; + return this; + } + + /** + * Get resource + * + * @return resource + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public B402PaymentPayloadV2Resource getResource() { + return resource; + } + + public void setResource(@jakarta.annotation.Nonnull B402PaymentPayloadV2Resource resource) { + this.resource = resource; + } + + public B402PaymentPayloadV2 accepted( + @jakarta.annotation.Nonnull B402PaymentPayloadV2Accepted accepted) { + this.accepted = accepted; + return this; + } + + /** + * Get accepted + * + * @return accepted + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public B402PaymentPayloadV2Accepted getAccepted() { + return accepted; + } + + public void setAccepted(@jakarta.annotation.Nonnull B402PaymentPayloadV2Accepted accepted) { + this.accepted = accepted; + } + + public B402PaymentPayloadV2 payload( + @jakarta.annotation.Nonnull B402PaymentPayloadV2Payload payload) { + this.payload = payload; + return this; + } + + /** + * Get payload + * + * @return payload + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public B402PaymentPayloadV2Payload getPayload() { + return payload; + } + + public void setPayload(@jakarta.annotation.Nonnull B402PaymentPayloadV2Payload payload) { + this.payload = payload; + } + + public B402PaymentPayloadV2 extensions( + @jakarta.annotation.Nullable B402PaymentPayloadV2Extensions extensions) { + this.extensions = extensions; + return this; + } + + /** + * Get extensions + * + * @return extensions + */ + @jakarta.annotation.Nullable + @Valid + public B402PaymentPayloadV2Extensions getExtensions() { + return extensions; + } + + public void setExtensions( + @jakarta.annotation.Nullable B402PaymentPayloadV2Extensions extensions) { + this.extensions = extensions; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402PaymentPayloadV2 b402PaymentPayloadV2 = (B402PaymentPayloadV2) o; + return Objects.equals(this.x402Version, b402PaymentPayloadV2.x402Version) + && Objects.equals(this.resource, b402PaymentPayloadV2.resource) + && Objects.equals(this.accepted, b402PaymentPayloadV2.accepted) + && Objects.equals(this.payload, b402PaymentPayloadV2.payload) + && Objects.equals(this.extensions, b402PaymentPayloadV2.extensions); + } + + @Override + public int hashCode() { + return Objects.hash(x402Version, resource, accepted, payload, extensions); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402PaymentPayloadV2 {\n"); + sb.append(" x402Version: ").append(toIndentedString(x402Version)).append("\n"); + sb.append(" resource: ").append(toIndentedString(resource)).append("\n"); + sb.append(" accepted: ").append(toIndentedString(accepted)).append("\n"); + sb.append(" payload: ").append(toIndentedString(payload)).append("\n"); + sb.append(" extensions: ").append(toIndentedString(extensions)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object x402VersionValue = getX402Version(); + String x402VersionValueAsString = ""; + x402VersionValueAsString = x402VersionValue.toString(); + sb.append("x402Version=").append(urlEncode(x402VersionValueAsString)).append(""); + Object resourceValue = getResource(); + String resourceValueAsString = ""; + resourceValueAsString = resourceValue.toString(); + sb.append("resource=").append(urlEncode(resourceValueAsString)).append(""); + Object acceptedValue = getAccepted(); + String acceptedValueAsString = ""; + acceptedValueAsString = acceptedValue.toString(); + sb.append("accepted=").append(urlEncode(acceptedValueAsString)).append(""); + Object payloadValue = getPayload(); + String payloadValueAsString = ""; + payloadValueAsString = payloadValue.toString(); + sb.append("payload=").append(urlEncode(payloadValueAsString)).append(""); + Object extensionsValue = getExtensions(); + String extensionsValueAsString = ""; + extensionsValueAsString = extensionsValue.toString(); + sb.append("extensions=").append(urlEncode(extensionsValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("x402Version"); + openapiFields.add("resource"); + openapiFields.add("accepted"); + openapiFields.add("payload"); + openapiFields.add("extensions"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("x402Version"); + openapiRequiredFields.add("resource"); + openapiRequiredFields.add("accepted"); + openapiRequiredFields.add("payload"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to B402PaymentPayloadV2 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402PaymentPayloadV2.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in B402PaymentPayloadV2 is not found in" + + " the empty JSON string", + B402PaymentPayloadV2.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : B402PaymentPayloadV2.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `x402Version` + X402VersionEnum.validateJsonElement(jsonObj.get("x402Version")); + // validate the required field `resource` + B402PaymentPayloadV2Resource.validateJsonElement(jsonObj.get("resource")); + // validate the required field `accepted` + B402PaymentPayloadV2Accepted.validateJsonElement(jsonObj.get("accepted")); + // validate the required field `payload` + B402PaymentPayloadV2Payload.validateJsonElement(jsonObj.get("payload")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402PaymentPayloadV2.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'B402PaymentPayloadV2' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(B402PaymentPayloadV2.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, B402PaymentPayloadV2 value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402PaymentPayloadV2 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402PaymentPayloadV2 given an JSON string + * + * @param jsonString JSON string + * @return An instance of B402PaymentPayloadV2 + * @throws IOException if the JSON string is invalid with respect to B402PaymentPayloadV2 + */ + public static B402PaymentPayloadV2 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, B402PaymentPayloadV2.class); + } + + /** + * Convert an instance of B402PaymentPayloadV2 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402PaymentPayloadV2Accepted.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402PaymentPayloadV2Accepted.java new file mode 100644 index 0000000..2c59fc3 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402PaymentPayloadV2Accepted.java @@ -0,0 +1,522 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** B402PaymentPayloadV2Accepted */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402PaymentPayloadV2Accepted { + /** Gets or Sets scheme */ + @JsonAdapter(SchemeEnum.Adapter.class) + public enum SchemeEnum { + exact("exact"), + + upto("upto"); + + private String value; + + SchemeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static SchemeEnum fromValue(String value) { + for (SchemeEnum b : SchemeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final SchemeEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public SchemeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return SchemeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + SchemeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_SCHEME = "scheme"; + + @SerializedName(SERIALIZED_NAME_SCHEME) + @jakarta.annotation.Nonnull + private SchemeEnum scheme; + + public static final String SERIALIZED_NAME_NETWORK = "network"; + + @SerializedName(SERIALIZED_NAME_NETWORK) + @jakarta.annotation.Nonnull + private String network; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + + @SerializedName(SERIALIZED_NAME_AMOUNT) + @jakarta.annotation.Nonnull + private String amount; + + public static final String SERIALIZED_NAME_ASSET = "asset"; + + @SerializedName(SERIALIZED_NAME_ASSET) + @jakarta.annotation.Nonnull + private String asset; + + public static final String SERIALIZED_NAME_PAY_TO = "payTo"; + + @SerializedName(SERIALIZED_NAME_PAY_TO) + @jakarta.annotation.Nonnull + private String payTo; + + public static final String SERIALIZED_NAME_MAX_TIMEOUT_SECONDS = "maxTimeoutSeconds"; + + @SerializedName(SERIALIZED_NAME_MAX_TIMEOUT_SECONDS) + @jakarta.annotation.Nonnull + private Integer maxTimeoutSeconds; + + public static final String SERIALIZED_NAME_EXTRA = "extra"; + + @SerializedName(SERIALIZED_NAME_EXTRA) + @jakarta.annotation.Nonnull + private B402PaymentRequirementsV2Extra extra; + + public B402PaymentPayloadV2Accepted() {} + + public B402PaymentPayloadV2Accepted scheme(@jakarta.annotation.Nonnull SchemeEnum scheme) { + this.scheme = scheme; + return this; + } + + /** + * Get scheme + * + * @return scheme + */ + @jakarta.annotation.Nonnull + @NotNull + public SchemeEnum getScheme() { + return scheme; + } + + public void setScheme(@jakarta.annotation.Nonnull SchemeEnum scheme) { + this.scheme = scheme; + } + + public B402PaymentPayloadV2Accepted network(@jakarta.annotation.Nonnull String network) { + this.network = network; + return this; + } + + /** + * Get network + * + * @return network + */ + @jakarta.annotation.Nonnull + @NotNull + public String getNetwork() { + return network; + } + + public void setNetwork(@jakarta.annotation.Nonnull String network) { + this.network = network; + } + + public B402PaymentPayloadV2Accepted amount(@jakarta.annotation.Nonnull String amount) { + this.amount = amount; + return this; + } + + /** + * Get amount + * + * @return amount + */ + @jakarta.annotation.Nonnull + @NotNull + @Pattern(regexp = "^[0-9]+$") + public String getAmount() { + return amount; + } + + public void setAmount(@jakarta.annotation.Nonnull String amount) { + this.amount = amount; + } + + public B402PaymentPayloadV2Accepted asset(@jakarta.annotation.Nonnull String asset) { + this.asset = asset; + return this; + } + + /** + * Get asset + * + * @return asset + */ + @jakarta.annotation.Nonnull + @NotNull + public String getAsset() { + return asset; + } + + public void setAsset(@jakarta.annotation.Nonnull String asset) { + this.asset = asset; + } + + public B402PaymentPayloadV2Accepted payTo(@jakarta.annotation.Nonnull String payTo) { + this.payTo = payTo; + return this; + } + + /** + * Get payTo + * + * @return payTo + */ + @jakarta.annotation.Nonnull + @NotNull + public String getPayTo() { + return payTo; + } + + public void setPayTo(@jakarta.annotation.Nonnull String payTo) { + this.payTo = payTo; + } + + public B402PaymentPayloadV2Accepted maxTimeoutSeconds( + @jakarta.annotation.Nonnull Integer maxTimeoutSeconds) { + this.maxTimeoutSeconds = maxTimeoutSeconds; + return this; + } + + /** + * Get maxTimeoutSeconds + * + * @return maxTimeoutSeconds + */ + @jakarta.annotation.Nonnull + @NotNull + public Integer getMaxTimeoutSeconds() { + return maxTimeoutSeconds; + } + + public void setMaxTimeoutSeconds(@jakarta.annotation.Nonnull Integer maxTimeoutSeconds) { + this.maxTimeoutSeconds = maxTimeoutSeconds; + } + + public B402PaymentPayloadV2Accepted extra( + @jakarta.annotation.Nonnull B402PaymentRequirementsV2Extra extra) { + this.extra = extra; + return this; + } + + /** + * Get extra + * + * @return extra + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public B402PaymentRequirementsV2Extra getExtra() { + return extra; + } + + public void setExtra(@jakarta.annotation.Nonnull B402PaymentRequirementsV2Extra extra) { + this.extra = extra; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402PaymentPayloadV2Accepted b402PaymentPayloadV2Accepted = + (B402PaymentPayloadV2Accepted) o; + return Objects.equals(this.scheme, b402PaymentPayloadV2Accepted.scheme) + && Objects.equals(this.network, b402PaymentPayloadV2Accepted.network) + && Objects.equals(this.amount, b402PaymentPayloadV2Accepted.amount) + && Objects.equals(this.asset, b402PaymentPayloadV2Accepted.asset) + && Objects.equals(this.payTo, b402PaymentPayloadV2Accepted.payTo) + && Objects.equals( + this.maxTimeoutSeconds, b402PaymentPayloadV2Accepted.maxTimeoutSeconds) + && Objects.equals(this.extra, b402PaymentPayloadV2Accepted.extra); + } + + @Override + public int hashCode() { + return Objects.hash(scheme, network, amount, asset, payTo, maxTimeoutSeconds, extra); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402PaymentPayloadV2Accepted {\n"); + sb.append(" scheme: ").append(toIndentedString(scheme)).append("\n"); + sb.append(" network: ").append(toIndentedString(network)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" asset: ").append(toIndentedString(asset)).append("\n"); + sb.append(" payTo: ").append(toIndentedString(payTo)).append("\n"); + sb.append(" maxTimeoutSeconds: ").append(toIndentedString(maxTimeoutSeconds)).append("\n"); + sb.append(" extra: ").append(toIndentedString(extra)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object schemeValue = getScheme(); + String schemeValueAsString = ""; + schemeValueAsString = schemeValue.toString(); + sb.append("scheme=").append(urlEncode(schemeValueAsString)).append(""); + Object networkValue = getNetwork(); + String networkValueAsString = ""; + networkValueAsString = networkValue.toString(); + sb.append("network=").append(urlEncode(networkValueAsString)).append(""); + Object amountValue = getAmount(); + String amountValueAsString = ""; + amountValueAsString = amountValue.toString(); + sb.append("amount=").append(urlEncode(amountValueAsString)).append(""); + Object assetValue = getAsset(); + String assetValueAsString = ""; + assetValueAsString = assetValue.toString(); + sb.append("asset=").append(urlEncode(assetValueAsString)).append(""); + Object payToValue = getPayTo(); + String payToValueAsString = ""; + payToValueAsString = payToValue.toString(); + sb.append("payTo=").append(urlEncode(payToValueAsString)).append(""); + Object maxTimeoutSecondsValue = getMaxTimeoutSeconds(); + String maxTimeoutSecondsValueAsString = ""; + maxTimeoutSecondsValueAsString = maxTimeoutSecondsValue.toString(); + sb.append("maxTimeoutSeconds=") + .append(urlEncode(maxTimeoutSecondsValueAsString)) + .append(""); + Object extraValue = getExtra(); + String extraValueAsString = ""; + extraValueAsString = extraValue.toString(); + sb.append("extra=").append(urlEncode(extraValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("scheme"); + openapiFields.add("network"); + openapiFields.add("amount"); + openapiFields.add("asset"); + openapiFields.add("payTo"); + openapiFields.add("maxTimeoutSeconds"); + openapiFields.add("extra"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("scheme"); + openapiRequiredFields.add("network"); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("asset"); + openapiRequiredFields.add("payTo"); + openapiRequiredFields.add("maxTimeoutSeconds"); + openapiRequiredFields.add("extra"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * B402PaymentPayloadV2Accepted + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402PaymentPayloadV2Accepted.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in B402PaymentPayloadV2Accepted is not" + + " found in the empty JSON string", + B402PaymentPayloadV2Accepted.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : B402PaymentPayloadV2Accepted.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("scheme").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `scheme` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("scheme").toString())); + } + // validate the required field `scheme` + SchemeEnum.validateJsonElement(jsonObj.get("scheme")); + if (!jsonObj.get("network").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `network` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("network").toString())); + } + if (!jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `amount` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("amount").toString())); + } + if (!jsonObj.get("asset").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `asset` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("asset").toString())); + } + if (!jsonObj.get("payTo").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `payTo` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("payTo").toString())); + } + // validate the required field `extra` + B402PaymentRequirementsV2Extra.validateJsonElement(jsonObj.get("extra")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402PaymentPayloadV2Accepted.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'B402PaymentPayloadV2Accepted' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(B402PaymentPayloadV2Accepted.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, B402PaymentPayloadV2Accepted value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402PaymentPayloadV2Accepted read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402PaymentPayloadV2Accepted given an JSON string + * + * @param jsonString JSON string + * @return An instance of B402PaymentPayloadV2Accepted + * @throws IOException if the JSON string is invalid with respect to + * B402PaymentPayloadV2Accepted + */ + public static B402PaymentPayloadV2Accepted fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, B402PaymentPayloadV2Accepted.class); + } + + /** + * Convert an instance of B402PaymentPayloadV2Accepted to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402PaymentPayloadV2Extensions.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402PaymentPayloadV2Extensions.java new file mode 100644 index 0000000..bdc9442 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402PaymentPayloadV2Extensions.java @@ -0,0 +1,315 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** B402PaymentPayloadV2Extensions */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402PaymentPayloadV2Extensions { + public static final String SERIALIZED_NAME_BAZAAR = "bazaar"; + + @SerializedName(SERIALIZED_NAME_BAZAAR) + @jakarta.annotation.Nullable + private B402PaymentPayloadV2ExtensionsBazaar bazaar; + + public B402PaymentPayloadV2Extensions() {} + + public B402PaymentPayloadV2Extensions bazaar( + @jakarta.annotation.Nullable B402PaymentPayloadV2ExtensionsBazaar bazaar) { + this.bazaar = bazaar; + return this; + } + + /** + * Get bazaar + * + * @return bazaar + */ + @jakarta.annotation.Nullable + @Valid + public B402PaymentPayloadV2ExtensionsBazaar getBazaar() { + return bazaar; + } + + public void setBazaar( + @jakarta.annotation.Nullable B402PaymentPayloadV2ExtensionsBazaar bazaar) { + this.bazaar = bazaar; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the B402PaymentPayloadV2Extensions instance itself + */ + public B402PaymentPayloadV2Extensions putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402PaymentPayloadV2Extensions b402PaymentPayloadV2Extensions = + (B402PaymentPayloadV2Extensions) o; + return Objects.equals(this.bazaar, b402PaymentPayloadV2Extensions.bazaar) + && Objects.equals( + this.additionalProperties, + b402PaymentPayloadV2Extensions.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(bazaar, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402PaymentPayloadV2Extensions {\n"); + sb.append(" bazaar: ").append(toIndentedString(bazaar)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object bazaarValue = getBazaar(); + String bazaarValueAsString = ""; + bazaarValueAsString = bazaarValue.toString(); + sb.append("bazaar=").append(urlEncode(bazaarValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("bazaar"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * B402PaymentPayloadV2Extensions + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (!jsonElement.isJsonObject()) { + throw new IllegalArgumentException( + String.format( + "Expected json element to be a object type in the JSON string but got" + + " `%s`", + jsonElement.toString())); + } + + Map map = jsonElement.getAsJsonObject().asMap(); + // validate map items + for (JsonElement element : map.values()) {} + if (jsonElement == null) { + if (!B402PaymentPayloadV2Extensions.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in B402PaymentPayloadV2Extensions is not" + + " found in the empty JSON string", + B402PaymentPayloadV2Extensions.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `bazaar` + if (jsonObj.get("bazaar") != null && !jsonObj.get("bazaar").isJsonNull()) { + B402PaymentPayloadV2ExtensionsBazaar.validateJsonElement(jsonObj.get("bazaar")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402PaymentPayloadV2Extensions.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'B402PaymentPayloadV2Extensions' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(B402PaymentPayloadV2Extensions.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, B402PaymentPayloadV2Extensions value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402PaymentPayloadV2Extensions read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + B402PaymentPayloadV2Extensions instance = + thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty( + entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty( + entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty( + entry.getKey(), + entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException( + String.format( + "The field `%s` has unknown primitive" + + " type. Value: %s", + entry.getKey(), + entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty( + entry.getKey(), + gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty( + entry.getKey(), + gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402PaymentPayloadV2Extensions given an JSON string + * + * @param jsonString JSON string + * @return An instance of B402PaymentPayloadV2Extensions + * @throws IOException if the JSON string is invalid with respect to + * B402PaymentPayloadV2Extensions + */ + public static B402PaymentPayloadV2Extensions fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, B402PaymentPayloadV2Extensions.class); + } + + /** + * Convert an instance of B402PaymentPayloadV2Extensions to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402PaymentPayloadV2ExtensionsBazaar.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402PaymentPayloadV2ExtensionsBazaar.java new file mode 100644 index 0000000..bf5688f --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402PaymentPayloadV2ExtensionsBazaar.java @@ -0,0 +1,361 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** B402PaymentPayloadV2ExtensionsBazaar */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402PaymentPayloadV2ExtensionsBazaar { + public static final String SERIALIZED_NAME_INFO = "info"; + + @SerializedName(SERIALIZED_NAME_INFO) + @jakarta.annotation.Nonnull + private Map info; + + public static final String SERIALIZED_NAME_SCHEMA = "schema"; + + @SerializedName(SERIALIZED_NAME_SCHEMA) + @jakarta.annotation.Nonnull + private Map schema; + + public static final String SERIALIZED_NAME_ROUTE_TEMPLATE = "routeTemplate"; + + @SerializedName(SERIALIZED_NAME_ROUTE_TEMPLATE) + @jakarta.annotation.Nullable + private String routeTemplate; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @jakarta.annotation.Nullable + private String description; + + public B402PaymentPayloadV2ExtensionsBazaar() {} + + public B402PaymentPayloadV2ExtensionsBazaar info( + @jakarta.annotation.Nonnull Map info) { + this.info = info; + return this; + } + + public B402PaymentPayloadV2ExtensionsBazaar putInfoItem(String key, Object infoItem) { + if (this.info == null) { + this.info = new HashMap<>(); + } + this.info.put(key, infoItem); + return this; + } + + /** + * Get info + * + * @return info + */ + @jakarta.annotation.Nonnull + @NotNull + public Map getInfo() { + return info; + } + + public void setInfo(@jakarta.annotation.Nonnull Map info) { + this.info = info; + } + + public B402PaymentPayloadV2ExtensionsBazaar schema( + @jakarta.annotation.Nonnull Map schema) { + this.schema = schema; + return this; + } + + public B402PaymentPayloadV2ExtensionsBazaar putSchemaItem(String key, Object schemaItem) { + if (this.schema == null) { + this.schema = new HashMap<>(); + } + this.schema.put(key, schemaItem); + return this; + } + + /** + * Get schema + * + * @return schema + */ + @jakarta.annotation.Nonnull + @NotNull + public Map getSchema() { + return schema; + } + + public void setSchema(@jakarta.annotation.Nonnull Map schema) { + this.schema = schema; + } + + public B402PaymentPayloadV2ExtensionsBazaar routeTemplate( + @jakarta.annotation.Nullable String routeTemplate) { + this.routeTemplate = routeTemplate; + return this; + } + + /** + * Get routeTemplate + * + * @return routeTemplate + */ + @jakarta.annotation.Nullable + public String getRouteTemplate() { + return routeTemplate; + } + + public void setRouteTemplate(@jakarta.annotation.Nullable String routeTemplate) { + this.routeTemplate = routeTemplate; + } + + public B402PaymentPayloadV2ExtensionsBazaar description( + @jakarta.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Get description + * + * @return description + */ + @jakarta.annotation.Nullable + public String getDescription() { + return description; + } + + public void setDescription(@jakarta.annotation.Nullable String description) { + this.description = description; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402PaymentPayloadV2ExtensionsBazaar b402PaymentPayloadV2ExtensionsBazaar = + (B402PaymentPayloadV2ExtensionsBazaar) o; + return Objects.equals(this.info, b402PaymentPayloadV2ExtensionsBazaar.info) + && Objects.equals(this.schema, b402PaymentPayloadV2ExtensionsBazaar.schema) + && Objects.equals( + this.routeTemplate, b402PaymentPayloadV2ExtensionsBazaar.routeTemplate) + && Objects.equals( + this.description, b402PaymentPayloadV2ExtensionsBazaar.description); + } + + @Override + public int hashCode() { + return Objects.hash(info, schema, routeTemplate, description); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402PaymentPayloadV2ExtensionsBazaar {\n"); + sb.append(" info: ").append(toIndentedString(info)).append("\n"); + sb.append(" schema: ").append(toIndentedString(schema)).append("\n"); + sb.append(" routeTemplate: ").append(toIndentedString(routeTemplate)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object infoValue = getInfo(); + String infoValueAsString = ""; + infoValueAsString = infoValue.toString(); + sb.append("info=").append(urlEncode(infoValueAsString)).append(""); + Object schemaValue = getSchema(); + String schemaValueAsString = ""; + schemaValueAsString = schemaValue.toString(); + sb.append("schema=").append(urlEncode(schemaValueAsString)).append(""); + Object routeTemplateValue = getRouteTemplate(); + String routeTemplateValueAsString = ""; + routeTemplateValueAsString = routeTemplateValue.toString(); + sb.append("routeTemplate=").append(urlEncode(routeTemplateValueAsString)).append(""); + Object descriptionValue = getDescription(); + String descriptionValueAsString = ""; + descriptionValueAsString = descriptionValue.toString(); + sb.append("description=").append(urlEncode(descriptionValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("info"); + openapiFields.add("schema"); + openapiFields.add("routeTemplate"); + openapiFields.add("description"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("info"); + openapiRequiredFields.add("schema"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * B402PaymentPayloadV2ExtensionsBazaar + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402PaymentPayloadV2ExtensionsBazaar.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in B402PaymentPayloadV2ExtensionsBazaar" + + " is not found in the empty JSON string", + B402PaymentPayloadV2ExtensionsBazaar.openapiRequiredFields + .toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : B402PaymentPayloadV2ExtensionsBazaar.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("routeTemplate") != null && !jsonObj.get("routeTemplate").isJsonNull()) + && !jsonObj.get("routeTemplate").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `routeTemplate` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("routeTemplate").toString())); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) + && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `description` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("description").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402PaymentPayloadV2ExtensionsBazaar.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'B402PaymentPayloadV2ExtensionsBazaar' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(B402PaymentPayloadV2ExtensionsBazaar.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, B402PaymentPayloadV2ExtensionsBazaar value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402PaymentPayloadV2ExtensionsBazaar read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402PaymentPayloadV2ExtensionsBazaar given an JSON string + * + * @param jsonString JSON string + * @return An instance of B402PaymentPayloadV2ExtensionsBazaar + * @throws IOException if the JSON string is invalid with respect to + * B402PaymentPayloadV2ExtensionsBazaar + */ + public static B402PaymentPayloadV2ExtensionsBazaar fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, B402PaymentPayloadV2ExtensionsBazaar.class); + } + + /** + * Convert an instance of B402PaymentPayloadV2ExtensionsBazaar to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402PaymentPayloadV2Payload.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402PaymentPayloadV2Payload.java new file mode 100644 index 0000000..109bd33 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402PaymentPayloadV2Payload.java @@ -0,0 +1,312 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** B402PaymentPayloadV2Payload */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402PaymentPayloadV2Payload { + public static final String SERIALIZED_NAME_SIGNATURE = "signature"; + + @SerializedName(SERIALIZED_NAME_SIGNATURE) + @jakarta.annotation.Nonnull + private String signature; + + public static final String SERIALIZED_NAME_AUTHORIZATION = "authorization"; + + @SerializedName(SERIALIZED_NAME_AUTHORIZATION) + @jakarta.annotation.Nullable + private B402PayloadDetailAuthorization authorization; + + public static final String SERIALIZED_NAME_PERMIT2_AUTHORIZATION = "permit2Authorization"; + + @SerializedName(SERIALIZED_NAME_PERMIT2_AUTHORIZATION) + @jakarta.annotation.Nullable + private B402PayloadDetailPermit2Authorization permit2Authorization; + + public B402PaymentPayloadV2Payload() {} + + public B402PaymentPayloadV2Payload signature(@jakarta.annotation.Nonnull String signature) { + this.signature = signature; + return this; + } + + /** + * Get signature + * + * @return signature + */ + @jakarta.annotation.Nonnull + @NotNull + public String getSignature() { + return signature; + } + + public void setSignature(@jakarta.annotation.Nonnull String signature) { + this.signature = signature; + } + + public B402PaymentPayloadV2Payload authorization( + @jakarta.annotation.Nullable B402PayloadDetailAuthorization authorization) { + this.authorization = authorization; + return this; + } + + /** + * Get authorization + * + * @return authorization + */ + @jakarta.annotation.Nullable + @Valid + public B402PayloadDetailAuthorization getAuthorization() { + return authorization; + } + + public void setAuthorization( + @jakarta.annotation.Nullable B402PayloadDetailAuthorization authorization) { + this.authorization = authorization; + } + + public B402PaymentPayloadV2Payload permit2Authorization( + @jakarta.annotation.Nullable + B402PayloadDetailPermit2Authorization permit2Authorization) { + this.permit2Authorization = permit2Authorization; + return this; + } + + /** + * Get permit2Authorization + * + * @return permit2Authorization + */ + @jakarta.annotation.Nullable + @Valid + public B402PayloadDetailPermit2Authorization getPermit2Authorization() { + return permit2Authorization; + } + + public void setPermit2Authorization( + @jakarta.annotation.Nullable + B402PayloadDetailPermit2Authorization permit2Authorization) { + this.permit2Authorization = permit2Authorization; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402PaymentPayloadV2Payload b402PaymentPayloadV2Payload = (B402PaymentPayloadV2Payload) o; + return Objects.equals(this.signature, b402PaymentPayloadV2Payload.signature) + && Objects.equals(this.authorization, b402PaymentPayloadV2Payload.authorization) + && Objects.equals( + this.permit2Authorization, + b402PaymentPayloadV2Payload.permit2Authorization); + } + + @Override + public int hashCode() { + return Objects.hash(signature, authorization, permit2Authorization); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402PaymentPayloadV2Payload {\n"); + sb.append(" signature: ").append(toIndentedString(signature)).append("\n"); + sb.append(" authorization: ").append(toIndentedString(authorization)).append("\n"); + sb.append(" permit2Authorization: ") + .append(toIndentedString(permit2Authorization)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object signatureValue = getSignature(); + String signatureValueAsString = ""; + signatureValueAsString = signatureValue.toString(); + sb.append("signature=").append(urlEncode(signatureValueAsString)).append(""); + Object authorizationValue = getAuthorization(); + String authorizationValueAsString = ""; + authorizationValueAsString = authorizationValue.toString(); + sb.append("authorization=").append(urlEncode(authorizationValueAsString)).append(""); + Object permit2AuthorizationValue = getPermit2Authorization(); + String permit2AuthorizationValueAsString = ""; + permit2AuthorizationValueAsString = permit2AuthorizationValue.toString(); + sb.append("permit2Authorization=") + .append(urlEncode(permit2AuthorizationValueAsString)) + .append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("signature"); + openapiFields.add("authorization"); + openapiFields.add("permit2Authorization"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("signature"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * B402PaymentPayloadV2Payload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402PaymentPayloadV2Payload.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in B402PaymentPayloadV2Payload is not" + + " found in the empty JSON string", + B402PaymentPayloadV2Payload.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : B402PaymentPayloadV2Payload.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("signature").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `signature` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("signature").toString())); + } + // validate the optional field `authorization` + if (jsonObj.get("authorization") != null && !jsonObj.get("authorization").isJsonNull()) { + B402PayloadDetailAuthorization.validateJsonElement(jsonObj.get("authorization")); + } + // validate the optional field `permit2Authorization` + if (jsonObj.get("permit2Authorization") != null + && !jsonObj.get("permit2Authorization").isJsonNull()) { + B402PayloadDetailPermit2Authorization.validateJsonElement( + jsonObj.get("permit2Authorization")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402PaymentPayloadV2Payload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'B402PaymentPayloadV2Payload' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(B402PaymentPayloadV2Payload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, B402PaymentPayloadV2Payload value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402PaymentPayloadV2Payload read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402PaymentPayloadV2Payload given an JSON string + * + * @param jsonString JSON string + * @return An instance of B402PaymentPayloadV2Payload + * @throws IOException if the JSON string is invalid with respect to B402PaymentPayloadV2Payload + */ + public static B402PaymentPayloadV2Payload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, B402PaymentPayloadV2Payload.class); + } + + /** + * Convert an instance of B402PaymentPayloadV2Payload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402PaymentPayloadV2Resource.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402PaymentPayloadV2Resource.java new file mode 100644 index 0000000..c2b033f --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402PaymentPayloadV2Resource.java @@ -0,0 +1,310 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URI; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** B402PaymentPayloadV2Resource */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402PaymentPayloadV2Resource { + public static final String SERIALIZED_NAME_URL = "url"; + + @SerializedName(SERIALIZED_NAME_URL) + @jakarta.annotation.Nonnull + private URI url; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @jakarta.annotation.Nullable + private String description; + + public static final String SERIALIZED_NAME_MIME_TYPE = "mimeType"; + + @SerializedName(SERIALIZED_NAME_MIME_TYPE) + @jakarta.annotation.Nullable + private String mimeType; + + public B402PaymentPayloadV2Resource() {} + + public B402PaymentPayloadV2Resource url(@jakarta.annotation.Nonnull URI url) { + this.url = url; + return this; + } + + /** + * Get url + * + * @return url + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public URI getUrl() { + return url; + } + + public void setUrl(@jakarta.annotation.Nonnull URI url) { + this.url = url; + } + + public B402PaymentPayloadV2Resource description( + @jakarta.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Get description + * + * @return description + */ + @jakarta.annotation.Nullable + public String getDescription() { + return description; + } + + public void setDescription(@jakarta.annotation.Nullable String description) { + this.description = description; + } + + public B402PaymentPayloadV2Resource mimeType(@jakarta.annotation.Nullable String mimeType) { + this.mimeType = mimeType; + return this; + } + + /** + * Get mimeType + * + * @return mimeType + */ + @jakarta.annotation.Nullable + public String getMimeType() { + return mimeType; + } + + public void setMimeType(@jakarta.annotation.Nullable String mimeType) { + this.mimeType = mimeType; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402PaymentPayloadV2Resource b402PaymentPayloadV2Resource = + (B402PaymentPayloadV2Resource) o; + return Objects.equals(this.url, b402PaymentPayloadV2Resource.url) + && Objects.equals(this.description, b402PaymentPayloadV2Resource.description) + && Objects.equals(this.mimeType, b402PaymentPayloadV2Resource.mimeType); + } + + @Override + public int hashCode() { + return Objects.hash(url, description, mimeType); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402PaymentPayloadV2Resource {\n"); + sb.append(" url: ").append(toIndentedString(url)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" mimeType: ").append(toIndentedString(mimeType)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object urlValue = getUrl(); + String urlValueAsString = ""; + urlValueAsString = urlValue.toString(); + sb.append("url=").append(urlEncode(urlValueAsString)).append(""); + Object descriptionValue = getDescription(); + String descriptionValueAsString = ""; + descriptionValueAsString = descriptionValue.toString(); + sb.append("description=").append(urlEncode(descriptionValueAsString)).append(""); + Object mimeTypeValue = getMimeType(); + String mimeTypeValueAsString = ""; + mimeTypeValueAsString = mimeTypeValue.toString(); + sb.append("mimeType=").append(urlEncode(mimeTypeValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("url"); + openapiFields.add("description"); + openapiFields.add("mimeType"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("url"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * B402PaymentPayloadV2Resource + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402PaymentPayloadV2Resource.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in B402PaymentPayloadV2Resource is not" + + " found in the empty JSON string", + B402PaymentPayloadV2Resource.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : B402PaymentPayloadV2Resource.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("url").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `url` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("url").toString())); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) + && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `description` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("description").toString())); + } + if ((jsonObj.get("mimeType") != null && !jsonObj.get("mimeType").isJsonNull()) + && !jsonObj.get("mimeType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `mimeType` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("mimeType").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402PaymentPayloadV2Resource.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'B402PaymentPayloadV2Resource' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(B402PaymentPayloadV2Resource.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, B402PaymentPayloadV2Resource value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402PaymentPayloadV2Resource read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402PaymentPayloadV2Resource given an JSON string + * + * @param jsonString JSON string + * @return An instance of B402PaymentPayloadV2Resource + * @throws IOException if the JSON string is invalid with respect to + * B402PaymentPayloadV2Resource + */ + public static B402PaymentPayloadV2Resource fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, B402PaymentPayloadV2Resource.class); + } + + /** + * Convert an instance of B402PaymentPayloadV2Resource to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402PaymentRequirementsExtraV2.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402PaymentRequirementsExtraV2.java new file mode 100644 index 0000000..ece3a57 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402PaymentRequirementsExtraV2.java @@ -0,0 +1,476 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** B402PaymentRequirementsExtraV2 */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402PaymentRequirementsExtraV2 { + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @jakarta.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_VERSION = "version"; + + @SerializedName(SERIALIZED_NAME_VERSION) + @jakarta.annotation.Nonnull + private String version; + + /** Gets or Sets assetTransferMethod */ + @JsonAdapter(AssetTransferMethodEnum.Adapter.class) + public enum AssetTransferMethodEnum { + EIP3009("eip3009"), + + PERMIT2_EXACT("permit2-exact"), + + PERMIT2_UPTO("permit2-upto"); + + private String value; + + AssetTransferMethodEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static AssetTransferMethodEnum fromValue(String value) { + for (AssetTransferMethodEnum b : AssetTransferMethodEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write( + final JsonWriter jsonWriter, final AssetTransferMethodEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public AssetTransferMethodEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return AssetTransferMethodEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + AssetTransferMethodEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_ASSET_TRANSFER_METHOD = "assetTransferMethod"; + + @SerializedName(SERIALIZED_NAME_ASSET_TRANSFER_METHOD) + @jakarta.annotation.Nonnull + private AssetTransferMethodEnum assetTransferMethod; + + public static final String SERIALIZED_NAME_SIGNER_ADDRESS = "signerAddress"; + + @SerializedName(SERIALIZED_NAME_SIGNER_ADDRESS) + @jakarta.annotation.Nonnull + private String signerAddress; + + public static final String SERIALIZED_NAME_SPENDER_ADDRESS = "spenderAddress"; + + @SerializedName(SERIALIZED_NAME_SPENDER_ADDRESS) + @jakarta.annotation.Nullable + private String spenderAddress; + + public B402PaymentRequirementsExtraV2() {} + + public B402PaymentRequirementsExtraV2 name(@jakarta.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * + * @return name + */ + @jakarta.annotation.Nonnull + @NotNull + public String getName() { + return name; + } + + public void setName(@jakarta.annotation.Nonnull String name) { + this.name = name; + } + + public B402PaymentRequirementsExtraV2 version(@jakarta.annotation.Nonnull String version) { + this.version = version; + return this; + } + + /** + * Get version + * + * @return version + */ + @jakarta.annotation.Nonnull + @NotNull + public String getVersion() { + return version; + } + + public void setVersion(@jakarta.annotation.Nonnull String version) { + this.version = version; + } + + public B402PaymentRequirementsExtraV2 assetTransferMethod( + @jakarta.annotation.Nonnull AssetTransferMethodEnum assetTransferMethod) { + this.assetTransferMethod = assetTransferMethod; + return this; + } + + /** + * Get assetTransferMethod + * + * @return assetTransferMethod + */ + @jakarta.annotation.Nonnull + @NotNull + public AssetTransferMethodEnum getAssetTransferMethod() { + return assetTransferMethod; + } + + public void setAssetTransferMethod( + @jakarta.annotation.Nonnull AssetTransferMethodEnum assetTransferMethod) { + this.assetTransferMethod = assetTransferMethod; + } + + public B402PaymentRequirementsExtraV2 signerAddress( + @jakarta.annotation.Nonnull String signerAddress) { + this.signerAddress = signerAddress; + return this; + } + + /** + * Get signerAddress + * + * @return signerAddress + */ + @jakarta.annotation.Nonnull + @NotNull + public String getSignerAddress() { + return signerAddress; + } + + public void setSignerAddress(@jakarta.annotation.Nonnull String signerAddress) { + this.signerAddress = signerAddress; + } + + public B402PaymentRequirementsExtraV2 spenderAddress( + @jakarta.annotation.Nullable String spenderAddress) { + this.spenderAddress = spenderAddress; + return this; + } + + /** + * Get spenderAddress + * + * @return spenderAddress + */ + @jakarta.annotation.Nullable + public String getSpenderAddress() { + return spenderAddress; + } + + public void setSpenderAddress(@jakarta.annotation.Nullable String spenderAddress) { + this.spenderAddress = spenderAddress; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402PaymentRequirementsExtraV2 b402PaymentRequirementsExtraV2 = + (B402PaymentRequirementsExtraV2) o; + return Objects.equals(this.name, b402PaymentRequirementsExtraV2.name) + && Objects.equals(this.version, b402PaymentRequirementsExtraV2.version) + && Objects.equals( + this.assetTransferMethod, + b402PaymentRequirementsExtraV2.assetTransferMethod) + && Objects.equals(this.signerAddress, b402PaymentRequirementsExtraV2.signerAddress) + && Objects.equals( + this.spenderAddress, b402PaymentRequirementsExtraV2.spenderAddress); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(name, version, assetTransferMethod, signerAddress, spenderAddress); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402PaymentRequirementsExtraV2 {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).append("\n"); + sb.append(" assetTransferMethod: ") + .append(toIndentedString(assetTransferMethod)) + .append("\n"); + sb.append(" signerAddress: ").append(toIndentedString(signerAddress)).append("\n"); + sb.append(" spenderAddress: ").append(toIndentedString(spenderAddress)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object nameValue = getName(); + String nameValueAsString = ""; + nameValueAsString = nameValue.toString(); + sb.append("name=").append(urlEncode(nameValueAsString)).append(""); + Object versionValue = getVersion(); + String versionValueAsString = ""; + versionValueAsString = versionValue.toString(); + sb.append("version=").append(urlEncode(versionValueAsString)).append(""); + Object assetTransferMethodValue = getAssetTransferMethod(); + String assetTransferMethodValueAsString = ""; + assetTransferMethodValueAsString = assetTransferMethodValue.toString(); + sb.append("assetTransferMethod=") + .append(urlEncode(assetTransferMethodValueAsString)) + .append(""); + Object signerAddressValue = getSignerAddress(); + String signerAddressValueAsString = ""; + signerAddressValueAsString = signerAddressValue.toString(); + sb.append("signerAddress=").append(urlEncode(signerAddressValueAsString)).append(""); + Object spenderAddressValue = getSpenderAddress(); + String spenderAddressValueAsString = ""; + spenderAddressValueAsString = spenderAddressValue.toString(); + sb.append("spenderAddress=").append(urlEncode(spenderAddressValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("version"); + openapiFields.add("assetTransferMethod"); + openapiFields.add("signerAddress"); + openapiFields.add("spenderAddress"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("version"); + openapiRequiredFields.add("assetTransferMethod"); + openapiRequiredFields.add("signerAddress"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * B402PaymentRequirementsExtraV2 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402PaymentRequirementsExtraV2.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in B402PaymentRequirementsExtraV2 is not" + + " found in the empty JSON string", + B402PaymentRequirementsExtraV2.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : B402PaymentRequirementsExtraV2.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `name` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("name").toString())); + } + if (!jsonObj.get("version").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `version` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("version").toString())); + } + if (!jsonObj.get("assetTransferMethod").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `assetTransferMethod` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("assetTransferMethod").toString())); + } + // validate the required field `assetTransferMethod` + AssetTransferMethodEnum.validateJsonElement(jsonObj.get("assetTransferMethod")); + if (!jsonObj.get("signerAddress").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `signerAddress` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("signerAddress").toString())); + } + if ((jsonObj.get("spenderAddress") != null && !jsonObj.get("spenderAddress").isJsonNull()) + && !jsonObj.get("spenderAddress").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `spenderAddress` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("spenderAddress").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402PaymentRequirementsExtraV2.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'B402PaymentRequirementsExtraV2' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(B402PaymentRequirementsExtraV2.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, B402PaymentRequirementsExtraV2 value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402PaymentRequirementsExtraV2 read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402PaymentRequirementsExtraV2 given an JSON string + * + * @param jsonString JSON string + * @return An instance of B402PaymentRequirementsExtraV2 + * @throws IOException if the JSON string is invalid with respect to + * B402PaymentRequirementsExtraV2 + */ + public static B402PaymentRequirementsExtraV2 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, B402PaymentRequirementsExtraV2.class); + } + + /** + * Convert an instance of B402PaymentRequirementsExtraV2 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402PaymentRequirementsV1.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402PaymentRequirementsV1.java new file mode 100644 index 0000000..1f425ca --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402PaymentRequirementsV1.java @@ -0,0 +1,691 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URI; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** B402PaymentRequirementsV1 */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402PaymentRequirementsV1 { + /** Gets or Sets scheme */ + @JsonAdapter(SchemeEnum.Adapter.class) + public enum SchemeEnum { + exact("exact"); + + private String value; + + SchemeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static SchemeEnum fromValue(String value) { + for (SchemeEnum b : SchemeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final SchemeEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public SchemeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return SchemeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + SchemeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_SCHEME = "scheme"; + + @SerializedName(SERIALIZED_NAME_SCHEME) + @jakarta.annotation.Nonnull + private SchemeEnum scheme; + + public static final String SERIALIZED_NAME_NETWORK = "network"; + + @SerializedName(SERIALIZED_NAME_NETWORK) + @jakarta.annotation.Nonnull + private String network; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + + @SerializedName(SERIALIZED_NAME_AMOUNT) + @jakarta.annotation.Nonnull + private String amount; + + public static final String SERIALIZED_NAME_RESOURCE = "resource"; + + @SerializedName(SERIALIZED_NAME_RESOURCE) + @jakarta.annotation.Nullable + private URI resource; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @jakarta.annotation.Nullable + private String description; + + public static final String SERIALIZED_NAME_PAY_TO = "payTo"; + + @SerializedName(SERIALIZED_NAME_PAY_TO) + @jakarta.annotation.Nonnull + private String payTo; + + public static final String SERIALIZED_NAME_ASSET = "asset"; + + @SerializedName(SERIALIZED_NAME_ASSET) + @jakarta.annotation.Nonnull + private String asset; + + public static final String SERIALIZED_NAME_MAX_TIMEOUT_SECONDS = "maxTimeoutSeconds"; + + @SerializedName(SERIALIZED_NAME_MAX_TIMEOUT_SECONDS) + @jakarta.annotation.Nonnull + private Integer maxTimeoutSeconds; + + public static final String SERIALIZED_NAME_MIME_TYPE = "mimeType"; + + @SerializedName(SERIALIZED_NAME_MIME_TYPE) + @jakarta.annotation.Nullable + private String mimeType; + + public static final String SERIALIZED_NAME_OUTPUT_SCHEMA = "outputSchema"; + + @SerializedName(SERIALIZED_NAME_OUTPUT_SCHEMA) + @jakarta.annotation.Nullable + private Map outputSchema; + + public static final String SERIALIZED_NAME_EXTRA = "extra"; + + @SerializedName(SERIALIZED_NAME_EXTRA) + @jakarta.annotation.Nullable + private B402PaymentKindV1Extra extra; + + public B402PaymentRequirementsV1() {} + + public B402PaymentRequirementsV1 scheme(@jakarta.annotation.Nonnull SchemeEnum scheme) { + this.scheme = scheme; + return this; + } + + /** + * Get scheme + * + * @return scheme + */ + @jakarta.annotation.Nonnull + @NotNull + public SchemeEnum getScheme() { + return scheme; + } + + public void setScheme(@jakarta.annotation.Nonnull SchemeEnum scheme) { + this.scheme = scheme; + } + + public B402PaymentRequirementsV1 network(@jakarta.annotation.Nonnull String network) { + this.network = network; + return this; + } + + /** + * Get network + * + * @return network + */ + @jakarta.annotation.Nonnull + @NotNull + public String getNetwork() { + return network; + } + + public void setNetwork(@jakarta.annotation.Nonnull String network) { + this.network = network; + } + + public B402PaymentRequirementsV1 amount(@jakarta.annotation.Nonnull String amount) { + this.amount = amount; + return this; + } + + /** + * Get amount + * + * @return amount + */ + @jakarta.annotation.Nonnull + @NotNull + public String getAmount() { + return amount; + } + + public void setAmount(@jakarta.annotation.Nonnull String amount) { + this.amount = amount; + } + + public B402PaymentRequirementsV1 resource(@jakarta.annotation.Nullable URI resource) { + this.resource = resource; + return this; + } + + /** + * Get resource + * + * @return resource + */ + @jakarta.annotation.Nullable + @Valid + public URI getResource() { + return resource; + } + + public void setResource(@jakarta.annotation.Nullable URI resource) { + this.resource = resource; + } + + public B402PaymentRequirementsV1 description(@jakarta.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Get description + * + * @return description + */ + @jakarta.annotation.Nullable + public String getDescription() { + return description; + } + + public void setDescription(@jakarta.annotation.Nullable String description) { + this.description = description; + } + + public B402PaymentRequirementsV1 payTo(@jakarta.annotation.Nonnull String payTo) { + this.payTo = payTo; + return this; + } + + /** + * Get payTo + * + * @return payTo + */ + @jakarta.annotation.Nonnull + @NotNull + public String getPayTo() { + return payTo; + } + + public void setPayTo(@jakarta.annotation.Nonnull String payTo) { + this.payTo = payTo; + } + + public B402PaymentRequirementsV1 asset(@jakarta.annotation.Nonnull String asset) { + this.asset = asset; + return this; + } + + /** + * Get asset + * + * @return asset + */ + @jakarta.annotation.Nonnull + @NotNull + public String getAsset() { + return asset; + } + + public void setAsset(@jakarta.annotation.Nonnull String asset) { + this.asset = asset; + } + + public B402PaymentRequirementsV1 maxTimeoutSeconds( + @jakarta.annotation.Nonnull Integer maxTimeoutSeconds) { + this.maxTimeoutSeconds = maxTimeoutSeconds; + return this; + } + + /** + * Get maxTimeoutSeconds + * + * @return maxTimeoutSeconds + */ + @jakarta.annotation.Nonnull + @NotNull + public Integer getMaxTimeoutSeconds() { + return maxTimeoutSeconds; + } + + public void setMaxTimeoutSeconds(@jakarta.annotation.Nonnull Integer maxTimeoutSeconds) { + this.maxTimeoutSeconds = maxTimeoutSeconds; + } + + public B402PaymentRequirementsV1 mimeType(@jakarta.annotation.Nullable String mimeType) { + this.mimeType = mimeType; + return this; + } + + /** + * Get mimeType + * + * @return mimeType + */ + @jakarta.annotation.Nullable + public String getMimeType() { + return mimeType; + } + + public void setMimeType(@jakarta.annotation.Nullable String mimeType) { + this.mimeType = mimeType; + } + + public B402PaymentRequirementsV1 outputSchema( + @jakarta.annotation.Nullable Map outputSchema) { + this.outputSchema = outputSchema; + return this; + } + + public B402PaymentRequirementsV1 putOutputSchemaItem(String key, Object outputSchemaItem) { + if (this.outputSchema == null) { + this.outputSchema = new HashMap<>(); + } + this.outputSchema.put(key, outputSchemaItem); + return this; + } + + /** + * Get outputSchema + * + * @return outputSchema + */ + @jakarta.annotation.Nullable + public Map getOutputSchema() { + return outputSchema; + } + + public void setOutputSchema(@jakarta.annotation.Nullable Map outputSchema) { + this.outputSchema = outputSchema; + } + + public B402PaymentRequirementsV1 extra( + @jakarta.annotation.Nullable B402PaymentKindV1Extra extra) { + this.extra = extra; + return this; + } + + /** + * Get extra + * + * @return extra + */ + @jakarta.annotation.Nullable + @Valid + public B402PaymentKindV1Extra getExtra() { + return extra; + } + + public void setExtra(@jakarta.annotation.Nullable B402PaymentKindV1Extra extra) { + this.extra = extra; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402PaymentRequirementsV1 b402PaymentRequirementsV1 = (B402PaymentRequirementsV1) o; + return Objects.equals(this.scheme, b402PaymentRequirementsV1.scheme) + && Objects.equals(this.network, b402PaymentRequirementsV1.network) + && Objects.equals(this.amount, b402PaymentRequirementsV1.amount) + && Objects.equals(this.resource, b402PaymentRequirementsV1.resource) + && Objects.equals(this.description, b402PaymentRequirementsV1.description) + && Objects.equals(this.payTo, b402PaymentRequirementsV1.payTo) + && Objects.equals(this.asset, b402PaymentRequirementsV1.asset) + && Objects.equals( + this.maxTimeoutSeconds, b402PaymentRequirementsV1.maxTimeoutSeconds) + && Objects.equals(this.mimeType, b402PaymentRequirementsV1.mimeType) + && Objects.equals(this.outputSchema, b402PaymentRequirementsV1.outputSchema) + && Objects.equals(this.extra, b402PaymentRequirementsV1.extra); + } + + @Override + public int hashCode() { + return Objects.hash( + scheme, + network, + amount, + resource, + description, + payTo, + asset, + maxTimeoutSeconds, + mimeType, + outputSchema, + extra); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402PaymentRequirementsV1 {\n"); + sb.append(" scheme: ").append(toIndentedString(scheme)).append("\n"); + sb.append(" network: ").append(toIndentedString(network)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" resource: ").append(toIndentedString(resource)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" payTo: ").append(toIndentedString(payTo)).append("\n"); + sb.append(" asset: ").append(toIndentedString(asset)).append("\n"); + sb.append(" maxTimeoutSeconds: ").append(toIndentedString(maxTimeoutSeconds)).append("\n"); + sb.append(" mimeType: ").append(toIndentedString(mimeType)).append("\n"); + sb.append(" outputSchema: ").append(toIndentedString(outputSchema)).append("\n"); + sb.append(" extra: ").append(toIndentedString(extra)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object schemeValue = getScheme(); + String schemeValueAsString = ""; + schemeValueAsString = schemeValue.toString(); + sb.append("scheme=").append(urlEncode(schemeValueAsString)).append(""); + Object networkValue = getNetwork(); + String networkValueAsString = ""; + networkValueAsString = networkValue.toString(); + sb.append("network=").append(urlEncode(networkValueAsString)).append(""); + Object amountValue = getAmount(); + String amountValueAsString = ""; + amountValueAsString = amountValue.toString(); + sb.append("amount=").append(urlEncode(amountValueAsString)).append(""); + Object resourceValue = getResource(); + String resourceValueAsString = ""; + resourceValueAsString = resourceValue.toString(); + sb.append("resource=").append(urlEncode(resourceValueAsString)).append(""); + Object descriptionValue = getDescription(); + String descriptionValueAsString = ""; + descriptionValueAsString = descriptionValue.toString(); + sb.append("description=").append(urlEncode(descriptionValueAsString)).append(""); + Object payToValue = getPayTo(); + String payToValueAsString = ""; + payToValueAsString = payToValue.toString(); + sb.append("payTo=").append(urlEncode(payToValueAsString)).append(""); + Object assetValue = getAsset(); + String assetValueAsString = ""; + assetValueAsString = assetValue.toString(); + sb.append("asset=").append(urlEncode(assetValueAsString)).append(""); + Object maxTimeoutSecondsValue = getMaxTimeoutSeconds(); + String maxTimeoutSecondsValueAsString = ""; + maxTimeoutSecondsValueAsString = maxTimeoutSecondsValue.toString(); + sb.append("maxTimeoutSeconds=") + .append(urlEncode(maxTimeoutSecondsValueAsString)) + .append(""); + Object mimeTypeValue = getMimeType(); + String mimeTypeValueAsString = ""; + mimeTypeValueAsString = mimeTypeValue.toString(); + sb.append("mimeType=").append(urlEncode(mimeTypeValueAsString)).append(""); + Object outputSchemaValue = getOutputSchema(); + String outputSchemaValueAsString = ""; + outputSchemaValueAsString = outputSchemaValue.toString(); + sb.append("outputSchema=").append(urlEncode(outputSchemaValueAsString)).append(""); + Object extraValue = getExtra(); + String extraValueAsString = ""; + extraValueAsString = extraValue.toString(); + sb.append("extra=").append(urlEncode(extraValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("scheme"); + openapiFields.add("network"); + openapiFields.add("amount"); + openapiFields.add("resource"); + openapiFields.add("description"); + openapiFields.add("payTo"); + openapiFields.add("asset"); + openapiFields.add("maxTimeoutSeconds"); + openapiFields.add("mimeType"); + openapiFields.add("outputSchema"); + openapiFields.add("extra"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("scheme"); + openapiRequiredFields.add("network"); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("payTo"); + openapiRequiredFields.add("asset"); + openapiRequiredFields.add("maxTimeoutSeconds"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to B402PaymentRequirementsV1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402PaymentRequirementsV1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in B402PaymentRequirementsV1 is not found" + + " in the empty JSON string", + B402PaymentRequirementsV1.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : B402PaymentRequirementsV1.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("scheme").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `scheme` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("scheme").toString())); + } + // validate the required field `scheme` + SchemeEnum.validateJsonElement(jsonObj.get("scheme")); + if (!jsonObj.get("network").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `network` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("network").toString())); + } + if (!jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `amount` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("amount").toString())); + } + if ((jsonObj.get("resource") != null && !jsonObj.get("resource").isJsonNull()) + && !jsonObj.get("resource").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `resource` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("resource").toString())); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) + && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `description` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("description").toString())); + } + if (!jsonObj.get("payTo").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `payTo` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("payTo").toString())); + } + if (!jsonObj.get("asset").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `asset` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("asset").toString())); + } + if ((jsonObj.get("mimeType") != null && !jsonObj.get("mimeType").isJsonNull()) + && !jsonObj.get("mimeType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `mimeType` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("mimeType").toString())); + } + // validate the optional field `extra` + if (jsonObj.get("extra") != null && !jsonObj.get("extra").isJsonNull()) { + B402PaymentKindV1Extra.validateJsonElement(jsonObj.get("extra")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402PaymentRequirementsV1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'B402PaymentRequirementsV1' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(B402PaymentRequirementsV1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, B402PaymentRequirementsV1 value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402PaymentRequirementsV1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402PaymentRequirementsV1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of B402PaymentRequirementsV1 + * @throws IOException if the JSON string is invalid with respect to B402PaymentRequirementsV1 + */ + public static B402PaymentRequirementsV1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, B402PaymentRequirementsV1.class); + } + + /** + * Convert an instance of B402PaymentRequirementsV1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402PaymentRequirementsV2.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402PaymentRequirementsV2.java new file mode 100644 index 0000000..4390c7b --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402PaymentRequirementsV2.java @@ -0,0 +1,518 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** B402PaymentRequirementsV2 */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402PaymentRequirementsV2 { + /** Gets or Sets scheme */ + @JsonAdapter(SchemeEnum.Adapter.class) + public enum SchemeEnum { + exact("exact"), + + upto("upto"); + + private String value; + + SchemeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static SchemeEnum fromValue(String value) { + for (SchemeEnum b : SchemeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final SchemeEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public SchemeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return SchemeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + SchemeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_SCHEME = "scheme"; + + @SerializedName(SERIALIZED_NAME_SCHEME) + @jakarta.annotation.Nonnull + private SchemeEnum scheme; + + public static final String SERIALIZED_NAME_NETWORK = "network"; + + @SerializedName(SERIALIZED_NAME_NETWORK) + @jakarta.annotation.Nonnull + private String network; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + + @SerializedName(SERIALIZED_NAME_AMOUNT) + @jakarta.annotation.Nonnull + private String amount; + + public static final String SERIALIZED_NAME_ASSET = "asset"; + + @SerializedName(SERIALIZED_NAME_ASSET) + @jakarta.annotation.Nonnull + private String asset; + + public static final String SERIALIZED_NAME_PAY_TO = "payTo"; + + @SerializedName(SERIALIZED_NAME_PAY_TO) + @jakarta.annotation.Nonnull + private String payTo; + + public static final String SERIALIZED_NAME_MAX_TIMEOUT_SECONDS = "maxTimeoutSeconds"; + + @SerializedName(SERIALIZED_NAME_MAX_TIMEOUT_SECONDS) + @jakarta.annotation.Nonnull + private Integer maxTimeoutSeconds; + + public static final String SERIALIZED_NAME_EXTRA = "extra"; + + @SerializedName(SERIALIZED_NAME_EXTRA) + @jakarta.annotation.Nonnull + private B402PaymentRequirementsV2Extra extra; + + public B402PaymentRequirementsV2() {} + + public B402PaymentRequirementsV2 scheme(@jakarta.annotation.Nonnull SchemeEnum scheme) { + this.scheme = scheme; + return this; + } + + /** + * Get scheme + * + * @return scheme + */ + @jakarta.annotation.Nonnull + @NotNull + public SchemeEnum getScheme() { + return scheme; + } + + public void setScheme(@jakarta.annotation.Nonnull SchemeEnum scheme) { + this.scheme = scheme; + } + + public B402PaymentRequirementsV2 network(@jakarta.annotation.Nonnull String network) { + this.network = network; + return this; + } + + /** + * Get network + * + * @return network + */ + @jakarta.annotation.Nonnull + @NotNull + public String getNetwork() { + return network; + } + + public void setNetwork(@jakarta.annotation.Nonnull String network) { + this.network = network; + } + + public B402PaymentRequirementsV2 amount(@jakarta.annotation.Nonnull String amount) { + this.amount = amount; + return this; + } + + /** + * Get amount + * + * @return amount + */ + @jakarta.annotation.Nonnull + @NotNull + @Pattern(regexp = "^[0-9]+$") + public String getAmount() { + return amount; + } + + public void setAmount(@jakarta.annotation.Nonnull String amount) { + this.amount = amount; + } + + public B402PaymentRequirementsV2 asset(@jakarta.annotation.Nonnull String asset) { + this.asset = asset; + return this; + } + + /** + * Get asset + * + * @return asset + */ + @jakarta.annotation.Nonnull + @NotNull + public String getAsset() { + return asset; + } + + public void setAsset(@jakarta.annotation.Nonnull String asset) { + this.asset = asset; + } + + public B402PaymentRequirementsV2 payTo(@jakarta.annotation.Nonnull String payTo) { + this.payTo = payTo; + return this; + } + + /** + * Get payTo + * + * @return payTo + */ + @jakarta.annotation.Nonnull + @NotNull + public String getPayTo() { + return payTo; + } + + public void setPayTo(@jakarta.annotation.Nonnull String payTo) { + this.payTo = payTo; + } + + public B402PaymentRequirementsV2 maxTimeoutSeconds( + @jakarta.annotation.Nonnull Integer maxTimeoutSeconds) { + this.maxTimeoutSeconds = maxTimeoutSeconds; + return this; + } + + /** + * Get maxTimeoutSeconds + * + * @return maxTimeoutSeconds + */ + @jakarta.annotation.Nonnull + @NotNull + public Integer getMaxTimeoutSeconds() { + return maxTimeoutSeconds; + } + + public void setMaxTimeoutSeconds(@jakarta.annotation.Nonnull Integer maxTimeoutSeconds) { + this.maxTimeoutSeconds = maxTimeoutSeconds; + } + + public B402PaymentRequirementsV2 extra( + @jakarta.annotation.Nonnull B402PaymentRequirementsV2Extra extra) { + this.extra = extra; + return this; + } + + /** + * Get extra + * + * @return extra + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public B402PaymentRequirementsV2Extra getExtra() { + return extra; + } + + public void setExtra(@jakarta.annotation.Nonnull B402PaymentRequirementsV2Extra extra) { + this.extra = extra; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402PaymentRequirementsV2 b402PaymentRequirementsV2 = (B402PaymentRequirementsV2) o; + return Objects.equals(this.scheme, b402PaymentRequirementsV2.scheme) + && Objects.equals(this.network, b402PaymentRequirementsV2.network) + && Objects.equals(this.amount, b402PaymentRequirementsV2.amount) + && Objects.equals(this.asset, b402PaymentRequirementsV2.asset) + && Objects.equals(this.payTo, b402PaymentRequirementsV2.payTo) + && Objects.equals( + this.maxTimeoutSeconds, b402PaymentRequirementsV2.maxTimeoutSeconds) + && Objects.equals(this.extra, b402PaymentRequirementsV2.extra); + } + + @Override + public int hashCode() { + return Objects.hash(scheme, network, amount, asset, payTo, maxTimeoutSeconds, extra); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402PaymentRequirementsV2 {\n"); + sb.append(" scheme: ").append(toIndentedString(scheme)).append("\n"); + sb.append(" network: ").append(toIndentedString(network)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" asset: ").append(toIndentedString(asset)).append("\n"); + sb.append(" payTo: ").append(toIndentedString(payTo)).append("\n"); + sb.append(" maxTimeoutSeconds: ").append(toIndentedString(maxTimeoutSeconds)).append("\n"); + sb.append(" extra: ").append(toIndentedString(extra)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object schemeValue = getScheme(); + String schemeValueAsString = ""; + schemeValueAsString = schemeValue.toString(); + sb.append("scheme=").append(urlEncode(schemeValueAsString)).append(""); + Object networkValue = getNetwork(); + String networkValueAsString = ""; + networkValueAsString = networkValue.toString(); + sb.append("network=").append(urlEncode(networkValueAsString)).append(""); + Object amountValue = getAmount(); + String amountValueAsString = ""; + amountValueAsString = amountValue.toString(); + sb.append("amount=").append(urlEncode(amountValueAsString)).append(""); + Object assetValue = getAsset(); + String assetValueAsString = ""; + assetValueAsString = assetValue.toString(); + sb.append("asset=").append(urlEncode(assetValueAsString)).append(""); + Object payToValue = getPayTo(); + String payToValueAsString = ""; + payToValueAsString = payToValue.toString(); + sb.append("payTo=").append(urlEncode(payToValueAsString)).append(""); + Object maxTimeoutSecondsValue = getMaxTimeoutSeconds(); + String maxTimeoutSecondsValueAsString = ""; + maxTimeoutSecondsValueAsString = maxTimeoutSecondsValue.toString(); + sb.append("maxTimeoutSeconds=") + .append(urlEncode(maxTimeoutSecondsValueAsString)) + .append(""); + Object extraValue = getExtra(); + String extraValueAsString = ""; + extraValueAsString = extraValue.toString(); + sb.append("extra=").append(urlEncode(extraValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("scheme"); + openapiFields.add("network"); + openapiFields.add("amount"); + openapiFields.add("asset"); + openapiFields.add("payTo"); + openapiFields.add("maxTimeoutSeconds"); + openapiFields.add("extra"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("scheme"); + openapiRequiredFields.add("network"); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("asset"); + openapiRequiredFields.add("payTo"); + openapiRequiredFields.add("maxTimeoutSeconds"); + openapiRequiredFields.add("extra"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to B402PaymentRequirementsV2 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402PaymentRequirementsV2.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in B402PaymentRequirementsV2 is not found" + + " in the empty JSON string", + B402PaymentRequirementsV2.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : B402PaymentRequirementsV2.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("scheme").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `scheme` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("scheme").toString())); + } + // validate the required field `scheme` + SchemeEnum.validateJsonElement(jsonObj.get("scheme")); + if (!jsonObj.get("network").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `network` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("network").toString())); + } + if (!jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `amount` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("amount").toString())); + } + if (!jsonObj.get("asset").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `asset` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("asset").toString())); + } + if (!jsonObj.get("payTo").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `payTo` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("payTo").toString())); + } + // validate the required field `extra` + B402PaymentRequirementsV2Extra.validateJsonElement(jsonObj.get("extra")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402PaymentRequirementsV2.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'B402PaymentRequirementsV2' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(B402PaymentRequirementsV2.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, B402PaymentRequirementsV2 value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402PaymentRequirementsV2 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402PaymentRequirementsV2 given an JSON string + * + * @param jsonString JSON string + * @return An instance of B402PaymentRequirementsV2 + * @throws IOException if the JSON string is invalid with respect to B402PaymentRequirementsV2 + */ + public static B402PaymentRequirementsV2 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, B402PaymentRequirementsV2.class); + } + + /** + * Convert an instance of B402PaymentRequirementsV2 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402PaymentRequirementsV2Extra.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402PaymentRequirementsV2Extra.java new file mode 100644 index 0000000..28aba83 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402PaymentRequirementsV2Extra.java @@ -0,0 +1,476 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** B402PaymentRequirementsV2Extra */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402PaymentRequirementsV2Extra { + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @jakarta.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_VERSION = "version"; + + @SerializedName(SERIALIZED_NAME_VERSION) + @jakarta.annotation.Nonnull + private String version; + + /** Gets or Sets assetTransferMethod */ + @JsonAdapter(AssetTransferMethodEnum.Adapter.class) + public enum AssetTransferMethodEnum { + EIP3009("eip3009"), + + PERMIT2_EXACT("permit2-exact"), + + PERMIT2_UPTO("permit2-upto"); + + private String value; + + AssetTransferMethodEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static AssetTransferMethodEnum fromValue(String value) { + for (AssetTransferMethodEnum b : AssetTransferMethodEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write( + final JsonWriter jsonWriter, final AssetTransferMethodEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public AssetTransferMethodEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return AssetTransferMethodEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + AssetTransferMethodEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_ASSET_TRANSFER_METHOD = "assetTransferMethod"; + + @SerializedName(SERIALIZED_NAME_ASSET_TRANSFER_METHOD) + @jakarta.annotation.Nonnull + private AssetTransferMethodEnum assetTransferMethod; + + public static final String SERIALIZED_NAME_SIGNER_ADDRESS = "signerAddress"; + + @SerializedName(SERIALIZED_NAME_SIGNER_ADDRESS) + @jakarta.annotation.Nonnull + private String signerAddress; + + public static final String SERIALIZED_NAME_SPENDER_ADDRESS = "spenderAddress"; + + @SerializedName(SERIALIZED_NAME_SPENDER_ADDRESS) + @jakarta.annotation.Nullable + private String spenderAddress; + + public B402PaymentRequirementsV2Extra() {} + + public B402PaymentRequirementsV2Extra name(@jakarta.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * + * @return name + */ + @jakarta.annotation.Nonnull + @NotNull + public String getName() { + return name; + } + + public void setName(@jakarta.annotation.Nonnull String name) { + this.name = name; + } + + public B402PaymentRequirementsV2Extra version(@jakarta.annotation.Nonnull String version) { + this.version = version; + return this; + } + + /** + * Get version + * + * @return version + */ + @jakarta.annotation.Nonnull + @NotNull + public String getVersion() { + return version; + } + + public void setVersion(@jakarta.annotation.Nonnull String version) { + this.version = version; + } + + public B402PaymentRequirementsV2Extra assetTransferMethod( + @jakarta.annotation.Nonnull AssetTransferMethodEnum assetTransferMethod) { + this.assetTransferMethod = assetTransferMethod; + return this; + } + + /** + * Get assetTransferMethod + * + * @return assetTransferMethod + */ + @jakarta.annotation.Nonnull + @NotNull + public AssetTransferMethodEnum getAssetTransferMethod() { + return assetTransferMethod; + } + + public void setAssetTransferMethod( + @jakarta.annotation.Nonnull AssetTransferMethodEnum assetTransferMethod) { + this.assetTransferMethod = assetTransferMethod; + } + + public B402PaymentRequirementsV2Extra signerAddress( + @jakarta.annotation.Nonnull String signerAddress) { + this.signerAddress = signerAddress; + return this; + } + + /** + * Get signerAddress + * + * @return signerAddress + */ + @jakarta.annotation.Nonnull + @NotNull + public String getSignerAddress() { + return signerAddress; + } + + public void setSignerAddress(@jakarta.annotation.Nonnull String signerAddress) { + this.signerAddress = signerAddress; + } + + public B402PaymentRequirementsV2Extra spenderAddress( + @jakarta.annotation.Nullable String spenderAddress) { + this.spenderAddress = spenderAddress; + return this; + } + + /** + * Get spenderAddress + * + * @return spenderAddress + */ + @jakarta.annotation.Nullable + public String getSpenderAddress() { + return spenderAddress; + } + + public void setSpenderAddress(@jakarta.annotation.Nullable String spenderAddress) { + this.spenderAddress = spenderAddress; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402PaymentRequirementsV2Extra b402PaymentRequirementsV2Extra = + (B402PaymentRequirementsV2Extra) o; + return Objects.equals(this.name, b402PaymentRequirementsV2Extra.name) + && Objects.equals(this.version, b402PaymentRequirementsV2Extra.version) + && Objects.equals( + this.assetTransferMethod, + b402PaymentRequirementsV2Extra.assetTransferMethod) + && Objects.equals(this.signerAddress, b402PaymentRequirementsV2Extra.signerAddress) + && Objects.equals( + this.spenderAddress, b402PaymentRequirementsV2Extra.spenderAddress); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(name, version, assetTransferMethod, signerAddress, spenderAddress); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402PaymentRequirementsV2Extra {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).append("\n"); + sb.append(" assetTransferMethod: ") + .append(toIndentedString(assetTransferMethod)) + .append("\n"); + sb.append(" signerAddress: ").append(toIndentedString(signerAddress)).append("\n"); + sb.append(" spenderAddress: ").append(toIndentedString(spenderAddress)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object nameValue = getName(); + String nameValueAsString = ""; + nameValueAsString = nameValue.toString(); + sb.append("name=").append(urlEncode(nameValueAsString)).append(""); + Object versionValue = getVersion(); + String versionValueAsString = ""; + versionValueAsString = versionValue.toString(); + sb.append("version=").append(urlEncode(versionValueAsString)).append(""); + Object assetTransferMethodValue = getAssetTransferMethod(); + String assetTransferMethodValueAsString = ""; + assetTransferMethodValueAsString = assetTransferMethodValue.toString(); + sb.append("assetTransferMethod=") + .append(urlEncode(assetTransferMethodValueAsString)) + .append(""); + Object signerAddressValue = getSignerAddress(); + String signerAddressValueAsString = ""; + signerAddressValueAsString = signerAddressValue.toString(); + sb.append("signerAddress=").append(urlEncode(signerAddressValueAsString)).append(""); + Object spenderAddressValue = getSpenderAddress(); + String spenderAddressValueAsString = ""; + spenderAddressValueAsString = spenderAddressValue.toString(); + sb.append("spenderAddress=").append(urlEncode(spenderAddressValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("version"); + openapiFields.add("assetTransferMethod"); + openapiFields.add("signerAddress"); + openapiFields.add("spenderAddress"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("version"); + openapiRequiredFields.add("assetTransferMethod"); + openapiRequiredFields.add("signerAddress"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * B402PaymentRequirementsV2Extra + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402PaymentRequirementsV2Extra.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in B402PaymentRequirementsV2Extra is not" + + " found in the empty JSON string", + B402PaymentRequirementsV2Extra.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : B402PaymentRequirementsV2Extra.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `name` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("name").toString())); + } + if (!jsonObj.get("version").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `version` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("version").toString())); + } + if (!jsonObj.get("assetTransferMethod").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `assetTransferMethod` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("assetTransferMethod").toString())); + } + // validate the required field `assetTransferMethod` + AssetTransferMethodEnum.validateJsonElement(jsonObj.get("assetTransferMethod")); + if (!jsonObj.get("signerAddress").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `signerAddress` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("signerAddress").toString())); + } + if ((jsonObj.get("spenderAddress") != null && !jsonObj.get("spenderAddress").isJsonNull()) + && !jsonObj.get("spenderAddress").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `spenderAddress` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("spenderAddress").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402PaymentRequirementsV2Extra.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'B402PaymentRequirementsV2Extra' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(B402PaymentRequirementsV2Extra.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, B402PaymentRequirementsV2Extra value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402PaymentRequirementsV2Extra read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402PaymentRequirementsV2Extra given an JSON string + * + * @param jsonString JSON string + * @return An instance of B402PaymentRequirementsV2Extra + * @throws IOException if the JSON string is invalid with respect to + * B402PaymentRequirementsV2Extra + */ + public static B402PaymentRequirementsV2Extra fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, B402PaymentRequirementsV2Extra.class); + } + + /** + * Convert an instance of B402PaymentRequirementsV2Extra to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402Permit2Authorization.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402Permit2Authorization.java new file mode 100644 index 0000000..0b4a9b4 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402Permit2Authorization.java @@ -0,0 +1,423 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** B402Permit2Authorization */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402Permit2Authorization { + public static final String SERIALIZED_NAME_PERMITTED = "permitted"; + + @SerializedName(SERIALIZED_NAME_PERMITTED) + @jakarta.annotation.Nonnull + private B402Permit2AuthorizationPermitted permitted; + + public static final String SERIALIZED_NAME_FROM = "from"; + + @SerializedName(SERIALIZED_NAME_FROM) + @jakarta.annotation.Nonnull + private String from; + + public static final String SERIALIZED_NAME_SPENDER = "spender"; + + @SerializedName(SERIALIZED_NAME_SPENDER) + @jakarta.annotation.Nonnull + private String spender; + + public static final String SERIALIZED_NAME_NONCE = "nonce"; + + @SerializedName(SERIALIZED_NAME_NONCE) + @jakarta.annotation.Nonnull + private String nonce; + + public static final String SERIALIZED_NAME_DEADLINE = "deadline"; + + @SerializedName(SERIALIZED_NAME_DEADLINE) + @jakarta.annotation.Nonnull + private String deadline; + + public static final String SERIALIZED_NAME_WITNESS = "witness"; + + @SerializedName(SERIALIZED_NAME_WITNESS) + @jakarta.annotation.Nonnull + private B402Permit2AuthorizationWitness witness; + + public B402Permit2Authorization() {} + + public B402Permit2Authorization permitted( + @jakarta.annotation.Nonnull B402Permit2AuthorizationPermitted permitted) { + this.permitted = permitted; + return this; + } + + /** + * Get permitted + * + * @return permitted + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public B402Permit2AuthorizationPermitted getPermitted() { + return permitted; + } + + public void setPermitted( + @jakarta.annotation.Nonnull B402Permit2AuthorizationPermitted permitted) { + this.permitted = permitted; + } + + public B402Permit2Authorization from(@jakarta.annotation.Nonnull String from) { + this.from = from; + return this; + } + + /** + * Get from + * + * @return from + */ + @jakarta.annotation.Nonnull + @NotNull + public String getFrom() { + return from; + } + + public void setFrom(@jakarta.annotation.Nonnull String from) { + this.from = from; + } + + public B402Permit2Authorization spender(@jakarta.annotation.Nonnull String spender) { + this.spender = spender; + return this; + } + + /** + * Get spender + * + * @return spender + */ + @jakarta.annotation.Nonnull + @NotNull + public String getSpender() { + return spender; + } + + public void setSpender(@jakarta.annotation.Nonnull String spender) { + this.spender = spender; + } + + public B402Permit2Authorization nonce(@jakarta.annotation.Nonnull String nonce) { + this.nonce = nonce; + return this; + } + + /** + * Get nonce + * + * @return nonce + */ + @jakarta.annotation.Nonnull + @NotNull + public String getNonce() { + return nonce; + } + + public void setNonce(@jakarta.annotation.Nonnull String nonce) { + this.nonce = nonce; + } + + public B402Permit2Authorization deadline(@jakarta.annotation.Nonnull String deadline) { + this.deadline = deadline; + return this; + } + + /** + * Get deadline + * + * @return deadline + */ + @jakarta.annotation.Nonnull + @NotNull + public String getDeadline() { + return deadline; + } + + public void setDeadline(@jakarta.annotation.Nonnull String deadline) { + this.deadline = deadline; + } + + public B402Permit2Authorization witness( + @jakarta.annotation.Nonnull B402Permit2AuthorizationWitness witness) { + this.witness = witness; + return this; + } + + /** + * Get witness + * + * @return witness + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public B402Permit2AuthorizationWitness getWitness() { + return witness; + } + + public void setWitness(@jakarta.annotation.Nonnull B402Permit2AuthorizationWitness witness) { + this.witness = witness; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402Permit2Authorization b402Permit2Authorization = (B402Permit2Authorization) o; + return Objects.equals(this.permitted, b402Permit2Authorization.permitted) + && Objects.equals(this.from, b402Permit2Authorization.from) + && Objects.equals(this.spender, b402Permit2Authorization.spender) + && Objects.equals(this.nonce, b402Permit2Authorization.nonce) + && Objects.equals(this.deadline, b402Permit2Authorization.deadline) + && Objects.equals(this.witness, b402Permit2Authorization.witness); + } + + @Override + public int hashCode() { + return Objects.hash(permitted, from, spender, nonce, deadline, witness); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402Permit2Authorization {\n"); + sb.append(" permitted: ").append(toIndentedString(permitted)).append("\n"); + sb.append(" from: ").append(toIndentedString(from)).append("\n"); + sb.append(" spender: ").append(toIndentedString(spender)).append("\n"); + sb.append(" nonce: ").append(toIndentedString(nonce)).append("\n"); + sb.append(" deadline: ").append(toIndentedString(deadline)).append("\n"); + sb.append(" witness: ").append(toIndentedString(witness)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object permittedValue = getPermitted(); + String permittedValueAsString = ""; + permittedValueAsString = permittedValue.toString(); + sb.append("permitted=").append(urlEncode(permittedValueAsString)).append(""); + Object fromValue = getFrom(); + String fromValueAsString = ""; + fromValueAsString = fromValue.toString(); + sb.append("from=").append(urlEncode(fromValueAsString)).append(""); + Object spenderValue = getSpender(); + String spenderValueAsString = ""; + spenderValueAsString = spenderValue.toString(); + sb.append("spender=").append(urlEncode(spenderValueAsString)).append(""); + Object nonceValue = getNonce(); + String nonceValueAsString = ""; + nonceValueAsString = nonceValue.toString(); + sb.append("nonce=").append(urlEncode(nonceValueAsString)).append(""); + Object deadlineValue = getDeadline(); + String deadlineValueAsString = ""; + deadlineValueAsString = deadlineValue.toString(); + sb.append("deadline=").append(urlEncode(deadlineValueAsString)).append(""); + Object witnessValue = getWitness(); + String witnessValueAsString = ""; + witnessValueAsString = witnessValue.toString(); + sb.append("witness=").append(urlEncode(witnessValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("permitted"); + openapiFields.add("from"); + openapiFields.add("spender"); + openapiFields.add("nonce"); + openapiFields.add("deadline"); + openapiFields.add("witness"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("permitted"); + openapiRequiredFields.add("from"); + openapiRequiredFields.add("spender"); + openapiRequiredFields.add("nonce"); + openapiRequiredFields.add("deadline"); + openapiRequiredFields.add("witness"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to B402Permit2Authorization + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402Permit2Authorization.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in B402Permit2Authorization is not found" + + " in the empty JSON string", + B402Permit2Authorization.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : B402Permit2Authorization.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `permitted` + B402Permit2AuthorizationPermitted.validateJsonElement(jsonObj.get("permitted")); + if (!jsonObj.get("from").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `from` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("from").toString())); + } + if (!jsonObj.get("spender").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `spender` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("spender").toString())); + } + if (!jsonObj.get("nonce").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `nonce` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("nonce").toString())); + } + if (!jsonObj.get("deadline").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `deadline` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("deadline").toString())); + } + // validate the required field `witness` + B402Permit2AuthorizationWitness.validateJsonElement(jsonObj.get("witness")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402Permit2Authorization.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'B402Permit2Authorization' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(B402Permit2Authorization.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, B402Permit2Authorization value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402Permit2Authorization read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402Permit2Authorization given an JSON string + * + * @param jsonString JSON string + * @return An instance of B402Permit2Authorization + * @throws IOException if the JSON string is invalid with respect to B402Permit2Authorization + */ + public static B402Permit2Authorization fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, B402Permit2Authorization.class); + } + + /** + * Convert an instance of B402Permit2Authorization to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402Permit2AuthorizationPermitted.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402Permit2AuthorizationPermitted.java new file mode 100644 index 0000000..8a58f3f --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402Permit2AuthorizationPermitted.java @@ -0,0 +1,269 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** B402Permit2AuthorizationPermitted */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402Permit2AuthorizationPermitted { + public static final String SERIALIZED_NAME_TOKEN = "token"; + + @SerializedName(SERIALIZED_NAME_TOKEN) + @jakarta.annotation.Nonnull + private String token; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + + @SerializedName(SERIALIZED_NAME_AMOUNT) + @jakarta.annotation.Nonnull + private String amount; + + public B402Permit2AuthorizationPermitted() {} + + public B402Permit2AuthorizationPermitted token(@jakarta.annotation.Nonnull String token) { + this.token = token; + return this; + } + + /** + * Get token + * + * @return token + */ + @jakarta.annotation.Nonnull + @NotNull + public String getToken() { + return token; + } + + public void setToken(@jakarta.annotation.Nonnull String token) { + this.token = token; + } + + public B402Permit2AuthorizationPermitted amount(@jakarta.annotation.Nonnull String amount) { + this.amount = amount; + return this; + } + + /** + * Get amount + * + * @return amount + */ + @jakarta.annotation.Nonnull + @NotNull + public String getAmount() { + return amount; + } + + public void setAmount(@jakarta.annotation.Nonnull String amount) { + this.amount = amount; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402Permit2AuthorizationPermitted b402Permit2AuthorizationPermitted = + (B402Permit2AuthorizationPermitted) o; + return Objects.equals(this.token, b402Permit2AuthorizationPermitted.token) + && Objects.equals(this.amount, b402Permit2AuthorizationPermitted.amount); + } + + @Override + public int hashCode() { + return Objects.hash(token, amount); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402Permit2AuthorizationPermitted {\n"); + sb.append(" token: ").append(toIndentedString(token)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object tokenValue = getToken(); + String tokenValueAsString = ""; + tokenValueAsString = tokenValue.toString(); + sb.append("token=").append(urlEncode(tokenValueAsString)).append(""); + Object amountValue = getAmount(); + String amountValueAsString = ""; + amountValueAsString = amountValue.toString(); + sb.append("amount=").append(urlEncode(amountValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("token"); + openapiFields.add("amount"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("token"); + openapiRequiredFields.add("amount"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * B402Permit2AuthorizationPermitted + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402Permit2AuthorizationPermitted.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in B402Permit2AuthorizationPermitted is" + + " not found in the empty JSON string", + B402Permit2AuthorizationPermitted.openapiRequiredFields + .toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : B402Permit2AuthorizationPermitted.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("token").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `token` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("token").toString())); + } + if (!jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `amount` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("amount").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402Permit2AuthorizationPermitted.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'B402Permit2AuthorizationPermitted' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(B402Permit2AuthorizationPermitted.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, B402Permit2AuthorizationPermitted value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402Permit2AuthorizationPermitted read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402Permit2AuthorizationPermitted given an JSON string + * + * @param jsonString JSON string + * @return An instance of B402Permit2AuthorizationPermitted + * @throws IOException if the JSON string is invalid with respect to + * B402Permit2AuthorizationPermitted + */ + public static B402Permit2AuthorizationPermitted fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, B402Permit2AuthorizationPermitted.class); + } + + /** + * Convert an instance of B402Permit2AuthorizationPermitted to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402Permit2AuthorizationWitness.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402Permit2AuthorizationWitness.java new file mode 100644 index 0000000..266b1d5 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402Permit2AuthorizationWitness.java @@ -0,0 +1,328 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** B402Permit2AuthorizationWitness */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402Permit2AuthorizationWitness { + public static final String SERIALIZED_NAME_TO = "to"; + + @SerializedName(SERIALIZED_NAME_TO) + @jakarta.annotation.Nonnull + private String to; + + public static final String SERIALIZED_NAME_FACILITATOR = "facilitator"; + + @SerializedName(SERIALIZED_NAME_FACILITATOR) + @jakarta.annotation.Nullable + private String facilitator; + + public static final String SERIALIZED_NAME_VALID_AFTER = "validAfter"; + + @SerializedName(SERIALIZED_NAME_VALID_AFTER) + @jakarta.annotation.Nonnull + private String validAfter; + + public B402Permit2AuthorizationWitness() {} + + public B402Permit2AuthorizationWitness to(@jakarta.annotation.Nonnull String to) { + this.to = to; + return this; + } + + /** + * Get to + * + * @return to + */ + @jakarta.annotation.Nonnull + @NotNull + public String getTo() { + return to; + } + + public void setTo(@jakarta.annotation.Nonnull String to) { + this.to = to; + } + + public B402Permit2AuthorizationWitness facilitator( + @jakarta.annotation.Nullable String facilitator) { + this.facilitator = facilitator; + return this; + } + + /** + * Get facilitator + * + * @return facilitator + */ + @jakarta.annotation.Nullable + public String getFacilitator() { + return facilitator; + } + + public void setFacilitator(@jakarta.annotation.Nullable String facilitator) { + this.facilitator = facilitator; + } + + public B402Permit2AuthorizationWitness validAfter( + @jakarta.annotation.Nonnull String validAfter) { + this.validAfter = validAfter; + return this; + } + + /** + * Get validAfter + * + * @return validAfter + */ + @jakarta.annotation.Nonnull + @NotNull + public String getValidAfter() { + return validAfter; + } + + public void setValidAfter(@jakarta.annotation.Nonnull String validAfter) { + this.validAfter = validAfter; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402Permit2AuthorizationWitness b402Permit2AuthorizationWitness = + (B402Permit2AuthorizationWitness) o; + return Objects.equals(this.to, b402Permit2AuthorizationWitness.to) + && Objects.equals(this.facilitator, b402Permit2AuthorizationWitness.facilitator) + && Objects.equals(this.validAfter, b402Permit2AuthorizationWitness.validAfter); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(to, facilitator, validAfter); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402Permit2AuthorizationWitness {\n"); + sb.append(" to: ").append(toIndentedString(to)).append("\n"); + sb.append(" facilitator: ").append(toIndentedString(facilitator)).append("\n"); + sb.append(" validAfter: ").append(toIndentedString(validAfter)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object toValue = getTo(); + String toValueAsString = ""; + toValueAsString = toValue.toString(); + sb.append("to=").append(urlEncode(toValueAsString)).append(""); + Object facilitatorValue = getFacilitator(); + String facilitatorValueAsString = ""; + facilitatorValueAsString = facilitatorValue.toString(); + sb.append("facilitator=").append(urlEncode(facilitatorValueAsString)).append(""); + Object validAfterValue = getValidAfter(); + String validAfterValueAsString = ""; + validAfterValueAsString = validAfterValue.toString(); + sb.append("validAfter=").append(urlEncode(validAfterValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("to"); + openapiFields.add("facilitator"); + openapiFields.add("validAfter"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("to"); + openapiRequiredFields.add("validAfter"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * B402Permit2AuthorizationWitness + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402Permit2AuthorizationWitness.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in B402Permit2AuthorizationWitness is not" + + " found in the empty JSON string", + B402Permit2AuthorizationWitness.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : B402Permit2AuthorizationWitness.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("to").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `to` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("to").toString())); + } + if ((jsonObj.get("facilitator") != null && !jsonObj.get("facilitator").isJsonNull()) + && !jsonObj.get("facilitator").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `facilitator` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("facilitator").toString())); + } + if (!jsonObj.get("validAfter").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `validAfter` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("validAfter").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402Permit2AuthorizationWitness.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'B402Permit2AuthorizationWitness' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(B402Permit2AuthorizationWitness.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, B402Permit2AuthorizationWitness value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402Permit2AuthorizationWitness read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402Permit2AuthorizationWitness given an JSON string + * + * @param jsonString JSON string + * @return An instance of B402Permit2AuthorizationWitness + * @throws IOException if the JSON string is invalid with respect to + * B402Permit2AuthorizationWitness + */ + public static B402Permit2AuthorizationWitness fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, B402Permit2AuthorizationWitness.class); + } + + /** + * Convert an instance of B402Permit2AuthorizationWitness to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402Permit2Permitted.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402Permit2Permitted.java new file mode 100644 index 0000000..4c6296f --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402Permit2Permitted.java @@ -0,0 +1,262 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** B402Permit2Permitted */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402Permit2Permitted { + public static final String SERIALIZED_NAME_TOKEN = "token"; + + @SerializedName(SERIALIZED_NAME_TOKEN) + @jakarta.annotation.Nonnull + private String token; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + + @SerializedName(SERIALIZED_NAME_AMOUNT) + @jakarta.annotation.Nonnull + private String amount; + + public B402Permit2Permitted() {} + + public B402Permit2Permitted token(@jakarta.annotation.Nonnull String token) { + this.token = token; + return this; + } + + /** + * Get token + * + * @return token + */ + @jakarta.annotation.Nonnull + @NotNull + public String getToken() { + return token; + } + + public void setToken(@jakarta.annotation.Nonnull String token) { + this.token = token; + } + + public B402Permit2Permitted amount(@jakarta.annotation.Nonnull String amount) { + this.amount = amount; + return this; + } + + /** + * Get amount + * + * @return amount + */ + @jakarta.annotation.Nonnull + @NotNull + public String getAmount() { + return amount; + } + + public void setAmount(@jakarta.annotation.Nonnull String amount) { + this.amount = amount; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402Permit2Permitted b402Permit2Permitted = (B402Permit2Permitted) o; + return Objects.equals(this.token, b402Permit2Permitted.token) + && Objects.equals(this.amount, b402Permit2Permitted.amount); + } + + @Override + public int hashCode() { + return Objects.hash(token, amount); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402Permit2Permitted {\n"); + sb.append(" token: ").append(toIndentedString(token)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object tokenValue = getToken(); + String tokenValueAsString = ""; + tokenValueAsString = tokenValue.toString(); + sb.append("token=").append(urlEncode(tokenValueAsString)).append(""); + Object amountValue = getAmount(); + String amountValueAsString = ""; + amountValueAsString = amountValue.toString(); + sb.append("amount=").append(urlEncode(amountValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("token"); + openapiFields.add("amount"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("token"); + openapiRequiredFields.add("amount"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to B402Permit2Permitted + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402Permit2Permitted.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in B402Permit2Permitted is not found in" + + " the empty JSON string", + B402Permit2Permitted.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : B402Permit2Permitted.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("token").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `token` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("token").toString())); + } + if (!jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `amount` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("amount").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402Permit2Permitted.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'B402Permit2Permitted' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(B402Permit2Permitted.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, B402Permit2Permitted value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402Permit2Permitted read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402Permit2Permitted given an JSON string + * + * @param jsonString JSON string + * @return An instance of B402Permit2Permitted + * @throws IOException if the JSON string is invalid with respect to B402Permit2Permitted + */ + public static B402Permit2Permitted fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, B402Permit2Permitted.class); + } + + /** + * Convert an instance of B402Permit2Permitted to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402Permit2Witness.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402Permit2Witness.java new file mode 100644 index 0000000..d6b5c4f --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402Permit2Witness.java @@ -0,0 +1,320 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** B402Permit2Witness */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402Permit2Witness { + public static final String SERIALIZED_NAME_TO = "to"; + + @SerializedName(SERIALIZED_NAME_TO) + @jakarta.annotation.Nonnull + private String to; + + public static final String SERIALIZED_NAME_FACILITATOR = "facilitator"; + + @SerializedName(SERIALIZED_NAME_FACILITATOR) + @jakarta.annotation.Nullable + private String facilitator; + + public static final String SERIALIZED_NAME_VALID_AFTER = "validAfter"; + + @SerializedName(SERIALIZED_NAME_VALID_AFTER) + @jakarta.annotation.Nonnull + private String validAfter; + + public B402Permit2Witness() {} + + public B402Permit2Witness to(@jakarta.annotation.Nonnull String to) { + this.to = to; + return this; + } + + /** + * Get to + * + * @return to + */ + @jakarta.annotation.Nonnull + @NotNull + public String getTo() { + return to; + } + + public void setTo(@jakarta.annotation.Nonnull String to) { + this.to = to; + } + + public B402Permit2Witness facilitator(@jakarta.annotation.Nullable String facilitator) { + this.facilitator = facilitator; + return this; + } + + /** + * Get facilitator + * + * @return facilitator + */ + @jakarta.annotation.Nullable + public String getFacilitator() { + return facilitator; + } + + public void setFacilitator(@jakarta.annotation.Nullable String facilitator) { + this.facilitator = facilitator; + } + + public B402Permit2Witness validAfter(@jakarta.annotation.Nonnull String validAfter) { + this.validAfter = validAfter; + return this; + } + + /** + * Get validAfter + * + * @return validAfter + */ + @jakarta.annotation.Nonnull + @NotNull + public String getValidAfter() { + return validAfter; + } + + public void setValidAfter(@jakarta.annotation.Nonnull String validAfter) { + this.validAfter = validAfter; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402Permit2Witness b402Permit2Witness = (B402Permit2Witness) o; + return Objects.equals(this.to, b402Permit2Witness.to) + && Objects.equals(this.facilitator, b402Permit2Witness.facilitator) + && Objects.equals(this.validAfter, b402Permit2Witness.validAfter); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(to, facilitator, validAfter); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402Permit2Witness {\n"); + sb.append(" to: ").append(toIndentedString(to)).append("\n"); + sb.append(" facilitator: ").append(toIndentedString(facilitator)).append("\n"); + sb.append(" validAfter: ").append(toIndentedString(validAfter)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object toValue = getTo(); + String toValueAsString = ""; + toValueAsString = toValue.toString(); + sb.append("to=").append(urlEncode(toValueAsString)).append(""); + Object facilitatorValue = getFacilitator(); + String facilitatorValueAsString = ""; + facilitatorValueAsString = facilitatorValue.toString(); + sb.append("facilitator=").append(urlEncode(facilitatorValueAsString)).append(""); + Object validAfterValue = getValidAfter(); + String validAfterValueAsString = ""; + validAfterValueAsString = validAfterValue.toString(); + sb.append("validAfter=").append(urlEncode(validAfterValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("to"); + openapiFields.add("facilitator"); + openapiFields.add("validAfter"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("to"); + openapiRequiredFields.add("validAfter"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to B402Permit2Witness + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402Permit2Witness.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in B402Permit2Witness is not found in the" + + " empty JSON string", + B402Permit2Witness.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : B402Permit2Witness.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("to").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `to` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("to").toString())); + } + if ((jsonObj.get("facilitator") != null && !jsonObj.get("facilitator").isJsonNull()) + && !jsonObj.get("facilitator").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `facilitator` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("facilitator").toString())); + } + if (!jsonObj.get("validAfter").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `validAfter` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("validAfter").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402Permit2Witness.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'B402Permit2Witness' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(B402Permit2Witness.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, B402Permit2Witness value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402Permit2Witness read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402Permit2Witness given an JSON string + * + * @param jsonString JSON string + * @return An instance of B402Permit2Witness + * @throws IOException if the JSON string is invalid with respect to B402Permit2Witness + */ + public static B402Permit2Witness fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, B402Permit2Witness.class); + } + + /** + * Convert an instance of B402Permit2Witness to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402RequestEnvelopeSupported.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402RequestEnvelopeSupported.java new file mode 100644 index 0000000..1d9b8ff --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402RequestEnvelopeSupported.java @@ -0,0 +1,219 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** B402RequestEnvelopeSupported */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402RequestEnvelopeSupported { + public static final String SERIALIZED_NAME_BODY = "body"; + + @SerializedName(SERIALIZED_NAME_BODY) + @jakarta.annotation.Nonnull + private Object body; + + public B402RequestEnvelopeSupported() {} + + public B402RequestEnvelopeSupported body(@jakarta.annotation.Nonnull Object body) { + this.body = body; + return this; + } + + /** + * Get body + * + * @return body + */ + @jakarta.annotation.Nonnull + @NotNull + public Object getBody() { + return body; + } + + public void setBody(@jakarta.annotation.Nonnull Object body) { + this.body = body; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402RequestEnvelopeSupported b402RequestEnvelopeSupported = + (B402RequestEnvelopeSupported) o; + return Objects.equals(this.body, b402RequestEnvelopeSupported.body); + } + + @Override + public int hashCode() { + return Objects.hash(body); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402RequestEnvelopeSupported {\n"); + sb.append(" body: ").append(toIndentedString(body)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object bodyValue = getBody(); + String bodyValueAsString = ""; + bodyValueAsString = bodyValue.toString(); + sb.append("body=").append(urlEncode(bodyValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("body"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("body"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * B402RequestEnvelopeSupported + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402RequestEnvelopeSupported.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in B402RequestEnvelopeSupported is not" + + " found in the empty JSON string", + B402RequestEnvelopeSupported.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : B402RequestEnvelopeSupported.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402RequestEnvelopeSupported.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'B402RequestEnvelopeSupported' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(B402RequestEnvelopeSupported.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, B402RequestEnvelopeSupported value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402RequestEnvelopeSupported read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402RequestEnvelopeSupported given an JSON string + * + * @param jsonString JSON string + * @return An instance of B402RequestEnvelopeSupported + * @throws IOException if the JSON string is invalid with respect to + * B402RequestEnvelopeSupported + */ + public static B402RequestEnvelopeSupported fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, B402RequestEnvelopeSupported.class); + } + + /** + * Convert an instance of B402RequestEnvelopeSupported to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402ResourceInfoV2.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402ResourceInfoV2.java new file mode 100644 index 0000000..535e99e --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402ResourceInfoV2.java @@ -0,0 +1,304 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URI; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** B402ResourceInfoV2 */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402ResourceInfoV2 { + public static final String SERIALIZED_NAME_URL = "url"; + + @SerializedName(SERIALIZED_NAME_URL) + @jakarta.annotation.Nonnull + private URI url; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @jakarta.annotation.Nullable + private String description; + + public static final String SERIALIZED_NAME_MIME_TYPE = "mimeType"; + + @SerializedName(SERIALIZED_NAME_MIME_TYPE) + @jakarta.annotation.Nullable + private String mimeType; + + public B402ResourceInfoV2() {} + + public B402ResourceInfoV2 url(@jakarta.annotation.Nonnull URI url) { + this.url = url; + return this; + } + + /** + * Get url + * + * @return url + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public URI getUrl() { + return url; + } + + public void setUrl(@jakarta.annotation.Nonnull URI url) { + this.url = url; + } + + public B402ResourceInfoV2 description(@jakarta.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Get description + * + * @return description + */ + @jakarta.annotation.Nullable + public String getDescription() { + return description; + } + + public void setDescription(@jakarta.annotation.Nullable String description) { + this.description = description; + } + + public B402ResourceInfoV2 mimeType(@jakarta.annotation.Nullable String mimeType) { + this.mimeType = mimeType; + return this; + } + + /** + * Get mimeType + * + * @return mimeType + */ + @jakarta.annotation.Nullable + public String getMimeType() { + return mimeType; + } + + public void setMimeType(@jakarta.annotation.Nullable String mimeType) { + this.mimeType = mimeType; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402ResourceInfoV2 b402ResourceInfoV2 = (B402ResourceInfoV2) o; + return Objects.equals(this.url, b402ResourceInfoV2.url) + && Objects.equals(this.description, b402ResourceInfoV2.description) + && Objects.equals(this.mimeType, b402ResourceInfoV2.mimeType); + } + + @Override + public int hashCode() { + return Objects.hash(url, description, mimeType); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402ResourceInfoV2 {\n"); + sb.append(" url: ").append(toIndentedString(url)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" mimeType: ").append(toIndentedString(mimeType)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object urlValue = getUrl(); + String urlValueAsString = ""; + urlValueAsString = urlValue.toString(); + sb.append("url=").append(urlEncode(urlValueAsString)).append(""); + Object descriptionValue = getDescription(); + String descriptionValueAsString = ""; + descriptionValueAsString = descriptionValue.toString(); + sb.append("description=").append(urlEncode(descriptionValueAsString)).append(""); + Object mimeTypeValue = getMimeType(); + String mimeTypeValueAsString = ""; + mimeTypeValueAsString = mimeTypeValue.toString(); + sb.append("mimeType=").append(urlEncode(mimeTypeValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("url"); + openapiFields.add("description"); + openapiFields.add("mimeType"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("url"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to B402ResourceInfoV2 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402ResourceInfoV2.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in B402ResourceInfoV2 is not found in the" + + " empty JSON string", + B402ResourceInfoV2.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : B402ResourceInfoV2.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("url").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `url` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("url").toString())); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) + && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `description` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("description").toString())); + } + if ((jsonObj.get("mimeType") != null && !jsonObj.get("mimeType").isJsonNull()) + && !jsonObj.get("mimeType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `mimeType` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("mimeType").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402ResourceInfoV2.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'B402ResourceInfoV2' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(B402ResourceInfoV2.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, B402ResourceInfoV2 value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402ResourceInfoV2 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402ResourceInfoV2 given an JSON string + * + * @param jsonString JSON string + * @return An instance of B402ResourceInfoV2 + * @throws IOException if the JSON string is invalid with respect to B402ResourceInfoV2 + */ + public static B402ResourceInfoV2 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, B402ResourceInfoV2.class); + } + + /** + * Convert an instance of B402ResourceInfoV2 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SettleDataV1.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SettleDataV1.java new file mode 100644 index 0000000..b9c10ff --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SettleDataV1.java @@ -0,0 +1,512 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** B402SettleDataV1 */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402SettleDataV1 { + public static final String SERIALIZED_NAME_SUCCESS = "success"; + + @SerializedName(SERIALIZED_NAME_SUCCESS) + @jakarta.annotation.Nonnull + private Boolean success; + + public static final String SERIALIZED_NAME_TRANSACTION = "transaction"; + + @SerializedName(SERIALIZED_NAME_TRANSACTION) + @jakarta.annotation.Nullable + private String transaction; + + public static final String SERIALIZED_NAME_PAYER = "payer"; + + @SerializedName(SERIALIZED_NAME_PAYER) + @jakarta.annotation.Nullable + private String payer; + + public static final String SERIALIZED_NAME_NETWORK = "network"; + + @SerializedName(SERIALIZED_NAME_NETWORK) + @jakarta.annotation.Nullable + private String network; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + + @SerializedName(SERIALIZED_NAME_AMOUNT) + @jakarta.annotation.Nullable + private String amount; + + public static final String SERIALIZED_NAME_CONFIRMATIONS = "confirmations"; + + @SerializedName(SERIALIZED_NAME_CONFIRMATIONS) + @jakarta.annotation.Nullable + private Integer confirmations; + + public static final String SERIALIZED_NAME_ERROR_REASON = "errorReason"; + + @SerializedName(SERIALIZED_NAME_ERROR_REASON) + @jakarta.annotation.Nullable + private String errorReason; + + public static final String SERIALIZED_NAME_ERROR_MESSAGE = "errorMessage"; + + @SerializedName(SERIALIZED_NAME_ERROR_MESSAGE) + @jakarta.annotation.Nullable + private String errorMessage; + + public B402SettleDataV1() {} + + public B402SettleDataV1 success(@jakarta.annotation.Nonnull Boolean success) { + this.success = success; + return this; + } + + /** + * Get success + * + * @return success + */ + @jakarta.annotation.Nonnull + @NotNull + public Boolean getSuccess() { + return success; + } + + public void setSuccess(@jakarta.annotation.Nonnull Boolean success) { + this.success = success; + } + + public B402SettleDataV1 transaction(@jakarta.annotation.Nullable String transaction) { + this.transaction = transaction; + return this; + } + + /** + * Get transaction + * + * @return transaction + */ + @jakarta.annotation.Nullable + public String getTransaction() { + return transaction; + } + + public void setTransaction(@jakarta.annotation.Nullable String transaction) { + this.transaction = transaction; + } + + public B402SettleDataV1 payer(@jakarta.annotation.Nullable String payer) { + this.payer = payer; + return this; + } + + /** + * Get payer + * + * @return payer + */ + @jakarta.annotation.Nullable + public String getPayer() { + return payer; + } + + public void setPayer(@jakarta.annotation.Nullable String payer) { + this.payer = payer; + } + + public B402SettleDataV1 network(@jakarta.annotation.Nullable String network) { + this.network = network; + return this; + } + + /** + * Get network + * + * @return network + */ + @jakarta.annotation.Nullable + public String getNetwork() { + return network; + } + + public void setNetwork(@jakarta.annotation.Nullable String network) { + this.network = network; + } + + public B402SettleDataV1 amount(@jakarta.annotation.Nullable String amount) { + this.amount = amount; + return this; + } + + /** + * Get amount + * + * @return amount + */ + @jakarta.annotation.Nullable + public String getAmount() { + return amount; + } + + public void setAmount(@jakarta.annotation.Nullable String amount) { + this.amount = amount; + } + + public B402SettleDataV1 confirmations(@jakarta.annotation.Nullable Integer confirmations) { + this.confirmations = confirmations; + return this; + } + + /** + * Get confirmations + * + * @return confirmations + */ + @jakarta.annotation.Nullable + public Integer getConfirmations() { + return confirmations; + } + + public void setConfirmations(@jakarta.annotation.Nullable Integer confirmations) { + this.confirmations = confirmations; + } + + public B402SettleDataV1 errorReason(@jakarta.annotation.Nullable String errorReason) { + this.errorReason = errorReason; + return this; + } + + /** + * Get errorReason + * + * @return errorReason + */ + @jakarta.annotation.Nullable + public String getErrorReason() { + return errorReason; + } + + public void setErrorReason(@jakarta.annotation.Nullable String errorReason) { + this.errorReason = errorReason; + } + + public B402SettleDataV1 errorMessage(@jakarta.annotation.Nullable String errorMessage) { + this.errorMessage = errorMessage; + return this; + } + + /** + * Get errorMessage + * + * @return errorMessage + */ + @jakarta.annotation.Nullable + public String getErrorMessage() { + return errorMessage; + } + + public void setErrorMessage(@jakarta.annotation.Nullable String errorMessage) { + this.errorMessage = errorMessage; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402SettleDataV1 b402SettleDataV1 = (B402SettleDataV1) o; + return Objects.equals(this.success, b402SettleDataV1.success) + && Objects.equals(this.transaction, b402SettleDataV1.transaction) + && Objects.equals(this.payer, b402SettleDataV1.payer) + && Objects.equals(this.network, b402SettleDataV1.network) + && Objects.equals(this.amount, b402SettleDataV1.amount) + && Objects.equals(this.confirmations, b402SettleDataV1.confirmations) + && Objects.equals(this.errorReason, b402SettleDataV1.errorReason) + && Objects.equals(this.errorMessage, b402SettleDataV1.errorMessage); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash( + success, + transaction, + payer, + network, + amount, + confirmations, + errorReason, + errorMessage); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402SettleDataV1 {\n"); + sb.append(" success: ").append(toIndentedString(success)).append("\n"); + sb.append(" transaction: ").append(toIndentedString(transaction)).append("\n"); + sb.append(" payer: ").append(toIndentedString(payer)).append("\n"); + sb.append(" network: ").append(toIndentedString(network)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" confirmations: ").append(toIndentedString(confirmations)).append("\n"); + sb.append(" errorReason: ").append(toIndentedString(errorReason)).append("\n"); + sb.append(" errorMessage: ").append(toIndentedString(errorMessage)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object successValue = getSuccess(); + String successValueAsString = ""; + successValueAsString = successValue.toString(); + sb.append("success=").append(urlEncode(successValueAsString)).append(""); + Object transactionValue = getTransaction(); + String transactionValueAsString = ""; + transactionValueAsString = transactionValue.toString(); + sb.append("transaction=").append(urlEncode(transactionValueAsString)).append(""); + Object payerValue = getPayer(); + String payerValueAsString = ""; + payerValueAsString = payerValue.toString(); + sb.append("payer=").append(urlEncode(payerValueAsString)).append(""); + Object networkValue = getNetwork(); + String networkValueAsString = ""; + networkValueAsString = networkValue.toString(); + sb.append("network=").append(urlEncode(networkValueAsString)).append(""); + Object amountValue = getAmount(); + String amountValueAsString = ""; + amountValueAsString = amountValue.toString(); + sb.append("amount=").append(urlEncode(amountValueAsString)).append(""); + Object confirmationsValue = getConfirmations(); + String confirmationsValueAsString = ""; + confirmationsValueAsString = confirmationsValue.toString(); + sb.append("confirmations=").append(urlEncode(confirmationsValueAsString)).append(""); + Object errorReasonValue = getErrorReason(); + String errorReasonValueAsString = ""; + errorReasonValueAsString = errorReasonValue.toString(); + sb.append("errorReason=").append(urlEncode(errorReasonValueAsString)).append(""); + Object errorMessageValue = getErrorMessage(); + String errorMessageValueAsString = ""; + errorMessageValueAsString = errorMessageValue.toString(); + sb.append("errorMessage=").append(urlEncode(errorMessageValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("success"); + openapiFields.add("transaction"); + openapiFields.add("payer"); + openapiFields.add("network"); + openapiFields.add("amount"); + openapiFields.add("confirmations"); + openapiFields.add("errorReason"); + openapiFields.add("errorMessage"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("success"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to B402SettleDataV1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402SettleDataV1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in B402SettleDataV1 is not found in the" + + " empty JSON string", + B402SettleDataV1.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : B402SettleDataV1.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("transaction") != null && !jsonObj.get("transaction").isJsonNull()) + && !jsonObj.get("transaction").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `transaction` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("transaction").toString())); + } + if ((jsonObj.get("payer") != null && !jsonObj.get("payer").isJsonNull()) + && !jsonObj.get("payer").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `payer` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("payer").toString())); + } + if ((jsonObj.get("network") != null && !jsonObj.get("network").isJsonNull()) + && !jsonObj.get("network").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `network` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("network").toString())); + } + if ((jsonObj.get("amount") != null && !jsonObj.get("amount").isJsonNull()) + && !jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `amount` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("amount").toString())); + } + if ((jsonObj.get("errorReason") != null && !jsonObj.get("errorReason").isJsonNull()) + && !jsonObj.get("errorReason").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `errorReason` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("errorReason").toString())); + } + if ((jsonObj.get("errorMessage") != null && !jsonObj.get("errorMessage").isJsonNull()) + && !jsonObj.get("errorMessage").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `errorMessage` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("errorMessage").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402SettleDataV1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'B402SettleDataV1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(B402SettleDataV1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, B402SettleDataV1 value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402SettleDataV1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402SettleDataV1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of B402SettleDataV1 + * @throws IOException if the JSON string is invalid with respect to B402SettleDataV1 + */ + public static B402SettleDataV1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, B402SettleDataV1.class); + } + + /** + * Convert an instance of B402SettleDataV1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SettleDataV2.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SettleDataV2.java new file mode 100644 index 0000000..1d47b69 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SettleDataV2.java @@ -0,0 +1,525 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** B402SettleDataV2 */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402SettleDataV2 { + public static final String SERIALIZED_NAME_SUCCESS = "success"; + + @SerializedName(SERIALIZED_NAME_SUCCESS) + @jakarta.annotation.Nonnull + private Boolean success; + + public static final String SERIALIZED_NAME_TRANSACTION = "transaction"; + + @SerializedName(SERIALIZED_NAME_TRANSACTION) + @jakarta.annotation.Nonnull + private String transaction; + + public static final String SERIALIZED_NAME_PAYER = "payer"; + + @SerializedName(SERIALIZED_NAME_PAYER) + @jakarta.annotation.Nullable + private String payer; + + public static final String SERIALIZED_NAME_NETWORK = "network"; + + @SerializedName(SERIALIZED_NAME_NETWORK) + @jakarta.annotation.Nonnull + private String network; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + + @SerializedName(SERIALIZED_NAME_AMOUNT) + @jakarta.annotation.Nullable + private String amount; + + public static final String SERIALIZED_NAME_ERROR_REASON = "errorReason"; + + @SerializedName(SERIALIZED_NAME_ERROR_REASON) + @jakarta.annotation.Nullable + private String errorReason; + + public static final String SERIALIZED_NAME_ERROR_MESSAGE = "errorMessage"; + + @SerializedName(SERIALIZED_NAME_ERROR_MESSAGE) + @jakarta.annotation.Nullable + private String errorMessage; + + public static final String SERIALIZED_NAME_EXTENSIONS = "extensions"; + + @SerializedName(SERIALIZED_NAME_EXTENSIONS) + @jakarta.annotation.Nullable + private Map extensions; + + public B402SettleDataV2() {} + + public B402SettleDataV2 success(@jakarta.annotation.Nonnull Boolean success) { + this.success = success; + return this; + } + + /** + * Get success + * + * @return success + */ + @jakarta.annotation.Nonnull + @NotNull + public Boolean getSuccess() { + return success; + } + + public void setSuccess(@jakarta.annotation.Nonnull Boolean success) { + this.success = success; + } + + public B402SettleDataV2 transaction(@jakarta.annotation.Nonnull String transaction) { + this.transaction = transaction; + return this; + } + + /** + * Get transaction + * + * @return transaction + */ + @jakarta.annotation.Nonnull + @NotNull + public String getTransaction() { + return transaction; + } + + public void setTransaction(@jakarta.annotation.Nonnull String transaction) { + this.transaction = transaction; + } + + public B402SettleDataV2 payer(@jakarta.annotation.Nullable String payer) { + this.payer = payer; + return this; + } + + /** + * Get payer + * + * @return payer + */ + @jakarta.annotation.Nullable + public String getPayer() { + return payer; + } + + public void setPayer(@jakarta.annotation.Nullable String payer) { + this.payer = payer; + } + + public B402SettleDataV2 network(@jakarta.annotation.Nonnull String network) { + this.network = network; + return this; + } + + /** + * Get network + * + * @return network + */ + @jakarta.annotation.Nonnull + @NotNull + public String getNetwork() { + return network; + } + + public void setNetwork(@jakarta.annotation.Nonnull String network) { + this.network = network; + } + + public B402SettleDataV2 amount(@jakarta.annotation.Nullable String amount) { + this.amount = amount; + return this; + } + + /** + * Get amount + * + * @return amount + */ + @jakarta.annotation.Nullable + public String getAmount() { + return amount; + } + + public void setAmount(@jakarta.annotation.Nullable String amount) { + this.amount = amount; + } + + public B402SettleDataV2 errorReason(@jakarta.annotation.Nullable String errorReason) { + this.errorReason = errorReason; + return this; + } + + /** + * Get errorReason + * + * @return errorReason + */ + @jakarta.annotation.Nullable + public String getErrorReason() { + return errorReason; + } + + public void setErrorReason(@jakarta.annotation.Nullable String errorReason) { + this.errorReason = errorReason; + } + + public B402SettleDataV2 errorMessage(@jakarta.annotation.Nullable String errorMessage) { + this.errorMessage = errorMessage; + return this; + } + + /** + * Get errorMessage + * + * @return errorMessage + */ + @jakarta.annotation.Nullable + public String getErrorMessage() { + return errorMessage; + } + + public void setErrorMessage(@jakarta.annotation.Nullable String errorMessage) { + this.errorMessage = errorMessage; + } + + public B402SettleDataV2 extensions( + @jakarta.annotation.Nullable Map extensions) { + this.extensions = extensions; + return this; + } + + public B402SettleDataV2 putExtensionsItem(String key, Object extensionsItem) { + if (this.extensions == null) { + this.extensions = new HashMap<>(); + } + this.extensions.put(key, extensionsItem); + return this; + } + + /** + * Get extensions + * + * @return extensions + */ + @jakarta.annotation.Nullable + public Map getExtensions() { + return extensions; + } + + public void setExtensions(@jakarta.annotation.Nullable Map extensions) { + this.extensions = extensions; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402SettleDataV2 b402SettleDataV2 = (B402SettleDataV2) o; + return Objects.equals(this.success, b402SettleDataV2.success) + && Objects.equals(this.transaction, b402SettleDataV2.transaction) + && Objects.equals(this.payer, b402SettleDataV2.payer) + && Objects.equals(this.network, b402SettleDataV2.network) + && Objects.equals(this.amount, b402SettleDataV2.amount) + && Objects.equals(this.errorReason, b402SettleDataV2.errorReason) + && Objects.equals(this.errorMessage, b402SettleDataV2.errorMessage) + && Objects.equals(this.extensions, b402SettleDataV2.extensions); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash( + success, + transaction, + payer, + network, + amount, + errorReason, + errorMessage, + extensions); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402SettleDataV2 {\n"); + sb.append(" success: ").append(toIndentedString(success)).append("\n"); + sb.append(" transaction: ").append(toIndentedString(transaction)).append("\n"); + sb.append(" payer: ").append(toIndentedString(payer)).append("\n"); + sb.append(" network: ").append(toIndentedString(network)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" errorReason: ").append(toIndentedString(errorReason)).append("\n"); + sb.append(" errorMessage: ").append(toIndentedString(errorMessage)).append("\n"); + sb.append(" extensions: ").append(toIndentedString(extensions)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object successValue = getSuccess(); + String successValueAsString = ""; + successValueAsString = successValue.toString(); + sb.append("success=").append(urlEncode(successValueAsString)).append(""); + Object transactionValue = getTransaction(); + String transactionValueAsString = ""; + transactionValueAsString = transactionValue.toString(); + sb.append("transaction=").append(urlEncode(transactionValueAsString)).append(""); + Object payerValue = getPayer(); + String payerValueAsString = ""; + payerValueAsString = payerValue.toString(); + sb.append("payer=").append(urlEncode(payerValueAsString)).append(""); + Object networkValue = getNetwork(); + String networkValueAsString = ""; + networkValueAsString = networkValue.toString(); + sb.append("network=").append(urlEncode(networkValueAsString)).append(""); + Object amountValue = getAmount(); + String amountValueAsString = ""; + amountValueAsString = amountValue.toString(); + sb.append("amount=").append(urlEncode(amountValueAsString)).append(""); + Object errorReasonValue = getErrorReason(); + String errorReasonValueAsString = ""; + errorReasonValueAsString = errorReasonValue.toString(); + sb.append("errorReason=").append(urlEncode(errorReasonValueAsString)).append(""); + Object errorMessageValue = getErrorMessage(); + String errorMessageValueAsString = ""; + errorMessageValueAsString = errorMessageValue.toString(); + sb.append("errorMessage=").append(urlEncode(errorMessageValueAsString)).append(""); + Object extensionsValue = getExtensions(); + String extensionsValueAsString = ""; + extensionsValueAsString = extensionsValue.toString(); + sb.append("extensions=").append(urlEncode(extensionsValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("success"); + openapiFields.add("transaction"); + openapiFields.add("payer"); + openapiFields.add("network"); + openapiFields.add("amount"); + openapiFields.add("errorReason"); + openapiFields.add("errorMessage"); + openapiFields.add("extensions"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("success"); + openapiRequiredFields.add("transaction"); + openapiRequiredFields.add("network"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to B402SettleDataV2 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402SettleDataV2.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in B402SettleDataV2 is not found in the" + + " empty JSON string", + B402SettleDataV2.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : B402SettleDataV2.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("transaction").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `transaction` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("transaction").toString())); + } + if ((jsonObj.get("payer") != null && !jsonObj.get("payer").isJsonNull()) + && !jsonObj.get("payer").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `payer` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("payer").toString())); + } + if (!jsonObj.get("network").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `network` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("network").toString())); + } + if ((jsonObj.get("amount") != null && !jsonObj.get("amount").isJsonNull()) + && !jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `amount` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("amount").toString())); + } + if ((jsonObj.get("errorReason") != null && !jsonObj.get("errorReason").isJsonNull()) + && !jsonObj.get("errorReason").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `errorReason` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("errorReason").toString())); + } + if ((jsonObj.get("errorMessage") != null && !jsonObj.get("errorMessage").isJsonNull()) + && !jsonObj.get("errorMessage").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `errorMessage` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("errorMessage").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402SettleDataV2.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'B402SettleDataV2' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(B402SettleDataV2.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, B402SettleDataV2 value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402SettleDataV2 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402SettleDataV2 given an JSON string + * + * @param jsonString JSON string + * @return An instance of B402SettleDataV2 + * @throws IOException if the JSON string is invalid with respect to B402SettleDataV2 + */ + public static B402SettleDataV2 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, B402SettleDataV2.class); + } + + /** + * Convert an instance of B402SettleDataV2 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SettleEnvelopeV1.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SettleEnvelopeV1.java new file mode 100644 index 0000000..3d8c506 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SettleEnvelopeV1.java @@ -0,0 +1,218 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** B402SettleEnvelopeV1 */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402SettleEnvelopeV1 { + public static final String SERIALIZED_NAME_BODY = "body"; + + @SerializedName(SERIALIZED_NAME_BODY) + @jakarta.annotation.Nonnull + private B402SettleEnvelopeV1Body body; + + public B402SettleEnvelopeV1() {} + + public B402SettleEnvelopeV1 body(@jakarta.annotation.Nonnull B402SettleEnvelopeV1Body body) { + this.body = body; + return this; + } + + /** + * Get body + * + * @return body + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public B402SettleEnvelopeV1Body getBody() { + return body; + } + + public void setBody(@jakarta.annotation.Nonnull B402SettleEnvelopeV1Body body) { + this.body = body; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402SettleEnvelopeV1 b402SettleEnvelopeV1 = (B402SettleEnvelopeV1) o; + return Objects.equals(this.body, b402SettleEnvelopeV1.body); + } + + @Override + public int hashCode() { + return Objects.hash(body); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402SettleEnvelopeV1 {\n"); + sb.append(" body: ").append(toIndentedString(body)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object bodyValue = getBody(); + String bodyValueAsString = ""; + bodyValueAsString = bodyValue.toString(); + sb.append("body=").append(urlEncode(bodyValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("body"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("body"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to B402SettleEnvelopeV1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402SettleEnvelopeV1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in B402SettleEnvelopeV1 is not found in" + + " the empty JSON string", + B402SettleEnvelopeV1.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : B402SettleEnvelopeV1.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `body` + B402SettleEnvelopeV1Body.validateJsonElement(jsonObj.get("body")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402SettleEnvelopeV1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'B402SettleEnvelopeV1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(B402SettleEnvelopeV1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, B402SettleEnvelopeV1 value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402SettleEnvelopeV1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402SettleEnvelopeV1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of B402SettleEnvelopeV1 + * @throws IOException if the JSON string is invalid with respect to B402SettleEnvelopeV1 + */ + public static B402SettleEnvelopeV1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, B402SettleEnvelopeV1.class); + } + + /** + * Convert an instance of B402SettleEnvelopeV1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SettleEnvelopeV1Body.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SettleEnvelopeV1Body.java new file mode 100644 index 0000000..cabbc0a --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SettleEnvelopeV1Body.java @@ -0,0 +1,396 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** B402SettleEnvelopeV1Body */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402SettleEnvelopeV1Body { + /** Gets or Sets x402Version */ + @JsonAdapter(X402VersionEnum.Adapter.class) + public enum X402VersionEnum { + X402_VERSION_1(1); + + private Integer value; + + X402VersionEnum(Integer value) { + this.value = value; + } + + public Integer getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static X402VersionEnum fromValue(Integer value) { + for (X402VersionEnum b : X402VersionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final X402VersionEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public X402VersionEnum read(final JsonReader jsonReader) throws IOException { + Integer value = jsonReader.nextInt(); + return X402VersionEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + Integer value = jsonElement.getAsInt(); + X402VersionEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_X402_VERSION = "x402Version"; + + @SerializedName(SERIALIZED_NAME_X402_VERSION) + @jakarta.annotation.Nonnull + private X402VersionEnum x402Version; + + public static final String SERIALIZED_NAME_PAYMENT_PAYLOAD = "paymentPayload"; + + @SerializedName(SERIALIZED_NAME_PAYMENT_PAYLOAD) + @jakarta.annotation.Nonnull + private B402SettleRequestV1AllOfPaymentPayload paymentPayload; + + public static final String SERIALIZED_NAME_PAYMENT_REQUIREMENTS = "paymentRequirements"; + + @SerializedName(SERIALIZED_NAME_PAYMENT_REQUIREMENTS) + @jakarta.annotation.Nonnull + private B402SettleRequestV1AllOfPaymentRequirements paymentRequirements; + + public static final String SERIALIZED_NAME_SETTLE_AMOUNT = "settleAmount"; + + @SerializedName(SERIALIZED_NAME_SETTLE_AMOUNT) + @jakarta.annotation.Nullable + private String settleAmount; + + public B402SettleEnvelopeV1Body() {} + + public B402SettleEnvelopeV1Body x402Version( + @jakarta.annotation.Nonnull X402VersionEnum x402Version) { + this.x402Version = x402Version; + return this; + } + + /** + * Get x402Version + * + * @return x402Version + */ + @jakarta.annotation.Nonnull + @NotNull + public X402VersionEnum getX402Version() { + return x402Version; + } + + public void setX402Version(@jakarta.annotation.Nonnull X402VersionEnum x402Version) { + this.x402Version = x402Version; + } + + public B402SettleEnvelopeV1Body paymentPayload( + @jakarta.annotation.Nonnull B402SettleRequestV1AllOfPaymentPayload paymentPayload) { + this.paymentPayload = paymentPayload; + return this; + } + + /** + * Get paymentPayload + * + * @return paymentPayload + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public B402SettleRequestV1AllOfPaymentPayload getPaymentPayload() { + return paymentPayload; + } + + public void setPaymentPayload( + @jakarta.annotation.Nonnull B402SettleRequestV1AllOfPaymentPayload paymentPayload) { + this.paymentPayload = paymentPayload; + } + + public B402SettleEnvelopeV1Body paymentRequirements( + @jakarta.annotation.Nonnull + B402SettleRequestV1AllOfPaymentRequirements paymentRequirements) { + this.paymentRequirements = paymentRequirements; + return this; + } + + /** + * Get paymentRequirements + * + * @return paymentRequirements + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public B402SettleRequestV1AllOfPaymentRequirements getPaymentRequirements() { + return paymentRequirements; + } + + public void setPaymentRequirements( + @jakarta.annotation.Nonnull + B402SettleRequestV1AllOfPaymentRequirements paymentRequirements) { + this.paymentRequirements = paymentRequirements; + } + + public B402SettleEnvelopeV1Body settleAmount(@jakarta.annotation.Nullable String settleAmount) { + this.settleAmount = settleAmount; + return this; + } + + /** + * Get settleAmount + * + * @return settleAmount + */ + @jakarta.annotation.Nullable + @Pattern(regexp = "^[0-9]+$") + public String getSettleAmount() { + return settleAmount; + } + + public void setSettleAmount(@jakarta.annotation.Nullable String settleAmount) { + this.settleAmount = settleAmount; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402SettleEnvelopeV1Body b402SettleEnvelopeV1Body = (B402SettleEnvelopeV1Body) o; + return Objects.equals(this.x402Version, b402SettleEnvelopeV1Body.x402Version) + && Objects.equals(this.paymentPayload, b402SettleEnvelopeV1Body.paymentPayload) + && Objects.equals( + this.paymentRequirements, b402SettleEnvelopeV1Body.paymentRequirements) + && Objects.equals(this.settleAmount, b402SettleEnvelopeV1Body.settleAmount); + } + + @Override + public int hashCode() { + return Objects.hash(x402Version, paymentPayload, paymentRequirements, settleAmount); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402SettleEnvelopeV1Body {\n"); + sb.append(" x402Version: ").append(toIndentedString(x402Version)).append("\n"); + sb.append(" paymentPayload: ").append(toIndentedString(paymentPayload)).append("\n"); + sb.append(" paymentRequirements: ") + .append(toIndentedString(paymentRequirements)) + .append("\n"); + sb.append(" settleAmount: ").append(toIndentedString(settleAmount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object x402VersionValue = getX402Version(); + String x402VersionValueAsString = ""; + x402VersionValueAsString = x402VersionValue.toString(); + sb.append("x402Version=").append(urlEncode(x402VersionValueAsString)).append(""); + Object paymentPayloadValue = getPaymentPayload(); + String paymentPayloadValueAsString = ""; + paymentPayloadValueAsString = paymentPayloadValue.toString(); + sb.append("paymentPayload=").append(urlEncode(paymentPayloadValueAsString)).append(""); + Object paymentRequirementsValue = getPaymentRequirements(); + String paymentRequirementsValueAsString = ""; + paymentRequirementsValueAsString = paymentRequirementsValue.toString(); + sb.append("paymentRequirements=") + .append(urlEncode(paymentRequirementsValueAsString)) + .append(""); + Object settleAmountValue = getSettleAmount(); + String settleAmountValueAsString = ""; + settleAmountValueAsString = settleAmountValue.toString(); + sb.append("settleAmount=").append(urlEncode(settleAmountValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("x402Version"); + openapiFields.add("paymentPayload"); + openapiFields.add("paymentRequirements"); + openapiFields.add("settleAmount"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("x402Version"); + openapiRequiredFields.add("paymentPayload"); + openapiRequiredFields.add("paymentRequirements"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to B402SettleEnvelopeV1Body + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402SettleEnvelopeV1Body.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in B402SettleEnvelopeV1Body is not found" + + " in the empty JSON string", + B402SettleEnvelopeV1Body.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : B402SettleEnvelopeV1Body.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `x402Version` + X402VersionEnum.validateJsonElement(jsonObj.get("x402Version")); + // validate the required field `paymentPayload` + B402SettleRequestV1AllOfPaymentPayload.validateJsonElement(jsonObj.get("paymentPayload")); + // validate the required field `paymentRequirements` + B402SettleRequestV1AllOfPaymentRequirements.validateJsonElement( + jsonObj.get("paymentRequirements")); + if ((jsonObj.get("settleAmount") != null && !jsonObj.get("settleAmount").isJsonNull()) + && !jsonObj.get("settleAmount").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `settleAmount` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("settleAmount").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402SettleEnvelopeV1Body.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'B402SettleEnvelopeV1Body' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(B402SettleEnvelopeV1Body.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, B402SettleEnvelopeV1Body value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402SettleEnvelopeV1Body read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402SettleEnvelopeV1Body given an JSON string + * + * @param jsonString JSON string + * @return An instance of B402SettleEnvelopeV1Body + * @throws IOException if the JSON string is invalid with respect to B402SettleEnvelopeV1Body + */ + public static B402SettleEnvelopeV1Body fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, B402SettleEnvelopeV1Body.class); + } + + /** + * Convert an instance of B402SettleEnvelopeV1Body to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SettleEnvelopeV2.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SettleEnvelopeV2.java new file mode 100644 index 0000000..c1cab81 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SettleEnvelopeV2.java @@ -0,0 +1,218 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** B402SettleEnvelopeV2 */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402SettleEnvelopeV2 { + public static final String SERIALIZED_NAME_BODY = "body"; + + @SerializedName(SERIALIZED_NAME_BODY) + @jakarta.annotation.Nonnull + private B402SettleEnvelopeV2Body body; + + public B402SettleEnvelopeV2() {} + + public B402SettleEnvelopeV2 body(@jakarta.annotation.Nonnull B402SettleEnvelopeV2Body body) { + this.body = body; + return this; + } + + /** + * Get body + * + * @return body + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public B402SettleEnvelopeV2Body getBody() { + return body; + } + + public void setBody(@jakarta.annotation.Nonnull B402SettleEnvelopeV2Body body) { + this.body = body; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402SettleEnvelopeV2 b402SettleEnvelopeV2 = (B402SettleEnvelopeV2) o; + return Objects.equals(this.body, b402SettleEnvelopeV2.body); + } + + @Override + public int hashCode() { + return Objects.hash(body); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402SettleEnvelopeV2 {\n"); + sb.append(" body: ").append(toIndentedString(body)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object bodyValue = getBody(); + String bodyValueAsString = ""; + bodyValueAsString = bodyValue.toString(); + sb.append("body=").append(urlEncode(bodyValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("body"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("body"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to B402SettleEnvelopeV2 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402SettleEnvelopeV2.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in B402SettleEnvelopeV2 is not found in" + + " the empty JSON string", + B402SettleEnvelopeV2.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : B402SettleEnvelopeV2.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `body` + B402SettleEnvelopeV2Body.validateJsonElement(jsonObj.get("body")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402SettleEnvelopeV2.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'B402SettleEnvelopeV2' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(B402SettleEnvelopeV2.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, B402SettleEnvelopeV2 value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402SettleEnvelopeV2 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402SettleEnvelopeV2 given an JSON string + * + * @param jsonString JSON string + * @return An instance of B402SettleEnvelopeV2 + * @throws IOException if the JSON string is invalid with respect to B402SettleEnvelopeV2 + */ + public static B402SettleEnvelopeV2 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, B402SettleEnvelopeV2.class); + } + + /** + * Convert an instance of B402SettleEnvelopeV2 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SettleEnvelopeV2Body.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SettleEnvelopeV2Body.java new file mode 100644 index 0000000..db563eb --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SettleEnvelopeV2Body.java @@ -0,0 +1,399 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** B402SettleEnvelopeV2Body */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402SettleEnvelopeV2Body { + /** Gets or Sets x402Version */ + @JsonAdapter(X402VersionEnum.Adapter.class) + public enum X402VersionEnum { + X402_VERSION_2(2); + + private Integer value; + + X402VersionEnum(Integer value) { + this.value = value; + } + + public Integer getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static X402VersionEnum fromValue(Integer value) { + for (X402VersionEnum b : X402VersionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final X402VersionEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public X402VersionEnum read(final JsonReader jsonReader) throws IOException { + Integer value = jsonReader.nextInt(); + return X402VersionEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + Integer value = jsonElement.getAsInt(); + X402VersionEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_X402_VERSION = "x402Version"; + + @SerializedName(SERIALIZED_NAME_X402_VERSION) + @jakarta.annotation.Nonnull + private X402VersionEnum x402Version; + + public static final String SERIALIZED_NAME_PAYMENT_PAYLOAD = "paymentPayload"; + + @SerializedName(SERIALIZED_NAME_PAYMENT_PAYLOAD) + @jakarta.annotation.Nonnull + private B402SettleEnvelopeV2BodyAllOfPaymentPayload paymentPayload; + + public static final String SERIALIZED_NAME_PAYMENT_REQUIREMENTS = "paymentRequirements"; + + @SerializedName(SERIALIZED_NAME_PAYMENT_REQUIREMENTS) + @jakarta.annotation.Nonnull + private B402SettleEnvelopeV2BodyAllOfPaymentPayloadAccepted paymentRequirements; + + public static final String SERIALIZED_NAME_SETTLE_AMOUNT = "settleAmount"; + + @SerializedName(SERIALIZED_NAME_SETTLE_AMOUNT) + @jakarta.annotation.Nullable + private String settleAmount; + + public B402SettleEnvelopeV2Body() {} + + public B402SettleEnvelopeV2Body x402Version( + @jakarta.annotation.Nonnull X402VersionEnum x402Version) { + this.x402Version = x402Version; + return this; + } + + /** + * Get x402Version + * + * @return x402Version + */ + @jakarta.annotation.Nonnull + @NotNull + public X402VersionEnum getX402Version() { + return x402Version; + } + + public void setX402Version(@jakarta.annotation.Nonnull X402VersionEnum x402Version) { + this.x402Version = x402Version; + } + + public B402SettleEnvelopeV2Body paymentPayload( + @jakarta.annotation.Nonnull + B402SettleEnvelopeV2BodyAllOfPaymentPayload paymentPayload) { + this.paymentPayload = paymentPayload; + return this; + } + + /** + * Get paymentPayload + * + * @return paymentPayload + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public B402SettleEnvelopeV2BodyAllOfPaymentPayload getPaymentPayload() { + return paymentPayload; + } + + public void setPaymentPayload( + @jakarta.annotation.Nonnull + B402SettleEnvelopeV2BodyAllOfPaymentPayload paymentPayload) { + this.paymentPayload = paymentPayload; + } + + public B402SettleEnvelopeV2Body paymentRequirements( + @jakarta.annotation.Nonnull + B402SettleEnvelopeV2BodyAllOfPaymentPayloadAccepted paymentRequirements) { + this.paymentRequirements = paymentRequirements; + return this; + } + + /** + * Get paymentRequirements + * + * @return paymentRequirements + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public B402SettleEnvelopeV2BodyAllOfPaymentPayloadAccepted getPaymentRequirements() { + return paymentRequirements; + } + + public void setPaymentRequirements( + @jakarta.annotation.Nonnull + B402SettleEnvelopeV2BodyAllOfPaymentPayloadAccepted paymentRequirements) { + this.paymentRequirements = paymentRequirements; + } + + public B402SettleEnvelopeV2Body settleAmount(@jakarta.annotation.Nullable String settleAmount) { + this.settleAmount = settleAmount; + return this; + } + + /** + * Get settleAmount + * + * @return settleAmount + */ + @jakarta.annotation.Nullable + @Pattern(regexp = "^[0-9]+$") + public String getSettleAmount() { + return settleAmount; + } + + public void setSettleAmount(@jakarta.annotation.Nullable String settleAmount) { + this.settleAmount = settleAmount; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402SettleEnvelopeV2Body b402SettleEnvelopeV2Body = (B402SettleEnvelopeV2Body) o; + return Objects.equals(this.x402Version, b402SettleEnvelopeV2Body.x402Version) + && Objects.equals(this.paymentPayload, b402SettleEnvelopeV2Body.paymentPayload) + && Objects.equals( + this.paymentRequirements, b402SettleEnvelopeV2Body.paymentRequirements) + && Objects.equals(this.settleAmount, b402SettleEnvelopeV2Body.settleAmount); + } + + @Override + public int hashCode() { + return Objects.hash(x402Version, paymentPayload, paymentRequirements, settleAmount); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402SettleEnvelopeV2Body {\n"); + sb.append(" x402Version: ").append(toIndentedString(x402Version)).append("\n"); + sb.append(" paymentPayload: ").append(toIndentedString(paymentPayload)).append("\n"); + sb.append(" paymentRequirements: ") + .append(toIndentedString(paymentRequirements)) + .append("\n"); + sb.append(" settleAmount: ").append(toIndentedString(settleAmount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object x402VersionValue = getX402Version(); + String x402VersionValueAsString = ""; + x402VersionValueAsString = x402VersionValue.toString(); + sb.append("x402Version=").append(urlEncode(x402VersionValueAsString)).append(""); + Object paymentPayloadValue = getPaymentPayload(); + String paymentPayloadValueAsString = ""; + paymentPayloadValueAsString = paymentPayloadValue.toString(); + sb.append("paymentPayload=").append(urlEncode(paymentPayloadValueAsString)).append(""); + Object paymentRequirementsValue = getPaymentRequirements(); + String paymentRequirementsValueAsString = ""; + paymentRequirementsValueAsString = paymentRequirementsValue.toString(); + sb.append("paymentRequirements=") + .append(urlEncode(paymentRequirementsValueAsString)) + .append(""); + Object settleAmountValue = getSettleAmount(); + String settleAmountValueAsString = ""; + settleAmountValueAsString = settleAmountValue.toString(); + sb.append("settleAmount=").append(urlEncode(settleAmountValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("x402Version"); + openapiFields.add("paymentPayload"); + openapiFields.add("paymentRequirements"); + openapiFields.add("settleAmount"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("x402Version"); + openapiRequiredFields.add("paymentPayload"); + openapiRequiredFields.add("paymentRequirements"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to B402SettleEnvelopeV2Body + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402SettleEnvelopeV2Body.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in B402SettleEnvelopeV2Body is not found" + + " in the empty JSON string", + B402SettleEnvelopeV2Body.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : B402SettleEnvelopeV2Body.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `x402Version` + X402VersionEnum.validateJsonElement(jsonObj.get("x402Version")); + // validate the required field `paymentPayload` + B402SettleEnvelopeV2BodyAllOfPaymentPayload.validateJsonElement( + jsonObj.get("paymentPayload")); + // validate the required field `paymentRequirements` + B402SettleEnvelopeV2BodyAllOfPaymentPayloadAccepted.validateJsonElement( + jsonObj.get("paymentRequirements")); + if ((jsonObj.get("settleAmount") != null && !jsonObj.get("settleAmount").isJsonNull()) + && !jsonObj.get("settleAmount").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `settleAmount` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("settleAmount").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402SettleEnvelopeV2Body.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'B402SettleEnvelopeV2Body' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(B402SettleEnvelopeV2Body.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, B402SettleEnvelopeV2Body value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402SettleEnvelopeV2Body read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402SettleEnvelopeV2Body given an JSON string + * + * @param jsonString JSON string + * @return An instance of B402SettleEnvelopeV2Body + * @throws IOException if the JSON string is invalid with respect to B402SettleEnvelopeV2Body + */ + public static B402SettleEnvelopeV2Body fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, B402SettleEnvelopeV2Body.class); + } + + /** + * Convert an instance of B402SettleEnvelopeV2Body to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SettleEnvelopeV2BodyAllOfPaymentPayload.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SettleEnvelopeV2BodyAllOfPaymentPayload.java new file mode 100644 index 0000000..9cde6c7 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SettleEnvelopeV2BodyAllOfPaymentPayload.java @@ -0,0 +1,440 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** B402SettleEnvelopeV2BodyAllOfPaymentPayload */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402SettleEnvelopeV2BodyAllOfPaymentPayload { + /** Gets or Sets x402Version */ + @JsonAdapter(X402VersionEnum.Adapter.class) + public enum X402VersionEnum { + X402_VERSION_2(2); + + private Integer value; + + X402VersionEnum(Integer value) { + this.value = value; + } + + public Integer getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static X402VersionEnum fromValue(Integer value) { + for (X402VersionEnum b : X402VersionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final X402VersionEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public X402VersionEnum read(final JsonReader jsonReader) throws IOException { + Integer value = jsonReader.nextInt(); + return X402VersionEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + Integer value = jsonElement.getAsInt(); + X402VersionEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_X402_VERSION = "x402Version"; + + @SerializedName(SERIALIZED_NAME_X402_VERSION) + @jakarta.annotation.Nonnull + private X402VersionEnum x402Version; + + public static final String SERIALIZED_NAME_RESOURCE = "resource"; + + @SerializedName(SERIALIZED_NAME_RESOURCE) + @jakarta.annotation.Nonnull + private B402SettleRequestV2AllOfPaymentPayloadResource resource; + + public static final String SERIALIZED_NAME_ACCEPTED = "accepted"; + + @SerializedName(SERIALIZED_NAME_ACCEPTED) + @jakarta.annotation.Nonnull + private B402SettleEnvelopeV2BodyAllOfPaymentPayloadAccepted accepted; + + public static final String SERIALIZED_NAME_PAYLOAD = "payload"; + + @SerializedName(SERIALIZED_NAME_PAYLOAD) + @jakarta.annotation.Nonnull + private B402SettleRequestV2AllOfPaymentPayloadPayload payload; + + public static final String SERIALIZED_NAME_EXTENSIONS = "extensions"; + + @SerializedName(SERIALIZED_NAME_EXTENSIONS) + @jakarta.annotation.Nullable + private B402PaymentPayloadV2Extensions extensions; + + public B402SettleEnvelopeV2BodyAllOfPaymentPayload() {} + + public B402SettleEnvelopeV2BodyAllOfPaymentPayload x402Version( + @jakarta.annotation.Nonnull X402VersionEnum x402Version) { + this.x402Version = x402Version; + return this; + } + + /** + * Get x402Version + * + * @return x402Version + */ + @jakarta.annotation.Nonnull + @NotNull + public X402VersionEnum getX402Version() { + return x402Version; + } + + public void setX402Version(@jakarta.annotation.Nonnull X402VersionEnum x402Version) { + this.x402Version = x402Version; + } + + public B402SettleEnvelopeV2BodyAllOfPaymentPayload resource( + @jakarta.annotation.Nonnull B402SettleRequestV2AllOfPaymentPayloadResource resource) { + this.resource = resource; + return this; + } + + /** + * Get resource + * + * @return resource + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public B402SettleRequestV2AllOfPaymentPayloadResource getResource() { + return resource; + } + + public void setResource( + @jakarta.annotation.Nonnull B402SettleRequestV2AllOfPaymentPayloadResource resource) { + this.resource = resource; + } + + public B402SettleEnvelopeV2BodyAllOfPaymentPayload accepted( + @jakarta.annotation.Nonnull + B402SettleEnvelopeV2BodyAllOfPaymentPayloadAccepted accepted) { + this.accepted = accepted; + return this; + } + + /** + * Get accepted + * + * @return accepted + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public B402SettleEnvelopeV2BodyAllOfPaymentPayloadAccepted getAccepted() { + return accepted; + } + + public void setAccepted( + @jakarta.annotation.Nonnull + B402SettleEnvelopeV2BodyAllOfPaymentPayloadAccepted accepted) { + this.accepted = accepted; + } + + public B402SettleEnvelopeV2BodyAllOfPaymentPayload payload( + @jakarta.annotation.Nonnull B402SettleRequestV2AllOfPaymentPayloadPayload payload) { + this.payload = payload; + return this; + } + + /** + * Get payload + * + * @return payload + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public B402SettleRequestV2AllOfPaymentPayloadPayload getPayload() { + return payload; + } + + public void setPayload( + @jakarta.annotation.Nonnull B402SettleRequestV2AllOfPaymentPayloadPayload payload) { + this.payload = payload; + } + + public B402SettleEnvelopeV2BodyAllOfPaymentPayload extensions( + @jakarta.annotation.Nullable B402PaymentPayloadV2Extensions extensions) { + this.extensions = extensions; + return this; + } + + /** + * Get extensions + * + * @return extensions + */ + @jakarta.annotation.Nullable + @Valid + public B402PaymentPayloadV2Extensions getExtensions() { + return extensions; + } + + public void setExtensions( + @jakarta.annotation.Nullable B402PaymentPayloadV2Extensions extensions) { + this.extensions = extensions; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402SettleEnvelopeV2BodyAllOfPaymentPayload b402SettleEnvelopeV2BodyAllOfPaymentPayload = + (B402SettleEnvelopeV2BodyAllOfPaymentPayload) o; + return Objects.equals( + this.x402Version, b402SettleEnvelopeV2BodyAllOfPaymentPayload.x402Version) + && Objects.equals( + this.resource, b402SettleEnvelopeV2BodyAllOfPaymentPayload.resource) + && Objects.equals( + this.accepted, b402SettleEnvelopeV2BodyAllOfPaymentPayload.accepted) + && Objects.equals(this.payload, b402SettleEnvelopeV2BodyAllOfPaymentPayload.payload) + && Objects.equals( + this.extensions, b402SettleEnvelopeV2BodyAllOfPaymentPayload.extensions); + } + + @Override + public int hashCode() { + return Objects.hash(x402Version, resource, accepted, payload, extensions); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402SettleEnvelopeV2BodyAllOfPaymentPayload {\n"); + sb.append(" x402Version: ").append(toIndentedString(x402Version)).append("\n"); + sb.append(" resource: ").append(toIndentedString(resource)).append("\n"); + sb.append(" accepted: ").append(toIndentedString(accepted)).append("\n"); + sb.append(" payload: ").append(toIndentedString(payload)).append("\n"); + sb.append(" extensions: ").append(toIndentedString(extensions)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object x402VersionValue = getX402Version(); + String x402VersionValueAsString = ""; + x402VersionValueAsString = x402VersionValue.toString(); + sb.append("x402Version=").append(urlEncode(x402VersionValueAsString)).append(""); + Object resourceValue = getResource(); + String resourceValueAsString = ""; + resourceValueAsString = resourceValue.toString(); + sb.append("resource=").append(urlEncode(resourceValueAsString)).append(""); + Object acceptedValue = getAccepted(); + String acceptedValueAsString = ""; + acceptedValueAsString = acceptedValue.toString(); + sb.append("accepted=").append(urlEncode(acceptedValueAsString)).append(""); + Object payloadValue = getPayload(); + String payloadValueAsString = ""; + payloadValueAsString = payloadValue.toString(); + sb.append("payload=").append(urlEncode(payloadValueAsString)).append(""); + Object extensionsValue = getExtensions(); + String extensionsValueAsString = ""; + extensionsValueAsString = extensionsValue.toString(); + sb.append("extensions=").append(urlEncode(extensionsValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("x402Version"); + openapiFields.add("resource"); + openapiFields.add("accepted"); + openapiFields.add("payload"); + openapiFields.add("extensions"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("x402Version"); + openapiRequiredFields.add("resource"); + openapiRequiredFields.add("accepted"); + openapiRequiredFields.add("payload"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * B402SettleEnvelopeV2BodyAllOfPaymentPayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402SettleEnvelopeV2BodyAllOfPaymentPayload.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " B402SettleEnvelopeV2BodyAllOfPaymentPayload is not found in" + + " the empty JSON string", + B402SettleEnvelopeV2BodyAllOfPaymentPayload.openapiRequiredFields + .toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : + B402SettleEnvelopeV2BodyAllOfPaymentPayload.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `x402Version` + X402VersionEnum.validateJsonElement(jsonObj.get("x402Version")); + // validate the required field `resource` + B402SettleRequestV2AllOfPaymentPayloadResource.validateJsonElement(jsonObj.get("resource")); + // validate the required field `accepted` + B402SettleEnvelopeV2BodyAllOfPaymentPayloadAccepted.validateJsonElement( + jsonObj.get("accepted")); + // validate the required field `payload` + B402SettleRequestV2AllOfPaymentPayloadPayload.validateJsonElement(jsonObj.get("payload")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402SettleEnvelopeV2BodyAllOfPaymentPayload.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'B402SettleEnvelopeV2BodyAllOfPaymentPayload' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(B402SettleEnvelopeV2BodyAllOfPaymentPayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, B402SettleEnvelopeV2BodyAllOfPaymentPayload value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402SettleEnvelopeV2BodyAllOfPaymentPayload read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402SettleEnvelopeV2BodyAllOfPaymentPayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of B402SettleEnvelopeV2BodyAllOfPaymentPayload + * @throws IOException if the JSON string is invalid with respect to + * B402SettleEnvelopeV2BodyAllOfPaymentPayload + */ + public static B402SettleEnvelopeV2BodyAllOfPaymentPayload fromJson(String jsonString) + throws IOException { + return JSON.getGson() + .fromJson(jsonString, B402SettleEnvelopeV2BodyAllOfPaymentPayload.class); + } + + /** + * Convert an instance of B402SettleEnvelopeV2BodyAllOfPaymentPayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SettleEnvelopeV2BodyAllOfPaymentPayloadAccepted.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SettleEnvelopeV2BodyAllOfPaymentPayloadAccepted.java new file mode 100644 index 0000000..ef68d76 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SettleEnvelopeV2BodyAllOfPaymentPayloadAccepted.java @@ -0,0 +1,549 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** B402SettleEnvelopeV2BodyAllOfPaymentPayloadAccepted */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402SettleEnvelopeV2BodyAllOfPaymentPayloadAccepted { + /** Gets or Sets scheme */ + @JsonAdapter(SchemeEnum.Adapter.class) + public enum SchemeEnum { + exact("exact"), + + upto("upto"); + + private String value; + + SchemeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static SchemeEnum fromValue(String value) { + for (SchemeEnum b : SchemeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final SchemeEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public SchemeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return SchemeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + SchemeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_SCHEME = "scheme"; + + @SerializedName(SERIALIZED_NAME_SCHEME) + @jakarta.annotation.Nonnull + private SchemeEnum scheme; + + public static final String SERIALIZED_NAME_NETWORK = "network"; + + @SerializedName(SERIALIZED_NAME_NETWORK) + @jakarta.annotation.Nonnull + private String network; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + + @SerializedName(SERIALIZED_NAME_AMOUNT) + @jakarta.annotation.Nonnull + private String amount; + + public static final String SERIALIZED_NAME_ASSET = "asset"; + + @SerializedName(SERIALIZED_NAME_ASSET) + @jakarta.annotation.Nonnull + private String asset; + + public static final String SERIALIZED_NAME_PAY_TO = "payTo"; + + @SerializedName(SERIALIZED_NAME_PAY_TO) + @jakarta.annotation.Nonnull + private String payTo; + + public static final String SERIALIZED_NAME_MAX_TIMEOUT_SECONDS = "maxTimeoutSeconds"; + + @SerializedName(SERIALIZED_NAME_MAX_TIMEOUT_SECONDS) + @jakarta.annotation.Nonnull + private Integer maxTimeoutSeconds; + + public static final String SERIALIZED_NAME_EXTRA = "extra"; + + @SerializedName(SERIALIZED_NAME_EXTRA) + @jakarta.annotation.Nonnull + private B402PaymentRequirementsV2Extra extra; + + public B402SettleEnvelopeV2BodyAllOfPaymentPayloadAccepted() {} + + public B402SettleEnvelopeV2BodyAllOfPaymentPayloadAccepted scheme( + @jakarta.annotation.Nonnull SchemeEnum scheme) { + this.scheme = scheme; + return this; + } + + /** + * Get scheme + * + * @return scheme + */ + @jakarta.annotation.Nonnull + @NotNull + public SchemeEnum getScheme() { + return scheme; + } + + public void setScheme(@jakarta.annotation.Nonnull SchemeEnum scheme) { + this.scheme = scheme; + } + + public B402SettleEnvelopeV2BodyAllOfPaymentPayloadAccepted network( + @jakarta.annotation.Nonnull String network) { + this.network = network; + return this; + } + + /** + * Get network + * + * @return network + */ + @jakarta.annotation.Nonnull + @NotNull + public String getNetwork() { + return network; + } + + public void setNetwork(@jakarta.annotation.Nonnull String network) { + this.network = network; + } + + public B402SettleEnvelopeV2BodyAllOfPaymentPayloadAccepted amount( + @jakarta.annotation.Nonnull String amount) { + this.amount = amount; + return this; + } + + /** + * Get amount + * + * @return amount + */ + @jakarta.annotation.Nonnull + @NotNull + @Pattern(regexp = "^[0-9]+$") + public String getAmount() { + return amount; + } + + public void setAmount(@jakarta.annotation.Nonnull String amount) { + this.amount = amount; + } + + public B402SettleEnvelopeV2BodyAllOfPaymentPayloadAccepted asset( + @jakarta.annotation.Nonnull String asset) { + this.asset = asset; + return this; + } + + /** + * Get asset + * + * @return asset + */ + @jakarta.annotation.Nonnull + @NotNull + public String getAsset() { + return asset; + } + + public void setAsset(@jakarta.annotation.Nonnull String asset) { + this.asset = asset; + } + + public B402SettleEnvelopeV2BodyAllOfPaymentPayloadAccepted payTo( + @jakarta.annotation.Nonnull String payTo) { + this.payTo = payTo; + return this; + } + + /** + * Get payTo + * + * @return payTo + */ + @jakarta.annotation.Nonnull + @NotNull + public String getPayTo() { + return payTo; + } + + public void setPayTo(@jakarta.annotation.Nonnull String payTo) { + this.payTo = payTo; + } + + public B402SettleEnvelopeV2BodyAllOfPaymentPayloadAccepted maxTimeoutSeconds( + @jakarta.annotation.Nonnull Integer maxTimeoutSeconds) { + this.maxTimeoutSeconds = maxTimeoutSeconds; + return this; + } + + /** + * Get maxTimeoutSeconds + * + * @return maxTimeoutSeconds + */ + @jakarta.annotation.Nonnull + @NotNull + public Integer getMaxTimeoutSeconds() { + return maxTimeoutSeconds; + } + + public void setMaxTimeoutSeconds(@jakarta.annotation.Nonnull Integer maxTimeoutSeconds) { + this.maxTimeoutSeconds = maxTimeoutSeconds; + } + + public B402SettleEnvelopeV2BodyAllOfPaymentPayloadAccepted extra( + @jakarta.annotation.Nonnull B402PaymentRequirementsV2Extra extra) { + this.extra = extra; + return this; + } + + /** + * Get extra + * + * @return extra + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public B402PaymentRequirementsV2Extra getExtra() { + return extra; + } + + public void setExtra(@jakarta.annotation.Nonnull B402PaymentRequirementsV2Extra extra) { + this.extra = extra; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402SettleEnvelopeV2BodyAllOfPaymentPayloadAccepted + b402SettleEnvelopeV2BodyAllOfPaymentPayloadAccepted = + (B402SettleEnvelopeV2BodyAllOfPaymentPayloadAccepted) o; + return Objects.equals( + this.scheme, b402SettleEnvelopeV2BodyAllOfPaymentPayloadAccepted.scheme) + && Objects.equals( + this.network, b402SettleEnvelopeV2BodyAllOfPaymentPayloadAccepted.network) + && Objects.equals( + this.amount, b402SettleEnvelopeV2BodyAllOfPaymentPayloadAccepted.amount) + && Objects.equals( + this.asset, b402SettleEnvelopeV2BodyAllOfPaymentPayloadAccepted.asset) + && Objects.equals( + this.payTo, b402SettleEnvelopeV2BodyAllOfPaymentPayloadAccepted.payTo) + && Objects.equals( + this.maxTimeoutSeconds, + b402SettleEnvelopeV2BodyAllOfPaymentPayloadAccepted.maxTimeoutSeconds) + && Objects.equals( + this.extra, b402SettleEnvelopeV2BodyAllOfPaymentPayloadAccepted.extra); + } + + @Override + public int hashCode() { + return Objects.hash(scheme, network, amount, asset, payTo, maxTimeoutSeconds, extra); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402SettleEnvelopeV2BodyAllOfPaymentPayloadAccepted {\n"); + sb.append(" scheme: ").append(toIndentedString(scheme)).append("\n"); + sb.append(" network: ").append(toIndentedString(network)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" asset: ").append(toIndentedString(asset)).append("\n"); + sb.append(" payTo: ").append(toIndentedString(payTo)).append("\n"); + sb.append(" maxTimeoutSeconds: ").append(toIndentedString(maxTimeoutSeconds)).append("\n"); + sb.append(" extra: ").append(toIndentedString(extra)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object schemeValue = getScheme(); + String schemeValueAsString = ""; + schemeValueAsString = schemeValue.toString(); + sb.append("scheme=").append(urlEncode(schemeValueAsString)).append(""); + Object networkValue = getNetwork(); + String networkValueAsString = ""; + networkValueAsString = networkValue.toString(); + sb.append("network=").append(urlEncode(networkValueAsString)).append(""); + Object amountValue = getAmount(); + String amountValueAsString = ""; + amountValueAsString = amountValue.toString(); + sb.append("amount=").append(urlEncode(amountValueAsString)).append(""); + Object assetValue = getAsset(); + String assetValueAsString = ""; + assetValueAsString = assetValue.toString(); + sb.append("asset=").append(urlEncode(assetValueAsString)).append(""); + Object payToValue = getPayTo(); + String payToValueAsString = ""; + payToValueAsString = payToValue.toString(); + sb.append("payTo=").append(urlEncode(payToValueAsString)).append(""); + Object maxTimeoutSecondsValue = getMaxTimeoutSeconds(); + String maxTimeoutSecondsValueAsString = ""; + maxTimeoutSecondsValueAsString = maxTimeoutSecondsValue.toString(); + sb.append("maxTimeoutSeconds=") + .append(urlEncode(maxTimeoutSecondsValueAsString)) + .append(""); + Object extraValue = getExtra(); + String extraValueAsString = ""; + extraValueAsString = extraValue.toString(); + sb.append("extra=").append(urlEncode(extraValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("scheme"); + openapiFields.add("network"); + openapiFields.add("amount"); + openapiFields.add("asset"); + openapiFields.add("payTo"); + openapiFields.add("maxTimeoutSeconds"); + openapiFields.add("extra"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("scheme"); + openapiRequiredFields.add("network"); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("asset"); + openapiRequiredFields.add("payTo"); + openapiRequiredFields.add("maxTimeoutSeconds"); + openapiRequiredFields.add("extra"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * B402SettleEnvelopeV2BodyAllOfPaymentPayloadAccepted + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402SettleEnvelopeV2BodyAllOfPaymentPayloadAccepted.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " B402SettleEnvelopeV2BodyAllOfPaymentPayloadAccepted is not" + + " found in the empty JSON string", + B402SettleEnvelopeV2BodyAllOfPaymentPayloadAccepted + .openapiRequiredFields + .toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : + B402SettleEnvelopeV2BodyAllOfPaymentPayloadAccepted.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("scheme").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `scheme` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("scheme").toString())); + } + // validate the required field `scheme` + SchemeEnum.validateJsonElement(jsonObj.get("scheme")); + if (!jsonObj.get("network").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `network` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("network").toString())); + } + if (!jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `amount` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("amount").toString())); + } + if (!jsonObj.get("asset").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `asset` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("asset").toString())); + } + if (!jsonObj.get("payTo").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `payTo` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("payTo").toString())); + } + // validate the required field `extra` + B402PaymentRequirementsV2Extra.validateJsonElement(jsonObj.get("extra")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402SettleEnvelopeV2BodyAllOfPaymentPayloadAccepted.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'B402SettleEnvelopeV2BodyAllOfPaymentPayloadAccepted' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, + TypeToken.get( + B402SettleEnvelopeV2BodyAllOfPaymentPayloadAccepted.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, + B402SettleEnvelopeV2BodyAllOfPaymentPayloadAccepted value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402SettleEnvelopeV2BodyAllOfPaymentPayloadAccepted read( + JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402SettleEnvelopeV2BodyAllOfPaymentPayloadAccepted given an JSON + * string + * + * @param jsonString JSON string + * @return An instance of B402SettleEnvelopeV2BodyAllOfPaymentPayloadAccepted + * @throws IOException if the JSON string is invalid with respect to + * B402SettleEnvelopeV2BodyAllOfPaymentPayloadAccepted + */ + public static B402SettleEnvelopeV2BodyAllOfPaymentPayloadAccepted fromJson(String jsonString) + throws IOException { + return JSON.getGson() + .fromJson(jsonString, B402SettleEnvelopeV2BodyAllOfPaymentPayloadAccepted.class); + } + + /** + * Convert an instance of B402SettleEnvelopeV2BodyAllOfPaymentPayloadAccepted to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SettleRequestV1.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SettleRequestV1.java new file mode 100644 index 0000000..3618ae4 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SettleRequestV1.java @@ -0,0 +1,394 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** B402SettleRequestV1 */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402SettleRequestV1 { + /** Gets or Sets x402Version */ + @JsonAdapter(X402VersionEnum.Adapter.class) + public enum X402VersionEnum { + X402_VERSION_1(1); + + private Integer value; + + X402VersionEnum(Integer value) { + this.value = value; + } + + public Integer getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static X402VersionEnum fromValue(Integer value) { + for (X402VersionEnum b : X402VersionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final X402VersionEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public X402VersionEnum read(final JsonReader jsonReader) throws IOException { + Integer value = jsonReader.nextInt(); + return X402VersionEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + Integer value = jsonElement.getAsInt(); + X402VersionEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_X402_VERSION = "x402Version"; + + @SerializedName(SERIALIZED_NAME_X402_VERSION) + @jakarta.annotation.Nonnull + private X402VersionEnum x402Version; + + public static final String SERIALIZED_NAME_PAYMENT_PAYLOAD = "paymentPayload"; + + @SerializedName(SERIALIZED_NAME_PAYMENT_PAYLOAD) + @jakarta.annotation.Nonnull + private B402SettleRequestV1AllOfPaymentPayload paymentPayload; + + public static final String SERIALIZED_NAME_PAYMENT_REQUIREMENTS = "paymentRequirements"; + + @SerializedName(SERIALIZED_NAME_PAYMENT_REQUIREMENTS) + @jakarta.annotation.Nonnull + private B402SettleRequestV1AllOfPaymentRequirements paymentRequirements; + + public static final String SERIALIZED_NAME_SETTLE_AMOUNT = "settleAmount"; + + @SerializedName(SERIALIZED_NAME_SETTLE_AMOUNT) + @jakarta.annotation.Nullable + private String settleAmount; + + public B402SettleRequestV1() {} + + public B402SettleRequestV1 x402Version( + @jakarta.annotation.Nonnull X402VersionEnum x402Version) { + this.x402Version = x402Version; + return this; + } + + /** + * Get x402Version + * + * @return x402Version + */ + @jakarta.annotation.Nonnull + @NotNull + public X402VersionEnum getX402Version() { + return x402Version; + } + + public void setX402Version(@jakarta.annotation.Nonnull X402VersionEnum x402Version) { + this.x402Version = x402Version; + } + + public B402SettleRequestV1 paymentPayload( + @jakarta.annotation.Nonnull B402SettleRequestV1AllOfPaymentPayload paymentPayload) { + this.paymentPayload = paymentPayload; + return this; + } + + /** + * Get paymentPayload + * + * @return paymentPayload + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public B402SettleRequestV1AllOfPaymentPayload getPaymentPayload() { + return paymentPayload; + } + + public void setPaymentPayload( + @jakarta.annotation.Nonnull B402SettleRequestV1AllOfPaymentPayload paymentPayload) { + this.paymentPayload = paymentPayload; + } + + public B402SettleRequestV1 paymentRequirements( + @jakarta.annotation.Nonnull + B402SettleRequestV1AllOfPaymentRequirements paymentRequirements) { + this.paymentRequirements = paymentRequirements; + return this; + } + + /** + * Get paymentRequirements + * + * @return paymentRequirements + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public B402SettleRequestV1AllOfPaymentRequirements getPaymentRequirements() { + return paymentRequirements; + } + + public void setPaymentRequirements( + @jakarta.annotation.Nonnull + B402SettleRequestV1AllOfPaymentRequirements paymentRequirements) { + this.paymentRequirements = paymentRequirements; + } + + public B402SettleRequestV1 settleAmount(@jakarta.annotation.Nullable String settleAmount) { + this.settleAmount = settleAmount; + return this; + } + + /** + * Get settleAmount + * + * @return settleAmount + */ + @jakarta.annotation.Nullable + @Pattern(regexp = "^[0-9]+$") + public String getSettleAmount() { + return settleAmount; + } + + public void setSettleAmount(@jakarta.annotation.Nullable String settleAmount) { + this.settleAmount = settleAmount; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402SettleRequestV1 b402SettleRequestV1 = (B402SettleRequestV1) o; + return Objects.equals(this.x402Version, b402SettleRequestV1.x402Version) + && Objects.equals(this.paymentPayload, b402SettleRequestV1.paymentPayload) + && Objects.equals(this.paymentRequirements, b402SettleRequestV1.paymentRequirements) + && Objects.equals(this.settleAmount, b402SettleRequestV1.settleAmount); + } + + @Override + public int hashCode() { + return Objects.hash(x402Version, paymentPayload, paymentRequirements, settleAmount); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402SettleRequestV1 {\n"); + sb.append(" x402Version: ").append(toIndentedString(x402Version)).append("\n"); + sb.append(" paymentPayload: ").append(toIndentedString(paymentPayload)).append("\n"); + sb.append(" paymentRequirements: ") + .append(toIndentedString(paymentRequirements)) + .append("\n"); + sb.append(" settleAmount: ").append(toIndentedString(settleAmount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object x402VersionValue = getX402Version(); + String x402VersionValueAsString = ""; + x402VersionValueAsString = x402VersionValue.toString(); + sb.append("x402Version=").append(urlEncode(x402VersionValueAsString)).append(""); + Object paymentPayloadValue = getPaymentPayload(); + String paymentPayloadValueAsString = ""; + paymentPayloadValueAsString = paymentPayloadValue.toString(); + sb.append("paymentPayload=").append(urlEncode(paymentPayloadValueAsString)).append(""); + Object paymentRequirementsValue = getPaymentRequirements(); + String paymentRequirementsValueAsString = ""; + paymentRequirementsValueAsString = paymentRequirementsValue.toString(); + sb.append("paymentRequirements=") + .append(urlEncode(paymentRequirementsValueAsString)) + .append(""); + Object settleAmountValue = getSettleAmount(); + String settleAmountValueAsString = ""; + settleAmountValueAsString = settleAmountValue.toString(); + sb.append("settleAmount=").append(urlEncode(settleAmountValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("x402Version"); + openapiFields.add("paymentPayload"); + openapiFields.add("paymentRequirements"); + openapiFields.add("settleAmount"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("x402Version"); + openapiRequiredFields.add("paymentPayload"); + openapiRequiredFields.add("paymentRequirements"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to B402SettleRequestV1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402SettleRequestV1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in B402SettleRequestV1 is not found in" + + " the empty JSON string", + B402SettleRequestV1.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : B402SettleRequestV1.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `x402Version` + X402VersionEnum.validateJsonElement(jsonObj.get("x402Version")); + // validate the required field `paymentPayload` + B402SettleRequestV1AllOfPaymentPayload.validateJsonElement(jsonObj.get("paymentPayload")); + // validate the required field `paymentRequirements` + B402SettleRequestV1AllOfPaymentRequirements.validateJsonElement( + jsonObj.get("paymentRequirements")); + if ((jsonObj.get("settleAmount") != null && !jsonObj.get("settleAmount").isJsonNull()) + && !jsonObj.get("settleAmount").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `settleAmount` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("settleAmount").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402SettleRequestV1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'B402SettleRequestV1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(B402SettleRequestV1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, B402SettleRequestV1 value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402SettleRequestV1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402SettleRequestV1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of B402SettleRequestV1 + * @throws IOException if the JSON string is invalid with respect to B402SettleRequestV1 + */ + public static B402SettleRequestV1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, B402SettleRequestV1.class); + } + + /** + * Convert an instance of B402SettleRequestV1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SettleRequestV1AllOfPaymentPayload.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SettleRequestV1AllOfPaymentPayload.java new file mode 100644 index 0000000..f14f4ae --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SettleRequestV1AllOfPaymentPayload.java @@ -0,0 +1,451 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** B402SettleRequestV1AllOfPaymentPayload */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402SettleRequestV1AllOfPaymentPayload { + /** Gets or Sets x402Version */ + @JsonAdapter(X402VersionEnum.Adapter.class) + public enum X402VersionEnum { + X402_VERSION_1(1); + + private Integer value; + + X402VersionEnum(Integer value) { + this.value = value; + } + + public Integer getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static X402VersionEnum fromValue(Integer value) { + for (X402VersionEnum b : X402VersionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final X402VersionEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public X402VersionEnum read(final JsonReader jsonReader) throws IOException { + Integer value = jsonReader.nextInt(); + return X402VersionEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + Integer value = jsonElement.getAsInt(); + X402VersionEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_X402_VERSION = "x402Version"; + + @SerializedName(SERIALIZED_NAME_X402_VERSION) + @jakarta.annotation.Nonnull + private X402VersionEnum x402Version; + + /** Gets or Sets scheme */ + @JsonAdapter(SchemeEnum.Adapter.class) + public enum SchemeEnum { + exact("exact"); + + private String value; + + SchemeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static SchemeEnum fromValue(String value) { + for (SchemeEnum b : SchemeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final SchemeEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public SchemeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return SchemeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + SchemeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_SCHEME = "scheme"; + + @SerializedName(SERIALIZED_NAME_SCHEME) + @jakarta.annotation.Nonnull + private SchemeEnum scheme; + + public static final String SERIALIZED_NAME_NETWORK = "network"; + + @SerializedName(SERIALIZED_NAME_NETWORK) + @jakarta.annotation.Nonnull + private String network; + + public static final String SERIALIZED_NAME_PAYLOAD = "payload"; + + @SerializedName(SERIALIZED_NAME_PAYLOAD) + @jakarta.annotation.Nonnull + private B402SettleRequestV2AllOfPaymentPayloadPayload payload; + + public B402SettleRequestV1AllOfPaymentPayload() {} + + public B402SettleRequestV1AllOfPaymentPayload x402Version( + @jakarta.annotation.Nonnull X402VersionEnum x402Version) { + this.x402Version = x402Version; + return this; + } + + /** + * Get x402Version + * + * @return x402Version + */ + @jakarta.annotation.Nonnull + @NotNull + public X402VersionEnum getX402Version() { + return x402Version; + } + + public void setX402Version(@jakarta.annotation.Nonnull X402VersionEnum x402Version) { + this.x402Version = x402Version; + } + + public B402SettleRequestV1AllOfPaymentPayload scheme( + @jakarta.annotation.Nonnull SchemeEnum scheme) { + this.scheme = scheme; + return this; + } + + /** + * Get scheme + * + * @return scheme + */ + @jakarta.annotation.Nonnull + @NotNull + public SchemeEnum getScheme() { + return scheme; + } + + public void setScheme(@jakarta.annotation.Nonnull SchemeEnum scheme) { + this.scheme = scheme; + } + + public B402SettleRequestV1AllOfPaymentPayload network( + @jakarta.annotation.Nonnull String network) { + this.network = network; + return this; + } + + /** + * Get network + * + * @return network + */ + @jakarta.annotation.Nonnull + @NotNull + public String getNetwork() { + return network; + } + + public void setNetwork(@jakarta.annotation.Nonnull String network) { + this.network = network; + } + + public B402SettleRequestV1AllOfPaymentPayload payload( + @jakarta.annotation.Nonnull B402SettleRequestV2AllOfPaymentPayloadPayload payload) { + this.payload = payload; + return this; + } + + /** + * Get payload + * + * @return payload + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public B402SettleRequestV2AllOfPaymentPayloadPayload getPayload() { + return payload; + } + + public void setPayload( + @jakarta.annotation.Nonnull B402SettleRequestV2AllOfPaymentPayloadPayload payload) { + this.payload = payload; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402SettleRequestV1AllOfPaymentPayload b402SettleRequestV1AllOfPaymentPayload = + (B402SettleRequestV1AllOfPaymentPayload) o; + return Objects.equals(this.x402Version, b402SettleRequestV1AllOfPaymentPayload.x402Version) + && Objects.equals(this.scheme, b402SettleRequestV1AllOfPaymentPayload.scheme) + && Objects.equals(this.network, b402SettleRequestV1AllOfPaymentPayload.network) + && Objects.equals(this.payload, b402SettleRequestV1AllOfPaymentPayload.payload); + } + + @Override + public int hashCode() { + return Objects.hash(x402Version, scheme, network, payload); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402SettleRequestV1AllOfPaymentPayload {\n"); + sb.append(" x402Version: ").append(toIndentedString(x402Version)).append("\n"); + sb.append(" scheme: ").append(toIndentedString(scheme)).append("\n"); + sb.append(" network: ").append(toIndentedString(network)).append("\n"); + sb.append(" payload: ").append(toIndentedString(payload)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object x402VersionValue = getX402Version(); + String x402VersionValueAsString = ""; + x402VersionValueAsString = x402VersionValue.toString(); + sb.append("x402Version=").append(urlEncode(x402VersionValueAsString)).append(""); + Object schemeValue = getScheme(); + String schemeValueAsString = ""; + schemeValueAsString = schemeValue.toString(); + sb.append("scheme=").append(urlEncode(schemeValueAsString)).append(""); + Object networkValue = getNetwork(); + String networkValueAsString = ""; + networkValueAsString = networkValue.toString(); + sb.append("network=").append(urlEncode(networkValueAsString)).append(""); + Object payloadValue = getPayload(); + String payloadValueAsString = ""; + payloadValueAsString = payloadValue.toString(); + sb.append("payload=").append(urlEncode(payloadValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("x402Version"); + openapiFields.add("scheme"); + openapiFields.add("network"); + openapiFields.add("payload"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("x402Version"); + openapiRequiredFields.add("scheme"); + openapiRequiredFields.add("network"); + openapiRequiredFields.add("payload"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * B402SettleRequestV1AllOfPaymentPayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402SettleRequestV1AllOfPaymentPayload.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in B402SettleRequestV1AllOfPaymentPayload" + + " is not found in the empty JSON string", + B402SettleRequestV1AllOfPaymentPayload.openapiRequiredFields + .toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : B402SettleRequestV1AllOfPaymentPayload.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `x402Version` + X402VersionEnum.validateJsonElement(jsonObj.get("x402Version")); + if (!jsonObj.get("scheme").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `scheme` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("scheme").toString())); + } + // validate the required field `scheme` + SchemeEnum.validateJsonElement(jsonObj.get("scheme")); + if (!jsonObj.get("network").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `network` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("network").toString())); + } + // validate the required field `payload` + B402SettleRequestV2AllOfPaymentPayloadPayload.validateJsonElement(jsonObj.get("payload")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402SettleRequestV1AllOfPaymentPayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'B402SettleRequestV1AllOfPaymentPayload' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(B402SettleRequestV1AllOfPaymentPayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, B402SettleRequestV1AllOfPaymentPayload value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402SettleRequestV1AllOfPaymentPayload read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402SettleRequestV1AllOfPaymentPayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of B402SettleRequestV1AllOfPaymentPayload + * @throws IOException if the JSON string is invalid with respect to + * B402SettleRequestV1AllOfPaymentPayload + */ + public static B402SettleRequestV1AllOfPaymentPayload fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, B402SettleRequestV1AllOfPaymentPayload.class); + } + + /** + * Convert an instance of B402SettleRequestV1AllOfPaymentPayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SettleRequestV1AllOfPaymentRequirements.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SettleRequestV1AllOfPaymentRequirements.java new file mode 100644 index 0000000..8490287 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SettleRequestV1AllOfPaymentRequirements.java @@ -0,0 +1,717 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URI; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** B402SettleRequestV1AllOfPaymentRequirements */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402SettleRequestV1AllOfPaymentRequirements { + /** Gets or Sets scheme */ + @JsonAdapter(SchemeEnum.Adapter.class) + public enum SchemeEnum { + exact("exact"); + + private String value; + + SchemeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static SchemeEnum fromValue(String value) { + for (SchemeEnum b : SchemeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final SchemeEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public SchemeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return SchemeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + SchemeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_SCHEME = "scheme"; + + @SerializedName(SERIALIZED_NAME_SCHEME) + @jakarta.annotation.Nonnull + private SchemeEnum scheme; + + public static final String SERIALIZED_NAME_NETWORK = "network"; + + @SerializedName(SERIALIZED_NAME_NETWORK) + @jakarta.annotation.Nonnull + private String network; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + + @SerializedName(SERIALIZED_NAME_AMOUNT) + @jakarta.annotation.Nonnull + private String amount; + + public static final String SERIALIZED_NAME_RESOURCE = "resource"; + + @SerializedName(SERIALIZED_NAME_RESOURCE) + @jakarta.annotation.Nullable + private URI resource; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @jakarta.annotation.Nullable + private String description; + + public static final String SERIALIZED_NAME_PAY_TO = "payTo"; + + @SerializedName(SERIALIZED_NAME_PAY_TO) + @jakarta.annotation.Nonnull + private String payTo; + + public static final String SERIALIZED_NAME_ASSET = "asset"; + + @SerializedName(SERIALIZED_NAME_ASSET) + @jakarta.annotation.Nonnull + private String asset; + + public static final String SERIALIZED_NAME_MAX_TIMEOUT_SECONDS = "maxTimeoutSeconds"; + + @SerializedName(SERIALIZED_NAME_MAX_TIMEOUT_SECONDS) + @jakarta.annotation.Nonnull + private Integer maxTimeoutSeconds; + + public static final String SERIALIZED_NAME_MIME_TYPE = "mimeType"; + + @SerializedName(SERIALIZED_NAME_MIME_TYPE) + @jakarta.annotation.Nullable + private String mimeType; + + public static final String SERIALIZED_NAME_OUTPUT_SCHEMA = "outputSchema"; + + @SerializedName(SERIALIZED_NAME_OUTPUT_SCHEMA) + @jakarta.annotation.Nullable + private Map outputSchema; + + public static final String SERIALIZED_NAME_EXTRA = "extra"; + + @SerializedName(SERIALIZED_NAME_EXTRA) + @jakarta.annotation.Nullable + private B402PaymentKindV1Extra extra; + + public B402SettleRequestV1AllOfPaymentRequirements() {} + + public B402SettleRequestV1AllOfPaymentRequirements scheme( + @jakarta.annotation.Nonnull SchemeEnum scheme) { + this.scheme = scheme; + return this; + } + + /** + * Get scheme + * + * @return scheme + */ + @jakarta.annotation.Nonnull + @NotNull + public SchemeEnum getScheme() { + return scheme; + } + + public void setScheme(@jakarta.annotation.Nonnull SchemeEnum scheme) { + this.scheme = scheme; + } + + public B402SettleRequestV1AllOfPaymentRequirements network( + @jakarta.annotation.Nonnull String network) { + this.network = network; + return this; + } + + /** + * Get network + * + * @return network + */ + @jakarta.annotation.Nonnull + @NotNull + public String getNetwork() { + return network; + } + + public void setNetwork(@jakarta.annotation.Nonnull String network) { + this.network = network; + } + + public B402SettleRequestV1AllOfPaymentRequirements amount( + @jakarta.annotation.Nonnull String amount) { + this.amount = amount; + return this; + } + + /** + * Get amount + * + * @return amount + */ + @jakarta.annotation.Nonnull + @NotNull + public String getAmount() { + return amount; + } + + public void setAmount(@jakarta.annotation.Nonnull String amount) { + this.amount = amount; + } + + public B402SettleRequestV1AllOfPaymentRequirements resource( + @jakarta.annotation.Nullable URI resource) { + this.resource = resource; + return this; + } + + /** + * Get resource + * + * @return resource + */ + @jakarta.annotation.Nullable + @Valid + public URI getResource() { + return resource; + } + + public void setResource(@jakarta.annotation.Nullable URI resource) { + this.resource = resource; + } + + public B402SettleRequestV1AllOfPaymentRequirements description( + @jakarta.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Get description + * + * @return description + */ + @jakarta.annotation.Nullable + public String getDescription() { + return description; + } + + public void setDescription(@jakarta.annotation.Nullable String description) { + this.description = description; + } + + public B402SettleRequestV1AllOfPaymentRequirements payTo( + @jakarta.annotation.Nonnull String payTo) { + this.payTo = payTo; + return this; + } + + /** + * Get payTo + * + * @return payTo + */ + @jakarta.annotation.Nonnull + @NotNull + public String getPayTo() { + return payTo; + } + + public void setPayTo(@jakarta.annotation.Nonnull String payTo) { + this.payTo = payTo; + } + + public B402SettleRequestV1AllOfPaymentRequirements asset( + @jakarta.annotation.Nonnull String asset) { + this.asset = asset; + return this; + } + + /** + * Get asset + * + * @return asset + */ + @jakarta.annotation.Nonnull + @NotNull + public String getAsset() { + return asset; + } + + public void setAsset(@jakarta.annotation.Nonnull String asset) { + this.asset = asset; + } + + public B402SettleRequestV1AllOfPaymentRequirements maxTimeoutSeconds( + @jakarta.annotation.Nonnull Integer maxTimeoutSeconds) { + this.maxTimeoutSeconds = maxTimeoutSeconds; + return this; + } + + /** + * Get maxTimeoutSeconds + * + * @return maxTimeoutSeconds + */ + @jakarta.annotation.Nonnull + @NotNull + public Integer getMaxTimeoutSeconds() { + return maxTimeoutSeconds; + } + + public void setMaxTimeoutSeconds(@jakarta.annotation.Nonnull Integer maxTimeoutSeconds) { + this.maxTimeoutSeconds = maxTimeoutSeconds; + } + + public B402SettleRequestV1AllOfPaymentRequirements mimeType( + @jakarta.annotation.Nullable String mimeType) { + this.mimeType = mimeType; + return this; + } + + /** + * Get mimeType + * + * @return mimeType + */ + @jakarta.annotation.Nullable + public String getMimeType() { + return mimeType; + } + + public void setMimeType(@jakarta.annotation.Nullable String mimeType) { + this.mimeType = mimeType; + } + + public B402SettleRequestV1AllOfPaymentRequirements outputSchema( + @jakarta.annotation.Nullable Map outputSchema) { + this.outputSchema = outputSchema; + return this; + } + + public B402SettleRequestV1AllOfPaymentRequirements putOutputSchemaItem( + String key, Object outputSchemaItem) { + if (this.outputSchema == null) { + this.outputSchema = new HashMap<>(); + } + this.outputSchema.put(key, outputSchemaItem); + return this; + } + + /** + * Get outputSchema + * + * @return outputSchema + */ + @jakarta.annotation.Nullable + public Map getOutputSchema() { + return outputSchema; + } + + public void setOutputSchema(@jakarta.annotation.Nullable Map outputSchema) { + this.outputSchema = outputSchema; + } + + public B402SettleRequestV1AllOfPaymentRequirements extra( + @jakarta.annotation.Nullable B402PaymentKindV1Extra extra) { + this.extra = extra; + return this; + } + + /** + * Get extra + * + * @return extra + */ + @jakarta.annotation.Nullable + @Valid + public B402PaymentKindV1Extra getExtra() { + return extra; + } + + public void setExtra(@jakarta.annotation.Nullable B402PaymentKindV1Extra extra) { + this.extra = extra; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402SettleRequestV1AllOfPaymentRequirements b402SettleRequestV1AllOfPaymentRequirements = + (B402SettleRequestV1AllOfPaymentRequirements) o; + return Objects.equals(this.scheme, b402SettleRequestV1AllOfPaymentRequirements.scheme) + && Objects.equals(this.network, b402SettleRequestV1AllOfPaymentRequirements.network) + && Objects.equals(this.amount, b402SettleRequestV1AllOfPaymentRequirements.amount) + && Objects.equals( + this.resource, b402SettleRequestV1AllOfPaymentRequirements.resource) + && Objects.equals( + this.description, b402SettleRequestV1AllOfPaymentRequirements.description) + && Objects.equals(this.payTo, b402SettleRequestV1AllOfPaymentRequirements.payTo) + && Objects.equals(this.asset, b402SettleRequestV1AllOfPaymentRequirements.asset) + && Objects.equals( + this.maxTimeoutSeconds, + b402SettleRequestV1AllOfPaymentRequirements.maxTimeoutSeconds) + && Objects.equals( + this.mimeType, b402SettleRequestV1AllOfPaymentRequirements.mimeType) + && Objects.equals( + this.outputSchema, b402SettleRequestV1AllOfPaymentRequirements.outputSchema) + && Objects.equals(this.extra, b402SettleRequestV1AllOfPaymentRequirements.extra); + } + + @Override + public int hashCode() { + return Objects.hash( + scheme, + network, + amount, + resource, + description, + payTo, + asset, + maxTimeoutSeconds, + mimeType, + outputSchema, + extra); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402SettleRequestV1AllOfPaymentRequirements {\n"); + sb.append(" scheme: ").append(toIndentedString(scheme)).append("\n"); + sb.append(" network: ").append(toIndentedString(network)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" resource: ").append(toIndentedString(resource)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" payTo: ").append(toIndentedString(payTo)).append("\n"); + sb.append(" asset: ").append(toIndentedString(asset)).append("\n"); + sb.append(" maxTimeoutSeconds: ").append(toIndentedString(maxTimeoutSeconds)).append("\n"); + sb.append(" mimeType: ").append(toIndentedString(mimeType)).append("\n"); + sb.append(" outputSchema: ").append(toIndentedString(outputSchema)).append("\n"); + sb.append(" extra: ").append(toIndentedString(extra)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object schemeValue = getScheme(); + String schemeValueAsString = ""; + schemeValueAsString = schemeValue.toString(); + sb.append("scheme=").append(urlEncode(schemeValueAsString)).append(""); + Object networkValue = getNetwork(); + String networkValueAsString = ""; + networkValueAsString = networkValue.toString(); + sb.append("network=").append(urlEncode(networkValueAsString)).append(""); + Object amountValue = getAmount(); + String amountValueAsString = ""; + amountValueAsString = amountValue.toString(); + sb.append("amount=").append(urlEncode(amountValueAsString)).append(""); + Object resourceValue = getResource(); + String resourceValueAsString = ""; + resourceValueAsString = resourceValue.toString(); + sb.append("resource=").append(urlEncode(resourceValueAsString)).append(""); + Object descriptionValue = getDescription(); + String descriptionValueAsString = ""; + descriptionValueAsString = descriptionValue.toString(); + sb.append("description=").append(urlEncode(descriptionValueAsString)).append(""); + Object payToValue = getPayTo(); + String payToValueAsString = ""; + payToValueAsString = payToValue.toString(); + sb.append("payTo=").append(urlEncode(payToValueAsString)).append(""); + Object assetValue = getAsset(); + String assetValueAsString = ""; + assetValueAsString = assetValue.toString(); + sb.append("asset=").append(urlEncode(assetValueAsString)).append(""); + Object maxTimeoutSecondsValue = getMaxTimeoutSeconds(); + String maxTimeoutSecondsValueAsString = ""; + maxTimeoutSecondsValueAsString = maxTimeoutSecondsValue.toString(); + sb.append("maxTimeoutSeconds=") + .append(urlEncode(maxTimeoutSecondsValueAsString)) + .append(""); + Object mimeTypeValue = getMimeType(); + String mimeTypeValueAsString = ""; + mimeTypeValueAsString = mimeTypeValue.toString(); + sb.append("mimeType=").append(urlEncode(mimeTypeValueAsString)).append(""); + Object outputSchemaValue = getOutputSchema(); + String outputSchemaValueAsString = ""; + outputSchemaValueAsString = outputSchemaValue.toString(); + sb.append("outputSchema=").append(urlEncode(outputSchemaValueAsString)).append(""); + Object extraValue = getExtra(); + String extraValueAsString = ""; + extraValueAsString = extraValue.toString(); + sb.append("extra=").append(urlEncode(extraValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("scheme"); + openapiFields.add("network"); + openapiFields.add("amount"); + openapiFields.add("resource"); + openapiFields.add("description"); + openapiFields.add("payTo"); + openapiFields.add("asset"); + openapiFields.add("maxTimeoutSeconds"); + openapiFields.add("mimeType"); + openapiFields.add("outputSchema"); + openapiFields.add("extra"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("scheme"); + openapiRequiredFields.add("network"); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("payTo"); + openapiRequiredFields.add("asset"); + openapiRequiredFields.add("maxTimeoutSeconds"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * B402SettleRequestV1AllOfPaymentRequirements + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402SettleRequestV1AllOfPaymentRequirements.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " B402SettleRequestV1AllOfPaymentRequirements is not found in" + + " the empty JSON string", + B402SettleRequestV1AllOfPaymentRequirements.openapiRequiredFields + .toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : + B402SettleRequestV1AllOfPaymentRequirements.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("scheme").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `scheme` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("scheme").toString())); + } + // validate the required field `scheme` + SchemeEnum.validateJsonElement(jsonObj.get("scheme")); + if (!jsonObj.get("network").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `network` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("network").toString())); + } + if (!jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `amount` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("amount").toString())); + } + if ((jsonObj.get("resource") != null && !jsonObj.get("resource").isJsonNull()) + && !jsonObj.get("resource").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `resource` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("resource").toString())); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) + && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `description` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("description").toString())); + } + if (!jsonObj.get("payTo").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `payTo` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("payTo").toString())); + } + if (!jsonObj.get("asset").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `asset` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("asset").toString())); + } + if ((jsonObj.get("mimeType") != null && !jsonObj.get("mimeType").isJsonNull()) + && !jsonObj.get("mimeType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `mimeType` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("mimeType").toString())); + } + // validate the optional field `extra` + if (jsonObj.get("extra") != null && !jsonObj.get("extra").isJsonNull()) { + B402PaymentKindV1Extra.validateJsonElement(jsonObj.get("extra")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402SettleRequestV1AllOfPaymentRequirements.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'B402SettleRequestV1AllOfPaymentRequirements' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(B402SettleRequestV1AllOfPaymentRequirements.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, B402SettleRequestV1AllOfPaymentRequirements value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402SettleRequestV1AllOfPaymentRequirements read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402SettleRequestV1AllOfPaymentRequirements given an JSON string + * + * @param jsonString JSON string + * @return An instance of B402SettleRequestV1AllOfPaymentRequirements + * @throws IOException if the JSON string is invalid with respect to + * B402SettleRequestV1AllOfPaymentRequirements + */ + public static B402SettleRequestV1AllOfPaymentRequirements fromJson(String jsonString) + throws IOException { + return JSON.getGson() + .fromJson(jsonString, B402SettleRequestV1AllOfPaymentRequirements.class); + } + + /** + * Convert an instance of B402SettleRequestV1AllOfPaymentRequirements to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SettleRequestV2.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SettleRequestV2.java new file mode 100644 index 0000000..9b36f8e --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SettleRequestV2.java @@ -0,0 +1,394 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** B402SettleRequestV2 */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402SettleRequestV2 { + /** Gets or Sets x402Version */ + @JsonAdapter(X402VersionEnum.Adapter.class) + public enum X402VersionEnum { + X402_VERSION_2(2); + + private Integer value; + + X402VersionEnum(Integer value) { + this.value = value; + } + + public Integer getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static X402VersionEnum fromValue(Integer value) { + for (X402VersionEnum b : X402VersionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final X402VersionEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public X402VersionEnum read(final JsonReader jsonReader) throws IOException { + Integer value = jsonReader.nextInt(); + return X402VersionEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + Integer value = jsonElement.getAsInt(); + X402VersionEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_X402_VERSION = "x402Version"; + + @SerializedName(SERIALIZED_NAME_X402_VERSION) + @jakarta.annotation.Nonnull + private X402VersionEnum x402Version; + + public static final String SERIALIZED_NAME_PAYMENT_PAYLOAD = "paymentPayload"; + + @SerializedName(SERIALIZED_NAME_PAYMENT_PAYLOAD) + @jakarta.annotation.Nonnull + private B402SettleRequestV2AllOfPaymentPayload paymentPayload; + + public static final String SERIALIZED_NAME_PAYMENT_REQUIREMENTS = "paymentRequirements"; + + @SerializedName(SERIALIZED_NAME_PAYMENT_REQUIREMENTS) + @jakarta.annotation.Nonnull + private B402SettleRequestV2AllOfPaymentPayloadAccepted paymentRequirements; + + public static final String SERIALIZED_NAME_SETTLE_AMOUNT = "settleAmount"; + + @SerializedName(SERIALIZED_NAME_SETTLE_AMOUNT) + @jakarta.annotation.Nullable + private String settleAmount; + + public B402SettleRequestV2() {} + + public B402SettleRequestV2 x402Version( + @jakarta.annotation.Nonnull X402VersionEnum x402Version) { + this.x402Version = x402Version; + return this; + } + + /** + * Get x402Version + * + * @return x402Version + */ + @jakarta.annotation.Nonnull + @NotNull + public X402VersionEnum getX402Version() { + return x402Version; + } + + public void setX402Version(@jakarta.annotation.Nonnull X402VersionEnum x402Version) { + this.x402Version = x402Version; + } + + public B402SettleRequestV2 paymentPayload( + @jakarta.annotation.Nonnull B402SettleRequestV2AllOfPaymentPayload paymentPayload) { + this.paymentPayload = paymentPayload; + return this; + } + + /** + * Get paymentPayload + * + * @return paymentPayload + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public B402SettleRequestV2AllOfPaymentPayload getPaymentPayload() { + return paymentPayload; + } + + public void setPaymentPayload( + @jakarta.annotation.Nonnull B402SettleRequestV2AllOfPaymentPayload paymentPayload) { + this.paymentPayload = paymentPayload; + } + + public B402SettleRequestV2 paymentRequirements( + @jakarta.annotation.Nonnull + B402SettleRequestV2AllOfPaymentPayloadAccepted paymentRequirements) { + this.paymentRequirements = paymentRequirements; + return this; + } + + /** + * Get paymentRequirements + * + * @return paymentRequirements + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public B402SettleRequestV2AllOfPaymentPayloadAccepted getPaymentRequirements() { + return paymentRequirements; + } + + public void setPaymentRequirements( + @jakarta.annotation.Nonnull + B402SettleRequestV2AllOfPaymentPayloadAccepted paymentRequirements) { + this.paymentRequirements = paymentRequirements; + } + + public B402SettleRequestV2 settleAmount(@jakarta.annotation.Nullable String settleAmount) { + this.settleAmount = settleAmount; + return this; + } + + /** + * Get settleAmount + * + * @return settleAmount + */ + @jakarta.annotation.Nullable + @Pattern(regexp = "^[0-9]+$") + public String getSettleAmount() { + return settleAmount; + } + + public void setSettleAmount(@jakarta.annotation.Nullable String settleAmount) { + this.settleAmount = settleAmount; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402SettleRequestV2 b402SettleRequestV2 = (B402SettleRequestV2) o; + return Objects.equals(this.x402Version, b402SettleRequestV2.x402Version) + && Objects.equals(this.paymentPayload, b402SettleRequestV2.paymentPayload) + && Objects.equals(this.paymentRequirements, b402SettleRequestV2.paymentRequirements) + && Objects.equals(this.settleAmount, b402SettleRequestV2.settleAmount); + } + + @Override + public int hashCode() { + return Objects.hash(x402Version, paymentPayload, paymentRequirements, settleAmount); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402SettleRequestV2 {\n"); + sb.append(" x402Version: ").append(toIndentedString(x402Version)).append("\n"); + sb.append(" paymentPayload: ").append(toIndentedString(paymentPayload)).append("\n"); + sb.append(" paymentRequirements: ") + .append(toIndentedString(paymentRequirements)) + .append("\n"); + sb.append(" settleAmount: ").append(toIndentedString(settleAmount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object x402VersionValue = getX402Version(); + String x402VersionValueAsString = ""; + x402VersionValueAsString = x402VersionValue.toString(); + sb.append("x402Version=").append(urlEncode(x402VersionValueAsString)).append(""); + Object paymentPayloadValue = getPaymentPayload(); + String paymentPayloadValueAsString = ""; + paymentPayloadValueAsString = paymentPayloadValue.toString(); + sb.append("paymentPayload=").append(urlEncode(paymentPayloadValueAsString)).append(""); + Object paymentRequirementsValue = getPaymentRequirements(); + String paymentRequirementsValueAsString = ""; + paymentRequirementsValueAsString = paymentRequirementsValue.toString(); + sb.append("paymentRequirements=") + .append(urlEncode(paymentRequirementsValueAsString)) + .append(""); + Object settleAmountValue = getSettleAmount(); + String settleAmountValueAsString = ""; + settleAmountValueAsString = settleAmountValue.toString(); + sb.append("settleAmount=").append(urlEncode(settleAmountValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("x402Version"); + openapiFields.add("paymentPayload"); + openapiFields.add("paymentRequirements"); + openapiFields.add("settleAmount"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("x402Version"); + openapiRequiredFields.add("paymentPayload"); + openapiRequiredFields.add("paymentRequirements"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to B402SettleRequestV2 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402SettleRequestV2.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in B402SettleRequestV2 is not found in" + + " the empty JSON string", + B402SettleRequestV2.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : B402SettleRequestV2.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `x402Version` + X402VersionEnum.validateJsonElement(jsonObj.get("x402Version")); + // validate the required field `paymentPayload` + B402SettleRequestV2AllOfPaymentPayload.validateJsonElement(jsonObj.get("paymentPayload")); + // validate the required field `paymentRequirements` + B402SettleRequestV2AllOfPaymentPayloadAccepted.validateJsonElement( + jsonObj.get("paymentRequirements")); + if ((jsonObj.get("settleAmount") != null && !jsonObj.get("settleAmount").isJsonNull()) + && !jsonObj.get("settleAmount").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `settleAmount` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("settleAmount").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402SettleRequestV2.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'B402SettleRequestV2' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(B402SettleRequestV2.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, B402SettleRequestV2 value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402SettleRequestV2 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402SettleRequestV2 given an JSON string + * + * @param jsonString JSON string + * @return An instance of B402SettleRequestV2 + * @throws IOException if the JSON string is invalid with respect to B402SettleRequestV2 + */ + public static B402SettleRequestV2 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, B402SettleRequestV2.class); + } + + /** + * Convert an instance of B402SettleRequestV2 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SettleRequestV2AllOfPaymentPayload.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SettleRequestV2AllOfPaymentPayload.java new file mode 100644 index 0000000..c41853f --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SettleRequestV2AllOfPaymentPayload.java @@ -0,0 +1,439 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** B402SettleRequestV2AllOfPaymentPayload */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402SettleRequestV2AllOfPaymentPayload { + /** Gets or Sets x402Version */ + @JsonAdapter(X402VersionEnum.Adapter.class) + public enum X402VersionEnum { + X402_VERSION_2(2); + + private Integer value; + + X402VersionEnum(Integer value) { + this.value = value; + } + + public Integer getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static X402VersionEnum fromValue(Integer value) { + for (X402VersionEnum b : X402VersionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final X402VersionEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public X402VersionEnum read(final JsonReader jsonReader) throws IOException { + Integer value = jsonReader.nextInt(); + return X402VersionEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + Integer value = jsonElement.getAsInt(); + X402VersionEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_X402_VERSION = "x402Version"; + + @SerializedName(SERIALIZED_NAME_X402_VERSION) + @jakarta.annotation.Nonnull + private X402VersionEnum x402Version; + + public static final String SERIALIZED_NAME_RESOURCE = "resource"; + + @SerializedName(SERIALIZED_NAME_RESOURCE) + @jakarta.annotation.Nonnull + private B402SettleRequestV2AllOfPaymentPayloadResource resource; + + public static final String SERIALIZED_NAME_ACCEPTED = "accepted"; + + @SerializedName(SERIALIZED_NAME_ACCEPTED) + @jakarta.annotation.Nonnull + private B402SettleRequestV2AllOfPaymentPayloadAccepted accepted; + + public static final String SERIALIZED_NAME_PAYLOAD = "payload"; + + @SerializedName(SERIALIZED_NAME_PAYLOAD) + @jakarta.annotation.Nonnull + private B402SettleRequestV2AllOfPaymentPayloadPayload payload; + + public static final String SERIALIZED_NAME_EXTENSIONS = "extensions"; + + @SerializedName(SERIALIZED_NAME_EXTENSIONS) + @jakarta.annotation.Nullable + private Map extensions; + + public B402SettleRequestV2AllOfPaymentPayload() {} + + public B402SettleRequestV2AllOfPaymentPayload x402Version( + @jakarta.annotation.Nonnull X402VersionEnum x402Version) { + this.x402Version = x402Version; + return this; + } + + /** + * Get x402Version + * + * @return x402Version + */ + @jakarta.annotation.Nonnull + @NotNull + public X402VersionEnum getX402Version() { + return x402Version; + } + + public void setX402Version(@jakarta.annotation.Nonnull X402VersionEnum x402Version) { + this.x402Version = x402Version; + } + + public B402SettleRequestV2AllOfPaymentPayload resource( + @jakarta.annotation.Nonnull B402SettleRequestV2AllOfPaymentPayloadResource resource) { + this.resource = resource; + return this; + } + + /** + * Get resource + * + * @return resource + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public B402SettleRequestV2AllOfPaymentPayloadResource getResource() { + return resource; + } + + public void setResource( + @jakarta.annotation.Nonnull B402SettleRequestV2AllOfPaymentPayloadResource resource) { + this.resource = resource; + } + + public B402SettleRequestV2AllOfPaymentPayload accepted( + @jakarta.annotation.Nonnull B402SettleRequestV2AllOfPaymentPayloadAccepted accepted) { + this.accepted = accepted; + return this; + } + + /** + * Get accepted + * + * @return accepted + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public B402SettleRequestV2AllOfPaymentPayloadAccepted getAccepted() { + return accepted; + } + + public void setAccepted( + @jakarta.annotation.Nonnull B402SettleRequestV2AllOfPaymentPayloadAccepted accepted) { + this.accepted = accepted; + } + + public B402SettleRequestV2AllOfPaymentPayload payload( + @jakarta.annotation.Nonnull B402SettleRequestV2AllOfPaymentPayloadPayload payload) { + this.payload = payload; + return this; + } + + /** + * Get payload + * + * @return payload + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public B402SettleRequestV2AllOfPaymentPayloadPayload getPayload() { + return payload; + } + + public void setPayload( + @jakarta.annotation.Nonnull B402SettleRequestV2AllOfPaymentPayloadPayload payload) { + this.payload = payload; + } + + public B402SettleRequestV2AllOfPaymentPayload extensions( + @jakarta.annotation.Nullable Map extensions) { + this.extensions = extensions; + return this; + } + + public B402SettleRequestV2AllOfPaymentPayload putExtensionsItem( + String key, Object extensionsItem) { + if (this.extensions == null) { + this.extensions = new HashMap<>(); + } + this.extensions.put(key, extensionsItem); + return this; + } + + /** + * Get extensions + * + * @return extensions + */ + @jakarta.annotation.Nullable + public Map getExtensions() { + return extensions; + } + + public void setExtensions(@jakarta.annotation.Nullable Map extensions) { + this.extensions = extensions; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402SettleRequestV2AllOfPaymentPayload b402SettleRequestV2AllOfPaymentPayload = + (B402SettleRequestV2AllOfPaymentPayload) o; + return Objects.equals(this.x402Version, b402SettleRequestV2AllOfPaymentPayload.x402Version) + && Objects.equals(this.resource, b402SettleRequestV2AllOfPaymentPayload.resource) + && Objects.equals(this.accepted, b402SettleRequestV2AllOfPaymentPayload.accepted) + && Objects.equals(this.payload, b402SettleRequestV2AllOfPaymentPayload.payload) + && Objects.equals( + this.extensions, b402SettleRequestV2AllOfPaymentPayload.extensions); + } + + @Override + public int hashCode() { + return Objects.hash(x402Version, resource, accepted, payload, extensions); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402SettleRequestV2AllOfPaymentPayload {\n"); + sb.append(" x402Version: ").append(toIndentedString(x402Version)).append("\n"); + sb.append(" resource: ").append(toIndentedString(resource)).append("\n"); + sb.append(" accepted: ").append(toIndentedString(accepted)).append("\n"); + sb.append(" payload: ").append(toIndentedString(payload)).append("\n"); + sb.append(" extensions: ").append(toIndentedString(extensions)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object x402VersionValue = getX402Version(); + String x402VersionValueAsString = ""; + x402VersionValueAsString = x402VersionValue.toString(); + sb.append("x402Version=").append(urlEncode(x402VersionValueAsString)).append(""); + Object resourceValue = getResource(); + String resourceValueAsString = ""; + resourceValueAsString = resourceValue.toString(); + sb.append("resource=").append(urlEncode(resourceValueAsString)).append(""); + Object acceptedValue = getAccepted(); + String acceptedValueAsString = ""; + acceptedValueAsString = acceptedValue.toString(); + sb.append("accepted=").append(urlEncode(acceptedValueAsString)).append(""); + Object payloadValue = getPayload(); + String payloadValueAsString = ""; + payloadValueAsString = payloadValue.toString(); + sb.append("payload=").append(urlEncode(payloadValueAsString)).append(""); + Object extensionsValue = getExtensions(); + String extensionsValueAsString = ""; + extensionsValueAsString = extensionsValue.toString(); + sb.append("extensions=").append(urlEncode(extensionsValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("x402Version"); + openapiFields.add("resource"); + openapiFields.add("accepted"); + openapiFields.add("payload"); + openapiFields.add("extensions"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("x402Version"); + openapiRequiredFields.add("resource"); + openapiRequiredFields.add("accepted"); + openapiRequiredFields.add("payload"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * B402SettleRequestV2AllOfPaymentPayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402SettleRequestV2AllOfPaymentPayload.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in B402SettleRequestV2AllOfPaymentPayload" + + " is not found in the empty JSON string", + B402SettleRequestV2AllOfPaymentPayload.openapiRequiredFields + .toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : B402SettleRequestV2AllOfPaymentPayload.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `x402Version` + X402VersionEnum.validateJsonElement(jsonObj.get("x402Version")); + // validate the required field `resource` + B402SettleRequestV2AllOfPaymentPayloadResource.validateJsonElement(jsonObj.get("resource")); + // validate the required field `accepted` + B402SettleRequestV2AllOfPaymentPayloadAccepted.validateJsonElement(jsonObj.get("accepted")); + // validate the required field `payload` + B402SettleRequestV2AllOfPaymentPayloadPayload.validateJsonElement(jsonObj.get("payload")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402SettleRequestV2AllOfPaymentPayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'B402SettleRequestV2AllOfPaymentPayload' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(B402SettleRequestV2AllOfPaymentPayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, B402SettleRequestV2AllOfPaymentPayload value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402SettleRequestV2AllOfPaymentPayload read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402SettleRequestV2AllOfPaymentPayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of B402SettleRequestV2AllOfPaymentPayload + * @throws IOException if the JSON string is invalid with respect to + * B402SettleRequestV2AllOfPaymentPayload + */ + public static B402SettleRequestV2AllOfPaymentPayload fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, B402SettleRequestV2AllOfPaymentPayload.class); + } + + /** + * Convert an instance of B402SettleRequestV2AllOfPaymentPayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SettleRequestV2AllOfPaymentPayloadAccepted.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SettleRequestV2AllOfPaymentPayloadAccepted.java new file mode 100644 index 0000000..d2027da --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SettleRequestV2AllOfPaymentPayloadAccepted.java @@ -0,0 +1,537 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** B402SettleRequestV2AllOfPaymentPayloadAccepted */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402SettleRequestV2AllOfPaymentPayloadAccepted { + /** Gets or Sets scheme */ + @JsonAdapter(SchemeEnum.Adapter.class) + public enum SchemeEnum { + exact("exact"), + + upto("upto"); + + private String value; + + SchemeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static SchemeEnum fromValue(String value) { + for (SchemeEnum b : SchemeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final SchemeEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public SchemeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return SchemeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + SchemeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_SCHEME = "scheme"; + + @SerializedName(SERIALIZED_NAME_SCHEME) + @jakarta.annotation.Nonnull + private SchemeEnum scheme; + + public static final String SERIALIZED_NAME_NETWORK = "network"; + + @SerializedName(SERIALIZED_NAME_NETWORK) + @jakarta.annotation.Nonnull + private String network; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + + @SerializedName(SERIALIZED_NAME_AMOUNT) + @jakarta.annotation.Nonnull + private String amount; + + public static final String SERIALIZED_NAME_ASSET = "asset"; + + @SerializedName(SERIALIZED_NAME_ASSET) + @jakarta.annotation.Nonnull + private String asset; + + public static final String SERIALIZED_NAME_PAY_TO = "payTo"; + + @SerializedName(SERIALIZED_NAME_PAY_TO) + @jakarta.annotation.Nonnull + private String payTo; + + public static final String SERIALIZED_NAME_MAX_TIMEOUT_SECONDS = "maxTimeoutSeconds"; + + @SerializedName(SERIALIZED_NAME_MAX_TIMEOUT_SECONDS) + @jakarta.annotation.Nonnull + private Integer maxTimeoutSeconds; + + public static final String SERIALIZED_NAME_EXTRA = "extra"; + + @SerializedName(SERIALIZED_NAME_EXTRA) + @jakarta.annotation.Nonnull + private Object extra; + + public B402SettleRequestV2AllOfPaymentPayloadAccepted() {} + + public B402SettleRequestV2AllOfPaymentPayloadAccepted scheme( + @jakarta.annotation.Nonnull SchemeEnum scheme) { + this.scheme = scheme; + return this; + } + + /** + * Get scheme + * + * @return scheme + */ + @jakarta.annotation.Nonnull + @NotNull + public SchemeEnum getScheme() { + return scheme; + } + + public void setScheme(@jakarta.annotation.Nonnull SchemeEnum scheme) { + this.scheme = scheme; + } + + public B402SettleRequestV2AllOfPaymentPayloadAccepted network( + @jakarta.annotation.Nonnull String network) { + this.network = network; + return this; + } + + /** + * Get network + * + * @return network + */ + @jakarta.annotation.Nonnull + @NotNull + public String getNetwork() { + return network; + } + + public void setNetwork(@jakarta.annotation.Nonnull String network) { + this.network = network; + } + + public B402SettleRequestV2AllOfPaymentPayloadAccepted amount( + @jakarta.annotation.Nonnull String amount) { + this.amount = amount; + return this; + } + + /** + * Get amount + * + * @return amount + */ + @jakarta.annotation.Nonnull + @NotNull + @Pattern(regexp = "^[0-9]+$") + public String getAmount() { + return amount; + } + + public void setAmount(@jakarta.annotation.Nonnull String amount) { + this.amount = amount; + } + + public B402SettleRequestV2AllOfPaymentPayloadAccepted asset( + @jakarta.annotation.Nonnull String asset) { + this.asset = asset; + return this; + } + + /** + * Get asset + * + * @return asset + */ + @jakarta.annotation.Nonnull + @NotNull + public String getAsset() { + return asset; + } + + public void setAsset(@jakarta.annotation.Nonnull String asset) { + this.asset = asset; + } + + public B402SettleRequestV2AllOfPaymentPayloadAccepted payTo( + @jakarta.annotation.Nonnull String payTo) { + this.payTo = payTo; + return this; + } + + /** + * Get payTo + * + * @return payTo + */ + @jakarta.annotation.Nonnull + @NotNull + public String getPayTo() { + return payTo; + } + + public void setPayTo(@jakarta.annotation.Nonnull String payTo) { + this.payTo = payTo; + } + + public B402SettleRequestV2AllOfPaymentPayloadAccepted maxTimeoutSeconds( + @jakarta.annotation.Nonnull Integer maxTimeoutSeconds) { + this.maxTimeoutSeconds = maxTimeoutSeconds; + return this; + } + + /** + * Get maxTimeoutSeconds + * + * @return maxTimeoutSeconds + */ + @jakarta.annotation.Nonnull + @NotNull + public Integer getMaxTimeoutSeconds() { + return maxTimeoutSeconds; + } + + public void setMaxTimeoutSeconds(@jakarta.annotation.Nonnull Integer maxTimeoutSeconds) { + this.maxTimeoutSeconds = maxTimeoutSeconds; + } + + public B402SettleRequestV2AllOfPaymentPayloadAccepted extra( + @jakarta.annotation.Nonnull Object extra) { + this.extra = extra; + return this; + } + + /** + * Get extra + * + * @return extra + */ + @jakarta.annotation.Nonnull + @NotNull + public Object getExtra() { + return extra; + } + + public void setExtra(@jakarta.annotation.Nonnull Object extra) { + this.extra = extra; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402SettleRequestV2AllOfPaymentPayloadAccepted + b402SettleRequestV2AllOfPaymentPayloadAccepted = + (B402SettleRequestV2AllOfPaymentPayloadAccepted) o; + return Objects.equals(this.scheme, b402SettleRequestV2AllOfPaymentPayloadAccepted.scheme) + && Objects.equals( + this.network, b402SettleRequestV2AllOfPaymentPayloadAccepted.network) + && Objects.equals( + this.amount, b402SettleRequestV2AllOfPaymentPayloadAccepted.amount) + && Objects.equals(this.asset, b402SettleRequestV2AllOfPaymentPayloadAccepted.asset) + && Objects.equals(this.payTo, b402SettleRequestV2AllOfPaymentPayloadAccepted.payTo) + && Objects.equals( + this.maxTimeoutSeconds, + b402SettleRequestV2AllOfPaymentPayloadAccepted.maxTimeoutSeconds) + && Objects.equals(this.extra, b402SettleRequestV2AllOfPaymentPayloadAccepted.extra); + } + + @Override + public int hashCode() { + return Objects.hash(scheme, network, amount, asset, payTo, maxTimeoutSeconds, extra); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402SettleRequestV2AllOfPaymentPayloadAccepted {\n"); + sb.append(" scheme: ").append(toIndentedString(scheme)).append("\n"); + sb.append(" network: ").append(toIndentedString(network)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" asset: ").append(toIndentedString(asset)).append("\n"); + sb.append(" payTo: ").append(toIndentedString(payTo)).append("\n"); + sb.append(" maxTimeoutSeconds: ").append(toIndentedString(maxTimeoutSeconds)).append("\n"); + sb.append(" extra: ").append(toIndentedString(extra)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object schemeValue = getScheme(); + String schemeValueAsString = ""; + schemeValueAsString = schemeValue.toString(); + sb.append("scheme=").append(urlEncode(schemeValueAsString)).append(""); + Object networkValue = getNetwork(); + String networkValueAsString = ""; + networkValueAsString = networkValue.toString(); + sb.append("network=").append(urlEncode(networkValueAsString)).append(""); + Object amountValue = getAmount(); + String amountValueAsString = ""; + amountValueAsString = amountValue.toString(); + sb.append("amount=").append(urlEncode(amountValueAsString)).append(""); + Object assetValue = getAsset(); + String assetValueAsString = ""; + assetValueAsString = assetValue.toString(); + sb.append("asset=").append(urlEncode(assetValueAsString)).append(""); + Object payToValue = getPayTo(); + String payToValueAsString = ""; + payToValueAsString = payToValue.toString(); + sb.append("payTo=").append(urlEncode(payToValueAsString)).append(""); + Object maxTimeoutSecondsValue = getMaxTimeoutSeconds(); + String maxTimeoutSecondsValueAsString = ""; + maxTimeoutSecondsValueAsString = maxTimeoutSecondsValue.toString(); + sb.append("maxTimeoutSeconds=") + .append(urlEncode(maxTimeoutSecondsValueAsString)) + .append(""); + Object extraValue = getExtra(); + String extraValueAsString = ""; + extraValueAsString = extraValue.toString(); + sb.append("extra=").append(urlEncode(extraValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("scheme"); + openapiFields.add("network"); + openapiFields.add("amount"); + openapiFields.add("asset"); + openapiFields.add("payTo"); + openapiFields.add("maxTimeoutSeconds"); + openapiFields.add("extra"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("scheme"); + openapiRequiredFields.add("network"); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("asset"); + openapiRequiredFields.add("payTo"); + openapiRequiredFields.add("maxTimeoutSeconds"); + openapiRequiredFields.add("extra"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * B402SettleRequestV2AllOfPaymentPayloadAccepted + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402SettleRequestV2AllOfPaymentPayloadAccepted.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " B402SettleRequestV2AllOfPaymentPayloadAccepted is not found" + + " in the empty JSON string", + B402SettleRequestV2AllOfPaymentPayloadAccepted.openapiRequiredFields + .toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : + B402SettleRequestV2AllOfPaymentPayloadAccepted.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("scheme").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `scheme` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("scheme").toString())); + } + // validate the required field `scheme` + SchemeEnum.validateJsonElement(jsonObj.get("scheme")); + if (!jsonObj.get("network").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `network` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("network").toString())); + } + if (!jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `amount` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("amount").toString())); + } + if (!jsonObj.get("asset").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `asset` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("asset").toString())); + } + if (!jsonObj.get("payTo").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `payTo` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("payTo").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402SettleRequestV2AllOfPaymentPayloadAccepted.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'B402SettleRequestV2AllOfPaymentPayloadAccepted' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, + TypeToken.get(B402SettleRequestV2AllOfPaymentPayloadAccepted.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, + B402SettleRequestV2AllOfPaymentPayloadAccepted value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402SettleRequestV2AllOfPaymentPayloadAccepted read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402SettleRequestV2AllOfPaymentPayloadAccepted given an JSON string + * + * @param jsonString JSON string + * @return An instance of B402SettleRequestV2AllOfPaymentPayloadAccepted + * @throws IOException if the JSON string is invalid with respect to + * B402SettleRequestV2AllOfPaymentPayloadAccepted + */ + public static B402SettleRequestV2AllOfPaymentPayloadAccepted fromJson(String jsonString) + throws IOException { + return JSON.getGson() + .fromJson(jsonString, B402SettleRequestV2AllOfPaymentPayloadAccepted.class); + } + + /** + * Convert an instance of B402SettleRequestV2AllOfPaymentPayloadAccepted to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SettleRequestV2AllOfPaymentPayloadPayload.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SettleRequestV2AllOfPaymentPayloadPayload.java new file mode 100644 index 0000000..1e655dc --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SettleRequestV2AllOfPaymentPayloadPayload.java @@ -0,0 +1,332 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** B402SettleRequestV2AllOfPaymentPayloadPayload */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402SettleRequestV2AllOfPaymentPayloadPayload { + public static final String SERIALIZED_NAME_SIGNATURE = "signature"; + + @SerializedName(SERIALIZED_NAME_SIGNATURE) + @jakarta.annotation.Nonnull + private String signature; + + public static final String SERIALIZED_NAME_AUTHORIZATION = "authorization"; + + @SerializedName(SERIALIZED_NAME_AUTHORIZATION) + @jakarta.annotation.Nullable + private B402PayloadDetailAuthorization authorization; + + public static final String SERIALIZED_NAME_PERMIT2_AUTHORIZATION = "permit2Authorization"; + + @SerializedName(SERIALIZED_NAME_PERMIT2_AUTHORIZATION) + @jakarta.annotation.Nullable + private B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2Authorization permit2Authorization; + + public B402SettleRequestV2AllOfPaymentPayloadPayload() {} + + public B402SettleRequestV2AllOfPaymentPayloadPayload signature( + @jakarta.annotation.Nonnull String signature) { + this.signature = signature; + return this; + } + + /** + * Get signature + * + * @return signature + */ + @jakarta.annotation.Nonnull + @NotNull + public String getSignature() { + return signature; + } + + public void setSignature(@jakarta.annotation.Nonnull String signature) { + this.signature = signature; + } + + public B402SettleRequestV2AllOfPaymentPayloadPayload authorization( + @jakarta.annotation.Nullable B402PayloadDetailAuthorization authorization) { + this.authorization = authorization; + return this; + } + + /** + * Get authorization + * + * @return authorization + */ + @jakarta.annotation.Nullable + @Valid + public B402PayloadDetailAuthorization getAuthorization() { + return authorization; + } + + public void setAuthorization( + @jakarta.annotation.Nullable B402PayloadDetailAuthorization authorization) { + this.authorization = authorization; + } + + public B402SettleRequestV2AllOfPaymentPayloadPayload permit2Authorization( + @jakarta.annotation.Nullable + B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2Authorization + permit2Authorization) { + this.permit2Authorization = permit2Authorization; + return this; + } + + /** + * Get permit2Authorization + * + * @return permit2Authorization + */ + @jakarta.annotation.Nullable + @Valid + public B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2Authorization + getPermit2Authorization() { + return permit2Authorization; + } + + public void setPermit2Authorization( + @jakarta.annotation.Nullable + B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2Authorization + permit2Authorization) { + this.permit2Authorization = permit2Authorization; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402SettleRequestV2AllOfPaymentPayloadPayload + b402SettleRequestV2AllOfPaymentPayloadPayload = + (B402SettleRequestV2AllOfPaymentPayloadPayload) o; + return Objects.equals( + this.signature, b402SettleRequestV2AllOfPaymentPayloadPayload.signature) + && Objects.equals( + this.authorization, + b402SettleRequestV2AllOfPaymentPayloadPayload.authorization) + && Objects.equals( + this.permit2Authorization, + b402SettleRequestV2AllOfPaymentPayloadPayload.permit2Authorization); + } + + @Override + public int hashCode() { + return Objects.hash(signature, authorization, permit2Authorization); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402SettleRequestV2AllOfPaymentPayloadPayload {\n"); + sb.append(" signature: ").append(toIndentedString(signature)).append("\n"); + sb.append(" authorization: ").append(toIndentedString(authorization)).append("\n"); + sb.append(" permit2Authorization: ") + .append(toIndentedString(permit2Authorization)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object signatureValue = getSignature(); + String signatureValueAsString = ""; + signatureValueAsString = signatureValue.toString(); + sb.append("signature=").append(urlEncode(signatureValueAsString)).append(""); + Object authorizationValue = getAuthorization(); + String authorizationValueAsString = ""; + authorizationValueAsString = authorizationValue.toString(); + sb.append("authorization=").append(urlEncode(authorizationValueAsString)).append(""); + Object permit2AuthorizationValue = getPermit2Authorization(); + String permit2AuthorizationValueAsString = ""; + permit2AuthorizationValueAsString = permit2AuthorizationValue.toString(); + sb.append("permit2Authorization=") + .append(urlEncode(permit2AuthorizationValueAsString)) + .append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("signature"); + openapiFields.add("authorization"); + openapiFields.add("permit2Authorization"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("signature"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * B402SettleRequestV2AllOfPaymentPayloadPayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402SettleRequestV2AllOfPaymentPayloadPayload.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " B402SettleRequestV2AllOfPaymentPayloadPayload is not found" + + " in the empty JSON string", + B402SettleRequestV2AllOfPaymentPayloadPayload.openapiRequiredFields + .toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : + B402SettleRequestV2AllOfPaymentPayloadPayload.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("signature").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `signature` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("signature").toString())); + } + // validate the optional field `authorization` + if (jsonObj.get("authorization") != null && !jsonObj.get("authorization").isJsonNull()) { + B402PayloadDetailAuthorization.validateJsonElement(jsonObj.get("authorization")); + } + // validate the optional field `permit2Authorization` + if (jsonObj.get("permit2Authorization") != null + && !jsonObj.get("permit2Authorization").isJsonNull()) { + B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2Authorization.validateJsonElement( + jsonObj.get("permit2Authorization")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402SettleRequestV2AllOfPaymentPayloadPayload.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'B402SettleRequestV2AllOfPaymentPayloadPayload' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, + TypeToken.get(B402SettleRequestV2AllOfPaymentPayloadPayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, B402SettleRequestV2AllOfPaymentPayloadPayload value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402SettleRequestV2AllOfPaymentPayloadPayload read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402SettleRequestV2AllOfPaymentPayloadPayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of B402SettleRequestV2AllOfPaymentPayloadPayload + * @throws IOException if the JSON string is invalid with respect to + * B402SettleRequestV2AllOfPaymentPayloadPayload + */ + public static B402SettleRequestV2AllOfPaymentPayloadPayload fromJson(String jsonString) + throws IOException { + return JSON.getGson() + .fromJson(jsonString, B402SettleRequestV2AllOfPaymentPayloadPayload.class); + } + + /** + * Convert an instance of B402SettleRequestV2AllOfPaymentPayloadPayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2Authorization.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2Authorization.java new file mode 100644 index 0000000..1d13045 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2Authorization.java @@ -0,0 +1,479 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2Authorization */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2Authorization { + public static final String SERIALIZED_NAME_PERMITTED = "permitted"; + + @SerializedName(SERIALIZED_NAME_PERMITTED) + @jakarta.annotation.Nonnull + private B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationPermitted permitted; + + public static final String SERIALIZED_NAME_FROM = "from"; + + @SerializedName(SERIALIZED_NAME_FROM) + @jakarta.annotation.Nonnull + private String from; + + public static final String SERIALIZED_NAME_SPENDER = "spender"; + + @SerializedName(SERIALIZED_NAME_SPENDER) + @jakarta.annotation.Nonnull + private String spender; + + public static final String SERIALIZED_NAME_NONCE = "nonce"; + + @SerializedName(SERIALIZED_NAME_NONCE) + @jakarta.annotation.Nonnull + private String nonce; + + public static final String SERIALIZED_NAME_DEADLINE = "deadline"; + + @SerializedName(SERIALIZED_NAME_DEADLINE) + @jakarta.annotation.Nonnull + private String deadline; + + public static final String SERIALIZED_NAME_WITNESS = "witness"; + + @SerializedName(SERIALIZED_NAME_WITNESS) + @jakarta.annotation.Nonnull + private B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationWitness witness; + + public B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2Authorization() {} + + public B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2Authorization permitted( + @jakarta.annotation.Nonnull + B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationPermitted + permitted) { + this.permitted = permitted; + return this; + } + + /** + * Get permitted + * + * @return permitted + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationPermitted + getPermitted() { + return permitted; + } + + public void setPermitted( + @jakarta.annotation.Nonnull + B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationPermitted + permitted) { + this.permitted = permitted; + } + + public B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2Authorization from( + @jakarta.annotation.Nonnull String from) { + this.from = from; + return this; + } + + /** + * Get from + * + * @return from + */ + @jakarta.annotation.Nonnull + @NotNull + public String getFrom() { + return from; + } + + public void setFrom(@jakarta.annotation.Nonnull String from) { + this.from = from; + } + + public B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2Authorization spender( + @jakarta.annotation.Nonnull String spender) { + this.spender = spender; + return this; + } + + /** + * Get spender + * + * @return spender + */ + @jakarta.annotation.Nonnull + @NotNull + public String getSpender() { + return spender; + } + + public void setSpender(@jakarta.annotation.Nonnull String spender) { + this.spender = spender; + } + + public B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2Authorization nonce( + @jakarta.annotation.Nonnull String nonce) { + this.nonce = nonce; + return this; + } + + /** + * Get nonce + * + * @return nonce + */ + @jakarta.annotation.Nonnull + @NotNull + public String getNonce() { + return nonce; + } + + public void setNonce(@jakarta.annotation.Nonnull String nonce) { + this.nonce = nonce; + } + + public B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2Authorization deadline( + @jakarta.annotation.Nonnull String deadline) { + this.deadline = deadline; + return this; + } + + /** + * Get deadline + * + * @return deadline + */ + @jakarta.annotation.Nonnull + @NotNull + public String getDeadline() { + return deadline; + } + + public void setDeadline(@jakarta.annotation.Nonnull String deadline) { + this.deadline = deadline; + } + + public B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2Authorization witness( + @jakarta.annotation.Nonnull + B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationWitness + witness) { + this.witness = witness; + return this; + } + + /** + * Get witness + * + * @return witness + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationWitness getWitness() { + return witness; + } + + public void setWitness( + @jakarta.annotation.Nonnull + B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationWitness + witness) { + this.witness = witness; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2Authorization + b402SettleRequestV2AllOfPaymentPayloadPayloadPermit2Authorization = + (B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2Authorization) o; + return Objects.equals( + this.permitted, + b402SettleRequestV2AllOfPaymentPayloadPayloadPermit2Authorization.permitted) + && Objects.equals( + this.from, + b402SettleRequestV2AllOfPaymentPayloadPayloadPermit2Authorization.from) + && Objects.equals( + this.spender, + b402SettleRequestV2AllOfPaymentPayloadPayloadPermit2Authorization.spender) + && Objects.equals( + this.nonce, + b402SettleRequestV2AllOfPaymentPayloadPayloadPermit2Authorization.nonce) + && Objects.equals( + this.deadline, + b402SettleRequestV2AllOfPaymentPayloadPayloadPermit2Authorization.deadline) + && Objects.equals( + this.witness, + b402SettleRequestV2AllOfPaymentPayloadPayloadPermit2Authorization.witness); + } + + @Override + public int hashCode() { + return Objects.hash(permitted, from, spender, nonce, deadline, witness); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2Authorization {\n"); + sb.append(" permitted: ").append(toIndentedString(permitted)).append("\n"); + sb.append(" from: ").append(toIndentedString(from)).append("\n"); + sb.append(" spender: ").append(toIndentedString(spender)).append("\n"); + sb.append(" nonce: ").append(toIndentedString(nonce)).append("\n"); + sb.append(" deadline: ").append(toIndentedString(deadline)).append("\n"); + sb.append(" witness: ").append(toIndentedString(witness)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object permittedValue = getPermitted(); + String permittedValueAsString = ""; + permittedValueAsString = permittedValue.toString(); + sb.append("permitted=").append(urlEncode(permittedValueAsString)).append(""); + Object fromValue = getFrom(); + String fromValueAsString = ""; + fromValueAsString = fromValue.toString(); + sb.append("from=").append(urlEncode(fromValueAsString)).append(""); + Object spenderValue = getSpender(); + String spenderValueAsString = ""; + spenderValueAsString = spenderValue.toString(); + sb.append("spender=").append(urlEncode(spenderValueAsString)).append(""); + Object nonceValue = getNonce(); + String nonceValueAsString = ""; + nonceValueAsString = nonceValue.toString(); + sb.append("nonce=").append(urlEncode(nonceValueAsString)).append(""); + Object deadlineValue = getDeadline(); + String deadlineValueAsString = ""; + deadlineValueAsString = deadlineValue.toString(); + sb.append("deadline=").append(urlEncode(deadlineValueAsString)).append(""); + Object witnessValue = getWitness(); + String witnessValueAsString = ""; + witnessValueAsString = witnessValue.toString(); + sb.append("witness=").append(urlEncode(witnessValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("permitted"); + openapiFields.add("from"); + openapiFields.add("spender"); + openapiFields.add("nonce"); + openapiFields.add("deadline"); + openapiFields.add("witness"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("permitted"); + openapiRequiredFields.add("from"); + openapiRequiredFields.add("spender"); + openapiRequiredFields.add("nonce"); + openapiRequiredFields.add("deadline"); + openapiRequiredFields.add("witness"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2Authorization + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2Authorization + .openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2Authorization" + + " is not found in the empty JSON string", + B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2Authorization + .openapiRequiredFields + .toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : + B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2Authorization + .openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `permitted` + B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationPermitted + .validateJsonElement(jsonObj.get("permitted")); + if (!jsonObj.get("from").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `from` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("from").toString())); + } + if (!jsonObj.get("spender").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `spender` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("spender").toString())); + } + if (!jsonObj.get("nonce").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `nonce` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("nonce").toString())); + } + if (!jsonObj.get("deadline").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `deadline` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("deadline").toString())); + } + // validate the required field `witness` + B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationWitness + .validateJsonElement(jsonObj.get("witness")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2Authorization.class + .isAssignableFrom(type.getRawType())) { + return null; // this class only serializes + // 'B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2Authorization' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter + thisAdapter = + gson.getDelegateAdapter( + this, + TypeToken.get( + B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2Authorization + .class)); + + return (TypeAdapter) + new TypeAdapter< + B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2Authorization>() { + @Override + public void write( + JsonWriter out, + B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2Authorization + value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2Authorization + read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2Authorization given + * an JSON string + * + * @param jsonString JSON string + * @return An instance of B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2Authorization + * @throws IOException if the JSON string is invalid with respect to + * B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2Authorization + */ + public static B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2Authorization fromJson( + String jsonString) throws IOException { + return JSON.getGson() + .fromJson( + jsonString, + B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2Authorization.class); + } + + /** + * Convert an instance of B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2Authorization to + * an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationPermitted.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationPermitted.java new file mode 100644 index 0000000..d5e508b --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationPermitted.java @@ -0,0 +1,307 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationPermitted */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationPermitted { + public static final String SERIALIZED_NAME_TOKEN = "token"; + + @SerializedName(SERIALIZED_NAME_TOKEN) + @jakarta.annotation.Nonnull + private String token; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + + @SerializedName(SERIALIZED_NAME_AMOUNT) + @jakarta.annotation.Nonnull + private String amount; + + public B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationPermitted() {} + + public B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationPermitted token( + @jakarta.annotation.Nonnull String token) { + this.token = token; + return this; + } + + /** + * Get token + * + * @return token + */ + @jakarta.annotation.Nonnull + @NotNull + public String getToken() { + return token; + } + + public void setToken(@jakarta.annotation.Nonnull String token) { + this.token = token; + } + + public B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationPermitted amount( + @jakarta.annotation.Nonnull String amount) { + this.amount = amount; + return this; + } + + /** + * Get amount + * + * @return amount + */ + @jakarta.annotation.Nonnull + @NotNull + public String getAmount() { + return amount; + } + + public void setAmount(@jakarta.annotation.Nonnull String amount) { + this.amount = amount; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationPermitted + b402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationPermitted = + (B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationPermitted) + o; + return Objects.equals( + this.token, + b402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationPermitted + .token) + && Objects.equals( + this.amount, + b402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationPermitted + .amount); + } + + @Override + public int hashCode() { + return Objects.hash(token, amount); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append( + "class B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationPermitted" + + " {\n"); + sb.append(" token: ").append(toIndentedString(token)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object tokenValue = getToken(); + String tokenValueAsString = ""; + tokenValueAsString = tokenValue.toString(); + sb.append("token=").append(urlEncode(tokenValueAsString)).append(""); + Object amountValue = getAmount(); + String amountValueAsString = ""; + amountValueAsString = amountValue.toString(); + sb.append("amount=").append(urlEncode(amountValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("token"); + openapiFields.add("amount"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("token"); + openapiRequiredFields.add("amount"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationPermitted + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationPermitted + .openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationPermitted" + + " is not found in the empty JSON string", + B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationPermitted + .openapiRequiredFields + .toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : + B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationPermitted + .openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("token").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `token` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("token").toString())); + } + if (!jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `amount` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("amount").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationPermitted.class + .isAssignableFrom(type.getRawType())) { + return null; // this class only serializes + // 'B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationPermitted' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter< + B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationPermitted> + thisAdapter = + gson.getDelegateAdapter( + this, + TypeToken.get( + B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationPermitted + .class)); + + return (TypeAdapter) + new TypeAdapter< + B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationPermitted>() { + @Override + public void write( + JsonWriter out, + B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationPermitted + value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public + B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationPermitted + read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of + * B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationPermitted given an JSON + * string + * + * @param jsonString JSON string + * @return An instance of + * B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationPermitted + * @throws IOException if the JSON string is invalid with respect to + * B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationPermitted + */ + public static B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationPermitted + fromJson(String jsonString) throws IOException { + return JSON.getGson() + .fromJson( + jsonString, + B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationPermitted + .class); + } + + /** + * Convert an instance of + * B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationPermitted to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationWitness.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationWitness.java new file mode 100644 index 0000000..2794c0c --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationWitness.java @@ -0,0 +1,367 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationWitness */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationWitness { + public static final String SERIALIZED_NAME_TO = "to"; + + @SerializedName(SERIALIZED_NAME_TO) + @jakarta.annotation.Nonnull + private String to; + + public static final String SERIALIZED_NAME_FACILITATOR = "facilitator"; + + @SerializedName(SERIALIZED_NAME_FACILITATOR) + @jakarta.annotation.Nullable + private String facilitator; + + public static final String SERIALIZED_NAME_VALID_AFTER = "validAfter"; + + @SerializedName(SERIALIZED_NAME_VALID_AFTER) + @jakarta.annotation.Nonnull + private String validAfter; + + public B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationWitness() {} + + public B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationWitness to( + @jakarta.annotation.Nonnull String to) { + this.to = to; + return this; + } + + /** + * Get to + * + * @return to + */ + @jakarta.annotation.Nonnull + @NotNull + public String getTo() { + return to; + } + + public void setTo(@jakarta.annotation.Nonnull String to) { + this.to = to; + } + + public B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationWitness facilitator( + @jakarta.annotation.Nullable String facilitator) { + this.facilitator = facilitator; + return this; + } + + /** + * Get facilitator + * + * @return facilitator + */ + @jakarta.annotation.Nullable + public String getFacilitator() { + return facilitator; + } + + public void setFacilitator(@jakarta.annotation.Nullable String facilitator) { + this.facilitator = facilitator; + } + + public B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationWitness validAfter( + @jakarta.annotation.Nonnull String validAfter) { + this.validAfter = validAfter; + return this; + } + + /** + * Get validAfter + * + * @return validAfter + */ + @jakarta.annotation.Nonnull + @NotNull + public String getValidAfter() { + return validAfter; + } + + public void setValidAfter(@jakarta.annotation.Nonnull String validAfter) { + this.validAfter = validAfter; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationWitness + b402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationWitness = + (B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationWitness) + o; + return Objects.equals( + this.to, + b402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationWitness.to) + && Objects.equals( + this.facilitator, + b402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationWitness + .facilitator) + && Objects.equals( + this.validAfter, + b402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationWitness + .validAfter); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(to, facilitator, validAfter); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append( + "class B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationWitness" + + " {\n"); + sb.append(" to: ").append(toIndentedString(to)).append("\n"); + sb.append(" facilitator: ").append(toIndentedString(facilitator)).append("\n"); + sb.append(" validAfter: ").append(toIndentedString(validAfter)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object toValue = getTo(); + String toValueAsString = ""; + toValueAsString = toValue.toString(); + sb.append("to=").append(urlEncode(toValueAsString)).append(""); + Object facilitatorValue = getFacilitator(); + String facilitatorValueAsString = ""; + facilitatorValueAsString = facilitatorValue.toString(); + sb.append("facilitator=").append(urlEncode(facilitatorValueAsString)).append(""); + Object validAfterValue = getValidAfter(); + String validAfterValueAsString = ""; + validAfterValueAsString = validAfterValue.toString(); + sb.append("validAfter=").append(urlEncode(validAfterValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("to"); + openapiFields.add("facilitator"); + openapiFields.add("validAfter"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("to"); + openapiRequiredFields.add("validAfter"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationWitness + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationWitness + .openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationWitness" + + " is not found in the empty JSON string", + B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationWitness + .openapiRequiredFields + .toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : + B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationWitness + .openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("to").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `to` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("to").toString())); + } + if ((jsonObj.get("facilitator") != null && !jsonObj.get("facilitator").isJsonNull()) + && !jsonObj.get("facilitator").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `facilitator` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("facilitator").toString())); + } + if (!jsonObj.get("validAfter").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `validAfter` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("validAfter").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationWitness.class + .isAssignableFrom(type.getRawType())) { + return null; // this class only serializes + // 'B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationWitness' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter< + B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationWitness> + thisAdapter = + gson.getDelegateAdapter( + this, + TypeToken.get( + B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationWitness + .class)); + + return (TypeAdapter) + new TypeAdapter< + B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationWitness>() { + @Override + public void write( + JsonWriter out, + B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationWitness + value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public + B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationWitness + read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of + * B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationWitness given an JSON string + * + * @param jsonString JSON string + * @return An instance of + * B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationWitness + * @throws IOException if the JSON string is invalid with respect to + * B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationWitness + */ + public static B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationWitness fromJson( + String jsonString) throws IOException { + return JSON.getGson() + .fromJson( + jsonString, + B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationWitness + .class); + } + + /** + * Convert an instance of + * B402SettleRequestV2AllOfPaymentPayloadPayloadPermit2AuthorizationWitness to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SettleRequestV2AllOfPaymentPayloadResource.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SettleRequestV2AllOfPaymentPayloadResource.java new file mode 100644 index 0000000..c514bf2 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SettleRequestV2AllOfPaymentPayloadResource.java @@ -0,0 +1,325 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URI; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** B402SettleRequestV2AllOfPaymentPayloadResource */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402SettleRequestV2AllOfPaymentPayloadResource { + public static final String SERIALIZED_NAME_URL = "url"; + + @SerializedName(SERIALIZED_NAME_URL) + @jakarta.annotation.Nonnull + private URI url; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @jakarta.annotation.Nullable + private String description; + + public static final String SERIALIZED_NAME_MIME_TYPE = "mimeType"; + + @SerializedName(SERIALIZED_NAME_MIME_TYPE) + @jakarta.annotation.Nullable + private String mimeType; + + public B402SettleRequestV2AllOfPaymentPayloadResource() {} + + public B402SettleRequestV2AllOfPaymentPayloadResource url(@jakarta.annotation.Nonnull URI url) { + this.url = url; + return this; + } + + /** + * Get url + * + * @return url + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public URI getUrl() { + return url; + } + + public void setUrl(@jakarta.annotation.Nonnull URI url) { + this.url = url; + } + + public B402SettleRequestV2AllOfPaymentPayloadResource description( + @jakarta.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Get description + * + * @return description + */ + @jakarta.annotation.Nullable + public String getDescription() { + return description; + } + + public void setDescription(@jakarta.annotation.Nullable String description) { + this.description = description; + } + + public B402SettleRequestV2AllOfPaymentPayloadResource mimeType( + @jakarta.annotation.Nullable String mimeType) { + this.mimeType = mimeType; + return this; + } + + /** + * Get mimeType + * + * @return mimeType + */ + @jakarta.annotation.Nullable + public String getMimeType() { + return mimeType; + } + + public void setMimeType(@jakarta.annotation.Nullable String mimeType) { + this.mimeType = mimeType; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402SettleRequestV2AllOfPaymentPayloadResource + b402SettleRequestV2AllOfPaymentPayloadResource = + (B402SettleRequestV2AllOfPaymentPayloadResource) o; + return Objects.equals(this.url, b402SettleRequestV2AllOfPaymentPayloadResource.url) + && Objects.equals( + this.description, + b402SettleRequestV2AllOfPaymentPayloadResource.description) + && Objects.equals( + this.mimeType, b402SettleRequestV2AllOfPaymentPayloadResource.mimeType); + } + + @Override + public int hashCode() { + return Objects.hash(url, description, mimeType); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402SettleRequestV2AllOfPaymentPayloadResource {\n"); + sb.append(" url: ").append(toIndentedString(url)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" mimeType: ").append(toIndentedString(mimeType)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object urlValue = getUrl(); + String urlValueAsString = ""; + urlValueAsString = urlValue.toString(); + sb.append("url=").append(urlEncode(urlValueAsString)).append(""); + Object descriptionValue = getDescription(); + String descriptionValueAsString = ""; + descriptionValueAsString = descriptionValue.toString(); + sb.append("description=").append(urlEncode(descriptionValueAsString)).append(""); + Object mimeTypeValue = getMimeType(); + String mimeTypeValueAsString = ""; + mimeTypeValueAsString = mimeTypeValue.toString(); + sb.append("mimeType=").append(urlEncode(mimeTypeValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("url"); + openapiFields.add("description"); + openapiFields.add("mimeType"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("url"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * B402SettleRequestV2AllOfPaymentPayloadResource + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402SettleRequestV2AllOfPaymentPayloadResource.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " B402SettleRequestV2AllOfPaymentPayloadResource is not found" + + " in the empty JSON string", + B402SettleRequestV2AllOfPaymentPayloadResource.openapiRequiredFields + .toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : + B402SettleRequestV2AllOfPaymentPayloadResource.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("url").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `url` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("url").toString())); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) + && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `description` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("description").toString())); + } + if ((jsonObj.get("mimeType") != null && !jsonObj.get("mimeType").isJsonNull()) + && !jsonObj.get("mimeType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `mimeType` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("mimeType").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402SettleRequestV2AllOfPaymentPayloadResource.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'B402SettleRequestV2AllOfPaymentPayloadResource' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, + TypeToken.get(B402SettleRequestV2AllOfPaymentPayloadResource.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, + B402SettleRequestV2AllOfPaymentPayloadResource value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402SettleRequestV2AllOfPaymentPayloadResource read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402SettleRequestV2AllOfPaymentPayloadResource given an JSON string + * + * @param jsonString JSON string + * @return An instance of B402SettleRequestV2AllOfPaymentPayloadResource + * @throws IOException if the JSON string is invalid with respect to + * B402SettleRequestV2AllOfPaymentPayloadResource + */ + public static B402SettleRequestV2AllOfPaymentPayloadResource fromJson(String jsonString) + throws IOException { + return JSON.getGson() + .fromJson(jsonString, B402SettleRequestV2AllOfPaymentPayloadResource.class); + } + + /** + * Convert an instance of B402SettleRequestV2AllOfPaymentPayloadResource to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SettleResponseV1.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SettleResponseV1.java new file mode 100644 index 0000000..c4ee7e8 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SettleResponseV1.java @@ -0,0 +1,450 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** B402SettleResponseV1 */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402SettleResponseV1 { + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + @jakarta.annotation.Nullable + private String status; + + public static final String SERIALIZED_NAME_TYPE = "type"; + + @SerializedName(SERIALIZED_NAME_TYPE) + @jakarta.annotation.Nullable + private String type; + + public static final String SERIALIZED_NAME_CODE = "code"; + + @SerializedName(SERIALIZED_NAME_CODE) + @jakarta.annotation.Nullable + private String code; + + public static final String SERIALIZED_NAME_ERROR_DATA = "errorData"; + + @SerializedName(SERIALIZED_NAME_ERROR_DATA) + @jakarta.annotation.Nullable + private String errorData; + + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + @jakarta.annotation.Nullable + private B402SettleResponseV1Data data; + + public static final String SERIALIZED_NAME_SUB_DATA = "subData"; + + @SerializedName(SERIALIZED_NAME_SUB_DATA) + @jakarta.annotation.Nullable + private Object subData; + + public static final String SERIALIZED_NAME_PARAMS = "params"; + + @SerializedName(SERIALIZED_NAME_PARAMS) + @jakarta.annotation.Nullable + private Object params; + + public B402SettleResponseV1() {} + + public B402SettleResponseV1 status(@jakarta.annotation.Nullable String status) { + this.status = status; + return this; + } + + /** + * Get status + * + * @return status + */ + @jakarta.annotation.Nullable + public String getStatus() { + return status; + } + + public void setStatus(@jakarta.annotation.Nullable String status) { + this.status = status; + } + + public B402SettleResponseV1 type(@jakarta.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * + * @return type + */ + @jakarta.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@jakarta.annotation.Nullable String type) { + this.type = type; + } + + public B402SettleResponseV1 code(@jakarta.annotation.Nullable String code) { + this.code = code; + return this; + } + + /** + * Get code + * + * @return code + */ + @jakarta.annotation.Nullable + public String getCode() { + return code; + } + + public void setCode(@jakarta.annotation.Nullable String code) { + this.code = code; + } + + public B402SettleResponseV1 errorData(@jakarta.annotation.Nullable String errorData) { + this.errorData = errorData; + return this; + } + + /** + * Get errorData + * + * @return errorData + */ + @jakarta.annotation.Nullable + public String getErrorData() { + return errorData; + } + + public void setErrorData(@jakarta.annotation.Nullable String errorData) { + this.errorData = errorData; + } + + public B402SettleResponseV1 data(@jakarta.annotation.Nullable B402SettleResponseV1Data data) { + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @jakarta.annotation.Nullable + @Valid + public B402SettleResponseV1Data getData() { + return data; + } + + public void setData(@jakarta.annotation.Nullable B402SettleResponseV1Data data) { + this.data = data; + } + + public B402SettleResponseV1 subData(@jakarta.annotation.Nullable Object subData) { + this.subData = subData; + return this; + } + + /** + * Get subData + * + * @return subData + */ + @jakarta.annotation.Nullable + public Object getSubData() { + return subData; + } + + public void setSubData(@jakarta.annotation.Nullable Object subData) { + this.subData = subData; + } + + public B402SettleResponseV1 params(@jakarta.annotation.Nullable Object params) { + this.params = params; + return this; + } + + /** + * Get params + * + * @return params + */ + @jakarta.annotation.Nullable + public Object getParams() { + return params; + } + + public void setParams(@jakarta.annotation.Nullable Object params) { + this.params = params; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402SettleResponseV1 b402SettleResponseV1 = (B402SettleResponseV1) o; + return Objects.equals(this.status, b402SettleResponseV1.status) + && Objects.equals(this.type, b402SettleResponseV1.type) + && Objects.equals(this.code, b402SettleResponseV1.code) + && Objects.equals(this.errorData, b402SettleResponseV1.errorData) + && Objects.equals(this.data, b402SettleResponseV1.data) + && Objects.equals(this.subData, b402SettleResponseV1.subData) + && Objects.equals(this.params, b402SettleResponseV1.params); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(status, type, code, errorData, data, subData, params); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402SettleResponseV1 {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" errorData: ").append(toIndentedString(errorData)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" subData: ").append(toIndentedString(subData)).append("\n"); + sb.append(" params: ").append(toIndentedString(params)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object statusValue = getStatus(); + String statusValueAsString = ""; + statusValueAsString = statusValue.toString(); + sb.append("status=").append(urlEncode(statusValueAsString)).append(""); + Object typeValue = getType(); + String typeValueAsString = ""; + typeValueAsString = typeValue.toString(); + sb.append("type=").append(urlEncode(typeValueAsString)).append(""); + Object codeValue = getCode(); + String codeValueAsString = ""; + codeValueAsString = codeValue.toString(); + sb.append("code=").append(urlEncode(codeValueAsString)).append(""); + Object errorDataValue = getErrorData(); + String errorDataValueAsString = ""; + errorDataValueAsString = errorDataValue.toString(); + sb.append("errorData=").append(urlEncode(errorDataValueAsString)).append(""); + Object dataValue = getData(); + String dataValueAsString = ""; + dataValueAsString = dataValue.toString(); + sb.append("data=").append(urlEncode(dataValueAsString)).append(""); + Object subDataValue = getSubData(); + String subDataValueAsString = ""; + subDataValueAsString = subDataValue.toString(); + sb.append("subData=").append(urlEncode(subDataValueAsString)).append(""); + Object paramsValue = getParams(); + String paramsValueAsString = ""; + paramsValueAsString = paramsValue.toString(); + sb.append("params=").append(urlEncode(paramsValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("status"); + openapiFields.add("type"); + openapiFields.add("code"); + openapiFields.add("errorData"); + openapiFields.add("data"); + openapiFields.add("subData"); + openapiFields.add("params"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to B402SettleResponseV1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402SettleResponseV1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in B402SettleResponseV1 is not found in" + + " the empty JSON string", + B402SettleResponseV1.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) + && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `status` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("status").toString())); + } + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) + && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `type` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("type").toString())); + } + if ((jsonObj.get("code") != null && !jsonObj.get("code").isJsonNull()) + && !jsonObj.get("code").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `code` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("code").toString())); + } + if ((jsonObj.get("errorData") != null && !jsonObj.get("errorData").isJsonNull()) + && !jsonObj.get("errorData").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `errorData` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("errorData").toString())); + } + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + B402SettleResponseV1Data.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402SettleResponseV1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'B402SettleResponseV1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(B402SettleResponseV1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, B402SettleResponseV1 value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402SettleResponseV1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402SettleResponseV1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of B402SettleResponseV1 + * @throws IOException if the JSON string is invalid with respect to B402SettleResponseV1 + */ + public static B402SettleResponseV1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, B402SettleResponseV1.class); + } + + /** + * Convert an instance of B402SettleResponseV1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SettleResponseV1Data.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SettleResponseV1Data.java new file mode 100644 index 0000000..36cadae --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SettleResponseV1Data.java @@ -0,0 +1,514 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** B402SettleResponseV1Data */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402SettleResponseV1Data { + public static final String SERIALIZED_NAME_SUCCESS = "success"; + + @SerializedName(SERIALIZED_NAME_SUCCESS) + @jakarta.annotation.Nonnull + private Boolean success; + + public static final String SERIALIZED_NAME_TRANSACTION = "transaction"; + + @SerializedName(SERIALIZED_NAME_TRANSACTION) + @jakarta.annotation.Nullable + private String transaction; + + public static final String SERIALIZED_NAME_PAYER = "payer"; + + @SerializedName(SERIALIZED_NAME_PAYER) + @jakarta.annotation.Nullable + private String payer; + + public static final String SERIALIZED_NAME_NETWORK = "network"; + + @SerializedName(SERIALIZED_NAME_NETWORK) + @jakarta.annotation.Nullable + private String network; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + + @SerializedName(SERIALIZED_NAME_AMOUNT) + @jakarta.annotation.Nullable + private String amount; + + public static final String SERIALIZED_NAME_CONFIRMATIONS = "confirmations"; + + @SerializedName(SERIALIZED_NAME_CONFIRMATIONS) + @jakarta.annotation.Nullable + private Integer confirmations; + + public static final String SERIALIZED_NAME_ERROR_REASON = "errorReason"; + + @SerializedName(SERIALIZED_NAME_ERROR_REASON) + @jakarta.annotation.Nullable + private String errorReason; + + public static final String SERIALIZED_NAME_ERROR_MESSAGE = "errorMessage"; + + @SerializedName(SERIALIZED_NAME_ERROR_MESSAGE) + @jakarta.annotation.Nullable + private String errorMessage; + + public B402SettleResponseV1Data() {} + + public B402SettleResponseV1Data success(@jakarta.annotation.Nonnull Boolean success) { + this.success = success; + return this; + } + + /** + * Get success + * + * @return success + */ + @jakarta.annotation.Nonnull + @NotNull + public Boolean getSuccess() { + return success; + } + + public void setSuccess(@jakarta.annotation.Nonnull Boolean success) { + this.success = success; + } + + public B402SettleResponseV1Data transaction(@jakarta.annotation.Nullable String transaction) { + this.transaction = transaction; + return this; + } + + /** + * Get transaction + * + * @return transaction + */ + @jakarta.annotation.Nullable + public String getTransaction() { + return transaction; + } + + public void setTransaction(@jakarta.annotation.Nullable String transaction) { + this.transaction = transaction; + } + + public B402SettleResponseV1Data payer(@jakarta.annotation.Nullable String payer) { + this.payer = payer; + return this; + } + + /** + * Get payer + * + * @return payer + */ + @jakarta.annotation.Nullable + public String getPayer() { + return payer; + } + + public void setPayer(@jakarta.annotation.Nullable String payer) { + this.payer = payer; + } + + public B402SettleResponseV1Data network(@jakarta.annotation.Nullable String network) { + this.network = network; + return this; + } + + /** + * Get network + * + * @return network + */ + @jakarta.annotation.Nullable + public String getNetwork() { + return network; + } + + public void setNetwork(@jakarta.annotation.Nullable String network) { + this.network = network; + } + + public B402SettleResponseV1Data amount(@jakarta.annotation.Nullable String amount) { + this.amount = amount; + return this; + } + + /** + * Get amount + * + * @return amount + */ + @jakarta.annotation.Nullable + public String getAmount() { + return amount; + } + + public void setAmount(@jakarta.annotation.Nullable String amount) { + this.amount = amount; + } + + public B402SettleResponseV1Data confirmations( + @jakarta.annotation.Nullable Integer confirmations) { + this.confirmations = confirmations; + return this; + } + + /** + * Get confirmations + * + * @return confirmations + */ + @jakarta.annotation.Nullable + public Integer getConfirmations() { + return confirmations; + } + + public void setConfirmations(@jakarta.annotation.Nullable Integer confirmations) { + this.confirmations = confirmations; + } + + public B402SettleResponseV1Data errorReason(@jakarta.annotation.Nullable String errorReason) { + this.errorReason = errorReason; + return this; + } + + /** + * Get errorReason + * + * @return errorReason + */ + @jakarta.annotation.Nullable + public String getErrorReason() { + return errorReason; + } + + public void setErrorReason(@jakarta.annotation.Nullable String errorReason) { + this.errorReason = errorReason; + } + + public B402SettleResponseV1Data errorMessage(@jakarta.annotation.Nullable String errorMessage) { + this.errorMessage = errorMessage; + return this; + } + + /** + * Get errorMessage + * + * @return errorMessage + */ + @jakarta.annotation.Nullable + public String getErrorMessage() { + return errorMessage; + } + + public void setErrorMessage(@jakarta.annotation.Nullable String errorMessage) { + this.errorMessage = errorMessage; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402SettleResponseV1Data b402SettleResponseV1Data = (B402SettleResponseV1Data) o; + return Objects.equals(this.success, b402SettleResponseV1Data.success) + && Objects.equals(this.transaction, b402SettleResponseV1Data.transaction) + && Objects.equals(this.payer, b402SettleResponseV1Data.payer) + && Objects.equals(this.network, b402SettleResponseV1Data.network) + && Objects.equals(this.amount, b402SettleResponseV1Data.amount) + && Objects.equals(this.confirmations, b402SettleResponseV1Data.confirmations) + && Objects.equals(this.errorReason, b402SettleResponseV1Data.errorReason) + && Objects.equals(this.errorMessage, b402SettleResponseV1Data.errorMessage); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash( + success, + transaction, + payer, + network, + amount, + confirmations, + errorReason, + errorMessage); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402SettleResponseV1Data {\n"); + sb.append(" success: ").append(toIndentedString(success)).append("\n"); + sb.append(" transaction: ").append(toIndentedString(transaction)).append("\n"); + sb.append(" payer: ").append(toIndentedString(payer)).append("\n"); + sb.append(" network: ").append(toIndentedString(network)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" confirmations: ").append(toIndentedString(confirmations)).append("\n"); + sb.append(" errorReason: ").append(toIndentedString(errorReason)).append("\n"); + sb.append(" errorMessage: ").append(toIndentedString(errorMessage)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object successValue = getSuccess(); + String successValueAsString = ""; + successValueAsString = successValue.toString(); + sb.append("success=").append(urlEncode(successValueAsString)).append(""); + Object transactionValue = getTransaction(); + String transactionValueAsString = ""; + transactionValueAsString = transactionValue.toString(); + sb.append("transaction=").append(urlEncode(transactionValueAsString)).append(""); + Object payerValue = getPayer(); + String payerValueAsString = ""; + payerValueAsString = payerValue.toString(); + sb.append("payer=").append(urlEncode(payerValueAsString)).append(""); + Object networkValue = getNetwork(); + String networkValueAsString = ""; + networkValueAsString = networkValue.toString(); + sb.append("network=").append(urlEncode(networkValueAsString)).append(""); + Object amountValue = getAmount(); + String amountValueAsString = ""; + amountValueAsString = amountValue.toString(); + sb.append("amount=").append(urlEncode(amountValueAsString)).append(""); + Object confirmationsValue = getConfirmations(); + String confirmationsValueAsString = ""; + confirmationsValueAsString = confirmationsValue.toString(); + sb.append("confirmations=").append(urlEncode(confirmationsValueAsString)).append(""); + Object errorReasonValue = getErrorReason(); + String errorReasonValueAsString = ""; + errorReasonValueAsString = errorReasonValue.toString(); + sb.append("errorReason=").append(urlEncode(errorReasonValueAsString)).append(""); + Object errorMessageValue = getErrorMessage(); + String errorMessageValueAsString = ""; + errorMessageValueAsString = errorMessageValue.toString(); + sb.append("errorMessage=").append(urlEncode(errorMessageValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("success"); + openapiFields.add("transaction"); + openapiFields.add("payer"); + openapiFields.add("network"); + openapiFields.add("amount"); + openapiFields.add("confirmations"); + openapiFields.add("errorReason"); + openapiFields.add("errorMessage"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("success"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to B402SettleResponseV1Data + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402SettleResponseV1Data.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in B402SettleResponseV1Data is not found" + + " in the empty JSON string", + B402SettleResponseV1Data.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : B402SettleResponseV1Data.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("transaction") != null && !jsonObj.get("transaction").isJsonNull()) + && !jsonObj.get("transaction").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `transaction` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("transaction").toString())); + } + if ((jsonObj.get("payer") != null && !jsonObj.get("payer").isJsonNull()) + && !jsonObj.get("payer").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `payer` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("payer").toString())); + } + if ((jsonObj.get("network") != null && !jsonObj.get("network").isJsonNull()) + && !jsonObj.get("network").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `network` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("network").toString())); + } + if ((jsonObj.get("amount") != null && !jsonObj.get("amount").isJsonNull()) + && !jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `amount` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("amount").toString())); + } + if ((jsonObj.get("errorReason") != null && !jsonObj.get("errorReason").isJsonNull()) + && !jsonObj.get("errorReason").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `errorReason` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("errorReason").toString())); + } + if ((jsonObj.get("errorMessage") != null && !jsonObj.get("errorMessage").isJsonNull()) + && !jsonObj.get("errorMessage").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `errorMessage` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("errorMessage").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402SettleResponseV1Data.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'B402SettleResponseV1Data' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(B402SettleResponseV1Data.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, B402SettleResponseV1Data value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402SettleResponseV1Data read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402SettleResponseV1Data given an JSON string + * + * @param jsonString JSON string + * @return An instance of B402SettleResponseV1Data + * @throws IOException if the JSON string is invalid with respect to B402SettleResponseV1Data + */ + public static B402SettleResponseV1Data fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, B402SettleResponseV1Data.class); + } + + /** + * Convert an instance of B402SettleResponseV1Data to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SettleResponseV2.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SettleResponseV2.java new file mode 100644 index 0000000..fb8db52 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SettleResponseV2.java @@ -0,0 +1,450 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** B402SettleResponseV2 */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402SettleResponseV2 { + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + @jakarta.annotation.Nullable + private String status; + + public static final String SERIALIZED_NAME_TYPE = "type"; + + @SerializedName(SERIALIZED_NAME_TYPE) + @jakarta.annotation.Nullable + private String type; + + public static final String SERIALIZED_NAME_CODE = "code"; + + @SerializedName(SERIALIZED_NAME_CODE) + @jakarta.annotation.Nullable + private String code; + + public static final String SERIALIZED_NAME_ERROR_DATA = "errorData"; + + @SerializedName(SERIALIZED_NAME_ERROR_DATA) + @jakarta.annotation.Nullable + private String errorData; + + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + @jakarta.annotation.Nullable + private B402SettleResponseV2Data data; + + public static final String SERIALIZED_NAME_SUB_DATA = "subData"; + + @SerializedName(SERIALIZED_NAME_SUB_DATA) + @jakarta.annotation.Nullable + private Object subData; + + public static final String SERIALIZED_NAME_PARAMS = "params"; + + @SerializedName(SERIALIZED_NAME_PARAMS) + @jakarta.annotation.Nullable + private Object params; + + public B402SettleResponseV2() {} + + public B402SettleResponseV2 status(@jakarta.annotation.Nullable String status) { + this.status = status; + return this; + } + + /** + * Get status + * + * @return status + */ + @jakarta.annotation.Nullable + public String getStatus() { + return status; + } + + public void setStatus(@jakarta.annotation.Nullable String status) { + this.status = status; + } + + public B402SettleResponseV2 type(@jakarta.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * + * @return type + */ + @jakarta.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@jakarta.annotation.Nullable String type) { + this.type = type; + } + + public B402SettleResponseV2 code(@jakarta.annotation.Nullable String code) { + this.code = code; + return this; + } + + /** + * Get code + * + * @return code + */ + @jakarta.annotation.Nullable + public String getCode() { + return code; + } + + public void setCode(@jakarta.annotation.Nullable String code) { + this.code = code; + } + + public B402SettleResponseV2 errorData(@jakarta.annotation.Nullable String errorData) { + this.errorData = errorData; + return this; + } + + /** + * Get errorData + * + * @return errorData + */ + @jakarta.annotation.Nullable + public String getErrorData() { + return errorData; + } + + public void setErrorData(@jakarta.annotation.Nullable String errorData) { + this.errorData = errorData; + } + + public B402SettleResponseV2 data(@jakarta.annotation.Nullable B402SettleResponseV2Data data) { + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @jakarta.annotation.Nullable + @Valid + public B402SettleResponseV2Data getData() { + return data; + } + + public void setData(@jakarta.annotation.Nullable B402SettleResponseV2Data data) { + this.data = data; + } + + public B402SettleResponseV2 subData(@jakarta.annotation.Nullable Object subData) { + this.subData = subData; + return this; + } + + /** + * Get subData + * + * @return subData + */ + @jakarta.annotation.Nullable + public Object getSubData() { + return subData; + } + + public void setSubData(@jakarta.annotation.Nullable Object subData) { + this.subData = subData; + } + + public B402SettleResponseV2 params(@jakarta.annotation.Nullable Object params) { + this.params = params; + return this; + } + + /** + * Get params + * + * @return params + */ + @jakarta.annotation.Nullable + public Object getParams() { + return params; + } + + public void setParams(@jakarta.annotation.Nullable Object params) { + this.params = params; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402SettleResponseV2 b402SettleResponseV2 = (B402SettleResponseV2) o; + return Objects.equals(this.status, b402SettleResponseV2.status) + && Objects.equals(this.type, b402SettleResponseV2.type) + && Objects.equals(this.code, b402SettleResponseV2.code) + && Objects.equals(this.errorData, b402SettleResponseV2.errorData) + && Objects.equals(this.data, b402SettleResponseV2.data) + && Objects.equals(this.subData, b402SettleResponseV2.subData) + && Objects.equals(this.params, b402SettleResponseV2.params); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(status, type, code, errorData, data, subData, params); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402SettleResponseV2 {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" errorData: ").append(toIndentedString(errorData)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" subData: ").append(toIndentedString(subData)).append("\n"); + sb.append(" params: ").append(toIndentedString(params)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object statusValue = getStatus(); + String statusValueAsString = ""; + statusValueAsString = statusValue.toString(); + sb.append("status=").append(urlEncode(statusValueAsString)).append(""); + Object typeValue = getType(); + String typeValueAsString = ""; + typeValueAsString = typeValue.toString(); + sb.append("type=").append(urlEncode(typeValueAsString)).append(""); + Object codeValue = getCode(); + String codeValueAsString = ""; + codeValueAsString = codeValue.toString(); + sb.append("code=").append(urlEncode(codeValueAsString)).append(""); + Object errorDataValue = getErrorData(); + String errorDataValueAsString = ""; + errorDataValueAsString = errorDataValue.toString(); + sb.append("errorData=").append(urlEncode(errorDataValueAsString)).append(""); + Object dataValue = getData(); + String dataValueAsString = ""; + dataValueAsString = dataValue.toString(); + sb.append("data=").append(urlEncode(dataValueAsString)).append(""); + Object subDataValue = getSubData(); + String subDataValueAsString = ""; + subDataValueAsString = subDataValue.toString(); + sb.append("subData=").append(urlEncode(subDataValueAsString)).append(""); + Object paramsValue = getParams(); + String paramsValueAsString = ""; + paramsValueAsString = paramsValue.toString(); + sb.append("params=").append(urlEncode(paramsValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("status"); + openapiFields.add("type"); + openapiFields.add("code"); + openapiFields.add("errorData"); + openapiFields.add("data"); + openapiFields.add("subData"); + openapiFields.add("params"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to B402SettleResponseV2 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402SettleResponseV2.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in B402SettleResponseV2 is not found in" + + " the empty JSON string", + B402SettleResponseV2.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) + && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `status` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("status").toString())); + } + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) + && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `type` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("type").toString())); + } + if ((jsonObj.get("code") != null && !jsonObj.get("code").isJsonNull()) + && !jsonObj.get("code").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `code` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("code").toString())); + } + if ((jsonObj.get("errorData") != null && !jsonObj.get("errorData").isJsonNull()) + && !jsonObj.get("errorData").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `errorData` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("errorData").toString())); + } + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + B402SettleResponseV2Data.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402SettleResponseV2.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'B402SettleResponseV2' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(B402SettleResponseV2.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, B402SettleResponseV2 value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402SettleResponseV2 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402SettleResponseV2 given an JSON string + * + * @param jsonString JSON string + * @return An instance of B402SettleResponseV2 + * @throws IOException if the JSON string is invalid with respect to B402SettleResponseV2 + */ + public static B402SettleResponseV2 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, B402SettleResponseV2.class); + } + + /** + * Convert an instance of B402SettleResponseV2 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SettleResponseV2Data.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SettleResponseV2Data.java new file mode 100644 index 0000000..d2ba486 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SettleResponseV2Data.java @@ -0,0 +1,526 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** B402SettleResponseV2Data */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402SettleResponseV2Data { + public static final String SERIALIZED_NAME_SUCCESS = "success"; + + @SerializedName(SERIALIZED_NAME_SUCCESS) + @jakarta.annotation.Nonnull + private Boolean success; + + public static final String SERIALIZED_NAME_TRANSACTION = "transaction"; + + @SerializedName(SERIALIZED_NAME_TRANSACTION) + @jakarta.annotation.Nonnull + private String transaction; + + public static final String SERIALIZED_NAME_PAYER = "payer"; + + @SerializedName(SERIALIZED_NAME_PAYER) + @jakarta.annotation.Nullable + private String payer; + + public static final String SERIALIZED_NAME_NETWORK = "network"; + + @SerializedName(SERIALIZED_NAME_NETWORK) + @jakarta.annotation.Nonnull + private String network; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + + @SerializedName(SERIALIZED_NAME_AMOUNT) + @jakarta.annotation.Nullable + private String amount; + + public static final String SERIALIZED_NAME_ERROR_REASON = "errorReason"; + + @SerializedName(SERIALIZED_NAME_ERROR_REASON) + @jakarta.annotation.Nullable + private String errorReason; + + public static final String SERIALIZED_NAME_ERROR_MESSAGE = "errorMessage"; + + @SerializedName(SERIALIZED_NAME_ERROR_MESSAGE) + @jakarta.annotation.Nullable + private String errorMessage; + + public static final String SERIALIZED_NAME_EXTENSIONS = "extensions"; + + @SerializedName(SERIALIZED_NAME_EXTENSIONS) + @jakarta.annotation.Nullable + private Map extensions; + + public B402SettleResponseV2Data() {} + + public B402SettleResponseV2Data success(@jakarta.annotation.Nonnull Boolean success) { + this.success = success; + return this; + } + + /** + * Get success + * + * @return success + */ + @jakarta.annotation.Nonnull + @NotNull + public Boolean getSuccess() { + return success; + } + + public void setSuccess(@jakarta.annotation.Nonnull Boolean success) { + this.success = success; + } + + public B402SettleResponseV2Data transaction(@jakarta.annotation.Nonnull String transaction) { + this.transaction = transaction; + return this; + } + + /** + * Get transaction + * + * @return transaction + */ + @jakarta.annotation.Nonnull + @NotNull + public String getTransaction() { + return transaction; + } + + public void setTransaction(@jakarta.annotation.Nonnull String transaction) { + this.transaction = transaction; + } + + public B402SettleResponseV2Data payer(@jakarta.annotation.Nullable String payer) { + this.payer = payer; + return this; + } + + /** + * Get payer + * + * @return payer + */ + @jakarta.annotation.Nullable + public String getPayer() { + return payer; + } + + public void setPayer(@jakarta.annotation.Nullable String payer) { + this.payer = payer; + } + + public B402SettleResponseV2Data network(@jakarta.annotation.Nonnull String network) { + this.network = network; + return this; + } + + /** + * Get network + * + * @return network + */ + @jakarta.annotation.Nonnull + @NotNull + public String getNetwork() { + return network; + } + + public void setNetwork(@jakarta.annotation.Nonnull String network) { + this.network = network; + } + + public B402SettleResponseV2Data amount(@jakarta.annotation.Nullable String amount) { + this.amount = amount; + return this; + } + + /** + * Get amount + * + * @return amount + */ + @jakarta.annotation.Nullable + public String getAmount() { + return amount; + } + + public void setAmount(@jakarta.annotation.Nullable String amount) { + this.amount = amount; + } + + public B402SettleResponseV2Data errorReason(@jakarta.annotation.Nullable String errorReason) { + this.errorReason = errorReason; + return this; + } + + /** + * Get errorReason + * + * @return errorReason + */ + @jakarta.annotation.Nullable + public String getErrorReason() { + return errorReason; + } + + public void setErrorReason(@jakarta.annotation.Nullable String errorReason) { + this.errorReason = errorReason; + } + + public B402SettleResponseV2Data errorMessage(@jakarta.annotation.Nullable String errorMessage) { + this.errorMessage = errorMessage; + return this; + } + + /** + * Get errorMessage + * + * @return errorMessage + */ + @jakarta.annotation.Nullable + public String getErrorMessage() { + return errorMessage; + } + + public void setErrorMessage(@jakarta.annotation.Nullable String errorMessage) { + this.errorMessage = errorMessage; + } + + public B402SettleResponseV2Data extensions( + @jakarta.annotation.Nullable Map extensions) { + this.extensions = extensions; + return this; + } + + public B402SettleResponseV2Data putExtensionsItem(String key, Object extensionsItem) { + if (this.extensions == null) { + this.extensions = new HashMap<>(); + } + this.extensions.put(key, extensionsItem); + return this; + } + + /** + * Get extensions + * + * @return extensions + */ + @jakarta.annotation.Nullable + public Map getExtensions() { + return extensions; + } + + public void setExtensions(@jakarta.annotation.Nullable Map extensions) { + this.extensions = extensions; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402SettleResponseV2Data b402SettleResponseV2Data = (B402SettleResponseV2Data) o; + return Objects.equals(this.success, b402SettleResponseV2Data.success) + && Objects.equals(this.transaction, b402SettleResponseV2Data.transaction) + && Objects.equals(this.payer, b402SettleResponseV2Data.payer) + && Objects.equals(this.network, b402SettleResponseV2Data.network) + && Objects.equals(this.amount, b402SettleResponseV2Data.amount) + && Objects.equals(this.errorReason, b402SettleResponseV2Data.errorReason) + && Objects.equals(this.errorMessage, b402SettleResponseV2Data.errorMessage) + && Objects.equals(this.extensions, b402SettleResponseV2Data.extensions); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash( + success, + transaction, + payer, + network, + amount, + errorReason, + errorMessage, + extensions); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402SettleResponseV2Data {\n"); + sb.append(" success: ").append(toIndentedString(success)).append("\n"); + sb.append(" transaction: ").append(toIndentedString(transaction)).append("\n"); + sb.append(" payer: ").append(toIndentedString(payer)).append("\n"); + sb.append(" network: ").append(toIndentedString(network)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" errorReason: ").append(toIndentedString(errorReason)).append("\n"); + sb.append(" errorMessage: ").append(toIndentedString(errorMessage)).append("\n"); + sb.append(" extensions: ").append(toIndentedString(extensions)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object successValue = getSuccess(); + String successValueAsString = ""; + successValueAsString = successValue.toString(); + sb.append("success=").append(urlEncode(successValueAsString)).append(""); + Object transactionValue = getTransaction(); + String transactionValueAsString = ""; + transactionValueAsString = transactionValue.toString(); + sb.append("transaction=").append(urlEncode(transactionValueAsString)).append(""); + Object payerValue = getPayer(); + String payerValueAsString = ""; + payerValueAsString = payerValue.toString(); + sb.append("payer=").append(urlEncode(payerValueAsString)).append(""); + Object networkValue = getNetwork(); + String networkValueAsString = ""; + networkValueAsString = networkValue.toString(); + sb.append("network=").append(urlEncode(networkValueAsString)).append(""); + Object amountValue = getAmount(); + String amountValueAsString = ""; + amountValueAsString = amountValue.toString(); + sb.append("amount=").append(urlEncode(amountValueAsString)).append(""); + Object errorReasonValue = getErrorReason(); + String errorReasonValueAsString = ""; + errorReasonValueAsString = errorReasonValue.toString(); + sb.append("errorReason=").append(urlEncode(errorReasonValueAsString)).append(""); + Object errorMessageValue = getErrorMessage(); + String errorMessageValueAsString = ""; + errorMessageValueAsString = errorMessageValue.toString(); + sb.append("errorMessage=").append(urlEncode(errorMessageValueAsString)).append(""); + Object extensionsValue = getExtensions(); + String extensionsValueAsString = ""; + extensionsValueAsString = extensionsValue.toString(); + sb.append("extensions=").append(urlEncode(extensionsValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("success"); + openapiFields.add("transaction"); + openapiFields.add("payer"); + openapiFields.add("network"); + openapiFields.add("amount"); + openapiFields.add("errorReason"); + openapiFields.add("errorMessage"); + openapiFields.add("extensions"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("success"); + openapiRequiredFields.add("transaction"); + openapiRequiredFields.add("network"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to B402SettleResponseV2Data + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402SettleResponseV2Data.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in B402SettleResponseV2Data is not found" + + " in the empty JSON string", + B402SettleResponseV2Data.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : B402SettleResponseV2Data.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("transaction").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `transaction` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("transaction").toString())); + } + if ((jsonObj.get("payer") != null && !jsonObj.get("payer").isJsonNull()) + && !jsonObj.get("payer").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `payer` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("payer").toString())); + } + if (!jsonObj.get("network").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `network` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("network").toString())); + } + if ((jsonObj.get("amount") != null && !jsonObj.get("amount").isJsonNull()) + && !jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `amount` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("amount").toString())); + } + if ((jsonObj.get("errorReason") != null && !jsonObj.get("errorReason").isJsonNull()) + && !jsonObj.get("errorReason").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `errorReason` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("errorReason").toString())); + } + if ((jsonObj.get("errorMessage") != null && !jsonObj.get("errorMessage").isJsonNull()) + && !jsonObj.get("errorMessage").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `errorMessage` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("errorMessage").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402SettleResponseV2Data.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'B402SettleResponseV2Data' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(B402SettleResponseV2Data.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, B402SettleResponseV2Data value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402SettleResponseV2Data read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402SettleResponseV2Data given an JSON string + * + * @param jsonString JSON string + * @return An instance of B402SettleResponseV2Data + * @throws IOException if the JSON string is invalid with respect to B402SettleResponseV2Data + */ + public static B402SettleResponseV2Data fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, B402SettleResponseV2Data.class); + } + + /** + * Convert an instance of B402SettleResponseV2Data to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SupportedDataV1.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SupportedDataV1.java new file mode 100644 index 0000000..732efc6 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SupportedDataV1.java @@ -0,0 +1,338 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; +import org.hibernate.validator.constraints.*; + +/** B402SupportedDataV1 */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402SupportedDataV1 { + public static final String SERIALIZED_NAME_KINDS = "kinds"; + + @SerializedName(SERIALIZED_NAME_KINDS) + @jakarta.annotation.Nullable + private List<@Valid B402SupportedDataV1KindsInner> kinds; + + public static final String SERIALIZED_NAME_EXTENSIONS = "extensions"; + + @SerializedName(SERIALIZED_NAME_EXTENSIONS) + @jakarta.annotation.Nullable + private List extensions; + + public static final String SERIALIZED_NAME_SIGNERS = "signers"; + + @SerializedName(SERIALIZED_NAME_SIGNERS) + @jakarta.annotation.Nullable + private Map> signers; + + public B402SupportedDataV1() {} + + public B402SupportedDataV1 kinds( + @jakarta.annotation.Nullable List<@Valid B402SupportedDataV1KindsInner> kinds) { + this.kinds = kinds; + return this; + } + + public B402SupportedDataV1 addKindsItem(B402SupportedDataV1KindsInner kindsItem) { + if (this.kinds == null) { + this.kinds = new ArrayList<>(); + } + this.kinds.add(kindsItem); + return this; + } + + /** + * Get kinds + * + * @return kinds + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid B402SupportedDataV1KindsInner> getKinds() { + return kinds; + } + + public void setKinds( + @jakarta.annotation.Nullable List<@Valid B402SupportedDataV1KindsInner> kinds) { + this.kinds = kinds; + } + + public B402SupportedDataV1 extensions(@jakarta.annotation.Nullable List extensions) { + this.extensions = extensions; + return this; + } + + public B402SupportedDataV1 addExtensionsItem(String extensionsItem) { + if (this.extensions == null) { + this.extensions = new ArrayList<>(); + } + this.extensions.add(extensionsItem); + return this; + } + + /** + * Get extensions + * + * @return extensions + */ + @jakarta.annotation.Nullable + public List getExtensions() { + return extensions; + } + + public void setExtensions(@jakarta.annotation.Nullable List extensions) { + this.extensions = extensions; + } + + public B402SupportedDataV1 signers( + @jakarta.annotation.Nullable Map> signers) { + this.signers = signers; + return this; + } + + public B402SupportedDataV1 putSignersItem(String key, List signersItem) { + if (this.signers == null) { + this.signers = new HashMap<>(); + } + this.signers.put(key, signersItem); + return this; + } + + /** + * Get signers + * + * @return signers + */ + @jakarta.annotation.Nullable + @Valid + public Map> getSigners() { + return signers; + } + + public void setSigners(@jakarta.annotation.Nullable Map> signers) { + this.signers = signers; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402SupportedDataV1 b402SupportedDataV1 = (B402SupportedDataV1) o; + return Objects.equals(this.kinds, b402SupportedDataV1.kinds) + && Objects.equals(this.extensions, b402SupportedDataV1.extensions) + && Objects.equals(this.signers, b402SupportedDataV1.signers); + } + + @Override + public int hashCode() { + return Objects.hash(kinds, extensions, signers); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402SupportedDataV1 {\n"); + sb.append(" kinds: ").append(toIndentedString(kinds)).append("\n"); + sb.append(" extensions: ").append(toIndentedString(extensions)).append("\n"); + sb.append(" signers: ").append(toIndentedString(signers)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object kindsValue = getKinds(); + String kindsValueAsString = ""; + kindsValueAsString = + (String) + ((Collection) kindsValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("kinds=").append(urlEncode(kindsValueAsString)).append(""); + Object extensionsValue = getExtensions(); + String extensionsValueAsString = ""; + extensionsValueAsString = + (String) + ((Collection) extensionsValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("extensions=").append(urlEncode(extensionsValueAsString)).append(""); + Object signersValue = getSigners(); + String signersValueAsString = ""; + signersValueAsString = signersValue.toString(); + sb.append("signers=").append(urlEncode(signersValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("kinds"); + openapiFields.add("extensions"); + openapiFields.add("signers"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to B402SupportedDataV1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402SupportedDataV1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in B402SupportedDataV1 is not found in" + + " the empty JSON string", + B402SupportedDataV1.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("kinds") != null && !jsonObj.get("kinds").isJsonNull()) { + JsonArray jsonArraykinds = jsonObj.getAsJsonArray("kinds"); + if (jsonArraykinds != null) { + // ensure the json data is an array + if (!jsonObj.get("kinds").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `kinds` to be an array in the JSON string" + + " but got `%s`", + jsonObj.get("kinds").toString())); + } + + // validate the optional field `kinds` (array) + for (int i = 0; i < jsonArraykinds.size(); i++) { + B402SupportedDataV1KindsInner.validateJsonElement(jsonArraykinds.get(i)); + } + ; + } + } + // ensure the optional json data is an array if present + if (jsonObj.get("extensions") != null + && !jsonObj.get("extensions").isJsonNull() + && !jsonObj.get("extensions").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `extensions` to be an array in the JSON string but" + + " got `%s`", + jsonObj.get("extensions").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402SupportedDataV1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'B402SupportedDataV1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(B402SupportedDataV1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, B402SupportedDataV1 value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402SupportedDataV1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402SupportedDataV1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of B402SupportedDataV1 + * @throws IOException if the JSON string is invalid with respect to B402SupportedDataV1 + */ + public static B402SupportedDataV1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, B402SupportedDataV1.class); + } + + /** + * Convert an instance of B402SupportedDataV1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SupportedDataV1KindsInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SupportedDataV1KindsInner.java new file mode 100644 index 0000000..01c7a05 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SupportedDataV1KindsInner.java @@ -0,0 +1,435 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** B402SupportedDataV1KindsInner */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402SupportedDataV1KindsInner { + /** Gets or Sets x402Version */ + @JsonAdapter(X402VersionEnum.Adapter.class) + public enum X402VersionEnum { + X402_VERSION_1(1); + + private Integer value; + + X402VersionEnum(Integer value) { + this.value = value; + } + + public Integer getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static X402VersionEnum fromValue(Integer value) { + for (X402VersionEnum b : X402VersionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final X402VersionEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public X402VersionEnum read(final JsonReader jsonReader) throws IOException { + Integer value = jsonReader.nextInt(); + return X402VersionEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + Integer value = jsonElement.getAsInt(); + X402VersionEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_X402_VERSION = "x402Version"; + + @SerializedName(SERIALIZED_NAME_X402_VERSION) + @jakarta.annotation.Nullable + private X402VersionEnum x402Version; + + /** Gets or Sets scheme */ + @JsonAdapter(SchemeEnum.Adapter.class) + public enum SchemeEnum { + exact("exact"); + + private String value; + + SchemeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static SchemeEnum fromValue(String value) { + for (SchemeEnum b : SchemeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final SchemeEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public SchemeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return SchemeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + SchemeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_SCHEME = "scheme"; + + @SerializedName(SERIALIZED_NAME_SCHEME) + @jakarta.annotation.Nullable + private SchemeEnum scheme; + + public static final String SERIALIZED_NAME_NETWORK = "network"; + + @SerializedName(SERIALIZED_NAME_NETWORK) + @jakarta.annotation.Nullable + private String network; + + public static final String SERIALIZED_NAME_EXTRA = "extra"; + + @SerializedName(SERIALIZED_NAME_EXTRA) + @jakarta.annotation.Nullable + private B402PaymentKindV1Extra extra; + + public B402SupportedDataV1KindsInner() {} + + public B402SupportedDataV1KindsInner x402Version( + @jakarta.annotation.Nullable X402VersionEnum x402Version) { + this.x402Version = x402Version; + return this; + } + + /** + * Get x402Version + * + * @return x402Version + */ + @jakarta.annotation.Nullable + public X402VersionEnum getX402Version() { + return x402Version; + } + + public void setX402Version(@jakarta.annotation.Nullable X402VersionEnum x402Version) { + this.x402Version = x402Version; + } + + public B402SupportedDataV1KindsInner scheme(@jakarta.annotation.Nullable SchemeEnum scheme) { + this.scheme = scheme; + return this; + } + + /** + * Get scheme + * + * @return scheme + */ + @jakarta.annotation.Nullable + public SchemeEnum getScheme() { + return scheme; + } + + public void setScheme(@jakarta.annotation.Nullable SchemeEnum scheme) { + this.scheme = scheme; + } + + public B402SupportedDataV1KindsInner network(@jakarta.annotation.Nullable String network) { + this.network = network; + return this; + } + + /** + * Get network + * + * @return network + */ + @jakarta.annotation.Nullable + public String getNetwork() { + return network; + } + + public void setNetwork(@jakarta.annotation.Nullable String network) { + this.network = network; + } + + public B402SupportedDataV1KindsInner extra( + @jakarta.annotation.Nullable B402PaymentKindV1Extra extra) { + this.extra = extra; + return this; + } + + /** + * Get extra + * + * @return extra + */ + @jakarta.annotation.Nullable + @Valid + public B402PaymentKindV1Extra getExtra() { + return extra; + } + + public void setExtra(@jakarta.annotation.Nullable B402PaymentKindV1Extra extra) { + this.extra = extra; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402SupportedDataV1KindsInner b402SupportedDataV1KindsInner = + (B402SupportedDataV1KindsInner) o; + return Objects.equals(this.x402Version, b402SupportedDataV1KindsInner.x402Version) + && Objects.equals(this.scheme, b402SupportedDataV1KindsInner.scheme) + && Objects.equals(this.network, b402SupportedDataV1KindsInner.network) + && Objects.equals(this.extra, b402SupportedDataV1KindsInner.extra); + } + + @Override + public int hashCode() { + return Objects.hash(x402Version, scheme, network, extra); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402SupportedDataV1KindsInner {\n"); + sb.append(" x402Version: ").append(toIndentedString(x402Version)).append("\n"); + sb.append(" scheme: ").append(toIndentedString(scheme)).append("\n"); + sb.append(" network: ").append(toIndentedString(network)).append("\n"); + sb.append(" extra: ").append(toIndentedString(extra)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object x402VersionValue = getX402Version(); + String x402VersionValueAsString = ""; + x402VersionValueAsString = x402VersionValue.toString(); + sb.append("x402Version=").append(urlEncode(x402VersionValueAsString)).append(""); + Object schemeValue = getScheme(); + String schemeValueAsString = ""; + schemeValueAsString = schemeValue.toString(); + sb.append("scheme=").append(urlEncode(schemeValueAsString)).append(""); + Object networkValue = getNetwork(); + String networkValueAsString = ""; + networkValueAsString = networkValue.toString(); + sb.append("network=").append(urlEncode(networkValueAsString)).append(""); + Object extraValue = getExtra(); + String extraValueAsString = ""; + extraValueAsString = extraValue.toString(); + sb.append("extra=").append(urlEncode(extraValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("x402Version"); + openapiFields.add("scheme"); + openapiFields.add("network"); + openapiFields.add("extra"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * B402SupportedDataV1KindsInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402SupportedDataV1KindsInner.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in B402SupportedDataV1KindsInner is not" + + " found in the empty JSON string", + B402SupportedDataV1KindsInner.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `x402Version` + if (jsonObj.get("x402Version") != null && !jsonObj.get("x402Version").isJsonNull()) { + X402VersionEnum.validateJsonElement(jsonObj.get("x402Version")); + } + if ((jsonObj.get("scheme") != null && !jsonObj.get("scheme").isJsonNull()) + && !jsonObj.get("scheme").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `scheme` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("scheme").toString())); + } + // validate the optional field `scheme` + if (jsonObj.get("scheme") != null && !jsonObj.get("scheme").isJsonNull()) { + SchemeEnum.validateJsonElement(jsonObj.get("scheme")); + } + if ((jsonObj.get("network") != null && !jsonObj.get("network").isJsonNull()) + && !jsonObj.get("network").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `network` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("network").toString())); + } + // validate the optional field `extra` + if (jsonObj.get("extra") != null && !jsonObj.get("extra").isJsonNull()) { + B402PaymentKindV1Extra.validateJsonElement(jsonObj.get("extra")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402SupportedDataV1KindsInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'B402SupportedDataV1KindsInner' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(B402SupportedDataV1KindsInner.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, B402SupportedDataV1KindsInner value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402SupportedDataV1KindsInner read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402SupportedDataV1KindsInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of B402SupportedDataV1KindsInner + * @throws IOException if the JSON string is invalid with respect to + * B402SupportedDataV1KindsInner + */ + public static B402SupportedDataV1KindsInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, B402SupportedDataV1KindsInner.class); + } + + /** + * Convert an instance of B402SupportedDataV1KindsInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SupportedDataV2.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SupportedDataV2.java new file mode 100644 index 0000000..a609018 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SupportedDataV2.java @@ -0,0 +1,352 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; +import org.hibernate.validator.constraints.*; + +/** B402SupportedDataV2 */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402SupportedDataV2 { + public static final String SERIALIZED_NAME_KINDS = "kinds"; + + @SerializedName(SERIALIZED_NAME_KINDS) + @jakarta.annotation.Nonnull + private List<@Valid B402SupportedDataV2KindsInner> kinds; + + public static final String SERIALIZED_NAME_EXTENSIONS = "extensions"; + + @SerializedName(SERIALIZED_NAME_EXTENSIONS) + @jakarta.annotation.Nonnull + private List extensions; + + public static final String SERIALIZED_NAME_SIGNERS = "signers"; + + @SerializedName(SERIALIZED_NAME_SIGNERS) + @jakarta.annotation.Nonnull + private Map> signers; + + public B402SupportedDataV2() {} + + public B402SupportedDataV2 kinds( + @jakarta.annotation.Nonnull List<@Valid B402SupportedDataV2KindsInner> kinds) { + this.kinds = kinds; + return this; + } + + public B402SupportedDataV2 addKindsItem(B402SupportedDataV2KindsInner kindsItem) { + if (this.kinds == null) { + this.kinds = new ArrayList<>(); + } + this.kinds.add(kindsItem); + return this; + } + + /** + * Get kinds + * + * @return kinds + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public List<@Valid B402SupportedDataV2KindsInner> getKinds() { + return kinds; + } + + public void setKinds( + @jakarta.annotation.Nonnull List<@Valid B402SupportedDataV2KindsInner> kinds) { + this.kinds = kinds; + } + + public B402SupportedDataV2 extensions(@jakarta.annotation.Nonnull List extensions) { + this.extensions = extensions; + return this; + } + + public B402SupportedDataV2 addExtensionsItem(String extensionsItem) { + if (this.extensions == null) { + this.extensions = new ArrayList<>(); + } + this.extensions.add(extensionsItem); + return this; + } + + /** + * Get extensions + * + * @return extensions + */ + @jakarta.annotation.Nonnull + @NotNull + public List getExtensions() { + return extensions; + } + + public void setExtensions(@jakarta.annotation.Nonnull List extensions) { + this.extensions = extensions; + } + + public B402SupportedDataV2 signers( + @jakarta.annotation.Nonnull Map> signers) { + this.signers = signers; + return this; + } + + public B402SupportedDataV2 putSignersItem(String key, List signersItem) { + if (this.signers == null) { + this.signers = new HashMap<>(); + } + this.signers.put(key, signersItem); + return this; + } + + /** + * Get signers + * + * @return signers + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public Map> getSigners() { + return signers; + } + + public void setSigners(@jakarta.annotation.Nonnull Map> signers) { + this.signers = signers; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402SupportedDataV2 b402SupportedDataV2 = (B402SupportedDataV2) o; + return Objects.equals(this.kinds, b402SupportedDataV2.kinds) + && Objects.equals(this.extensions, b402SupportedDataV2.extensions) + && Objects.equals(this.signers, b402SupportedDataV2.signers); + } + + @Override + public int hashCode() { + return Objects.hash(kinds, extensions, signers); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402SupportedDataV2 {\n"); + sb.append(" kinds: ").append(toIndentedString(kinds)).append("\n"); + sb.append(" extensions: ").append(toIndentedString(extensions)).append("\n"); + sb.append(" signers: ").append(toIndentedString(signers)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object kindsValue = getKinds(); + String kindsValueAsString = ""; + kindsValueAsString = + (String) + ((Collection) kindsValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("kinds=").append(urlEncode(kindsValueAsString)).append(""); + Object extensionsValue = getExtensions(); + String extensionsValueAsString = ""; + extensionsValueAsString = + (String) + ((Collection) extensionsValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("extensions=").append(urlEncode(extensionsValueAsString)).append(""); + Object signersValue = getSigners(); + String signersValueAsString = ""; + signersValueAsString = signersValue.toString(); + sb.append("signers=").append(urlEncode(signersValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("kinds"); + openapiFields.add("extensions"); + openapiFields.add("signers"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("kinds"); + openapiRequiredFields.add("extensions"); + openapiRequiredFields.add("signers"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to B402SupportedDataV2 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402SupportedDataV2.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in B402SupportedDataV2 is not found in" + + " the empty JSON string", + B402SupportedDataV2.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : B402SupportedDataV2.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("kinds").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `kinds` to be an array in the JSON string but got" + + " `%s`", + jsonObj.get("kinds").toString())); + } + + JsonArray jsonArraykinds = jsonObj.getAsJsonArray("kinds"); + // validate the required field `kinds` (array) + for (int i = 0; i < jsonArraykinds.size(); i++) { + B402SupportedDataV2KindsInner.validateJsonElement(jsonArraykinds.get(i)); + } + ; + // ensure the required json array is present + if (jsonObj.get("extensions") == null) { + throw new IllegalArgumentException( + "Expected the field `linkedContent` to be an array in the JSON string but got" + + " `null`"); + } else if (!jsonObj.get("extensions").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `extensions` to be an array in the JSON string but" + + " got `%s`", + jsonObj.get("extensions").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402SupportedDataV2.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'B402SupportedDataV2' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(B402SupportedDataV2.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, B402SupportedDataV2 value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402SupportedDataV2 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402SupportedDataV2 given an JSON string + * + * @param jsonString JSON string + * @return An instance of B402SupportedDataV2 + * @throws IOException if the JSON string is invalid with respect to B402SupportedDataV2 + */ + public static B402SupportedDataV2 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, B402SupportedDataV2.class); + } + + /** + * Convert an instance of B402SupportedDataV2 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SupportedDataV2KindsInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SupportedDataV2KindsInner.java new file mode 100644 index 0000000..0613a12 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SupportedDataV2KindsInner.java @@ -0,0 +1,447 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** B402SupportedDataV2KindsInner */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402SupportedDataV2KindsInner { + /** Gets or Sets x402Version */ + @JsonAdapter(X402VersionEnum.Adapter.class) + public enum X402VersionEnum { + X402_VERSION_2(2); + + private Integer value; + + X402VersionEnum(Integer value) { + this.value = value; + } + + public Integer getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static X402VersionEnum fromValue(Integer value) { + for (X402VersionEnum b : X402VersionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final X402VersionEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public X402VersionEnum read(final JsonReader jsonReader) throws IOException { + Integer value = jsonReader.nextInt(); + return X402VersionEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + Integer value = jsonElement.getAsInt(); + X402VersionEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_X402_VERSION = "x402Version"; + + @SerializedName(SERIALIZED_NAME_X402_VERSION) + @jakarta.annotation.Nonnull + private X402VersionEnum x402Version; + + /** Gets or Sets scheme */ + @JsonAdapter(SchemeEnum.Adapter.class) + public enum SchemeEnum { + exact("exact"), + + upto("upto"); + + private String value; + + SchemeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static SchemeEnum fromValue(String value) { + for (SchemeEnum b : SchemeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final SchemeEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public SchemeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return SchemeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + SchemeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_SCHEME = "scheme"; + + @SerializedName(SERIALIZED_NAME_SCHEME) + @jakarta.annotation.Nonnull + private SchemeEnum scheme; + + public static final String SERIALIZED_NAME_NETWORK = "network"; + + @SerializedName(SERIALIZED_NAME_NETWORK) + @jakarta.annotation.Nonnull + private String network; + + public static final String SERIALIZED_NAME_EXTRA = "extra"; + + @SerializedName(SERIALIZED_NAME_EXTRA) + @jakarta.annotation.Nonnull + private B402SupportedDataV2KindsInnerExtra extra; + + public B402SupportedDataV2KindsInner() {} + + public B402SupportedDataV2KindsInner x402Version( + @jakarta.annotation.Nonnull X402VersionEnum x402Version) { + this.x402Version = x402Version; + return this; + } + + /** + * Get x402Version + * + * @return x402Version + */ + @jakarta.annotation.Nonnull + @NotNull + public X402VersionEnum getX402Version() { + return x402Version; + } + + public void setX402Version(@jakarta.annotation.Nonnull X402VersionEnum x402Version) { + this.x402Version = x402Version; + } + + public B402SupportedDataV2KindsInner scheme(@jakarta.annotation.Nonnull SchemeEnum scheme) { + this.scheme = scheme; + return this; + } + + /** + * Get scheme + * + * @return scheme + */ + @jakarta.annotation.Nonnull + @NotNull + public SchemeEnum getScheme() { + return scheme; + } + + public void setScheme(@jakarta.annotation.Nonnull SchemeEnum scheme) { + this.scheme = scheme; + } + + public B402SupportedDataV2KindsInner network(@jakarta.annotation.Nonnull String network) { + this.network = network; + return this; + } + + /** + * Get network + * + * @return network + */ + @jakarta.annotation.Nonnull + @NotNull + public String getNetwork() { + return network; + } + + public void setNetwork(@jakarta.annotation.Nonnull String network) { + this.network = network; + } + + public B402SupportedDataV2KindsInner extra( + @jakarta.annotation.Nonnull B402SupportedDataV2KindsInnerExtra extra) { + this.extra = extra; + return this; + } + + /** + * Get extra + * + * @return extra + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public B402SupportedDataV2KindsInnerExtra getExtra() { + return extra; + } + + public void setExtra(@jakarta.annotation.Nonnull B402SupportedDataV2KindsInnerExtra extra) { + this.extra = extra; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402SupportedDataV2KindsInner b402SupportedDataV2KindsInner = + (B402SupportedDataV2KindsInner) o; + return Objects.equals(this.x402Version, b402SupportedDataV2KindsInner.x402Version) + && Objects.equals(this.scheme, b402SupportedDataV2KindsInner.scheme) + && Objects.equals(this.network, b402SupportedDataV2KindsInner.network) + && Objects.equals(this.extra, b402SupportedDataV2KindsInner.extra); + } + + @Override + public int hashCode() { + return Objects.hash(x402Version, scheme, network, extra); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402SupportedDataV2KindsInner {\n"); + sb.append(" x402Version: ").append(toIndentedString(x402Version)).append("\n"); + sb.append(" scheme: ").append(toIndentedString(scheme)).append("\n"); + sb.append(" network: ").append(toIndentedString(network)).append("\n"); + sb.append(" extra: ").append(toIndentedString(extra)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object x402VersionValue = getX402Version(); + String x402VersionValueAsString = ""; + x402VersionValueAsString = x402VersionValue.toString(); + sb.append("x402Version=").append(urlEncode(x402VersionValueAsString)).append(""); + Object schemeValue = getScheme(); + String schemeValueAsString = ""; + schemeValueAsString = schemeValue.toString(); + sb.append("scheme=").append(urlEncode(schemeValueAsString)).append(""); + Object networkValue = getNetwork(); + String networkValueAsString = ""; + networkValueAsString = networkValue.toString(); + sb.append("network=").append(urlEncode(networkValueAsString)).append(""); + Object extraValue = getExtra(); + String extraValueAsString = ""; + extraValueAsString = extraValue.toString(); + sb.append("extra=").append(urlEncode(extraValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("x402Version"); + openapiFields.add("scheme"); + openapiFields.add("network"); + openapiFields.add("extra"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("x402Version"); + openapiRequiredFields.add("scheme"); + openapiRequiredFields.add("network"); + openapiRequiredFields.add("extra"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * B402SupportedDataV2KindsInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402SupportedDataV2KindsInner.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in B402SupportedDataV2KindsInner is not" + + " found in the empty JSON string", + B402SupportedDataV2KindsInner.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : B402SupportedDataV2KindsInner.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `x402Version` + X402VersionEnum.validateJsonElement(jsonObj.get("x402Version")); + if (!jsonObj.get("scheme").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `scheme` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("scheme").toString())); + } + // validate the required field `scheme` + SchemeEnum.validateJsonElement(jsonObj.get("scheme")); + if (!jsonObj.get("network").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `network` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("network").toString())); + } + // validate the required field `extra` + B402SupportedDataV2KindsInnerExtra.validateJsonElement(jsonObj.get("extra")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402SupportedDataV2KindsInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'B402SupportedDataV2KindsInner' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(B402SupportedDataV2KindsInner.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, B402SupportedDataV2KindsInner value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402SupportedDataV2KindsInner read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402SupportedDataV2KindsInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of B402SupportedDataV2KindsInner + * @throws IOException if the JSON string is invalid with respect to + * B402SupportedDataV2KindsInner + */ + public static B402SupportedDataV2KindsInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, B402SupportedDataV2KindsInner.class); + } + + /** + * Convert an instance of B402SupportedDataV2KindsInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SupportedDataV2KindsInnerExtra.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SupportedDataV2KindsInnerExtra.java new file mode 100644 index 0000000..d667669 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SupportedDataV2KindsInnerExtra.java @@ -0,0 +1,479 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** B402SupportedDataV2KindsInnerExtra */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402SupportedDataV2KindsInnerExtra { + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @jakarta.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_VERSION = "version"; + + @SerializedName(SERIALIZED_NAME_VERSION) + @jakarta.annotation.Nonnull + private String version; + + /** Gets or Sets assetTransferMethod */ + @JsonAdapter(AssetTransferMethodEnum.Adapter.class) + public enum AssetTransferMethodEnum { + EIP3009("eip3009"), + + PERMIT2_EXACT("permit2-exact"), + + PERMIT2_UPTO("permit2-upto"); + + private String value; + + AssetTransferMethodEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static AssetTransferMethodEnum fromValue(String value) { + for (AssetTransferMethodEnum b : AssetTransferMethodEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write( + final JsonWriter jsonWriter, final AssetTransferMethodEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public AssetTransferMethodEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return AssetTransferMethodEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + AssetTransferMethodEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_ASSET_TRANSFER_METHOD = "assetTransferMethod"; + + @SerializedName(SERIALIZED_NAME_ASSET_TRANSFER_METHOD) + @jakarta.annotation.Nonnull + private AssetTransferMethodEnum assetTransferMethod; + + public static final String SERIALIZED_NAME_SIGNER_ADDRESS = "signerAddress"; + + @SerializedName(SERIALIZED_NAME_SIGNER_ADDRESS) + @jakarta.annotation.Nonnull + private String signerAddress; + + public static final String SERIALIZED_NAME_SPENDER_ADDRESS = "spenderAddress"; + + @SerializedName(SERIALIZED_NAME_SPENDER_ADDRESS) + @jakarta.annotation.Nullable + private String spenderAddress; + + public B402SupportedDataV2KindsInnerExtra() {} + + public B402SupportedDataV2KindsInnerExtra name(@jakarta.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * + * @return name + */ + @jakarta.annotation.Nonnull + @NotNull + public String getName() { + return name; + } + + public void setName(@jakarta.annotation.Nonnull String name) { + this.name = name; + } + + public B402SupportedDataV2KindsInnerExtra version(@jakarta.annotation.Nonnull String version) { + this.version = version; + return this; + } + + /** + * Get version + * + * @return version + */ + @jakarta.annotation.Nonnull + @NotNull + public String getVersion() { + return version; + } + + public void setVersion(@jakarta.annotation.Nonnull String version) { + this.version = version; + } + + public B402SupportedDataV2KindsInnerExtra assetTransferMethod( + @jakarta.annotation.Nonnull AssetTransferMethodEnum assetTransferMethod) { + this.assetTransferMethod = assetTransferMethod; + return this; + } + + /** + * Get assetTransferMethod + * + * @return assetTransferMethod + */ + @jakarta.annotation.Nonnull + @NotNull + public AssetTransferMethodEnum getAssetTransferMethod() { + return assetTransferMethod; + } + + public void setAssetTransferMethod( + @jakarta.annotation.Nonnull AssetTransferMethodEnum assetTransferMethod) { + this.assetTransferMethod = assetTransferMethod; + } + + public B402SupportedDataV2KindsInnerExtra signerAddress( + @jakarta.annotation.Nonnull String signerAddress) { + this.signerAddress = signerAddress; + return this; + } + + /** + * Get signerAddress + * + * @return signerAddress + */ + @jakarta.annotation.Nonnull + @NotNull + public String getSignerAddress() { + return signerAddress; + } + + public void setSignerAddress(@jakarta.annotation.Nonnull String signerAddress) { + this.signerAddress = signerAddress; + } + + public B402SupportedDataV2KindsInnerExtra spenderAddress( + @jakarta.annotation.Nullable String spenderAddress) { + this.spenderAddress = spenderAddress; + return this; + } + + /** + * Get spenderAddress + * + * @return spenderAddress + */ + @jakarta.annotation.Nullable + public String getSpenderAddress() { + return spenderAddress; + } + + public void setSpenderAddress(@jakarta.annotation.Nullable String spenderAddress) { + this.spenderAddress = spenderAddress; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402SupportedDataV2KindsInnerExtra b402SupportedDataV2KindsInnerExtra = + (B402SupportedDataV2KindsInnerExtra) o; + return Objects.equals(this.name, b402SupportedDataV2KindsInnerExtra.name) + && Objects.equals(this.version, b402SupportedDataV2KindsInnerExtra.version) + && Objects.equals( + this.assetTransferMethod, + b402SupportedDataV2KindsInnerExtra.assetTransferMethod) + && Objects.equals( + this.signerAddress, b402SupportedDataV2KindsInnerExtra.signerAddress) + && Objects.equals( + this.spenderAddress, b402SupportedDataV2KindsInnerExtra.spenderAddress); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(name, version, assetTransferMethod, signerAddress, spenderAddress); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402SupportedDataV2KindsInnerExtra {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).append("\n"); + sb.append(" assetTransferMethod: ") + .append(toIndentedString(assetTransferMethod)) + .append("\n"); + sb.append(" signerAddress: ").append(toIndentedString(signerAddress)).append("\n"); + sb.append(" spenderAddress: ").append(toIndentedString(spenderAddress)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object nameValue = getName(); + String nameValueAsString = ""; + nameValueAsString = nameValue.toString(); + sb.append("name=").append(urlEncode(nameValueAsString)).append(""); + Object versionValue = getVersion(); + String versionValueAsString = ""; + versionValueAsString = versionValue.toString(); + sb.append("version=").append(urlEncode(versionValueAsString)).append(""); + Object assetTransferMethodValue = getAssetTransferMethod(); + String assetTransferMethodValueAsString = ""; + assetTransferMethodValueAsString = assetTransferMethodValue.toString(); + sb.append("assetTransferMethod=") + .append(urlEncode(assetTransferMethodValueAsString)) + .append(""); + Object signerAddressValue = getSignerAddress(); + String signerAddressValueAsString = ""; + signerAddressValueAsString = signerAddressValue.toString(); + sb.append("signerAddress=").append(urlEncode(signerAddressValueAsString)).append(""); + Object spenderAddressValue = getSpenderAddress(); + String spenderAddressValueAsString = ""; + spenderAddressValueAsString = spenderAddressValue.toString(); + sb.append("spenderAddress=").append(urlEncode(spenderAddressValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("version"); + openapiFields.add("assetTransferMethod"); + openapiFields.add("signerAddress"); + openapiFields.add("spenderAddress"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("version"); + openapiRequiredFields.add("assetTransferMethod"); + openapiRequiredFields.add("signerAddress"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * B402SupportedDataV2KindsInnerExtra + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402SupportedDataV2KindsInnerExtra.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in B402SupportedDataV2KindsInnerExtra is" + + " not found in the empty JSON string", + B402SupportedDataV2KindsInnerExtra.openapiRequiredFields + .toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : B402SupportedDataV2KindsInnerExtra.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `name` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("name").toString())); + } + if (!jsonObj.get("version").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `version` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("version").toString())); + } + if (!jsonObj.get("assetTransferMethod").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `assetTransferMethod` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("assetTransferMethod").toString())); + } + // validate the required field `assetTransferMethod` + AssetTransferMethodEnum.validateJsonElement(jsonObj.get("assetTransferMethod")); + if (!jsonObj.get("signerAddress").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `signerAddress` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("signerAddress").toString())); + } + if ((jsonObj.get("spenderAddress") != null && !jsonObj.get("spenderAddress").isJsonNull()) + && !jsonObj.get("spenderAddress").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `spenderAddress` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("spenderAddress").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402SupportedDataV2KindsInnerExtra.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'B402SupportedDataV2KindsInnerExtra' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(B402SupportedDataV2KindsInnerExtra.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, B402SupportedDataV2KindsInnerExtra value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402SupportedDataV2KindsInnerExtra read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402SupportedDataV2KindsInnerExtra given an JSON string + * + * @param jsonString JSON string + * @return An instance of B402SupportedDataV2KindsInnerExtra + * @throws IOException if the JSON string is invalid with respect to + * B402SupportedDataV2KindsInnerExtra + */ + public static B402SupportedDataV2KindsInnerExtra fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, B402SupportedDataV2KindsInnerExtra.class); + } + + /** + * Convert an instance of B402SupportedDataV2KindsInnerExtra to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SupportedResponseV1.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SupportedResponseV1.java new file mode 100644 index 0000000..213942a --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SupportedResponseV1.java @@ -0,0 +1,452 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** B402SupportedResponseV1 */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402SupportedResponseV1 { + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + @jakarta.annotation.Nullable + private String status; + + public static final String SERIALIZED_NAME_TYPE = "type"; + + @SerializedName(SERIALIZED_NAME_TYPE) + @jakarta.annotation.Nullable + private String type; + + public static final String SERIALIZED_NAME_CODE = "code"; + + @SerializedName(SERIALIZED_NAME_CODE) + @jakarta.annotation.Nullable + private String code; + + public static final String SERIALIZED_NAME_ERROR_DATA = "errorData"; + + @SerializedName(SERIALIZED_NAME_ERROR_DATA) + @jakarta.annotation.Nullable + private String errorData; + + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + @jakarta.annotation.Nullable + private B402SupportedResponseV1Data data; + + public static final String SERIALIZED_NAME_SUB_DATA = "subData"; + + @SerializedName(SERIALIZED_NAME_SUB_DATA) + @jakarta.annotation.Nullable + private Object subData; + + public static final String SERIALIZED_NAME_PARAMS = "params"; + + @SerializedName(SERIALIZED_NAME_PARAMS) + @jakarta.annotation.Nullable + private Object params; + + public B402SupportedResponseV1() {} + + public B402SupportedResponseV1 status(@jakarta.annotation.Nullable String status) { + this.status = status; + return this; + } + + /** + * Get status + * + * @return status + */ + @jakarta.annotation.Nullable + public String getStatus() { + return status; + } + + public void setStatus(@jakarta.annotation.Nullable String status) { + this.status = status; + } + + public B402SupportedResponseV1 type(@jakarta.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * + * @return type + */ + @jakarta.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@jakarta.annotation.Nullable String type) { + this.type = type; + } + + public B402SupportedResponseV1 code(@jakarta.annotation.Nullable String code) { + this.code = code; + return this; + } + + /** + * Get code + * + * @return code + */ + @jakarta.annotation.Nullable + public String getCode() { + return code; + } + + public void setCode(@jakarta.annotation.Nullable String code) { + this.code = code; + } + + public B402SupportedResponseV1 errorData(@jakarta.annotation.Nullable String errorData) { + this.errorData = errorData; + return this; + } + + /** + * Get errorData + * + * @return errorData + */ + @jakarta.annotation.Nullable + public String getErrorData() { + return errorData; + } + + public void setErrorData(@jakarta.annotation.Nullable String errorData) { + this.errorData = errorData; + } + + public B402SupportedResponseV1 data( + @jakarta.annotation.Nullable B402SupportedResponseV1Data data) { + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @jakarta.annotation.Nullable + @Valid + public B402SupportedResponseV1Data getData() { + return data; + } + + public void setData(@jakarta.annotation.Nullable B402SupportedResponseV1Data data) { + this.data = data; + } + + public B402SupportedResponseV1 subData(@jakarta.annotation.Nullable Object subData) { + this.subData = subData; + return this; + } + + /** + * Get subData + * + * @return subData + */ + @jakarta.annotation.Nullable + public Object getSubData() { + return subData; + } + + public void setSubData(@jakarta.annotation.Nullable Object subData) { + this.subData = subData; + } + + public B402SupportedResponseV1 params(@jakarta.annotation.Nullable Object params) { + this.params = params; + return this; + } + + /** + * Get params + * + * @return params + */ + @jakarta.annotation.Nullable + public Object getParams() { + return params; + } + + public void setParams(@jakarta.annotation.Nullable Object params) { + this.params = params; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402SupportedResponseV1 b402SupportedResponseV1 = (B402SupportedResponseV1) o; + return Objects.equals(this.status, b402SupportedResponseV1.status) + && Objects.equals(this.type, b402SupportedResponseV1.type) + && Objects.equals(this.code, b402SupportedResponseV1.code) + && Objects.equals(this.errorData, b402SupportedResponseV1.errorData) + && Objects.equals(this.data, b402SupportedResponseV1.data) + && Objects.equals(this.subData, b402SupportedResponseV1.subData) + && Objects.equals(this.params, b402SupportedResponseV1.params); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(status, type, code, errorData, data, subData, params); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402SupportedResponseV1 {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" errorData: ").append(toIndentedString(errorData)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" subData: ").append(toIndentedString(subData)).append("\n"); + sb.append(" params: ").append(toIndentedString(params)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object statusValue = getStatus(); + String statusValueAsString = ""; + statusValueAsString = statusValue.toString(); + sb.append("status=").append(urlEncode(statusValueAsString)).append(""); + Object typeValue = getType(); + String typeValueAsString = ""; + typeValueAsString = typeValue.toString(); + sb.append("type=").append(urlEncode(typeValueAsString)).append(""); + Object codeValue = getCode(); + String codeValueAsString = ""; + codeValueAsString = codeValue.toString(); + sb.append("code=").append(urlEncode(codeValueAsString)).append(""); + Object errorDataValue = getErrorData(); + String errorDataValueAsString = ""; + errorDataValueAsString = errorDataValue.toString(); + sb.append("errorData=").append(urlEncode(errorDataValueAsString)).append(""); + Object dataValue = getData(); + String dataValueAsString = ""; + dataValueAsString = dataValue.toString(); + sb.append("data=").append(urlEncode(dataValueAsString)).append(""); + Object subDataValue = getSubData(); + String subDataValueAsString = ""; + subDataValueAsString = subDataValue.toString(); + sb.append("subData=").append(urlEncode(subDataValueAsString)).append(""); + Object paramsValue = getParams(); + String paramsValueAsString = ""; + paramsValueAsString = paramsValue.toString(); + sb.append("params=").append(urlEncode(paramsValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("status"); + openapiFields.add("type"); + openapiFields.add("code"); + openapiFields.add("errorData"); + openapiFields.add("data"); + openapiFields.add("subData"); + openapiFields.add("params"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to B402SupportedResponseV1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402SupportedResponseV1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in B402SupportedResponseV1 is not found" + + " in the empty JSON string", + B402SupportedResponseV1.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) + && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `status` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("status").toString())); + } + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) + && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `type` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("type").toString())); + } + if ((jsonObj.get("code") != null && !jsonObj.get("code").isJsonNull()) + && !jsonObj.get("code").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `code` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("code").toString())); + } + if ((jsonObj.get("errorData") != null && !jsonObj.get("errorData").isJsonNull()) + && !jsonObj.get("errorData").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `errorData` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("errorData").toString())); + } + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + B402SupportedResponseV1Data.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402SupportedResponseV1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'B402SupportedResponseV1' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(B402SupportedResponseV1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, B402SupportedResponseV1 value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402SupportedResponseV1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402SupportedResponseV1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of B402SupportedResponseV1 + * @throws IOException if the JSON string is invalid with respect to B402SupportedResponseV1 + */ + public static B402SupportedResponseV1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, B402SupportedResponseV1.class); + } + + /** + * Convert an instance of B402SupportedResponseV1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SupportedResponseV1Data.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SupportedResponseV1Data.java new file mode 100644 index 0000000..59a4e67 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SupportedResponseV1Data.java @@ -0,0 +1,341 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; +import org.hibernate.validator.constraints.*; + +/** B402SupportedResponseV1Data */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402SupportedResponseV1Data { + public static final String SERIALIZED_NAME_KINDS = "kinds"; + + @SerializedName(SERIALIZED_NAME_KINDS) + @jakarta.annotation.Nullable + private List<@Valid B402SupportedDataV1KindsInner> kinds; + + public static final String SERIALIZED_NAME_EXTENSIONS = "extensions"; + + @SerializedName(SERIALIZED_NAME_EXTENSIONS) + @jakarta.annotation.Nullable + private List extensions; + + public static final String SERIALIZED_NAME_SIGNERS = "signers"; + + @SerializedName(SERIALIZED_NAME_SIGNERS) + @jakarta.annotation.Nullable + private Map> signers; + + public B402SupportedResponseV1Data() {} + + public B402SupportedResponseV1Data kinds( + @jakarta.annotation.Nullable List<@Valid B402SupportedDataV1KindsInner> kinds) { + this.kinds = kinds; + return this; + } + + public B402SupportedResponseV1Data addKindsItem(B402SupportedDataV1KindsInner kindsItem) { + if (this.kinds == null) { + this.kinds = new ArrayList<>(); + } + this.kinds.add(kindsItem); + return this; + } + + /** + * Get kinds + * + * @return kinds + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid B402SupportedDataV1KindsInner> getKinds() { + return kinds; + } + + public void setKinds( + @jakarta.annotation.Nullable List<@Valid B402SupportedDataV1KindsInner> kinds) { + this.kinds = kinds; + } + + public B402SupportedResponseV1Data extensions( + @jakarta.annotation.Nullable List extensions) { + this.extensions = extensions; + return this; + } + + public B402SupportedResponseV1Data addExtensionsItem(String extensionsItem) { + if (this.extensions == null) { + this.extensions = new ArrayList<>(); + } + this.extensions.add(extensionsItem); + return this; + } + + /** + * Get extensions + * + * @return extensions + */ + @jakarta.annotation.Nullable + public List getExtensions() { + return extensions; + } + + public void setExtensions(@jakarta.annotation.Nullable List extensions) { + this.extensions = extensions; + } + + public B402SupportedResponseV1Data signers( + @jakarta.annotation.Nullable Map> signers) { + this.signers = signers; + return this; + } + + public B402SupportedResponseV1Data putSignersItem(String key, List signersItem) { + if (this.signers == null) { + this.signers = new HashMap<>(); + } + this.signers.put(key, signersItem); + return this; + } + + /** + * Get signers + * + * @return signers + */ + @jakarta.annotation.Nullable + @Valid + public Map> getSigners() { + return signers; + } + + public void setSigners(@jakarta.annotation.Nullable Map> signers) { + this.signers = signers; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402SupportedResponseV1Data b402SupportedResponseV1Data = (B402SupportedResponseV1Data) o; + return Objects.equals(this.kinds, b402SupportedResponseV1Data.kinds) + && Objects.equals(this.extensions, b402SupportedResponseV1Data.extensions) + && Objects.equals(this.signers, b402SupportedResponseV1Data.signers); + } + + @Override + public int hashCode() { + return Objects.hash(kinds, extensions, signers); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402SupportedResponseV1Data {\n"); + sb.append(" kinds: ").append(toIndentedString(kinds)).append("\n"); + sb.append(" extensions: ").append(toIndentedString(extensions)).append("\n"); + sb.append(" signers: ").append(toIndentedString(signers)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object kindsValue = getKinds(); + String kindsValueAsString = ""; + kindsValueAsString = + (String) + ((Collection) kindsValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("kinds=").append(urlEncode(kindsValueAsString)).append(""); + Object extensionsValue = getExtensions(); + String extensionsValueAsString = ""; + extensionsValueAsString = + (String) + ((Collection) extensionsValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("extensions=").append(urlEncode(extensionsValueAsString)).append(""); + Object signersValue = getSigners(); + String signersValueAsString = ""; + signersValueAsString = signersValue.toString(); + sb.append("signers=").append(urlEncode(signersValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("kinds"); + openapiFields.add("extensions"); + openapiFields.add("signers"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * B402SupportedResponseV1Data + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402SupportedResponseV1Data.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in B402SupportedResponseV1Data is not" + + " found in the empty JSON string", + B402SupportedResponseV1Data.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("kinds") != null && !jsonObj.get("kinds").isJsonNull()) { + JsonArray jsonArraykinds = jsonObj.getAsJsonArray("kinds"); + if (jsonArraykinds != null) { + // ensure the json data is an array + if (!jsonObj.get("kinds").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `kinds` to be an array in the JSON string" + + " but got `%s`", + jsonObj.get("kinds").toString())); + } + + // validate the optional field `kinds` (array) + for (int i = 0; i < jsonArraykinds.size(); i++) { + B402SupportedDataV1KindsInner.validateJsonElement(jsonArraykinds.get(i)); + } + ; + } + } + // ensure the optional json data is an array if present + if (jsonObj.get("extensions") != null + && !jsonObj.get("extensions").isJsonNull() + && !jsonObj.get("extensions").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `extensions` to be an array in the JSON string but" + + " got `%s`", + jsonObj.get("extensions").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402SupportedResponseV1Data.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'B402SupportedResponseV1Data' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(B402SupportedResponseV1Data.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, B402SupportedResponseV1Data value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402SupportedResponseV1Data read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402SupportedResponseV1Data given an JSON string + * + * @param jsonString JSON string + * @return An instance of B402SupportedResponseV1Data + * @throws IOException if the JSON string is invalid with respect to B402SupportedResponseV1Data + */ + public static B402SupportedResponseV1Data fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, B402SupportedResponseV1Data.class); + } + + /** + * Convert an instance of B402SupportedResponseV1Data to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SupportedResponseV2.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SupportedResponseV2.java new file mode 100644 index 0000000..dcbcbe1 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SupportedResponseV2.java @@ -0,0 +1,452 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** B402SupportedResponseV2 */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402SupportedResponseV2 { + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + @jakarta.annotation.Nullable + private String status; + + public static final String SERIALIZED_NAME_TYPE = "type"; + + @SerializedName(SERIALIZED_NAME_TYPE) + @jakarta.annotation.Nullable + private String type; + + public static final String SERIALIZED_NAME_CODE = "code"; + + @SerializedName(SERIALIZED_NAME_CODE) + @jakarta.annotation.Nullable + private String code; + + public static final String SERIALIZED_NAME_ERROR_DATA = "errorData"; + + @SerializedName(SERIALIZED_NAME_ERROR_DATA) + @jakarta.annotation.Nullable + private String errorData; + + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + @jakarta.annotation.Nullable + private B402SupportedResponseV2Data data; + + public static final String SERIALIZED_NAME_SUB_DATA = "subData"; + + @SerializedName(SERIALIZED_NAME_SUB_DATA) + @jakarta.annotation.Nullable + private Object subData; + + public static final String SERIALIZED_NAME_PARAMS = "params"; + + @SerializedName(SERIALIZED_NAME_PARAMS) + @jakarta.annotation.Nullable + private Object params; + + public B402SupportedResponseV2() {} + + public B402SupportedResponseV2 status(@jakarta.annotation.Nullable String status) { + this.status = status; + return this; + } + + /** + * Get status + * + * @return status + */ + @jakarta.annotation.Nullable + public String getStatus() { + return status; + } + + public void setStatus(@jakarta.annotation.Nullable String status) { + this.status = status; + } + + public B402SupportedResponseV2 type(@jakarta.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * + * @return type + */ + @jakarta.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@jakarta.annotation.Nullable String type) { + this.type = type; + } + + public B402SupportedResponseV2 code(@jakarta.annotation.Nullable String code) { + this.code = code; + return this; + } + + /** + * Get code + * + * @return code + */ + @jakarta.annotation.Nullable + public String getCode() { + return code; + } + + public void setCode(@jakarta.annotation.Nullable String code) { + this.code = code; + } + + public B402SupportedResponseV2 errorData(@jakarta.annotation.Nullable String errorData) { + this.errorData = errorData; + return this; + } + + /** + * Get errorData + * + * @return errorData + */ + @jakarta.annotation.Nullable + public String getErrorData() { + return errorData; + } + + public void setErrorData(@jakarta.annotation.Nullable String errorData) { + this.errorData = errorData; + } + + public B402SupportedResponseV2 data( + @jakarta.annotation.Nullable B402SupportedResponseV2Data data) { + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @jakarta.annotation.Nullable + @Valid + public B402SupportedResponseV2Data getData() { + return data; + } + + public void setData(@jakarta.annotation.Nullable B402SupportedResponseV2Data data) { + this.data = data; + } + + public B402SupportedResponseV2 subData(@jakarta.annotation.Nullable Object subData) { + this.subData = subData; + return this; + } + + /** + * Get subData + * + * @return subData + */ + @jakarta.annotation.Nullable + public Object getSubData() { + return subData; + } + + public void setSubData(@jakarta.annotation.Nullable Object subData) { + this.subData = subData; + } + + public B402SupportedResponseV2 params(@jakarta.annotation.Nullable Object params) { + this.params = params; + return this; + } + + /** + * Get params + * + * @return params + */ + @jakarta.annotation.Nullable + public Object getParams() { + return params; + } + + public void setParams(@jakarta.annotation.Nullable Object params) { + this.params = params; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402SupportedResponseV2 b402SupportedResponseV2 = (B402SupportedResponseV2) o; + return Objects.equals(this.status, b402SupportedResponseV2.status) + && Objects.equals(this.type, b402SupportedResponseV2.type) + && Objects.equals(this.code, b402SupportedResponseV2.code) + && Objects.equals(this.errorData, b402SupportedResponseV2.errorData) + && Objects.equals(this.data, b402SupportedResponseV2.data) + && Objects.equals(this.subData, b402SupportedResponseV2.subData) + && Objects.equals(this.params, b402SupportedResponseV2.params); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(status, type, code, errorData, data, subData, params); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402SupportedResponseV2 {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" errorData: ").append(toIndentedString(errorData)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" subData: ").append(toIndentedString(subData)).append("\n"); + sb.append(" params: ").append(toIndentedString(params)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object statusValue = getStatus(); + String statusValueAsString = ""; + statusValueAsString = statusValue.toString(); + sb.append("status=").append(urlEncode(statusValueAsString)).append(""); + Object typeValue = getType(); + String typeValueAsString = ""; + typeValueAsString = typeValue.toString(); + sb.append("type=").append(urlEncode(typeValueAsString)).append(""); + Object codeValue = getCode(); + String codeValueAsString = ""; + codeValueAsString = codeValue.toString(); + sb.append("code=").append(urlEncode(codeValueAsString)).append(""); + Object errorDataValue = getErrorData(); + String errorDataValueAsString = ""; + errorDataValueAsString = errorDataValue.toString(); + sb.append("errorData=").append(urlEncode(errorDataValueAsString)).append(""); + Object dataValue = getData(); + String dataValueAsString = ""; + dataValueAsString = dataValue.toString(); + sb.append("data=").append(urlEncode(dataValueAsString)).append(""); + Object subDataValue = getSubData(); + String subDataValueAsString = ""; + subDataValueAsString = subDataValue.toString(); + sb.append("subData=").append(urlEncode(subDataValueAsString)).append(""); + Object paramsValue = getParams(); + String paramsValueAsString = ""; + paramsValueAsString = paramsValue.toString(); + sb.append("params=").append(urlEncode(paramsValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("status"); + openapiFields.add("type"); + openapiFields.add("code"); + openapiFields.add("errorData"); + openapiFields.add("data"); + openapiFields.add("subData"); + openapiFields.add("params"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to B402SupportedResponseV2 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402SupportedResponseV2.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in B402SupportedResponseV2 is not found" + + " in the empty JSON string", + B402SupportedResponseV2.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) + && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `status` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("status").toString())); + } + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) + && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `type` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("type").toString())); + } + if ((jsonObj.get("code") != null && !jsonObj.get("code").isJsonNull()) + && !jsonObj.get("code").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `code` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("code").toString())); + } + if ((jsonObj.get("errorData") != null && !jsonObj.get("errorData").isJsonNull()) + && !jsonObj.get("errorData").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `errorData` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("errorData").toString())); + } + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + B402SupportedResponseV2Data.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402SupportedResponseV2.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'B402SupportedResponseV2' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(B402SupportedResponseV2.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, B402SupportedResponseV2 value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402SupportedResponseV2 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402SupportedResponseV2 given an JSON string + * + * @param jsonString JSON string + * @return An instance of B402SupportedResponseV2 + * @throws IOException if the JSON string is invalid with respect to B402SupportedResponseV2 + */ + public static B402SupportedResponseV2 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, B402SupportedResponseV2.class); + } + + /** + * Convert an instance of B402SupportedResponseV2 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SupportedResponseV2Data.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SupportedResponseV2Data.java new file mode 100644 index 0000000..51df1aa --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402SupportedResponseV2Data.java @@ -0,0 +1,355 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; +import org.hibernate.validator.constraints.*; + +/** B402SupportedResponseV2Data */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402SupportedResponseV2Data { + public static final String SERIALIZED_NAME_KINDS = "kinds"; + + @SerializedName(SERIALIZED_NAME_KINDS) + @jakarta.annotation.Nonnull + private List<@Valid B402SupportedDataV2KindsInner> kinds; + + public static final String SERIALIZED_NAME_EXTENSIONS = "extensions"; + + @SerializedName(SERIALIZED_NAME_EXTENSIONS) + @jakarta.annotation.Nonnull + private List extensions; + + public static final String SERIALIZED_NAME_SIGNERS = "signers"; + + @SerializedName(SERIALIZED_NAME_SIGNERS) + @jakarta.annotation.Nonnull + private Map> signers; + + public B402SupportedResponseV2Data() {} + + public B402SupportedResponseV2Data kinds( + @jakarta.annotation.Nonnull List<@Valid B402SupportedDataV2KindsInner> kinds) { + this.kinds = kinds; + return this; + } + + public B402SupportedResponseV2Data addKindsItem(B402SupportedDataV2KindsInner kindsItem) { + if (this.kinds == null) { + this.kinds = new ArrayList<>(); + } + this.kinds.add(kindsItem); + return this; + } + + /** + * Get kinds + * + * @return kinds + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public List<@Valid B402SupportedDataV2KindsInner> getKinds() { + return kinds; + } + + public void setKinds( + @jakarta.annotation.Nonnull List<@Valid B402SupportedDataV2KindsInner> kinds) { + this.kinds = kinds; + } + + public B402SupportedResponseV2Data extensions( + @jakarta.annotation.Nonnull List extensions) { + this.extensions = extensions; + return this; + } + + public B402SupportedResponseV2Data addExtensionsItem(String extensionsItem) { + if (this.extensions == null) { + this.extensions = new ArrayList<>(); + } + this.extensions.add(extensionsItem); + return this; + } + + /** + * Get extensions + * + * @return extensions + */ + @jakarta.annotation.Nonnull + @NotNull + public List getExtensions() { + return extensions; + } + + public void setExtensions(@jakarta.annotation.Nonnull List extensions) { + this.extensions = extensions; + } + + public B402SupportedResponseV2Data signers( + @jakarta.annotation.Nonnull Map> signers) { + this.signers = signers; + return this; + } + + public B402SupportedResponseV2Data putSignersItem(String key, List signersItem) { + if (this.signers == null) { + this.signers = new HashMap<>(); + } + this.signers.put(key, signersItem); + return this; + } + + /** + * Get signers + * + * @return signers + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public Map> getSigners() { + return signers; + } + + public void setSigners(@jakarta.annotation.Nonnull Map> signers) { + this.signers = signers; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402SupportedResponseV2Data b402SupportedResponseV2Data = (B402SupportedResponseV2Data) o; + return Objects.equals(this.kinds, b402SupportedResponseV2Data.kinds) + && Objects.equals(this.extensions, b402SupportedResponseV2Data.extensions) + && Objects.equals(this.signers, b402SupportedResponseV2Data.signers); + } + + @Override + public int hashCode() { + return Objects.hash(kinds, extensions, signers); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402SupportedResponseV2Data {\n"); + sb.append(" kinds: ").append(toIndentedString(kinds)).append("\n"); + sb.append(" extensions: ").append(toIndentedString(extensions)).append("\n"); + sb.append(" signers: ").append(toIndentedString(signers)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object kindsValue = getKinds(); + String kindsValueAsString = ""; + kindsValueAsString = + (String) + ((Collection) kindsValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("kinds=").append(urlEncode(kindsValueAsString)).append(""); + Object extensionsValue = getExtensions(); + String extensionsValueAsString = ""; + extensionsValueAsString = + (String) + ((Collection) extensionsValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("extensions=").append(urlEncode(extensionsValueAsString)).append(""); + Object signersValue = getSigners(); + String signersValueAsString = ""; + signersValueAsString = signersValue.toString(); + sb.append("signers=").append(urlEncode(signersValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("kinds"); + openapiFields.add("extensions"); + openapiFields.add("signers"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("kinds"); + openapiRequiredFields.add("extensions"); + openapiRequiredFields.add("signers"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * B402SupportedResponseV2Data + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402SupportedResponseV2Data.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in B402SupportedResponseV2Data is not" + + " found in the empty JSON string", + B402SupportedResponseV2Data.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : B402SupportedResponseV2Data.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("kinds").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `kinds` to be an array in the JSON string but got" + + " `%s`", + jsonObj.get("kinds").toString())); + } + + JsonArray jsonArraykinds = jsonObj.getAsJsonArray("kinds"); + // validate the required field `kinds` (array) + for (int i = 0; i < jsonArraykinds.size(); i++) { + B402SupportedDataV2KindsInner.validateJsonElement(jsonArraykinds.get(i)); + } + ; + // ensure the required json array is present + if (jsonObj.get("extensions") == null) { + throw new IllegalArgumentException( + "Expected the field `linkedContent` to be an array in the JSON string but got" + + " `null`"); + } else if (!jsonObj.get("extensions").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `extensions` to be an array in the JSON string but" + + " got `%s`", + jsonObj.get("extensions").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402SupportedResponseV2Data.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'B402SupportedResponseV2Data' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(B402SupportedResponseV2Data.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, B402SupportedResponseV2Data value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402SupportedResponseV2Data read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402SupportedResponseV2Data given an JSON string + * + * @param jsonString JSON string + * @return An instance of B402SupportedResponseV2Data + * @throws IOException if the JSON string is invalid with respect to B402SupportedResponseV2Data + */ + public static B402SupportedResponseV2Data fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, B402SupportedResponseV2Data.class); + } + + /** + * Convert an instance of B402SupportedResponseV2Data to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402VerifyDataV2.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402VerifyDataV2.java new file mode 100644 index 0000000..e60f781 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402VerifyDataV2.java @@ -0,0 +1,352 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** B402VerifyDataV2 */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402VerifyDataV2 { + public static final String SERIALIZED_NAME_IS_VALID = "isValid"; + + @SerializedName(SERIALIZED_NAME_IS_VALID) + @jakarta.annotation.Nonnull + private Boolean isValid; + + public static final String SERIALIZED_NAME_PAYER = "payer"; + + @SerializedName(SERIALIZED_NAME_PAYER) + @jakarta.annotation.Nullable + private String payer; + + public static final String SERIALIZED_NAME_INVALID_REASON = "invalidReason"; + + @SerializedName(SERIALIZED_NAME_INVALID_REASON) + @jakarta.annotation.Nullable + private String invalidReason; + + public static final String SERIALIZED_NAME_INVALID_MESSAGE = "invalidMessage"; + + @SerializedName(SERIALIZED_NAME_INVALID_MESSAGE) + @jakarta.annotation.Nullable + private String invalidMessage; + + public B402VerifyDataV2() {} + + public B402VerifyDataV2 isValid(@jakarta.annotation.Nonnull Boolean isValid) { + this.isValid = isValid; + return this; + } + + /** + * Get isValid + * + * @return isValid + */ + @jakarta.annotation.Nonnull + @NotNull + public Boolean getIsValid() { + return isValid; + } + + public void setIsValid(@jakarta.annotation.Nonnull Boolean isValid) { + this.isValid = isValid; + } + + public B402VerifyDataV2 payer(@jakarta.annotation.Nullable String payer) { + this.payer = payer; + return this; + } + + /** + * Get payer + * + * @return payer + */ + @jakarta.annotation.Nullable + public String getPayer() { + return payer; + } + + public void setPayer(@jakarta.annotation.Nullable String payer) { + this.payer = payer; + } + + public B402VerifyDataV2 invalidReason(@jakarta.annotation.Nullable String invalidReason) { + this.invalidReason = invalidReason; + return this; + } + + /** + * Get invalidReason + * + * @return invalidReason + */ + @jakarta.annotation.Nullable + public String getInvalidReason() { + return invalidReason; + } + + public void setInvalidReason(@jakarta.annotation.Nullable String invalidReason) { + this.invalidReason = invalidReason; + } + + public B402VerifyDataV2 invalidMessage(@jakarta.annotation.Nullable String invalidMessage) { + this.invalidMessage = invalidMessage; + return this; + } + + /** + * Get invalidMessage + * + * @return invalidMessage + */ + @jakarta.annotation.Nullable + public String getInvalidMessage() { + return invalidMessage; + } + + public void setInvalidMessage(@jakarta.annotation.Nullable String invalidMessage) { + this.invalidMessage = invalidMessage; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402VerifyDataV2 b402VerifyDataV2 = (B402VerifyDataV2) o; + return Objects.equals(this.isValid, b402VerifyDataV2.isValid) + && Objects.equals(this.payer, b402VerifyDataV2.payer) + && Objects.equals(this.invalidReason, b402VerifyDataV2.invalidReason) + && Objects.equals(this.invalidMessage, b402VerifyDataV2.invalidMessage); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(isValid, payer, invalidReason, invalidMessage); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402VerifyDataV2 {\n"); + sb.append(" isValid: ").append(toIndentedString(isValid)).append("\n"); + sb.append(" payer: ").append(toIndentedString(payer)).append("\n"); + sb.append(" invalidReason: ").append(toIndentedString(invalidReason)).append("\n"); + sb.append(" invalidMessage: ").append(toIndentedString(invalidMessage)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object isValidValue = getIsValid(); + String isValidValueAsString = ""; + isValidValueAsString = isValidValue.toString(); + sb.append("isValid=").append(urlEncode(isValidValueAsString)).append(""); + Object payerValue = getPayer(); + String payerValueAsString = ""; + payerValueAsString = payerValue.toString(); + sb.append("payer=").append(urlEncode(payerValueAsString)).append(""); + Object invalidReasonValue = getInvalidReason(); + String invalidReasonValueAsString = ""; + invalidReasonValueAsString = invalidReasonValue.toString(); + sb.append("invalidReason=").append(urlEncode(invalidReasonValueAsString)).append(""); + Object invalidMessageValue = getInvalidMessage(); + String invalidMessageValueAsString = ""; + invalidMessageValueAsString = invalidMessageValue.toString(); + sb.append("invalidMessage=").append(urlEncode(invalidMessageValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("isValid"); + openapiFields.add("payer"); + openapiFields.add("invalidReason"); + openapiFields.add("invalidMessage"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("isValid"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to B402VerifyDataV2 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402VerifyDataV2.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in B402VerifyDataV2 is not found in the" + + " empty JSON string", + B402VerifyDataV2.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : B402VerifyDataV2.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("payer") != null && !jsonObj.get("payer").isJsonNull()) + && !jsonObj.get("payer").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `payer` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("payer").toString())); + } + if ((jsonObj.get("invalidReason") != null && !jsonObj.get("invalidReason").isJsonNull()) + && !jsonObj.get("invalidReason").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `invalidReason` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("invalidReason").toString())); + } + if ((jsonObj.get("invalidMessage") != null && !jsonObj.get("invalidMessage").isJsonNull()) + && !jsonObj.get("invalidMessage").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `invalidMessage` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("invalidMessage").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402VerifyDataV2.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'B402VerifyDataV2' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(B402VerifyDataV2.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, B402VerifyDataV2 value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402VerifyDataV2 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402VerifyDataV2 given an JSON string + * + * @param jsonString JSON string + * @return An instance of B402VerifyDataV2 + * @throws IOException if the JSON string is invalid with respect to B402VerifyDataV2 + */ + public static B402VerifyDataV2 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, B402VerifyDataV2.class); + } + + /** + * Convert an instance of B402VerifyDataV2 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402VerifyEnvelopeV1.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402VerifyEnvelopeV1.java new file mode 100644 index 0000000..a6b0581 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402VerifyEnvelopeV1.java @@ -0,0 +1,218 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** B402VerifyEnvelopeV1 */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402VerifyEnvelopeV1 { + public static final String SERIALIZED_NAME_BODY = "body"; + + @SerializedName(SERIALIZED_NAME_BODY) + @jakarta.annotation.Nonnull + private B402VerifyEnvelopeV1Body body; + + public B402VerifyEnvelopeV1() {} + + public B402VerifyEnvelopeV1 body(@jakarta.annotation.Nonnull B402VerifyEnvelopeV1Body body) { + this.body = body; + return this; + } + + /** + * Get body + * + * @return body + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public B402VerifyEnvelopeV1Body getBody() { + return body; + } + + public void setBody(@jakarta.annotation.Nonnull B402VerifyEnvelopeV1Body body) { + this.body = body; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402VerifyEnvelopeV1 b402VerifyEnvelopeV1 = (B402VerifyEnvelopeV1) o; + return Objects.equals(this.body, b402VerifyEnvelopeV1.body); + } + + @Override + public int hashCode() { + return Objects.hash(body); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402VerifyEnvelopeV1 {\n"); + sb.append(" body: ").append(toIndentedString(body)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object bodyValue = getBody(); + String bodyValueAsString = ""; + bodyValueAsString = bodyValue.toString(); + sb.append("body=").append(urlEncode(bodyValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("body"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("body"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to B402VerifyEnvelopeV1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402VerifyEnvelopeV1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in B402VerifyEnvelopeV1 is not found in" + + " the empty JSON string", + B402VerifyEnvelopeV1.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : B402VerifyEnvelopeV1.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `body` + B402VerifyEnvelopeV1Body.validateJsonElement(jsonObj.get("body")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402VerifyEnvelopeV1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'B402VerifyEnvelopeV1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(B402VerifyEnvelopeV1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, B402VerifyEnvelopeV1 value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402VerifyEnvelopeV1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402VerifyEnvelopeV1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of B402VerifyEnvelopeV1 + * @throws IOException if the JSON string is invalid with respect to B402VerifyEnvelopeV1 + */ + public static B402VerifyEnvelopeV1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, B402VerifyEnvelopeV1.class); + } + + /** + * Convert an instance of B402VerifyEnvelopeV1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402VerifyEnvelopeV1Body.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402VerifyEnvelopeV1Body.java new file mode 100644 index 0000000..d44d738 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402VerifyEnvelopeV1Body.java @@ -0,0 +1,355 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** B402VerifyEnvelopeV1Body */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402VerifyEnvelopeV1Body { + /** Gets or Sets x402Version */ + @JsonAdapter(X402VersionEnum.Adapter.class) + public enum X402VersionEnum { + X402_VERSION_1(1); + + private Integer value; + + X402VersionEnum(Integer value) { + this.value = value; + } + + public Integer getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static X402VersionEnum fromValue(Integer value) { + for (X402VersionEnum b : X402VersionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final X402VersionEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public X402VersionEnum read(final JsonReader jsonReader) throws IOException { + Integer value = jsonReader.nextInt(); + return X402VersionEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + Integer value = jsonElement.getAsInt(); + X402VersionEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_X402_VERSION = "x402Version"; + + @SerializedName(SERIALIZED_NAME_X402_VERSION) + @jakarta.annotation.Nonnull + private X402VersionEnum x402Version; + + public static final String SERIALIZED_NAME_PAYMENT_PAYLOAD = "paymentPayload"; + + @SerializedName(SERIALIZED_NAME_PAYMENT_PAYLOAD) + @jakarta.annotation.Nonnull + private B402VerifyRequestV1PaymentPayload paymentPayload; + + public static final String SERIALIZED_NAME_PAYMENT_REQUIREMENTS = "paymentRequirements"; + + @SerializedName(SERIALIZED_NAME_PAYMENT_REQUIREMENTS) + @jakarta.annotation.Nonnull + private B402VerifyRequestV1PaymentRequirements paymentRequirements; + + public B402VerifyEnvelopeV1Body() {} + + public B402VerifyEnvelopeV1Body x402Version( + @jakarta.annotation.Nonnull X402VersionEnum x402Version) { + this.x402Version = x402Version; + return this; + } + + /** + * Get x402Version + * + * @return x402Version + */ + @jakarta.annotation.Nonnull + @NotNull + public X402VersionEnum getX402Version() { + return x402Version; + } + + public void setX402Version(@jakarta.annotation.Nonnull X402VersionEnum x402Version) { + this.x402Version = x402Version; + } + + public B402VerifyEnvelopeV1Body paymentPayload( + @jakarta.annotation.Nonnull B402VerifyRequestV1PaymentPayload paymentPayload) { + this.paymentPayload = paymentPayload; + return this; + } + + /** + * Get paymentPayload + * + * @return paymentPayload + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public B402VerifyRequestV1PaymentPayload getPaymentPayload() { + return paymentPayload; + } + + public void setPaymentPayload( + @jakarta.annotation.Nonnull B402VerifyRequestV1PaymentPayload paymentPayload) { + this.paymentPayload = paymentPayload; + } + + public B402VerifyEnvelopeV1Body paymentRequirements( + @jakarta.annotation.Nonnull + B402VerifyRequestV1PaymentRequirements paymentRequirements) { + this.paymentRequirements = paymentRequirements; + return this; + } + + /** + * Get paymentRequirements + * + * @return paymentRequirements + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public B402VerifyRequestV1PaymentRequirements getPaymentRequirements() { + return paymentRequirements; + } + + public void setPaymentRequirements( + @jakarta.annotation.Nonnull + B402VerifyRequestV1PaymentRequirements paymentRequirements) { + this.paymentRequirements = paymentRequirements; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402VerifyEnvelopeV1Body b402VerifyEnvelopeV1Body = (B402VerifyEnvelopeV1Body) o; + return Objects.equals(this.x402Version, b402VerifyEnvelopeV1Body.x402Version) + && Objects.equals(this.paymentPayload, b402VerifyEnvelopeV1Body.paymentPayload) + && Objects.equals( + this.paymentRequirements, b402VerifyEnvelopeV1Body.paymentRequirements); + } + + @Override + public int hashCode() { + return Objects.hash(x402Version, paymentPayload, paymentRequirements); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402VerifyEnvelopeV1Body {\n"); + sb.append(" x402Version: ").append(toIndentedString(x402Version)).append("\n"); + sb.append(" paymentPayload: ").append(toIndentedString(paymentPayload)).append("\n"); + sb.append(" paymentRequirements: ") + .append(toIndentedString(paymentRequirements)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object x402VersionValue = getX402Version(); + String x402VersionValueAsString = ""; + x402VersionValueAsString = x402VersionValue.toString(); + sb.append("x402Version=").append(urlEncode(x402VersionValueAsString)).append(""); + Object paymentPayloadValue = getPaymentPayload(); + String paymentPayloadValueAsString = ""; + paymentPayloadValueAsString = paymentPayloadValue.toString(); + sb.append("paymentPayload=").append(urlEncode(paymentPayloadValueAsString)).append(""); + Object paymentRequirementsValue = getPaymentRequirements(); + String paymentRequirementsValueAsString = ""; + paymentRequirementsValueAsString = paymentRequirementsValue.toString(); + sb.append("paymentRequirements=") + .append(urlEncode(paymentRequirementsValueAsString)) + .append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("x402Version"); + openapiFields.add("paymentPayload"); + openapiFields.add("paymentRequirements"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("x402Version"); + openapiRequiredFields.add("paymentPayload"); + openapiRequiredFields.add("paymentRequirements"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to B402VerifyEnvelopeV1Body + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402VerifyEnvelopeV1Body.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in B402VerifyEnvelopeV1Body is not found" + + " in the empty JSON string", + B402VerifyEnvelopeV1Body.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : B402VerifyEnvelopeV1Body.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `x402Version` + X402VersionEnum.validateJsonElement(jsonObj.get("x402Version")); + // validate the required field `paymentPayload` + B402VerifyRequestV1PaymentPayload.validateJsonElement(jsonObj.get("paymentPayload")); + // validate the required field `paymentRequirements` + B402VerifyRequestV1PaymentRequirements.validateJsonElement( + jsonObj.get("paymentRequirements")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402VerifyEnvelopeV1Body.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'B402VerifyEnvelopeV1Body' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(B402VerifyEnvelopeV1Body.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, B402VerifyEnvelopeV1Body value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402VerifyEnvelopeV1Body read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402VerifyEnvelopeV1Body given an JSON string + * + * @param jsonString JSON string + * @return An instance of B402VerifyEnvelopeV1Body + * @throws IOException if the JSON string is invalid with respect to B402VerifyEnvelopeV1Body + */ + public static B402VerifyEnvelopeV1Body fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, B402VerifyEnvelopeV1Body.class); + } + + /** + * Convert an instance of B402VerifyEnvelopeV1Body to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402VerifyEnvelopeV2.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402VerifyEnvelopeV2.java new file mode 100644 index 0000000..9ae26b9 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402VerifyEnvelopeV2.java @@ -0,0 +1,218 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** B402VerifyEnvelopeV2 */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402VerifyEnvelopeV2 { + public static final String SERIALIZED_NAME_BODY = "body"; + + @SerializedName(SERIALIZED_NAME_BODY) + @jakarta.annotation.Nonnull + private B402VerifyEnvelopeV2Body body; + + public B402VerifyEnvelopeV2() {} + + public B402VerifyEnvelopeV2 body(@jakarta.annotation.Nonnull B402VerifyEnvelopeV2Body body) { + this.body = body; + return this; + } + + /** + * Get body + * + * @return body + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public B402VerifyEnvelopeV2Body getBody() { + return body; + } + + public void setBody(@jakarta.annotation.Nonnull B402VerifyEnvelopeV2Body body) { + this.body = body; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402VerifyEnvelopeV2 b402VerifyEnvelopeV2 = (B402VerifyEnvelopeV2) o; + return Objects.equals(this.body, b402VerifyEnvelopeV2.body); + } + + @Override + public int hashCode() { + return Objects.hash(body); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402VerifyEnvelopeV2 {\n"); + sb.append(" body: ").append(toIndentedString(body)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object bodyValue = getBody(); + String bodyValueAsString = ""; + bodyValueAsString = bodyValue.toString(); + sb.append("body=").append(urlEncode(bodyValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("body"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("body"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to B402VerifyEnvelopeV2 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402VerifyEnvelopeV2.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in B402VerifyEnvelopeV2 is not found in" + + " the empty JSON string", + B402VerifyEnvelopeV2.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : B402VerifyEnvelopeV2.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `body` + B402VerifyEnvelopeV2Body.validateJsonElement(jsonObj.get("body")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402VerifyEnvelopeV2.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'B402VerifyEnvelopeV2' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(B402VerifyEnvelopeV2.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, B402VerifyEnvelopeV2 value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402VerifyEnvelopeV2 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402VerifyEnvelopeV2 given an JSON string + * + * @param jsonString JSON string + * @return An instance of B402VerifyEnvelopeV2 + * @throws IOException if the JSON string is invalid with respect to B402VerifyEnvelopeV2 + */ + public static B402VerifyEnvelopeV2 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, B402VerifyEnvelopeV2.class); + } + + /** + * Convert an instance of B402VerifyEnvelopeV2 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402VerifyEnvelopeV2Body.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402VerifyEnvelopeV2Body.java new file mode 100644 index 0000000..b014da2 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402VerifyEnvelopeV2Body.java @@ -0,0 +1,352 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** B402VerifyEnvelopeV2Body */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402VerifyEnvelopeV2Body { + /** Gets or Sets x402Version */ + @JsonAdapter(X402VersionEnum.Adapter.class) + public enum X402VersionEnum { + X402_VERSION_2(2); + + private Integer value; + + X402VersionEnum(Integer value) { + this.value = value; + } + + public Integer getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static X402VersionEnum fromValue(Integer value) { + for (X402VersionEnum b : X402VersionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final X402VersionEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public X402VersionEnum read(final JsonReader jsonReader) throws IOException { + Integer value = jsonReader.nextInt(); + return X402VersionEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + Integer value = jsonElement.getAsInt(); + X402VersionEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_X402_VERSION = "x402Version"; + + @SerializedName(SERIALIZED_NAME_X402_VERSION) + @jakarta.annotation.Nonnull + private X402VersionEnum x402Version; + + public static final String SERIALIZED_NAME_PAYMENT_PAYLOAD = "paymentPayload"; + + @SerializedName(SERIALIZED_NAME_PAYMENT_PAYLOAD) + @jakarta.annotation.Nonnull + private B402VerifyRequestV2PaymentPayload paymentPayload; + + public static final String SERIALIZED_NAME_PAYMENT_REQUIREMENTS = "paymentRequirements"; + + @SerializedName(SERIALIZED_NAME_PAYMENT_REQUIREMENTS) + @jakarta.annotation.Nonnull + private B402PaymentPayloadV2Accepted paymentRequirements; + + public B402VerifyEnvelopeV2Body() {} + + public B402VerifyEnvelopeV2Body x402Version( + @jakarta.annotation.Nonnull X402VersionEnum x402Version) { + this.x402Version = x402Version; + return this; + } + + /** + * Get x402Version + * + * @return x402Version + */ + @jakarta.annotation.Nonnull + @NotNull + public X402VersionEnum getX402Version() { + return x402Version; + } + + public void setX402Version(@jakarta.annotation.Nonnull X402VersionEnum x402Version) { + this.x402Version = x402Version; + } + + public B402VerifyEnvelopeV2Body paymentPayload( + @jakarta.annotation.Nonnull B402VerifyRequestV2PaymentPayload paymentPayload) { + this.paymentPayload = paymentPayload; + return this; + } + + /** + * Get paymentPayload + * + * @return paymentPayload + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public B402VerifyRequestV2PaymentPayload getPaymentPayload() { + return paymentPayload; + } + + public void setPaymentPayload( + @jakarta.annotation.Nonnull B402VerifyRequestV2PaymentPayload paymentPayload) { + this.paymentPayload = paymentPayload; + } + + public B402VerifyEnvelopeV2Body paymentRequirements( + @jakarta.annotation.Nonnull B402PaymentPayloadV2Accepted paymentRequirements) { + this.paymentRequirements = paymentRequirements; + return this; + } + + /** + * Get paymentRequirements + * + * @return paymentRequirements + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public B402PaymentPayloadV2Accepted getPaymentRequirements() { + return paymentRequirements; + } + + public void setPaymentRequirements( + @jakarta.annotation.Nonnull B402PaymentPayloadV2Accepted paymentRequirements) { + this.paymentRequirements = paymentRequirements; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402VerifyEnvelopeV2Body b402VerifyEnvelopeV2Body = (B402VerifyEnvelopeV2Body) o; + return Objects.equals(this.x402Version, b402VerifyEnvelopeV2Body.x402Version) + && Objects.equals(this.paymentPayload, b402VerifyEnvelopeV2Body.paymentPayload) + && Objects.equals( + this.paymentRequirements, b402VerifyEnvelopeV2Body.paymentRequirements); + } + + @Override + public int hashCode() { + return Objects.hash(x402Version, paymentPayload, paymentRequirements); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402VerifyEnvelopeV2Body {\n"); + sb.append(" x402Version: ").append(toIndentedString(x402Version)).append("\n"); + sb.append(" paymentPayload: ").append(toIndentedString(paymentPayload)).append("\n"); + sb.append(" paymentRequirements: ") + .append(toIndentedString(paymentRequirements)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object x402VersionValue = getX402Version(); + String x402VersionValueAsString = ""; + x402VersionValueAsString = x402VersionValue.toString(); + sb.append("x402Version=").append(urlEncode(x402VersionValueAsString)).append(""); + Object paymentPayloadValue = getPaymentPayload(); + String paymentPayloadValueAsString = ""; + paymentPayloadValueAsString = paymentPayloadValue.toString(); + sb.append("paymentPayload=").append(urlEncode(paymentPayloadValueAsString)).append(""); + Object paymentRequirementsValue = getPaymentRequirements(); + String paymentRequirementsValueAsString = ""; + paymentRequirementsValueAsString = paymentRequirementsValue.toString(); + sb.append("paymentRequirements=") + .append(urlEncode(paymentRequirementsValueAsString)) + .append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("x402Version"); + openapiFields.add("paymentPayload"); + openapiFields.add("paymentRequirements"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("x402Version"); + openapiRequiredFields.add("paymentPayload"); + openapiRequiredFields.add("paymentRequirements"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to B402VerifyEnvelopeV2Body + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402VerifyEnvelopeV2Body.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in B402VerifyEnvelopeV2Body is not found" + + " in the empty JSON string", + B402VerifyEnvelopeV2Body.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : B402VerifyEnvelopeV2Body.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `x402Version` + X402VersionEnum.validateJsonElement(jsonObj.get("x402Version")); + // validate the required field `paymentPayload` + B402VerifyRequestV2PaymentPayload.validateJsonElement(jsonObj.get("paymentPayload")); + // validate the required field `paymentRequirements` + B402PaymentPayloadV2Accepted.validateJsonElement(jsonObj.get("paymentRequirements")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402VerifyEnvelopeV2Body.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'B402VerifyEnvelopeV2Body' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(B402VerifyEnvelopeV2Body.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, B402VerifyEnvelopeV2Body value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402VerifyEnvelopeV2Body read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402VerifyEnvelopeV2Body given an JSON string + * + * @param jsonString JSON string + * @return An instance of B402VerifyEnvelopeV2Body + * @throws IOException if the JSON string is invalid with respect to B402VerifyEnvelopeV2Body + */ + public static B402VerifyEnvelopeV2Body fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, B402VerifyEnvelopeV2Body.class); + } + + /** + * Convert an instance of B402VerifyEnvelopeV2Body to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402VerifyRequestV1.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402VerifyRequestV1.java new file mode 100644 index 0000000..8a97d1b --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402VerifyRequestV1.java @@ -0,0 +1,354 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** B402VerifyRequestV1 */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402VerifyRequestV1 { + /** Gets or Sets x402Version */ + @JsonAdapter(X402VersionEnum.Adapter.class) + public enum X402VersionEnum { + X402_VERSION_1(1); + + private Integer value; + + X402VersionEnum(Integer value) { + this.value = value; + } + + public Integer getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static X402VersionEnum fromValue(Integer value) { + for (X402VersionEnum b : X402VersionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final X402VersionEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public X402VersionEnum read(final JsonReader jsonReader) throws IOException { + Integer value = jsonReader.nextInt(); + return X402VersionEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + Integer value = jsonElement.getAsInt(); + X402VersionEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_X402_VERSION = "x402Version"; + + @SerializedName(SERIALIZED_NAME_X402_VERSION) + @jakarta.annotation.Nonnull + private X402VersionEnum x402Version; + + public static final String SERIALIZED_NAME_PAYMENT_PAYLOAD = "paymentPayload"; + + @SerializedName(SERIALIZED_NAME_PAYMENT_PAYLOAD) + @jakarta.annotation.Nonnull + private B402VerifyRequestV1PaymentPayload paymentPayload; + + public static final String SERIALIZED_NAME_PAYMENT_REQUIREMENTS = "paymentRequirements"; + + @SerializedName(SERIALIZED_NAME_PAYMENT_REQUIREMENTS) + @jakarta.annotation.Nonnull + private B402VerifyRequestV1PaymentRequirements paymentRequirements; + + public B402VerifyRequestV1() {} + + public B402VerifyRequestV1 x402Version( + @jakarta.annotation.Nonnull X402VersionEnum x402Version) { + this.x402Version = x402Version; + return this; + } + + /** + * Get x402Version + * + * @return x402Version + */ + @jakarta.annotation.Nonnull + @NotNull + public X402VersionEnum getX402Version() { + return x402Version; + } + + public void setX402Version(@jakarta.annotation.Nonnull X402VersionEnum x402Version) { + this.x402Version = x402Version; + } + + public B402VerifyRequestV1 paymentPayload( + @jakarta.annotation.Nonnull B402VerifyRequestV1PaymentPayload paymentPayload) { + this.paymentPayload = paymentPayload; + return this; + } + + /** + * Get paymentPayload + * + * @return paymentPayload + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public B402VerifyRequestV1PaymentPayload getPaymentPayload() { + return paymentPayload; + } + + public void setPaymentPayload( + @jakarta.annotation.Nonnull B402VerifyRequestV1PaymentPayload paymentPayload) { + this.paymentPayload = paymentPayload; + } + + public B402VerifyRequestV1 paymentRequirements( + @jakarta.annotation.Nonnull + B402VerifyRequestV1PaymentRequirements paymentRequirements) { + this.paymentRequirements = paymentRequirements; + return this; + } + + /** + * Get paymentRequirements + * + * @return paymentRequirements + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public B402VerifyRequestV1PaymentRequirements getPaymentRequirements() { + return paymentRequirements; + } + + public void setPaymentRequirements( + @jakarta.annotation.Nonnull + B402VerifyRequestV1PaymentRequirements paymentRequirements) { + this.paymentRequirements = paymentRequirements; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402VerifyRequestV1 b402VerifyRequestV1 = (B402VerifyRequestV1) o; + return Objects.equals(this.x402Version, b402VerifyRequestV1.x402Version) + && Objects.equals(this.paymentPayload, b402VerifyRequestV1.paymentPayload) + && Objects.equals( + this.paymentRequirements, b402VerifyRequestV1.paymentRequirements); + } + + @Override + public int hashCode() { + return Objects.hash(x402Version, paymentPayload, paymentRequirements); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402VerifyRequestV1 {\n"); + sb.append(" x402Version: ").append(toIndentedString(x402Version)).append("\n"); + sb.append(" paymentPayload: ").append(toIndentedString(paymentPayload)).append("\n"); + sb.append(" paymentRequirements: ") + .append(toIndentedString(paymentRequirements)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object x402VersionValue = getX402Version(); + String x402VersionValueAsString = ""; + x402VersionValueAsString = x402VersionValue.toString(); + sb.append("x402Version=").append(urlEncode(x402VersionValueAsString)).append(""); + Object paymentPayloadValue = getPaymentPayload(); + String paymentPayloadValueAsString = ""; + paymentPayloadValueAsString = paymentPayloadValue.toString(); + sb.append("paymentPayload=").append(urlEncode(paymentPayloadValueAsString)).append(""); + Object paymentRequirementsValue = getPaymentRequirements(); + String paymentRequirementsValueAsString = ""; + paymentRequirementsValueAsString = paymentRequirementsValue.toString(); + sb.append("paymentRequirements=") + .append(urlEncode(paymentRequirementsValueAsString)) + .append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("x402Version"); + openapiFields.add("paymentPayload"); + openapiFields.add("paymentRequirements"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("x402Version"); + openapiRequiredFields.add("paymentPayload"); + openapiRequiredFields.add("paymentRequirements"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to B402VerifyRequestV1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402VerifyRequestV1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in B402VerifyRequestV1 is not found in" + + " the empty JSON string", + B402VerifyRequestV1.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : B402VerifyRequestV1.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `x402Version` + X402VersionEnum.validateJsonElement(jsonObj.get("x402Version")); + // validate the required field `paymentPayload` + B402VerifyRequestV1PaymentPayload.validateJsonElement(jsonObj.get("paymentPayload")); + // validate the required field `paymentRequirements` + B402VerifyRequestV1PaymentRequirements.validateJsonElement( + jsonObj.get("paymentRequirements")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402VerifyRequestV1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'B402VerifyRequestV1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(B402VerifyRequestV1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, B402VerifyRequestV1 value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402VerifyRequestV1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402VerifyRequestV1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of B402VerifyRequestV1 + * @throws IOException if the JSON string is invalid with respect to B402VerifyRequestV1 + */ + public static B402VerifyRequestV1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, B402VerifyRequestV1.class); + } + + /** + * Convert an instance of B402VerifyRequestV1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402VerifyRequestV1PaymentPayload.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402VerifyRequestV1PaymentPayload.java new file mode 100644 index 0000000..49a5902 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402VerifyRequestV1PaymentPayload.java @@ -0,0 +1,446 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** B402VerifyRequestV1PaymentPayload */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402VerifyRequestV1PaymentPayload { + /** Gets or Sets x402Version */ + @JsonAdapter(X402VersionEnum.Adapter.class) + public enum X402VersionEnum { + X402_VERSION_1(1); + + private Integer value; + + X402VersionEnum(Integer value) { + this.value = value; + } + + public Integer getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static X402VersionEnum fromValue(Integer value) { + for (X402VersionEnum b : X402VersionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final X402VersionEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public X402VersionEnum read(final JsonReader jsonReader) throws IOException { + Integer value = jsonReader.nextInt(); + return X402VersionEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + Integer value = jsonElement.getAsInt(); + X402VersionEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_X402_VERSION = "x402Version"; + + @SerializedName(SERIALIZED_NAME_X402_VERSION) + @jakarta.annotation.Nonnull + private X402VersionEnum x402Version; + + /** Gets or Sets scheme */ + @JsonAdapter(SchemeEnum.Adapter.class) + public enum SchemeEnum { + exact("exact"); + + private String value; + + SchemeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static SchemeEnum fromValue(String value) { + for (SchemeEnum b : SchemeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final SchemeEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public SchemeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return SchemeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + SchemeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_SCHEME = "scheme"; + + @SerializedName(SERIALIZED_NAME_SCHEME) + @jakarta.annotation.Nonnull + private SchemeEnum scheme; + + public static final String SERIALIZED_NAME_NETWORK = "network"; + + @SerializedName(SERIALIZED_NAME_NETWORK) + @jakarta.annotation.Nonnull + private String network; + + public static final String SERIALIZED_NAME_PAYLOAD = "payload"; + + @SerializedName(SERIALIZED_NAME_PAYLOAD) + @jakarta.annotation.Nonnull + private B402PaymentPayloadV2Payload payload; + + public B402VerifyRequestV1PaymentPayload() {} + + public B402VerifyRequestV1PaymentPayload x402Version( + @jakarta.annotation.Nonnull X402VersionEnum x402Version) { + this.x402Version = x402Version; + return this; + } + + /** + * Get x402Version + * + * @return x402Version + */ + @jakarta.annotation.Nonnull + @NotNull + public X402VersionEnum getX402Version() { + return x402Version; + } + + public void setX402Version(@jakarta.annotation.Nonnull X402VersionEnum x402Version) { + this.x402Version = x402Version; + } + + public B402VerifyRequestV1PaymentPayload scheme(@jakarta.annotation.Nonnull SchemeEnum scheme) { + this.scheme = scheme; + return this; + } + + /** + * Get scheme + * + * @return scheme + */ + @jakarta.annotation.Nonnull + @NotNull + public SchemeEnum getScheme() { + return scheme; + } + + public void setScheme(@jakarta.annotation.Nonnull SchemeEnum scheme) { + this.scheme = scheme; + } + + public B402VerifyRequestV1PaymentPayload network(@jakarta.annotation.Nonnull String network) { + this.network = network; + return this; + } + + /** + * Get network + * + * @return network + */ + @jakarta.annotation.Nonnull + @NotNull + public String getNetwork() { + return network; + } + + public void setNetwork(@jakarta.annotation.Nonnull String network) { + this.network = network; + } + + public B402VerifyRequestV1PaymentPayload payload( + @jakarta.annotation.Nonnull B402PaymentPayloadV2Payload payload) { + this.payload = payload; + return this; + } + + /** + * Get payload + * + * @return payload + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public B402PaymentPayloadV2Payload getPayload() { + return payload; + } + + public void setPayload(@jakarta.annotation.Nonnull B402PaymentPayloadV2Payload payload) { + this.payload = payload; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402VerifyRequestV1PaymentPayload b402VerifyRequestV1PaymentPayload = + (B402VerifyRequestV1PaymentPayload) o; + return Objects.equals(this.x402Version, b402VerifyRequestV1PaymentPayload.x402Version) + && Objects.equals(this.scheme, b402VerifyRequestV1PaymentPayload.scheme) + && Objects.equals(this.network, b402VerifyRequestV1PaymentPayload.network) + && Objects.equals(this.payload, b402VerifyRequestV1PaymentPayload.payload); + } + + @Override + public int hashCode() { + return Objects.hash(x402Version, scheme, network, payload); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402VerifyRequestV1PaymentPayload {\n"); + sb.append(" x402Version: ").append(toIndentedString(x402Version)).append("\n"); + sb.append(" scheme: ").append(toIndentedString(scheme)).append("\n"); + sb.append(" network: ").append(toIndentedString(network)).append("\n"); + sb.append(" payload: ").append(toIndentedString(payload)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object x402VersionValue = getX402Version(); + String x402VersionValueAsString = ""; + x402VersionValueAsString = x402VersionValue.toString(); + sb.append("x402Version=").append(urlEncode(x402VersionValueAsString)).append(""); + Object schemeValue = getScheme(); + String schemeValueAsString = ""; + schemeValueAsString = schemeValue.toString(); + sb.append("scheme=").append(urlEncode(schemeValueAsString)).append(""); + Object networkValue = getNetwork(); + String networkValueAsString = ""; + networkValueAsString = networkValue.toString(); + sb.append("network=").append(urlEncode(networkValueAsString)).append(""); + Object payloadValue = getPayload(); + String payloadValueAsString = ""; + payloadValueAsString = payloadValue.toString(); + sb.append("payload=").append(urlEncode(payloadValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("x402Version"); + openapiFields.add("scheme"); + openapiFields.add("network"); + openapiFields.add("payload"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("x402Version"); + openapiRequiredFields.add("scheme"); + openapiRequiredFields.add("network"); + openapiRequiredFields.add("payload"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * B402VerifyRequestV1PaymentPayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402VerifyRequestV1PaymentPayload.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in B402VerifyRequestV1PaymentPayload is" + + " not found in the empty JSON string", + B402VerifyRequestV1PaymentPayload.openapiRequiredFields + .toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : B402VerifyRequestV1PaymentPayload.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `x402Version` + X402VersionEnum.validateJsonElement(jsonObj.get("x402Version")); + if (!jsonObj.get("scheme").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `scheme` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("scheme").toString())); + } + // validate the required field `scheme` + SchemeEnum.validateJsonElement(jsonObj.get("scheme")); + if (!jsonObj.get("network").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `network` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("network").toString())); + } + // validate the required field `payload` + B402PaymentPayloadV2Payload.validateJsonElement(jsonObj.get("payload")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402VerifyRequestV1PaymentPayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'B402VerifyRequestV1PaymentPayload' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(B402VerifyRequestV1PaymentPayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, B402VerifyRequestV1PaymentPayload value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402VerifyRequestV1PaymentPayload read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402VerifyRequestV1PaymentPayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of B402VerifyRequestV1PaymentPayload + * @throws IOException if the JSON string is invalid with respect to + * B402VerifyRequestV1PaymentPayload + */ + public static B402VerifyRequestV1PaymentPayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, B402VerifyRequestV1PaymentPayload.class); + } + + /** + * Convert an instance of B402VerifyRequestV1PaymentPayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402VerifyRequestV1PaymentRequirements.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402VerifyRequestV1PaymentRequirements.java new file mode 100644 index 0000000..ce23ec5 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402VerifyRequestV1PaymentRequirements.java @@ -0,0 +1,709 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URI; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** B402VerifyRequestV1PaymentRequirements */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402VerifyRequestV1PaymentRequirements { + /** Gets or Sets scheme */ + @JsonAdapter(SchemeEnum.Adapter.class) + public enum SchemeEnum { + exact("exact"); + + private String value; + + SchemeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static SchemeEnum fromValue(String value) { + for (SchemeEnum b : SchemeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final SchemeEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public SchemeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return SchemeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + SchemeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_SCHEME = "scheme"; + + @SerializedName(SERIALIZED_NAME_SCHEME) + @jakarta.annotation.Nonnull + private SchemeEnum scheme; + + public static final String SERIALIZED_NAME_NETWORK = "network"; + + @SerializedName(SERIALIZED_NAME_NETWORK) + @jakarta.annotation.Nonnull + private String network; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + + @SerializedName(SERIALIZED_NAME_AMOUNT) + @jakarta.annotation.Nonnull + private String amount; + + public static final String SERIALIZED_NAME_RESOURCE = "resource"; + + @SerializedName(SERIALIZED_NAME_RESOURCE) + @jakarta.annotation.Nullable + private URI resource; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @jakarta.annotation.Nullable + private String description; + + public static final String SERIALIZED_NAME_PAY_TO = "payTo"; + + @SerializedName(SERIALIZED_NAME_PAY_TO) + @jakarta.annotation.Nonnull + private String payTo; + + public static final String SERIALIZED_NAME_ASSET = "asset"; + + @SerializedName(SERIALIZED_NAME_ASSET) + @jakarta.annotation.Nonnull + private String asset; + + public static final String SERIALIZED_NAME_MAX_TIMEOUT_SECONDS = "maxTimeoutSeconds"; + + @SerializedName(SERIALIZED_NAME_MAX_TIMEOUT_SECONDS) + @jakarta.annotation.Nonnull + private Integer maxTimeoutSeconds; + + public static final String SERIALIZED_NAME_MIME_TYPE = "mimeType"; + + @SerializedName(SERIALIZED_NAME_MIME_TYPE) + @jakarta.annotation.Nullable + private String mimeType; + + public static final String SERIALIZED_NAME_OUTPUT_SCHEMA = "outputSchema"; + + @SerializedName(SERIALIZED_NAME_OUTPUT_SCHEMA) + @jakarta.annotation.Nullable + private Map outputSchema; + + public static final String SERIALIZED_NAME_EXTRA = "extra"; + + @SerializedName(SERIALIZED_NAME_EXTRA) + @jakarta.annotation.Nullable + private B402PaymentKindV1Extra extra; + + public B402VerifyRequestV1PaymentRequirements() {} + + public B402VerifyRequestV1PaymentRequirements scheme( + @jakarta.annotation.Nonnull SchemeEnum scheme) { + this.scheme = scheme; + return this; + } + + /** + * Get scheme + * + * @return scheme + */ + @jakarta.annotation.Nonnull + @NotNull + public SchemeEnum getScheme() { + return scheme; + } + + public void setScheme(@jakarta.annotation.Nonnull SchemeEnum scheme) { + this.scheme = scheme; + } + + public B402VerifyRequestV1PaymentRequirements network( + @jakarta.annotation.Nonnull String network) { + this.network = network; + return this; + } + + /** + * Get network + * + * @return network + */ + @jakarta.annotation.Nonnull + @NotNull + public String getNetwork() { + return network; + } + + public void setNetwork(@jakarta.annotation.Nonnull String network) { + this.network = network; + } + + public B402VerifyRequestV1PaymentRequirements amount( + @jakarta.annotation.Nonnull String amount) { + this.amount = amount; + return this; + } + + /** + * Get amount + * + * @return amount + */ + @jakarta.annotation.Nonnull + @NotNull + public String getAmount() { + return amount; + } + + public void setAmount(@jakarta.annotation.Nonnull String amount) { + this.amount = amount; + } + + public B402VerifyRequestV1PaymentRequirements resource( + @jakarta.annotation.Nullable URI resource) { + this.resource = resource; + return this; + } + + /** + * Get resource + * + * @return resource + */ + @jakarta.annotation.Nullable + @Valid + public URI getResource() { + return resource; + } + + public void setResource(@jakarta.annotation.Nullable URI resource) { + this.resource = resource; + } + + public B402VerifyRequestV1PaymentRequirements description( + @jakarta.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Get description + * + * @return description + */ + @jakarta.annotation.Nullable + public String getDescription() { + return description; + } + + public void setDescription(@jakarta.annotation.Nullable String description) { + this.description = description; + } + + public B402VerifyRequestV1PaymentRequirements payTo(@jakarta.annotation.Nonnull String payTo) { + this.payTo = payTo; + return this; + } + + /** + * Get payTo + * + * @return payTo + */ + @jakarta.annotation.Nonnull + @NotNull + public String getPayTo() { + return payTo; + } + + public void setPayTo(@jakarta.annotation.Nonnull String payTo) { + this.payTo = payTo; + } + + public B402VerifyRequestV1PaymentRequirements asset(@jakarta.annotation.Nonnull String asset) { + this.asset = asset; + return this; + } + + /** + * Get asset + * + * @return asset + */ + @jakarta.annotation.Nonnull + @NotNull + public String getAsset() { + return asset; + } + + public void setAsset(@jakarta.annotation.Nonnull String asset) { + this.asset = asset; + } + + public B402VerifyRequestV1PaymentRequirements maxTimeoutSeconds( + @jakarta.annotation.Nonnull Integer maxTimeoutSeconds) { + this.maxTimeoutSeconds = maxTimeoutSeconds; + return this; + } + + /** + * Get maxTimeoutSeconds + * + * @return maxTimeoutSeconds + */ + @jakarta.annotation.Nonnull + @NotNull + public Integer getMaxTimeoutSeconds() { + return maxTimeoutSeconds; + } + + public void setMaxTimeoutSeconds(@jakarta.annotation.Nonnull Integer maxTimeoutSeconds) { + this.maxTimeoutSeconds = maxTimeoutSeconds; + } + + public B402VerifyRequestV1PaymentRequirements mimeType( + @jakarta.annotation.Nullable String mimeType) { + this.mimeType = mimeType; + return this; + } + + /** + * Get mimeType + * + * @return mimeType + */ + @jakarta.annotation.Nullable + public String getMimeType() { + return mimeType; + } + + public void setMimeType(@jakarta.annotation.Nullable String mimeType) { + this.mimeType = mimeType; + } + + public B402VerifyRequestV1PaymentRequirements outputSchema( + @jakarta.annotation.Nullable Map outputSchema) { + this.outputSchema = outputSchema; + return this; + } + + public B402VerifyRequestV1PaymentRequirements putOutputSchemaItem( + String key, Object outputSchemaItem) { + if (this.outputSchema == null) { + this.outputSchema = new HashMap<>(); + } + this.outputSchema.put(key, outputSchemaItem); + return this; + } + + /** + * Get outputSchema + * + * @return outputSchema + */ + @jakarta.annotation.Nullable + public Map getOutputSchema() { + return outputSchema; + } + + public void setOutputSchema(@jakarta.annotation.Nullable Map outputSchema) { + this.outputSchema = outputSchema; + } + + public B402VerifyRequestV1PaymentRequirements extra( + @jakarta.annotation.Nullable B402PaymentKindV1Extra extra) { + this.extra = extra; + return this; + } + + /** + * Get extra + * + * @return extra + */ + @jakarta.annotation.Nullable + @Valid + public B402PaymentKindV1Extra getExtra() { + return extra; + } + + public void setExtra(@jakarta.annotation.Nullable B402PaymentKindV1Extra extra) { + this.extra = extra; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402VerifyRequestV1PaymentRequirements b402VerifyRequestV1PaymentRequirements = + (B402VerifyRequestV1PaymentRequirements) o; + return Objects.equals(this.scheme, b402VerifyRequestV1PaymentRequirements.scheme) + && Objects.equals(this.network, b402VerifyRequestV1PaymentRequirements.network) + && Objects.equals(this.amount, b402VerifyRequestV1PaymentRequirements.amount) + && Objects.equals(this.resource, b402VerifyRequestV1PaymentRequirements.resource) + && Objects.equals( + this.description, b402VerifyRequestV1PaymentRequirements.description) + && Objects.equals(this.payTo, b402VerifyRequestV1PaymentRequirements.payTo) + && Objects.equals(this.asset, b402VerifyRequestV1PaymentRequirements.asset) + && Objects.equals( + this.maxTimeoutSeconds, + b402VerifyRequestV1PaymentRequirements.maxTimeoutSeconds) + && Objects.equals(this.mimeType, b402VerifyRequestV1PaymentRequirements.mimeType) + && Objects.equals( + this.outputSchema, b402VerifyRequestV1PaymentRequirements.outputSchema) + && Objects.equals(this.extra, b402VerifyRequestV1PaymentRequirements.extra); + } + + @Override + public int hashCode() { + return Objects.hash( + scheme, + network, + amount, + resource, + description, + payTo, + asset, + maxTimeoutSeconds, + mimeType, + outputSchema, + extra); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402VerifyRequestV1PaymentRequirements {\n"); + sb.append(" scheme: ").append(toIndentedString(scheme)).append("\n"); + sb.append(" network: ").append(toIndentedString(network)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" resource: ").append(toIndentedString(resource)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" payTo: ").append(toIndentedString(payTo)).append("\n"); + sb.append(" asset: ").append(toIndentedString(asset)).append("\n"); + sb.append(" maxTimeoutSeconds: ").append(toIndentedString(maxTimeoutSeconds)).append("\n"); + sb.append(" mimeType: ").append(toIndentedString(mimeType)).append("\n"); + sb.append(" outputSchema: ").append(toIndentedString(outputSchema)).append("\n"); + sb.append(" extra: ").append(toIndentedString(extra)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object schemeValue = getScheme(); + String schemeValueAsString = ""; + schemeValueAsString = schemeValue.toString(); + sb.append("scheme=").append(urlEncode(schemeValueAsString)).append(""); + Object networkValue = getNetwork(); + String networkValueAsString = ""; + networkValueAsString = networkValue.toString(); + sb.append("network=").append(urlEncode(networkValueAsString)).append(""); + Object amountValue = getAmount(); + String amountValueAsString = ""; + amountValueAsString = amountValue.toString(); + sb.append("amount=").append(urlEncode(amountValueAsString)).append(""); + Object resourceValue = getResource(); + String resourceValueAsString = ""; + resourceValueAsString = resourceValue.toString(); + sb.append("resource=").append(urlEncode(resourceValueAsString)).append(""); + Object descriptionValue = getDescription(); + String descriptionValueAsString = ""; + descriptionValueAsString = descriptionValue.toString(); + sb.append("description=").append(urlEncode(descriptionValueAsString)).append(""); + Object payToValue = getPayTo(); + String payToValueAsString = ""; + payToValueAsString = payToValue.toString(); + sb.append("payTo=").append(urlEncode(payToValueAsString)).append(""); + Object assetValue = getAsset(); + String assetValueAsString = ""; + assetValueAsString = assetValue.toString(); + sb.append("asset=").append(urlEncode(assetValueAsString)).append(""); + Object maxTimeoutSecondsValue = getMaxTimeoutSeconds(); + String maxTimeoutSecondsValueAsString = ""; + maxTimeoutSecondsValueAsString = maxTimeoutSecondsValue.toString(); + sb.append("maxTimeoutSeconds=") + .append(urlEncode(maxTimeoutSecondsValueAsString)) + .append(""); + Object mimeTypeValue = getMimeType(); + String mimeTypeValueAsString = ""; + mimeTypeValueAsString = mimeTypeValue.toString(); + sb.append("mimeType=").append(urlEncode(mimeTypeValueAsString)).append(""); + Object outputSchemaValue = getOutputSchema(); + String outputSchemaValueAsString = ""; + outputSchemaValueAsString = outputSchemaValue.toString(); + sb.append("outputSchema=").append(urlEncode(outputSchemaValueAsString)).append(""); + Object extraValue = getExtra(); + String extraValueAsString = ""; + extraValueAsString = extraValue.toString(); + sb.append("extra=").append(urlEncode(extraValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("scheme"); + openapiFields.add("network"); + openapiFields.add("amount"); + openapiFields.add("resource"); + openapiFields.add("description"); + openapiFields.add("payTo"); + openapiFields.add("asset"); + openapiFields.add("maxTimeoutSeconds"); + openapiFields.add("mimeType"); + openapiFields.add("outputSchema"); + openapiFields.add("extra"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("scheme"); + openapiRequiredFields.add("network"); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("payTo"); + openapiRequiredFields.add("asset"); + openapiRequiredFields.add("maxTimeoutSeconds"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * B402VerifyRequestV1PaymentRequirements + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402VerifyRequestV1PaymentRequirements.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in B402VerifyRequestV1PaymentRequirements" + + " is not found in the empty JSON string", + B402VerifyRequestV1PaymentRequirements.openapiRequiredFields + .toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : B402VerifyRequestV1PaymentRequirements.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("scheme").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `scheme` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("scheme").toString())); + } + // validate the required field `scheme` + SchemeEnum.validateJsonElement(jsonObj.get("scheme")); + if (!jsonObj.get("network").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `network` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("network").toString())); + } + if (!jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `amount` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("amount").toString())); + } + if ((jsonObj.get("resource") != null && !jsonObj.get("resource").isJsonNull()) + && !jsonObj.get("resource").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `resource` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("resource").toString())); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) + && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `description` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("description").toString())); + } + if (!jsonObj.get("payTo").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `payTo` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("payTo").toString())); + } + if (!jsonObj.get("asset").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `asset` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("asset").toString())); + } + if ((jsonObj.get("mimeType") != null && !jsonObj.get("mimeType").isJsonNull()) + && !jsonObj.get("mimeType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `mimeType` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("mimeType").toString())); + } + // validate the optional field `extra` + if (jsonObj.get("extra") != null && !jsonObj.get("extra").isJsonNull()) { + B402PaymentKindV1Extra.validateJsonElement(jsonObj.get("extra")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402VerifyRequestV1PaymentRequirements.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'B402VerifyRequestV1PaymentRequirements' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(B402VerifyRequestV1PaymentRequirements.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, B402VerifyRequestV1PaymentRequirements value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402VerifyRequestV1PaymentRequirements read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402VerifyRequestV1PaymentRequirements given an JSON string + * + * @param jsonString JSON string + * @return An instance of B402VerifyRequestV1PaymentRequirements + * @throws IOException if the JSON string is invalid with respect to + * B402VerifyRequestV1PaymentRequirements + */ + public static B402VerifyRequestV1PaymentRequirements fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, B402VerifyRequestV1PaymentRequirements.class); + } + + /** + * Convert an instance of B402VerifyRequestV1PaymentRequirements to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402VerifyRequestV2.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402VerifyRequestV2.java new file mode 100644 index 0000000..2610551 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402VerifyRequestV2.java @@ -0,0 +1,351 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** B402VerifyRequestV2 */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402VerifyRequestV2 { + /** Gets or Sets x402Version */ + @JsonAdapter(X402VersionEnum.Adapter.class) + public enum X402VersionEnum { + X402_VERSION_2(2); + + private Integer value; + + X402VersionEnum(Integer value) { + this.value = value; + } + + public Integer getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static X402VersionEnum fromValue(Integer value) { + for (X402VersionEnum b : X402VersionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final X402VersionEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public X402VersionEnum read(final JsonReader jsonReader) throws IOException { + Integer value = jsonReader.nextInt(); + return X402VersionEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + Integer value = jsonElement.getAsInt(); + X402VersionEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_X402_VERSION = "x402Version"; + + @SerializedName(SERIALIZED_NAME_X402_VERSION) + @jakarta.annotation.Nonnull + private X402VersionEnum x402Version; + + public static final String SERIALIZED_NAME_PAYMENT_PAYLOAD = "paymentPayload"; + + @SerializedName(SERIALIZED_NAME_PAYMENT_PAYLOAD) + @jakarta.annotation.Nonnull + private B402VerifyRequestV2PaymentPayload paymentPayload; + + public static final String SERIALIZED_NAME_PAYMENT_REQUIREMENTS = "paymentRequirements"; + + @SerializedName(SERIALIZED_NAME_PAYMENT_REQUIREMENTS) + @jakarta.annotation.Nonnull + private B402PaymentPayloadV2Accepted paymentRequirements; + + public B402VerifyRequestV2() {} + + public B402VerifyRequestV2 x402Version( + @jakarta.annotation.Nonnull X402VersionEnum x402Version) { + this.x402Version = x402Version; + return this; + } + + /** + * Get x402Version + * + * @return x402Version + */ + @jakarta.annotation.Nonnull + @NotNull + public X402VersionEnum getX402Version() { + return x402Version; + } + + public void setX402Version(@jakarta.annotation.Nonnull X402VersionEnum x402Version) { + this.x402Version = x402Version; + } + + public B402VerifyRequestV2 paymentPayload( + @jakarta.annotation.Nonnull B402VerifyRequestV2PaymentPayload paymentPayload) { + this.paymentPayload = paymentPayload; + return this; + } + + /** + * Get paymentPayload + * + * @return paymentPayload + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public B402VerifyRequestV2PaymentPayload getPaymentPayload() { + return paymentPayload; + } + + public void setPaymentPayload( + @jakarta.annotation.Nonnull B402VerifyRequestV2PaymentPayload paymentPayload) { + this.paymentPayload = paymentPayload; + } + + public B402VerifyRequestV2 paymentRequirements( + @jakarta.annotation.Nonnull B402PaymentPayloadV2Accepted paymentRequirements) { + this.paymentRequirements = paymentRequirements; + return this; + } + + /** + * Get paymentRequirements + * + * @return paymentRequirements + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public B402PaymentPayloadV2Accepted getPaymentRequirements() { + return paymentRequirements; + } + + public void setPaymentRequirements( + @jakarta.annotation.Nonnull B402PaymentPayloadV2Accepted paymentRequirements) { + this.paymentRequirements = paymentRequirements; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402VerifyRequestV2 b402VerifyRequestV2 = (B402VerifyRequestV2) o; + return Objects.equals(this.x402Version, b402VerifyRequestV2.x402Version) + && Objects.equals(this.paymentPayload, b402VerifyRequestV2.paymentPayload) + && Objects.equals( + this.paymentRequirements, b402VerifyRequestV2.paymentRequirements); + } + + @Override + public int hashCode() { + return Objects.hash(x402Version, paymentPayload, paymentRequirements); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402VerifyRequestV2 {\n"); + sb.append(" x402Version: ").append(toIndentedString(x402Version)).append("\n"); + sb.append(" paymentPayload: ").append(toIndentedString(paymentPayload)).append("\n"); + sb.append(" paymentRequirements: ") + .append(toIndentedString(paymentRequirements)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object x402VersionValue = getX402Version(); + String x402VersionValueAsString = ""; + x402VersionValueAsString = x402VersionValue.toString(); + sb.append("x402Version=").append(urlEncode(x402VersionValueAsString)).append(""); + Object paymentPayloadValue = getPaymentPayload(); + String paymentPayloadValueAsString = ""; + paymentPayloadValueAsString = paymentPayloadValue.toString(); + sb.append("paymentPayload=").append(urlEncode(paymentPayloadValueAsString)).append(""); + Object paymentRequirementsValue = getPaymentRequirements(); + String paymentRequirementsValueAsString = ""; + paymentRequirementsValueAsString = paymentRequirementsValue.toString(); + sb.append("paymentRequirements=") + .append(urlEncode(paymentRequirementsValueAsString)) + .append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("x402Version"); + openapiFields.add("paymentPayload"); + openapiFields.add("paymentRequirements"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("x402Version"); + openapiRequiredFields.add("paymentPayload"); + openapiRequiredFields.add("paymentRequirements"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to B402VerifyRequestV2 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402VerifyRequestV2.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in B402VerifyRequestV2 is not found in" + + " the empty JSON string", + B402VerifyRequestV2.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : B402VerifyRequestV2.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `x402Version` + X402VersionEnum.validateJsonElement(jsonObj.get("x402Version")); + // validate the required field `paymentPayload` + B402VerifyRequestV2PaymentPayload.validateJsonElement(jsonObj.get("paymentPayload")); + // validate the required field `paymentRequirements` + B402PaymentPayloadV2Accepted.validateJsonElement(jsonObj.get("paymentRequirements")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402VerifyRequestV2.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'B402VerifyRequestV2' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(B402VerifyRequestV2.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, B402VerifyRequestV2 value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402VerifyRequestV2 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402VerifyRequestV2 given an JSON string + * + * @param jsonString JSON string + * @return An instance of B402VerifyRequestV2 + * @throws IOException if the JSON string is invalid with respect to B402VerifyRequestV2 + */ + public static B402VerifyRequestV2 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, B402VerifyRequestV2.class); + } + + /** + * Convert an instance of B402VerifyRequestV2 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402VerifyRequestV2PaymentPayload.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402VerifyRequestV2PaymentPayload.java new file mode 100644 index 0000000..6fb4c46 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402VerifyRequestV2PaymentPayload.java @@ -0,0 +1,424 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** B402VerifyRequestV2PaymentPayload */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402VerifyRequestV2PaymentPayload { + /** Gets or Sets x402Version */ + @JsonAdapter(X402VersionEnum.Adapter.class) + public enum X402VersionEnum { + X402_VERSION_2(2); + + private Integer value; + + X402VersionEnum(Integer value) { + this.value = value; + } + + public Integer getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static X402VersionEnum fromValue(Integer value) { + for (X402VersionEnum b : X402VersionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final X402VersionEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public X402VersionEnum read(final JsonReader jsonReader) throws IOException { + Integer value = jsonReader.nextInt(); + return X402VersionEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + Integer value = jsonElement.getAsInt(); + X402VersionEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_X402_VERSION = "x402Version"; + + @SerializedName(SERIALIZED_NAME_X402_VERSION) + @jakarta.annotation.Nonnull + private X402VersionEnum x402Version; + + public static final String SERIALIZED_NAME_RESOURCE = "resource"; + + @SerializedName(SERIALIZED_NAME_RESOURCE) + @jakarta.annotation.Nonnull + private B402PaymentPayloadV2Resource resource; + + public static final String SERIALIZED_NAME_ACCEPTED = "accepted"; + + @SerializedName(SERIALIZED_NAME_ACCEPTED) + @jakarta.annotation.Nonnull + private B402PaymentPayloadV2Accepted accepted; + + public static final String SERIALIZED_NAME_PAYLOAD = "payload"; + + @SerializedName(SERIALIZED_NAME_PAYLOAD) + @jakarta.annotation.Nonnull + private B402PaymentPayloadV2Payload payload; + + public static final String SERIALIZED_NAME_EXTENSIONS = "extensions"; + + @SerializedName(SERIALIZED_NAME_EXTENSIONS) + @jakarta.annotation.Nullable + private B402PaymentPayloadV2Extensions extensions; + + public B402VerifyRequestV2PaymentPayload() {} + + public B402VerifyRequestV2PaymentPayload x402Version( + @jakarta.annotation.Nonnull X402VersionEnum x402Version) { + this.x402Version = x402Version; + return this; + } + + /** + * Get x402Version + * + * @return x402Version + */ + @jakarta.annotation.Nonnull + @NotNull + public X402VersionEnum getX402Version() { + return x402Version; + } + + public void setX402Version(@jakarta.annotation.Nonnull X402VersionEnum x402Version) { + this.x402Version = x402Version; + } + + public B402VerifyRequestV2PaymentPayload resource( + @jakarta.annotation.Nonnull B402PaymentPayloadV2Resource resource) { + this.resource = resource; + return this; + } + + /** + * Get resource + * + * @return resource + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public B402PaymentPayloadV2Resource getResource() { + return resource; + } + + public void setResource(@jakarta.annotation.Nonnull B402PaymentPayloadV2Resource resource) { + this.resource = resource; + } + + public B402VerifyRequestV2PaymentPayload accepted( + @jakarta.annotation.Nonnull B402PaymentPayloadV2Accepted accepted) { + this.accepted = accepted; + return this; + } + + /** + * Get accepted + * + * @return accepted + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public B402PaymentPayloadV2Accepted getAccepted() { + return accepted; + } + + public void setAccepted(@jakarta.annotation.Nonnull B402PaymentPayloadV2Accepted accepted) { + this.accepted = accepted; + } + + public B402VerifyRequestV2PaymentPayload payload( + @jakarta.annotation.Nonnull B402PaymentPayloadV2Payload payload) { + this.payload = payload; + return this; + } + + /** + * Get payload + * + * @return payload + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public B402PaymentPayloadV2Payload getPayload() { + return payload; + } + + public void setPayload(@jakarta.annotation.Nonnull B402PaymentPayloadV2Payload payload) { + this.payload = payload; + } + + public B402VerifyRequestV2PaymentPayload extensions( + @jakarta.annotation.Nullable B402PaymentPayloadV2Extensions extensions) { + this.extensions = extensions; + return this; + } + + /** + * Get extensions + * + * @return extensions + */ + @jakarta.annotation.Nullable + @Valid + public B402PaymentPayloadV2Extensions getExtensions() { + return extensions; + } + + public void setExtensions( + @jakarta.annotation.Nullable B402PaymentPayloadV2Extensions extensions) { + this.extensions = extensions; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402VerifyRequestV2PaymentPayload b402VerifyRequestV2PaymentPayload = + (B402VerifyRequestV2PaymentPayload) o; + return Objects.equals(this.x402Version, b402VerifyRequestV2PaymentPayload.x402Version) + && Objects.equals(this.resource, b402VerifyRequestV2PaymentPayload.resource) + && Objects.equals(this.accepted, b402VerifyRequestV2PaymentPayload.accepted) + && Objects.equals(this.payload, b402VerifyRequestV2PaymentPayload.payload) + && Objects.equals(this.extensions, b402VerifyRequestV2PaymentPayload.extensions); + } + + @Override + public int hashCode() { + return Objects.hash(x402Version, resource, accepted, payload, extensions); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402VerifyRequestV2PaymentPayload {\n"); + sb.append(" x402Version: ").append(toIndentedString(x402Version)).append("\n"); + sb.append(" resource: ").append(toIndentedString(resource)).append("\n"); + sb.append(" accepted: ").append(toIndentedString(accepted)).append("\n"); + sb.append(" payload: ").append(toIndentedString(payload)).append("\n"); + sb.append(" extensions: ").append(toIndentedString(extensions)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object x402VersionValue = getX402Version(); + String x402VersionValueAsString = ""; + x402VersionValueAsString = x402VersionValue.toString(); + sb.append("x402Version=").append(urlEncode(x402VersionValueAsString)).append(""); + Object resourceValue = getResource(); + String resourceValueAsString = ""; + resourceValueAsString = resourceValue.toString(); + sb.append("resource=").append(urlEncode(resourceValueAsString)).append(""); + Object acceptedValue = getAccepted(); + String acceptedValueAsString = ""; + acceptedValueAsString = acceptedValue.toString(); + sb.append("accepted=").append(urlEncode(acceptedValueAsString)).append(""); + Object payloadValue = getPayload(); + String payloadValueAsString = ""; + payloadValueAsString = payloadValue.toString(); + sb.append("payload=").append(urlEncode(payloadValueAsString)).append(""); + Object extensionsValue = getExtensions(); + String extensionsValueAsString = ""; + extensionsValueAsString = extensionsValue.toString(); + sb.append("extensions=").append(urlEncode(extensionsValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("x402Version"); + openapiFields.add("resource"); + openapiFields.add("accepted"); + openapiFields.add("payload"); + openapiFields.add("extensions"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("x402Version"); + openapiRequiredFields.add("resource"); + openapiRequiredFields.add("accepted"); + openapiRequiredFields.add("payload"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * B402VerifyRequestV2PaymentPayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402VerifyRequestV2PaymentPayload.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in B402VerifyRequestV2PaymentPayload is" + + " not found in the empty JSON string", + B402VerifyRequestV2PaymentPayload.openapiRequiredFields + .toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : B402VerifyRequestV2PaymentPayload.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `x402Version` + X402VersionEnum.validateJsonElement(jsonObj.get("x402Version")); + // validate the required field `resource` + B402PaymentPayloadV2Resource.validateJsonElement(jsonObj.get("resource")); + // validate the required field `accepted` + B402PaymentPayloadV2Accepted.validateJsonElement(jsonObj.get("accepted")); + // validate the required field `payload` + B402PaymentPayloadV2Payload.validateJsonElement(jsonObj.get("payload")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402VerifyRequestV2PaymentPayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'B402VerifyRequestV2PaymentPayload' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(B402VerifyRequestV2PaymentPayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, B402VerifyRequestV2PaymentPayload value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402VerifyRequestV2PaymentPayload read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402VerifyRequestV2PaymentPayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of B402VerifyRequestV2PaymentPayload + * @throws IOException if the JSON string is invalid with respect to + * B402VerifyRequestV2PaymentPayload + */ + public static B402VerifyRequestV2PaymentPayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, B402VerifyRequestV2PaymentPayload.class); + } + + /** + * Convert an instance of B402VerifyRequestV2PaymentPayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402VerifyResponseV1.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402VerifyResponseV1.java new file mode 100644 index 0000000..487c9de --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402VerifyResponseV1.java @@ -0,0 +1,450 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** B402VerifyResponseV1 */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402VerifyResponseV1 { + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + @jakarta.annotation.Nullable + private String status; + + public static final String SERIALIZED_NAME_TYPE = "type"; + + @SerializedName(SERIALIZED_NAME_TYPE) + @jakarta.annotation.Nullable + private String type; + + public static final String SERIALIZED_NAME_CODE = "code"; + + @SerializedName(SERIALIZED_NAME_CODE) + @jakarta.annotation.Nullable + private String code; + + public static final String SERIALIZED_NAME_ERROR_DATA = "errorData"; + + @SerializedName(SERIALIZED_NAME_ERROR_DATA) + @jakarta.annotation.Nullable + private String errorData; + + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + @jakarta.annotation.Nullable + private B402VerifyResponseV2Data data; + + public static final String SERIALIZED_NAME_SUB_DATA = "subData"; + + @SerializedName(SERIALIZED_NAME_SUB_DATA) + @jakarta.annotation.Nullable + private Object subData; + + public static final String SERIALIZED_NAME_PARAMS = "params"; + + @SerializedName(SERIALIZED_NAME_PARAMS) + @jakarta.annotation.Nullable + private Object params; + + public B402VerifyResponseV1() {} + + public B402VerifyResponseV1 status(@jakarta.annotation.Nullable String status) { + this.status = status; + return this; + } + + /** + * Get status + * + * @return status + */ + @jakarta.annotation.Nullable + public String getStatus() { + return status; + } + + public void setStatus(@jakarta.annotation.Nullable String status) { + this.status = status; + } + + public B402VerifyResponseV1 type(@jakarta.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * + * @return type + */ + @jakarta.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@jakarta.annotation.Nullable String type) { + this.type = type; + } + + public B402VerifyResponseV1 code(@jakarta.annotation.Nullable String code) { + this.code = code; + return this; + } + + /** + * Get code + * + * @return code + */ + @jakarta.annotation.Nullable + public String getCode() { + return code; + } + + public void setCode(@jakarta.annotation.Nullable String code) { + this.code = code; + } + + public B402VerifyResponseV1 errorData(@jakarta.annotation.Nullable String errorData) { + this.errorData = errorData; + return this; + } + + /** + * Get errorData + * + * @return errorData + */ + @jakarta.annotation.Nullable + public String getErrorData() { + return errorData; + } + + public void setErrorData(@jakarta.annotation.Nullable String errorData) { + this.errorData = errorData; + } + + public B402VerifyResponseV1 data(@jakarta.annotation.Nullable B402VerifyResponseV2Data data) { + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @jakarta.annotation.Nullable + @Valid + public B402VerifyResponseV2Data getData() { + return data; + } + + public void setData(@jakarta.annotation.Nullable B402VerifyResponseV2Data data) { + this.data = data; + } + + public B402VerifyResponseV1 subData(@jakarta.annotation.Nullable Object subData) { + this.subData = subData; + return this; + } + + /** + * Get subData + * + * @return subData + */ + @jakarta.annotation.Nullable + public Object getSubData() { + return subData; + } + + public void setSubData(@jakarta.annotation.Nullable Object subData) { + this.subData = subData; + } + + public B402VerifyResponseV1 params(@jakarta.annotation.Nullable Object params) { + this.params = params; + return this; + } + + /** + * Get params + * + * @return params + */ + @jakarta.annotation.Nullable + public Object getParams() { + return params; + } + + public void setParams(@jakarta.annotation.Nullable Object params) { + this.params = params; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402VerifyResponseV1 b402VerifyResponseV1 = (B402VerifyResponseV1) o; + return Objects.equals(this.status, b402VerifyResponseV1.status) + && Objects.equals(this.type, b402VerifyResponseV1.type) + && Objects.equals(this.code, b402VerifyResponseV1.code) + && Objects.equals(this.errorData, b402VerifyResponseV1.errorData) + && Objects.equals(this.data, b402VerifyResponseV1.data) + && Objects.equals(this.subData, b402VerifyResponseV1.subData) + && Objects.equals(this.params, b402VerifyResponseV1.params); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(status, type, code, errorData, data, subData, params); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402VerifyResponseV1 {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" errorData: ").append(toIndentedString(errorData)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" subData: ").append(toIndentedString(subData)).append("\n"); + sb.append(" params: ").append(toIndentedString(params)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object statusValue = getStatus(); + String statusValueAsString = ""; + statusValueAsString = statusValue.toString(); + sb.append("status=").append(urlEncode(statusValueAsString)).append(""); + Object typeValue = getType(); + String typeValueAsString = ""; + typeValueAsString = typeValue.toString(); + sb.append("type=").append(urlEncode(typeValueAsString)).append(""); + Object codeValue = getCode(); + String codeValueAsString = ""; + codeValueAsString = codeValue.toString(); + sb.append("code=").append(urlEncode(codeValueAsString)).append(""); + Object errorDataValue = getErrorData(); + String errorDataValueAsString = ""; + errorDataValueAsString = errorDataValue.toString(); + sb.append("errorData=").append(urlEncode(errorDataValueAsString)).append(""); + Object dataValue = getData(); + String dataValueAsString = ""; + dataValueAsString = dataValue.toString(); + sb.append("data=").append(urlEncode(dataValueAsString)).append(""); + Object subDataValue = getSubData(); + String subDataValueAsString = ""; + subDataValueAsString = subDataValue.toString(); + sb.append("subData=").append(urlEncode(subDataValueAsString)).append(""); + Object paramsValue = getParams(); + String paramsValueAsString = ""; + paramsValueAsString = paramsValue.toString(); + sb.append("params=").append(urlEncode(paramsValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("status"); + openapiFields.add("type"); + openapiFields.add("code"); + openapiFields.add("errorData"); + openapiFields.add("data"); + openapiFields.add("subData"); + openapiFields.add("params"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to B402VerifyResponseV1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402VerifyResponseV1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in B402VerifyResponseV1 is not found in" + + " the empty JSON string", + B402VerifyResponseV1.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) + && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `status` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("status").toString())); + } + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) + && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `type` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("type").toString())); + } + if ((jsonObj.get("code") != null && !jsonObj.get("code").isJsonNull()) + && !jsonObj.get("code").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `code` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("code").toString())); + } + if ((jsonObj.get("errorData") != null && !jsonObj.get("errorData").isJsonNull()) + && !jsonObj.get("errorData").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `errorData` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("errorData").toString())); + } + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + B402VerifyResponseV2Data.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402VerifyResponseV1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'B402VerifyResponseV1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(B402VerifyResponseV1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, B402VerifyResponseV1 value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402VerifyResponseV1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402VerifyResponseV1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of B402VerifyResponseV1 + * @throws IOException if the JSON string is invalid with respect to B402VerifyResponseV1 + */ + public static B402VerifyResponseV1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, B402VerifyResponseV1.class); + } + + /** + * Convert an instance of B402VerifyResponseV1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402VerifyResponseV2.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402VerifyResponseV2.java new file mode 100644 index 0000000..3edea7f --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402VerifyResponseV2.java @@ -0,0 +1,450 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** B402VerifyResponseV2 */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402VerifyResponseV2 { + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + @jakarta.annotation.Nullable + private String status; + + public static final String SERIALIZED_NAME_TYPE = "type"; + + @SerializedName(SERIALIZED_NAME_TYPE) + @jakarta.annotation.Nullable + private String type; + + public static final String SERIALIZED_NAME_CODE = "code"; + + @SerializedName(SERIALIZED_NAME_CODE) + @jakarta.annotation.Nullable + private String code; + + public static final String SERIALIZED_NAME_ERROR_DATA = "errorData"; + + @SerializedName(SERIALIZED_NAME_ERROR_DATA) + @jakarta.annotation.Nullable + private String errorData; + + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + @jakarta.annotation.Nullable + private B402VerifyResponseV2Data data; + + public static final String SERIALIZED_NAME_SUB_DATA = "subData"; + + @SerializedName(SERIALIZED_NAME_SUB_DATA) + @jakarta.annotation.Nullable + private Object subData; + + public static final String SERIALIZED_NAME_PARAMS = "params"; + + @SerializedName(SERIALIZED_NAME_PARAMS) + @jakarta.annotation.Nullable + private Object params; + + public B402VerifyResponseV2() {} + + public B402VerifyResponseV2 status(@jakarta.annotation.Nullable String status) { + this.status = status; + return this; + } + + /** + * Get status + * + * @return status + */ + @jakarta.annotation.Nullable + public String getStatus() { + return status; + } + + public void setStatus(@jakarta.annotation.Nullable String status) { + this.status = status; + } + + public B402VerifyResponseV2 type(@jakarta.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * + * @return type + */ + @jakarta.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@jakarta.annotation.Nullable String type) { + this.type = type; + } + + public B402VerifyResponseV2 code(@jakarta.annotation.Nullable String code) { + this.code = code; + return this; + } + + /** + * Get code + * + * @return code + */ + @jakarta.annotation.Nullable + public String getCode() { + return code; + } + + public void setCode(@jakarta.annotation.Nullable String code) { + this.code = code; + } + + public B402VerifyResponseV2 errorData(@jakarta.annotation.Nullable String errorData) { + this.errorData = errorData; + return this; + } + + /** + * Get errorData + * + * @return errorData + */ + @jakarta.annotation.Nullable + public String getErrorData() { + return errorData; + } + + public void setErrorData(@jakarta.annotation.Nullable String errorData) { + this.errorData = errorData; + } + + public B402VerifyResponseV2 data(@jakarta.annotation.Nullable B402VerifyResponseV2Data data) { + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @jakarta.annotation.Nullable + @Valid + public B402VerifyResponseV2Data getData() { + return data; + } + + public void setData(@jakarta.annotation.Nullable B402VerifyResponseV2Data data) { + this.data = data; + } + + public B402VerifyResponseV2 subData(@jakarta.annotation.Nullable Object subData) { + this.subData = subData; + return this; + } + + /** + * Get subData + * + * @return subData + */ + @jakarta.annotation.Nullable + public Object getSubData() { + return subData; + } + + public void setSubData(@jakarta.annotation.Nullable Object subData) { + this.subData = subData; + } + + public B402VerifyResponseV2 params(@jakarta.annotation.Nullable Object params) { + this.params = params; + return this; + } + + /** + * Get params + * + * @return params + */ + @jakarta.annotation.Nullable + public Object getParams() { + return params; + } + + public void setParams(@jakarta.annotation.Nullable Object params) { + this.params = params; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402VerifyResponseV2 b402VerifyResponseV2 = (B402VerifyResponseV2) o; + return Objects.equals(this.status, b402VerifyResponseV2.status) + && Objects.equals(this.type, b402VerifyResponseV2.type) + && Objects.equals(this.code, b402VerifyResponseV2.code) + && Objects.equals(this.errorData, b402VerifyResponseV2.errorData) + && Objects.equals(this.data, b402VerifyResponseV2.data) + && Objects.equals(this.subData, b402VerifyResponseV2.subData) + && Objects.equals(this.params, b402VerifyResponseV2.params); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(status, type, code, errorData, data, subData, params); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402VerifyResponseV2 {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" errorData: ").append(toIndentedString(errorData)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" subData: ").append(toIndentedString(subData)).append("\n"); + sb.append(" params: ").append(toIndentedString(params)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object statusValue = getStatus(); + String statusValueAsString = ""; + statusValueAsString = statusValue.toString(); + sb.append("status=").append(urlEncode(statusValueAsString)).append(""); + Object typeValue = getType(); + String typeValueAsString = ""; + typeValueAsString = typeValue.toString(); + sb.append("type=").append(urlEncode(typeValueAsString)).append(""); + Object codeValue = getCode(); + String codeValueAsString = ""; + codeValueAsString = codeValue.toString(); + sb.append("code=").append(urlEncode(codeValueAsString)).append(""); + Object errorDataValue = getErrorData(); + String errorDataValueAsString = ""; + errorDataValueAsString = errorDataValue.toString(); + sb.append("errorData=").append(urlEncode(errorDataValueAsString)).append(""); + Object dataValue = getData(); + String dataValueAsString = ""; + dataValueAsString = dataValue.toString(); + sb.append("data=").append(urlEncode(dataValueAsString)).append(""); + Object subDataValue = getSubData(); + String subDataValueAsString = ""; + subDataValueAsString = subDataValue.toString(); + sb.append("subData=").append(urlEncode(subDataValueAsString)).append(""); + Object paramsValue = getParams(); + String paramsValueAsString = ""; + paramsValueAsString = paramsValue.toString(); + sb.append("params=").append(urlEncode(paramsValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("status"); + openapiFields.add("type"); + openapiFields.add("code"); + openapiFields.add("errorData"); + openapiFields.add("data"); + openapiFields.add("subData"); + openapiFields.add("params"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to B402VerifyResponseV2 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402VerifyResponseV2.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in B402VerifyResponseV2 is not found in" + + " the empty JSON string", + B402VerifyResponseV2.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) + && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `status` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("status").toString())); + } + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) + && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `type` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("type").toString())); + } + if ((jsonObj.get("code") != null && !jsonObj.get("code").isJsonNull()) + && !jsonObj.get("code").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `code` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("code").toString())); + } + if ((jsonObj.get("errorData") != null && !jsonObj.get("errorData").isJsonNull()) + && !jsonObj.get("errorData").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `errorData` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("errorData").toString())); + } + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + B402VerifyResponseV2Data.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402VerifyResponseV2.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'B402VerifyResponseV2' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(B402VerifyResponseV2.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, B402VerifyResponseV2 value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402VerifyResponseV2 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402VerifyResponseV2 given an JSON string + * + * @param jsonString JSON string + * @return An instance of B402VerifyResponseV2 + * @throws IOException if the JSON string is invalid with respect to B402VerifyResponseV2 + */ + public static B402VerifyResponseV2 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, B402VerifyResponseV2.class); + } + + /** + * Convert an instance of B402VerifyResponseV2 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402VerifyResponseV2Data.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402VerifyResponseV2Data.java new file mode 100644 index 0000000..23456e0 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/B402VerifyResponseV2Data.java @@ -0,0 +1,355 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** B402VerifyResponseV2Data */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class B402VerifyResponseV2Data { + public static final String SERIALIZED_NAME_IS_VALID = "isValid"; + + @SerializedName(SERIALIZED_NAME_IS_VALID) + @jakarta.annotation.Nonnull + private Boolean isValid; + + public static final String SERIALIZED_NAME_PAYER = "payer"; + + @SerializedName(SERIALIZED_NAME_PAYER) + @jakarta.annotation.Nullable + private String payer; + + public static final String SERIALIZED_NAME_INVALID_REASON = "invalidReason"; + + @SerializedName(SERIALIZED_NAME_INVALID_REASON) + @jakarta.annotation.Nullable + private String invalidReason; + + public static final String SERIALIZED_NAME_INVALID_MESSAGE = "invalidMessage"; + + @SerializedName(SERIALIZED_NAME_INVALID_MESSAGE) + @jakarta.annotation.Nullable + private String invalidMessage; + + public B402VerifyResponseV2Data() {} + + public B402VerifyResponseV2Data isValid(@jakarta.annotation.Nonnull Boolean isValid) { + this.isValid = isValid; + return this; + } + + /** + * Get isValid + * + * @return isValid + */ + @jakarta.annotation.Nonnull + @NotNull + public Boolean getIsValid() { + return isValid; + } + + public void setIsValid(@jakarta.annotation.Nonnull Boolean isValid) { + this.isValid = isValid; + } + + public B402VerifyResponseV2Data payer(@jakarta.annotation.Nullable String payer) { + this.payer = payer; + return this; + } + + /** + * Get payer + * + * @return payer + */ + @jakarta.annotation.Nullable + public String getPayer() { + return payer; + } + + public void setPayer(@jakarta.annotation.Nullable String payer) { + this.payer = payer; + } + + public B402VerifyResponseV2Data invalidReason( + @jakarta.annotation.Nullable String invalidReason) { + this.invalidReason = invalidReason; + return this; + } + + /** + * Get invalidReason + * + * @return invalidReason + */ + @jakarta.annotation.Nullable + public String getInvalidReason() { + return invalidReason; + } + + public void setInvalidReason(@jakarta.annotation.Nullable String invalidReason) { + this.invalidReason = invalidReason; + } + + public B402VerifyResponseV2Data invalidMessage( + @jakarta.annotation.Nullable String invalidMessage) { + this.invalidMessage = invalidMessage; + return this; + } + + /** + * Get invalidMessage + * + * @return invalidMessage + */ + @jakarta.annotation.Nullable + public String getInvalidMessage() { + return invalidMessage; + } + + public void setInvalidMessage(@jakarta.annotation.Nullable String invalidMessage) { + this.invalidMessage = invalidMessage; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B402VerifyResponseV2Data b402VerifyResponseV2Data = (B402VerifyResponseV2Data) o; + return Objects.equals(this.isValid, b402VerifyResponseV2Data.isValid) + && Objects.equals(this.payer, b402VerifyResponseV2Data.payer) + && Objects.equals(this.invalidReason, b402VerifyResponseV2Data.invalidReason) + && Objects.equals(this.invalidMessage, b402VerifyResponseV2Data.invalidMessage); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(isValid, payer, invalidReason, invalidMessage); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B402VerifyResponseV2Data {\n"); + sb.append(" isValid: ").append(toIndentedString(isValid)).append("\n"); + sb.append(" payer: ").append(toIndentedString(payer)).append("\n"); + sb.append(" invalidReason: ").append(toIndentedString(invalidReason)).append("\n"); + sb.append(" invalidMessage: ").append(toIndentedString(invalidMessage)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object isValidValue = getIsValid(); + String isValidValueAsString = ""; + isValidValueAsString = isValidValue.toString(); + sb.append("isValid=").append(urlEncode(isValidValueAsString)).append(""); + Object payerValue = getPayer(); + String payerValueAsString = ""; + payerValueAsString = payerValue.toString(); + sb.append("payer=").append(urlEncode(payerValueAsString)).append(""); + Object invalidReasonValue = getInvalidReason(); + String invalidReasonValueAsString = ""; + invalidReasonValueAsString = invalidReasonValue.toString(); + sb.append("invalidReason=").append(urlEncode(invalidReasonValueAsString)).append(""); + Object invalidMessageValue = getInvalidMessage(); + String invalidMessageValueAsString = ""; + invalidMessageValueAsString = invalidMessageValue.toString(); + sb.append("invalidMessage=").append(urlEncode(invalidMessageValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("isValid"); + openapiFields.add("payer"); + openapiFields.add("invalidReason"); + openapiFields.add("invalidMessage"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("isValid"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to B402VerifyResponseV2Data + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B402VerifyResponseV2Data.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in B402VerifyResponseV2Data is not found" + + " in the empty JSON string", + B402VerifyResponseV2Data.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : B402VerifyResponseV2Data.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("payer") != null && !jsonObj.get("payer").isJsonNull()) + && !jsonObj.get("payer").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `payer` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("payer").toString())); + } + if ((jsonObj.get("invalidReason") != null && !jsonObj.get("invalidReason").isJsonNull()) + && !jsonObj.get("invalidReason").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `invalidReason` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("invalidReason").toString())); + } + if ((jsonObj.get("invalidMessage") != null && !jsonObj.get("invalidMessage").isJsonNull()) + && !jsonObj.get("invalidMessage").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `invalidMessage` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("invalidMessage").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B402VerifyResponseV2Data.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'B402VerifyResponseV2Data' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(B402VerifyResponseV2Data.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, B402VerifyResponseV2Data value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B402VerifyResponseV2Data read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of B402VerifyResponseV2Data given an JSON string + * + * @param jsonString JSON string + * @return An instance of B402VerifyResponseV2Data + * @throws IOException if the JSON string is invalid with respect to B402VerifyResponseV2Data + */ + public static B402VerifyResponseV2Data fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, B402VerifyResponseV2Data.class); + } + + /** + * Convert an instance of B402VerifyResponseV2Data to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/Bar.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/Bar.java index d18e9e8..bda3ee6 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/Bar.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/Bar.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BinanceChainId.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BinanceChainId.java index 245765f..b05be3a 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BinanceChainId.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BinanceChainId.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BroadcastTransactionsRequest.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BroadcastTransactionsRequest.java index efdf154..ac38137 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BroadcastTransactionsRequest.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BroadcastTransactionsRequest.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BroadcastTransactionsResponse.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BroadcastTransactionsResponse.java index d708a6a..a14a374 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BroadcastTransactionsResponse.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BroadcastTransactionsResponse.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BroadcastTransactionsResponseData.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BroadcastTransactionsResponseData.java index 82b579b..b50aa88 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BroadcastTransactionsResponseData.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BroadcastTransactionsResponseData.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildDeFiClaimTransactionRequest.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildDeFiClaimTransactionRequest.java new file mode 100644 index 0000000..236f570 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildDeFiClaimTransactionRequest.java @@ -0,0 +1,682 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; +import org.hibernate.validator.constraints.*; + +/** BuildDeFiClaimTransactionRequest */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class BuildDeFiClaimTransactionRequest { + public static final String SERIALIZED_NAME_ADDRESS = "address"; + + @SerializedName(SERIALIZED_NAME_ADDRESS) + @jakarta.annotation.Nonnull + private String address; + + public static final String SERIALIZED_NAME_BINANCE_CHAIN_ID = "binanceChainId"; + + @SerializedName(SERIALIZED_NAME_BINANCE_CHAIN_ID) + @jakarta.annotation.Nullable + private String binanceChainId; + + /** + * Claim routing type. Determines which companion fields are required: - + * `REWARD_PROTOCOL`: protocol-level rewards (e.g. Aave incentive, Radiant) — requires + * `defiProtocolId` + `binanceChainId` - `REWARD_INVESTMENT`: + * per-investment rewards — requires `investmentId` - `LP_FEE`: Uniswap + * V3/V4 LP fees — requires `investmentId` + `nftId` - + * `REDEMPTION`: redeem principal (Lista / Aster / Solv etc.) — requires + * `investmentId` + `redemptionId` **Protocol constraints** — not every + * `claimType` is valid for every protocol; an invalid combination is rejected + * (`40453` or `40454`): - `REWARD_PROTOCOL` is **not** supported + * for LP (liquidity-pool) protocols in this release. - `REWARD_INVESTMENT` is not + * supported for PancakeSwap V3 farming positions; use `LP_FEE` to claim farming + * incentives there. - `LP_FEE` applies only to concentrated-liquidity (V3/V4) LP + * positions. - `REDEMPTION` applies only to protocols with a redemption / lock-up + * flow (Lista, Aster, Solv). The valid `claimType`s for a specific position are + * returned in that position's `positionDetail.claimTypes` (see the position list) + * — branch on that rather than hard-coding the mapping. Note: error messages may surface the + * protocol id with a chain prefix (e.g. `bsc_pancakeswap4`); the canonical id in API + * fields is the un-prefixed form (e.g. `pancakeswap4`). + */ + @JsonAdapter(ClaimTypeEnum.Adapter.class) + public enum ClaimTypeEnum { + REWARD_PROTOCOL("REWARD_PROTOCOL"), + + REWARD_INVESTMENT("REWARD_INVESTMENT"), + + LP_FEE("LP_FEE"), + + REDEMPTION("REDEMPTION"); + + private String value; + + ClaimTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ClaimTypeEnum fromValue(String value) { + for (ClaimTypeEnum b : ClaimTypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ClaimTypeEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ClaimTypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ClaimTypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + ClaimTypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_CLAIM_TYPE = "claimType"; + + @SerializedName(SERIALIZED_NAME_CLAIM_TYPE) + @jakarta.annotation.Nonnull + private ClaimTypeEnum claimType; + + public static final String SERIALIZED_NAME_INVESTMENT_ID = "investmentId"; + + @SerializedName(SERIALIZED_NAME_INVESTMENT_ID) + @jakarta.annotation.Nullable + private String investmentId; + + public static final String SERIALIZED_NAME_DEFI_PROTOCOL_ID = "defiProtocolId"; + + @SerializedName(SERIALIZED_NAME_DEFI_PROTOCOL_ID) + @jakarta.annotation.Nullable + private String defiProtocolId; + + public static final String SERIALIZED_NAME_NFT_ID = "nftId"; + + @SerializedName(SERIALIZED_NAME_NFT_ID) + @jakarta.annotation.Nullable + private String nftId; + + public static final String SERIALIZED_NAME_REDEMPTION_ID = "redemptionId"; + + @SerializedName(SERIALIZED_NAME_REDEMPTION_ID) + @jakarta.annotation.Nullable + private String redemptionId; + + public static final String SERIALIZED_NAME_TOKEN_ADDRESS_LIST = "tokenAddressList"; + + @SerializedName(SERIALIZED_NAME_TOKEN_ADDRESS_LIST) + @jakarta.annotation.Nullable + private List tokenAddressList; + + public static final String SERIALIZED_NAME_SIMULATE = "simulate"; + + @SerializedName(SERIALIZED_NAME_SIMULATE) + @jakarta.annotation.Nullable + private Boolean simulate; + + public BuildDeFiClaimTransactionRequest() {} + + public BuildDeFiClaimTransactionRequest address(@jakarta.annotation.Nonnull String address) { + this.address = address; + return this; + } + + /** + * User wallet address (the signer / sender). + * + * @return address + */ + @jakarta.annotation.Nonnull + @NotNull + public String getAddress() { + return address; + } + + public void setAddress(@jakarta.annotation.Nonnull String address) { + this.address = address; + } + + public BuildDeFiClaimTransactionRequest binanceChainId( + @jakarta.annotation.Nullable String binanceChainId) { + this.binanceChainId = binanceChainId; + return this; + } + + /** + * Binance chain ID. For `REWARD_PROTOCOL` (which does not use + * `investmentId`) this is the only chain signal and is required. For all other claim + * types the chain is resolved from `investmentId` and any client-supplied value is + * silently ignored — the call still executes on the `investmentId` chain, so a + * different chainId does not redirect the claim. + * + * @return binanceChainId + */ + @jakarta.annotation.Nullable + public String getBinanceChainId() { + return binanceChainId; + } + + public void setBinanceChainId(@jakarta.annotation.Nullable String binanceChainId) { + this.binanceChainId = binanceChainId; + } + + public BuildDeFiClaimTransactionRequest claimType( + @jakarta.annotation.Nonnull ClaimTypeEnum claimType) { + this.claimType = claimType; + return this; + } + + /** + * Claim routing type. Determines which companion fields are required: - + * `REWARD_PROTOCOL`: protocol-level rewards (e.g. Aave incentive, Radiant) — requires + * `defiProtocolId` + `binanceChainId` - `REWARD_INVESTMENT`: + * per-investment rewards — requires `investmentId` - `LP_FEE`: Uniswap + * V3/V4 LP fees — requires `investmentId` + `nftId` - + * `REDEMPTION`: redeem principal (Lista / Aster / Solv etc.) — requires + * `investmentId` + `redemptionId` **Protocol constraints** — not every + * `claimType` is valid for every protocol; an invalid combination is rejected + * (`40453` or `40454`): - `REWARD_PROTOCOL` is **not** supported + * for LP (liquidity-pool) protocols in this release. - `REWARD_INVESTMENT` is not + * supported for PancakeSwap V3 farming positions; use `LP_FEE` to claim farming + * incentives there. - `LP_FEE` applies only to concentrated-liquidity (V3/V4) LP + * positions. - `REDEMPTION` applies only to protocols with a redemption / lock-up + * flow (Lista, Aster, Solv). The valid `claimType`s for a specific position are + * returned in that position's `positionDetail.claimTypes` (see the position list) + * — branch on that rather than hard-coding the mapping. Note: error messages may surface the + * protocol id with a chain prefix (e.g. `bsc_pancakeswap4`); the canonical id in API + * fields is the un-prefixed form (e.g. `pancakeswap4`). + * + * @return claimType + */ + @jakarta.annotation.Nonnull + @NotNull + public ClaimTypeEnum getClaimType() { + return claimType; + } + + public void setClaimType(@jakarta.annotation.Nonnull ClaimTypeEnum claimType) { + this.claimType = claimType; + } + + public BuildDeFiClaimTransactionRequest investmentId( + @jakarta.annotation.Nullable String investmentId) { + this.investmentId = investmentId; + return this; + } + + /** + * Required for `REWARD_INVESTMENT`, `LP_FEE`, and `REDEMPTION`. + * Not used for `REWARD_PROTOCOL` (which keys off `defiProtocolId`). + * + * @return investmentId + */ + @jakarta.annotation.Nullable + public String getInvestmentId() { + return investmentId; + } + + public void setInvestmentId(@jakarta.annotation.Nullable String investmentId) { + this.investmentId = investmentId; + } + + public BuildDeFiClaimTransactionRequest defiProtocolId( + @jakarta.annotation.Nullable String defiProtocolId) { + this.defiProtocolId = defiProtocolId; + return this; + } + + /** + * Required for `REWARD_PROTOCOL` (e.g. `pancakeswap3`). + * + * @return defiProtocolId + */ + @jakarta.annotation.Nullable + public String getDefiProtocolId() { + return defiProtocolId; + } + + public void setDefiProtocolId(@jakarta.annotation.Nullable String defiProtocolId) { + this.defiProtocolId = defiProtocolId; + } + + public BuildDeFiClaimTransactionRequest nftId(@jakarta.annotation.Nullable String nftId) { + this.nftId = nftId; + return this; + } + + /** + * Required for `LP_FEE`. The NFT token ID as a decimal string (e.g. + * `\"7225901\"` or `\"#7225901\"`). The `#` + * prefix returned by the position list may be passed as-is — the service strips it + * automatically. + * + * @return nftId + */ + @jakarta.annotation.Nullable + public String getNftId() { + return nftId; + } + + public void setNftId(@jakarta.annotation.Nullable String nftId) { + this.nftId = nftId; + } + + public BuildDeFiClaimTransactionRequest redemptionId( + @jakarta.annotation.Nullable String redemptionId) { + this.redemptionId = redemptionId; + return this; + } + + /** + * Required for `REDEMPTION`. Maps to the `redemptionId` returned in the + * position list (the on-line position index). + * + * @return redemptionId + */ + @jakarta.annotation.Nullable + public String getRedemptionId() { + return redemptionId; + } + + public void setRedemptionId(@jakarta.annotation.Nullable String redemptionId) { + this.redemptionId = redemptionId; + } + + public BuildDeFiClaimTransactionRequest tokenAddressList( + @jakarta.annotation.Nullable List tokenAddressList) { + this.tokenAddressList = tokenAddressList; + return this; + } + + public BuildDeFiClaimTransactionRequest addTokenAddressListItem(String tokenAddressListItem) { + if (this.tokenAddressList == null) { + this.tokenAddressList = new ArrayList<>(); + } + this.tokenAddressList.add(tokenAddressListItem); + return this; + } + + /** + * Optional token address filter to narrow the claim scope. + * + * @return tokenAddressList + */ + @jakarta.annotation.Nullable + public List getTokenAddressList() { + return tokenAddressList; + } + + public void setTokenAddressList(@jakarta.annotation.Nullable List tokenAddressList) { + this.tokenAddressList = tokenAddressList; + } + + public BuildDeFiClaimTransactionRequest simulate( + @jakarta.annotation.Nullable Boolean simulate) { + this.simulate = simulate; + return this; + } + + /** + * When `true`, the response also includes a `preview` object. Default + * `false`. If the simulated transaction reverts, the request returns + * `40485` for a specific classified revert reason or `40484` for any other + * revert (see Error Codes). + * + * @return simulate + */ + @jakarta.annotation.Nullable + public Boolean getSimulate() { + return simulate; + } + + public void setSimulate(@jakarta.annotation.Nullable Boolean simulate) { + this.simulate = simulate; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BuildDeFiClaimTransactionRequest buildDeFiClaimTransactionRequest = + (BuildDeFiClaimTransactionRequest) o; + return Objects.equals(this.address, buildDeFiClaimTransactionRequest.address) + && Objects.equals( + this.binanceChainId, buildDeFiClaimTransactionRequest.binanceChainId) + && Objects.equals(this.claimType, buildDeFiClaimTransactionRequest.claimType) + && Objects.equals(this.investmentId, buildDeFiClaimTransactionRequest.investmentId) + && Objects.equals( + this.defiProtocolId, buildDeFiClaimTransactionRequest.defiProtocolId) + && Objects.equals(this.nftId, buildDeFiClaimTransactionRequest.nftId) + && Objects.equals(this.redemptionId, buildDeFiClaimTransactionRequest.redemptionId) + && Objects.equals( + this.tokenAddressList, buildDeFiClaimTransactionRequest.tokenAddressList) + && Objects.equals(this.simulate, buildDeFiClaimTransactionRequest.simulate); + } + + @Override + public int hashCode() { + return Objects.hash( + address, + binanceChainId, + claimType, + investmentId, + defiProtocolId, + nftId, + redemptionId, + tokenAddressList, + simulate); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BuildDeFiClaimTransactionRequest {\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append(" binanceChainId: ").append(toIndentedString(binanceChainId)).append("\n"); + sb.append(" claimType: ").append(toIndentedString(claimType)).append("\n"); + sb.append(" investmentId: ").append(toIndentedString(investmentId)).append("\n"); + sb.append(" defiProtocolId: ").append(toIndentedString(defiProtocolId)).append("\n"); + sb.append(" nftId: ").append(toIndentedString(nftId)).append("\n"); + sb.append(" redemptionId: ").append(toIndentedString(redemptionId)).append("\n"); + sb.append(" tokenAddressList: ").append(toIndentedString(tokenAddressList)).append("\n"); + sb.append(" simulate: ").append(toIndentedString(simulate)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object addressValue = getAddress(); + String addressValueAsString = ""; + addressValueAsString = addressValue.toString(); + sb.append("address=").append(urlEncode(addressValueAsString)).append(""); + Object binanceChainIdValue = getBinanceChainId(); + String binanceChainIdValueAsString = ""; + binanceChainIdValueAsString = binanceChainIdValue.toString(); + sb.append("binanceChainId=").append(urlEncode(binanceChainIdValueAsString)).append(""); + Object claimTypeValue = getClaimType(); + String claimTypeValueAsString = ""; + claimTypeValueAsString = claimTypeValue.toString(); + sb.append("claimType=").append(urlEncode(claimTypeValueAsString)).append(""); + Object investmentIdValue = getInvestmentId(); + String investmentIdValueAsString = ""; + investmentIdValueAsString = investmentIdValue.toString(); + sb.append("investmentId=").append(urlEncode(investmentIdValueAsString)).append(""); + Object defiProtocolIdValue = getDefiProtocolId(); + String defiProtocolIdValueAsString = ""; + defiProtocolIdValueAsString = defiProtocolIdValue.toString(); + sb.append("defiProtocolId=").append(urlEncode(defiProtocolIdValueAsString)).append(""); + Object nftIdValue = getNftId(); + String nftIdValueAsString = ""; + nftIdValueAsString = nftIdValue.toString(); + sb.append("nftId=").append(urlEncode(nftIdValueAsString)).append(""); + Object redemptionIdValue = getRedemptionId(); + String redemptionIdValueAsString = ""; + redemptionIdValueAsString = redemptionIdValue.toString(); + sb.append("redemptionId=").append(urlEncode(redemptionIdValueAsString)).append(""); + Object tokenAddressListValue = getTokenAddressList(); + String tokenAddressListValueAsString = ""; + tokenAddressListValueAsString = + (String) + ((Collection) tokenAddressListValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("tokenAddressList=").append(urlEncode(tokenAddressListValueAsString)).append(""); + Object simulateValue = getSimulate(); + String simulateValueAsString = ""; + simulateValueAsString = simulateValue.toString(); + sb.append("simulate=").append(urlEncode(simulateValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("address"); + openapiFields.add("binanceChainId"); + openapiFields.add("claimType"); + openapiFields.add("investmentId"); + openapiFields.add("defiProtocolId"); + openapiFields.add("nftId"); + openapiFields.add("redemptionId"); + openapiFields.add("tokenAddressList"); + openapiFields.add("simulate"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("address"); + openapiRequiredFields.add("claimType"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * BuildDeFiClaimTransactionRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BuildDeFiClaimTransactionRequest.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in BuildDeFiClaimTransactionRequest is" + + " not found in the empty JSON string", + BuildDeFiClaimTransactionRequest.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BuildDeFiClaimTransactionRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("address").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `address` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("address").toString())); + } + if ((jsonObj.get("binanceChainId") != null && !jsonObj.get("binanceChainId").isJsonNull()) + && !jsonObj.get("binanceChainId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `binanceChainId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("binanceChainId").toString())); + } + if (!jsonObj.get("claimType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `claimType` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("claimType").toString())); + } + // validate the required field `claimType` + ClaimTypeEnum.validateJsonElement(jsonObj.get("claimType")); + if ((jsonObj.get("investmentId") != null && !jsonObj.get("investmentId").isJsonNull()) + && !jsonObj.get("investmentId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `investmentId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("investmentId").toString())); + } + if ((jsonObj.get("defiProtocolId") != null && !jsonObj.get("defiProtocolId").isJsonNull()) + && !jsonObj.get("defiProtocolId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `defiProtocolId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("defiProtocolId").toString())); + } + if ((jsonObj.get("nftId") != null && !jsonObj.get("nftId").isJsonNull()) + && !jsonObj.get("nftId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `nftId` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("nftId").toString())); + } + if ((jsonObj.get("redemptionId") != null && !jsonObj.get("redemptionId").isJsonNull()) + && !jsonObj.get("redemptionId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `redemptionId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("redemptionId").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("tokenAddressList") != null + && !jsonObj.get("tokenAddressList").isJsonNull() + && !jsonObj.get("tokenAddressList").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `tokenAddressList` to be an array in the JSON" + + " string but got `%s`", + jsonObj.get("tokenAddressList").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BuildDeFiClaimTransactionRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BuildDeFiClaimTransactionRequest' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(BuildDeFiClaimTransactionRequest.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, BuildDeFiClaimTransactionRequest value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BuildDeFiClaimTransactionRequest read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of BuildDeFiClaimTransactionRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of BuildDeFiClaimTransactionRequest + * @throws IOException if the JSON string is invalid with respect to + * BuildDeFiClaimTransactionRequest + */ + public static BuildDeFiClaimTransactionRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BuildDeFiClaimTransactionRequest.class); + } + + /** + * Convert an instance of BuildDeFiClaimTransactionRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildDeFiClaimTransactionResponse.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildDeFiClaimTransactionResponse.java new file mode 100644 index 0000000..19a5aa3 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildDeFiClaimTransactionResponse.java @@ -0,0 +1,353 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** BuildDeFiClaimTransactionResponse */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class BuildDeFiClaimTransactionResponse { + public static final String SERIALIZED_NAME_CODE = "code"; + + @SerializedName(SERIALIZED_NAME_CODE) + @jakarta.annotation.Nullable + private Integer code; + + public static final String SERIALIZED_NAME_MSG = "msg"; + + @SerializedName(SERIALIZED_NAME_MSG) + @jakarta.annotation.Nullable + private String msg; + + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + @jakarta.annotation.Nullable + private BuildDeFiDepositTransactionResponseData data; + + public static final String SERIALIZED_NAME_TIMESTAMP = "timestamp"; + + @SerializedName(SERIALIZED_NAME_TIMESTAMP) + @jakarta.annotation.Nullable + private Long timestamp; + + public static final String SERIALIZED_NAME_SUCCESS = "success"; + + @SerializedName(SERIALIZED_NAME_SUCCESS) + @jakarta.annotation.Nullable + private Boolean success; + + public BuildDeFiClaimTransactionResponse() {} + + public BuildDeFiClaimTransactionResponse code(@jakarta.annotation.Nullable Integer code) { + this.code = code; + return this; + } + + /** + * Business status code. 0 indicates success. + * + * @return code + */ + @jakarta.annotation.Nullable + public Integer getCode() { + return code; + } + + public void setCode(@jakarta.annotation.Nullable Integer code) { + this.code = code; + } + + public BuildDeFiClaimTransactionResponse msg(@jakarta.annotation.Nullable String msg) { + this.msg = msg; + return this; + } + + /** + * Human-readable status message. + * + * @return msg + */ + @jakarta.annotation.Nullable + public String getMsg() { + return msg; + } + + public void setMsg(@jakarta.annotation.Nullable String msg) { + this.msg = msg; + } + + public BuildDeFiClaimTransactionResponse data( + @jakarta.annotation.Nullable BuildDeFiDepositTransactionResponseData data) { + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @jakarta.annotation.Nullable + @Valid + public BuildDeFiDepositTransactionResponseData getData() { + return data; + } + + public void setData(@jakarta.annotation.Nullable BuildDeFiDepositTransactionResponseData data) { + this.data = data; + } + + public BuildDeFiClaimTransactionResponse timestamp( + @jakarta.annotation.Nullable Long timestamp) { + this.timestamp = timestamp; + return this; + } + + /** + * Server timestamp in milliseconds. + * + * @return timestamp + */ + @jakarta.annotation.Nullable + public Long getTimestamp() { + return timestamp; + } + + public void setTimestamp(@jakarta.annotation.Nullable Long timestamp) { + this.timestamp = timestamp; + } + + public BuildDeFiClaimTransactionResponse success(@jakarta.annotation.Nullable Boolean success) { + this.success = success; + return this; + } + + /** + * Whether the request succeeded (mirrors `code == 0`). + * + * @return success + */ + @jakarta.annotation.Nullable + public Boolean getSuccess() { + return success; + } + + public void setSuccess(@jakarta.annotation.Nullable Boolean success) { + this.success = success; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BuildDeFiClaimTransactionResponse buildDeFiClaimTransactionResponse = + (BuildDeFiClaimTransactionResponse) o; + return Objects.equals(this.code, buildDeFiClaimTransactionResponse.code) + && Objects.equals(this.msg, buildDeFiClaimTransactionResponse.msg) + && Objects.equals(this.data, buildDeFiClaimTransactionResponse.data) + && Objects.equals(this.timestamp, buildDeFiClaimTransactionResponse.timestamp) + && Objects.equals(this.success, buildDeFiClaimTransactionResponse.success); + } + + @Override + public int hashCode() { + return Objects.hash(code, msg, data, timestamp, success); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BuildDeFiClaimTransactionResponse {\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" msg: ").append(toIndentedString(msg)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" timestamp: ").append(toIndentedString(timestamp)).append("\n"); + sb.append(" success: ").append(toIndentedString(success)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object codeValue = getCode(); + String codeValueAsString = ""; + codeValueAsString = codeValue.toString(); + sb.append("code=").append(urlEncode(codeValueAsString)).append(""); + Object msgValue = getMsg(); + String msgValueAsString = ""; + msgValueAsString = msgValue.toString(); + sb.append("msg=").append(urlEncode(msgValueAsString)).append(""); + Object dataValue = getData(); + String dataValueAsString = ""; + dataValueAsString = dataValue.toString(); + sb.append("data=").append(urlEncode(dataValueAsString)).append(""); + Object timestampValue = getTimestamp(); + String timestampValueAsString = ""; + timestampValueAsString = timestampValue.toString(); + sb.append("timestamp=").append(urlEncode(timestampValueAsString)).append(""); + Object successValue = getSuccess(); + String successValueAsString = ""; + successValueAsString = successValue.toString(); + sb.append("success=").append(urlEncode(successValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("code"); + openapiFields.add("msg"); + openapiFields.add("data"); + openapiFields.add("timestamp"); + openapiFields.add("success"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * BuildDeFiClaimTransactionResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BuildDeFiClaimTransactionResponse.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in BuildDeFiClaimTransactionResponse is" + + " not found in the empty JSON string", + BuildDeFiClaimTransactionResponse.openapiRequiredFields + .toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("msg") != null && !jsonObj.get("msg").isJsonNull()) + && !jsonObj.get("msg").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `msg` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("msg").toString())); + } + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + BuildDeFiDepositTransactionResponseData.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BuildDeFiClaimTransactionResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BuildDeFiClaimTransactionResponse' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(BuildDeFiClaimTransactionResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, BuildDeFiClaimTransactionResponse value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BuildDeFiClaimTransactionResponse read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of BuildDeFiClaimTransactionResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of BuildDeFiClaimTransactionResponse + * @throws IOException if the JSON string is invalid with respect to + * BuildDeFiClaimTransactionResponse + */ + public static BuildDeFiClaimTransactionResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BuildDeFiClaimTransactionResponse.class); + } + + /** + * Convert an instance of BuildDeFiClaimTransactionResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildDeFiDepositTransactionRequest.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildDeFiDepositTransactionRequest.java new file mode 100644 index 0000000..a762995 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildDeFiDepositTransactionRequest.java @@ -0,0 +1,348 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** BuildDeFiDepositTransactionRequest */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class BuildDeFiDepositTransactionRequest { + public static final String SERIALIZED_NAME_ADDRESS = "address"; + + @SerializedName(SERIALIZED_NAME_ADDRESS) + @jakarta.annotation.Nonnull + private String address; + + public static final String SERIALIZED_NAME_INVESTMENT_ID = "investmentId"; + + @SerializedName(SERIALIZED_NAME_INVESTMENT_ID) + @jakarta.annotation.Nonnull + private String investmentId; + + public static final String SERIALIZED_NAME_TOKEN = "token"; + + @SerializedName(SERIALIZED_NAME_TOKEN) + @jakarta.annotation.Nonnull + private BuildDeFiDepositTransactionRequestToken token; + + public static final String SERIALIZED_NAME_SIMULATE = "simulate"; + + @SerializedName(SERIALIZED_NAME_SIMULATE) + @jakarta.annotation.Nullable + private Boolean simulate; + + public BuildDeFiDepositTransactionRequest() {} + + public BuildDeFiDepositTransactionRequest address(@jakarta.annotation.Nonnull String address) { + this.address = address; + return this; + } + + /** + * User wallet address (the signer / sender). + * + * @return address + */ + @jakarta.annotation.Nonnull + @NotNull + public String getAddress() { + return address; + } + + public void setAddress(@jakarta.annotation.Nonnull String address) { + this.address = address; + } + + public BuildDeFiDepositTransactionRequest investmentId( + @jakarta.annotation.Nonnull String investmentId) { + this.investmentId = investmentId; + return this; + } + + /** + * Investment product ID (chain-agnostic). The service resolves the chain from this ID. + * + * @return investmentId + */ + @jakarta.annotation.Nonnull + @NotNull + public String getInvestmentId() { + return investmentId; + } + + public void setInvestmentId(@jakarta.annotation.Nonnull String investmentId) { + this.investmentId = investmentId; + } + + public BuildDeFiDepositTransactionRequest token( + @jakarta.annotation.Nonnull BuildDeFiDepositTransactionRequestToken token) { + this.token = token; + return this; + } + + /** + * Get token + * + * @return token + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public BuildDeFiDepositTransactionRequestToken getToken() { + return token; + } + + public void setToken( + @jakarta.annotation.Nonnull BuildDeFiDepositTransactionRequestToken token) { + this.token = token; + } + + public BuildDeFiDepositTransactionRequest simulate( + @jakarta.annotation.Nullable Boolean simulate) { + this.simulate = simulate; + return this; + } + + /** + * When `true`, the response also includes a `preview` object. Default + * `false`. If the simulated transaction reverts, the request returns + * `40485` for a specific classified revert reason or `40484` for any other + * revert (see Error Codes). + * + * @return simulate + */ + @jakarta.annotation.Nullable + public Boolean getSimulate() { + return simulate; + } + + public void setSimulate(@jakarta.annotation.Nullable Boolean simulate) { + this.simulate = simulate; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BuildDeFiDepositTransactionRequest buildDeFiDepositTransactionRequest = + (BuildDeFiDepositTransactionRequest) o; + return Objects.equals(this.address, buildDeFiDepositTransactionRequest.address) + && Objects.equals( + this.investmentId, buildDeFiDepositTransactionRequest.investmentId) + && Objects.equals(this.token, buildDeFiDepositTransactionRequest.token) + && Objects.equals(this.simulate, buildDeFiDepositTransactionRequest.simulate); + } + + @Override + public int hashCode() { + return Objects.hash(address, investmentId, token, simulate); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BuildDeFiDepositTransactionRequest {\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append(" investmentId: ").append(toIndentedString(investmentId)).append("\n"); + sb.append(" token: ").append(toIndentedString(token)).append("\n"); + sb.append(" simulate: ").append(toIndentedString(simulate)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object addressValue = getAddress(); + String addressValueAsString = ""; + addressValueAsString = addressValue.toString(); + sb.append("address=").append(urlEncode(addressValueAsString)).append(""); + Object investmentIdValue = getInvestmentId(); + String investmentIdValueAsString = ""; + investmentIdValueAsString = investmentIdValue.toString(); + sb.append("investmentId=").append(urlEncode(investmentIdValueAsString)).append(""); + Object tokenValue = getToken(); + String tokenValueAsString = ""; + tokenValueAsString = tokenValue.toString(); + sb.append("token=").append(urlEncode(tokenValueAsString)).append(""); + Object simulateValue = getSimulate(); + String simulateValueAsString = ""; + simulateValueAsString = simulateValue.toString(); + sb.append("simulate=").append(urlEncode(simulateValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("address"); + openapiFields.add("investmentId"); + openapiFields.add("token"); + openapiFields.add("simulate"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("address"); + openapiRequiredFields.add("investmentId"); + openapiRequiredFields.add("token"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * BuildDeFiDepositTransactionRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BuildDeFiDepositTransactionRequest.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in BuildDeFiDepositTransactionRequest is" + + " not found in the empty JSON string", + BuildDeFiDepositTransactionRequest.openapiRequiredFields + .toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BuildDeFiDepositTransactionRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("address").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `address` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("address").toString())); + } + if (!jsonObj.get("investmentId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `investmentId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("investmentId").toString())); + } + // validate the required field `token` + BuildDeFiDepositTransactionRequestToken.validateJsonElement(jsonObj.get("token")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BuildDeFiDepositTransactionRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BuildDeFiDepositTransactionRequest' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(BuildDeFiDepositTransactionRequest.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, BuildDeFiDepositTransactionRequest value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BuildDeFiDepositTransactionRequest read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of BuildDeFiDepositTransactionRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of BuildDeFiDepositTransactionRequest + * @throws IOException if the JSON string is invalid with respect to + * BuildDeFiDepositTransactionRequest + */ + public static BuildDeFiDepositTransactionRequest fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, BuildDeFiDepositTransactionRequest.class); + } + + /** + * Convert an instance of BuildDeFiDepositTransactionRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildDeFiDepositTransactionRequestToken.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildDeFiDepositTransactionRequestToken.java new file mode 100644 index 0000000..98d1235 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildDeFiDepositTransactionRequestToken.java @@ -0,0 +1,281 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** + * A `(tokenAddress, amount)` pair. `amount` is a human-readable decimal string + * (NOT the token's smallest unit); the service converts it according to the token's + * decimals. For the native asset use the sentinel + * `0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee` (40 `e`s). + */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class BuildDeFiDepositTransactionRequestToken { + public static final String SERIALIZED_NAME_TOKEN_ADDRESS = "tokenAddress"; + + @SerializedName(SERIALIZED_NAME_TOKEN_ADDRESS) + @jakarta.annotation.Nonnull + private String tokenAddress; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + + @SerializedName(SERIALIZED_NAME_AMOUNT) + @jakarta.annotation.Nonnull + private String amount; + + public BuildDeFiDepositTransactionRequestToken() {} + + public BuildDeFiDepositTransactionRequestToken tokenAddress( + @jakarta.annotation.Nonnull String tokenAddress) { + this.tokenAddress = tokenAddress; + return this; + } + + /** + * Token contract address; the native-asset sentinel for the native coin. + * + * @return tokenAddress + */ + @jakarta.annotation.Nonnull + @NotNull + public String getTokenAddress() { + return tokenAddress; + } + + public void setTokenAddress(@jakarta.annotation.Nonnull String tokenAddress) { + this.tokenAddress = tokenAddress; + } + + public BuildDeFiDepositTransactionRequestToken amount( + @jakarta.annotation.Nonnull String amount) { + this.amount = amount; + return this; + } + + /** + * Human-readable amount as a decimal string, e.g. \"1.5\", \"100\". + * + * @return amount + */ + @jakarta.annotation.Nonnull + @NotNull + public String getAmount() { + return amount; + } + + public void setAmount(@jakarta.annotation.Nonnull String amount) { + this.amount = amount; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BuildDeFiDepositTransactionRequestToken buildDeFiDepositTransactionRequestToken = + (BuildDeFiDepositTransactionRequestToken) o; + return Objects.equals( + this.tokenAddress, buildDeFiDepositTransactionRequestToken.tokenAddress) + && Objects.equals(this.amount, buildDeFiDepositTransactionRequestToken.amount); + } + + @Override + public int hashCode() { + return Objects.hash(tokenAddress, amount); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BuildDeFiDepositTransactionRequestToken {\n"); + sb.append(" tokenAddress: ").append(toIndentedString(tokenAddress)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object tokenAddressValue = getTokenAddress(); + String tokenAddressValueAsString = ""; + tokenAddressValueAsString = tokenAddressValue.toString(); + sb.append("tokenAddress=").append(urlEncode(tokenAddressValueAsString)).append(""); + Object amountValue = getAmount(); + String amountValueAsString = ""; + amountValueAsString = amountValue.toString(); + sb.append("amount=").append(urlEncode(amountValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("tokenAddress"); + openapiFields.add("amount"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("tokenAddress"); + openapiRequiredFields.add("amount"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * BuildDeFiDepositTransactionRequestToken + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BuildDeFiDepositTransactionRequestToken.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " BuildDeFiDepositTransactionRequestToken is not found in the" + + " empty JSON string", + BuildDeFiDepositTransactionRequestToken.openapiRequiredFields + .toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BuildDeFiDepositTransactionRequestToken.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("tokenAddress").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `tokenAddress` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("tokenAddress").toString())); + } + if (!jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `amount` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("amount").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BuildDeFiDepositTransactionRequestToken.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes 'BuildDeFiDepositTransactionRequestToken' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(BuildDeFiDepositTransactionRequestToken.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, BuildDeFiDepositTransactionRequestToken value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BuildDeFiDepositTransactionRequestToken read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of BuildDeFiDepositTransactionRequestToken given an JSON string + * + * @param jsonString JSON string + * @return An instance of BuildDeFiDepositTransactionRequestToken + * @throws IOException if the JSON string is invalid with respect to + * BuildDeFiDepositTransactionRequestToken + */ + public static BuildDeFiDepositTransactionRequestToken fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, BuildDeFiDepositTransactionRequestToken.class); + } + + /** + * Convert an instance of BuildDeFiDepositTransactionRequestToken to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildDeFiDepositTransactionResponse.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildDeFiDepositTransactionResponse.java new file mode 100644 index 0000000..4d94f35 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildDeFiDepositTransactionResponse.java @@ -0,0 +1,355 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** BuildDeFiDepositTransactionResponse */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class BuildDeFiDepositTransactionResponse { + public static final String SERIALIZED_NAME_CODE = "code"; + + @SerializedName(SERIALIZED_NAME_CODE) + @jakarta.annotation.Nullable + private Integer code; + + public static final String SERIALIZED_NAME_MSG = "msg"; + + @SerializedName(SERIALIZED_NAME_MSG) + @jakarta.annotation.Nullable + private String msg; + + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + @jakarta.annotation.Nullable + private BuildDeFiDepositTransactionResponseData data; + + public static final String SERIALIZED_NAME_TIMESTAMP = "timestamp"; + + @SerializedName(SERIALIZED_NAME_TIMESTAMP) + @jakarta.annotation.Nullable + private Long timestamp; + + public static final String SERIALIZED_NAME_SUCCESS = "success"; + + @SerializedName(SERIALIZED_NAME_SUCCESS) + @jakarta.annotation.Nullable + private Boolean success; + + public BuildDeFiDepositTransactionResponse() {} + + public BuildDeFiDepositTransactionResponse code(@jakarta.annotation.Nullable Integer code) { + this.code = code; + return this; + } + + /** + * Business status code. 0 indicates success. + * + * @return code + */ + @jakarta.annotation.Nullable + public Integer getCode() { + return code; + } + + public void setCode(@jakarta.annotation.Nullable Integer code) { + this.code = code; + } + + public BuildDeFiDepositTransactionResponse msg(@jakarta.annotation.Nullable String msg) { + this.msg = msg; + return this; + } + + /** + * Human-readable status message. + * + * @return msg + */ + @jakarta.annotation.Nullable + public String getMsg() { + return msg; + } + + public void setMsg(@jakarta.annotation.Nullable String msg) { + this.msg = msg; + } + + public BuildDeFiDepositTransactionResponse data( + @jakarta.annotation.Nullable BuildDeFiDepositTransactionResponseData data) { + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @jakarta.annotation.Nullable + @Valid + public BuildDeFiDepositTransactionResponseData getData() { + return data; + } + + public void setData(@jakarta.annotation.Nullable BuildDeFiDepositTransactionResponseData data) { + this.data = data; + } + + public BuildDeFiDepositTransactionResponse timestamp( + @jakarta.annotation.Nullable Long timestamp) { + this.timestamp = timestamp; + return this; + } + + /** + * Server timestamp in milliseconds. + * + * @return timestamp + */ + @jakarta.annotation.Nullable + public Long getTimestamp() { + return timestamp; + } + + public void setTimestamp(@jakarta.annotation.Nullable Long timestamp) { + this.timestamp = timestamp; + } + + public BuildDeFiDepositTransactionResponse success( + @jakarta.annotation.Nullable Boolean success) { + this.success = success; + return this; + } + + /** + * Whether the request succeeded (mirrors `code == 0`). + * + * @return success + */ + @jakarta.annotation.Nullable + public Boolean getSuccess() { + return success; + } + + public void setSuccess(@jakarta.annotation.Nullable Boolean success) { + this.success = success; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BuildDeFiDepositTransactionResponse buildDeFiDepositTransactionResponse = + (BuildDeFiDepositTransactionResponse) o; + return Objects.equals(this.code, buildDeFiDepositTransactionResponse.code) + && Objects.equals(this.msg, buildDeFiDepositTransactionResponse.msg) + && Objects.equals(this.data, buildDeFiDepositTransactionResponse.data) + && Objects.equals(this.timestamp, buildDeFiDepositTransactionResponse.timestamp) + && Objects.equals(this.success, buildDeFiDepositTransactionResponse.success); + } + + @Override + public int hashCode() { + return Objects.hash(code, msg, data, timestamp, success); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BuildDeFiDepositTransactionResponse {\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" msg: ").append(toIndentedString(msg)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" timestamp: ").append(toIndentedString(timestamp)).append("\n"); + sb.append(" success: ").append(toIndentedString(success)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object codeValue = getCode(); + String codeValueAsString = ""; + codeValueAsString = codeValue.toString(); + sb.append("code=").append(urlEncode(codeValueAsString)).append(""); + Object msgValue = getMsg(); + String msgValueAsString = ""; + msgValueAsString = msgValue.toString(); + sb.append("msg=").append(urlEncode(msgValueAsString)).append(""); + Object dataValue = getData(); + String dataValueAsString = ""; + dataValueAsString = dataValue.toString(); + sb.append("data=").append(urlEncode(dataValueAsString)).append(""); + Object timestampValue = getTimestamp(); + String timestampValueAsString = ""; + timestampValueAsString = timestampValue.toString(); + sb.append("timestamp=").append(urlEncode(timestampValueAsString)).append(""); + Object successValue = getSuccess(); + String successValueAsString = ""; + successValueAsString = successValue.toString(); + sb.append("success=").append(urlEncode(successValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("code"); + openapiFields.add("msg"); + openapiFields.add("data"); + openapiFields.add("timestamp"); + openapiFields.add("success"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * BuildDeFiDepositTransactionResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BuildDeFiDepositTransactionResponse.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in BuildDeFiDepositTransactionResponse is" + + " not found in the empty JSON string", + BuildDeFiDepositTransactionResponse.openapiRequiredFields + .toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("msg") != null && !jsonObj.get("msg").isJsonNull()) + && !jsonObj.get("msg").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `msg` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("msg").toString())); + } + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + BuildDeFiDepositTransactionResponseData.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BuildDeFiDepositTransactionResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BuildDeFiDepositTransactionResponse' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(BuildDeFiDepositTransactionResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, BuildDeFiDepositTransactionResponse value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BuildDeFiDepositTransactionResponse read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of BuildDeFiDepositTransactionResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of BuildDeFiDepositTransactionResponse + * @throws IOException if the JSON string is invalid with respect to + * BuildDeFiDepositTransactionResponse + */ + public static BuildDeFiDepositTransactionResponse fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, BuildDeFiDepositTransactionResponse.class); + } + + /** + * Convert an instance of BuildDeFiDepositTransactionResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildDeFiDepositTransactionResponseData.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildDeFiDepositTransactionResponseData.java new file mode 100644 index 0000000..747ae61 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildDeFiDepositTransactionResponseData.java @@ -0,0 +1,364 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; +import org.hibernate.validator.constraints.*; + +/** + * Unified response of the five build endpoints (deposit / redeem / lp-add / lp-remove / claim). + * `dataList` is ordered: APPROVE items come first, the main action follows — sign and + * broadcast each item in order. `preview` is non-null only when the request set + * `simulate=true`. `redeemDelayDays` is populated only by + * `/transaction/redeem`. + */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class BuildDeFiDepositTransactionResponseData { + public static final String SERIALIZED_NAME_DATA_LIST = "dataList"; + + @SerializedName(SERIALIZED_NAME_DATA_LIST) + @jakarta.annotation.Nullable + private List<@Valid BuildDeFiDepositTransactionResponseDataDataListInner> dataList; + + public static final String SERIALIZED_NAME_PREVIEW = "preview"; + + @SerializedName(SERIALIZED_NAME_PREVIEW) + @jakarta.annotation.Nullable + private BuildDeFiDepositTransactionResponseDataPreview preview; + + public static final String SERIALIZED_NAME_REDEEM_DELAY_DAYS = "redeemDelayDays"; + + @SerializedName(SERIALIZED_NAME_REDEEM_DELAY_DAYS) + @jakarta.annotation.Nullable + private List redeemDelayDays; + + public BuildDeFiDepositTransactionResponseData() {} + + public BuildDeFiDepositTransactionResponseData dataList( + @jakarta.annotation.Nullable + List<@Valid BuildDeFiDepositTransactionResponseDataDataListInner> dataList) { + this.dataList = dataList; + return this; + } + + public BuildDeFiDepositTransactionResponseData addDataListItem( + BuildDeFiDepositTransactionResponseDataDataListInner dataListItem) { + if (this.dataList == null) { + this.dataList = new ArrayList<>(); + } + this.dataList.add(dataListItem); + return this; + } + + /** + * Ordered unsigned transactions; APPROVE precedes the main action. + * + * @return dataList + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid BuildDeFiDepositTransactionResponseDataDataListInner> getDataList() { + return dataList; + } + + public void setDataList( + @jakarta.annotation.Nullable + List<@Valid BuildDeFiDepositTransactionResponseDataDataListInner> dataList) { + this.dataList = dataList; + } + + public BuildDeFiDepositTransactionResponseData preview( + @jakarta.annotation.Nullable BuildDeFiDepositTransactionResponseDataPreview preview) { + this.preview = preview; + return this; + } + + /** + * Get preview + * + * @return preview + */ + @jakarta.annotation.Nullable + @Valid + public BuildDeFiDepositTransactionResponseDataPreview getPreview() { + return preview; + } + + public void setPreview( + @jakarta.annotation.Nullable BuildDeFiDepositTransactionResponseDataPreview preview) { + this.preview = preview; + } + + public BuildDeFiDepositTransactionResponseData redeemDelayDays( + @jakarta.annotation.Nullable List redeemDelayDays) { + this.redeemDelayDays = redeemDelayDays; + return this; + } + + public BuildDeFiDepositTransactionResponseData addRedeemDelayDaysItem( + String redeemDelayDaysItem) { + if (this.redeemDelayDays == null) { + this.redeemDelayDays = new ArrayList<>(); + } + this.redeemDelayDays.add(redeemDelayDaysItem); + return this; + } + + /** + * Redeem waiting period as a `[min, max]` day pair of decimal strings. Populated + * **only** by `/transaction/redeem`; `null` on the other build endpoints or + * when unavailable. Interpretation: `[]` (empty) = instant, no waiting period; + * `[\"7\",\"7\"]` = fixed 7 days; + * `[\"7\",\"10\"]` = 7–10 days. The wait starts after the + * redeem transaction is confirmed on-chain. + * + * @return redeemDelayDays + */ + @jakarta.annotation.Nullable + public List getRedeemDelayDays() { + return redeemDelayDays; + } + + public void setRedeemDelayDays(@jakarta.annotation.Nullable List redeemDelayDays) { + this.redeemDelayDays = redeemDelayDays; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BuildDeFiDepositTransactionResponseData buildDeFiDepositTransactionResponseData = + (BuildDeFiDepositTransactionResponseData) o; + return Objects.equals(this.dataList, buildDeFiDepositTransactionResponseData.dataList) + && Objects.equals(this.preview, buildDeFiDepositTransactionResponseData.preview) + && Objects.equals( + this.redeemDelayDays, + buildDeFiDepositTransactionResponseData.redeemDelayDays); + } + + @Override + public int hashCode() { + return Objects.hash(dataList, preview, redeemDelayDays); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BuildDeFiDepositTransactionResponseData {\n"); + sb.append(" dataList: ").append(toIndentedString(dataList)).append("\n"); + sb.append(" preview: ").append(toIndentedString(preview)).append("\n"); + sb.append(" redeemDelayDays: ").append(toIndentedString(redeemDelayDays)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object dataListValue = getDataList(); + String dataListValueAsString = ""; + dataListValueAsString = + (String) + ((Collection) dataListValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("dataList=").append(urlEncode(dataListValueAsString)).append(""); + Object previewValue = getPreview(); + String previewValueAsString = ""; + previewValueAsString = previewValue.toString(); + sb.append("preview=").append(urlEncode(previewValueAsString)).append(""); + Object redeemDelayDaysValue = getRedeemDelayDays(); + String redeemDelayDaysValueAsString = ""; + redeemDelayDaysValueAsString = + (String) + ((Collection) redeemDelayDaysValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("redeemDelayDays=").append(urlEncode(redeemDelayDaysValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("dataList"); + openapiFields.add("preview"); + openapiFields.add("redeemDelayDays"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * BuildDeFiDepositTransactionResponseData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BuildDeFiDepositTransactionResponseData.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " BuildDeFiDepositTransactionResponseData is not found in the" + + " empty JSON string", + BuildDeFiDepositTransactionResponseData.openapiRequiredFields + .toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("dataList") != null && !jsonObj.get("dataList").isJsonNull()) { + JsonArray jsonArraydataList = jsonObj.getAsJsonArray("dataList"); + if (jsonArraydataList != null) { + // ensure the json data is an array + if (!jsonObj.get("dataList").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `dataList` to be an array in the JSON" + + " string but got `%s`", + jsonObj.get("dataList").toString())); + } + + // validate the optional field `dataList` (array) + for (int i = 0; i < jsonArraydataList.size(); i++) { + BuildDeFiDepositTransactionResponseDataDataListInner.validateJsonElement( + jsonArraydataList.get(i)); + } + ; + } + } + // validate the optional field `preview` + if (jsonObj.get("preview") != null && !jsonObj.get("preview").isJsonNull()) { + BuildDeFiDepositTransactionResponseDataPreview.validateJsonElement( + jsonObj.get("preview")); + } + // ensure the optional json data is an array if present + if (jsonObj.get("redeemDelayDays") != null + && !jsonObj.get("redeemDelayDays").isJsonNull() + && !jsonObj.get("redeemDelayDays").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `redeemDelayDays` to be an array in the JSON string" + + " but got `%s`", + jsonObj.get("redeemDelayDays").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BuildDeFiDepositTransactionResponseData.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes 'BuildDeFiDepositTransactionResponseData' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(BuildDeFiDepositTransactionResponseData.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, BuildDeFiDepositTransactionResponseData value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BuildDeFiDepositTransactionResponseData read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of BuildDeFiDepositTransactionResponseData given an JSON string + * + * @param jsonString JSON string + * @return An instance of BuildDeFiDepositTransactionResponseData + * @throws IOException if the JSON string is invalid with respect to + * BuildDeFiDepositTransactionResponseData + */ + public static BuildDeFiDepositTransactionResponseData fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, BuildDeFiDepositTransactionResponseData.class); + } + + /** + * Convert an instance of BuildDeFiDepositTransactionResponseData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildDeFiDepositTransactionResponseDataDataListInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildDeFiDepositTransactionResponseDataDataListInner.java new file mode 100644 index 0000000..b0c24a9 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildDeFiDepositTransactionResponseDataDataListInner.java @@ -0,0 +1,625 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** + * A single unsigned transaction to sign and broadcast. The `dataList` is ordered: APPROVE + * items precede the main action. EVM chains return `to`/`value` (hex) and hex + * calldata in `data`. **Number-format conventions for this object** — `value` + * is a `0x`-prefixed hex string; `gasLimit`, `gasPrice`, + * `maxPriorityFeePerGas`, and `maxFeePerGas` are decimal strings. Mixed + * hex/decimal within the same object is by design (it mirrors the on-chain transaction fields); + * always parse gas fields with base-10 and `value` with base-16. **BSC and EIP-1559**: + * this release is BSC only. BSC is an EIP-1559 chain, so build responses populate + * `maxFeePerGas` and `maxPriorityFeePerGas`; `gasPrice` is + * `null` (legacy-only). The nullable markers below are retained so the schema also + * describes non-1559 chains in later releases — on BSC the 1559 fields are present and the legacy + * `gasPrice` is `null`. `to` and `value` are non-null for + * every action item on BSC. + */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class BuildDeFiDepositTransactionResponseDataDataListInner { + public static final String SERIALIZED_NAME_CALL_DATA_TYPE = "callDataType"; + + @SerializedName(SERIALIZED_NAME_CALL_DATA_TYPE) + @jakarta.annotation.Nullable + private String callDataType; + + public static final String SERIALIZED_NAME_FROM = "from"; + + @SerializedName(SERIALIZED_NAME_FROM) + @jakarta.annotation.Nullable + private String from; + + public static final String SERIALIZED_NAME_TO = "to"; + + @SerializedName(SERIALIZED_NAME_TO) + @jakarta.annotation.Nullable + private String to; + + public static final String SERIALIZED_NAME_VALUE = "value"; + + @SerializedName(SERIALIZED_NAME_VALUE) + @jakarta.annotation.Nullable + private String value; + + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + @jakarta.annotation.Nullable + private String data; + + public static final String SERIALIZED_NAME_GAS_LIMIT = "gasLimit"; + + @SerializedName(SERIALIZED_NAME_GAS_LIMIT) + @jakarta.annotation.Nullable + private String gasLimit; + + public static final String SERIALIZED_NAME_GAS_PRICE = "gasPrice"; + + @SerializedName(SERIALIZED_NAME_GAS_PRICE) + @jakarta.annotation.Nullable + private String gasPrice; + + public static final String SERIALIZED_NAME_MAX_PRIORITY_FEE_PER_GAS = "maxPriorityFeePerGas"; + + @SerializedName(SERIALIZED_NAME_MAX_PRIORITY_FEE_PER_GAS) + @jakarta.annotation.Nullable + private String maxPriorityFeePerGas; + + public static final String SERIALIZED_NAME_MAX_FEE_PER_GAS = "maxFeePerGas"; + + @SerializedName(SERIALIZED_NAME_MAX_FEE_PER_GAS) + @jakarta.annotation.Nullable + private String maxFeePerGas; + + public BuildDeFiDepositTransactionResponseDataDataListInner() {} + + public BuildDeFiDepositTransactionResponseDataDataListInner callDataType( + @jakarta.annotation.Nullable String callDataType) { + this.callDataType = callDataType; + return this; + } + + /** + * Action kind of this item: - `APPROVE` — ERC-20 approval, must be signed/broadcast + * and confirmed before the main action - `DEPOSIT` / `REDEEM` / + * `LP_ADD` / `LP_REMOVE` / `CLAIM` — the main action. + * `LP_ADD` / `LP_REMOVE` are the LP add / remove legs (the same build path + * as deposit / redeem for liquidity-pool investments; the kind reflects the on-chain action, + * not the entry endpoint). + * + * @return callDataType + */ + @jakarta.annotation.Nullable + public String getCallDataType() { + return callDataType; + } + + public void setCallDataType(@jakarta.annotation.Nullable String callDataType) { + this.callDataType = callDataType; + } + + public BuildDeFiDepositTransactionResponseDataDataListInner from( + @jakarta.annotation.Nullable String from) { + this.from = from; + return this; + } + + /** + * User wallet address (the signer / sender). EIP-55 checksummed — normalize with + * `to_checksum_address` before signing if your signer requires it. + * + * @return from + */ + @jakarta.annotation.Nullable + public String getFrom() { + return from; + } + + public void setFrom(@jakarta.annotation.Nullable String from) { + this.from = from; + } + + public BuildDeFiDepositTransactionResponseDataDataListInner to( + @jakarta.annotation.Nullable String to) { + this.to = to; + return this; + } + + /** + * Target contract address. EIP-55 checksummed, same format as `from`. Non-null on BSC + * for every action item. + * + * @return to + */ + @jakarta.annotation.Nullable + public String getTo() { + return to; + } + + public void setTo(@jakarta.annotation.Nullable String to) { + this.to = to; + } + + public BuildDeFiDepositTransactionResponseDataDataListInner value( + @jakarta.annotation.Nullable String value) { + this.value = value; + return this; + } + + /** + * Native-asset value as a `0x`-prefixed hex string. Non-null on BSC for action items. + * + * @return value + */ + @jakarta.annotation.Nullable + public String getValue() { + return value; + } + + public void setValue(@jakarta.annotation.Nullable String value) { + this.value = value; + } + + public BuildDeFiDepositTransactionResponseDataDataListInner data( + @jakarta.annotation.Nullable String data) { + this.data = data; + return this; + } + + /** + * Serialized transaction data, as a `0x`-prefixed hex calldata string. + * + * @return data + */ + @jakarta.annotation.Nullable + public String getData() { + return data; + } + + public void setData(@jakarta.annotation.Nullable String data) { + this.data = data; + } + + public BuildDeFiDepositTransactionResponseDataDataListInner gasLimit( + @jakarta.annotation.Nullable String gasLimit) { + this.gasLimit = gasLimit; + return this; + } + + /** + * Suggested gas limit (decimal string). `null` when estimation fails. + * + * @return gasLimit + */ + @jakarta.annotation.Nullable + public String getGasLimit() { + return gasLimit; + } + + public void setGasLimit(@jakarta.annotation.Nullable String gasLimit) { + this.gasLimit = gasLimit; + } + + public BuildDeFiDepositTransactionResponseDataDataListInner gasPrice( + @jakarta.annotation.Nullable String gasPrice) { + this.gasPrice = gasPrice; + return this; + } + + /** + * Legacy gas price, decimal string. `null` on EIP-1559 chains such as BSC (use + * `maxFeePerGas` / `maxPriorityFeePerGas` instead). + * + * @return gasPrice + */ + @jakarta.annotation.Nullable + public String getGasPrice() { + return gasPrice; + } + + public void setGasPrice(@jakarta.annotation.Nullable String gasPrice) { + this.gasPrice = gasPrice; + } + + public BuildDeFiDepositTransactionResponseDataDataListInner maxPriorityFeePerGas( + @jakarta.annotation.Nullable String maxPriorityFeePerGas) { + this.maxPriorityFeePerGas = maxPriorityFeePerGas; + return this; + } + + /** + * EIP-1559 priority fee in wei (decimal string). `null` on non-1559 chains. + * + * @return maxPriorityFeePerGas + */ + @jakarta.annotation.Nullable + public String getMaxPriorityFeePerGas() { + return maxPriorityFeePerGas; + } + + public void setMaxPriorityFeePerGas(@jakarta.annotation.Nullable String maxPriorityFeePerGas) { + this.maxPriorityFeePerGas = maxPriorityFeePerGas; + } + + public BuildDeFiDepositTransactionResponseDataDataListInner maxFeePerGas( + @jakarta.annotation.Nullable String maxFeePerGas) { + this.maxFeePerGas = maxFeePerGas; + return this; + } + + /** + * EIP-1559 max fee per gas in wei (decimal string). `null` on non-1559 chains. + * + * @return maxFeePerGas + */ + @jakarta.annotation.Nullable + public String getMaxFeePerGas() { + return maxFeePerGas; + } + + public void setMaxFeePerGas(@jakarta.annotation.Nullable String maxFeePerGas) { + this.maxFeePerGas = maxFeePerGas; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BuildDeFiDepositTransactionResponseDataDataListInner + buildDeFiDepositTransactionResponseDataDataListInner = + (BuildDeFiDepositTransactionResponseDataDataListInner) o; + return Objects.equals( + this.callDataType, + buildDeFiDepositTransactionResponseDataDataListInner.callDataType) + && Objects.equals( + this.from, buildDeFiDepositTransactionResponseDataDataListInner.from) + && Objects.equals(this.to, buildDeFiDepositTransactionResponseDataDataListInner.to) + && Objects.equals( + this.value, buildDeFiDepositTransactionResponseDataDataListInner.value) + && Objects.equals( + this.data, buildDeFiDepositTransactionResponseDataDataListInner.data) + && Objects.equals( + this.gasLimit, + buildDeFiDepositTransactionResponseDataDataListInner.gasLimit) + && Objects.equals( + this.gasPrice, + buildDeFiDepositTransactionResponseDataDataListInner.gasPrice) + && Objects.equals( + this.maxPriorityFeePerGas, + buildDeFiDepositTransactionResponseDataDataListInner.maxPriorityFeePerGas) + && Objects.equals( + this.maxFeePerGas, + buildDeFiDepositTransactionResponseDataDataListInner.maxFeePerGas); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash( + callDataType, + from, + to, + value, + data, + gasLimit, + gasPrice, + maxPriorityFeePerGas, + maxFeePerGas); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BuildDeFiDepositTransactionResponseDataDataListInner {\n"); + sb.append(" callDataType: ").append(toIndentedString(callDataType)).append("\n"); + sb.append(" from: ").append(toIndentedString(from)).append("\n"); + sb.append(" to: ").append(toIndentedString(to)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" gasLimit: ").append(toIndentedString(gasLimit)).append("\n"); + sb.append(" gasPrice: ").append(toIndentedString(gasPrice)).append("\n"); + sb.append(" maxPriorityFeePerGas: ") + .append(toIndentedString(maxPriorityFeePerGas)) + .append("\n"); + sb.append(" maxFeePerGas: ").append(toIndentedString(maxFeePerGas)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object callDataTypeValue = getCallDataType(); + String callDataTypeValueAsString = ""; + callDataTypeValueAsString = callDataTypeValue.toString(); + sb.append("callDataType=").append(urlEncode(callDataTypeValueAsString)).append(""); + Object fromValue = getFrom(); + String fromValueAsString = ""; + fromValueAsString = fromValue.toString(); + sb.append("from=").append(urlEncode(fromValueAsString)).append(""); + Object toValue = getTo(); + String toValueAsString = ""; + toValueAsString = toValue.toString(); + sb.append("to=").append(urlEncode(toValueAsString)).append(""); + Object valueValue = getValue(); + String valueValueAsString = ""; + valueValueAsString = valueValue.toString(); + sb.append("value=").append(urlEncode(valueValueAsString)).append(""); + Object dataValue = getData(); + String dataValueAsString = ""; + dataValueAsString = dataValue.toString(); + sb.append("data=").append(urlEncode(dataValueAsString)).append(""); + Object gasLimitValue = getGasLimit(); + String gasLimitValueAsString = ""; + gasLimitValueAsString = gasLimitValue.toString(); + sb.append("gasLimit=").append(urlEncode(gasLimitValueAsString)).append(""); + Object gasPriceValue = getGasPrice(); + String gasPriceValueAsString = ""; + gasPriceValueAsString = gasPriceValue.toString(); + sb.append("gasPrice=").append(urlEncode(gasPriceValueAsString)).append(""); + Object maxPriorityFeePerGasValue = getMaxPriorityFeePerGas(); + String maxPriorityFeePerGasValueAsString = ""; + maxPriorityFeePerGasValueAsString = maxPriorityFeePerGasValue.toString(); + sb.append("maxPriorityFeePerGas=") + .append(urlEncode(maxPriorityFeePerGasValueAsString)) + .append(""); + Object maxFeePerGasValue = getMaxFeePerGas(); + String maxFeePerGasValueAsString = ""; + maxFeePerGasValueAsString = maxFeePerGasValue.toString(); + sb.append("maxFeePerGas=").append(urlEncode(maxFeePerGasValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("callDataType"); + openapiFields.add("from"); + openapiFields.add("to"); + openapiFields.add("value"); + openapiFields.add("data"); + openapiFields.add("gasLimit"); + openapiFields.add("gasPrice"); + openapiFields.add("maxPriorityFeePerGas"); + openapiFields.add("maxFeePerGas"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * BuildDeFiDepositTransactionResponseDataDataListInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BuildDeFiDepositTransactionResponseDataDataListInner.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " BuildDeFiDepositTransactionResponseDataDataListInner is not" + + " found in the empty JSON string", + BuildDeFiDepositTransactionResponseDataDataListInner + .openapiRequiredFields + .toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("callDataType") != null && !jsonObj.get("callDataType").isJsonNull()) + && !jsonObj.get("callDataType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `callDataType` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("callDataType").toString())); + } + if ((jsonObj.get("from") != null && !jsonObj.get("from").isJsonNull()) + && !jsonObj.get("from").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `from` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("from").toString())); + } + if ((jsonObj.get("to") != null && !jsonObj.get("to").isJsonNull()) + && !jsonObj.get("to").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `to` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("to").toString())); + } + if ((jsonObj.get("value") != null && !jsonObj.get("value").isJsonNull()) + && !jsonObj.get("value").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `value` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("value").toString())); + } + if ((jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) + && !jsonObj.get("data").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `data` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("data").toString())); + } + if ((jsonObj.get("gasLimit") != null && !jsonObj.get("gasLimit").isJsonNull()) + && !jsonObj.get("gasLimit").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `gasLimit` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("gasLimit").toString())); + } + if ((jsonObj.get("gasPrice") != null && !jsonObj.get("gasPrice").isJsonNull()) + && !jsonObj.get("gasPrice").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `gasPrice` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("gasPrice").toString())); + } + if ((jsonObj.get("maxPriorityFeePerGas") != null + && !jsonObj.get("maxPriorityFeePerGas").isJsonNull()) + && !jsonObj.get("maxPriorityFeePerGas").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `maxPriorityFeePerGas` to be a primitive type in" + + " the JSON string but got `%s`", + jsonObj.get("maxPriorityFeePerGas").toString())); + } + if ((jsonObj.get("maxFeePerGas") != null && !jsonObj.get("maxFeePerGas").isJsonNull()) + && !jsonObj.get("maxFeePerGas").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `maxFeePerGas` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("maxFeePerGas").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BuildDeFiDepositTransactionResponseDataDataListInner.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'BuildDeFiDepositTransactionResponseDataDataListInner' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, + TypeToken.get( + BuildDeFiDepositTransactionResponseDataDataListInner.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, + BuildDeFiDepositTransactionResponseDataDataListInner value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BuildDeFiDepositTransactionResponseDataDataListInner read( + JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of BuildDeFiDepositTransactionResponseDataDataListInner given an JSON + * string + * + * @param jsonString JSON string + * @return An instance of BuildDeFiDepositTransactionResponseDataDataListInner + * @throws IOException if the JSON string is invalid with respect to + * BuildDeFiDepositTransactionResponseDataDataListInner + */ + public static BuildDeFiDepositTransactionResponseDataDataListInner fromJson(String jsonString) + throws IOException { + return JSON.getGson() + .fromJson(jsonString, BuildDeFiDepositTransactionResponseDataDataListInner.class); + } + + /** + * Convert an instance of BuildDeFiDepositTransactionResponseDataDataListInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildDeFiDepositTransactionResponseDataPreview.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildDeFiDepositTransactionResponseDataPreview.java new file mode 100644 index 0000000..0fd0542 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildDeFiDepositTransactionResponseDataPreview.java @@ -0,0 +1,494 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; +import org.hibernate.validator.constraints.*; + +/** + * Simulation result returned by the build endpoints when `simulate=true`. Includes + * whether the action is expected to succeed, the projected balance change, the estimated network + * fee, and — for lending protocols — the health-factor change. `balanceChange`, + * `feeAndContract`, `healthFactor`, and `warnings` each have a fixed + * structure (see below); the number of entries and some inner values vary by protocol. + */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class BuildDeFiDepositTransactionResponseDataPreview { + public static final String SERIALIZED_NAME_SUCCESS = "success"; + + @SerializedName(SERIALIZED_NAME_SUCCESS) + @jakarta.annotation.Nullable + private Boolean success; + + public static final String SERIALIZED_NAME_BALANCE_CHANGE = "balanceChange"; + + @SerializedName(SERIALIZED_NAME_BALANCE_CHANGE) + @jakarta.annotation.Nullable + private List<@Valid DefiPreviewBalanceChangeInner> balanceChange; + + public static final String SERIALIZED_NAME_FEE_AND_CONTRACT = "feeAndContract"; + + @SerializedName(SERIALIZED_NAME_FEE_AND_CONTRACT) + @jakarta.annotation.Nullable + private DefiPreviewFeeAndContract feeAndContract; + + public static final String SERIALIZED_NAME_HEALTH_FACTOR = "healthFactor"; + + @SerializedName(SERIALIZED_NAME_HEALTH_FACTOR) + @jakarta.annotation.Nullable + private DefiPreviewHealthFactor healthFactor; + + public static final String SERIALIZED_NAME_WARNINGS = "warnings"; + + @SerializedName(SERIALIZED_NAME_WARNINGS) + @jakarta.annotation.Nullable + private List<@Valid DefiPreviewWarningsInner> warnings; + + public static final String SERIALIZED_NAME_ERROR_MESSAGE = "errorMessage"; + + @SerializedName(SERIALIZED_NAME_ERROR_MESSAGE) + @jakarta.annotation.Nullable + private String errorMessage; + + public BuildDeFiDepositTransactionResponseDataPreview() {} + + public BuildDeFiDepositTransactionResponseDataPreview success( + @jakarta.annotation.Nullable Boolean success) { + this.success = success; + return this; + } + + /** + * Whether the simulated transaction is expected to succeed on-chain. + * + * @return success + */ + @jakarta.annotation.Nullable + public Boolean getSuccess() { + return success; + } + + public void setSuccess(@jakarta.annotation.Nullable Boolean success) { + this.success = success; + } + + public BuildDeFiDepositTransactionResponseDataPreview balanceChange( + @jakarta.annotation.Nullable List<@Valid DefiPreviewBalanceChangeInner> balanceChange) { + this.balanceChange = balanceChange; + return this; + } + + public BuildDeFiDepositTransactionResponseDataPreview addBalanceChangeItem( + DefiPreviewBalanceChangeInner balanceChangeItem) { + if (this.balanceChange == null) { + this.balanceChange = new ArrayList<>(); + } + this.balanceChange.add(balanceChangeItem); + return this; + } + + /** + * Signed token balance deltas from the simulation. Each entry has `tokenType`, + * `tokenSymbol`, `tokenAddress`, `tokenDecimals`, + * `amount` (positive = received, negative = spent), `valueUsd`, + * and an optional `tokenId`. + * + * @return balanceChange + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid DefiPreviewBalanceChangeInner> getBalanceChange() { + return balanceChange; + } + + public void setBalanceChange( + @jakarta.annotation.Nullable List<@Valid DefiPreviewBalanceChangeInner> balanceChange) { + this.balanceChange = balanceChange; + } + + public BuildDeFiDepositTransactionResponseDataPreview feeAndContract( + @jakarta.annotation.Nullable DefiPreviewFeeAndContract feeAndContract) { + this.feeAndContract = feeAndContract; + return this; + } + + /** + * Get feeAndContract + * + * @return feeAndContract + */ + @jakarta.annotation.Nullable + @Valid + public DefiPreviewFeeAndContract getFeeAndContract() { + return feeAndContract; + } + + public void setFeeAndContract( + @jakarta.annotation.Nullable DefiPreviewFeeAndContract feeAndContract) { + this.feeAndContract = feeAndContract; + } + + public BuildDeFiDepositTransactionResponseDataPreview healthFactor( + @jakarta.annotation.Nullable DefiPreviewHealthFactor healthFactor) { + this.healthFactor = healthFactor; + return this; + } + + /** + * Get healthFactor + * + * @return healthFactor + */ + @jakarta.annotation.Nullable + @Valid + public DefiPreviewHealthFactor getHealthFactor() { + return healthFactor; + } + + public void setHealthFactor(@jakarta.annotation.Nullable DefiPreviewHealthFactor healthFactor) { + this.healthFactor = healthFactor; + } + + public BuildDeFiDepositTransactionResponseDataPreview warnings( + @jakarta.annotation.Nullable List<@Valid DefiPreviewWarningsInner> warnings) { + this.warnings = warnings; + return this; + } + + public BuildDeFiDepositTransactionResponseDataPreview addWarningsItem( + DefiPreviewWarningsInner warningsItem) { + if (this.warnings == null) { + this.warnings = new ArrayList<>(); + } + this.warnings.add(warningsItem); + return this; + } + + /** + * Non-blocking risk warnings. Empty array when there are no warnings. + * + * @return warnings + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid DefiPreviewWarningsInner> getWarnings() { + return warnings; + } + + public void setWarnings( + @jakarta.annotation.Nullable List<@Valid DefiPreviewWarningsInner> warnings) { + this.warnings = warnings; + } + + public BuildDeFiDepositTransactionResponseDataPreview errorMessage( + @jakarta.annotation.Nullable String errorMessage) { + this.errorMessage = errorMessage; + return this; + } + + /** + * Error message when the simulated transaction is expected to fail. + * + * @return errorMessage + */ + @jakarta.annotation.Nullable + public String getErrorMessage() { + return errorMessage; + } + + public void setErrorMessage(@jakarta.annotation.Nullable String errorMessage) { + this.errorMessage = errorMessage; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BuildDeFiDepositTransactionResponseDataPreview + buildDeFiDepositTransactionResponseDataPreview = + (BuildDeFiDepositTransactionResponseDataPreview) o; + return Objects.equals(this.success, buildDeFiDepositTransactionResponseDataPreview.success) + && Objects.equals( + this.balanceChange, + buildDeFiDepositTransactionResponseDataPreview.balanceChange) + && Objects.equals( + this.feeAndContract, + buildDeFiDepositTransactionResponseDataPreview.feeAndContract) + && Objects.equals( + this.healthFactor, + buildDeFiDepositTransactionResponseDataPreview.healthFactor) + && Objects.equals( + this.warnings, buildDeFiDepositTransactionResponseDataPreview.warnings) + && Objects.equals( + this.errorMessage, + buildDeFiDepositTransactionResponseDataPreview.errorMessage); + } + + @Override + public int hashCode() { + return Objects.hash( + success, balanceChange, feeAndContract, healthFactor, warnings, errorMessage); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BuildDeFiDepositTransactionResponseDataPreview {\n"); + sb.append(" success: ").append(toIndentedString(success)).append("\n"); + sb.append(" balanceChange: ").append(toIndentedString(balanceChange)).append("\n"); + sb.append(" feeAndContract: ").append(toIndentedString(feeAndContract)).append("\n"); + sb.append(" healthFactor: ").append(toIndentedString(healthFactor)).append("\n"); + sb.append(" warnings: ").append(toIndentedString(warnings)).append("\n"); + sb.append(" errorMessage: ").append(toIndentedString(errorMessage)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object successValue = getSuccess(); + String successValueAsString = ""; + successValueAsString = successValue.toString(); + sb.append("success=").append(urlEncode(successValueAsString)).append(""); + Object balanceChangeValue = getBalanceChange(); + String balanceChangeValueAsString = ""; + balanceChangeValueAsString = + (String) + ((Collection) balanceChangeValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("balanceChange=").append(urlEncode(balanceChangeValueAsString)).append(""); + Object feeAndContractValue = getFeeAndContract(); + String feeAndContractValueAsString = ""; + feeAndContractValueAsString = feeAndContractValue.toString(); + sb.append("feeAndContract=").append(urlEncode(feeAndContractValueAsString)).append(""); + Object healthFactorValue = getHealthFactor(); + String healthFactorValueAsString = ""; + healthFactorValueAsString = healthFactorValue.toString(); + sb.append("healthFactor=").append(urlEncode(healthFactorValueAsString)).append(""); + Object warningsValue = getWarnings(); + String warningsValueAsString = ""; + warningsValueAsString = + (String) + ((Collection) warningsValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("warnings=").append(urlEncode(warningsValueAsString)).append(""); + Object errorMessageValue = getErrorMessage(); + String errorMessageValueAsString = ""; + errorMessageValueAsString = errorMessageValue.toString(); + sb.append("errorMessage=").append(urlEncode(errorMessageValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("success"); + openapiFields.add("balanceChange"); + openapiFields.add("feeAndContract"); + openapiFields.add("healthFactor"); + openapiFields.add("warnings"); + openapiFields.add("errorMessage"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * BuildDeFiDepositTransactionResponseDataPreview + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BuildDeFiDepositTransactionResponseDataPreview.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " BuildDeFiDepositTransactionResponseDataPreview is not found" + + " in the empty JSON string", + BuildDeFiDepositTransactionResponseDataPreview.openapiRequiredFields + .toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("balanceChange") != null && !jsonObj.get("balanceChange").isJsonNull()) { + JsonArray jsonArraybalanceChange = jsonObj.getAsJsonArray("balanceChange"); + if (jsonArraybalanceChange != null) { + // ensure the json data is an array + if (!jsonObj.get("balanceChange").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `balanceChange` to be an array in the JSON" + + " string but got `%s`", + jsonObj.get("balanceChange").toString())); + } + + // validate the optional field `balanceChange` (array) + for (int i = 0; i < jsonArraybalanceChange.size(); i++) { + DefiPreviewBalanceChangeInner.validateJsonElement( + jsonArraybalanceChange.get(i)); + } + ; + } + } + // validate the optional field `feeAndContract` + if (jsonObj.get("feeAndContract") != null && !jsonObj.get("feeAndContract").isJsonNull()) { + DefiPreviewFeeAndContract.validateJsonElement(jsonObj.get("feeAndContract")); + } + // validate the optional field `healthFactor` + if (jsonObj.get("healthFactor") != null && !jsonObj.get("healthFactor").isJsonNull()) { + DefiPreviewHealthFactor.validateJsonElement(jsonObj.get("healthFactor")); + } + if (jsonObj.get("warnings") != null && !jsonObj.get("warnings").isJsonNull()) { + JsonArray jsonArraywarnings = jsonObj.getAsJsonArray("warnings"); + if (jsonArraywarnings != null) { + // ensure the json data is an array + if (!jsonObj.get("warnings").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `warnings` to be an array in the JSON" + + " string but got `%s`", + jsonObj.get("warnings").toString())); + } + + // validate the optional field `warnings` (array) + for (int i = 0; i < jsonArraywarnings.size(); i++) { + DefiPreviewWarningsInner.validateJsonElement(jsonArraywarnings.get(i)); + } + ; + } + } + if ((jsonObj.get("errorMessage") != null && !jsonObj.get("errorMessage").isJsonNull()) + && !jsonObj.get("errorMessage").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `errorMessage` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("errorMessage").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BuildDeFiDepositTransactionResponseDataPreview.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'BuildDeFiDepositTransactionResponseDataPreview' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, + TypeToken.get(BuildDeFiDepositTransactionResponseDataPreview.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, + BuildDeFiDepositTransactionResponseDataPreview value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BuildDeFiDepositTransactionResponseDataPreview read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of BuildDeFiDepositTransactionResponseDataPreview given an JSON string + * + * @param jsonString JSON string + * @return An instance of BuildDeFiDepositTransactionResponseDataPreview + * @throws IOException if the JSON string is invalid with respect to + * BuildDeFiDepositTransactionResponseDataPreview + */ + public static BuildDeFiDepositTransactionResponseDataPreview fromJson(String jsonString) + throws IOException { + return JSON.getGson() + .fromJson(jsonString, BuildDeFiDepositTransactionResponseDataPreview.class); + } + + /** + * Convert an instance of BuildDeFiDepositTransactionResponseDataPreview to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildDeFiRedeemTransactionRequest.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildDeFiRedeemTransactionRequest.java new file mode 100644 index 0000000..45d943a --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildDeFiRedeemTransactionRequest.java @@ -0,0 +1,433 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** BuildDeFiRedeemTransactionRequest */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class BuildDeFiRedeemTransactionRequest { + public static final String SERIALIZED_NAME_ADDRESS = "address"; + + @SerializedName(SERIALIZED_NAME_ADDRESS) + @jakarta.annotation.Nonnull + private String address; + + public static final String SERIALIZED_NAME_INVESTMENT_ID = "investmentId"; + + @SerializedName(SERIALIZED_NAME_INVESTMENT_ID) + @jakarta.annotation.Nonnull + private String investmentId; + + public static final String SERIALIZED_NAME_TOKEN = "token"; + + @SerializedName(SERIALIZED_NAME_TOKEN) + @jakarta.annotation.Nullable + private BuildDeFiRedeemTransactionRequestToken token; + + public static final String SERIALIZED_NAME_RATIO = "ratio"; + + @SerializedName(SERIALIZED_NAME_RATIO) + @jakarta.annotation.Nullable + private String ratio; + + public static final String SERIALIZED_NAME_SLIPPAGE_BPS = "slippageBps"; + + @SerializedName(SERIALIZED_NAME_SLIPPAGE_BPS) + @jakarta.annotation.Nullable + private String slippageBps; + + public static final String SERIALIZED_NAME_SIMULATE = "simulate"; + + @SerializedName(SERIALIZED_NAME_SIMULATE) + @jakarta.annotation.Nullable + private Boolean simulate; + + public BuildDeFiRedeemTransactionRequest() {} + + public BuildDeFiRedeemTransactionRequest address(@jakarta.annotation.Nonnull String address) { + this.address = address; + return this; + } + + /** + * User wallet address (the signer / sender). + * + * @return address + */ + @jakarta.annotation.Nonnull + @NotNull + public String getAddress() { + return address; + } + + public void setAddress(@jakarta.annotation.Nonnull String address) { + this.address = address; + } + + public BuildDeFiRedeemTransactionRequest investmentId( + @jakarta.annotation.Nonnull String investmentId) { + this.investmentId = investmentId; + return this; + } + + /** + * Investment product ID (chain-agnostic). The service resolves the chain from this ID. + * + * @return investmentId + */ + @jakarta.annotation.Nonnull + @NotNull + public String getInvestmentId() { + return investmentId; + } + + public void setInvestmentId(@jakarta.annotation.Nonnull String investmentId) { + this.investmentId = investmentId; + } + + public BuildDeFiRedeemTransactionRequest token( + @jakarta.annotation.Nullable BuildDeFiRedeemTransactionRequestToken token) { + this.token = token; + return this; + } + + /** + * Get token + * + * @return token + */ + @jakarta.annotation.Nullable + @Valid + public BuildDeFiRedeemTransactionRequestToken getToken() { + return token; + } + + public void setToken( + @jakarta.annotation.Nullable BuildDeFiRedeemTransactionRequestToken token) { + this.token = token; + } + + public BuildDeFiRedeemTransactionRequest ratio(@jakarta.annotation.Nullable String ratio) { + this.ratio = ratio; + return this; + } + + /** + * Redeem ratio, mutually exclusive with `token`. Omitted / blank → exact-amount + * redeem via `token` (`tokenAddress` + `amount`, position not + * queried). Present → must parse as a decimal in `(0, 1]`; the service queries the + * on-chain position under `investmentId` and scales each token amount by + * `ratio` (floored to decimals). `\"1\"` = full (max) + * redeem; in this mode `token` is ignored. + * + * @return ratio + */ + @jakarta.annotation.Nullable + public String getRatio() { + return ratio; + } + + public void setRatio(@jakarta.annotation.Nullable String ratio) { + this.ratio = ratio; + } + + public BuildDeFiRedeemTransactionRequest slippageBps( + @jakarta.annotation.Nullable String slippageBps) { + this.slippageBps = slippageBps; + return this; + } + + /** + * Slippage tolerance in basis points (e.g. `300` = 3%). + * + * @return slippageBps + */ + @jakarta.annotation.Nullable + public String getSlippageBps() { + return slippageBps; + } + + public void setSlippageBps(@jakarta.annotation.Nullable String slippageBps) { + this.slippageBps = slippageBps; + } + + public BuildDeFiRedeemTransactionRequest simulate( + @jakarta.annotation.Nullable Boolean simulate) { + this.simulate = simulate; + return this; + } + + /** + * When `true`, the response also includes a `preview` object. Default + * `false`. If the simulated transaction reverts, the request returns an error code + * instead of a `200` with `preview.success=false`: `40485` + * when the redeem amount exceeds the current position, `40484` for any other revert + * (see Error Codes). + * + * @return simulate + */ + @jakarta.annotation.Nullable + public Boolean getSimulate() { + return simulate; + } + + public void setSimulate(@jakarta.annotation.Nullable Boolean simulate) { + this.simulate = simulate; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BuildDeFiRedeemTransactionRequest buildDeFiRedeemTransactionRequest = + (BuildDeFiRedeemTransactionRequest) o; + return Objects.equals(this.address, buildDeFiRedeemTransactionRequest.address) + && Objects.equals(this.investmentId, buildDeFiRedeemTransactionRequest.investmentId) + && Objects.equals(this.token, buildDeFiRedeemTransactionRequest.token) + && Objects.equals(this.ratio, buildDeFiRedeemTransactionRequest.ratio) + && Objects.equals(this.slippageBps, buildDeFiRedeemTransactionRequest.slippageBps) + && Objects.equals(this.simulate, buildDeFiRedeemTransactionRequest.simulate); + } + + @Override + public int hashCode() { + return Objects.hash(address, investmentId, token, ratio, slippageBps, simulate); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BuildDeFiRedeemTransactionRequest {\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append(" investmentId: ").append(toIndentedString(investmentId)).append("\n"); + sb.append(" token: ").append(toIndentedString(token)).append("\n"); + sb.append(" ratio: ").append(toIndentedString(ratio)).append("\n"); + sb.append(" slippageBps: ").append(toIndentedString(slippageBps)).append("\n"); + sb.append(" simulate: ").append(toIndentedString(simulate)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object addressValue = getAddress(); + String addressValueAsString = ""; + addressValueAsString = addressValue.toString(); + sb.append("address=").append(urlEncode(addressValueAsString)).append(""); + Object investmentIdValue = getInvestmentId(); + String investmentIdValueAsString = ""; + investmentIdValueAsString = investmentIdValue.toString(); + sb.append("investmentId=").append(urlEncode(investmentIdValueAsString)).append(""); + Object tokenValue = getToken(); + String tokenValueAsString = ""; + tokenValueAsString = tokenValue.toString(); + sb.append("token=").append(urlEncode(tokenValueAsString)).append(""); + Object ratioValue = getRatio(); + String ratioValueAsString = ""; + ratioValueAsString = ratioValue.toString(); + sb.append("ratio=").append(urlEncode(ratioValueAsString)).append(""); + Object slippageBpsValue = getSlippageBps(); + String slippageBpsValueAsString = ""; + slippageBpsValueAsString = slippageBpsValue.toString(); + sb.append("slippageBps=").append(urlEncode(slippageBpsValueAsString)).append(""); + Object simulateValue = getSimulate(); + String simulateValueAsString = ""; + simulateValueAsString = simulateValue.toString(); + sb.append("simulate=").append(urlEncode(simulateValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("address"); + openapiFields.add("investmentId"); + openapiFields.add("token"); + openapiFields.add("ratio"); + openapiFields.add("slippageBps"); + openapiFields.add("simulate"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("address"); + openapiRequiredFields.add("investmentId"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * BuildDeFiRedeemTransactionRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BuildDeFiRedeemTransactionRequest.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in BuildDeFiRedeemTransactionRequest is" + + " not found in the empty JSON string", + BuildDeFiRedeemTransactionRequest.openapiRequiredFields + .toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BuildDeFiRedeemTransactionRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("address").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `address` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("address").toString())); + } + if (!jsonObj.get("investmentId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `investmentId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("investmentId").toString())); + } + // validate the optional field `token` + if (jsonObj.get("token") != null && !jsonObj.get("token").isJsonNull()) { + BuildDeFiRedeemTransactionRequestToken.validateJsonElement(jsonObj.get("token")); + } + if ((jsonObj.get("ratio") != null && !jsonObj.get("ratio").isJsonNull()) + && !jsonObj.get("ratio").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `ratio` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("ratio").toString())); + } + if ((jsonObj.get("slippageBps") != null && !jsonObj.get("slippageBps").isJsonNull()) + && !jsonObj.get("slippageBps").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `slippageBps` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("slippageBps").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BuildDeFiRedeemTransactionRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BuildDeFiRedeemTransactionRequest' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(BuildDeFiRedeemTransactionRequest.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, BuildDeFiRedeemTransactionRequest value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BuildDeFiRedeemTransactionRequest read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of BuildDeFiRedeemTransactionRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of BuildDeFiRedeemTransactionRequest + * @throws IOException if the JSON string is invalid with respect to + * BuildDeFiRedeemTransactionRequest + */ + public static BuildDeFiRedeemTransactionRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BuildDeFiRedeemTransactionRequest.class); + } + + /** + * Convert an instance of BuildDeFiRedeemTransactionRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildDeFiRedeemTransactionRequestToken.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildDeFiRedeemTransactionRequestToken.java new file mode 100644 index 0000000..768a7ec --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildDeFiRedeemTransactionRequestToken.java @@ -0,0 +1,279 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** + * A `(tokenAddress, amount)` pair. `amount` is a human-readable decimal string + * (NOT the token's smallest unit); the service converts it according to the token's + * decimals. For the native asset use the sentinel + * `0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee` (40 `e`s). + */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class BuildDeFiRedeemTransactionRequestToken { + public static final String SERIALIZED_NAME_TOKEN_ADDRESS = "tokenAddress"; + + @SerializedName(SERIALIZED_NAME_TOKEN_ADDRESS) + @jakarta.annotation.Nonnull + private String tokenAddress; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + + @SerializedName(SERIALIZED_NAME_AMOUNT) + @jakarta.annotation.Nonnull + private String amount; + + public BuildDeFiRedeemTransactionRequestToken() {} + + public BuildDeFiRedeemTransactionRequestToken tokenAddress( + @jakarta.annotation.Nonnull String tokenAddress) { + this.tokenAddress = tokenAddress; + return this; + } + + /** + * Token contract address; the native-asset sentinel for the native coin. + * + * @return tokenAddress + */ + @jakarta.annotation.Nonnull + @NotNull + public String getTokenAddress() { + return tokenAddress; + } + + public void setTokenAddress(@jakarta.annotation.Nonnull String tokenAddress) { + this.tokenAddress = tokenAddress; + } + + public BuildDeFiRedeemTransactionRequestToken amount( + @jakarta.annotation.Nonnull String amount) { + this.amount = amount; + return this; + } + + /** + * Human-readable amount as a decimal string, e.g. \"1.5\", \"100\". + * + * @return amount + */ + @jakarta.annotation.Nonnull + @NotNull + public String getAmount() { + return amount; + } + + public void setAmount(@jakarta.annotation.Nonnull String amount) { + this.amount = amount; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BuildDeFiRedeemTransactionRequestToken buildDeFiRedeemTransactionRequestToken = + (BuildDeFiRedeemTransactionRequestToken) o; + return Objects.equals( + this.tokenAddress, buildDeFiRedeemTransactionRequestToken.tokenAddress) + && Objects.equals(this.amount, buildDeFiRedeemTransactionRequestToken.amount); + } + + @Override + public int hashCode() { + return Objects.hash(tokenAddress, amount); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BuildDeFiRedeemTransactionRequestToken {\n"); + sb.append(" tokenAddress: ").append(toIndentedString(tokenAddress)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object tokenAddressValue = getTokenAddress(); + String tokenAddressValueAsString = ""; + tokenAddressValueAsString = tokenAddressValue.toString(); + sb.append("tokenAddress=").append(urlEncode(tokenAddressValueAsString)).append(""); + Object amountValue = getAmount(); + String amountValueAsString = ""; + amountValueAsString = amountValue.toString(); + sb.append("amount=").append(urlEncode(amountValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("tokenAddress"); + openapiFields.add("amount"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("tokenAddress"); + openapiRequiredFields.add("amount"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * BuildDeFiRedeemTransactionRequestToken + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BuildDeFiRedeemTransactionRequestToken.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in BuildDeFiRedeemTransactionRequestToken" + + " is not found in the empty JSON string", + BuildDeFiRedeemTransactionRequestToken.openapiRequiredFields + .toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BuildDeFiRedeemTransactionRequestToken.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("tokenAddress").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `tokenAddress` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("tokenAddress").toString())); + } + if (!jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `amount` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("amount").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BuildDeFiRedeemTransactionRequestToken.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BuildDeFiRedeemTransactionRequestToken' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(BuildDeFiRedeemTransactionRequestToken.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, BuildDeFiRedeemTransactionRequestToken value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BuildDeFiRedeemTransactionRequestToken read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of BuildDeFiRedeemTransactionRequestToken given an JSON string + * + * @param jsonString JSON string + * @return An instance of BuildDeFiRedeemTransactionRequestToken + * @throws IOException if the JSON string is invalid with respect to + * BuildDeFiRedeemTransactionRequestToken + */ + public static BuildDeFiRedeemTransactionRequestToken fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, BuildDeFiRedeemTransactionRequestToken.class); + } + + /** + * Convert an instance of BuildDeFiRedeemTransactionRequestToken to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildDeFiRedeemTransactionResponse.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildDeFiRedeemTransactionResponse.java new file mode 100644 index 0000000..25c081e --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildDeFiRedeemTransactionResponse.java @@ -0,0 +1,355 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** BuildDeFiRedeemTransactionResponse */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class BuildDeFiRedeemTransactionResponse { + public static final String SERIALIZED_NAME_CODE = "code"; + + @SerializedName(SERIALIZED_NAME_CODE) + @jakarta.annotation.Nullable + private Integer code; + + public static final String SERIALIZED_NAME_MSG = "msg"; + + @SerializedName(SERIALIZED_NAME_MSG) + @jakarta.annotation.Nullable + private String msg; + + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + @jakarta.annotation.Nullable + private BuildDeFiDepositTransactionResponseData data; + + public static final String SERIALIZED_NAME_TIMESTAMP = "timestamp"; + + @SerializedName(SERIALIZED_NAME_TIMESTAMP) + @jakarta.annotation.Nullable + private Long timestamp; + + public static final String SERIALIZED_NAME_SUCCESS = "success"; + + @SerializedName(SERIALIZED_NAME_SUCCESS) + @jakarta.annotation.Nullable + private Boolean success; + + public BuildDeFiRedeemTransactionResponse() {} + + public BuildDeFiRedeemTransactionResponse code(@jakarta.annotation.Nullable Integer code) { + this.code = code; + return this; + } + + /** + * Business status code. 0 indicates success. + * + * @return code + */ + @jakarta.annotation.Nullable + public Integer getCode() { + return code; + } + + public void setCode(@jakarta.annotation.Nullable Integer code) { + this.code = code; + } + + public BuildDeFiRedeemTransactionResponse msg(@jakarta.annotation.Nullable String msg) { + this.msg = msg; + return this; + } + + /** + * Human-readable status message. + * + * @return msg + */ + @jakarta.annotation.Nullable + public String getMsg() { + return msg; + } + + public void setMsg(@jakarta.annotation.Nullable String msg) { + this.msg = msg; + } + + public BuildDeFiRedeemTransactionResponse data( + @jakarta.annotation.Nullable BuildDeFiDepositTransactionResponseData data) { + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @jakarta.annotation.Nullable + @Valid + public BuildDeFiDepositTransactionResponseData getData() { + return data; + } + + public void setData(@jakarta.annotation.Nullable BuildDeFiDepositTransactionResponseData data) { + this.data = data; + } + + public BuildDeFiRedeemTransactionResponse timestamp( + @jakarta.annotation.Nullable Long timestamp) { + this.timestamp = timestamp; + return this; + } + + /** + * Server timestamp in milliseconds. + * + * @return timestamp + */ + @jakarta.annotation.Nullable + public Long getTimestamp() { + return timestamp; + } + + public void setTimestamp(@jakarta.annotation.Nullable Long timestamp) { + this.timestamp = timestamp; + } + + public BuildDeFiRedeemTransactionResponse success( + @jakarta.annotation.Nullable Boolean success) { + this.success = success; + return this; + } + + /** + * Whether the request succeeded (mirrors `code == 0`). + * + * @return success + */ + @jakarta.annotation.Nullable + public Boolean getSuccess() { + return success; + } + + public void setSuccess(@jakarta.annotation.Nullable Boolean success) { + this.success = success; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BuildDeFiRedeemTransactionResponse buildDeFiRedeemTransactionResponse = + (BuildDeFiRedeemTransactionResponse) o; + return Objects.equals(this.code, buildDeFiRedeemTransactionResponse.code) + && Objects.equals(this.msg, buildDeFiRedeemTransactionResponse.msg) + && Objects.equals(this.data, buildDeFiRedeemTransactionResponse.data) + && Objects.equals(this.timestamp, buildDeFiRedeemTransactionResponse.timestamp) + && Objects.equals(this.success, buildDeFiRedeemTransactionResponse.success); + } + + @Override + public int hashCode() { + return Objects.hash(code, msg, data, timestamp, success); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BuildDeFiRedeemTransactionResponse {\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" msg: ").append(toIndentedString(msg)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" timestamp: ").append(toIndentedString(timestamp)).append("\n"); + sb.append(" success: ").append(toIndentedString(success)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object codeValue = getCode(); + String codeValueAsString = ""; + codeValueAsString = codeValue.toString(); + sb.append("code=").append(urlEncode(codeValueAsString)).append(""); + Object msgValue = getMsg(); + String msgValueAsString = ""; + msgValueAsString = msgValue.toString(); + sb.append("msg=").append(urlEncode(msgValueAsString)).append(""); + Object dataValue = getData(); + String dataValueAsString = ""; + dataValueAsString = dataValue.toString(); + sb.append("data=").append(urlEncode(dataValueAsString)).append(""); + Object timestampValue = getTimestamp(); + String timestampValueAsString = ""; + timestampValueAsString = timestampValue.toString(); + sb.append("timestamp=").append(urlEncode(timestampValueAsString)).append(""); + Object successValue = getSuccess(); + String successValueAsString = ""; + successValueAsString = successValue.toString(); + sb.append("success=").append(urlEncode(successValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("code"); + openapiFields.add("msg"); + openapiFields.add("data"); + openapiFields.add("timestamp"); + openapiFields.add("success"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * BuildDeFiRedeemTransactionResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BuildDeFiRedeemTransactionResponse.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in BuildDeFiRedeemTransactionResponse is" + + " not found in the empty JSON string", + BuildDeFiRedeemTransactionResponse.openapiRequiredFields + .toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("msg") != null && !jsonObj.get("msg").isJsonNull()) + && !jsonObj.get("msg").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `msg` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("msg").toString())); + } + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + BuildDeFiDepositTransactionResponseData.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BuildDeFiRedeemTransactionResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BuildDeFiRedeemTransactionResponse' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(BuildDeFiRedeemTransactionResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, BuildDeFiRedeemTransactionResponse value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BuildDeFiRedeemTransactionResponse read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of BuildDeFiRedeemTransactionResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of BuildDeFiRedeemTransactionResponse + * @throws IOException if the JSON string is invalid with respect to + * BuildDeFiRedeemTransactionResponse + */ + public static BuildDeFiRedeemTransactionResponse fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, BuildDeFiRedeemTransactionResponse.class); + } + + /** + * Convert an instance of BuildDeFiRedeemTransactionResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildLpAddTransactionRequest.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildLpAddTransactionRequest.java new file mode 100644 index 0000000..ce69a62 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildLpAddTransactionRequest.java @@ -0,0 +1,597 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; +import org.hibernate.validator.constraints.*; + +/** BuildLpAddTransactionRequest */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class BuildLpAddTransactionRequest { + public static final String SERIALIZED_NAME_ADDRESS = "address"; + + @SerializedName(SERIALIZED_NAME_ADDRESS) + @jakarta.annotation.Nonnull + private String address; + + public static final String SERIALIZED_NAME_INVESTMENT_ID = "investmentId"; + + @SerializedName(SERIALIZED_NAME_INVESTMENT_ID) + @jakarta.annotation.Nonnull + private String investmentId; + + public static final String SERIALIZED_NAME_TOKEN_LIST = "tokenList"; + + @SerializedName(SERIALIZED_NAME_TOKEN_LIST) + @jakarta.annotation.Nonnull + private List<@Valid BuildLpAddTransactionRequestTokenListInner> tokenList; + + public static final String SERIALIZED_NAME_TICK_LOWER = "tickLower"; + + @SerializedName(SERIALIZED_NAME_TICK_LOWER) + @jakarta.annotation.Nullable + private String tickLower; + + public static final String SERIALIZED_NAME_TICK_UPPER = "tickUpper"; + + @SerializedName(SERIALIZED_NAME_TICK_UPPER) + @jakarta.annotation.Nullable + private String tickUpper; + + public static final String SERIALIZED_NAME_PRICE_RANGE = "priceRange"; + + @SerializedName(SERIALIZED_NAME_PRICE_RANGE) + @jakarta.annotation.Nullable + private String priceRange; + + public static final String SERIALIZED_NAME_NFT_ID = "nftId"; + + @SerializedName(SERIALIZED_NAME_NFT_ID) + @jakarta.annotation.Nullable + private String nftId; + + public static final String SERIALIZED_NAME_SLIPPAGE_BPS = "slippageBps"; + + @SerializedName(SERIALIZED_NAME_SLIPPAGE_BPS) + @jakarta.annotation.Nullable + private String slippageBps; + + public static final String SERIALIZED_NAME_SIMULATE = "simulate"; + + @SerializedName(SERIALIZED_NAME_SIMULATE) + @jakarta.annotation.Nullable + private Boolean simulate; + + public BuildLpAddTransactionRequest() {} + + public BuildLpAddTransactionRequest address(@jakarta.annotation.Nonnull String address) { + this.address = address; + return this; + } + + /** + * User wallet address (the signer / sender). + * + * @return address + */ + @jakarta.annotation.Nonnull + @NotNull + public String getAddress() { + return address; + } + + public void setAddress(@jakarta.annotation.Nonnull String address) { + this.address = address; + } + + public BuildLpAddTransactionRequest investmentId( + @jakarta.annotation.Nonnull String investmentId) { + this.investmentId = investmentId; + return this; + } + + /** + * LP investment product ID (chain-agnostic). + * + * @return investmentId + */ + @jakarta.annotation.Nonnull + @NotNull + public String getInvestmentId() { + return investmentId; + } + + public void setInvestmentId(@jakarta.annotation.Nonnull String investmentId) { + this.investmentId = investmentId; + } + + public BuildLpAddTransactionRequest tokenList( + @jakarta.annotation.Nonnull + List<@Valid BuildLpAddTransactionRequestTokenListInner> tokenList) { + this.tokenList = tokenList; + return this; + } + + public BuildLpAddTransactionRequest addTokenListItem( + BuildLpAddTransactionRequestTokenListInner tokenListItem) { + if (this.tokenList == null) { + this.tokenList = new ArrayList<>(); + } + this.tokenList.add(tokenListItem); + return this; + } + + /** + * Tokens to supply. Two tokens for a standard LP add. + * + * @return tokenList + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public List<@Valid BuildLpAddTransactionRequestTokenListInner> getTokenList() { + return tokenList; + } + + public void setTokenList( + @jakarta.annotation.Nonnull + List<@Valid BuildLpAddTransactionRequestTokenListInner> tokenList) { + this.tokenList = tokenList; + } + + public BuildLpAddTransactionRequest tickLower(@jakarta.annotation.Nullable String tickLower) { + this.tickLower = tickLower; + return this; + } + + /** + * Lower tick bound (raw `int24`) for a new position. MUST be aligned to the + * pool's `tickSpacing`. Pick exactly one tick-range source: + * `tickLower`+`tickUpper`, `priceRange`, or `nftId` (to + * append to an existing position). If several are supplied, the lowest-priority ones are + * ignored (priority: `nftId` > `priceRange` > explicit tick pair). + * + * @return tickLower + */ + @jakarta.annotation.Nullable + public String getTickLower() { + return tickLower; + } + + public void setTickLower(@jakarta.annotation.Nullable String tickLower) { + this.tickLower = tickLower; + } + + public BuildLpAddTransactionRequest tickUpper(@jakarta.annotation.Nullable String tickUpper) { + this.tickUpper = tickUpper; + return this; + } + + /** + * Upper tick bound (raw `int24`) for a new position. MUST be aligned to the + * pool's `tickSpacing`. See `tickLower` for the pick-exactly-one rule. + * + * @return tickUpper + */ + @jakarta.annotation.Nullable + public String getTickUpper() { + return tickUpper; + } + + public void setTickUpper(@jakarta.annotation.Nullable String tickUpper) { + this.tickUpper = tickUpper; + } + + public BuildLpAddTransactionRequest priceRange(@jakarta.annotation.Nullable String priceRange) { + this.priceRange = priceRange; + return this; + } + + /** + * Price range as a percentage (e.g. `\"5\"` = ±5%) for a new position. + * Alternative to `tickLower`+`tickUpper`; see `tickLower` for the + * pick-exactly-one rule. + * + * @return priceRange + */ + @jakarta.annotation.Nullable + public String getPriceRange() { + return priceRange; + } + + public void setPriceRange(@jakarta.annotation.Nullable String priceRange) { + this.priceRange = priceRange; + } + + public BuildLpAddTransactionRequest nftId(@jakarta.annotation.Nullable String nftId) { + this.nftId = nftId; + return this; + } + + /** + * LP NFT token ID, decimal string (e.g. `\"7225901\"` or + * `\"#7225901\"`). Required when appending to an existing position (reuses + * its range); omit for a new position. Highest-priority tick-range source — see + * `tickLower` for the pick-exactly-one rule. The `#` prefix returned by the + * position list may be passed as-is — the service strips it automatically. + * + * @return nftId + */ + @jakarta.annotation.Nullable + public String getNftId() { + return nftId; + } + + public void setNftId(@jakarta.annotation.Nullable String nftId) { + this.nftId = nftId; + } + + public BuildLpAddTransactionRequest slippageBps( + @jakarta.annotation.Nullable String slippageBps) { + this.slippageBps = slippageBps; + return this; + } + + /** + * Slippage tolerance for the LP leg, in basis points (e.g. `300` = 3%). + * + * @return slippageBps + */ + @jakarta.annotation.Nullable + public String getSlippageBps() { + return slippageBps; + } + + public void setSlippageBps(@jakarta.annotation.Nullable String slippageBps) { + this.slippageBps = slippageBps; + } + + public BuildLpAddTransactionRequest simulate(@jakarta.annotation.Nullable Boolean simulate) { + this.simulate = simulate; + return this; + } + + /** + * When `true`, the response also includes a `preview` object. Default + * `false`. If the simulated transaction reverts, the request returns + * `40485` for a specific classified revert reason or `40484` for any other + * revert (see Error Codes). + * + * @return simulate + */ + @jakarta.annotation.Nullable + public Boolean getSimulate() { + return simulate; + } + + public void setSimulate(@jakarta.annotation.Nullable Boolean simulate) { + this.simulate = simulate; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BuildLpAddTransactionRequest buildLpAddTransactionRequest = + (BuildLpAddTransactionRequest) o; + return Objects.equals(this.address, buildLpAddTransactionRequest.address) + && Objects.equals(this.investmentId, buildLpAddTransactionRequest.investmentId) + && Objects.equals(this.tokenList, buildLpAddTransactionRequest.tokenList) + && Objects.equals(this.tickLower, buildLpAddTransactionRequest.tickLower) + && Objects.equals(this.tickUpper, buildLpAddTransactionRequest.tickUpper) + && Objects.equals(this.priceRange, buildLpAddTransactionRequest.priceRange) + && Objects.equals(this.nftId, buildLpAddTransactionRequest.nftId) + && Objects.equals(this.slippageBps, buildLpAddTransactionRequest.slippageBps) + && Objects.equals(this.simulate, buildLpAddTransactionRequest.simulate); + } + + @Override + public int hashCode() { + return Objects.hash( + address, + investmentId, + tokenList, + tickLower, + tickUpper, + priceRange, + nftId, + slippageBps, + simulate); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BuildLpAddTransactionRequest {\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append(" investmentId: ").append(toIndentedString(investmentId)).append("\n"); + sb.append(" tokenList: ").append(toIndentedString(tokenList)).append("\n"); + sb.append(" tickLower: ").append(toIndentedString(tickLower)).append("\n"); + sb.append(" tickUpper: ").append(toIndentedString(tickUpper)).append("\n"); + sb.append(" priceRange: ").append(toIndentedString(priceRange)).append("\n"); + sb.append(" nftId: ").append(toIndentedString(nftId)).append("\n"); + sb.append(" slippageBps: ").append(toIndentedString(slippageBps)).append("\n"); + sb.append(" simulate: ").append(toIndentedString(simulate)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object addressValue = getAddress(); + String addressValueAsString = ""; + addressValueAsString = addressValue.toString(); + sb.append("address=").append(urlEncode(addressValueAsString)).append(""); + Object investmentIdValue = getInvestmentId(); + String investmentIdValueAsString = ""; + investmentIdValueAsString = investmentIdValue.toString(); + sb.append("investmentId=").append(urlEncode(investmentIdValueAsString)).append(""); + Object tokenListValue = getTokenList(); + String tokenListValueAsString = ""; + tokenListValueAsString = + (String) + ((Collection) tokenListValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("tokenList=").append(urlEncode(tokenListValueAsString)).append(""); + Object tickLowerValue = getTickLower(); + String tickLowerValueAsString = ""; + tickLowerValueAsString = tickLowerValue.toString(); + sb.append("tickLower=").append(urlEncode(tickLowerValueAsString)).append(""); + Object tickUpperValue = getTickUpper(); + String tickUpperValueAsString = ""; + tickUpperValueAsString = tickUpperValue.toString(); + sb.append("tickUpper=").append(urlEncode(tickUpperValueAsString)).append(""); + Object priceRangeValue = getPriceRange(); + String priceRangeValueAsString = ""; + priceRangeValueAsString = priceRangeValue.toString(); + sb.append("priceRange=").append(urlEncode(priceRangeValueAsString)).append(""); + Object nftIdValue = getNftId(); + String nftIdValueAsString = ""; + nftIdValueAsString = nftIdValue.toString(); + sb.append("nftId=").append(urlEncode(nftIdValueAsString)).append(""); + Object slippageBpsValue = getSlippageBps(); + String slippageBpsValueAsString = ""; + slippageBpsValueAsString = slippageBpsValue.toString(); + sb.append("slippageBps=").append(urlEncode(slippageBpsValueAsString)).append(""); + Object simulateValue = getSimulate(); + String simulateValueAsString = ""; + simulateValueAsString = simulateValue.toString(); + sb.append("simulate=").append(urlEncode(simulateValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("address"); + openapiFields.add("investmentId"); + openapiFields.add("tokenList"); + openapiFields.add("tickLower"); + openapiFields.add("tickUpper"); + openapiFields.add("priceRange"); + openapiFields.add("nftId"); + openapiFields.add("slippageBps"); + openapiFields.add("simulate"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("address"); + openapiRequiredFields.add("investmentId"); + openapiRequiredFields.add("tokenList"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * BuildLpAddTransactionRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BuildLpAddTransactionRequest.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in BuildLpAddTransactionRequest is not" + + " found in the empty JSON string", + BuildLpAddTransactionRequest.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BuildLpAddTransactionRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("address").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `address` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("address").toString())); + } + if (!jsonObj.get("investmentId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `investmentId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("investmentId").toString())); + } + // ensure the json data is an array + if (!jsonObj.get("tokenList").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `tokenList` to be an array in the JSON string but" + + " got `%s`", + jsonObj.get("tokenList").toString())); + } + + JsonArray jsonArraytokenList = jsonObj.getAsJsonArray("tokenList"); + // validate the required field `tokenList` (array) + for (int i = 0; i < jsonArraytokenList.size(); i++) { + BuildLpAddTransactionRequestTokenListInner.validateJsonElement( + jsonArraytokenList.get(i)); + } + ; + if ((jsonObj.get("tickLower") != null && !jsonObj.get("tickLower").isJsonNull()) + && !jsonObj.get("tickLower").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `tickLower` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("tickLower").toString())); + } + if ((jsonObj.get("tickUpper") != null && !jsonObj.get("tickUpper").isJsonNull()) + && !jsonObj.get("tickUpper").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `tickUpper` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("tickUpper").toString())); + } + if ((jsonObj.get("priceRange") != null && !jsonObj.get("priceRange").isJsonNull()) + && !jsonObj.get("priceRange").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `priceRange` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("priceRange").toString())); + } + if ((jsonObj.get("nftId") != null && !jsonObj.get("nftId").isJsonNull()) + && !jsonObj.get("nftId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `nftId` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("nftId").toString())); + } + if ((jsonObj.get("slippageBps") != null && !jsonObj.get("slippageBps").isJsonNull()) + && !jsonObj.get("slippageBps").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `slippageBps` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("slippageBps").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BuildLpAddTransactionRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BuildLpAddTransactionRequest' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(BuildLpAddTransactionRequest.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, BuildLpAddTransactionRequest value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BuildLpAddTransactionRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of BuildLpAddTransactionRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of BuildLpAddTransactionRequest + * @throws IOException if the JSON string is invalid with respect to + * BuildLpAddTransactionRequest + */ + public static BuildLpAddTransactionRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BuildLpAddTransactionRequest.class); + } + + /** + * Convert an instance of BuildLpAddTransactionRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildLpAddTransactionRequestTokenListInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildLpAddTransactionRequestTokenListInner.java new file mode 100644 index 0000000..cad1203 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildLpAddTransactionRequestTokenListInner.java @@ -0,0 +1,283 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** + * A `(tokenAddress, amount)` pair. `amount` is a human-readable decimal string + * (NOT the token's smallest unit); the service converts it according to the token's + * decimals. For the native asset use the sentinel + * `0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee` (40 `e`s). + */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class BuildLpAddTransactionRequestTokenListInner { + public static final String SERIALIZED_NAME_TOKEN_ADDRESS = "tokenAddress"; + + @SerializedName(SERIALIZED_NAME_TOKEN_ADDRESS) + @jakarta.annotation.Nonnull + private String tokenAddress; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + + @SerializedName(SERIALIZED_NAME_AMOUNT) + @jakarta.annotation.Nonnull + private String amount; + + public BuildLpAddTransactionRequestTokenListInner() {} + + public BuildLpAddTransactionRequestTokenListInner tokenAddress( + @jakarta.annotation.Nonnull String tokenAddress) { + this.tokenAddress = tokenAddress; + return this; + } + + /** + * Token contract address; the native-asset sentinel for the native coin. + * + * @return tokenAddress + */ + @jakarta.annotation.Nonnull + @NotNull + public String getTokenAddress() { + return tokenAddress; + } + + public void setTokenAddress(@jakarta.annotation.Nonnull String tokenAddress) { + this.tokenAddress = tokenAddress; + } + + public BuildLpAddTransactionRequestTokenListInner amount( + @jakarta.annotation.Nonnull String amount) { + this.amount = amount; + return this; + } + + /** + * Human-readable amount as a decimal string, e.g. \"1.5\", \"100\". + * + * @return amount + */ + @jakarta.annotation.Nonnull + @NotNull + public String getAmount() { + return amount; + } + + public void setAmount(@jakarta.annotation.Nonnull String amount) { + this.amount = amount; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BuildLpAddTransactionRequestTokenListInner buildLpAddTransactionRequestTokenListInner = + (BuildLpAddTransactionRequestTokenListInner) o; + return Objects.equals( + this.tokenAddress, buildLpAddTransactionRequestTokenListInner.tokenAddress) + && Objects.equals(this.amount, buildLpAddTransactionRequestTokenListInner.amount); + } + + @Override + public int hashCode() { + return Objects.hash(tokenAddress, amount); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BuildLpAddTransactionRequestTokenListInner {\n"); + sb.append(" tokenAddress: ").append(toIndentedString(tokenAddress)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object tokenAddressValue = getTokenAddress(); + String tokenAddressValueAsString = ""; + tokenAddressValueAsString = tokenAddressValue.toString(); + sb.append("tokenAddress=").append(urlEncode(tokenAddressValueAsString)).append(""); + Object amountValue = getAmount(); + String amountValueAsString = ""; + amountValueAsString = amountValue.toString(); + sb.append("amount=").append(urlEncode(amountValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("tokenAddress"); + openapiFields.add("amount"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("tokenAddress"); + openapiRequiredFields.add("amount"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * BuildLpAddTransactionRequestTokenListInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BuildLpAddTransactionRequestTokenListInner.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " BuildLpAddTransactionRequestTokenListInner is not found in" + + " the empty JSON string", + BuildLpAddTransactionRequestTokenListInner.openapiRequiredFields + .toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : + BuildLpAddTransactionRequestTokenListInner.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("tokenAddress").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `tokenAddress` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("tokenAddress").toString())); + } + if (!jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `amount` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("amount").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BuildLpAddTransactionRequestTokenListInner.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'BuildLpAddTransactionRequestTokenListInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(BuildLpAddTransactionRequestTokenListInner.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, BuildLpAddTransactionRequestTokenListInner value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BuildLpAddTransactionRequestTokenListInner read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of BuildLpAddTransactionRequestTokenListInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of BuildLpAddTransactionRequestTokenListInner + * @throws IOException if the JSON string is invalid with respect to + * BuildLpAddTransactionRequestTokenListInner + */ + public static BuildLpAddTransactionRequestTokenListInner fromJson(String jsonString) + throws IOException { + return JSON.getGson() + .fromJson(jsonString, BuildLpAddTransactionRequestTokenListInner.class); + } + + /** + * Convert an instance of BuildLpAddTransactionRequestTokenListInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildLpAddTransactionResponse.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildLpAddTransactionResponse.java new file mode 100644 index 0000000..6f31521 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildLpAddTransactionResponse.java @@ -0,0 +1,351 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** BuildLpAddTransactionResponse */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class BuildLpAddTransactionResponse { + public static final String SERIALIZED_NAME_CODE = "code"; + + @SerializedName(SERIALIZED_NAME_CODE) + @jakarta.annotation.Nullable + private Integer code; + + public static final String SERIALIZED_NAME_MSG = "msg"; + + @SerializedName(SERIALIZED_NAME_MSG) + @jakarta.annotation.Nullable + private String msg; + + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + @jakarta.annotation.Nullable + private BuildDeFiDepositTransactionResponseData data; + + public static final String SERIALIZED_NAME_TIMESTAMP = "timestamp"; + + @SerializedName(SERIALIZED_NAME_TIMESTAMP) + @jakarta.annotation.Nullable + private Long timestamp; + + public static final String SERIALIZED_NAME_SUCCESS = "success"; + + @SerializedName(SERIALIZED_NAME_SUCCESS) + @jakarta.annotation.Nullable + private Boolean success; + + public BuildLpAddTransactionResponse() {} + + public BuildLpAddTransactionResponse code(@jakarta.annotation.Nullable Integer code) { + this.code = code; + return this; + } + + /** + * Business status code. 0 indicates success. + * + * @return code + */ + @jakarta.annotation.Nullable + public Integer getCode() { + return code; + } + + public void setCode(@jakarta.annotation.Nullable Integer code) { + this.code = code; + } + + public BuildLpAddTransactionResponse msg(@jakarta.annotation.Nullable String msg) { + this.msg = msg; + return this; + } + + /** + * Human-readable status message. + * + * @return msg + */ + @jakarta.annotation.Nullable + public String getMsg() { + return msg; + } + + public void setMsg(@jakarta.annotation.Nullable String msg) { + this.msg = msg; + } + + public BuildLpAddTransactionResponse data( + @jakarta.annotation.Nullable BuildDeFiDepositTransactionResponseData data) { + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @jakarta.annotation.Nullable + @Valid + public BuildDeFiDepositTransactionResponseData getData() { + return data; + } + + public void setData(@jakarta.annotation.Nullable BuildDeFiDepositTransactionResponseData data) { + this.data = data; + } + + public BuildLpAddTransactionResponse timestamp(@jakarta.annotation.Nullable Long timestamp) { + this.timestamp = timestamp; + return this; + } + + /** + * Server timestamp in milliseconds. + * + * @return timestamp + */ + @jakarta.annotation.Nullable + public Long getTimestamp() { + return timestamp; + } + + public void setTimestamp(@jakarta.annotation.Nullable Long timestamp) { + this.timestamp = timestamp; + } + + public BuildLpAddTransactionResponse success(@jakarta.annotation.Nullable Boolean success) { + this.success = success; + return this; + } + + /** + * Whether the request succeeded (mirrors `code == 0`). + * + * @return success + */ + @jakarta.annotation.Nullable + public Boolean getSuccess() { + return success; + } + + public void setSuccess(@jakarta.annotation.Nullable Boolean success) { + this.success = success; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BuildLpAddTransactionResponse buildLpAddTransactionResponse = + (BuildLpAddTransactionResponse) o; + return Objects.equals(this.code, buildLpAddTransactionResponse.code) + && Objects.equals(this.msg, buildLpAddTransactionResponse.msg) + && Objects.equals(this.data, buildLpAddTransactionResponse.data) + && Objects.equals(this.timestamp, buildLpAddTransactionResponse.timestamp) + && Objects.equals(this.success, buildLpAddTransactionResponse.success); + } + + @Override + public int hashCode() { + return Objects.hash(code, msg, data, timestamp, success); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BuildLpAddTransactionResponse {\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" msg: ").append(toIndentedString(msg)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" timestamp: ").append(toIndentedString(timestamp)).append("\n"); + sb.append(" success: ").append(toIndentedString(success)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object codeValue = getCode(); + String codeValueAsString = ""; + codeValueAsString = codeValue.toString(); + sb.append("code=").append(urlEncode(codeValueAsString)).append(""); + Object msgValue = getMsg(); + String msgValueAsString = ""; + msgValueAsString = msgValue.toString(); + sb.append("msg=").append(urlEncode(msgValueAsString)).append(""); + Object dataValue = getData(); + String dataValueAsString = ""; + dataValueAsString = dataValue.toString(); + sb.append("data=").append(urlEncode(dataValueAsString)).append(""); + Object timestampValue = getTimestamp(); + String timestampValueAsString = ""; + timestampValueAsString = timestampValue.toString(); + sb.append("timestamp=").append(urlEncode(timestampValueAsString)).append(""); + Object successValue = getSuccess(); + String successValueAsString = ""; + successValueAsString = successValue.toString(); + sb.append("success=").append(urlEncode(successValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("code"); + openapiFields.add("msg"); + openapiFields.add("data"); + openapiFields.add("timestamp"); + openapiFields.add("success"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * BuildLpAddTransactionResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BuildLpAddTransactionResponse.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in BuildLpAddTransactionResponse is not" + + " found in the empty JSON string", + BuildLpAddTransactionResponse.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("msg") != null && !jsonObj.get("msg").isJsonNull()) + && !jsonObj.get("msg").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `msg` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("msg").toString())); + } + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + BuildDeFiDepositTransactionResponseData.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BuildLpAddTransactionResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BuildLpAddTransactionResponse' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(BuildLpAddTransactionResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, BuildLpAddTransactionResponse value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BuildLpAddTransactionResponse read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of BuildLpAddTransactionResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of BuildLpAddTransactionResponse + * @throws IOException if the JSON string is invalid with respect to + * BuildLpAddTransactionResponse + */ + public static BuildLpAddTransactionResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BuildLpAddTransactionResponse.class); + } + + /** + * Convert an instance of BuildLpAddTransactionResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildLpRemoveTransactionRequest.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildLpRemoveTransactionRequest.java new file mode 100644 index 0000000..7474dc9 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildLpRemoveTransactionRequest.java @@ -0,0 +1,431 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** BuildLpRemoveTransactionRequest */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class BuildLpRemoveTransactionRequest { + public static final String SERIALIZED_NAME_ADDRESS = "address"; + + @SerializedName(SERIALIZED_NAME_ADDRESS) + @jakarta.annotation.Nonnull + private String address; + + public static final String SERIALIZED_NAME_INVESTMENT_ID = "investmentId"; + + @SerializedName(SERIALIZED_NAME_INVESTMENT_ID) + @jakarta.annotation.Nonnull + private String investmentId; + + public static final String SERIALIZED_NAME_NFT_ID = "nftId"; + + @SerializedName(SERIALIZED_NAME_NFT_ID) + @jakarta.annotation.Nonnull + private String nftId; + + public static final String SERIALIZED_NAME_RATIO = "ratio"; + + @SerializedName(SERIALIZED_NAME_RATIO) + @jakarta.annotation.Nonnull + private String ratio; + + public static final String SERIALIZED_NAME_SLIPPAGE_BPS = "slippageBps"; + + @SerializedName(SERIALIZED_NAME_SLIPPAGE_BPS) + @jakarta.annotation.Nullable + private String slippageBps; + + public static final String SERIALIZED_NAME_SIMULATE = "simulate"; + + @SerializedName(SERIALIZED_NAME_SIMULATE) + @jakarta.annotation.Nullable + private Boolean simulate; + + public BuildLpRemoveTransactionRequest() {} + + public BuildLpRemoveTransactionRequest address(@jakarta.annotation.Nonnull String address) { + this.address = address; + return this; + } + + /** + * User wallet address (the signer / sender). + * + * @return address + */ + @jakarta.annotation.Nonnull + @NotNull + public String getAddress() { + return address; + } + + public void setAddress(@jakarta.annotation.Nonnull String address) { + this.address = address; + } + + public BuildLpRemoveTransactionRequest investmentId( + @jakarta.annotation.Nonnull String investmentId) { + this.investmentId = investmentId; + return this; + } + + /** + * LP investment product ID (chain-agnostic). + * + * @return investmentId + */ + @jakarta.annotation.Nonnull + @NotNull + public String getInvestmentId() { + return investmentId; + } + + public void setInvestmentId(@jakarta.annotation.Nonnull String investmentId) { + this.investmentId = investmentId; + } + + public BuildLpRemoveTransactionRequest nftId(@jakarta.annotation.Nonnull String nftId) { + this.nftId = nftId; + return this; + } + + /** + * LP NFT token ID identifying the position to remove, decimal string (e.g. + * `\"7225901\"` or `\"#7225901\"`). The `#` + * prefix returned by the position list may be passed as-is — the service strips it + * automatically. + * + * @return nftId + */ + @jakarta.annotation.Nonnull + @NotNull + public String getNftId() { + return nftId; + } + + public void setNftId(@jakarta.annotation.Nonnull String nftId) { + this.nftId = nftId; + } + + public BuildLpRemoveTransactionRequest ratio(@jakarta.annotation.Nonnull String ratio) { + this.ratio = ratio; + return this; + } + + /** + * Removal ratio in the range `(0, 1]` as a decimal string (e.g. + * `\"0.04\"`, `\"1\"`). + * + * @return ratio + */ + @jakarta.annotation.Nonnull + @NotNull + public String getRatio() { + return ratio; + } + + public void setRatio(@jakarta.annotation.Nonnull String ratio) { + this.ratio = ratio; + } + + public BuildLpRemoveTransactionRequest slippageBps( + @jakarta.annotation.Nullable String slippageBps) { + this.slippageBps = slippageBps; + return this; + } + + /** + * Slippage tolerance for the LP leg, in basis points (e.g. `300` = 3%). + * + * @return slippageBps + */ + @jakarta.annotation.Nullable + public String getSlippageBps() { + return slippageBps; + } + + public void setSlippageBps(@jakarta.annotation.Nullable String slippageBps) { + this.slippageBps = slippageBps; + } + + public BuildLpRemoveTransactionRequest simulate(@jakarta.annotation.Nullable Boolean simulate) { + this.simulate = simulate; + return this; + } + + /** + * When `true`, the response also includes a `preview` object. Default + * `false`. If the simulated transaction reverts, the request returns + * `40485` for a specific classified revert reason or `40484` for any other + * revert (see Error Codes). + * + * @return simulate + */ + @jakarta.annotation.Nullable + public Boolean getSimulate() { + return simulate; + } + + public void setSimulate(@jakarta.annotation.Nullable Boolean simulate) { + this.simulate = simulate; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BuildLpRemoveTransactionRequest buildLpRemoveTransactionRequest = + (BuildLpRemoveTransactionRequest) o; + return Objects.equals(this.address, buildLpRemoveTransactionRequest.address) + && Objects.equals(this.investmentId, buildLpRemoveTransactionRequest.investmentId) + && Objects.equals(this.nftId, buildLpRemoveTransactionRequest.nftId) + && Objects.equals(this.ratio, buildLpRemoveTransactionRequest.ratio) + && Objects.equals(this.slippageBps, buildLpRemoveTransactionRequest.slippageBps) + && Objects.equals(this.simulate, buildLpRemoveTransactionRequest.simulate); + } + + @Override + public int hashCode() { + return Objects.hash(address, investmentId, nftId, ratio, slippageBps, simulate); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BuildLpRemoveTransactionRequest {\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append(" investmentId: ").append(toIndentedString(investmentId)).append("\n"); + sb.append(" nftId: ").append(toIndentedString(nftId)).append("\n"); + sb.append(" ratio: ").append(toIndentedString(ratio)).append("\n"); + sb.append(" slippageBps: ").append(toIndentedString(slippageBps)).append("\n"); + sb.append(" simulate: ").append(toIndentedString(simulate)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object addressValue = getAddress(); + String addressValueAsString = ""; + addressValueAsString = addressValue.toString(); + sb.append("address=").append(urlEncode(addressValueAsString)).append(""); + Object investmentIdValue = getInvestmentId(); + String investmentIdValueAsString = ""; + investmentIdValueAsString = investmentIdValue.toString(); + sb.append("investmentId=").append(urlEncode(investmentIdValueAsString)).append(""); + Object nftIdValue = getNftId(); + String nftIdValueAsString = ""; + nftIdValueAsString = nftIdValue.toString(); + sb.append("nftId=").append(urlEncode(nftIdValueAsString)).append(""); + Object ratioValue = getRatio(); + String ratioValueAsString = ""; + ratioValueAsString = ratioValue.toString(); + sb.append("ratio=").append(urlEncode(ratioValueAsString)).append(""); + Object slippageBpsValue = getSlippageBps(); + String slippageBpsValueAsString = ""; + slippageBpsValueAsString = slippageBpsValue.toString(); + sb.append("slippageBps=").append(urlEncode(slippageBpsValueAsString)).append(""); + Object simulateValue = getSimulate(); + String simulateValueAsString = ""; + simulateValueAsString = simulateValue.toString(); + sb.append("simulate=").append(urlEncode(simulateValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("address"); + openapiFields.add("investmentId"); + openapiFields.add("nftId"); + openapiFields.add("ratio"); + openapiFields.add("slippageBps"); + openapiFields.add("simulate"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("address"); + openapiRequiredFields.add("investmentId"); + openapiRequiredFields.add("nftId"); + openapiRequiredFields.add("ratio"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * BuildLpRemoveTransactionRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BuildLpRemoveTransactionRequest.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in BuildLpRemoveTransactionRequest is not" + + " found in the empty JSON string", + BuildLpRemoveTransactionRequest.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BuildLpRemoveTransactionRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("address").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `address` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("address").toString())); + } + if (!jsonObj.get("investmentId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `investmentId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("investmentId").toString())); + } + if (!jsonObj.get("nftId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `nftId` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("nftId").toString())); + } + if (!jsonObj.get("ratio").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `ratio` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("ratio").toString())); + } + if ((jsonObj.get("slippageBps") != null && !jsonObj.get("slippageBps").isJsonNull()) + && !jsonObj.get("slippageBps").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `slippageBps` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("slippageBps").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BuildLpRemoveTransactionRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BuildLpRemoveTransactionRequest' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(BuildLpRemoveTransactionRequest.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, BuildLpRemoveTransactionRequest value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BuildLpRemoveTransactionRequest read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of BuildLpRemoveTransactionRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of BuildLpRemoveTransactionRequest + * @throws IOException if the JSON string is invalid with respect to + * BuildLpRemoveTransactionRequest + */ + public static BuildLpRemoveTransactionRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BuildLpRemoveTransactionRequest.class); + } + + /** + * Convert an instance of BuildLpRemoveTransactionRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildLpRemoveTransactionResponse.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildLpRemoveTransactionResponse.java new file mode 100644 index 0000000..bf3f7ff --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildLpRemoveTransactionResponse.java @@ -0,0 +1,351 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** BuildLpRemoveTransactionResponse */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class BuildLpRemoveTransactionResponse { + public static final String SERIALIZED_NAME_CODE = "code"; + + @SerializedName(SERIALIZED_NAME_CODE) + @jakarta.annotation.Nullable + private Integer code; + + public static final String SERIALIZED_NAME_MSG = "msg"; + + @SerializedName(SERIALIZED_NAME_MSG) + @jakarta.annotation.Nullable + private String msg; + + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + @jakarta.annotation.Nullable + private BuildDeFiDepositTransactionResponseData data; + + public static final String SERIALIZED_NAME_TIMESTAMP = "timestamp"; + + @SerializedName(SERIALIZED_NAME_TIMESTAMP) + @jakarta.annotation.Nullable + private Long timestamp; + + public static final String SERIALIZED_NAME_SUCCESS = "success"; + + @SerializedName(SERIALIZED_NAME_SUCCESS) + @jakarta.annotation.Nullable + private Boolean success; + + public BuildLpRemoveTransactionResponse() {} + + public BuildLpRemoveTransactionResponse code(@jakarta.annotation.Nullable Integer code) { + this.code = code; + return this; + } + + /** + * Business status code. 0 indicates success. + * + * @return code + */ + @jakarta.annotation.Nullable + public Integer getCode() { + return code; + } + + public void setCode(@jakarta.annotation.Nullable Integer code) { + this.code = code; + } + + public BuildLpRemoveTransactionResponse msg(@jakarta.annotation.Nullable String msg) { + this.msg = msg; + return this; + } + + /** + * Human-readable status message. + * + * @return msg + */ + @jakarta.annotation.Nullable + public String getMsg() { + return msg; + } + + public void setMsg(@jakarta.annotation.Nullable String msg) { + this.msg = msg; + } + + public BuildLpRemoveTransactionResponse data( + @jakarta.annotation.Nullable BuildDeFiDepositTransactionResponseData data) { + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @jakarta.annotation.Nullable + @Valid + public BuildDeFiDepositTransactionResponseData getData() { + return data; + } + + public void setData(@jakarta.annotation.Nullable BuildDeFiDepositTransactionResponseData data) { + this.data = data; + } + + public BuildLpRemoveTransactionResponse timestamp(@jakarta.annotation.Nullable Long timestamp) { + this.timestamp = timestamp; + return this; + } + + /** + * Server timestamp in milliseconds. + * + * @return timestamp + */ + @jakarta.annotation.Nullable + public Long getTimestamp() { + return timestamp; + } + + public void setTimestamp(@jakarta.annotation.Nullable Long timestamp) { + this.timestamp = timestamp; + } + + public BuildLpRemoveTransactionResponse success(@jakarta.annotation.Nullable Boolean success) { + this.success = success; + return this; + } + + /** + * Whether the request succeeded (mirrors `code == 0`). + * + * @return success + */ + @jakarta.annotation.Nullable + public Boolean getSuccess() { + return success; + } + + public void setSuccess(@jakarta.annotation.Nullable Boolean success) { + this.success = success; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BuildLpRemoveTransactionResponse buildLpRemoveTransactionResponse = + (BuildLpRemoveTransactionResponse) o; + return Objects.equals(this.code, buildLpRemoveTransactionResponse.code) + && Objects.equals(this.msg, buildLpRemoveTransactionResponse.msg) + && Objects.equals(this.data, buildLpRemoveTransactionResponse.data) + && Objects.equals(this.timestamp, buildLpRemoveTransactionResponse.timestamp) + && Objects.equals(this.success, buildLpRemoveTransactionResponse.success); + } + + @Override + public int hashCode() { + return Objects.hash(code, msg, data, timestamp, success); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BuildLpRemoveTransactionResponse {\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" msg: ").append(toIndentedString(msg)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" timestamp: ").append(toIndentedString(timestamp)).append("\n"); + sb.append(" success: ").append(toIndentedString(success)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object codeValue = getCode(); + String codeValueAsString = ""; + codeValueAsString = codeValue.toString(); + sb.append("code=").append(urlEncode(codeValueAsString)).append(""); + Object msgValue = getMsg(); + String msgValueAsString = ""; + msgValueAsString = msgValue.toString(); + sb.append("msg=").append(urlEncode(msgValueAsString)).append(""); + Object dataValue = getData(); + String dataValueAsString = ""; + dataValueAsString = dataValue.toString(); + sb.append("data=").append(urlEncode(dataValueAsString)).append(""); + Object timestampValue = getTimestamp(); + String timestampValueAsString = ""; + timestampValueAsString = timestampValue.toString(); + sb.append("timestamp=").append(urlEncode(timestampValueAsString)).append(""); + Object successValue = getSuccess(); + String successValueAsString = ""; + successValueAsString = successValue.toString(); + sb.append("success=").append(urlEncode(successValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("code"); + openapiFields.add("msg"); + openapiFields.add("data"); + openapiFields.add("timestamp"); + openapiFields.add("success"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * BuildLpRemoveTransactionResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BuildLpRemoveTransactionResponse.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in BuildLpRemoveTransactionResponse is" + + " not found in the empty JSON string", + BuildLpRemoveTransactionResponse.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("msg") != null && !jsonObj.get("msg").isJsonNull()) + && !jsonObj.get("msg").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `msg` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("msg").toString())); + } + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + BuildDeFiDepositTransactionResponseData.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BuildLpRemoveTransactionResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BuildLpRemoveTransactionResponse' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(BuildLpRemoveTransactionResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, BuildLpRemoveTransactionResponse value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BuildLpRemoveTransactionResponse read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of BuildLpRemoveTransactionResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of BuildLpRemoveTransactionResponse + * @throws IOException if the JSON string is invalid with respect to + * BuildLpRemoveTransactionResponse + */ + public static BuildLpRemoveTransactionResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BuildLpRemoveTransactionResponse.class); + } + + /** + * Convert an instance of BuildLpRemoveTransactionResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSolanaSwapInstructionsResponse.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSolanaSwapInstructionsResponse.java index f9b3b0c..26063c8 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSolanaSwapInstructionsResponse.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSolanaSwapInstructionsResponse.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSolanaSwapInstructionsResponseData.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSolanaSwapInstructionsResponseData.java index 69fbb6d..714a662 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSolanaSwapInstructionsResponseData.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSolanaSwapInstructionsResponseData.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSolanaSwapInstructionsResponseDataInstructionListsInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSolanaSwapInstructionsResponseDataInstructionListsInner.java index fe105af..510e6f9 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSolanaSwapInstructionsResponseDataInstructionListsInner.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSolanaSwapInstructionsResponseDataInstructionListsInner.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSolanaSwapInstructionsResponseDataInstructionListsInnerAccountsInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSolanaSwapInstructionsResponseDataInstructionListsInnerAccountsInner.java index 6f1d852..918a63e 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSolanaSwapInstructionsResponseDataInstructionListsInnerAccountsInner.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSolanaSwapInstructionsResponseDataInstructionListsInnerAccountsInner.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSolanaSwapInstructionsResponseDataRouterResult.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSolanaSwapInstructionsResponseDataRouterResult.java index fcaf118..f444fc6 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSolanaSwapInstructionsResponseDataRouterResult.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSolanaSwapInstructionsResponseDataRouterResult.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSolanaSwapInstructionsResponseDataRouterResultDexRouterListInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSolanaSwapInstructionsResponseDataRouterResultDexRouterListInner.java index 5db4e03..3f411b2 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSolanaSwapInstructionsResponseDataRouterResultDexRouterListInner.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSolanaSwapInstructionsResponseDataRouterResultDexRouterListInner.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSolanaSwapInstructionsResponseDataRouterResultDexRouterListInnerDexProtocol.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSolanaSwapInstructionsResponseDataRouterResultDexRouterListInnerDexProtocol.java index 5e44a40..ce78ef2 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSolanaSwapInstructionsResponseDataRouterResultDexRouterListInnerDexProtocol.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSolanaSwapInstructionsResponseDataRouterResultDexRouterListInnerDexProtocol.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSolanaSwapInstructionsResponseDataRouterResultDexRouterListInnerFromToken.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSolanaSwapInstructionsResponseDataRouterResultDexRouterListInnerFromToken.java index 7713680..03541b0 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSolanaSwapInstructionsResponseDataRouterResultDexRouterListInnerFromToken.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSolanaSwapInstructionsResponseDataRouterResultDexRouterListInnerFromToken.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSolanaSwapInstructionsResponseDataRouterResultDexRouterListInnerToToken.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSolanaSwapInstructionsResponseDataRouterResultDexRouterListInnerToToken.java index ce464cd..832810b 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSolanaSwapInstructionsResponseDataRouterResultDexRouterListInnerToToken.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSolanaSwapInstructionsResponseDataRouterResultDexRouterListInnerToToken.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSolanaSwapInstructionsResponseDataRouterResultFromToken.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSolanaSwapInstructionsResponseDataRouterResultFromToken.java index 83750fb..e393d07 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSolanaSwapInstructionsResponseDataRouterResultFromToken.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSolanaSwapInstructionsResponseDataRouterResultFromToken.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSolanaSwapInstructionsResponseDataRouterResultToToken.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSolanaSwapInstructionsResponseDataRouterResultToToken.java index 077f98b..67622cf 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSolanaSwapInstructionsResponseDataRouterResultToToken.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSolanaSwapInstructionsResponseDataRouterResultToToken.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSolanaSwapInstructionsResponseDataTx.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSolanaSwapInstructionsResponseDataTx.java index 6eca324..dad1274 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSolanaSwapInstructionsResponseDataTx.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSolanaSwapInstructionsResponseDataTx.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSwapTransactionResponse.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSwapTransactionResponse.java index dba94c1..f2f4a48 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSwapTransactionResponse.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSwapTransactionResponse.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSwapTransactionResponseData.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSwapTransactionResponseData.java index a123eee..20299ce 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSwapTransactionResponseData.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSwapTransactionResponseData.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSwapTransactionResponseDataRfq.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSwapTransactionResponseDataRfq.java index c2d653f..7f2aba3 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSwapTransactionResponseDataRfq.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSwapTransactionResponseDataRfq.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSwapTransactionResponseDataRouterResult.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSwapTransactionResponseDataRouterResult.java index 8a4cdfd..df764e8 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSwapTransactionResponseDataRouterResult.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSwapTransactionResponseDataRouterResult.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSwapTransactionResponseDataRouterResultDexRouterListInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSwapTransactionResponseDataRouterResultDexRouterListInner.java index b536f77..aa78c0d 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSwapTransactionResponseDataRouterResultDexRouterListInner.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSwapTransactionResponseDataRouterResultDexRouterListInner.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSwapTransactionResponseDataRouterResultDexRouterListInnerDexProtocol.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSwapTransactionResponseDataRouterResultDexRouterListInnerDexProtocol.java index fb22c3e..0309db2 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSwapTransactionResponseDataRouterResultDexRouterListInnerDexProtocol.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSwapTransactionResponseDataRouterResultDexRouterListInnerDexProtocol.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSwapTransactionResponseDataRouterResultDexRouterListInnerFromToken.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSwapTransactionResponseDataRouterResultDexRouterListInnerFromToken.java index 8eb591d..2f3df6c 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSwapTransactionResponseDataRouterResultDexRouterListInnerFromToken.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSwapTransactionResponseDataRouterResultDexRouterListInnerFromToken.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSwapTransactionResponseDataRouterResultDexRouterListInnerToToken.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSwapTransactionResponseDataRouterResultDexRouterListInnerToToken.java index e15edb0..7ef9e71 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSwapTransactionResponseDataRouterResultDexRouterListInnerToToken.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSwapTransactionResponseDataRouterResultDexRouterListInnerToToken.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSwapTransactionResponseDataRouterResultFromToken.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSwapTransactionResponseDataRouterResultFromToken.java index fdc261b..423c26c 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSwapTransactionResponseDataRouterResultFromToken.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSwapTransactionResponseDataRouterResultFromToken.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSwapTransactionResponseDataRouterResultToToken.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSwapTransactionResponseDataRouterResultToToken.java index db2954e..7d68131 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSwapTransactionResponseDataRouterResultToToken.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSwapTransactionResponseDataRouterResultToToken.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSwapTransactionResponseDataTx.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSwapTransactionResponseDataTx.java index b8eb319..0bfced8 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSwapTransactionResponseDataTx.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/BuildSwapTransactionResponseDataTx.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/CalculateLpAddPairedAmountsRequest.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/CalculateLpAddPairedAmountsRequest.java new file mode 100644 index 0000000..7637853 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/CalculateLpAddPairedAmountsRequest.java @@ -0,0 +1,476 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** CalculateLpAddPairedAmountsRequest */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class CalculateLpAddPairedAmountsRequest { + public static final String SERIALIZED_NAME_ADDRESS = "address"; + + @SerializedName(SERIALIZED_NAME_ADDRESS) + @jakarta.annotation.Nonnull + private String address; + + public static final String SERIALIZED_NAME_INVESTMENT_ID = "investmentId"; + + @SerializedName(SERIALIZED_NAME_INVESTMENT_ID) + @jakarta.annotation.Nonnull + private String investmentId; + + public static final String SERIALIZED_NAME_TICK_LOWER = "tickLower"; + + @SerializedName(SERIALIZED_NAME_TICK_LOWER) + @jakarta.annotation.Nullable + private String tickLower; + + public static final String SERIALIZED_NAME_TICK_UPPER = "tickUpper"; + + @SerializedName(SERIALIZED_NAME_TICK_UPPER) + @jakarta.annotation.Nullable + private String tickUpper; + + public static final String SERIALIZED_NAME_PRICE_RANGE = "priceRange"; + + @SerializedName(SERIALIZED_NAME_PRICE_RANGE) + @jakarta.annotation.Nullable + private String priceRange; + + public static final String SERIALIZED_NAME_NFT_ID = "nftId"; + + @SerializedName(SERIALIZED_NAME_NFT_ID) + @jakarta.annotation.Nullable + private String nftId; + + public static final String SERIALIZED_NAME_INPUT_TOKEN = "inputToken"; + + @SerializedName(SERIALIZED_NAME_INPUT_TOKEN) + @jakarta.annotation.Nonnull + private BuildDeFiDepositTransactionRequestToken inputToken; + + public CalculateLpAddPairedAmountsRequest() {} + + public CalculateLpAddPairedAmountsRequest address(@jakarta.annotation.Nonnull String address) { + this.address = address; + return this; + } + + /** + * User wallet address. + * + * @return address + */ + @jakarta.annotation.Nonnull + @NotNull + public String getAddress() { + return address; + } + + public void setAddress(@jakarta.annotation.Nonnull String address) { + this.address = address; + } + + public CalculateLpAddPairedAmountsRequest investmentId( + @jakarta.annotation.Nonnull String investmentId) { + this.investmentId = investmentId; + return this; + } + + /** + * LP investment product ID (chain-agnostic). + * + * @return investmentId + */ + @jakarta.annotation.Nonnull + @NotNull + public String getInvestmentId() { + return investmentId; + } + + public void setInvestmentId(@jakarta.annotation.Nonnull String investmentId) { + this.investmentId = investmentId; + } + + public CalculateLpAddPairedAmountsRequest tickLower( + @jakarta.annotation.Nullable String tickLower) { + this.tickLower = tickLower; + return this; + } + + /** + * Lower tick bound (raw `int24`), aligned to the pool's `tickSpacing`. + * + * @return tickLower + */ + @jakarta.annotation.Nullable + public String getTickLower() { + return tickLower; + } + + public void setTickLower(@jakarta.annotation.Nullable String tickLower) { + this.tickLower = tickLower; + } + + public CalculateLpAddPairedAmountsRequest tickUpper( + @jakarta.annotation.Nullable String tickUpper) { + this.tickUpper = tickUpper; + return this; + } + + /** + * Upper tick bound (raw `int24`), aligned to the pool's `tickSpacing`. + * + * @return tickUpper + */ + @jakarta.annotation.Nullable + public String getTickUpper() { + return tickUpper; + } + + public void setTickUpper(@jakarta.annotation.Nullable String tickUpper) { + this.tickUpper = tickUpper; + } + + public CalculateLpAddPairedAmountsRequest priceRange( + @jakarta.annotation.Nullable String priceRange) { + this.priceRange = priceRange; + return this; + } + + /** + * Price range as a percentage (e.g. `\"5\"` = ±5%). + * + * @return priceRange + */ + @jakarta.annotation.Nullable + public String getPriceRange() { + return priceRange; + } + + public void setPriceRange(@jakarta.annotation.Nullable String priceRange) { + this.priceRange = priceRange; + } + + public CalculateLpAddPairedAmountsRequest nftId(@jakarta.annotation.Nullable String nftId) { + this.nftId = nftId; + return this; + } + + /** + * Required when calculating for an existing LP position. + * + * @return nftId + */ + @jakarta.annotation.Nullable + public String getNftId() { + return nftId; + } + + public void setNftId(@jakarta.annotation.Nullable String nftId) { + this.nftId = nftId; + } + + public CalculateLpAddPairedAmountsRequest inputToken( + @jakarta.annotation.Nonnull BuildDeFiDepositTransactionRequestToken inputToken) { + this.inputToken = inputToken; + return this; + } + + /** + * Get inputToken + * + * @return inputToken + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public BuildDeFiDepositTransactionRequestToken getInputToken() { + return inputToken; + } + + public void setInputToken( + @jakarta.annotation.Nonnull BuildDeFiDepositTransactionRequestToken inputToken) { + this.inputToken = inputToken; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CalculateLpAddPairedAmountsRequest calculateLpAddPairedAmountsRequest = + (CalculateLpAddPairedAmountsRequest) o; + return Objects.equals(this.address, calculateLpAddPairedAmountsRequest.address) + && Objects.equals( + this.investmentId, calculateLpAddPairedAmountsRequest.investmentId) + && Objects.equals(this.tickLower, calculateLpAddPairedAmountsRequest.tickLower) + && Objects.equals(this.tickUpper, calculateLpAddPairedAmountsRequest.tickUpper) + && Objects.equals(this.priceRange, calculateLpAddPairedAmountsRequest.priceRange) + && Objects.equals(this.nftId, calculateLpAddPairedAmountsRequest.nftId) + && Objects.equals(this.inputToken, calculateLpAddPairedAmountsRequest.inputToken); + } + + @Override + public int hashCode() { + return Objects.hash( + address, investmentId, tickLower, tickUpper, priceRange, nftId, inputToken); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CalculateLpAddPairedAmountsRequest {\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append(" investmentId: ").append(toIndentedString(investmentId)).append("\n"); + sb.append(" tickLower: ").append(toIndentedString(tickLower)).append("\n"); + sb.append(" tickUpper: ").append(toIndentedString(tickUpper)).append("\n"); + sb.append(" priceRange: ").append(toIndentedString(priceRange)).append("\n"); + sb.append(" nftId: ").append(toIndentedString(nftId)).append("\n"); + sb.append(" inputToken: ").append(toIndentedString(inputToken)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object addressValue = getAddress(); + String addressValueAsString = ""; + addressValueAsString = addressValue.toString(); + sb.append("address=").append(urlEncode(addressValueAsString)).append(""); + Object investmentIdValue = getInvestmentId(); + String investmentIdValueAsString = ""; + investmentIdValueAsString = investmentIdValue.toString(); + sb.append("investmentId=").append(urlEncode(investmentIdValueAsString)).append(""); + Object tickLowerValue = getTickLower(); + String tickLowerValueAsString = ""; + tickLowerValueAsString = tickLowerValue.toString(); + sb.append("tickLower=").append(urlEncode(tickLowerValueAsString)).append(""); + Object tickUpperValue = getTickUpper(); + String tickUpperValueAsString = ""; + tickUpperValueAsString = tickUpperValue.toString(); + sb.append("tickUpper=").append(urlEncode(tickUpperValueAsString)).append(""); + Object priceRangeValue = getPriceRange(); + String priceRangeValueAsString = ""; + priceRangeValueAsString = priceRangeValue.toString(); + sb.append("priceRange=").append(urlEncode(priceRangeValueAsString)).append(""); + Object nftIdValue = getNftId(); + String nftIdValueAsString = ""; + nftIdValueAsString = nftIdValue.toString(); + sb.append("nftId=").append(urlEncode(nftIdValueAsString)).append(""); + Object inputTokenValue = getInputToken(); + String inputTokenValueAsString = ""; + inputTokenValueAsString = inputTokenValue.toString(); + sb.append("inputToken=").append(urlEncode(inputTokenValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("address"); + openapiFields.add("investmentId"); + openapiFields.add("tickLower"); + openapiFields.add("tickUpper"); + openapiFields.add("priceRange"); + openapiFields.add("nftId"); + openapiFields.add("inputToken"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("address"); + openapiRequiredFields.add("investmentId"); + openapiRequiredFields.add("inputToken"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * CalculateLpAddPairedAmountsRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CalculateLpAddPairedAmountsRequest.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CalculateLpAddPairedAmountsRequest is" + + " not found in the empty JSON string", + CalculateLpAddPairedAmountsRequest.openapiRequiredFields + .toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CalculateLpAddPairedAmountsRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("address").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `address` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("address").toString())); + } + if (!jsonObj.get("investmentId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `investmentId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("investmentId").toString())); + } + if ((jsonObj.get("tickLower") != null && !jsonObj.get("tickLower").isJsonNull()) + && !jsonObj.get("tickLower").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `tickLower` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("tickLower").toString())); + } + if ((jsonObj.get("tickUpper") != null && !jsonObj.get("tickUpper").isJsonNull()) + && !jsonObj.get("tickUpper").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `tickUpper` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("tickUpper").toString())); + } + if ((jsonObj.get("priceRange") != null && !jsonObj.get("priceRange").isJsonNull()) + && !jsonObj.get("priceRange").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `priceRange` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("priceRange").toString())); + } + if ((jsonObj.get("nftId") != null && !jsonObj.get("nftId").isJsonNull()) + && !jsonObj.get("nftId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `nftId` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("nftId").toString())); + } + // validate the required field `inputToken` + BuildDeFiDepositTransactionRequestToken.validateJsonElement(jsonObj.get("inputToken")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CalculateLpAddPairedAmountsRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CalculateLpAddPairedAmountsRequest' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CalculateLpAddPairedAmountsRequest.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CalculateLpAddPairedAmountsRequest value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CalculateLpAddPairedAmountsRequest read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CalculateLpAddPairedAmountsRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of CalculateLpAddPairedAmountsRequest + * @throws IOException if the JSON string is invalid with respect to + * CalculateLpAddPairedAmountsRequest + */ + public static CalculateLpAddPairedAmountsRequest fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, CalculateLpAddPairedAmountsRequest.class); + } + + /** + * Convert an instance of CalculateLpAddPairedAmountsRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/CalculateLpAddPairedAmountsResponse.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/CalculateLpAddPairedAmountsResponse.java new file mode 100644 index 0000000..88e4641 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/CalculateLpAddPairedAmountsResponse.java @@ -0,0 +1,355 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** CalculateLpAddPairedAmountsResponse */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class CalculateLpAddPairedAmountsResponse { + public static final String SERIALIZED_NAME_CODE = "code"; + + @SerializedName(SERIALIZED_NAME_CODE) + @jakarta.annotation.Nullable + private Integer code; + + public static final String SERIALIZED_NAME_MSG = "msg"; + + @SerializedName(SERIALIZED_NAME_MSG) + @jakarta.annotation.Nullable + private String msg; + + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + @jakarta.annotation.Nullable + private CalculateLpAddPairedAmountsResponseData data; + + public static final String SERIALIZED_NAME_TIMESTAMP = "timestamp"; + + @SerializedName(SERIALIZED_NAME_TIMESTAMP) + @jakarta.annotation.Nullable + private Long timestamp; + + public static final String SERIALIZED_NAME_SUCCESS = "success"; + + @SerializedName(SERIALIZED_NAME_SUCCESS) + @jakarta.annotation.Nullable + private Boolean success; + + public CalculateLpAddPairedAmountsResponse() {} + + public CalculateLpAddPairedAmountsResponse code(@jakarta.annotation.Nullable Integer code) { + this.code = code; + return this; + } + + /** + * Business status code. 0 indicates success. + * + * @return code + */ + @jakarta.annotation.Nullable + public Integer getCode() { + return code; + } + + public void setCode(@jakarta.annotation.Nullable Integer code) { + this.code = code; + } + + public CalculateLpAddPairedAmountsResponse msg(@jakarta.annotation.Nullable String msg) { + this.msg = msg; + return this; + } + + /** + * Human-readable status message. + * + * @return msg + */ + @jakarta.annotation.Nullable + public String getMsg() { + return msg; + } + + public void setMsg(@jakarta.annotation.Nullable String msg) { + this.msg = msg; + } + + public CalculateLpAddPairedAmountsResponse data( + @jakarta.annotation.Nullable CalculateLpAddPairedAmountsResponseData data) { + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @jakarta.annotation.Nullable + @Valid + public CalculateLpAddPairedAmountsResponseData getData() { + return data; + } + + public void setData(@jakarta.annotation.Nullable CalculateLpAddPairedAmountsResponseData data) { + this.data = data; + } + + public CalculateLpAddPairedAmountsResponse timestamp( + @jakarta.annotation.Nullable Long timestamp) { + this.timestamp = timestamp; + return this; + } + + /** + * Server timestamp in milliseconds. + * + * @return timestamp + */ + @jakarta.annotation.Nullable + public Long getTimestamp() { + return timestamp; + } + + public void setTimestamp(@jakarta.annotation.Nullable Long timestamp) { + this.timestamp = timestamp; + } + + public CalculateLpAddPairedAmountsResponse success( + @jakarta.annotation.Nullable Boolean success) { + this.success = success; + return this; + } + + /** + * Whether the request succeeded (mirrors `code == 0`). + * + * @return success + */ + @jakarta.annotation.Nullable + public Boolean getSuccess() { + return success; + } + + public void setSuccess(@jakarta.annotation.Nullable Boolean success) { + this.success = success; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CalculateLpAddPairedAmountsResponse calculateLpAddPairedAmountsResponse = + (CalculateLpAddPairedAmountsResponse) o; + return Objects.equals(this.code, calculateLpAddPairedAmountsResponse.code) + && Objects.equals(this.msg, calculateLpAddPairedAmountsResponse.msg) + && Objects.equals(this.data, calculateLpAddPairedAmountsResponse.data) + && Objects.equals(this.timestamp, calculateLpAddPairedAmountsResponse.timestamp) + && Objects.equals(this.success, calculateLpAddPairedAmountsResponse.success); + } + + @Override + public int hashCode() { + return Objects.hash(code, msg, data, timestamp, success); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CalculateLpAddPairedAmountsResponse {\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" msg: ").append(toIndentedString(msg)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" timestamp: ").append(toIndentedString(timestamp)).append("\n"); + sb.append(" success: ").append(toIndentedString(success)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object codeValue = getCode(); + String codeValueAsString = ""; + codeValueAsString = codeValue.toString(); + sb.append("code=").append(urlEncode(codeValueAsString)).append(""); + Object msgValue = getMsg(); + String msgValueAsString = ""; + msgValueAsString = msgValue.toString(); + sb.append("msg=").append(urlEncode(msgValueAsString)).append(""); + Object dataValue = getData(); + String dataValueAsString = ""; + dataValueAsString = dataValue.toString(); + sb.append("data=").append(urlEncode(dataValueAsString)).append(""); + Object timestampValue = getTimestamp(); + String timestampValueAsString = ""; + timestampValueAsString = timestampValue.toString(); + sb.append("timestamp=").append(urlEncode(timestampValueAsString)).append(""); + Object successValue = getSuccess(); + String successValueAsString = ""; + successValueAsString = successValue.toString(); + sb.append("success=").append(urlEncode(successValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("code"); + openapiFields.add("msg"); + openapiFields.add("data"); + openapiFields.add("timestamp"); + openapiFields.add("success"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * CalculateLpAddPairedAmountsResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CalculateLpAddPairedAmountsResponse.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CalculateLpAddPairedAmountsResponse is" + + " not found in the empty JSON string", + CalculateLpAddPairedAmountsResponse.openapiRequiredFields + .toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("msg") != null && !jsonObj.get("msg").isJsonNull()) + && !jsonObj.get("msg").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `msg` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("msg").toString())); + } + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + CalculateLpAddPairedAmountsResponseData.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CalculateLpAddPairedAmountsResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CalculateLpAddPairedAmountsResponse' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CalculateLpAddPairedAmountsResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CalculateLpAddPairedAmountsResponse value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CalculateLpAddPairedAmountsResponse read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CalculateLpAddPairedAmountsResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of CalculateLpAddPairedAmountsResponse + * @throws IOException if the JSON string is invalid with respect to + * CalculateLpAddPairedAmountsResponse + */ + public static CalculateLpAddPairedAmountsResponse fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, CalculateLpAddPairedAmountsResponse.class); + } + + /** + * Convert an instance of CalculateLpAddPairedAmountsResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/CalculateLpAddPairedAmountsResponseData.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/CalculateLpAddPairedAmountsResponseData.java new file mode 100644 index 0000000..ac73f9b --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/CalculateLpAddPairedAmountsResponseData.java @@ -0,0 +1,323 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** + * Result of `/transaction/lp-add/calculate`. Returns the paired token amounts derived + * from the single input token. This endpoint is pure computation — it does not touch the chain and + * does not deduct any fee. + */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class CalculateLpAddPairedAmountsResponseData { + public static final String SERIALIZED_NAME_INPUT_TOKEN_AMOUNT = "inputTokenAmount"; + + @SerializedName(SERIALIZED_NAME_INPUT_TOKEN_AMOUNT) + @jakarta.annotation.Nullable + private String inputTokenAmount; + + public static final String SERIALIZED_NAME_PAIRED_TOKEN_ADDRESS = "pairedTokenAddress"; + + @SerializedName(SERIALIZED_NAME_PAIRED_TOKEN_ADDRESS) + @jakarta.annotation.Nullable + private String pairedTokenAddress; + + public static final String SERIALIZED_NAME_PAIRED_TOKEN_AMOUNT = "pairedTokenAmount"; + + @SerializedName(SERIALIZED_NAME_PAIRED_TOKEN_AMOUNT) + @jakarta.annotation.Nullable + private String pairedTokenAmount; + + public CalculateLpAddPairedAmountsResponseData() {} + + public CalculateLpAddPairedAmountsResponseData inputTokenAmount( + @jakarta.annotation.Nullable String inputTokenAmount) { + this.inputTokenAmount = inputTokenAmount; + return this; + } + + /** + * Echo of the input token amount (human-readable). + * + * @return inputTokenAmount + */ + @jakarta.annotation.Nullable + public String getInputTokenAmount() { + return inputTokenAmount; + } + + public void setInputTokenAmount(@jakarta.annotation.Nullable String inputTokenAmount) { + this.inputTokenAmount = inputTokenAmount; + } + + public CalculateLpAddPairedAmountsResponseData pairedTokenAddress( + @jakarta.annotation.Nullable String pairedTokenAddress) { + this.pairedTokenAddress = pairedTokenAddress; + return this; + } + + /** + * The paired token contract address derived from the investment. + * + * @return pairedTokenAddress + */ + @jakarta.annotation.Nullable + public String getPairedTokenAddress() { + return pairedTokenAddress; + } + + public void setPairedTokenAddress(@jakarta.annotation.Nullable String pairedTokenAddress) { + this.pairedTokenAddress = pairedTokenAddress; + } + + public CalculateLpAddPairedAmountsResponseData pairedTokenAmount( + @jakarta.annotation.Nullable String pairedTokenAmount) { + this.pairedTokenAmount = pairedTokenAmount; + return this; + } + + /** + * Calculated paired token amount (human-readable). + * + * @return pairedTokenAmount + */ + @jakarta.annotation.Nullable + public String getPairedTokenAmount() { + return pairedTokenAmount; + } + + public void setPairedTokenAmount(@jakarta.annotation.Nullable String pairedTokenAmount) { + this.pairedTokenAmount = pairedTokenAmount; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CalculateLpAddPairedAmountsResponseData calculateLpAddPairedAmountsResponseData = + (CalculateLpAddPairedAmountsResponseData) o; + return Objects.equals( + this.inputTokenAmount, + calculateLpAddPairedAmountsResponseData.inputTokenAmount) + && Objects.equals( + this.pairedTokenAddress, + calculateLpAddPairedAmountsResponseData.pairedTokenAddress) + && Objects.equals( + this.pairedTokenAmount, + calculateLpAddPairedAmountsResponseData.pairedTokenAmount); + } + + @Override + public int hashCode() { + return Objects.hash(inputTokenAmount, pairedTokenAddress, pairedTokenAmount); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CalculateLpAddPairedAmountsResponseData {\n"); + sb.append(" inputTokenAmount: ").append(toIndentedString(inputTokenAmount)).append("\n"); + sb.append(" pairedTokenAddress: ") + .append(toIndentedString(pairedTokenAddress)) + .append("\n"); + sb.append(" pairedTokenAmount: ").append(toIndentedString(pairedTokenAmount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object inputTokenAmountValue = getInputTokenAmount(); + String inputTokenAmountValueAsString = ""; + inputTokenAmountValueAsString = inputTokenAmountValue.toString(); + sb.append("inputTokenAmount=").append(urlEncode(inputTokenAmountValueAsString)).append(""); + Object pairedTokenAddressValue = getPairedTokenAddress(); + String pairedTokenAddressValueAsString = ""; + pairedTokenAddressValueAsString = pairedTokenAddressValue.toString(); + sb.append("pairedTokenAddress=") + .append(urlEncode(pairedTokenAddressValueAsString)) + .append(""); + Object pairedTokenAmountValue = getPairedTokenAmount(); + String pairedTokenAmountValueAsString = ""; + pairedTokenAmountValueAsString = pairedTokenAmountValue.toString(); + sb.append("pairedTokenAmount=") + .append(urlEncode(pairedTokenAmountValueAsString)) + .append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("inputTokenAmount"); + openapiFields.add("pairedTokenAddress"); + openapiFields.add("pairedTokenAmount"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * CalculateLpAddPairedAmountsResponseData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CalculateLpAddPairedAmountsResponseData.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " CalculateLpAddPairedAmountsResponseData is not found in the" + + " empty JSON string", + CalculateLpAddPairedAmountsResponseData.openapiRequiredFields + .toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("inputTokenAmount") != null + && !jsonObj.get("inputTokenAmount").isJsonNull()) + && !jsonObj.get("inputTokenAmount").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `inputTokenAmount` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("inputTokenAmount").toString())); + } + if ((jsonObj.get("pairedTokenAddress") != null + && !jsonObj.get("pairedTokenAddress").isJsonNull()) + && !jsonObj.get("pairedTokenAddress").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `pairedTokenAddress` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("pairedTokenAddress").toString())); + } + if ((jsonObj.get("pairedTokenAmount") != null + && !jsonObj.get("pairedTokenAmount").isJsonNull()) + && !jsonObj.get("pairedTokenAmount").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `pairedTokenAmount` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("pairedTokenAmount").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CalculateLpAddPairedAmountsResponseData.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes 'CalculateLpAddPairedAmountsResponseData' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CalculateLpAddPairedAmountsResponseData.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, CalculateLpAddPairedAmountsResponseData value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CalculateLpAddPairedAmountsResponseData read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CalculateLpAddPairedAmountsResponseData given an JSON string + * + * @param jsonString JSON string + * @return An instance of CalculateLpAddPairedAmountsResponseData + * @throws IOException if the JSON string is invalid with respect to + * CalculateLpAddPairedAmountsResponseData + */ + public static CalculateLpAddPairedAmountsResponseData fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, CalculateLpAddPairedAmountsResponseData.class); + } + + /** + * Convert an instance of CalculateLpAddPairedAmountsResponseData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiCallDataItem.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiCallDataItem.java new file mode 100644 index 0000000..2b06ac8 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiCallDataItem.java @@ -0,0 +1,657 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** + * A single unsigned transaction to sign and broadcast. The `dataList` is ordered: APPROVE + * items precede the main action. EVM chains return `to`/`value` (hex) and hex + * calldata in `data`. **Number-format conventions for this object** — `value` + * is a `0x`-prefixed hex string; `gasLimit`, `gasPrice`, + * `maxPriorityFeePerGas`, and `maxFeePerGas` are decimal strings. Mixed + * hex/decimal within the same object is by design (it mirrors the on-chain transaction fields); + * always parse gas fields with base-10 and `value` with base-16. **BSC and EIP-1559**: + * this release is BSC only. BSC is an EIP-1559 chain, so build responses populate + * `maxFeePerGas` and `maxPriorityFeePerGas`; `gasPrice` is + * `null` (legacy-only). The nullable markers below are retained so the schema also + * describes non-1559 chains in later releases — on BSC the 1559 fields are present and the legacy + * `gasPrice` is `null`. `to` and `value` are non-null for + * every action item on BSC. + */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class DefiCallDataItem { + /** + * Action kind of this item: - `APPROVE` — ERC-20 approval, must be signed/broadcast + * and confirmed before the main action - `DEPOSIT` / `REDEEM` / + * `LP_ADD` / `LP_REMOVE` / `CLAIM` — the main action. + * `LP_ADD` / `LP_REMOVE` are the LP add / remove legs (the same build path + * as deposit / redeem for liquidity-pool investments; the kind reflects the on-chain action, + * not the entry endpoint). + */ + @JsonAdapter(CallDataTypeEnum.Adapter.class) + public enum CallDataTypeEnum { + APPROVE("APPROVE"), + + DEPOSIT("DEPOSIT"), + + REDEEM("REDEEM"), + + LP_ADD("LP_ADD"), + + LP_REMOVE("LP_REMOVE"), + + CLAIM("CLAIM"); + + private String value; + + CallDataTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static CallDataTypeEnum fromValue(String value) { + for (CallDataTypeEnum b : CallDataTypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final CallDataTypeEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public CallDataTypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return CallDataTypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + CallDataTypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_CALL_DATA_TYPE = "callDataType"; + + @SerializedName(SERIALIZED_NAME_CALL_DATA_TYPE) + @jakarta.annotation.Nullable + private CallDataTypeEnum callDataType; + + public static final String SERIALIZED_NAME_FROM = "from"; + + @SerializedName(SERIALIZED_NAME_FROM) + @jakarta.annotation.Nullable + private String from; + + public static final String SERIALIZED_NAME_TO = "to"; + + @SerializedName(SERIALIZED_NAME_TO) + @jakarta.annotation.Nullable + private String to; + + public static final String SERIALIZED_NAME_VALUE = "value"; + + @SerializedName(SERIALIZED_NAME_VALUE) + @jakarta.annotation.Nullable + private String value; + + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + @jakarta.annotation.Nullable + private String data; + + public static final String SERIALIZED_NAME_GAS_LIMIT = "gasLimit"; + + @SerializedName(SERIALIZED_NAME_GAS_LIMIT) + @jakarta.annotation.Nullable + private String gasLimit; + + public static final String SERIALIZED_NAME_GAS_PRICE = "gasPrice"; + + @SerializedName(SERIALIZED_NAME_GAS_PRICE) + @jakarta.annotation.Nullable + private String gasPrice; + + public static final String SERIALIZED_NAME_MAX_PRIORITY_FEE_PER_GAS = "maxPriorityFeePerGas"; + + @SerializedName(SERIALIZED_NAME_MAX_PRIORITY_FEE_PER_GAS) + @jakarta.annotation.Nullable + private String maxPriorityFeePerGas; + + public static final String SERIALIZED_NAME_MAX_FEE_PER_GAS = "maxFeePerGas"; + + @SerializedName(SERIALIZED_NAME_MAX_FEE_PER_GAS) + @jakarta.annotation.Nullable + private String maxFeePerGas; + + public DefiCallDataItem() {} + + public DefiCallDataItem callDataType( + @jakarta.annotation.Nullable CallDataTypeEnum callDataType) { + this.callDataType = callDataType; + return this; + } + + /** + * Action kind of this item: - `APPROVE` — ERC-20 approval, must be signed/broadcast + * and confirmed before the main action - `DEPOSIT` / `REDEEM` / + * `LP_ADD` / `LP_REMOVE` / `CLAIM` — the main action. + * `LP_ADD` / `LP_REMOVE` are the LP add / remove legs (the same build path + * as deposit / redeem for liquidity-pool investments; the kind reflects the on-chain action, + * not the entry endpoint). + * + * @return callDataType + */ + @jakarta.annotation.Nullable + public CallDataTypeEnum getCallDataType() { + return callDataType; + } + + public void setCallDataType(@jakarta.annotation.Nullable CallDataTypeEnum callDataType) { + this.callDataType = callDataType; + } + + public DefiCallDataItem from(@jakarta.annotation.Nullable String from) { + this.from = from; + return this; + } + + /** + * User wallet address (the signer / sender). EIP-55 checksummed — normalize with + * `to_checksum_address` before signing if your signer requires it. + * + * @return from + */ + @jakarta.annotation.Nullable + public String getFrom() { + return from; + } + + public void setFrom(@jakarta.annotation.Nullable String from) { + this.from = from; + } + + public DefiCallDataItem to(@jakarta.annotation.Nullable String to) { + this.to = to; + return this; + } + + /** + * Target contract address. EIP-55 checksummed, same format as `from`. Non-null on BSC + * for every action item. + * + * @return to + */ + @jakarta.annotation.Nullable + public String getTo() { + return to; + } + + public void setTo(@jakarta.annotation.Nullable String to) { + this.to = to; + } + + public DefiCallDataItem value(@jakarta.annotation.Nullable String value) { + this.value = value; + return this; + } + + /** + * Native-asset value as a `0x`-prefixed hex string. Non-null on BSC for action items. + * + * @return value + */ + @jakarta.annotation.Nullable + public String getValue() { + return value; + } + + public void setValue(@jakarta.annotation.Nullable String value) { + this.value = value; + } + + public DefiCallDataItem data(@jakarta.annotation.Nullable String data) { + this.data = data; + return this; + } + + /** + * Serialized transaction data, as a `0x`-prefixed hex calldata string. + * + * @return data + */ + @jakarta.annotation.Nullable + public String getData() { + return data; + } + + public void setData(@jakarta.annotation.Nullable String data) { + this.data = data; + } + + public DefiCallDataItem gasLimit(@jakarta.annotation.Nullable String gasLimit) { + this.gasLimit = gasLimit; + return this; + } + + /** + * Suggested gas limit (decimal string). `null` when estimation fails. + * + * @return gasLimit + */ + @jakarta.annotation.Nullable + public String getGasLimit() { + return gasLimit; + } + + public void setGasLimit(@jakarta.annotation.Nullable String gasLimit) { + this.gasLimit = gasLimit; + } + + public DefiCallDataItem gasPrice(@jakarta.annotation.Nullable String gasPrice) { + this.gasPrice = gasPrice; + return this; + } + + /** + * Legacy gas price, decimal string. `null` on EIP-1559 chains such as BSC (use + * `maxFeePerGas` / `maxPriorityFeePerGas` instead). + * + * @return gasPrice + */ + @jakarta.annotation.Nullable + public String getGasPrice() { + return gasPrice; + } + + public void setGasPrice(@jakarta.annotation.Nullable String gasPrice) { + this.gasPrice = gasPrice; + } + + public DefiCallDataItem maxPriorityFeePerGas( + @jakarta.annotation.Nullable String maxPriorityFeePerGas) { + this.maxPriorityFeePerGas = maxPriorityFeePerGas; + return this; + } + + /** + * EIP-1559 priority fee in wei (decimal string). `null` on non-1559 chains. + * + * @return maxPriorityFeePerGas + */ + @jakarta.annotation.Nullable + public String getMaxPriorityFeePerGas() { + return maxPriorityFeePerGas; + } + + public void setMaxPriorityFeePerGas(@jakarta.annotation.Nullable String maxPriorityFeePerGas) { + this.maxPriorityFeePerGas = maxPriorityFeePerGas; + } + + public DefiCallDataItem maxFeePerGas(@jakarta.annotation.Nullable String maxFeePerGas) { + this.maxFeePerGas = maxFeePerGas; + return this; + } + + /** + * EIP-1559 max fee per gas in wei (decimal string). `null` on non-1559 chains. + * + * @return maxFeePerGas + */ + @jakarta.annotation.Nullable + public String getMaxFeePerGas() { + return maxFeePerGas; + } + + public void setMaxFeePerGas(@jakarta.annotation.Nullable String maxFeePerGas) { + this.maxFeePerGas = maxFeePerGas; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DefiCallDataItem defiCallDataItem = (DefiCallDataItem) o; + return Objects.equals(this.callDataType, defiCallDataItem.callDataType) + && Objects.equals(this.from, defiCallDataItem.from) + && Objects.equals(this.to, defiCallDataItem.to) + && Objects.equals(this.value, defiCallDataItem.value) + && Objects.equals(this.data, defiCallDataItem.data) + && Objects.equals(this.gasLimit, defiCallDataItem.gasLimit) + && Objects.equals(this.gasPrice, defiCallDataItem.gasPrice) + && Objects.equals(this.maxPriorityFeePerGas, defiCallDataItem.maxPriorityFeePerGas) + && Objects.equals(this.maxFeePerGas, defiCallDataItem.maxFeePerGas); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash( + callDataType, + from, + to, + value, + data, + gasLimit, + gasPrice, + maxPriorityFeePerGas, + maxFeePerGas); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DefiCallDataItem {\n"); + sb.append(" callDataType: ").append(toIndentedString(callDataType)).append("\n"); + sb.append(" from: ").append(toIndentedString(from)).append("\n"); + sb.append(" to: ").append(toIndentedString(to)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" gasLimit: ").append(toIndentedString(gasLimit)).append("\n"); + sb.append(" gasPrice: ").append(toIndentedString(gasPrice)).append("\n"); + sb.append(" maxPriorityFeePerGas: ") + .append(toIndentedString(maxPriorityFeePerGas)) + .append("\n"); + sb.append(" maxFeePerGas: ").append(toIndentedString(maxFeePerGas)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object callDataTypeValue = getCallDataType(); + String callDataTypeValueAsString = ""; + callDataTypeValueAsString = callDataTypeValue.toString(); + sb.append("callDataType=").append(urlEncode(callDataTypeValueAsString)).append(""); + Object fromValue = getFrom(); + String fromValueAsString = ""; + fromValueAsString = fromValue.toString(); + sb.append("from=").append(urlEncode(fromValueAsString)).append(""); + Object toValue = getTo(); + String toValueAsString = ""; + toValueAsString = toValue.toString(); + sb.append("to=").append(urlEncode(toValueAsString)).append(""); + Object valueValue = getValue(); + String valueValueAsString = ""; + valueValueAsString = valueValue.toString(); + sb.append("value=").append(urlEncode(valueValueAsString)).append(""); + Object dataValue = getData(); + String dataValueAsString = ""; + dataValueAsString = dataValue.toString(); + sb.append("data=").append(urlEncode(dataValueAsString)).append(""); + Object gasLimitValue = getGasLimit(); + String gasLimitValueAsString = ""; + gasLimitValueAsString = gasLimitValue.toString(); + sb.append("gasLimit=").append(urlEncode(gasLimitValueAsString)).append(""); + Object gasPriceValue = getGasPrice(); + String gasPriceValueAsString = ""; + gasPriceValueAsString = gasPriceValue.toString(); + sb.append("gasPrice=").append(urlEncode(gasPriceValueAsString)).append(""); + Object maxPriorityFeePerGasValue = getMaxPriorityFeePerGas(); + String maxPriorityFeePerGasValueAsString = ""; + maxPriorityFeePerGasValueAsString = maxPriorityFeePerGasValue.toString(); + sb.append("maxPriorityFeePerGas=") + .append(urlEncode(maxPriorityFeePerGasValueAsString)) + .append(""); + Object maxFeePerGasValue = getMaxFeePerGas(); + String maxFeePerGasValueAsString = ""; + maxFeePerGasValueAsString = maxFeePerGasValue.toString(); + sb.append("maxFeePerGas=").append(urlEncode(maxFeePerGasValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("callDataType"); + openapiFields.add("from"); + openapiFields.add("to"); + openapiFields.add("value"); + openapiFields.add("data"); + openapiFields.add("gasLimit"); + openapiFields.add("gasPrice"); + openapiFields.add("maxPriorityFeePerGas"); + openapiFields.add("maxFeePerGas"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DefiCallDataItem + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DefiCallDataItem.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DefiCallDataItem is not found in the" + + " empty JSON string", + DefiCallDataItem.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("callDataType") != null && !jsonObj.get("callDataType").isJsonNull()) + && !jsonObj.get("callDataType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `callDataType` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("callDataType").toString())); + } + // validate the optional field `callDataType` + if (jsonObj.get("callDataType") != null && !jsonObj.get("callDataType").isJsonNull()) { + CallDataTypeEnum.validateJsonElement(jsonObj.get("callDataType")); + } + if ((jsonObj.get("from") != null && !jsonObj.get("from").isJsonNull()) + && !jsonObj.get("from").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `from` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("from").toString())); + } + if ((jsonObj.get("to") != null && !jsonObj.get("to").isJsonNull()) + && !jsonObj.get("to").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `to` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("to").toString())); + } + if ((jsonObj.get("value") != null && !jsonObj.get("value").isJsonNull()) + && !jsonObj.get("value").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `value` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("value").toString())); + } + if ((jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) + && !jsonObj.get("data").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `data` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("data").toString())); + } + if ((jsonObj.get("gasLimit") != null && !jsonObj.get("gasLimit").isJsonNull()) + && !jsonObj.get("gasLimit").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `gasLimit` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("gasLimit").toString())); + } + if ((jsonObj.get("gasPrice") != null && !jsonObj.get("gasPrice").isJsonNull()) + && !jsonObj.get("gasPrice").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `gasPrice` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("gasPrice").toString())); + } + if ((jsonObj.get("maxPriorityFeePerGas") != null + && !jsonObj.get("maxPriorityFeePerGas").isJsonNull()) + && !jsonObj.get("maxPriorityFeePerGas").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `maxPriorityFeePerGas` to be a primitive type in" + + " the JSON string but got `%s`", + jsonObj.get("maxPriorityFeePerGas").toString())); + } + if ((jsonObj.get("maxFeePerGas") != null && !jsonObj.get("maxFeePerGas").isJsonNull()) + && !jsonObj.get("maxFeePerGas").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `maxFeePerGas` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("maxFeePerGas").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DefiCallDataItem.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DefiCallDataItem' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(DefiCallDataItem.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DefiCallDataItem value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DefiCallDataItem read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DefiCallDataItem given an JSON string + * + * @param jsonString JSON string + * @return An instance of DefiCallDataItem + * @throws IOException if the JSON string is invalid with respect to DefiCallDataItem + */ + public static DefiCallDataItem fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DefiCallDataItem.class); + } + + /** + * Convert an instance of DefiCallDataItem to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiClaimType.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiClaimType.java new file mode 100644 index 0000000..68a814c --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiClaimType.java @@ -0,0 +1,95 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.google.gson.JsonElement; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import org.hibernate.validator.constraints.*; + +/** + * Claim routing type. Determines which companion fields are required: - + * `REWARD_PROTOCOL`: protocol-level rewards (e.g. Aave incentive, Radiant) — requires + * `defiProtocolId` + `binanceChainId` - `REWARD_INVESTMENT`: + * per-investment rewards — requires `investmentId` - `LP_FEE`: Uniswap V3/V4 LP + * fees — requires `investmentId` + `nftId` - `REDEMPTION`: redeem + * principal (Lista / Aster / Solv etc.) — requires `investmentId` + + * `redemptionId` **Protocol constraints** — not every `claimType` is valid for + * every protocol; an invalid combination is rejected (`40453` or `40454`): - + * `REWARD_PROTOCOL` is **not** supported for LP (liquidity-pool) protocols in this + * release. - `REWARD_INVESTMENT` is not supported for PancakeSwap V3 farming positions; + * use `LP_FEE` to claim farming incentives there. - `LP_FEE` applies only to + * concentrated-liquidity (V3/V4) LP positions. - `REDEMPTION` applies only to protocols + * with a redemption / lock-up flow (Lista, Aster, Solv). The valid `claimType`s for a + * specific position are returned in that position's `positionDetail.claimTypes` (see + * the position list) — branch on that rather than hard-coding the mapping. Note: error messages may + * surface the protocol id with a chain prefix (e.g. `bsc_pancakeswap4`); the canonical id + * in API fields is the un-prefixed form (e.g. `pancakeswap4`). + */ +@JsonAdapter(DefiClaimType.Adapter.class) +public enum DefiClaimType { + REWARD_PROTOCOL("REWARD_PROTOCOL"), + + REWARD_INVESTMENT("REWARD_INVESTMENT"), + + LP_FEE("LP_FEE"), + + REDEMPTION("REDEMPTION"); + + private String value; + + DefiClaimType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static DefiClaimType fromValue(String value) { + for (DefiClaimType b : DefiClaimType.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final DefiClaimType enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public DefiClaimType read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return DefiClaimType.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + DefiClaimType.fromValue(value); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiInvestmentDto.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiInvestmentDto.java new file mode 100644 index 0000000..db873e3 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiInvestmentDto.java @@ -0,0 +1,578 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** DeFi investment product summary (list item). */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class DefiInvestmentDto { + public static final String SERIALIZED_NAME_BINANCE_CHAIN_ID = "binanceChainId"; + + @SerializedName(SERIALIZED_NAME_BINANCE_CHAIN_ID) + @jakarta.annotation.Nullable + private String binanceChainId; + + public static final String SERIALIZED_NAME_DEFI_PROTOCOL_ID = "defiProtocolId"; + + @SerializedName(SERIALIZED_NAME_DEFI_PROTOCOL_ID) + @jakarta.annotation.Nullable + private String defiProtocolId; + + public static final String SERIALIZED_NAME_PROTOCOL_NAME = "protocolName"; + + @SerializedName(SERIALIZED_NAME_PROTOCOL_NAME) + @jakarta.annotation.Nullable + private String protocolName; + + public static final String SERIALIZED_NAME_INVESTMENT_ID = "investmentId"; + + @SerializedName(SERIALIZED_NAME_INVESTMENT_ID) + @jakarta.annotation.Nullable + private String investmentId; + + public static final String SERIALIZED_NAME_INVESTMENT_NAME = "investmentName"; + + @SerializedName(SERIALIZED_NAME_INVESTMENT_NAME) + @jakarta.annotation.Nullable + private String investmentName; + + public static final String SERIALIZED_NAME_INVEST_TYPE = "investType"; + + @SerializedName(SERIALIZED_NAME_INVEST_TYPE) + @jakarta.annotation.Nullable + private String investType; + + public static final String SERIALIZED_NAME_APY_TYPE = "apyType"; + + @SerializedName(SERIALIZED_NAME_APY_TYPE) + @jakarta.annotation.Nullable + private String apyType; + + public static final String SERIALIZED_NAME_APY_BPS = "apyBps"; + + @SerializedName(SERIALIZED_NAME_APY_BPS) + @jakarta.annotation.Nullable + private Long apyBps; + + public static final String SERIALIZED_NAME_APY_DISPLAY = "apyDisplay"; + + @SerializedName(SERIALIZED_NAME_APY_DISPLAY) + @jakarta.annotation.Nullable + private String apyDisplay; + + public static final String SERIALIZED_NAME_TVL = "tvl"; + + @SerializedName(SERIALIZED_NAME_TVL) + @jakarta.annotation.Nullable + private String tvl; + + public DefiInvestmentDto() {} + + public DefiInvestmentDto binanceChainId(@jakarta.annotation.Nullable String binanceChainId) { + this.binanceChainId = binanceChainId; + return this; + } + + /** + * Binance chain ID. + * + * @return binanceChainId + */ + @jakarta.annotation.Nullable + public String getBinanceChainId() { + return binanceChainId; + } + + public void setBinanceChainId(@jakarta.annotation.Nullable String binanceChainId) { + this.binanceChainId = binanceChainId; + } + + public DefiInvestmentDto defiProtocolId(@jakarta.annotation.Nullable String defiProtocolId) { + this.defiProtocolId = defiProtocolId; + return this; + } + + /** + * Parent DeFi protocol identifier. + * + * @return defiProtocolId + */ + @jakarta.annotation.Nullable + public String getDefiProtocolId() { + return defiProtocolId; + } + + public void setDefiProtocolId(@jakarta.annotation.Nullable String defiProtocolId) { + this.defiProtocolId = defiProtocolId; + } + + public DefiInvestmentDto protocolName(@jakarta.annotation.Nullable String protocolName) { + this.protocolName = protocolName; + return this; + } + + /** + * Protocol display name. + * + * @return protocolName + */ + @jakarta.annotation.Nullable + public String getProtocolName() { + return protocolName; + } + + public void setProtocolName(@jakarta.annotation.Nullable String protocolName) { + this.protocolName = protocolName; + } + + public DefiInvestmentDto investmentId(@jakarta.annotation.Nullable String investmentId) { + this.investmentId = investmentId; + return this; + } + + /** + * Investment product identifier (64-char hex, no `0x` prefix). Same format as the + * `investmentIds` returned by `POST /api/v1/defi/data/position/list` and + * accepted by the transaction build endpoints. + * + * @return investmentId + */ + @jakarta.annotation.Nullable + public String getInvestmentId() { + return investmentId; + } + + public void setInvestmentId(@jakarta.annotation.Nullable String investmentId) { + this.investmentId = investmentId; + } + + public DefiInvestmentDto investmentName(@jakarta.annotation.Nullable String investmentName) { + this.investmentName = investmentName; + return this; + } + + /** + * Investment display name. + * + * @return investmentName + */ + @jakarta.annotation.Nullable + public String getInvestmentName() { + return investmentName; + } + + public void setInvestmentName(@jakarta.annotation.Nullable String investmentName) { + this.investmentName = investmentName; + } + + public DefiInvestmentDto investType(@jakarta.annotation.Nullable String investType) { + this.investType = investType; + return this; + } + + /** + * Investment type of this product — a single string here (each product has exactly one). Note: + * the protocol-level investType (in protocol list/detail) is an array. Known values: Earn, + * LiquidityPool. + * + * @return investType + */ + @jakarta.annotation.Nullable + public String getInvestType() { + return investType; + } + + public void setInvestType(@jakarta.annotation.Nullable String investType) { + this.investType = investType; + } + + public DefiInvestmentDto apyType(@jakarta.annotation.Nullable String apyType) { + this.apyType = apyType; + return this; + } + + /** + * Rate yield type. Known values: APY, APR. + * + * @return apyType + */ + @jakarta.annotation.Nullable + public String getApyType() { + return apyType; + } + + public void setApyType(@jakarta.annotation.Nullable String apyType) { + this.apyType = apyType; + } + + public DefiInvestmentDto apyBps(@jakarta.annotation.Nullable Long apyBps) { + this.apyBps = apyBps; + return this; + } + + /** + * Annual percentage yield in basis points (1 bps = 0.01%). Integer value — use this for + * sorting / comparing / filtering, never the raw decimal. + * + * @return apyBps + */ + @jakarta.annotation.Nullable + public Long getApyBps() { + return apyBps; + } + + public void setApyBps(@jakarta.annotation.Nullable Long apyBps) { + this.apyBps = apyBps; + } + + public DefiInvestmentDto apyDisplay(@jakarta.annotation.Nullable String apyDisplay) { + this.apyDisplay = apyDisplay; + return this; + } + + /** + * Pre-formatted, human-readable APY string for display (e.g. \"1,562.65%\"). Quote + * as-is; do not re-compute or transform. + * + * @return apyDisplay + */ + @jakarta.annotation.Nullable + public String getApyDisplay() { + return apyDisplay; + } + + public void setApyDisplay(@jakarta.annotation.Nullable String apyDisplay) { + this.apyDisplay = apyDisplay; + } + + public DefiInvestmentDto tvl(@jakarta.annotation.Nullable String tvl) { + this.tvl = tvl; + return this; + } + + /** + * Total value locked in this investment (USD). String, raw precision from the data source. + * + * @return tvl + */ + @jakarta.annotation.Nullable + public String getTvl() { + return tvl; + } + + public void setTvl(@jakarta.annotation.Nullable String tvl) { + this.tvl = tvl; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DefiInvestmentDto defiInvestmentDto = (DefiInvestmentDto) o; + return Objects.equals(this.binanceChainId, defiInvestmentDto.binanceChainId) + && Objects.equals(this.defiProtocolId, defiInvestmentDto.defiProtocolId) + && Objects.equals(this.protocolName, defiInvestmentDto.protocolName) + && Objects.equals(this.investmentId, defiInvestmentDto.investmentId) + && Objects.equals(this.investmentName, defiInvestmentDto.investmentName) + && Objects.equals(this.investType, defiInvestmentDto.investType) + && Objects.equals(this.apyType, defiInvestmentDto.apyType) + && Objects.equals(this.apyBps, defiInvestmentDto.apyBps) + && Objects.equals(this.apyDisplay, defiInvestmentDto.apyDisplay) + && Objects.equals(this.tvl, defiInvestmentDto.tvl); + } + + @Override + public int hashCode() { + return Objects.hash( + binanceChainId, + defiProtocolId, + protocolName, + investmentId, + investmentName, + investType, + apyType, + apyBps, + apyDisplay, + tvl); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DefiInvestmentDto {\n"); + sb.append(" binanceChainId: ").append(toIndentedString(binanceChainId)).append("\n"); + sb.append(" defiProtocolId: ").append(toIndentedString(defiProtocolId)).append("\n"); + sb.append(" protocolName: ").append(toIndentedString(protocolName)).append("\n"); + sb.append(" investmentId: ").append(toIndentedString(investmentId)).append("\n"); + sb.append(" investmentName: ").append(toIndentedString(investmentName)).append("\n"); + sb.append(" investType: ").append(toIndentedString(investType)).append("\n"); + sb.append(" apyType: ").append(toIndentedString(apyType)).append("\n"); + sb.append(" apyBps: ").append(toIndentedString(apyBps)).append("\n"); + sb.append(" apyDisplay: ").append(toIndentedString(apyDisplay)).append("\n"); + sb.append(" tvl: ").append(toIndentedString(tvl)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object binanceChainIdValue = getBinanceChainId(); + String binanceChainIdValueAsString = ""; + binanceChainIdValueAsString = binanceChainIdValue.toString(); + sb.append("binanceChainId=").append(urlEncode(binanceChainIdValueAsString)).append(""); + Object defiProtocolIdValue = getDefiProtocolId(); + String defiProtocolIdValueAsString = ""; + defiProtocolIdValueAsString = defiProtocolIdValue.toString(); + sb.append("defiProtocolId=").append(urlEncode(defiProtocolIdValueAsString)).append(""); + Object protocolNameValue = getProtocolName(); + String protocolNameValueAsString = ""; + protocolNameValueAsString = protocolNameValue.toString(); + sb.append("protocolName=").append(urlEncode(protocolNameValueAsString)).append(""); + Object investmentIdValue = getInvestmentId(); + String investmentIdValueAsString = ""; + investmentIdValueAsString = investmentIdValue.toString(); + sb.append("investmentId=").append(urlEncode(investmentIdValueAsString)).append(""); + Object investmentNameValue = getInvestmentName(); + String investmentNameValueAsString = ""; + investmentNameValueAsString = investmentNameValue.toString(); + sb.append("investmentName=").append(urlEncode(investmentNameValueAsString)).append(""); + Object investTypeValue = getInvestType(); + String investTypeValueAsString = ""; + investTypeValueAsString = investTypeValue.toString(); + sb.append("investType=").append(urlEncode(investTypeValueAsString)).append(""); + Object apyTypeValue = getApyType(); + String apyTypeValueAsString = ""; + apyTypeValueAsString = apyTypeValue.toString(); + sb.append("apyType=").append(urlEncode(apyTypeValueAsString)).append(""); + Object apyBpsValue = getApyBps(); + String apyBpsValueAsString = ""; + apyBpsValueAsString = apyBpsValue.toString(); + sb.append("apyBps=").append(urlEncode(apyBpsValueAsString)).append(""); + Object apyDisplayValue = getApyDisplay(); + String apyDisplayValueAsString = ""; + apyDisplayValueAsString = apyDisplayValue.toString(); + sb.append("apyDisplay=").append(urlEncode(apyDisplayValueAsString)).append(""); + Object tvlValue = getTvl(); + String tvlValueAsString = ""; + tvlValueAsString = tvlValue.toString(); + sb.append("tvl=").append(urlEncode(tvlValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("binanceChainId"); + openapiFields.add("defiProtocolId"); + openapiFields.add("protocolName"); + openapiFields.add("investmentId"); + openapiFields.add("investmentName"); + openapiFields.add("investType"); + openapiFields.add("apyType"); + openapiFields.add("apyBps"); + openapiFields.add("apyDisplay"); + openapiFields.add("tvl"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DefiInvestmentDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DefiInvestmentDto.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DefiInvestmentDto is not found in the" + + " empty JSON string", + DefiInvestmentDto.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("binanceChainId") != null && !jsonObj.get("binanceChainId").isJsonNull()) + && !jsonObj.get("binanceChainId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `binanceChainId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("binanceChainId").toString())); + } + if ((jsonObj.get("defiProtocolId") != null && !jsonObj.get("defiProtocolId").isJsonNull()) + && !jsonObj.get("defiProtocolId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `defiProtocolId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("defiProtocolId").toString())); + } + if ((jsonObj.get("protocolName") != null && !jsonObj.get("protocolName").isJsonNull()) + && !jsonObj.get("protocolName").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `protocolName` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("protocolName").toString())); + } + if ((jsonObj.get("investmentId") != null && !jsonObj.get("investmentId").isJsonNull()) + && !jsonObj.get("investmentId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `investmentId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("investmentId").toString())); + } + if ((jsonObj.get("investmentName") != null && !jsonObj.get("investmentName").isJsonNull()) + && !jsonObj.get("investmentName").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `investmentName` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("investmentName").toString())); + } + if ((jsonObj.get("investType") != null && !jsonObj.get("investType").isJsonNull()) + && !jsonObj.get("investType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `investType` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("investType").toString())); + } + if ((jsonObj.get("apyType") != null && !jsonObj.get("apyType").isJsonNull()) + && !jsonObj.get("apyType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `apyType` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("apyType").toString())); + } + if ((jsonObj.get("apyDisplay") != null && !jsonObj.get("apyDisplay").isJsonNull()) + && !jsonObj.get("apyDisplay").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `apyDisplay` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("apyDisplay").toString())); + } + if ((jsonObj.get("tvl") != null && !jsonObj.get("tvl").isJsonNull()) + && !jsonObj.get("tvl").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `tvl` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("tvl").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DefiInvestmentDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DefiInvestmentDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(DefiInvestmentDto.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DefiInvestmentDto value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DefiInvestmentDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DefiInvestmentDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of DefiInvestmentDto + * @throws IOException if the JSON string is invalid with respect to DefiInvestmentDto + */ + public static DefiInvestmentDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DefiInvestmentDto.class); + } + + /** + * Convert an instance of DefiInvestmentDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiInvestmentInfoDto.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiInvestmentInfoDto.java new file mode 100644 index 0000000..526e12c --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiInvestmentInfoDto.java @@ -0,0 +1,1025 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; +import org.hibernate.validator.constraints.*; + +/** DeFi investment product detail. */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class DefiInvestmentInfoDto { + public static final String SERIALIZED_NAME_BINANCE_CHAIN_ID = "binanceChainId"; + + @SerializedName(SERIALIZED_NAME_BINANCE_CHAIN_ID) + @jakarta.annotation.Nullable + private String binanceChainId; + + public static final String SERIALIZED_NAME_DEFI_PROTOCOL_ID = "defiProtocolId"; + + @SerializedName(SERIALIZED_NAME_DEFI_PROTOCOL_ID) + @jakarta.annotation.Nullable + private String defiProtocolId; + + public static final String SERIALIZED_NAME_PROTOCOL_NAME = "protocolName"; + + @SerializedName(SERIALIZED_NAME_PROTOCOL_NAME) + @jakarta.annotation.Nullable + private String protocolName; + + public static final String SERIALIZED_NAME_PROTOCOL_LOGO = "protocolLogo"; + + @SerializedName(SERIALIZED_NAME_PROTOCOL_LOGO) + @jakarta.annotation.Nullable + private String protocolLogo; + + public static final String SERIALIZED_NAME_INVESTMENT_ID = "investmentId"; + + @SerializedName(SERIALIZED_NAME_INVESTMENT_ID) + @jakarta.annotation.Nullable + private String investmentId; + + public static final String SERIALIZED_NAME_INVESTMENT_NAME = "investmentName"; + + @SerializedName(SERIALIZED_NAME_INVESTMENT_NAME) + @jakarta.annotation.Nullable + private String investmentName; + + public static final String SERIALIZED_NAME_INVEST_TYPE = "investType"; + + @SerializedName(SERIALIZED_NAME_INVEST_TYPE) + @jakarta.annotation.Nullable + private String investType; + + public static final String SERIALIZED_NAME_INVESTABLE = "investable"; + + @SerializedName(SERIALIZED_NAME_INVESTABLE) + @jakarta.annotation.Nullable + private Boolean investable; + + public static final String SERIALIZED_NAME_APY_BPS = "apyBps"; + + @SerializedName(SERIALIZED_NAME_APY_BPS) + @jakarta.annotation.Nullable + private Long apyBps; + + public static final String SERIALIZED_NAME_APY_DISPLAY = "apyDisplay"; + + @SerializedName(SERIALIZED_NAME_APY_DISPLAY) + @jakarta.annotation.Nullable + private String apyDisplay; + + public static final String SERIALIZED_NAME_APY_TYPE = "apyType"; + + @SerializedName(SERIALIZED_NAME_APY_TYPE) + @jakarta.annotation.Nullable + private String apyType; + + public static final String SERIALIZED_NAME_TVL = "tvl"; + + @SerializedName(SERIALIZED_NAME_TVL) + @jakarta.annotation.Nullable + private String tvl; + + public static final String SERIALIZED_NAME_POOL_ADDRESS = "poolAddress"; + + @SerializedName(SERIALIZED_NAME_POOL_ADDRESS) + @jakarta.annotation.Nullable + private String poolAddress; + + public static final String SERIALIZED_NAME_FEE_RATE = "feeRate"; + + @SerializedName(SERIALIZED_NAME_FEE_RATE) + @jakarta.annotation.Nullable + private String feeRate; + + public static final String SERIALIZED_NAME_ASSET_TOKEN_LIST = "assetTokenList"; + + @SerializedName(SERIALIZED_NAME_ASSET_TOKEN_LIST) + @jakarta.annotation.Nullable + private List<@Valid DefiInvestmentInfoDtoAssetTokenListInner> assetTokenList; + + public static final String SERIALIZED_NAME_REWARD_TOKEN_LIST = "rewardTokenList"; + + @SerializedName(SERIALIZED_NAME_REWARD_TOKEN_LIST) + @jakarta.annotation.Nullable + private List<@Valid DefiInvestmentInfoDtoAssetTokenListInner> rewardTokenList; + + public static final String SERIALIZED_NAME_LP_TOKEN_LIST = "lpTokenList"; + + @SerializedName(SERIALIZED_NAME_LP_TOKEN_LIST) + @jakarta.annotation.Nullable + private List<@Valid DefiInvestmentInfoDtoAssetTokenListInner> lpTokenList; + + public static final String SERIALIZED_NAME_BORROW_TOKEN_LIST = "borrowTokenList"; + + @SerializedName(SERIALIZED_NAME_BORROW_TOKEN_LIST) + @jakarta.annotation.Nullable + private List<@Valid DefiInvestmentInfoDtoAssetTokenListInner> borrowTokenList; + + public DefiInvestmentInfoDto() {} + + public DefiInvestmentInfoDto binanceChainId( + @jakarta.annotation.Nullable String binanceChainId) { + this.binanceChainId = binanceChainId; + return this; + } + + /** + * Binance chain ID. + * + * @return binanceChainId + */ + @jakarta.annotation.Nullable + public String getBinanceChainId() { + return binanceChainId; + } + + public void setBinanceChainId(@jakarta.annotation.Nullable String binanceChainId) { + this.binanceChainId = binanceChainId; + } + + public DefiInvestmentInfoDto defiProtocolId( + @jakarta.annotation.Nullable String defiProtocolId) { + this.defiProtocolId = defiProtocolId; + return this; + } + + /** + * Parent DeFi protocol identifier. + * + * @return defiProtocolId + */ + @jakarta.annotation.Nullable + public String getDefiProtocolId() { + return defiProtocolId; + } + + public void setDefiProtocolId(@jakarta.annotation.Nullable String defiProtocolId) { + this.defiProtocolId = defiProtocolId; + } + + public DefiInvestmentInfoDto protocolName(@jakarta.annotation.Nullable String protocolName) { + this.protocolName = protocolName; + return this; + } + + /** + * Protocol display name. + * + * @return protocolName + */ + @jakarta.annotation.Nullable + public String getProtocolName() { + return protocolName; + } + + public void setProtocolName(@jakarta.annotation.Nullable String protocolName) { + this.protocolName = protocolName; + } + + public DefiInvestmentInfoDto protocolLogo(@jakarta.annotation.Nullable String protocolLogo) { + this.protocolLogo = protocolLogo; + return this; + } + + /** + * Protocol logo image URL (full URL; quote as-is). + * + * @return protocolLogo + */ + @jakarta.annotation.Nullable + public String getProtocolLogo() { + return protocolLogo; + } + + public void setProtocolLogo(@jakarta.annotation.Nullable String protocolLogo) { + this.protocolLogo = protocolLogo; + } + + public DefiInvestmentInfoDto investmentId(@jakarta.annotation.Nullable String investmentId) { + this.investmentId = investmentId; + return this; + } + + /** + * Investment product identifier (64-char hex, no `0x` prefix). Same format as the + * `investmentIds` returned by `POST /api/v1/defi/data/position/list` and + * accepted by the transaction build endpoints. + * + * @return investmentId + */ + @jakarta.annotation.Nullable + public String getInvestmentId() { + return investmentId; + } + + public void setInvestmentId(@jakarta.annotation.Nullable String investmentId) { + this.investmentId = investmentId; + } + + public DefiInvestmentInfoDto investmentName( + @jakarta.annotation.Nullable String investmentName) { + this.investmentName = investmentName; + return this; + } + + /** + * Investment display name. + * + * @return investmentName + */ + @jakarta.annotation.Nullable + public String getInvestmentName() { + return investmentName; + } + + public void setInvestmentName(@jakarta.annotation.Nullable String investmentName) { + this.investmentName = investmentName; + } + + public DefiInvestmentInfoDto investType(@jakarta.annotation.Nullable String investType) { + this.investType = investType; + return this; + } + + /** + * Investment type of this product — a single string here (each product has exactly one). Note: + * the protocol-level investType (in protocol list/detail) is an array. Known values: Earn, + * LiquidityPool. + * + * @return investType + */ + @jakarta.annotation.Nullable + public String getInvestType() { + return investType; + } + + public void setInvestType(@jakarta.annotation.Nullable String investType) { + this.investType = investType; + } + + public DefiInvestmentInfoDto investable(@jakarta.annotation.Nullable Boolean investable) { + this.investable = investable; + return this; + } + + /** + * Whether this investment is currently investable. + * + * @return investable + */ + @jakarta.annotation.Nullable + public Boolean getInvestable() { + return investable; + } + + public void setInvestable(@jakarta.annotation.Nullable Boolean investable) { + this.investable = investable; + } + + public DefiInvestmentInfoDto apyBps(@jakarta.annotation.Nullable Long apyBps) { + this.apyBps = apyBps; + return this; + } + + /** + * Annual percentage yield in basis points (1 bps = 0.01%). Integer value — use this for + * sorting / comparing / filtering, never the raw decimal. + * + * @return apyBps + */ + @jakarta.annotation.Nullable + public Long getApyBps() { + return apyBps; + } + + public void setApyBps(@jakarta.annotation.Nullable Long apyBps) { + this.apyBps = apyBps; + } + + public DefiInvestmentInfoDto apyDisplay(@jakarta.annotation.Nullable String apyDisplay) { + this.apyDisplay = apyDisplay; + return this; + } + + /** + * Pre-formatted, human-readable APY string for display (e.g. \"1,562.65%\"). Quote + * as-is; do not re-compute or transform. + * + * @return apyDisplay + */ + @jakarta.annotation.Nullable + public String getApyDisplay() { + return apyDisplay; + } + + public void setApyDisplay(@jakarta.annotation.Nullable String apyDisplay) { + this.apyDisplay = apyDisplay; + } + + public DefiInvestmentInfoDto apyType(@jakarta.annotation.Nullable String apyType) { + this.apyType = apyType; + return this; + } + + /** + * Rate yield type. Known values: APY, APR. + * + * @return apyType + */ + @jakarta.annotation.Nullable + public String getApyType() { + return apyType; + } + + public void setApyType(@jakarta.annotation.Nullable String apyType) { + this.apyType = apyType; + } + + public DefiInvestmentInfoDto tvl(@jakarta.annotation.Nullable String tvl) { + this.tvl = tvl; + return this; + } + + /** + * Total value locked (USD). String, raw precision from the data source. + * + * @return tvl + */ + @jakarta.annotation.Nullable + public String getTvl() { + return tvl; + } + + public void setTvl(@jakarta.annotation.Nullable String tvl) { + this.tvl = tvl; + } + + public DefiInvestmentInfoDto poolAddress(@jakarta.annotation.Nullable String poolAddress) { + this.poolAddress = poolAddress; + return this; + } + + /** + * Pool / strategy contract address. + * + * @return poolAddress + */ + @jakarta.annotation.Nullable + public String getPoolAddress() { + return poolAddress; + } + + public void setPoolAddress(@jakarta.annotation.Nullable String poolAddress) { + this.poolAddress = poolAddress; + } + + public DefiInvestmentInfoDto feeRate(@jakarta.annotation.Nullable String feeRate) { + this.feeRate = feeRate; + return this; + } + + /** + * Fee rate string (e.g. \"0.001\" = 0.1%). + * + * @return feeRate + */ + @jakarta.annotation.Nullable + public String getFeeRate() { + return feeRate; + } + + public void setFeeRate(@jakarta.annotation.Nullable String feeRate) { + this.feeRate = feeRate; + } + + public DefiInvestmentInfoDto assetTokenList( + @jakarta.annotation.Nullable + List<@Valid DefiInvestmentInfoDtoAssetTokenListInner> assetTokenList) { + this.assetTokenList = assetTokenList; + return this; + } + + public DefiInvestmentInfoDto addAssetTokenListItem( + DefiInvestmentInfoDtoAssetTokenListInner assetTokenListItem) { + if (this.assetTokenList == null) { + this.assetTokenList = new ArrayList<>(); + } + this.assetTokenList.add(assetTokenListItem); + return this; + } + + /** + * Tokens to supply / deposit. + * + * @return assetTokenList + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid DefiInvestmentInfoDtoAssetTokenListInner> getAssetTokenList() { + return assetTokenList; + } + + public void setAssetTokenList( + @jakarta.annotation.Nullable + List<@Valid DefiInvestmentInfoDtoAssetTokenListInner> assetTokenList) { + this.assetTokenList = assetTokenList; + } + + public DefiInvestmentInfoDto rewardTokenList( + @jakarta.annotation.Nullable + List<@Valid DefiInvestmentInfoDtoAssetTokenListInner> rewardTokenList) { + this.rewardTokenList = rewardTokenList; + return this; + } + + public DefiInvestmentInfoDto addRewardTokenListItem( + DefiInvestmentInfoDtoAssetTokenListInner rewardTokenListItem) { + if (this.rewardTokenList == null) { + this.rewardTokenList = new ArrayList<>(); + } + this.rewardTokenList.add(rewardTokenListItem); + return this; + } + + /** + * Reward tokens. + * + * @return rewardTokenList + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid DefiInvestmentInfoDtoAssetTokenListInner> getRewardTokenList() { + return rewardTokenList; + } + + public void setRewardTokenList( + @jakarta.annotation.Nullable + List<@Valid DefiInvestmentInfoDtoAssetTokenListInner> rewardTokenList) { + this.rewardTokenList = rewardTokenList; + } + + public DefiInvestmentInfoDto lpTokenList( + @jakarta.annotation.Nullable + List<@Valid DefiInvestmentInfoDtoAssetTokenListInner> lpTokenList) { + this.lpTokenList = lpTokenList; + return this; + } + + public DefiInvestmentInfoDto addLpTokenListItem( + DefiInvestmentInfoDtoAssetTokenListInner lpTokenListItem) { + if (this.lpTokenList == null) { + this.lpTokenList = new ArrayList<>(); + } + this.lpTokenList.add(lpTokenListItem); + return this; + } + + /** + * LP tokens (for liquidity positions). + * + * @return lpTokenList + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid DefiInvestmentInfoDtoAssetTokenListInner> getLpTokenList() { + return lpTokenList; + } + + public void setLpTokenList( + @jakarta.annotation.Nullable + List<@Valid DefiInvestmentInfoDtoAssetTokenListInner> lpTokenList) { + this.lpTokenList = lpTokenList; + } + + public DefiInvestmentInfoDto borrowTokenList( + @jakarta.annotation.Nullable + List<@Valid DefiInvestmentInfoDtoAssetTokenListInner> borrowTokenList) { + this.borrowTokenList = borrowTokenList; + return this; + } + + public DefiInvestmentInfoDto addBorrowTokenListItem( + DefiInvestmentInfoDtoAssetTokenListInner borrowTokenListItem) { + if (this.borrowTokenList == null) { + this.borrowTokenList = new ArrayList<>(); + } + this.borrowTokenList.add(borrowTokenListItem); + return this; + } + + /** + * Borrow tokens (for lending borrow positions). + * + * @return borrowTokenList + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid DefiInvestmentInfoDtoAssetTokenListInner> getBorrowTokenList() { + return borrowTokenList; + } + + public void setBorrowTokenList( + @jakarta.annotation.Nullable + List<@Valid DefiInvestmentInfoDtoAssetTokenListInner> borrowTokenList) { + this.borrowTokenList = borrowTokenList; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DefiInvestmentInfoDto defiInvestmentInfoDto = (DefiInvestmentInfoDto) o; + return Objects.equals(this.binanceChainId, defiInvestmentInfoDto.binanceChainId) + && Objects.equals(this.defiProtocolId, defiInvestmentInfoDto.defiProtocolId) + && Objects.equals(this.protocolName, defiInvestmentInfoDto.protocolName) + && Objects.equals(this.protocolLogo, defiInvestmentInfoDto.protocolLogo) + && Objects.equals(this.investmentId, defiInvestmentInfoDto.investmentId) + && Objects.equals(this.investmentName, defiInvestmentInfoDto.investmentName) + && Objects.equals(this.investType, defiInvestmentInfoDto.investType) + && Objects.equals(this.investable, defiInvestmentInfoDto.investable) + && Objects.equals(this.apyBps, defiInvestmentInfoDto.apyBps) + && Objects.equals(this.apyDisplay, defiInvestmentInfoDto.apyDisplay) + && Objects.equals(this.apyType, defiInvestmentInfoDto.apyType) + && Objects.equals(this.tvl, defiInvestmentInfoDto.tvl) + && Objects.equals(this.poolAddress, defiInvestmentInfoDto.poolAddress) + && Objects.equals(this.feeRate, defiInvestmentInfoDto.feeRate) + && Objects.equals(this.assetTokenList, defiInvestmentInfoDto.assetTokenList) + && Objects.equals(this.rewardTokenList, defiInvestmentInfoDto.rewardTokenList) + && Objects.equals(this.lpTokenList, defiInvestmentInfoDto.lpTokenList) + && Objects.equals(this.borrowTokenList, defiInvestmentInfoDto.borrowTokenList); + } + + @Override + public int hashCode() { + return Objects.hash( + binanceChainId, + defiProtocolId, + protocolName, + protocolLogo, + investmentId, + investmentName, + investType, + investable, + apyBps, + apyDisplay, + apyType, + tvl, + poolAddress, + feeRate, + assetTokenList, + rewardTokenList, + lpTokenList, + borrowTokenList); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DefiInvestmentInfoDto {\n"); + sb.append(" binanceChainId: ").append(toIndentedString(binanceChainId)).append("\n"); + sb.append(" defiProtocolId: ").append(toIndentedString(defiProtocolId)).append("\n"); + sb.append(" protocolName: ").append(toIndentedString(protocolName)).append("\n"); + sb.append(" protocolLogo: ").append(toIndentedString(protocolLogo)).append("\n"); + sb.append(" investmentId: ").append(toIndentedString(investmentId)).append("\n"); + sb.append(" investmentName: ").append(toIndentedString(investmentName)).append("\n"); + sb.append(" investType: ").append(toIndentedString(investType)).append("\n"); + sb.append(" investable: ").append(toIndentedString(investable)).append("\n"); + sb.append(" apyBps: ").append(toIndentedString(apyBps)).append("\n"); + sb.append(" apyDisplay: ").append(toIndentedString(apyDisplay)).append("\n"); + sb.append(" apyType: ").append(toIndentedString(apyType)).append("\n"); + sb.append(" tvl: ").append(toIndentedString(tvl)).append("\n"); + sb.append(" poolAddress: ").append(toIndentedString(poolAddress)).append("\n"); + sb.append(" feeRate: ").append(toIndentedString(feeRate)).append("\n"); + sb.append(" assetTokenList: ").append(toIndentedString(assetTokenList)).append("\n"); + sb.append(" rewardTokenList: ").append(toIndentedString(rewardTokenList)).append("\n"); + sb.append(" lpTokenList: ").append(toIndentedString(lpTokenList)).append("\n"); + sb.append(" borrowTokenList: ").append(toIndentedString(borrowTokenList)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object binanceChainIdValue = getBinanceChainId(); + String binanceChainIdValueAsString = ""; + binanceChainIdValueAsString = binanceChainIdValue.toString(); + sb.append("binanceChainId=").append(urlEncode(binanceChainIdValueAsString)).append(""); + Object defiProtocolIdValue = getDefiProtocolId(); + String defiProtocolIdValueAsString = ""; + defiProtocolIdValueAsString = defiProtocolIdValue.toString(); + sb.append("defiProtocolId=").append(urlEncode(defiProtocolIdValueAsString)).append(""); + Object protocolNameValue = getProtocolName(); + String protocolNameValueAsString = ""; + protocolNameValueAsString = protocolNameValue.toString(); + sb.append("protocolName=").append(urlEncode(protocolNameValueAsString)).append(""); + Object protocolLogoValue = getProtocolLogo(); + String protocolLogoValueAsString = ""; + protocolLogoValueAsString = protocolLogoValue.toString(); + sb.append("protocolLogo=").append(urlEncode(protocolLogoValueAsString)).append(""); + Object investmentIdValue = getInvestmentId(); + String investmentIdValueAsString = ""; + investmentIdValueAsString = investmentIdValue.toString(); + sb.append("investmentId=").append(urlEncode(investmentIdValueAsString)).append(""); + Object investmentNameValue = getInvestmentName(); + String investmentNameValueAsString = ""; + investmentNameValueAsString = investmentNameValue.toString(); + sb.append("investmentName=").append(urlEncode(investmentNameValueAsString)).append(""); + Object investTypeValue = getInvestType(); + String investTypeValueAsString = ""; + investTypeValueAsString = investTypeValue.toString(); + sb.append("investType=").append(urlEncode(investTypeValueAsString)).append(""); + Object investableValue = getInvestable(); + String investableValueAsString = ""; + investableValueAsString = investableValue.toString(); + sb.append("investable=").append(urlEncode(investableValueAsString)).append(""); + Object apyBpsValue = getApyBps(); + String apyBpsValueAsString = ""; + apyBpsValueAsString = apyBpsValue.toString(); + sb.append("apyBps=").append(urlEncode(apyBpsValueAsString)).append(""); + Object apyDisplayValue = getApyDisplay(); + String apyDisplayValueAsString = ""; + apyDisplayValueAsString = apyDisplayValue.toString(); + sb.append("apyDisplay=").append(urlEncode(apyDisplayValueAsString)).append(""); + Object apyTypeValue = getApyType(); + String apyTypeValueAsString = ""; + apyTypeValueAsString = apyTypeValue.toString(); + sb.append("apyType=").append(urlEncode(apyTypeValueAsString)).append(""); + Object tvlValue = getTvl(); + String tvlValueAsString = ""; + tvlValueAsString = tvlValue.toString(); + sb.append("tvl=").append(urlEncode(tvlValueAsString)).append(""); + Object poolAddressValue = getPoolAddress(); + String poolAddressValueAsString = ""; + poolAddressValueAsString = poolAddressValue.toString(); + sb.append("poolAddress=").append(urlEncode(poolAddressValueAsString)).append(""); + Object feeRateValue = getFeeRate(); + String feeRateValueAsString = ""; + feeRateValueAsString = feeRateValue.toString(); + sb.append("feeRate=").append(urlEncode(feeRateValueAsString)).append(""); + Object assetTokenListValue = getAssetTokenList(); + String assetTokenListValueAsString = ""; + assetTokenListValueAsString = + (String) + ((Collection) assetTokenListValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("assetTokenList=").append(urlEncode(assetTokenListValueAsString)).append(""); + Object rewardTokenListValue = getRewardTokenList(); + String rewardTokenListValueAsString = ""; + rewardTokenListValueAsString = + (String) + ((Collection) rewardTokenListValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("rewardTokenList=").append(urlEncode(rewardTokenListValueAsString)).append(""); + Object lpTokenListValue = getLpTokenList(); + String lpTokenListValueAsString = ""; + lpTokenListValueAsString = + (String) + ((Collection) lpTokenListValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("lpTokenList=").append(urlEncode(lpTokenListValueAsString)).append(""); + Object borrowTokenListValue = getBorrowTokenList(); + String borrowTokenListValueAsString = ""; + borrowTokenListValueAsString = + (String) + ((Collection) borrowTokenListValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("borrowTokenList=").append(urlEncode(borrowTokenListValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("binanceChainId"); + openapiFields.add("defiProtocolId"); + openapiFields.add("protocolName"); + openapiFields.add("protocolLogo"); + openapiFields.add("investmentId"); + openapiFields.add("investmentName"); + openapiFields.add("investType"); + openapiFields.add("investable"); + openapiFields.add("apyBps"); + openapiFields.add("apyDisplay"); + openapiFields.add("apyType"); + openapiFields.add("tvl"); + openapiFields.add("poolAddress"); + openapiFields.add("feeRate"); + openapiFields.add("assetTokenList"); + openapiFields.add("rewardTokenList"); + openapiFields.add("lpTokenList"); + openapiFields.add("borrowTokenList"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DefiInvestmentInfoDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DefiInvestmentInfoDto.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DefiInvestmentInfoDto is not found in" + + " the empty JSON string", + DefiInvestmentInfoDto.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("binanceChainId") != null && !jsonObj.get("binanceChainId").isJsonNull()) + && !jsonObj.get("binanceChainId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `binanceChainId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("binanceChainId").toString())); + } + if ((jsonObj.get("defiProtocolId") != null && !jsonObj.get("defiProtocolId").isJsonNull()) + && !jsonObj.get("defiProtocolId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `defiProtocolId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("defiProtocolId").toString())); + } + if ((jsonObj.get("protocolName") != null && !jsonObj.get("protocolName").isJsonNull()) + && !jsonObj.get("protocolName").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `protocolName` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("protocolName").toString())); + } + if ((jsonObj.get("protocolLogo") != null && !jsonObj.get("protocolLogo").isJsonNull()) + && !jsonObj.get("protocolLogo").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `protocolLogo` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("protocolLogo").toString())); + } + if ((jsonObj.get("investmentId") != null && !jsonObj.get("investmentId").isJsonNull()) + && !jsonObj.get("investmentId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `investmentId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("investmentId").toString())); + } + if ((jsonObj.get("investmentName") != null && !jsonObj.get("investmentName").isJsonNull()) + && !jsonObj.get("investmentName").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `investmentName` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("investmentName").toString())); + } + if ((jsonObj.get("investType") != null && !jsonObj.get("investType").isJsonNull()) + && !jsonObj.get("investType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `investType` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("investType").toString())); + } + if ((jsonObj.get("apyDisplay") != null && !jsonObj.get("apyDisplay").isJsonNull()) + && !jsonObj.get("apyDisplay").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `apyDisplay` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("apyDisplay").toString())); + } + if ((jsonObj.get("apyType") != null && !jsonObj.get("apyType").isJsonNull()) + && !jsonObj.get("apyType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `apyType` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("apyType").toString())); + } + if ((jsonObj.get("tvl") != null && !jsonObj.get("tvl").isJsonNull()) + && !jsonObj.get("tvl").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `tvl` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("tvl").toString())); + } + if ((jsonObj.get("poolAddress") != null && !jsonObj.get("poolAddress").isJsonNull()) + && !jsonObj.get("poolAddress").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `poolAddress` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("poolAddress").toString())); + } + if ((jsonObj.get("feeRate") != null && !jsonObj.get("feeRate").isJsonNull()) + && !jsonObj.get("feeRate").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `feeRate` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("feeRate").toString())); + } + if (jsonObj.get("assetTokenList") != null && !jsonObj.get("assetTokenList").isJsonNull()) { + JsonArray jsonArrayassetTokenList = jsonObj.getAsJsonArray("assetTokenList"); + if (jsonArrayassetTokenList != null) { + // ensure the json data is an array + if (!jsonObj.get("assetTokenList").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `assetTokenList` to be an array in the JSON" + + " string but got `%s`", + jsonObj.get("assetTokenList").toString())); + } + + // validate the optional field `assetTokenList` (array) + for (int i = 0; i < jsonArrayassetTokenList.size(); i++) { + DefiInvestmentInfoDtoAssetTokenListInner.validateJsonElement( + jsonArrayassetTokenList.get(i)); + } + ; + } + } + if (jsonObj.get("rewardTokenList") != null + && !jsonObj.get("rewardTokenList").isJsonNull()) { + JsonArray jsonArrayrewardTokenList = jsonObj.getAsJsonArray("rewardTokenList"); + if (jsonArrayrewardTokenList != null) { + // ensure the json data is an array + if (!jsonObj.get("rewardTokenList").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `rewardTokenList` to be an array in the" + + " JSON string but got `%s`", + jsonObj.get("rewardTokenList").toString())); + } + + // validate the optional field `rewardTokenList` (array) + for (int i = 0; i < jsonArrayrewardTokenList.size(); i++) { + DefiInvestmentInfoDtoAssetTokenListInner.validateJsonElement( + jsonArrayrewardTokenList.get(i)); + } + ; + } + } + if (jsonObj.get("lpTokenList") != null && !jsonObj.get("lpTokenList").isJsonNull()) { + JsonArray jsonArraylpTokenList = jsonObj.getAsJsonArray("lpTokenList"); + if (jsonArraylpTokenList != null) { + // ensure the json data is an array + if (!jsonObj.get("lpTokenList").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `lpTokenList` to be an array in the JSON" + + " string but got `%s`", + jsonObj.get("lpTokenList").toString())); + } + + // validate the optional field `lpTokenList` (array) + for (int i = 0; i < jsonArraylpTokenList.size(); i++) { + DefiInvestmentInfoDtoAssetTokenListInner.validateJsonElement( + jsonArraylpTokenList.get(i)); + } + ; + } + } + if (jsonObj.get("borrowTokenList") != null + && !jsonObj.get("borrowTokenList").isJsonNull()) { + JsonArray jsonArrayborrowTokenList = jsonObj.getAsJsonArray("borrowTokenList"); + if (jsonArrayborrowTokenList != null) { + // ensure the json data is an array + if (!jsonObj.get("borrowTokenList").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `borrowTokenList` to be an array in the" + + " JSON string but got `%s`", + jsonObj.get("borrowTokenList").toString())); + } + + // validate the optional field `borrowTokenList` (array) + for (int i = 0; i < jsonArrayborrowTokenList.size(); i++) { + DefiInvestmentInfoDtoAssetTokenListInner.validateJsonElement( + jsonArrayborrowTokenList.get(i)); + } + ; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DefiInvestmentInfoDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DefiInvestmentInfoDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(DefiInvestmentInfoDto.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DefiInvestmentInfoDto value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DefiInvestmentInfoDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DefiInvestmentInfoDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of DefiInvestmentInfoDto + * @throws IOException if the JSON string is invalid with respect to DefiInvestmentInfoDto + */ + public static DefiInvestmentInfoDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DefiInvestmentInfoDto.class); + } + + /** + * Convert an instance of DefiInvestmentInfoDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiInvestmentInfoDtoAssetTokenListInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiInvestmentInfoDtoAssetTokenListInner.java new file mode 100644 index 0000000..f31719d --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiInvestmentInfoDtoAssetTokenListInner.java @@ -0,0 +1,307 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** Token in an investment product. */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class DefiInvestmentInfoDtoAssetTokenListInner { + public static final String SERIALIZED_NAME_TOKEN_ADDRESS = "tokenAddress"; + + @SerializedName(SERIALIZED_NAME_TOKEN_ADDRESS) + @jakarta.annotation.Nullable + private String tokenAddress; + + public static final String SERIALIZED_NAME_TOKEN_NAME = "tokenName"; + + @SerializedName(SERIALIZED_NAME_TOKEN_NAME) + @jakarta.annotation.Nullable + private String tokenName; + + public static final String SERIALIZED_NAME_TOKEN_SYMBOL = "tokenSymbol"; + + @SerializedName(SERIALIZED_NAME_TOKEN_SYMBOL) + @jakarta.annotation.Nullable + private String tokenSymbol; + + public DefiInvestmentInfoDtoAssetTokenListInner() {} + + public DefiInvestmentInfoDtoAssetTokenListInner tokenAddress( + @jakarta.annotation.Nullable String tokenAddress) { + this.tokenAddress = tokenAddress; + return this; + } + + /** + * Token contract address. The native-asset sentinel for native coins. + * + * @return tokenAddress + */ + @jakarta.annotation.Nullable + public String getTokenAddress() { + return tokenAddress; + } + + public void setTokenAddress(@jakarta.annotation.Nullable String tokenAddress) { + this.tokenAddress = tokenAddress; + } + + public DefiInvestmentInfoDtoAssetTokenListInner tokenName( + @jakarta.annotation.Nullable String tokenName) { + this.tokenName = tokenName; + return this; + } + + /** + * Token name. + * + * @return tokenName + */ + @jakarta.annotation.Nullable + public String getTokenName() { + return tokenName; + } + + public void setTokenName(@jakarta.annotation.Nullable String tokenName) { + this.tokenName = tokenName; + } + + public DefiInvestmentInfoDtoAssetTokenListInner tokenSymbol( + @jakarta.annotation.Nullable String tokenSymbol) { + this.tokenSymbol = tokenSymbol; + return this; + } + + /** + * Token symbol. + * + * @return tokenSymbol + */ + @jakarta.annotation.Nullable + public String getTokenSymbol() { + return tokenSymbol; + } + + public void setTokenSymbol(@jakarta.annotation.Nullable String tokenSymbol) { + this.tokenSymbol = tokenSymbol; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DefiInvestmentInfoDtoAssetTokenListInner defiInvestmentInfoDtoAssetTokenListInner = + (DefiInvestmentInfoDtoAssetTokenListInner) o; + return Objects.equals( + this.tokenAddress, defiInvestmentInfoDtoAssetTokenListInner.tokenAddress) + && Objects.equals( + this.tokenName, defiInvestmentInfoDtoAssetTokenListInner.tokenName) + && Objects.equals( + this.tokenSymbol, defiInvestmentInfoDtoAssetTokenListInner.tokenSymbol); + } + + @Override + public int hashCode() { + return Objects.hash(tokenAddress, tokenName, tokenSymbol); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DefiInvestmentInfoDtoAssetTokenListInner {\n"); + sb.append(" tokenAddress: ").append(toIndentedString(tokenAddress)).append("\n"); + sb.append(" tokenName: ").append(toIndentedString(tokenName)).append("\n"); + sb.append(" tokenSymbol: ").append(toIndentedString(tokenSymbol)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object tokenAddressValue = getTokenAddress(); + String tokenAddressValueAsString = ""; + tokenAddressValueAsString = tokenAddressValue.toString(); + sb.append("tokenAddress=").append(urlEncode(tokenAddressValueAsString)).append(""); + Object tokenNameValue = getTokenName(); + String tokenNameValueAsString = ""; + tokenNameValueAsString = tokenNameValue.toString(); + sb.append("tokenName=").append(urlEncode(tokenNameValueAsString)).append(""); + Object tokenSymbolValue = getTokenSymbol(); + String tokenSymbolValueAsString = ""; + tokenSymbolValueAsString = tokenSymbolValue.toString(); + sb.append("tokenSymbol=").append(urlEncode(tokenSymbolValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("tokenAddress"); + openapiFields.add("tokenName"); + openapiFields.add("tokenSymbol"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * DefiInvestmentInfoDtoAssetTokenListInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DefiInvestmentInfoDtoAssetTokenListInner.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " DefiInvestmentInfoDtoAssetTokenListInner is not found in" + + " the empty JSON string", + DefiInvestmentInfoDtoAssetTokenListInner.openapiRequiredFields + .toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("tokenAddress") != null && !jsonObj.get("tokenAddress").isJsonNull()) + && !jsonObj.get("tokenAddress").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `tokenAddress` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("tokenAddress").toString())); + } + if ((jsonObj.get("tokenName") != null && !jsonObj.get("tokenName").isJsonNull()) + && !jsonObj.get("tokenName").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `tokenName` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("tokenName").toString())); + } + if ((jsonObj.get("tokenSymbol") != null && !jsonObj.get("tokenSymbol").isJsonNull()) + && !jsonObj.get("tokenSymbol").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `tokenSymbol` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("tokenSymbol").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DefiInvestmentInfoDtoAssetTokenListInner.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'DefiInvestmentInfoDtoAssetTokenListInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(DefiInvestmentInfoDtoAssetTokenListInner.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, DefiInvestmentInfoDtoAssetTokenListInner value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DefiInvestmentInfoDtoAssetTokenListInner read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DefiInvestmentInfoDtoAssetTokenListInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of DefiInvestmentInfoDtoAssetTokenListInner + * @throws IOException if the JSON string is invalid with respect to + * DefiInvestmentInfoDtoAssetTokenListInner + */ + public static DefiInvestmentInfoDtoAssetTokenListInner fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, DefiInvestmentInfoDtoAssetTokenListInner.class); + } + + /** + * Convert an instance of DefiInvestmentInfoDtoAssetTokenListInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiInvestmentTokenDto.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiInvestmentTokenDto.java new file mode 100644 index 0000000..7d2ece5 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiInvestmentTokenDto.java @@ -0,0 +1,290 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** Token in an investment product. */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class DefiInvestmentTokenDto { + public static final String SERIALIZED_NAME_TOKEN_ADDRESS = "tokenAddress"; + + @SerializedName(SERIALIZED_NAME_TOKEN_ADDRESS) + @jakarta.annotation.Nullable + private String tokenAddress; + + public static final String SERIALIZED_NAME_TOKEN_NAME = "tokenName"; + + @SerializedName(SERIALIZED_NAME_TOKEN_NAME) + @jakarta.annotation.Nullable + private String tokenName; + + public static final String SERIALIZED_NAME_TOKEN_SYMBOL = "tokenSymbol"; + + @SerializedName(SERIALIZED_NAME_TOKEN_SYMBOL) + @jakarta.annotation.Nullable + private String tokenSymbol; + + public DefiInvestmentTokenDto() {} + + public DefiInvestmentTokenDto tokenAddress(@jakarta.annotation.Nullable String tokenAddress) { + this.tokenAddress = tokenAddress; + return this; + } + + /** + * Token contract address. The native-asset sentinel for native coins. + * + * @return tokenAddress + */ + @jakarta.annotation.Nullable + public String getTokenAddress() { + return tokenAddress; + } + + public void setTokenAddress(@jakarta.annotation.Nullable String tokenAddress) { + this.tokenAddress = tokenAddress; + } + + public DefiInvestmentTokenDto tokenName(@jakarta.annotation.Nullable String tokenName) { + this.tokenName = tokenName; + return this; + } + + /** + * Token name. + * + * @return tokenName + */ + @jakarta.annotation.Nullable + public String getTokenName() { + return tokenName; + } + + public void setTokenName(@jakarta.annotation.Nullable String tokenName) { + this.tokenName = tokenName; + } + + public DefiInvestmentTokenDto tokenSymbol(@jakarta.annotation.Nullable String tokenSymbol) { + this.tokenSymbol = tokenSymbol; + return this; + } + + /** + * Token symbol. + * + * @return tokenSymbol + */ + @jakarta.annotation.Nullable + public String getTokenSymbol() { + return tokenSymbol; + } + + public void setTokenSymbol(@jakarta.annotation.Nullable String tokenSymbol) { + this.tokenSymbol = tokenSymbol; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DefiInvestmentTokenDto defiInvestmentTokenDto = (DefiInvestmentTokenDto) o; + return Objects.equals(this.tokenAddress, defiInvestmentTokenDto.tokenAddress) + && Objects.equals(this.tokenName, defiInvestmentTokenDto.tokenName) + && Objects.equals(this.tokenSymbol, defiInvestmentTokenDto.tokenSymbol); + } + + @Override + public int hashCode() { + return Objects.hash(tokenAddress, tokenName, tokenSymbol); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DefiInvestmentTokenDto {\n"); + sb.append(" tokenAddress: ").append(toIndentedString(tokenAddress)).append("\n"); + sb.append(" tokenName: ").append(toIndentedString(tokenName)).append("\n"); + sb.append(" tokenSymbol: ").append(toIndentedString(tokenSymbol)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object tokenAddressValue = getTokenAddress(); + String tokenAddressValueAsString = ""; + tokenAddressValueAsString = tokenAddressValue.toString(); + sb.append("tokenAddress=").append(urlEncode(tokenAddressValueAsString)).append(""); + Object tokenNameValue = getTokenName(); + String tokenNameValueAsString = ""; + tokenNameValueAsString = tokenNameValue.toString(); + sb.append("tokenName=").append(urlEncode(tokenNameValueAsString)).append(""); + Object tokenSymbolValue = getTokenSymbol(); + String tokenSymbolValueAsString = ""; + tokenSymbolValueAsString = tokenSymbolValue.toString(); + sb.append("tokenSymbol=").append(urlEncode(tokenSymbolValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("tokenAddress"); + openapiFields.add("tokenName"); + openapiFields.add("tokenSymbol"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DefiInvestmentTokenDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DefiInvestmentTokenDto.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DefiInvestmentTokenDto is not found in" + + " the empty JSON string", + DefiInvestmentTokenDto.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("tokenAddress") != null && !jsonObj.get("tokenAddress").isJsonNull()) + && !jsonObj.get("tokenAddress").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `tokenAddress` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("tokenAddress").toString())); + } + if ((jsonObj.get("tokenName") != null && !jsonObj.get("tokenName").isJsonNull()) + && !jsonObj.get("tokenName").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `tokenName` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("tokenName").toString())); + } + if ((jsonObj.get("tokenSymbol") != null && !jsonObj.get("tokenSymbol").isJsonNull()) + && !jsonObj.get("tokenSymbol").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `tokenSymbol` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("tokenSymbol").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DefiInvestmentTokenDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DefiInvestmentTokenDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(DefiInvestmentTokenDto.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DefiInvestmentTokenDto value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DefiInvestmentTokenDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DefiInvestmentTokenDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of DefiInvestmentTokenDto + * @throws IOException if the JSON string is invalid with respect to DefiInvestmentTokenDto + */ + public static DefiInvestmentTokenDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DefiInvestmentTokenDto.class); + } + + /** + * Convert an instance of DefiInvestmentTokenDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiPreview.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiPreview.java new file mode 100644 index 0000000..106d9f1 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiPreview.java @@ -0,0 +1,465 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; +import org.hibernate.validator.constraints.*; + +/** + * Simulation result returned by the build endpoints when `simulate=true`. Includes + * whether the action is expected to succeed, the projected balance change, the estimated network + * fee, and — for lending protocols — the health-factor change. `balanceChange`, + * `feeAndContract`, `healthFactor`, and `warnings` each have a fixed + * structure (see below); the number of entries and some inner values vary by protocol. + */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class DefiPreview { + public static final String SERIALIZED_NAME_SUCCESS = "success"; + + @SerializedName(SERIALIZED_NAME_SUCCESS) + @jakarta.annotation.Nullable + private Boolean success; + + public static final String SERIALIZED_NAME_BALANCE_CHANGE = "balanceChange"; + + @SerializedName(SERIALIZED_NAME_BALANCE_CHANGE) + @jakarta.annotation.Nullable + private List<@Valid DefiPreviewBalanceChangeInner> balanceChange; + + public static final String SERIALIZED_NAME_FEE_AND_CONTRACT = "feeAndContract"; + + @SerializedName(SERIALIZED_NAME_FEE_AND_CONTRACT) + @jakarta.annotation.Nullable + private DefiPreviewFeeAndContract feeAndContract; + + public static final String SERIALIZED_NAME_HEALTH_FACTOR = "healthFactor"; + + @SerializedName(SERIALIZED_NAME_HEALTH_FACTOR) + @jakarta.annotation.Nullable + private DefiPreviewHealthFactor healthFactor; + + public static final String SERIALIZED_NAME_WARNINGS = "warnings"; + + @SerializedName(SERIALIZED_NAME_WARNINGS) + @jakarta.annotation.Nullable + private List<@Valid DefiPreviewWarningsInner> warnings; + + public static final String SERIALIZED_NAME_ERROR_MESSAGE = "errorMessage"; + + @SerializedName(SERIALIZED_NAME_ERROR_MESSAGE) + @jakarta.annotation.Nullable + private String errorMessage; + + public DefiPreview() {} + + public DefiPreview success(@jakarta.annotation.Nullable Boolean success) { + this.success = success; + return this; + } + + /** + * Whether the simulated transaction is expected to succeed on-chain. + * + * @return success + */ + @jakarta.annotation.Nullable + public Boolean getSuccess() { + return success; + } + + public void setSuccess(@jakarta.annotation.Nullable Boolean success) { + this.success = success; + } + + public DefiPreview balanceChange( + @jakarta.annotation.Nullable List<@Valid DefiPreviewBalanceChangeInner> balanceChange) { + this.balanceChange = balanceChange; + return this; + } + + public DefiPreview addBalanceChangeItem(DefiPreviewBalanceChangeInner balanceChangeItem) { + if (this.balanceChange == null) { + this.balanceChange = new ArrayList<>(); + } + this.balanceChange.add(balanceChangeItem); + return this; + } + + /** + * Signed token balance deltas from the simulation. Each entry has `tokenType`, + * `tokenSymbol`, `tokenAddress`, `tokenDecimals`, + * `amount` (positive = received, negative = spent), `valueUsd`, + * and an optional `tokenId`. + * + * @return balanceChange + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid DefiPreviewBalanceChangeInner> getBalanceChange() { + return balanceChange; + } + + public void setBalanceChange( + @jakarta.annotation.Nullable List<@Valid DefiPreviewBalanceChangeInner> balanceChange) { + this.balanceChange = balanceChange; + } + + public DefiPreview feeAndContract( + @jakarta.annotation.Nullable DefiPreviewFeeAndContract feeAndContract) { + this.feeAndContract = feeAndContract; + return this; + } + + /** + * Get feeAndContract + * + * @return feeAndContract + */ + @jakarta.annotation.Nullable + @Valid + public DefiPreviewFeeAndContract getFeeAndContract() { + return feeAndContract; + } + + public void setFeeAndContract( + @jakarta.annotation.Nullable DefiPreviewFeeAndContract feeAndContract) { + this.feeAndContract = feeAndContract; + } + + public DefiPreview healthFactor( + @jakarta.annotation.Nullable DefiPreviewHealthFactor healthFactor) { + this.healthFactor = healthFactor; + return this; + } + + /** + * Get healthFactor + * + * @return healthFactor + */ + @jakarta.annotation.Nullable + @Valid + public DefiPreviewHealthFactor getHealthFactor() { + return healthFactor; + } + + public void setHealthFactor(@jakarta.annotation.Nullable DefiPreviewHealthFactor healthFactor) { + this.healthFactor = healthFactor; + } + + public DefiPreview warnings( + @jakarta.annotation.Nullable List<@Valid DefiPreviewWarningsInner> warnings) { + this.warnings = warnings; + return this; + } + + public DefiPreview addWarningsItem(DefiPreviewWarningsInner warningsItem) { + if (this.warnings == null) { + this.warnings = new ArrayList<>(); + } + this.warnings.add(warningsItem); + return this; + } + + /** + * Non-blocking risk warnings. Empty array when there are no warnings. + * + * @return warnings + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid DefiPreviewWarningsInner> getWarnings() { + return warnings; + } + + public void setWarnings( + @jakarta.annotation.Nullable List<@Valid DefiPreviewWarningsInner> warnings) { + this.warnings = warnings; + } + + public DefiPreview errorMessage(@jakarta.annotation.Nullable String errorMessage) { + this.errorMessage = errorMessage; + return this; + } + + /** + * Error message when the simulated transaction is expected to fail. + * + * @return errorMessage + */ + @jakarta.annotation.Nullable + public String getErrorMessage() { + return errorMessage; + } + + public void setErrorMessage(@jakarta.annotation.Nullable String errorMessage) { + this.errorMessage = errorMessage; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DefiPreview defiPreview = (DefiPreview) o; + return Objects.equals(this.success, defiPreview.success) + && Objects.equals(this.balanceChange, defiPreview.balanceChange) + && Objects.equals(this.feeAndContract, defiPreview.feeAndContract) + && Objects.equals(this.healthFactor, defiPreview.healthFactor) + && Objects.equals(this.warnings, defiPreview.warnings) + && Objects.equals(this.errorMessage, defiPreview.errorMessage); + } + + @Override + public int hashCode() { + return Objects.hash( + success, balanceChange, feeAndContract, healthFactor, warnings, errorMessage); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DefiPreview {\n"); + sb.append(" success: ").append(toIndentedString(success)).append("\n"); + sb.append(" balanceChange: ").append(toIndentedString(balanceChange)).append("\n"); + sb.append(" feeAndContract: ").append(toIndentedString(feeAndContract)).append("\n"); + sb.append(" healthFactor: ").append(toIndentedString(healthFactor)).append("\n"); + sb.append(" warnings: ").append(toIndentedString(warnings)).append("\n"); + sb.append(" errorMessage: ").append(toIndentedString(errorMessage)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object successValue = getSuccess(); + String successValueAsString = ""; + successValueAsString = successValue.toString(); + sb.append("success=").append(urlEncode(successValueAsString)).append(""); + Object balanceChangeValue = getBalanceChange(); + String balanceChangeValueAsString = ""; + balanceChangeValueAsString = + (String) + ((Collection) balanceChangeValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("balanceChange=").append(urlEncode(balanceChangeValueAsString)).append(""); + Object feeAndContractValue = getFeeAndContract(); + String feeAndContractValueAsString = ""; + feeAndContractValueAsString = feeAndContractValue.toString(); + sb.append("feeAndContract=").append(urlEncode(feeAndContractValueAsString)).append(""); + Object healthFactorValue = getHealthFactor(); + String healthFactorValueAsString = ""; + healthFactorValueAsString = healthFactorValue.toString(); + sb.append("healthFactor=").append(urlEncode(healthFactorValueAsString)).append(""); + Object warningsValue = getWarnings(); + String warningsValueAsString = ""; + warningsValueAsString = + (String) + ((Collection) warningsValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("warnings=").append(urlEncode(warningsValueAsString)).append(""); + Object errorMessageValue = getErrorMessage(); + String errorMessageValueAsString = ""; + errorMessageValueAsString = errorMessageValue.toString(); + sb.append("errorMessage=").append(urlEncode(errorMessageValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("success"); + openapiFields.add("balanceChange"); + openapiFields.add("feeAndContract"); + openapiFields.add("healthFactor"); + openapiFields.add("warnings"); + openapiFields.add("errorMessage"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DefiPreview + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DefiPreview.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DefiPreview is not found in the empty" + + " JSON string", + DefiPreview.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("balanceChange") != null && !jsonObj.get("balanceChange").isJsonNull()) { + JsonArray jsonArraybalanceChange = jsonObj.getAsJsonArray("balanceChange"); + if (jsonArraybalanceChange != null) { + // ensure the json data is an array + if (!jsonObj.get("balanceChange").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `balanceChange` to be an array in the JSON" + + " string but got `%s`", + jsonObj.get("balanceChange").toString())); + } + + // validate the optional field `balanceChange` (array) + for (int i = 0; i < jsonArraybalanceChange.size(); i++) { + DefiPreviewBalanceChangeInner.validateJsonElement( + jsonArraybalanceChange.get(i)); + } + ; + } + } + // validate the optional field `feeAndContract` + if (jsonObj.get("feeAndContract") != null && !jsonObj.get("feeAndContract").isJsonNull()) { + DefiPreviewFeeAndContract.validateJsonElement(jsonObj.get("feeAndContract")); + } + // validate the optional field `healthFactor` + if (jsonObj.get("healthFactor") != null && !jsonObj.get("healthFactor").isJsonNull()) { + DefiPreviewHealthFactor.validateJsonElement(jsonObj.get("healthFactor")); + } + if (jsonObj.get("warnings") != null && !jsonObj.get("warnings").isJsonNull()) { + JsonArray jsonArraywarnings = jsonObj.getAsJsonArray("warnings"); + if (jsonArraywarnings != null) { + // ensure the json data is an array + if (!jsonObj.get("warnings").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `warnings` to be an array in the JSON" + + " string but got `%s`", + jsonObj.get("warnings").toString())); + } + + // validate the optional field `warnings` (array) + for (int i = 0; i < jsonArraywarnings.size(); i++) { + DefiPreviewWarningsInner.validateJsonElement(jsonArraywarnings.get(i)); + } + ; + } + } + if ((jsonObj.get("errorMessage") != null && !jsonObj.get("errorMessage").isJsonNull()) + && !jsonObj.get("errorMessage").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `errorMessage` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("errorMessage").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DefiPreview.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DefiPreview' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(DefiPreview.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DefiPreview value) throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DefiPreview read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DefiPreview given an JSON string + * + * @param jsonString JSON string + * @return An instance of DefiPreview + * @throws IOException if the JSON string is invalid with respect to DefiPreview + */ + public static DefiPreview fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DefiPreview.class); + } + + /** + * Convert an instance of DefiPreview to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiPreviewBalanceChangeInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiPreviewBalanceChangeInner.java new file mode 100644 index 0000000..532bcf5 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiPreviewBalanceChangeInner.java @@ -0,0 +1,460 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** DefiPreviewBalanceChangeInner */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class DefiPreviewBalanceChangeInner { + public static final String SERIALIZED_NAME_TOKEN_TYPE = "tokenType"; + + @SerializedName(SERIALIZED_NAME_TOKEN_TYPE) + @jakarta.annotation.Nullable + private String tokenType; + + public static final String SERIALIZED_NAME_TOKEN_SYMBOL = "tokenSymbol"; + + @SerializedName(SERIALIZED_NAME_TOKEN_SYMBOL) + @jakarta.annotation.Nullable + private String tokenSymbol; + + public static final String SERIALIZED_NAME_TOKEN_ADDRESS = "tokenAddress"; + + @SerializedName(SERIALIZED_NAME_TOKEN_ADDRESS) + @jakarta.annotation.Nullable + private String tokenAddress; + + public static final String SERIALIZED_NAME_TOKEN_DECIMALS = "tokenDecimals"; + + @SerializedName(SERIALIZED_NAME_TOKEN_DECIMALS) + @jakarta.annotation.Nullable + private String tokenDecimals; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + + @SerializedName(SERIALIZED_NAME_AMOUNT) + @jakarta.annotation.Nullable + private String amount; + + public static final String SERIALIZED_NAME_VALUE_USD = "valueUsd"; + + @SerializedName(SERIALIZED_NAME_VALUE_USD) + @jakarta.annotation.Nullable + private String valueUsd; + + public static final String SERIALIZED_NAME_TOKEN_ID = "tokenId"; + + @SerializedName(SERIALIZED_NAME_TOKEN_ID) + @jakarta.annotation.Nullable + private String tokenId; + + public DefiPreviewBalanceChangeInner() {} + + public DefiPreviewBalanceChangeInner tokenType(@jakarta.annotation.Nullable String tokenType) { + this.tokenType = tokenType; + return this; + } + + /** + * Token role / type tag from the simulation. + * + * @return tokenType + */ + @jakarta.annotation.Nullable + public String getTokenType() { + return tokenType; + } + + public void setTokenType(@jakarta.annotation.Nullable String tokenType) { + this.tokenType = tokenType; + } + + public DefiPreviewBalanceChangeInner tokenSymbol( + @jakarta.annotation.Nullable String tokenSymbol) { + this.tokenSymbol = tokenSymbol; + return this; + } + + /** + * Token symbol. + * + * @return tokenSymbol + */ + @jakarta.annotation.Nullable + public String getTokenSymbol() { + return tokenSymbol; + } + + public void setTokenSymbol(@jakarta.annotation.Nullable String tokenSymbol) { + this.tokenSymbol = tokenSymbol; + } + + public DefiPreviewBalanceChangeInner tokenAddress( + @jakarta.annotation.Nullable String tokenAddress) { + this.tokenAddress = tokenAddress; + return this; + } + + /** + * Token contract address. + * + * @return tokenAddress + */ + @jakarta.annotation.Nullable + public String getTokenAddress() { + return tokenAddress; + } + + public void setTokenAddress(@jakarta.annotation.Nullable String tokenAddress) { + this.tokenAddress = tokenAddress; + } + + public DefiPreviewBalanceChangeInner tokenDecimals( + @jakarta.annotation.Nullable String tokenDecimals) { + this.tokenDecimals = tokenDecimals; + return this; + } + + /** + * Token decimals. + * + * @return tokenDecimals + */ + @jakarta.annotation.Nullable + public String getTokenDecimals() { + return tokenDecimals; + } + + public void setTokenDecimals(@jakarta.annotation.Nullable String tokenDecimals) { + this.tokenDecimals = tokenDecimals; + } + + public DefiPreviewBalanceChangeInner amount(@jakarta.annotation.Nullable String amount) { + this.amount = amount; + return this; + } + + /** + * Signed delta (positive = received, negative = spent). + * + * @return amount + */ + @jakarta.annotation.Nullable + public String getAmount() { + return amount; + } + + public void setAmount(@jakarta.annotation.Nullable String amount) { + this.amount = amount; + } + + public DefiPreviewBalanceChangeInner valueUsd(@jakarta.annotation.Nullable String valueUsd) { + this.valueUsd = valueUsd; + return this; + } + + /** + * USD value of the delta. + * + * @return valueUsd + */ + @jakarta.annotation.Nullable + public String getValueUsd() { + return valueUsd; + } + + public void setValueUsd(@jakarta.annotation.Nullable String valueUsd) { + this.valueUsd = valueUsd; + } + + public DefiPreviewBalanceChangeInner tokenId(@jakarta.annotation.Nullable String tokenId) { + this.tokenId = tokenId; + return this; + } + + /** + * Optional NFT / position token ID when applicable. + * + * @return tokenId + */ + @jakarta.annotation.Nullable + public String getTokenId() { + return tokenId; + } + + public void setTokenId(@jakarta.annotation.Nullable String tokenId) { + this.tokenId = tokenId; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DefiPreviewBalanceChangeInner defiPreviewBalanceChangeInner = + (DefiPreviewBalanceChangeInner) o; + return Objects.equals(this.tokenType, defiPreviewBalanceChangeInner.tokenType) + && Objects.equals(this.tokenSymbol, defiPreviewBalanceChangeInner.tokenSymbol) + && Objects.equals(this.tokenAddress, defiPreviewBalanceChangeInner.tokenAddress) + && Objects.equals(this.tokenDecimals, defiPreviewBalanceChangeInner.tokenDecimals) + && Objects.equals(this.amount, defiPreviewBalanceChangeInner.amount) + && Objects.equals(this.valueUsd, defiPreviewBalanceChangeInner.valueUsd) + && Objects.equals(this.tokenId, defiPreviewBalanceChangeInner.tokenId); + } + + @Override + public int hashCode() { + return Objects.hash( + tokenType, tokenSymbol, tokenAddress, tokenDecimals, amount, valueUsd, tokenId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DefiPreviewBalanceChangeInner {\n"); + sb.append(" tokenType: ").append(toIndentedString(tokenType)).append("\n"); + sb.append(" tokenSymbol: ").append(toIndentedString(tokenSymbol)).append("\n"); + sb.append(" tokenAddress: ").append(toIndentedString(tokenAddress)).append("\n"); + sb.append(" tokenDecimals: ").append(toIndentedString(tokenDecimals)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" valueUsd: ").append(toIndentedString(valueUsd)).append("\n"); + sb.append(" tokenId: ").append(toIndentedString(tokenId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object tokenTypeValue = getTokenType(); + String tokenTypeValueAsString = ""; + tokenTypeValueAsString = tokenTypeValue.toString(); + sb.append("tokenType=").append(urlEncode(tokenTypeValueAsString)).append(""); + Object tokenSymbolValue = getTokenSymbol(); + String tokenSymbolValueAsString = ""; + tokenSymbolValueAsString = tokenSymbolValue.toString(); + sb.append("tokenSymbol=").append(urlEncode(tokenSymbolValueAsString)).append(""); + Object tokenAddressValue = getTokenAddress(); + String tokenAddressValueAsString = ""; + tokenAddressValueAsString = tokenAddressValue.toString(); + sb.append("tokenAddress=").append(urlEncode(tokenAddressValueAsString)).append(""); + Object tokenDecimalsValue = getTokenDecimals(); + String tokenDecimalsValueAsString = ""; + tokenDecimalsValueAsString = tokenDecimalsValue.toString(); + sb.append("tokenDecimals=").append(urlEncode(tokenDecimalsValueAsString)).append(""); + Object amountValue = getAmount(); + String amountValueAsString = ""; + amountValueAsString = amountValue.toString(); + sb.append("amount=").append(urlEncode(amountValueAsString)).append(""); + Object valueUsdValue = getValueUsd(); + String valueUsdValueAsString = ""; + valueUsdValueAsString = valueUsdValue.toString(); + sb.append("valueUsd=").append(urlEncode(valueUsdValueAsString)).append(""); + Object tokenIdValue = getTokenId(); + String tokenIdValueAsString = ""; + tokenIdValueAsString = tokenIdValue.toString(); + sb.append("tokenId=").append(urlEncode(tokenIdValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("tokenType"); + openapiFields.add("tokenSymbol"); + openapiFields.add("tokenAddress"); + openapiFields.add("tokenDecimals"); + openapiFields.add("amount"); + openapiFields.add("valueUsd"); + openapiFields.add("tokenId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * DefiPreviewBalanceChangeInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DefiPreviewBalanceChangeInner.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DefiPreviewBalanceChangeInner is not" + + " found in the empty JSON string", + DefiPreviewBalanceChangeInner.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("tokenType") != null && !jsonObj.get("tokenType").isJsonNull()) + && !jsonObj.get("tokenType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `tokenType` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("tokenType").toString())); + } + if ((jsonObj.get("tokenSymbol") != null && !jsonObj.get("tokenSymbol").isJsonNull()) + && !jsonObj.get("tokenSymbol").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `tokenSymbol` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("tokenSymbol").toString())); + } + if ((jsonObj.get("tokenAddress") != null && !jsonObj.get("tokenAddress").isJsonNull()) + && !jsonObj.get("tokenAddress").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `tokenAddress` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("tokenAddress").toString())); + } + if ((jsonObj.get("tokenDecimals") != null && !jsonObj.get("tokenDecimals").isJsonNull()) + && !jsonObj.get("tokenDecimals").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `tokenDecimals` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("tokenDecimals").toString())); + } + if ((jsonObj.get("amount") != null && !jsonObj.get("amount").isJsonNull()) + && !jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `amount` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("amount").toString())); + } + if ((jsonObj.get("valueUsd") != null && !jsonObj.get("valueUsd").isJsonNull()) + && !jsonObj.get("valueUsd").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `valueUsd` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("valueUsd").toString())); + } + if ((jsonObj.get("tokenId") != null && !jsonObj.get("tokenId").isJsonNull()) + && !jsonObj.get("tokenId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `tokenId` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("tokenId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DefiPreviewBalanceChangeInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DefiPreviewBalanceChangeInner' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(DefiPreviewBalanceChangeInner.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DefiPreviewBalanceChangeInner value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DefiPreviewBalanceChangeInner read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DefiPreviewBalanceChangeInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of DefiPreviewBalanceChangeInner + * @throws IOException if the JSON string is invalid with respect to + * DefiPreviewBalanceChangeInner + */ + public static DefiPreviewBalanceChangeInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DefiPreviewBalanceChangeInner.class); + } + + /** + * Convert an instance of DefiPreviewBalanceChangeInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiPreviewFeeAndContract.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiPreviewFeeAndContract.java new file mode 100644 index 0000000..4d52c46 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiPreviewFeeAndContract.java @@ -0,0 +1,262 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** + * Estimated network fee and the contract the action interacts with. Contains + * `estimatedNetworkFee` and `interactWith`. + */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class DefiPreviewFeeAndContract { + public static final String SERIALIZED_NAME_ESTIMATED_NETWORK_FEE = "estimatedNetworkFee"; + + @SerializedName(SERIALIZED_NAME_ESTIMATED_NETWORK_FEE) + @jakarta.annotation.Nullable + private DefiPreviewFeeAndContractEstimatedNetworkFee estimatedNetworkFee; + + public static final String SERIALIZED_NAME_INTERACT_WITH = "interactWith"; + + @SerializedName(SERIALIZED_NAME_INTERACT_WITH) + @jakarta.annotation.Nullable + private DefiPreviewFeeAndContractInteractWith interactWith; + + public DefiPreviewFeeAndContract() {} + + public DefiPreviewFeeAndContract estimatedNetworkFee( + @jakarta.annotation.Nullable + DefiPreviewFeeAndContractEstimatedNetworkFee estimatedNetworkFee) { + this.estimatedNetworkFee = estimatedNetworkFee; + return this; + } + + /** + * Get estimatedNetworkFee + * + * @return estimatedNetworkFee + */ + @jakarta.annotation.Nullable + @Valid + public DefiPreviewFeeAndContractEstimatedNetworkFee getEstimatedNetworkFee() { + return estimatedNetworkFee; + } + + public void setEstimatedNetworkFee( + @jakarta.annotation.Nullable + DefiPreviewFeeAndContractEstimatedNetworkFee estimatedNetworkFee) { + this.estimatedNetworkFee = estimatedNetworkFee; + } + + public DefiPreviewFeeAndContract interactWith( + @jakarta.annotation.Nullable DefiPreviewFeeAndContractInteractWith interactWith) { + this.interactWith = interactWith; + return this; + } + + /** + * Get interactWith + * + * @return interactWith + */ + @jakarta.annotation.Nullable + @Valid + public DefiPreviewFeeAndContractInteractWith getInteractWith() { + return interactWith; + } + + public void setInteractWith( + @jakarta.annotation.Nullable DefiPreviewFeeAndContractInteractWith interactWith) { + this.interactWith = interactWith; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DefiPreviewFeeAndContract defiPreviewFeeAndContract = (DefiPreviewFeeAndContract) o; + return Objects.equals( + this.estimatedNetworkFee, defiPreviewFeeAndContract.estimatedNetworkFee) + && Objects.equals(this.interactWith, defiPreviewFeeAndContract.interactWith); + } + + @Override + public int hashCode() { + return Objects.hash(estimatedNetworkFee, interactWith); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DefiPreviewFeeAndContract {\n"); + sb.append(" estimatedNetworkFee: ") + .append(toIndentedString(estimatedNetworkFee)) + .append("\n"); + sb.append(" interactWith: ").append(toIndentedString(interactWith)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object estimatedNetworkFeeValue = getEstimatedNetworkFee(); + String estimatedNetworkFeeValueAsString = ""; + estimatedNetworkFeeValueAsString = estimatedNetworkFeeValue.toString(); + sb.append("estimatedNetworkFee=") + .append(urlEncode(estimatedNetworkFeeValueAsString)) + .append(""); + Object interactWithValue = getInteractWith(); + String interactWithValueAsString = ""; + interactWithValueAsString = interactWithValue.toString(); + sb.append("interactWith=").append(urlEncode(interactWithValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("estimatedNetworkFee"); + openapiFields.add("interactWith"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DefiPreviewFeeAndContract + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DefiPreviewFeeAndContract.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DefiPreviewFeeAndContract is not found" + + " in the empty JSON string", + DefiPreviewFeeAndContract.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `estimatedNetworkFee` + if (jsonObj.get("estimatedNetworkFee") != null + && !jsonObj.get("estimatedNetworkFee").isJsonNull()) { + DefiPreviewFeeAndContractEstimatedNetworkFee.validateJsonElement( + jsonObj.get("estimatedNetworkFee")); + } + // validate the optional field `interactWith` + if (jsonObj.get("interactWith") != null && !jsonObj.get("interactWith").isJsonNull()) { + DefiPreviewFeeAndContractInteractWith.validateJsonElement(jsonObj.get("interactWith")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DefiPreviewFeeAndContract.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DefiPreviewFeeAndContract' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(DefiPreviewFeeAndContract.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DefiPreviewFeeAndContract value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DefiPreviewFeeAndContract read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DefiPreviewFeeAndContract given an JSON string + * + * @param jsonString JSON string + * @return An instance of DefiPreviewFeeAndContract + * @throws IOException if the JSON string is invalid with respect to DefiPreviewFeeAndContract + */ + public static DefiPreviewFeeAndContract fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DefiPreviewFeeAndContract.class); + } + + /** + * Convert an instance of DefiPreviewFeeAndContract to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiPreviewFeeAndContractEstimatedNetworkFee.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiPreviewFeeAndContractEstimatedNetworkFee.java new file mode 100644 index 0000000..12c200a --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiPreviewFeeAndContractEstimatedNetworkFee.java @@ -0,0 +1,462 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** + * Estimated gas cost for the action. Fields may be `null` when estimation is not + * available (e.g. a failed simulation). + */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class DefiPreviewFeeAndContractEstimatedNetworkFee { + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + + @SerializedName(SERIALIZED_NAME_AMOUNT) + @jakarta.annotation.Nullable + private String amount; + + public static final String SERIALIZED_NAME_TOKEN_SYMBOL = "tokenSymbol"; + + @SerializedName(SERIALIZED_NAME_TOKEN_SYMBOL) + @jakarta.annotation.Nullable + private String tokenSymbol; + + public static final String SERIALIZED_NAME_VALUE_USD = "valueUsd"; + + @SerializedName(SERIALIZED_NAME_VALUE_USD) + @jakarta.annotation.Nullable + private String valueUsd; + + public static final String SERIALIZED_NAME_RENT_FEE_AMOUNT = "rentFeeAmount"; + + @SerializedName(SERIALIZED_NAME_RENT_FEE_AMOUNT) + @jakarta.annotation.Nullable + private String rentFeeAmount; + + public static final String SERIALIZED_NAME_RENT_FEE_VALUE_USD = "rentFeeValueUsd"; + + @SerializedName(SERIALIZED_NAME_RENT_FEE_VALUE_USD) + @jakarta.annotation.Nullable + private String rentFeeValueUsd; + + public static final String SERIALIZED_NAME_PRIORITY_FEE_AMOUNT = "priorityFeeAmount"; + + @SerializedName(SERIALIZED_NAME_PRIORITY_FEE_AMOUNT) + @jakarta.annotation.Nullable + private String priorityFeeAmount; + + public DefiPreviewFeeAndContractEstimatedNetworkFee() {} + + public DefiPreviewFeeAndContractEstimatedNetworkFee amount( + @jakarta.annotation.Nullable String amount) { + this.amount = amount; + return this; + } + + /** + * Estimated gas fee in the gas-paying token (human-readable). + * + * @return amount + */ + @jakarta.annotation.Nullable + public String getAmount() { + return amount; + } + + public void setAmount(@jakarta.annotation.Nullable String amount) { + this.amount = amount; + } + + public DefiPreviewFeeAndContractEstimatedNetworkFee tokenSymbol( + @jakarta.annotation.Nullable String tokenSymbol) { + this.tokenSymbol = tokenSymbol; + return this; + } + + /** + * Symbol of the fee-paying token (native coin, e.g. BNB). + * + * @return tokenSymbol + */ + @jakarta.annotation.Nullable + public String getTokenSymbol() { + return tokenSymbol; + } + + public void setTokenSymbol(@jakarta.annotation.Nullable String tokenSymbol) { + this.tokenSymbol = tokenSymbol; + } + + public DefiPreviewFeeAndContractEstimatedNetworkFee valueUsd( + @jakarta.annotation.Nullable String valueUsd) { + this.valueUsd = valueUsd; + return this; + } + + /** + * USD value of the estimated fee. + * + * @return valueUsd + */ + @jakarta.annotation.Nullable + public String getValueUsd() { + return valueUsd; + } + + public void setValueUsd(@jakarta.annotation.Nullable String valueUsd) { + this.valueUsd = valueUsd; + } + + public DefiPreviewFeeAndContractEstimatedNetworkFee rentFeeAmount( + @jakarta.annotation.Nullable String rentFeeAmount) { + this.rentFeeAmount = rentFeeAmount; + return this; + } + + /** + * Storage / rent fee portion (human-readable), if applicable. + * + * @return rentFeeAmount + */ + @jakarta.annotation.Nullable + public String getRentFeeAmount() { + return rentFeeAmount; + } + + public void setRentFeeAmount(@jakarta.annotation.Nullable String rentFeeAmount) { + this.rentFeeAmount = rentFeeAmount; + } + + public DefiPreviewFeeAndContractEstimatedNetworkFee rentFeeValueUsd( + @jakarta.annotation.Nullable String rentFeeValueUsd) { + this.rentFeeValueUsd = rentFeeValueUsd; + return this; + } + + /** + * USD value of the storage / rent fee, if applicable. + * + * @return rentFeeValueUsd + */ + @jakarta.annotation.Nullable + public String getRentFeeValueUsd() { + return rentFeeValueUsd; + } + + public void setRentFeeValueUsd(@jakarta.annotation.Nullable String rentFeeValueUsd) { + this.rentFeeValueUsd = rentFeeValueUsd; + } + + public DefiPreviewFeeAndContractEstimatedNetworkFee priorityFeeAmount( + @jakarta.annotation.Nullable String priorityFeeAmount) { + this.priorityFeeAmount = priorityFeeAmount; + return this; + } + + /** + * Priority fee portion (human-readable), if broken out. + * + * @return priorityFeeAmount + */ + @jakarta.annotation.Nullable + public String getPriorityFeeAmount() { + return priorityFeeAmount; + } + + public void setPriorityFeeAmount(@jakarta.annotation.Nullable String priorityFeeAmount) { + this.priorityFeeAmount = priorityFeeAmount; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DefiPreviewFeeAndContractEstimatedNetworkFee defiPreviewFeeAndContractEstimatedNetworkFee = + (DefiPreviewFeeAndContractEstimatedNetworkFee) o; + return Objects.equals(this.amount, defiPreviewFeeAndContractEstimatedNetworkFee.amount) + && Objects.equals( + this.tokenSymbol, defiPreviewFeeAndContractEstimatedNetworkFee.tokenSymbol) + && Objects.equals( + this.valueUsd, defiPreviewFeeAndContractEstimatedNetworkFee.valueUsd) + && Objects.equals( + this.rentFeeAmount, + defiPreviewFeeAndContractEstimatedNetworkFee.rentFeeAmount) + && Objects.equals( + this.rentFeeValueUsd, + defiPreviewFeeAndContractEstimatedNetworkFee.rentFeeValueUsd) + && Objects.equals( + this.priorityFeeAmount, + defiPreviewFeeAndContractEstimatedNetworkFee.priorityFeeAmount); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash( + amount, tokenSymbol, valueUsd, rentFeeAmount, rentFeeValueUsd, priorityFeeAmount); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DefiPreviewFeeAndContractEstimatedNetworkFee {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" tokenSymbol: ").append(toIndentedString(tokenSymbol)).append("\n"); + sb.append(" valueUsd: ").append(toIndentedString(valueUsd)).append("\n"); + sb.append(" rentFeeAmount: ").append(toIndentedString(rentFeeAmount)).append("\n"); + sb.append(" rentFeeValueUsd: ").append(toIndentedString(rentFeeValueUsd)).append("\n"); + sb.append(" priorityFeeAmount: ").append(toIndentedString(priorityFeeAmount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object amountValue = getAmount(); + String amountValueAsString = ""; + amountValueAsString = amountValue.toString(); + sb.append("amount=").append(urlEncode(amountValueAsString)).append(""); + Object tokenSymbolValue = getTokenSymbol(); + String tokenSymbolValueAsString = ""; + tokenSymbolValueAsString = tokenSymbolValue.toString(); + sb.append("tokenSymbol=").append(urlEncode(tokenSymbolValueAsString)).append(""); + Object valueUsdValue = getValueUsd(); + String valueUsdValueAsString = ""; + valueUsdValueAsString = valueUsdValue.toString(); + sb.append("valueUsd=").append(urlEncode(valueUsdValueAsString)).append(""); + Object rentFeeAmountValue = getRentFeeAmount(); + String rentFeeAmountValueAsString = ""; + rentFeeAmountValueAsString = rentFeeAmountValue.toString(); + sb.append("rentFeeAmount=").append(urlEncode(rentFeeAmountValueAsString)).append(""); + Object rentFeeValueUsdValue = getRentFeeValueUsd(); + String rentFeeValueUsdValueAsString = ""; + rentFeeValueUsdValueAsString = rentFeeValueUsdValue.toString(); + sb.append("rentFeeValueUsd=").append(urlEncode(rentFeeValueUsdValueAsString)).append(""); + Object priorityFeeAmountValue = getPriorityFeeAmount(); + String priorityFeeAmountValueAsString = ""; + priorityFeeAmountValueAsString = priorityFeeAmountValue.toString(); + sb.append("priorityFeeAmount=") + .append(urlEncode(priorityFeeAmountValueAsString)) + .append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("amount"); + openapiFields.add("tokenSymbol"); + openapiFields.add("valueUsd"); + openapiFields.add("rentFeeAmount"); + openapiFields.add("rentFeeValueUsd"); + openapiFields.add("priorityFeeAmount"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * DefiPreviewFeeAndContractEstimatedNetworkFee + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DefiPreviewFeeAndContractEstimatedNetworkFee.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " DefiPreviewFeeAndContractEstimatedNetworkFee is not found" + + " in the empty JSON string", + DefiPreviewFeeAndContractEstimatedNetworkFee.openapiRequiredFields + .toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("amount") != null && !jsonObj.get("amount").isJsonNull()) + && !jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `amount` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("amount").toString())); + } + if ((jsonObj.get("tokenSymbol") != null && !jsonObj.get("tokenSymbol").isJsonNull()) + && !jsonObj.get("tokenSymbol").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `tokenSymbol` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("tokenSymbol").toString())); + } + if ((jsonObj.get("valueUsd") != null && !jsonObj.get("valueUsd").isJsonNull()) + && !jsonObj.get("valueUsd").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `valueUsd` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("valueUsd").toString())); + } + if ((jsonObj.get("rentFeeAmount") != null && !jsonObj.get("rentFeeAmount").isJsonNull()) + && !jsonObj.get("rentFeeAmount").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `rentFeeAmount` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("rentFeeAmount").toString())); + } + if ((jsonObj.get("rentFeeValueUsd") != null && !jsonObj.get("rentFeeValueUsd").isJsonNull()) + && !jsonObj.get("rentFeeValueUsd").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `rentFeeValueUsd` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("rentFeeValueUsd").toString())); + } + if ((jsonObj.get("priorityFeeAmount") != null + && !jsonObj.get("priorityFeeAmount").isJsonNull()) + && !jsonObj.get("priorityFeeAmount").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `priorityFeeAmount` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("priorityFeeAmount").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DefiPreviewFeeAndContractEstimatedNetworkFee.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'DefiPreviewFeeAndContractEstimatedNetworkFee' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, + TypeToken.get(DefiPreviewFeeAndContractEstimatedNetworkFee.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, DefiPreviewFeeAndContractEstimatedNetworkFee value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DefiPreviewFeeAndContractEstimatedNetworkFee read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DefiPreviewFeeAndContractEstimatedNetworkFee given an JSON string + * + * @param jsonString JSON string + * @return An instance of DefiPreviewFeeAndContractEstimatedNetworkFee + * @throws IOException if the JSON string is invalid with respect to + * DefiPreviewFeeAndContractEstimatedNetworkFee + */ + public static DefiPreviewFeeAndContractEstimatedNetworkFee fromJson(String jsonString) + throws IOException { + return JSON.getGson() + .fromJson(jsonString, DefiPreviewFeeAndContractEstimatedNetworkFee.class); + } + + /** + * Convert an instance of DefiPreviewFeeAndContractEstimatedNetworkFee to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiPreviewFeeAndContractInteractWith.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiPreviewFeeAndContractInteractWith.java new file mode 100644 index 0000000..0c05eae --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiPreviewFeeAndContractInteractWith.java @@ -0,0 +1,220 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** The contract the action interacts with. */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class DefiPreviewFeeAndContractInteractWith { + public static final String SERIALIZED_NAME_ADDRESS = "address"; + + @SerializedName(SERIALIZED_NAME_ADDRESS) + @jakarta.annotation.Nullable + private String address; + + public DefiPreviewFeeAndContractInteractWith() {} + + public DefiPreviewFeeAndContractInteractWith address( + @jakarta.annotation.Nullable String address) { + this.address = address; + return this; + } + + /** + * Target contract address. + * + * @return address + */ + @jakarta.annotation.Nullable + public String getAddress() { + return address; + } + + public void setAddress(@jakarta.annotation.Nullable String address) { + this.address = address; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DefiPreviewFeeAndContractInteractWith defiPreviewFeeAndContractInteractWith = + (DefiPreviewFeeAndContractInteractWith) o; + return Objects.equals(this.address, defiPreviewFeeAndContractInteractWith.address); + } + + @Override + public int hashCode() { + return Objects.hash(address); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DefiPreviewFeeAndContractInteractWith {\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object addressValue = getAddress(); + String addressValueAsString = ""; + addressValueAsString = addressValue.toString(); + sb.append("address=").append(urlEncode(addressValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("address"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * DefiPreviewFeeAndContractInteractWith + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DefiPreviewFeeAndContractInteractWith.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DefiPreviewFeeAndContractInteractWith" + + " is not found in the empty JSON string", + DefiPreviewFeeAndContractInteractWith.openapiRequiredFields + .toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("address") != null && !jsonObj.get("address").isJsonNull()) + && !jsonObj.get("address").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `address` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("address").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DefiPreviewFeeAndContractInteractWith.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DefiPreviewFeeAndContractInteractWith' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(DefiPreviewFeeAndContractInteractWith.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, DefiPreviewFeeAndContractInteractWith value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DefiPreviewFeeAndContractInteractWith read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DefiPreviewFeeAndContractInteractWith given an JSON string + * + * @param jsonString JSON string + * @return An instance of DefiPreviewFeeAndContractInteractWith + * @throws IOException if the JSON string is invalid with respect to + * DefiPreviewFeeAndContractInteractWith + */ + public static DefiPreviewFeeAndContractInteractWith fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, DefiPreviewFeeAndContractInteractWith.class); + } + + /** + * Convert an instance of DefiPreviewFeeAndContractInteractWith to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiPreviewHealthFactor.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiPreviewHealthFactor.java new file mode 100644 index 0000000..0152c7d --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiPreviewHealthFactor.java @@ -0,0 +1,273 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** + * Lending health-factor change. Contains `before` / `after` values for lending + * protocols (e.g. Aave / Venus); `null` for non-lending protocols or when health factor + * is unavailable. + */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class DefiPreviewHealthFactor { + public static final String SERIALIZED_NAME_BEFORE = "before"; + + @SerializedName(SERIALIZED_NAME_BEFORE) + @jakarta.annotation.Nullable + private String before; + + public static final String SERIALIZED_NAME_AFTER = "after"; + + @SerializedName(SERIALIZED_NAME_AFTER) + @jakarta.annotation.Nullable + private String after; + + public DefiPreviewHealthFactor() {} + + public DefiPreviewHealthFactor before(@jakarta.annotation.Nullable String before) { + this.before = before; + return this; + } + + /** + * Health factor before this transaction. Null when unavailable. + * + * @return before + */ + @jakarta.annotation.Nullable + public String getBefore() { + return before; + } + + public void setBefore(@jakarta.annotation.Nullable String before) { + this.before = before; + } + + public DefiPreviewHealthFactor after(@jakarta.annotation.Nullable String after) { + this.after = after; + return this; + } + + /** + * Health factor after this transaction. Null when unavailable. + * + * @return after + */ + @jakarta.annotation.Nullable + public String getAfter() { + return after; + } + + public void setAfter(@jakarta.annotation.Nullable String after) { + this.after = after; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DefiPreviewHealthFactor defiPreviewHealthFactor = (DefiPreviewHealthFactor) o; + return Objects.equals(this.before, defiPreviewHealthFactor.before) + && Objects.equals(this.after, defiPreviewHealthFactor.after); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(before, after); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DefiPreviewHealthFactor {\n"); + sb.append(" before: ").append(toIndentedString(before)).append("\n"); + sb.append(" after: ").append(toIndentedString(after)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object beforeValue = getBefore(); + String beforeValueAsString = ""; + beforeValueAsString = beforeValue.toString(); + sb.append("before=").append(urlEncode(beforeValueAsString)).append(""); + Object afterValue = getAfter(); + String afterValueAsString = ""; + afterValueAsString = afterValue.toString(); + sb.append("after=").append(urlEncode(afterValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("before"); + openapiFields.add("after"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DefiPreviewHealthFactor + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DefiPreviewHealthFactor.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DefiPreviewHealthFactor is not found" + + " in the empty JSON string", + DefiPreviewHealthFactor.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("before") != null && !jsonObj.get("before").isJsonNull()) + && !jsonObj.get("before").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `before` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("before").toString())); + } + if ((jsonObj.get("after") != null && !jsonObj.get("after").isJsonNull()) + && !jsonObj.get("after").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `after` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("after").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DefiPreviewHealthFactor.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DefiPreviewHealthFactor' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(DefiPreviewHealthFactor.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DefiPreviewHealthFactor value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DefiPreviewHealthFactor read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DefiPreviewHealthFactor given an JSON string + * + * @param jsonString JSON string + * @return An instance of DefiPreviewHealthFactor + * @throws IOException if the JSON string is invalid with respect to DefiPreviewHealthFactor + */ + public static DefiPreviewHealthFactor fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DefiPreviewHealthFactor.class); + } + + /** + * Convert an instance of DefiPreviewHealthFactor to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiPreviewWarningsInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiPreviewWarningsInner.java new file mode 100644 index 0000000..36a749a --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiPreviewWarningsInner.java @@ -0,0 +1,294 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** A single non-blocking risk warning. */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class DefiPreviewWarningsInner { + public static final String SERIALIZED_NAME_CODE = "code"; + + @SerializedName(SERIALIZED_NAME_CODE) + @jakarta.annotation.Nullable + private String code; + + public static final String SERIALIZED_NAME_LEVEL = "level"; + + @SerializedName(SERIALIZED_NAME_LEVEL) + @jakarta.annotation.Nullable + private String level; + + public static final String SERIALIZED_NAME_MESSAGE = "message"; + + @SerializedName(SERIALIZED_NAME_MESSAGE) + @jakarta.annotation.Nullable + private String message; + + public DefiPreviewWarningsInner() {} + + public DefiPreviewWarningsInner code(@jakarta.annotation.Nullable String code) { + this.code = code; + return this; + } + + /** + * Warning code. Known values: `HEALTH_FACTOR_WARNING`, + * `HEALTH_FACTOR_DANGER`, `HIGH_SLIPPAGE`, `DELAYED_REDEMPTION`, + * `LP_OUT_OF_RANGE`. Branch on `code` for control flow; display + * `message` as-is. + * + * @return code + */ + @jakarta.annotation.Nullable + public String getCode() { + return code; + } + + public void setCode(@jakarta.annotation.Nullable String code) { + this.code = code; + } + + public DefiPreviewWarningsInner level(@jakarta.annotation.Nullable String level) { + this.level = level; + return this; + } + + /** + * Severity level — INFO / WARN / DANGER. + * + * @return level + */ + @jakarta.annotation.Nullable + public String getLevel() { + return level; + } + + public void setLevel(@jakarta.annotation.Nullable String level) { + this.level = level; + } + + public DefiPreviewWarningsInner message(@jakarta.annotation.Nullable String message) { + this.message = message; + return this; + } + + /** + * Human-readable warning text. + * + * @return message + */ + @jakarta.annotation.Nullable + public String getMessage() { + return message; + } + + public void setMessage(@jakarta.annotation.Nullable String message) { + this.message = message; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DefiPreviewWarningsInner defiPreviewWarningsInner = (DefiPreviewWarningsInner) o; + return Objects.equals(this.code, defiPreviewWarningsInner.code) + && Objects.equals(this.level, defiPreviewWarningsInner.level) + && Objects.equals(this.message, defiPreviewWarningsInner.message); + } + + @Override + public int hashCode() { + return Objects.hash(code, level, message); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DefiPreviewWarningsInner {\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" level: ").append(toIndentedString(level)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object codeValue = getCode(); + String codeValueAsString = ""; + codeValueAsString = codeValue.toString(); + sb.append("code=").append(urlEncode(codeValueAsString)).append(""); + Object levelValue = getLevel(); + String levelValueAsString = ""; + levelValueAsString = levelValue.toString(); + sb.append("level=").append(urlEncode(levelValueAsString)).append(""); + Object messageValue = getMessage(); + String messageValueAsString = ""; + messageValueAsString = messageValue.toString(); + sb.append("message=").append(urlEncode(messageValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("code"); + openapiFields.add("level"); + openapiFields.add("message"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DefiPreviewWarningsInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DefiPreviewWarningsInner.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DefiPreviewWarningsInner is not found" + + " in the empty JSON string", + DefiPreviewWarningsInner.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("code") != null && !jsonObj.get("code").isJsonNull()) + && !jsonObj.get("code").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `code` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("code").toString())); + } + if ((jsonObj.get("level") != null && !jsonObj.get("level").isJsonNull()) + && !jsonObj.get("level").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `level` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("level").toString())); + } + if ((jsonObj.get("message") != null && !jsonObj.get("message").isJsonNull()) + && !jsonObj.get("message").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `message` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("message").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DefiPreviewWarningsInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DefiPreviewWarningsInner' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(DefiPreviewWarningsInner.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DefiPreviewWarningsInner value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DefiPreviewWarningsInner read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DefiPreviewWarningsInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of DefiPreviewWarningsInner + * @throws IOException if the JSON string is invalid with respect to DefiPreviewWarningsInner + */ + public static DefiPreviewWarningsInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DefiPreviewWarningsInner.class); + } + + /** + * Convert an instance of DefiPreviewWarningsInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiProtocolDimensionScoresDto.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiProtocolDimensionScoresDto.java new file mode 100644 index 0000000..725e4f2 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiProtocolDimensionScoresDto.java @@ -0,0 +1,448 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** CertiK six-dimension security scores. */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class DefiProtocolDimensionScoresDto { + public static final String SERIALIZED_NAME_CODE_SECURITY = "codeSecurity"; + + @SerializedName(SERIALIZED_NAME_CODE_SECURITY) + @jakarta.annotation.Nullable + private String codeSecurity; + + public static final String SERIALIZED_NAME_FUNDAMENTAL_HEALTH = "fundamentalHealth"; + + @SerializedName(SERIALIZED_NAME_FUNDAMENTAL_HEALTH) + @jakarta.annotation.Nullable + private String fundamentalHealth; + + public static final String SERIALIZED_NAME_OPERATIONAL_RESILIENCE = "operationalResilience"; + + @SerializedName(SERIALIZED_NAME_OPERATIONAL_RESILIENCE) + @jakarta.annotation.Nullable + private String operationalResilience; + + public static final String SERIALIZED_NAME_COMMUNITY_TRUST = "communityTrust"; + + @SerializedName(SERIALIZED_NAME_COMMUNITY_TRUST) + @jakarta.annotation.Nullable + private String communityTrust; + + public static final String SERIALIZED_NAME_GOVERNANCE_STRENGTH = "governanceStrength"; + + @SerializedName(SERIALIZED_NAME_GOVERNANCE_STRENGTH) + @jakarta.annotation.Nullable + private String governanceStrength; + + public static final String SERIALIZED_NAME_MARKET_STABILITY = "marketStability"; + + @SerializedName(SERIALIZED_NAME_MARKET_STABILITY) + @jakarta.annotation.Nullable + private String marketStability; + + public DefiProtocolDimensionScoresDto() {} + + public DefiProtocolDimensionScoresDto codeSecurity( + @jakarta.annotation.Nullable String codeSecurity) { + this.codeSecurity = codeSecurity; + return this; + } + + /** + * Code security score. + * + * @return codeSecurity + */ + @jakarta.annotation.Nullable + public String getCodeSecurity() { + return codeSecurity; + } + + public void setCodeSecurity(@jakarta.annotation.Nullable String codeSecurity) { + this.codeSecurity = codeSecurity; + } + + public DefiProtocolDimensionScoresDto fundamentalHealth( + @jakarta.annotation.Nullable String fundamentalHealth) { + this.fundamentalHealth = fundamentalHealth; + return this; + } + + /** + * Fundamental health score. + * + * @return fundamentalHealth + */ + @jakarta.annotation.Nullable + public String getFundamentalHealth() { + return fundamentalHealth; + } + + public void setFundamentalHealth(@jakarta.annotation.Nullable String fundamentalHealth) { + this.fundamentalHealth = fundamentalHealth; + } + + public DefiProtocolDimensionScoresDto operationalResilience( + @jakarta.annotation.Nullable String operationalResilience) { + this.operationalResilience = operationalResilience; + return this; + } + + /** + * Operational resilience score. + * + * @return operationalResilience + */ + @jakarta.annotation.Nullable + public String getOperationalResilience() { + return operationalResilience; + } + + public void setOperationalResilience( + @jakarta.annotation.Nullable String operationalResilience) { + this.operationalResilience = operationalResilience; + } + + public DefiProtocolDimensionScoresDto communityTrust( + @jakarta.annotation.Nullable String communityTrust) { + this.communityTrust = communityTrust; + return this; + } + + /** + * Community trust score. + * + * @return communityTrust + */ + @jakarta.annotation.Nullable + public String getCommunityTrust() { + return communityTrust; + } + + public void setCommunityTrust(@jakarta.annotation.Nullable String communityTrust) { + this.communityTrust = communityTrust; + } + + public DefiProtocolDimensionScoresDto governanceStrength( + @jakarta.annotation.Nullable String governanceStrength) { + this.governanceStrength = governanceStrength; + return this; + } + + /** + * Governance strength score. + * + * @return governanceStrength + */ + @jakarta.annotation.Nullable + public String getGovernanceStrength() { + return governanceStrength; + } + + public void setGovernanceStrength(@jakarta.annotation.Nullable String governanceStrength) { + this.governanceStrength = governanceStrength; + } + + public DefiProtocolDimensionScoresDto marketStability( + @jakarta.annotation.Nullable String marketStability) { + this.marketStability = marketStability; + return this; + } + + /** + * Market stability score. + * + * @return marketStability + */ + @jakarta.annotation.Nullable + public String getMarketStability() { + return marketStability; + } + + public void setMarketStability(@jakarta.annotation.Nullable String marketStability) { + this.marketStability = marketStability; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DefiProtocolDimensionScoresDto defiProtocolDimensionScoresDto = + (DefiProtocolDimensionScoresDto) o; + return Objects.equals(this.codeSecurity, defiProtocolDimensionScoresDto.codeSecurity) + && Objects.equals( + this.fundamentalHealth, defiProtocolDimensionScoresDto.fundamentalHealth) + && Objects.equals( + this.operationalResilience, + defiProtocolDimensionScoresDto.operationalResilience) + && Objects.equals( + this.communityTrust, defiProtocolDimensionScoresDto.communityTrust) + && Objects.equals( + this.governanceStrength, defiProtocolDimensionScoresDto.governanceStrength) + && Objects.equals( + this.marketStability, defiProtocolDimensionScoresDto.marketStability); + } + + @Override + public int hashCode() { + return Objects.hash( + codeSecurity, + fundamentalHealth, + operationalResilience, + communityTrust, + governanceStrength, + marketStability); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DefiProtocolDimensionScoresDto {\n"); + sb.append(" codeSecurity: ").append(toIndentedString(codeSecurity)).append("\n"); + sb.append(" fundamentalHealth: ").append(toIndentedString(fundamentalHealth)).append("\n"); + sb.append(" operationalResilience: ") + .append(toIndentedString(operationalResilience)) + .append("\n"); + sb.append(" communityTrust: ").append(toIndentedString(communityTrust)).append("\n"); + sb.append(" governanceStrength: ") + .append(toIndentedString(governanceStrength)) + .append("\n"); + sb.append(" marketStability: ").append(toIndentedString(marketStability)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object codeSecurityValue = getCodeSecurity(); + String codeSecurityValueAsString = ""; + codeSecurityValueAsString = codeSecurityValue.toString(); + sb.append("codeSecurity=").append(urlEncode(codeSecurityValueAsString)).append(""); + Object fundamentalHealthValue = getFundamentalHealth(); + String fundamentalHealthValueAsString = ""; + fundamentalHealthValueAsString = fundamentalHealthValue.toString(); + sb.append("fundamentalHealth=") + .append(urlEncode(fundamentalHealthValueAsString)) + .append(""); + Object operationalResilienceValue = getOperationalResilience(); + String operationalResilienceValueAsString = ""; + operationalResilienceValueAsString = operationalResilienceValue.toString(); + sb.append("operationalResilience=") + .append(urlEncode(operationalResilienceValueAsString)) + .append(""); + Object communityTrustValue = getCommunityTrust(); + String communityTrustValueAsString = ""; + communityTrustValueAsString = communityTrustValue.toString(); + sb.append("communityTrust=").append(urlEncode(communityTrustValueAsString)).append(""); + Object governanceStrengthValue = getGovernanceStrength(); + String governanceStrengthValueAsString = ""; + governanceStrengthValueAsString = governanceStrengthValue.toString(); + sb.append("governanceStrength=") + .append(urlEncode(governanceStrengthValueAsString)) + .append(""); + Object marketStabilityValue = getMarketStability(); + String marketStabilityValueAsString = ""; + marketStabilityValueAsString = marketStabilityValue.toString(); + sb.append("marketStability=").append(urlEncode(marketStabilityValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("codeSecurity"); + openapiFields.add("fundamentalHealth"); + openapiFields.add("operationalResilience"); + openapiFields.add("communityTrust"); + openapiFields.add("governanceStrength"); + openapiFields.add("marketStability"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * DefiProtocolDimensionScoresDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DefiProtocolDimensionScoresDto.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DefiProtocolDimensionScoresDto is not" + + " found in the empty JSON string", + DefiProtocolDimensionScoresDto.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("codeSecurity") != null && !jsonObj.get("codeSecurity").isJsonNull()) + && !jsonObj.get("codeSecurity").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `codeSecurity` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("codeSecurity").toString())); + } + if ((jsonObj.get("fundamentalHealth") != null + && !jsonObj.get("fundamentalHealth").isJsonNull()) + && !jsonObj.get("fundamentalHealth").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `fundamentalHealth` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("fundamentalHealth").toString())); + } + if ((jsonObj.get("operationalResilience") != null + && !jsonObj.get("operationalResilience").isJsonNull()) + && !jsonObj.get("operationalResilience").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `operationalResilience` to be a primitive type in" + + " the JSON string but got `%s`", + jsonObj.get("operationalResilience").toString())); + } + if ((jsonObj.get("communityTrust") != null && !jsonObj.get("communityTrust").isJsonNull()) + && !jsonObj.get("communityTrust").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `communityTrust` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("communityTrust").toString())); + } + if ((jsonObj.get("governanceStrength") != null + && !jsonObj.get("governanceStrength").isJsonNull()) + && !jsonObj.get("governanceStrength").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `governanceStrength` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("governanceStrength").toString())); + } + if ((jsonObj.get("marketStability") != null && !jsonObj.get("marketStability").isJsonNull()) + && !jsonObj.get("marketStability").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `marketStability` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("marketStability").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DefiProtocolDimensionScoresDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DefiProtocolDimensionScoresDto' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(DefiProtocolDimensionScoresDto.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DefiProtocolDimensionScoresDto value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DefiProtocolDimensionScoresDto read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DefiProtocolDimensionScoresDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of DefiProtocolDimensionScoresDto + * @throws IOException if the JSON string is invalid with respect to + * DefiProtocolDimensionScoresDto + */ + public static DefiProtocolDimensionScoresDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DefiProtocolDimensionScoresDto.class); + } + + /** + * Convert an instance of DefiProtocolDimensionScoresDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiProtocolDto.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiProtocolDto.java new file mode 100644 index 0000000..505b09e --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiProtocolDto.java @@ -0,0 +1,525 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; +import org.hibernate.validator.constraints.*; + +/** DeFi protocol summary (list item). */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class DefiProtocolDto { + public static final String SERIALIZED_NAME_DEFI_PROTOCOL_ID = "defiProtocolId"; + + @SerializedName(SERIALIZED_NAME_DEFI_PROTOCOL_ID) + @jakarta.annotation.Nullable + private String defiProtocolId; + + public static final String SERIALIZED_NAME_PROTOCOL_NAME = "protocolName"; + + @SerializedName(SERIALIZED_NAME_PROTOCOL_NAME) + @jakarta.annotation.Nullable + private String protocolName; + + public static final String SERIALIZED_NAME_PROTOCOL_LOGO = "protocolLogo"; + + @SerializedName(SERIALIZED_NAME_PROTOCOL_LOGO) + @jakarta.annotation.Nullable + private String protocolLogo; + + public static final String SERIALIZED_NAME_TVL = "tvl"; + + @SerializedName(SERIALIZED_NAME_TVL) + @jakarta.annotation.Nullable + private String tvl; + + public static final String SERIALIZED_NAME_APY_BPS = "apyBps"; + + @SerializedName(SERIALIZED_NAME_APY_BPS) + @jakarta.annotation.Nullable + private Long apyBps; + + public static final String SERIALIZED_NAME_APY_DISPLAY = "apyDisplay"; + + @SerializedName(SERIALIZED_NAME_APY_DISPLAY) + @jakarta.annotation.Nullable + private String apyDisplay; + + public static final String SERIALIZED_NAME_INVEST_TYPE = "investType"; + + @SerializedName(SERIALIZED_NAME_INVEST_TYPE) + @jakarta.annotation.Nullable + private List investType; + + public static final String SERIALIZED_NAME_SUPPORTED_CHAINS = "supportedChains"; + + @SerializedName(SERIALIZED_NAME_SUPPORTED_CHAINS) + @jakarta.annotation.Nullable + private List supportedChains; + + public DefiProtocolDto() {} + + public DefiProtocolDto defiProtocolId(@jakarta.annotation.Nullable String defiProtocolId) { + this.defiProtocolId = defiProtocolId; + return this; + } + + /** + * DeFi protocol identifier. + * + * @return defiProtocolId + */ + @jakarta.annotation.Nullable + public String getDefiProtocolId() { + return defiProtocolId; + } + + public void setDefiProtocolId(@jakarta.annotation.Nullable String defiProtocolId) { + this.defiProtocolId = defiProtocolId; + } + + public DefiProtocolDto protocolName(@jakarta.annotation.Nullable String protocolName) { + this.protocolName = protocolName; + return this; + } + + /** + * Protocol display name. + * + * @return protocolName + */ + @jakarta.annotation.Nullable + public String getProtocolName() { + return protocolName; + } + + public void setProtocolName(@jakarta.annotation.Nullable String protocolName) { + this.protocolName = protocolName; + } + + public DefiProtocolDto protocolLogo(@jakarta.annotation.Nullable String protocolLogo) { + this.protocolLogo = protocolLogo; + return this; + } + + /** + * Protocol logo image URL (full URL; quote as-is). + * + * @return protocolLogo + */ + @jakarta.annotation.Nullable + public String getProtocolLogo() { + return protocolLogo; + } + + public void setProtocolLogo(@jakarta.annotation.Nullable String protocolLogo) { + this.protocolLogo = protocolLogo; + } + + public DefiProtocolDto tvl(@jakarta.annotation.Nullable String tvl) { + this.tvl = tvl; + return this; + } + + /** + * Total value locked in the protocol (USD). String, raw precision from the data source. + * + * @return tvl + */ + @jakarta.annotation.Nullable + public String getTvl() { + return tvl; + } + + public void setTvl(@jakarta.annotation.Nullable String tvl) { + this.tvl = tvl; + } + + public DefiProtocolDto apyBps(@jakarta.annotation.Nullable Long apyBps) { + this.apyBps = apyBps; + return this; + } + + /** + * Highest APY across the protocol's investments, in basis points (1 bps = 0.01%). + * Integer value — use this for sorting / comparing / filtering, never the raw decimal. + * + * @return apyBps + */ + @jakarta.annotation.Nullable + public Long getApyBps() { + return apyBps; + } + + public void setApyBps(@jakarta.annotation.Nullable Long apyBps) { + this.apyBps = apyBps; + } + + public DefiProtocolDto apyDisplay(@jakarta.annotation.Nullable String apyDisplay) { + this.apyDisplay = apyDisplay; + return this; + } + + /** + * Pre-formatted, human-readable APY string for display (e.g. \"12.35%\"). Quote + * as-is; do not re-compute or transform. + * + * @return apyDisplay + */ + @jakarta.annotation.Nullable + public String getApyDisplay() { + return apyDisplay; + } + + public void setApyDisplay(@jakarta.annotation.Nullable String apyDisplay) { + this.apyDisplay = apyDisplay; + } + + public DefiProtocolDto investType(@jakarta.annotation.Nullable List investType) { + this.investType = investType; + return this; + } + + public DefiProtocolDto addInvestTypeItem(String investTypeItem) { + if (this.investType == null) { + this.investType = new ArrayList<>(); + } + this.investType.add(investTypeItem); + return this; + } + + /** + * Investment types supported by this protocol — an array here (a protocol may support several). + * Note: the investment-level investType (in investment list/detail) is a single string. Known + * values: Earn, LiquidityPool. + * + * @return investType + */ + @jakarta.annotation.Nullable + public List getInvestType() { + return investType; + } + + public void setInvestType(@jakarta.annotation.Nullable List investType) { + this.investType = investType; + } + + public DefiProtocolDto supportedChains( + @jakarta.annotation.Nullable List supportedChains) { + this.supportedChains = supportedChains; + return this; + } + + public DefiProtocolDto addSupportedChainsItem(String supportedChainsItem) { + if (this.supportedChains == null) { + this.supportedChains = new ArrayList<>(); + } + this.supportedChains.add(supportedChainsItem); + return this; + } + + /** + * Supported Binance chain IDs. + * + * @return supportedChains + */ + @jakarta.annotation.Nullable + public List getSupportedChains() { + return supportedChains; + } + + public void setSupportedChains(@jakarta.annotation.Nullable List supportedChains) { + this.supportedChains = supportedChains; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DefiProtocolDto defiProtocolDto = (DefiProtocolDto) o; + return Objects.equals(this.defiProtocolId, defiProtocolDto.defiProtocolId) + && Objects.equals(this.protocolName, defiProtocolDto.protocolName) + && Objects.equals(this.protocolLogo, defiProtocolDto.protocolLogo) + && Objects.equals(this.tvl, defiProtocolDto.tvl) + && Objects.equals(this.apyBps, defiProtocolDto.apyBps) + && Objects.equals(this.apyDisplay, defiProtocolDto.apyDisplay) + && Objects.equals(this.investType, defiProtocolDto.investType) + && Objects.equals(this.supportedChains, defiProtocolDto.supportedChains); + } + + @Override + public int hashCode() { + return Objects.hash( + defiProtocolId, + protocolName, + protocolLogo, + tvl, + apyBps, + apyDisplay, + investType, + supportedChains); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DefiProtocolDto {\n"); + sb.append(" defiProtocolId: ").append(toIndentedString(defiProtocolId)).append("\n"); + sb.append(" protocolName: ").append(toIndentedString(protocolName)).append("\n"); + sb.append(" protocolLogo: ").append(toIndentedString(protocolLogo)).append("\n"); + sb.append(" tvl: ").append(toIndentedString(tvl)).append("\n"); + sb.append(" apyBps: ").append(toIndentedString(apyBps)).append("\n"); + sb.append(" apyDisplay: ").append(toIndentedString(apyDisplay)).append("\n"); + sb.append(" investType: ").append(toIndentedString(investType)).append("\n"); + sb.append(" supportedChains: ").append(toIndentedString(supportedChains)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object defiProtocolIdValue = getDefiProtocolId(); + String defiProtocolIdValueAsString = ""; + defiProtocolIdValueAsString = defiProtocolIdValue.toString(); + sb.append("defiProtocolId=").append(urlEncode(defiProtocolIdValueAsString)).append(""); + Object protocolNameValue = getProtocolName(); + String protocolNameValueAsString = ""; + protocolNameValueAsString = protocolNameValue.toString(); + sb.append("protocolName=").append(urlEncode(protocolNameValueAsString)).append(""); + Object protocolLogoValue = getProtocolLogo(); + String protocolLogoValueAsString = ""; + protocolLogoValueAsString = protocolLogoValue.toString(); + sb.append("protocolLogo=").append(urlEncode(protocolLogoValueAsString)).append(""); + Object tvlValue = getTvl(); + String tvlValueAsString = ""; + tvlValueAsString = tvlValue.toString(); + sb.append("tvl=").append(urlEncode(tvlValueAsString)).append(""); + Object apyBpsValue = getApyBps(); + String apyBpsValueAsString = ""; + apyBpsValueAsString = apyBpsValue.toString(); + sb.append("apyBps=").append(urlEncode(apyBpsValueAsString)).append(""); + Object apyDisplayValue = getApyDisplay(); + String apyDisplayValueAsString = ""; + apyDisplayValueAsString = apyDisplayValue.toString(); + sb.append("apyDisplay=").append(urlEncode(apyDisplayValueAsString)).append(""); + Object investTypeValue = getInvestType(); + String investTypeValueAsString = ""; + investTypeValueAsString = + (String) + ((Collection) investTypeValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("investType=").append(urlEncode(investTypeValueAsString)).append(""); + Object supportedChainsValue = getSupportedChains(); + String supportedChainsValueAsString = ""; + supportedChainsValueAsString = + (String) + ((Collection) supportedChainsValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("supportedChains=").append(urlEncode(supportedChainsValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("defiProtocolId"); + openapiFields.add("protocolName"); + openapiFields.add("protocolLogo"); + openapiFields.add("tvl"); + openapiFields.add("apyBps"); + openapiFields.add("apyDisplay"); + openapiFields.add("investType"); + openapiFields.add("supportedChains"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DefiProtocolDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DefiProtocolDto.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DefiProtocolDto is not found in the" + + " empty JSON string", + DefiProtocolDto.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("defiProtocolId") != null && !jsonObj.get("defiProtocolId").isJsonNull()) + && !jsonObj.get("defiProtocolId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `defiProtocolId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("defiProtocolId").toString())); + } + if ((jsonObj.get("protocolName") != null && !jsonObj.get("protocolName").isJsonNull()) + && !jsonObj.get("protocolName").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `protocolName` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("protocolName").toString())); + } + if ((jsonObj.get("protocolLogo") != null && !jsonObj.get("protocolLogo").isJsonNull()) + && !jsonObj.get("protocolLogo").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `protocolLogo` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("protocolLogo").toString())); + } + if ((jsonObj.get("tvl") != null && !jsonObj.get("tvl").isJsonNull()) + && !jsonObj.get("tvl").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `tvl` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("tvl").toString())); + } + if ((jsonObj.get("apyDisplay") != null && !jsonObj.get("apyDisplay").isJsonNull()) + && !jsonObj.get("apyDisplay").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `apyDisplay` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("apyDisplay").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("investType") != null + && !jsonObj.get("investType").isJsonNull() + && !jsonObj.get("investType").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `investType` to be an array in the JSON string but" + + " got `%s`", + jsonObj.get("investType").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("supportedChains") != null + && !jsonObj.get("supportedChains").isJsonNull() + && !jsonObj.get("supportedChains").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `supportedChains` to be an array in the JSON string" + + " but got `%s`", + jsonObj.get("supportedChains").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DefiProtocolDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DefiProtocolDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(DefiProtocolDto.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DefiProtocolDto value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DefiProtocolDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DefiProtocolDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of DefiProtocolDto + * @throws IOException if the JSON string is invalid with respect to DefiProtocolDto + */ + public static DefiProtocolDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DefiProtocolDto.class); + } + + /** + * Convert an instance of DefiProtocolDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiProtocolFaqDto.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiProtocolFaqDto.java new file mode 100644 index 0000000..3886132 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiProtocolFaqDto.java @@ -0,0 +1,252 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** FAQ entry. */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class DefiProtocolFaqDto { + public static final String SERIALIZED_NAME_TITLE = "title"; + + @SerializedName(SERIALIZED_NAME_TITLE) + @jakarta.annotation.Nullable + private String title; + + public static final String SERIALIZED_NAME_ANSWER = "answer"; + + @SerializedName(SERIALIZED_NAME_ANSWER) + @jakarta.annotation.Nullable + private String answer; + + public DefiProtocolFaqDto() {} + + public DefiProtocolFaqDto title(@jakarta.annotation.Nullable String title) { + this.title = title; + return this; + } + + /** + * FAQ question text (already translated; quote as-is). + * + * @return title + */ + @jakarta.annotation.Nullable + public String getTitle() { + return title; + } + + public void setTitle(@jakarta.annotation.Nullable String title) { + this.title = title; + } + + public DefiProtocolFaqDto answer(@jakarta.annotation.Nullable String answer) { + this.answer = answer; + return this; + } + + /** + * FAQ answer text (already translated; quote as-is). May contain line-break markup + * `<Br/>` and paragraph-gap markup `<Gap/>` — interpret them as + * line / paragraph breaks. + * + * @return answer + */ + @jakarta.annotation.Nullable + public String getAnswer() { + return answer; + } + + public void setAnswer(@jakarta.annotation.Nullable String answer) { + this.answer = answer; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DefiProtocolFaqDto defiProtocolFaqDto = (DefiProtocolFaqDto) o; + return Objects.equals(this.title, defiProtocolFaqDto.title) + && Objects.equals(this.answer, defiProtocolFaqDto.answer); + } + + @Override + public int hashCode() { + return Objects.hash(title, answer); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DefiProtocolFaqDto {\n"); + sb.append(" title: ").append(toIndentedString(title)).append("\n"); + sb.append(" answer: ").append(toIndentedString(answer)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object titleValue = getTitle(); + String titleValueAsString = ""; + titleValueAsString = titleValue.toString(); + sb.append("title=").append(urlEncode(titleValueAsString)).append(""); + Object answerValue = getAnswer(); + String answerValueAsString = ""; + answerValueAsString = answerValue.toString(); + sb.append("answer=").append(urlEncode(answerValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("title"); + openapiFields.add("answer"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DefiProtocolFaqDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DefiProtocolFaqDto.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DefiProtocolFaqDto is not found in the" + + " empty JSON string", + DefiProtocolFaqDto.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("title") != null && !jsonObj.get("title").isJsonNull()) + && !jsonObj.get("title").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `title` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("title").toString())); + } + if ((jsonObj.get("answer") != null && !jsonObj.get("answer").isJsonNull()) + && !jsonObj.get("answer").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `answer` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("answer").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DefiProtocolFaqDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DefiProtocolFaqDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(DefiProtocolFaqDto.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DefiProtocolFaqDto value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DefiProtocolFaqDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DefiProtocolFaqDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of DefiProtocolFaqDto + * @throws IOException if the JSON string is invalid with respect to DefiProtocolFaqDto + */ + public static DefiProtocolFaqDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DefiProtocolFaqDto.class); + } + + /** + * Convert an instance of DefiProtocolFaqDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiProtocolFundRaisingDto.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiProtocolFundRaisingDto.java new file mode 100644 index 0000000..8d0c3e4 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiProtocolFundRaisingDto.java @@ -0,0 +1,367 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** Fundraising round. */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class DefiProtocolFundRaisingDto { + public static final String SERIALIZED_NAME_ROUND = "round"; + + @SerializedName(SERIALIZED_NAME_ROUND) + @jakarta.annotation.Nullable + private String round; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + + @SerializedName(SERIALIZED_NAME_AMOUNT) + @jakarta.annotation.Nullable + private String amount; + + public static final String SERIALIZED_NAME_DATE = "date"; + + @SerializedName(SERIALIZED_NAME_DATE) + @jakarta.annotation.Nullable + private String date; + + public static final String SERIALIZED_NAME_INVESTORS = "investors"; + + @SerializedName(SERIALIZED_NAME_INVESTORS) + @jakarta.annotation.Nullable + private List investors; + + public DefiProtocolFundRaisingDto() {} + + public DefiProtocolFundRaisingDto round(@jakarta.annotation.Nullable String round) { + this.round = round; + return this; + } + + /** + * Round name (e.g. \"Strategic\"). + * + * @return round + */ + @jakarta.annotation.Nullable + public String getRound() { + return round; + } + + public void setRound(@jakarta.annotation.Nullable String round) { + this.round = round; + } + + public DefiProtocolFundRaisingDto amount(@jakarta.annotation.Nullable String amount) { + this.amount = amount; + return this; + } + + /** + * Amount raised. Null when not disclosed. + * + * @return amount + */ + @jakarta.annotation.Nullable + public String getAmount() { + return amount; + } + + public void setAmount(@jakarta.annotation.Nullable String amount) { + this.amount = amount; + } + + public DefiProtocolFundRaisingDto date(@jakarta.annotation.Nullable String date) { + this.date = date; + return this; + } + + /** + * Round date. + * + * @return date + */ + @jakarta.annotation.Nullable + public String getDate() { + return date; + } + + public void setDate(@jakarta.annotation.Nullable String date) { + this.date = date; + } + + public DefiProtocolFundRaisingDto investors( + @jakarta.annotation.Nullable List investors) { + this.investors = investors; + return this; + } + + public DefiProtocolFundRaisingDto addInvestorsItem(String investorsItem) { + if (this.investors == null) { + this.investors = new ArrayList<>(); + } + this.investors.add(investorsItem); + return this; + } + + /** + * Investor names. + * + * @return investors + */ + @jakarta.annotation.Nullable + public List getInvestors() { + return investors; + } + + public void setInvestors(@jakarta.annotation.Nullable List investors) { + this.investors = investors; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DefiProtocolFundRaisingDto defiProtocolFundRaisingDto = (DefiProtocolFundRaisingDto) o; + return Objects.equals(this.round, defiProtocolFundRaisingDto.round) + && Objects.equals(this.amount, defiProtocolFundRaisingDto.amount) + && Objects.equals(this.date, defiProtocolFundRaisingDto.date) + && Objects.equals(this.investors, defiProtocolFundRaisingDto.investors); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(round, amount, date, investors); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DefiProtocolFundRaisingDto {\n"); + sb.append(" round: ").append(toIndentedString(round)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" date: ").append(toIndentedString(date)).append("\n"); + sb.append(" investors: ").append(toIndentedString(investors)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object roundValue = getRound(); + String roundValueAsString = ""; + roundValueAsString = roundValue.toString(); + sb.append("round=").append(urlEncode(roundValueAsString)).append(""); + Object amountValue = getAmount(); + String amountValueAsString = ""; + amountValueAsString = amountValue.toString(); + sb.append("amount=").append(urlEncode(amountValueAsString)).append(""); + Object dateValue = getDate(); + String dateValueAsString = ""; + dateValueAsString = dateValue.toString(); + sb.append("date=").append(urlEncode(dateValueAsString)).append(""); + Object investorsValue = getInvestors(); + String investorsValueAsString = ""; + investorsValueAsString = + (String) + ((Collection) investorsValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("investors=").append(urlEncode(investorsValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("round"); + openapiFields.add("amount"); + openapiFields.add("date"); + openapiFields.add("investors"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DefiProtocolFundRaisingDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DefiProtocolFundRaisingDto.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DefiProtocolFundRaisingDto is not" + + " found in the empty JSON string", + DefiProtocolFundRaisingDto.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("round") != null && !jsonObj.get("round").isJsonNull()) + && !jsonObj.get("round").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `round` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("round").toString())); + } + if ((jsonObj.get("amount") != null && !jsonObj.get("amount").isJsonNull()) + && !jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `amount` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("amount").toString())); + } + if ((jsonObj.get("date") != null && !jsonObj.get("date").isJsonNull()) + && !jsonObj.get("date").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `date` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("date").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("investors") != null + && !jsonObj.get("investors").isJsonNull() + && !jsonObj.get("investors").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `investors` to be an array in the JSON string but" + + " got `%s`", + jsonObj.get("investors").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DefiProtocolFundRaisingDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DefiProtocolFundRaisingDto' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(DefiProtocolFundRaisingDto.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DefiProtocolFundRaisingDto value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DefiProtocolFundRaisingDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DefiProtocolFundRaisingDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of DefiProtocolFundRaisingDto + * @throws IOException if the JSON string is invalid with respect to DefiProtocolFundRaisingDto + */ + public static DefiProtocolFundRaisingDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DefiProtocolFundRaisingDto.class); + } + + /** + * Convert an instance of DefiProtocolFundRaisingDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiProtocolInfoDto.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiProtocolInfoDto.java new file mode 100644 index 0000000..62c7c43 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiProtocolInfoDto.java @@ -0,0 +1,1105 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** DeFi protocol detail. */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class DefiProtocolInfoDto { + public static final String SERIALIZED_NAME_DEFI_PROTOCOL_ID = "defiProtocolId"; + + @SerializedName(SERIALIZED_NAME_DEFI_PROTOCOL_ID) + @jakarta.annotation.Nullable + private String defiProtocolId; + + public static final String SERIALIZED_NAME_PROTOCOL_NAME = "protocolName"; + + @SerializedName(SERIALIZED_NAME_PROTOCOL_NAME) + @jakarta.annotation.Nullable + private String protocolName; + + public static final String SERIALIZED_NAME_PROTOCOL_LOGO = "protocolLogo"; + + @SerializedName(SERIALIZED_NAME_PROTOCOL_LOGO) + @jakarta.annotation.Nullable + private String protocolLogo; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @jakarta.annotation.Nullable + private String description; + + public static final String SERIALIZED_NAME_WEBSITE_URL = "websiteUrl"; + + @SerializedName(SERIALIZED_NAME_WEBSITE_URL) + @jakarta.annotation.Nullable + private String websiteUrl; + + public static final String SERIALIZED_NAME_INVEST_TYPE = "investType"; + + @SerializedName(SERIALIZED_NAME_INVEST_TYPE) + @jakarta.annotation.Nullable + private List investType; + + public static final String SERIALIZED_NAME_SUPPORTED_CHAINS = "supportedChains"; + + @SerializedName(SERIALIZED_NAME_SUPPORTED_CHAINS) + @jakarta.annotation.Nullable + private List supportedChains; + + public static final String SERIALIZED_NAME_TVL = "tvl"; + + @SerializedName(SERIALIZED_NAME_TVL) + @jakarta.annotation.Nullable + private String tvl; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + + @SerializedName(SERIALIZED_NAME_TAGS) + @jakarta.annotation.Nullable + private List tags; + + public static final String SERIALIZED_NAME_FOUNDED = "founded"; + + @SerializedName(SERIALIZED_NAME_FOUNDED) + @jakarta.annotation.Nullable + private String founded; + + public static final String SERIALIZED_NAME_FDV = "fdv"; + + @SerializedName(SERIALIZED_NAME_FDV) + @jakarta.annotation.Nullable + private String fdv; + + public static final String SERIALIZED_NAME_TOTAL_FUNDING = "totalFunding"; + + @SerializedName(SERIALIZED_NAME_TOTAL_FUNDING) + @jakarta.annotation.Nullable + private String totalFunding; + + public static final String SERIALIZED_NAME_SOCIAL_LINKS = "socialLinks"; + + @SerializedName(SERIALIZED_NAME_SOCIAL_LINKS) + @jakarta.annotation.Nullable + private DefiProtocolInfoDtoSocialLinks socialLinks; + + public static final String SERIALIZED_NAME_TEAM = "team"; + + @SerializedName(SERIALIZED_NAME_TEAM) + @jakarta.annotation.Nullable + private List<@Valid DefiProtocolInfoDtoTeamInner> team; + + public static final String SERIALIZED_NAME_FUND_RAISING = "fundRaising"; + + @SerializedName(SERIALIZED_NAME_FUND_RAISING) + @jakarta.annotation.Nullable + private List<@Valid DefiProtocolInfoDtoFundRaisingInner> fundRaising; + + public static final String SERIALIZED_NAME_SECURITY_SCORE = "securityScore"; + + @SerializedName(SERIALIZED_NAME_SECURITY_SCORE) + @jakarta.annotation.Nullable + private String securityScore; + + public static final String SERIALIZED_NAME_DIMENSION_SCORES = "dimensionScores"; + + @SerializedName(SERIALIZED_NAME_DIMENSION_SCORES) + @jakarta.annotation.Nullable + private DefiProtocolInfoDtoDimensionScores dimensionScores; + + public static final String SERIALIZED_NAME_HIGHLIGHTS = "highlights"; + + @SerializedName(SERIALIZED_NAME_HIGHLIGHTS) + @jakarta.annotation.Nullable + private List highlights; + + public static final String SERIALIZED_NAME_FAQ = "faq"; + + @SerializedName(SERIALIZED_NAME_FAQ) + @jakarta.annotation.Nullable + private List<@Valid DefiProtocolInfoDtoFaqInner> faq; + + public DefiProtocolInfoDto() {} + + public DefiProtocolInfoDto defiProtocolId(@jakarta.annotation.Nullable String defiProtocolId) { + this.defiProtocolId = defiProtocolId; + return this; + } + + /** + * DeFi protocol identifier. + * + * @return defiProtocolId + */ + @jakarta.annotation.Nullable + public String getDefiProtocolId() { + return defiProtocolId; + } + + public void setDefiProtocolId(@jakarta.annotation.Nullable String defiProtocolId) { + this.defiProtocolId = defiProtocolId; + } + + public DefiProtocolInfoDto protocolName(@jakarta.annotation.Nullable String protocolName) { + this.protocolName = protocolName; + return this; + } + + /** + * Protocol display name. + * + * @return protocolName + */ + @jakarta.annotation.Nullable + public String getProtocolName() { + return protocolName; + } + + public void setProtocolName(@jakarta.annotation.Nullable String protocolName) { + this.protocolName = protocolName; + } + + public DefiProtocolInfoDto protocolLogo(@jakarta.annotation.Nullable String protocolLogo) { + this.protocolLogo = protocolLogo; + return this; + } + + /** + * Protocol logo image URL (full URL under `https://bin.bnbstatic.com`). + * + * @return protocolLogo + */ + @jakarta.annotation.Nullable + public String getProtocolLogo() { + return protocolLogo; + } + + public void setProtocolLogo(@jakarta.annotation.Nullable String protocolLogo) { + this.protocolLogo = protocolLogo; + } + + public DefiProtocolInfoDto description(@jakarta.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Protocol description (already translated; quote as-is). + * + * @return description + */ + @jakarta.annotation.Nullable + public String getDescription() { + return description; + } + + public void setDescription(@jakarta.annotation.Nullable String description) { + this.description = description; + } + + public DefiProtocolInfoDto websiteUrl(@jakarta.annotation.Nullable String websiteUrl) { + this.websiteUrl = websiteUrl; + return this; + } + + /** + * Official website URL. + * + * @return websiteUrl + */ + @jakarta.annotation.Nullable + public String getWebsiteUrl() { + return websiteUrl; + } + + public void setWebsiteUrl(@jakarta.annotation.Nullable String websiteUrl) { + this.websiteUrl = websiteUrl; + } + + public DefiProtocolInfoDto investType(@jakarta.annotation.Nullable List investType) { + this.investType = investType; + return this; + } + + public DefiProtocolInfoDto addInvestTypeItem(String investTypeItem) { + if (this.investType == null) { + this.investType = new ArrayList<>(); + } + this.investType.add(investTypeItem); + return this; + } + + /** + * Investment types supported by this protocol — an array here (a protocol may support several). + * Note: the investment-level investType (in investment list/detail) is a single string. Known + * values: Earn, LiquidityPool. + * + * @return investType + */ + @jakarta.annotation.Nullable + public List getInvestType() { + return investType; + } + + public void setInvestType(@jakarta.annotation.Nullable List investType) { + this.investType = investType; + } + + public DefiProtocolInfoDto supportedChains( + @jakarta.annotation.Nullable List supportedChains) { + this.supportedChains = supportedChains; + return this; + } + + public DefiProtocolInfoDto addSupportedChainsItem(String supportedChainsItem) { + if (this.supportedChains == null) { + this.supportedChains = new ArrayList<>(); + } + this.supportedChains.add(supportedChainsItem); + return this; + } + + /** + * Supported Binance chain IDs. + * + * @return supportedChains + */ + @jakarta.annotation.Nullable + public List getSupportedChains() { + return supportedChains; + } + + public void setSupportedChains(@jakarta.annotation.Nullable List supportedChains) { + this.supportedChains = supportedChains; + } + + public DefiProtocolInfoDto tvl(@jakarta.annotation.Nullable String tvl) { + this.tvl = tvl; + return this; + } + + /** + * Total value locked (USD). String, raw precision from the data source. + * + * @return tvl + */ + @jakarta.annotation.Nullable + public String getTvl() { + return tvl; + } + + public void setTvl(@jakarta.annotation.Nullable String tvl) { + this.tvl = tvl; + } + + public DefiProtocolInfoDto tags(@jakarta.annotation.Nullable List tags) { + this.tags = tags; + return this; + } + + public DefiProtocolInfoDto addTagsItem(String tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList<>(); + } + this.tags.add(tagsItem); + return this; + } + + /** + * Protocol tags / categories. + * + * @return tags + */ + @jakarta.annotation.Nullable + public List getTags() { + return tags; + } + + public void setTags(@jakarta.annotation.Nullable List tags) { + this.tags = tags; + } + + public DefiProtocolInfoDto founded(@jakarta.annotation.Nullable String founded) { + this.founded = founded; + return this; + } + + /** + * Founding year (YYYY). + * + * @return founded + */ + @jakarta.annotation.Nullable + public String getFounded() { + return founded; + } + + public void setFounded(@jakarta.annotation.Nullable String founded) { + this.founded = founded; + } + + public DefiProtocolInfoDto fdv(@jakarta.annotation.Nullable String fdv) { + this.fdv = fdv; + return this; + } + + /** + * Fully diluted valuation. + * + * @return fdv + */ + @jakarta.annotation.Nullable + public String getFdv() { + return fdv; + } + + public void setFdv(@jakarta.annotation.Nullable String fdv) { + this.fdv = fdv; + } + + public DefiProtocolInfoDto totalFunding(@jakarta.annotation.Nullable String totalFunding) { + this.totalFunding = totalFunding; + return this; + } + + /** + * Total funding raised. Null when not disclosed. + * + * @return totalFunding + */ + @jakarta.annotation.Nullable + public String getTotalFunding() { + return totalFunding; + } + + public void setTotalFunding(@jakarta.annotation.Nullable String totalFunding) { + this.totalFunding = totalFunding; + } + + public DefiProtocolInfoDto socialLinks( + @jakarta.annotation.Nullable DefiProtocolInfoDtoSocialLinks socialLinks) { + this.socialLinks = socialLinks; + return this; + } + + /** + * Get socialLinks + * + * @return socialLinks + */ + @jakarta.annotation.Nullable + @Valid + public DefiProtocolInfoDtoSocialLinks getSocialLinks() { + return socialLinks; + } + + public void setSocialLinks( + @jakarta.annotation.Nullable DefiProtocolInfoDtoSocialLinks socialLinks) { + this.socialLinks = socialLinks; + } + + public DefiProtocolInfoDto team( + @jakarta.annotation.Nullable List<@Valid DefiProtocolInfoDtoTeamInner> team) { + this.team = team; + return this; + } + + public DefiProtocolInfoDto addTeamItem(DefiProtocolInfoDtoTeamInner teamItem) { + if (this.team == null) { + this.team = new ArrayList<>(); + } + this.team.add(teamItem); + return this; + } + + /** + * Team members. + * + * @return team + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid DefiProtocolInfoDtoTeamInner> getTeam() { + return team; + } + + public void setTeam( + @jakarta.annotation.Nullable List<@Valid DefiProtocolInfoDtoTeamInner> team) { + this.team = team; + } + + public DefiProtocolInfoDto fundRaising( + @jakarta.annotation.Nullable + List<@Valid DefiProtocolInfoDtoFundRaisingInner> fundRaising) { + this.fundRaising = fundRaising; + return this; + } + + public DefiProtocolInfoDto addFundRaisingItem( + DefiProtocolInfoDtoFundRaisingInner fundRaisingItem) { + if (this.fundRaising == null) { + this.fundRaising = new ArrayList<>(); + } + this.fundRaising.add(fundRaisingItem); + return this; + } + + /** + * Fundraising history. + * + * @return fundRaising + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid DefiProtocolInfoDtoFundRaisingInner> getFundRaising() { + return fundRaising; + } + + public void setFundRaising( + @jakarta.annotation.Nullable + List<@Valid DefiProtocolInfoDtoFundRaisingInner> fundRaising) { + this.fundRaising = fundRaising; + } + + public DefiProtocolInfoDto securityScore(@jakarta.annotation.Nullable String securityScore) { + this.securityScore = securityScore; + return this; + } + + /** + * Overall CertiK security score. + * + * @return securityScore + */ + @jakarta.annotation.Nullable + public String getSecurityScore() { + return securityScore; + } + + public void setSecurityScore(@jakarta.annotation.Nullable String securityScore) { + this.securityScore = securityScore; + } + + public DefiProtocolInfoDto dimensionScores( + @jakarta.annotation.Nullable DefiProtocolInfoDtoDimensionScores dimensionScores) { + this.dimensionScores = dimensionScores; + return this; + } + + /** + * Get dimensionScores + * + * @return dimensionScores + */ + @jakarta.annotation.Nullable + @Valid + public DefiProtocolInfoDtoDimensionScores getDimensionScores() { + return dimensionScores; + } + + public void setDimensionScores( + @jakarta.annotation.Nullable DefiProtocolInfoDtoDimensionScores dimensionScores) { + this.dimensionScores = dimensionScores; + } + + public DefiProtocolInfoDto highlights(@jakarta.annotation.Nullable List highlights) { + this.highlights = highlights; + return this; + } + + public DefiProtocolInfoDto addHighlightsItem(String highlightsItem) { + if (this.highlights == null) { + this.highlights = new ArrayList<>(); + } + this.highlights.add(highlightsItem); + return this; + } + + /** + * Protocol highlights (already translated; quote as-is). + * + * @return highlights + */ + @jakarta.annotation.Nullable + public List getHighlights() { + return highlights; + } + + public void setHighlights(@jakarta.annotation.Nullable List highlights) { + this.highlights = highlights; + } + + public DefiProtocolInfoDto faq( + @jakarta.annotation.Nullable List<@Valid DefiProtocolInfoDtoFaqInner> faq) { + this.faq = faq; + return this; + } + + public DefiProtocolInfoDto addFaqItem(DefiProtocolInfoDtoFaqInner faqItem) { + if (this.faq == null) { + this.faq = new ArrayList<>(); + } + this.faq.add(faqItem); + return this; + } + + /** + * FAQ entries (question and answer text, already translated). + * + * @return faq + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid DefiProtocolInfoDtoFaqInner> getFaq() { + return faq; + } + + public void setFaq(@jakarta.annotation.Nullable List<@Valid DefiProtocolInfoDtoFaqInner> faq) { + this.faq = faq; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DefiProtocolInfoDto defiProtocolInfoDto = (DefiProtocolInfoDto) o; + return Objects.equals(this.defiProtocolId, defiProtocolInfoDto.defiProtocolId) + && Objects.equals(this.protocolName, defiProtocolInfoDto.protocolName) + && Objects.equals(this.protocolLogo, defiProtocolInfoDto.protocolLogo) + && Objects.equals(this.description, defiProtocolInfoDto.description) + && Objects.equals(this.websiteUrl, defiProtocolInfoDto.websiteUrl) + && Objects.equals(this.investType, defiProtocolInfoDto.investType) + && Objects.equals(this.supportedChains, defiProtocolInfoDto.supportedChains) + && Objects.equals(this.tvl, defiProtocolInfoDto.tvl) + && Objects.equals(this.tags, defiProtocolInfoDto.tags) + && Objects.equals(this.founded, defiProtocolInfoDto.founded) + && Objects.equals(this.fdv, defiProtocolInfoDto.fdv) + && Objects.equals(this.totalFunding, defiProtocolInfoDto.totalFunding) + && Objects.equals(this.socialLinks, defiProtocolInfoDto.socialLinks) + && Objects.equals(this.team, defiProtocolInfoDto.team) + && Objects.equals(this.fundRaising, defiProtocolInfoDto.fundRaising) + && Objects.equals(this.securityScore, defiProtocolInfoDto.securityScore) + && Objects.equals(this.dimensionScores, defiProtocolInfoDto.dimensionScores) + && Objects.equals(this.highlights, defiProtocolInfoDto.highlights) + && Objects.equals(this.faq, defiProtocolInfoDto.faq); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash( + defiProtocolId, + protocolName, + protocolLogo, + description, + websiteUrl, + investType, + supportedChains, + tvl, + tags, + founded, + fdv, + totalFunding, + socialLinks, + team, + fundRaising, + securityScore, + dimensionScores, + highlights, + faq); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DefiProtocolInfoDto {\n"); + sb.append(" defiProtocolId: ").append(toIndentedString(defiProtocolId)).append("\n"); + sb.append(" protocolName: ").append(toIndentedString(protocolName)).append("\n"); + sb.append(" protocolLogo: ").append(toIndentedString(protocolLogo)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" websiteUrl: ").append(toIndentedString(websiteUrl)).append("\n"); + sb.append(" investType: ").append(toIndentedString(investType)).append("\n"); + sb.append(" supportedChains: ").append(toIndentedString(supportedChains)).append("\n"); + sb.append(" tvl: ").append(toIndentedString(tvl)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" founded: ").append(toIndentedString(founded)).append("\n"); + sb.append(" fdv: ").append(toIndentedString(fdv)).append("\n"); + sb.append(" totalFunding: ").append(toIndentedString(totalFunding)).append("\n"); + sb.append(" socialLinks: ").append(toIndentedString(socialLinks)).append("\n"); + sb.append(" team: ").append(toIndentedString(team)).append("\n"); + sb.append(" fundRaising: ").append(toIndentedString(fundRaising)).append("\n"); + sb.append(" securityScore: ").append(toIndentedString(securityScore)).append("\n"); + sb.append(" dimensionScores: ").append(toIndentedString(dimensionScores)).append("\n"); + sb.append(" highlights: ").append(toIndentedString(highlights)).append("\n"); + sb.append(" faq: ").append(toIndentedString(faq)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object defiProtocolIdValue = getDefiProtocolId(); + String defiProtocolIdValueAsString = ""; + defiProtocolIdValueAsString = defiProtocolIdValue.toString(); + sb.append("defiProtocolId=").append(urlEncode(defiProtocolIdValueAsString)).append(""); + Object protocolNameValue = getProtocolName(); + String protocolNameValueAsString = ""; + protocolNameValueAsString = protocolNameValue.toString(); + sb.append("protocolName=").append(urlEncode(protocolNameValueAsString)).append(""); + Object protocolLogoValue = getProtocolLogo(); + String protocolLogoValueAsString = ""; + protocolLogoValueAsString = protocolLogoValue.toString(); + sb.append("protocolLogo=").append(urlEncode(protocolLogoValueAsString)).append(""); + Object descriptionValue = getDescription(); + String descriptionValueAsString = ""; + descriptionValueAsString = descriptionValue.toString(); + sb.append("description=").append(urlEncode(descriptionValueAsString)).append(""); + Object websiteUrlValue = getWebsiteUrl(); + String websiteUrlValueAsString = ""; + websiteUrlValueAsString = websiteUrlValue.toString(); + sb.append("websiteUrl=").append(urlEncode(websiteUrlValueAsString)).append(""); + Object investTypeValue = getInvestType(); + String investTypeValueAsString = ""; + investTypeValueAsString = + (String) + ((Collection) investTypeValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("investType=").append(urlEncode(investTypeValueAsString)).append(""); + Object supportedChainsValue = getSupportedChains(); + String supportedChainsValueAsString = ""; + supportedChainsValueAsString = + (String) + ((Collection) supportedChainsValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("supportedChains=").append(urlEncode(supportedChainsValueAsString)).append(""); + Object tvlValue = getTvl(); + String tvlValueAsString = ""; + tvlValueAsString = tvlValue.toString(); + sb.append("tvl=").append(urlEncode(tvlValueAsString)).append(""); + Object tagsValue = getTags(); + String tagsValueAsString = ""; + tagsValueAsString = + (String) + ((Collection) tagsValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("tags=").append(urlEncode(tagsValueAsString)).append(""); + Object foundedValue = getFounded(); + String foundedValueAsString = ""; + foundedValueAsString = foundedValue.toString(); + sb.append("founded=").append(urlEncode(foundedValueAsString)).append(""); + Object fdvValue = getFdv(); + String fdvValueAsString = ""; + fdvValueAsString = fdvValue.toString(); + sb.append("fdv=").append(urlEncode(fdvValueAsString)).append(""); + Object totalFundingValue = getTotalFunding(); + String totalFundingValueAsString = ""; + totalFundingValueAsString = totalFundingValue.toString(); + sb.append("totalFunding=").append(urlEncode(totalFundingValueAsString)).append(""); + Object socialLinksValue = getSocialLinks(); + String socialLinksValueAsString = ""; + socialLinksValueAsString = socialLinksValue.toString(); + sb.append("socialLinks=").append(urlEncode(socialLinksValueAsString)).append(""); + Object teamValue = getTeam(); + String teamValueAsString = ""; + teamValueAsString = + (String) + ((Collection) teamValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("team=").append(urlEncode(teamValueAsString)).append(""); + Object fundRaisingValue = getFundRaising(); + String fundRaisingValueAsString = ""; + fundRaisingValueAsString = + (String) + ((Collection) fundRaisingValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("fundRaising=").append(urlEncode(fundRaisingValueAsString)).append(""); + Object securityScoreValue = getSecurityScore(); + String securityScoreValueAsString = ""; + securityScoreValueAsString = securityScoreValue.toString(); + sb.append("securityScore=").append(urlEncode(securityScoreValueAsString)).append(""); + Object dimensionScoresValue = getDimensionScores(); + String dimensionScoresValueAsString = ""; + dimensionScoresValueAsString = dimensionScoresValue.toString(); + sb.append("dimensionScores=").append(urlEncode(dimensionScoresValueAsString)).append(""); + Object highlightsValue = getHighlights(); + String highlightsValueAsString = ""; + highlightsValueAsString = + (String) + ((Collection) highlightsValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("highlights=").append(urlEncode(highlightsValueAsString)).append(""); + Object faqValue = getFaq(); + String faqValueAsString = ""; + faqValueAsString = + (String) + ((Collection) faqValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("faq=").append(urlEncode(faqValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("defiProtocolId"); + openapiFields.add("protocolName"); + openapiFields.add("protocolLogo"); + openapiFields.add("description"); + openapiFields.add("websiteUrl"); + openapiFields.add("investType"); + openapiFields.add("supportedChains"); + openapiFields.add("tvl"); + openapiFields.add("tags"); + openapiFields.add("founded"); + openapiFields.add("fdv"); + openapiFields.add("totalFunding"); + openapiFields.add("socialLinks"); + openapiFields.add("team"); + openapiFields.add("fundRaising"); + openapiFields.add("securityScore"); + openapiFields.add("dimensionScores"); + openapiFields.add("highlights"); + openapiFields.add("faq"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DefiProtocolInfoDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DefiProtocolInfoDto.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DefiProtocolInfoDto is not found in" + + " the empty JSON string", + DefiProtocolInfoDto.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("defiProtocolId") != null && !jsonObj.get("defiProtocolId").isJsonNull()) + && !jsonObj.get("defiProtocolId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `defiProtocolId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("defiProtocolId").toString())); + } + if ((jsonObj.get("protocolName") != null && !jsonObj.get("protocolName").isJsonNull()) + && !jsonObj.get("protocolName").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `protocolName` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("protocolName").toString())); + } + if ((jsonObj.get("protocolLogo") != null && !jsonObj.get("protocolLogo").isJsonNull()) + && !jsonObj.get("protocolLogo").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `protocolLogo` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("protocolLogo").toString())); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) + && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `description` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("description").toString())); + } + if ((jsonObj.get("websiteUrl") != null && !jsonObj.get("websiteUrl").isJsonNull()) + && !jsonObj.get("websiteUrl").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `websiteUrl` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("websiteUrl").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("investType") != null + && !jsonObj.get("investType").isJsonNull() + && !jsonObj.get("investType").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `investType` to be an array in the JSON string but" + + " got `%s`", + jsonObj.get("investType").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("supportedChains") != null + && !jsonObj.get("supportedChains").isJsonNull() + && !jsonObj.get("supportedChains").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `supportedChains` to be an array in the JSON string" + + " but got `%s`", + jsonObj.get("supportedChains").toString())); + } + if ((jsonObj.get("tvl") != null && !jsonObj.get("tvl").isJsonNull()) + && !jsonObj.get("tvl").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `tvl` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("tvl").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("tags") != null + && !jsonObj.get("tags").isJsonNull() + && !jsonObj.get("tags").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `tags` to be an array in the JSON string but got" + + " `%s`", + jsonObj.get("tags").toString())); + } + if ((jsonObj.get("founded") != null && !jsonObj.get("founded").isJsonNull()) + && !jsonObj.get("founded").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `founded` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("founded").toString())); + } + if ((jsonObj.get("fdv") != null && !jsonObj.get("fdv").isJsonNull()) + && !jsonObj.get("fdv").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `fdv` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("fdv").toString())); + } + if ((jsonObj.get("totalFunding") != null && !jsonObj.get("totalFunding").isJsonNull()) + && !jsonObj.get("totalFunding").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `totalFunding` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("totalFunding").toString())); + } + // validate the optional field `socialLinks` + if (jsonObj.get("socialLinks") != null && !jsonObj.get("socialLinks").isJsonNull()) { + DefiProtocolInfoDtoSocialLinks.validateJsonElement(jsonObj.get("socialLinks")); + } + if (jsonObj.get("team") != null && !jsonObj.get("team").isJsonNull()) { + JsonArray jsonArrayteam = jsonObj.getAsJsonArray("team"); + if (jsonArrayteam != null) { + // ensure the json data is an array + if (!jsonObj.get("team").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `team` to be an array in the JSON string" + + " but got `%s`", + jsonObj.get("team").toString())); + } + + // validate the optional field `team` (array) + for (int i = 0; i < jsonArrayteam.size(); i++) { + DefiProtocolInfoDtoTeamInner.validateJsonElement(jsonArrayteam.get(i)); + } + ; + } + } + if (jsonObj.get("fundRaising") != null && !jsonObj.get("fundRaising").isJsonNull()) { + JsonArray jsonArrayfundRaising = jsonObj.getAsJsonArray("fundRaising"); + if (jsonArrayfundRaising != null) { + // ensure the json data is an array + if (!jsonObj.get("fundRaising").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `fundRaising` to be an array in the JSON" + + " string but got `%s`", + jsonObj.get("fundRaising").toString())); + } + + // validate the optional field `fundRaising` (array) + for (int i = 0; i < jsonArrayfundRaising.size(); i++) { + DefiProtocolInfoDtoFundRaisingInner.validateJsonElement( + jsonArrayfundRaising.get(i)); + } + ; + } + } + if ((jsonObj.get("securityScore") != null && !jsonObj.get("securityScore").isJsonNull()) + && !jsonObj.get("securityScore").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `securityScore` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("securityScore").toString())); + } + // validate the optional field `dimensionScores` + if (jsonObj.get("dimensionScores") != null + && !jsonObj.get("dimensionScores").isJsonNull()) { + DefiProtocolInfoDtoDimensionScores.validateJsonElement(jsonObj.get("dimensionScores")); + } + // ensure the optional json data is an array if present + if (jsonObj.get("highlights") != null + && !jsonObj.get("highlights").isJsonNull() + && !jsonObj.get("highlights").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `highlights` to be an array in the JSON string but" + + " got `%s`", + jsonObj.get("highlights").toString())); + } + if (jsonObj.get("faq") != null && !jsonObj.get("faq").isJsonNull()) { + JsonArray jsonArrayfaq = jsonObj.getAsJsonArray("faq"); + if (jsonArrayfaq != null) { + // ensure the json data is an array + if (!jsonObj.get("faq").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `faq` to be an array in the JSON string but" + + " got `%s`", + jsonObj.get("faq").toString())); + } + + // validate the optional field `faq` (array) + for (int i = 0; i < jsonArrayfaq.size(); i++) { + DefiProtocolInfoDtoFaqInner.validateJsonElement(jsonArrayfaq.get(i)); + } + ; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DefiProtocolInfoDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DefiProtocolInfoDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(DefiProtocolInfoDto.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DefiProtocolInfoDto value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DefiProtocolInfoDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DefiProtocolInfoDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of DefiProtocolInfoDto + * @throws IOException if the JSON string is invalid with respect to DefiProtocolInfoDto + */ + public static DefiProtocolInfoDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DefiProtocolInfoDto.class); + } + + /** + * Convert an instance of DefiProtocolInfoDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiProtocolInfoDtoDimensionScores.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiProtocolInfoDtoDimensionScores.java new file mode 100644 index 0000000..aa5db98 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiProtocolInfoDtoDimensionScores.java @@ -0,0 +1,452 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** CertiK six-dimension security scores. */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class DefiProtocolInfoDtoDimensionScores { + public static final String SERIALIZED_NAME_CODE_SECURITY = "codeSecurity"; + + @SerializedName(SERIALIZED_NAME_CODE_SECURITY) + @jakarta.annotation.Nullable + private String codeSecurity; + + public static final String SERIALIZED_NAME_FUNDAMENTAL_HEALTH = "fundamentalHealth"; + + @SerializedName(SERIALIZED_NAME_FUNDAMENTAL_HEALTH) + @jakarta.annotation.Nullable + private String fundamentalHealth; + + public static final String SERIALIZED_NAME_OPERATIONAL_RESILIENCE = "operationalResilience"; + + @SerializedName(SERIALIZED_NAME_OPERATIONAL_RESILIENCE) + @jakarta.annotation.Nullable + private String operationalResilience; + + public static final String SERIALIZED_NAME_COMMUNITY_TRUST = "communityTrust"; + + @SerializedName(SERIALIZED_NAME_COMMUNITY_TRUST) + @jakarta.annotation.Nullable + private String communityTrust; + + public static final String SERIALIZED_NAME_GOVERNANCE_STRENGTH = "governanceStrength"; + + @SerializedName(SERIALIZED_NAME_GOVERNANCE_STRENGTH) + @jakarta.annotation.Nullable + private String governanceStrength; + + public static final String SERIALIZED_NAME_MARKET_STABILITY = "marketStability"; + + @SerializedName(SERIALIZED_NAME_MARKET_STABILITY) + @jakarta.annotation.Nullable + private String marketStability; + + public DefiProtocolInfoDtoDimensionScores() {} + + public DefiProtocolInfoDtoDimensionScores codeSecurity( + @jakarta.annotation.Nullable String codeSecurity) { + this.codeSecurity = codeSecurity; + return this; + } + + /** + * Code security score. + * + * @return codeSecurity + */ + @jakarta.annotation.Nullable + public String getCodeSecurity() { + return codeSecurity; + } + + public void setCodeSecurity(@jakarta.annotation.Nullable String codeSecurity) { + this.codeSecurity = codeSecurity; + } + + public DefiProtocolInfoDtoDimensionScores fundamentalHealth( + @jakarta.annotation.Nullable String fundamentalHealth) { + this.fundamentalHealth = fundamentalHealth; + return this; + } + + /** + * Fundamental health score. + * + * @return fundamentalHealth + */ + @jakarta.annotation.Nullable + public String getFundamentalHealth() { + return fundamentalHealth; + } + + public void setFundamentalHealth(@jakarta.annotation.Nullable String fundamentalHealth) { + this.fundamentalHealth = fundamentalHealth; + } + + public DefiProtocolInfoDtoDimensionScores operationalResilience( + @jakarta.annotation.Nullable String operationalResilience) { + this.operationalResilience = operationalResilience; + return this; + } + + /** + * Operational resilience score. + * + * @return operationalResilience + */ + @jakarta.annotation.Nullable + public String getOperationalResilience() { + return operationalResilience; + } + + public void setOperationalResilience( + @jakarta.annotation.Nullable String operationalResilience) { + this.operationalResilience = operationalResilience; + } + + public DefiProtocolInfoDtoDimensionScores communityTrust( + @jakarta.annotation.Nullable String communityTrust) { + this.communityTrust = communityTrust; + return this; + } + + /** + * Community trust score. + * + * @return communityTrust + */ + @jakarta.annotation.Nullable + public String getCommunityTrust() { + return communityTrust; + } + + public void setCommunityTrust(@jakarta.annotation.Nullable String communityTrust) { + this.communityTrust = communityTrust; + } + + public DefiProtocolInfoDtoDimensionScores governanceStrength( + @jakarta.annotation.Nullable String governanceStrength) { + this.governanceStrength = governanceStrength; + return this; + } + + /** + * Governance strength score. + * + * @return governanceStrength + */ + @jakarta.annotation.Nullable + public String getGovernanceStrength() { + return governanceStrength; + } + + public void setGovernanceStrength(@jakarta.annotation.Nullable String governanceStrength) { + this.governanceStrength = governanceStrength; + } + + public DefiProtocolInfoDtoDimensionScores marketStability( + @jakarta.annotation.Nullable String marketStability) { + this.marketStability = marketStability; + return this; + } + + /** + * Market stability score. + * + * @return marketStability + */ + @jakarta.annotation.Nullable + public String getMarketStability() { + return marketStability; + } + + public void setMarketStability(@jakarta.annotation.Nullable String marketStability) { + this.marketStability = marketStability; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DefiProtocolInfoDtoDimensionScores defiProtocolInfoDtoDimensionScores = + (DefiProtocolInfoDtoDimensionScores) o; + return Objects.equals(this.codeSecurity, defiProtocolInfoDtoDimensionScores.codeSecurity) + && Objects.equals( + this.fundamentalHealth, + defiProtocolInfoDtoDimensionScores.fundamentalHealth) + && Objects.equals( + this.operationalResilience, + defiProtocolInfoDtoDimensionScores.operationalResilience) + && Objects.equals( + this.communityTrust, defiProtocolInfoDtoDimensionScores.communityTrust) + && Objects.equals( + this.governanceStrength, + defiProtocolInfoDtoDimensionScores.governanceStrength) + && Objects.equals( + this.marketStability, defiProtocolInfoDtoDimensionScores.marketStability); + } + + @Override + public int hashCode() { + return Objects.hash( + codeSecurity, + fundamentalHealth, + operationalResilience, + communityTrust, + governanceStrength, + marketStability); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DefiProtocolInfoDtoDimensionScores {\n"); + sb.append(" codeSecurity: ").append(toIndentedString(codeSecurity)).append("\n"); + sb.append(" fundamentalHealth: ").append(toIndentedString(fundamentalHealth)).append("\n"); + sb.append(" operationalResilience: ") + .append(toIndentedString(operationalResilience)) + .append("\n"); + sb.append(" communityTrust: ").append(toIndentedString(communityTrust)).append("\n"); + sb.append(" governanceStrength: ") + .append(toIndentedString(governanceStrength)) + .append("\n"); + sb.append(" marketStability: ").append(toIndentedString(marketStability)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object codeSecurityValue = getCodeSecurity(); + String codeSecurityValueAsString = ""; + codeSecurityValueAsString = codeSecurityValue.toString(); + sb.append("codeSecurity=").append(urlEncode(codeSecurityValueAsString)).append(""); + Object fundamentalHealthValue = getFundamentalHealth(); + String fundamentalHealthValueAsString = ""; + fundamentalHealthValueAsString = fundamentalHealthValue.toString(); + sb.append("fundamentalHealth=") + .append(urlEncode(fundamentalHealthValueAsString)) + .append(""); + Object operationalResilienceValue = getOperationalResilience(); + String operationalResilienceValueAsString = ""; + operationalResilienceValueAsString = operationalResilienceValue.toString(); + sb.append("operationalResilience=") + .append(urlEncode(operationalResilienceValueAsString)) + .append(""); + Object communityTrustValue = getCommunityTrust(); + String communityTrustValueAsString = ""; + communityTrustValueAsString = communityTrustValue.toString(); + sb.append("communityTrust=").append(urlEncode(communityTrustValueAsString)).append(""); + Object governanceStrengthValue = getGovernanceStrength(); + String governanceStrengthValueAsString = ""; + governanceStrengthValueAsString = governanceStrengthValue.toString(); + sb.append("governanceStrength=") + .append(urlEncode(governanceStrengthValueAsString)) + .append(""); + Object marketStabilityValue = getMarketStability(); + String marketStabilityValueAsString = ""; + marketStabilityValueAsString = marketStabilityValue.toString(); + sb.append("marketStability=").append(urlEncode(marketStabilityValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("codeSecurity"); + openapiFields.add("fundamentalHealth"); + openapiFields.add("operationalResilience"); + openapiFields.add("communityTrust"); + openapiFields.add("governanceStrength"); + openapiFields.add("marketStability"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * DefiProtocolInfoDtoDimensionScores + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DefiProtocolInfoDtoDimensionScores.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DefiProtocolInfoDtoDimensionScores is" + + " not found in the empty JSON string", + DefiProtocolInfoDtoDimensionScores.openapiRequiredFields + .toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("codeSecurity") != null && !jsonObj.get("codeSecurity").isJsonNull()) + && !jsonObj.get("codeSecurity").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `codeSecurity` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("codeSecurity").toString())); + } + if ((jsonObj.get("fundamentalHealth") != null + && !jsonObj.get("fundamentalHealth").isJsonNull()) + && !jsonObj.get("fundamentalHealth").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `fundamentalHealth` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("fundamentalHealth").toString())); + } + if ((jsonObj.get("operationalResilience") != null + && !jsonObj.get("operationalResilience").isJsonNull()) + && !jsonObj.get("operationalResilience").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `operationalResilience` to be a primitive type in" + + " the JSON string but got `%s`", + jsonObj.get("operationalResilience").toString())); + } + if ((jsonObj.get("communityTrust") != null && !jsonObj.get("communityTrust").isJsonNull()) + && !jsonObj.get("communityTrust").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `communityTrust` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("communityTrust").toString())); + } + if ((jsonObj.get("governanceStrength") != null + && !jsonObj.get("governanceStrength").isJsonNull()) + && !jsonObj.get("governanceStrength").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `governanceStrength` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("governanceStrength").toString())); + } + if ((jsonObj.get("marketStability") != null && !jsonObj.get("marketStability").isJsonNull()) + && !jsonObj.get("marketStability").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `marketStability` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("marketStability").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DefiProtocolInfoDtoDimensionScores.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DefiProtocolInfoDtoDimensionScores' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(DefiProtocolInfoDtoDimensionScores.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DefiProtocolInfoDtoDimensionScores value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DefiProtocolInfoDtoDimensionScores read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DefiProtocolInfoDtoDimensionScores given an JSON string + * + * @param jsonString JSON string + * @return An instance of DefiProtocolInfoDtoDimensionScores + * @throws IOException if the JSON string is invalid with respect to + * DefiProtocolInfoDtoDimensionScores + */ + public static DefiProtocolInfoDtoDimensionScores fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, DefiProtocolInfoDtoDimensionScores.class); + } + + /** + * Convert an instance of DefiProtocolInfoDtoDimensionScores to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiProtocolInfoDtoFaqInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiProtocolInfoDtoFaqInner.java new file mode 100644 index 0000000..7734ca5 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiProtocolInfoDtoFaqInner.java @@ -0,0 +1,254 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** FAQ entry. */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class DefiProtocolInfoDtoFaqInner { + public static final String SERIALIZED_NAME_TITLE = "title"; + + @SerializedName(SERIALIZED_NAME_TITLE) + @jakarta.annotation.Nullable + private String title; + + public static final String SERIALIZED_NAME_ANSWER = "answer"; + + @SerializedName(SERIALIZED_NAME_ANSWER) + @jakarta.annotation.Nullable + private String answer; + + public DefiProtocolInfoDtoFaqInner() {} + + public DefiProtocolInfoDtoFaqInner title(@jakarta.annotation.Nullable String title) { + this.title = title; + return this; + } + + /** + * FAQ question text (already translated; quote as-is). + * + * @return title + */ + @jakarta.annotation.Nullable + public String getTitle() { + return title; + } + + public void setTitle(@jakarta.annotation.Nullable String title) { + this.title = title; + } + + public DefiProtocolInfoDtoFaqInner answer(@jakarta.annotation.Nullable String answer) { + this.answer = answer; + return this; + } + + /** + * FAQ answer text (already translated; quote as-is). May contain line-break markup + * `<Br/>` and paragraph-gap markup `<Gap/>` — interpret them as + * line / paragraph breaks. + * + * @return answer + */ + @jakarta.annotation.Nullable + public String getAnswer() { + return answer; + } + + public void setAnswer(@jakarta.annotation.Nullable String answer) { + this.answer = answer; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DefiProtocolInfoDtoFaqInner defiProtocolInfoDtoFaqInner = (DefiProtocolInfoDtoFaqInner) o; + return Objects.equals(this.title, defiProtocolInfoDtoFaqInner.title) + && Objects.equals(this.answer, defiProtocolInfoDtoFaqInner.answer); + } + + @Override + public int hashCode() { + return Objects.hash(title, answer); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DefiProtocolInfoDtoFaqInner {\n"); + sb.append(" title: ").append(toIndentedString(title)).append("\n"); + sb.append(" answer: ").append(toIndentedString(answer)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object titleValue = getTitle(); + String titleValueAsString = ""; + titleValueAsString = titleValue.toString(); + sb.append("title=").append(urlEncode(titleValueAsString)).append(""); + Object answerValue = getAnswer(); + String answerValueAsString = ""; + answerValueAsString = answerValue.toString(); + sb.append("answer=").append(urlEncode(answerValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("title"); + openapiFields.add("answer"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * DefiProtocolInfoDtoFaqInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DefiProtocolInfoDtoFaqInner.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DefiProtocolInfoDtoFaqInner is not" + + " found in the empty JSON string", + DefiProtocolInfoDtoFaqInner.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("title") != null && !jsonObj.get("title").isJsonNull()) + && !jsonObj.get("title").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `title` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("title").toString())); + } + if ((jsonObj.get("answer") != null && !jsonObj.get("answer").isJsonNull()) + && !jsonObj.get("answer").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `answer` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("answer").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DefiProtocolInfoDtoFaqInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DefiProtocolInfoDtoFaqInner' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(DefiProtocolInfoDtoFaqInner.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DefiProtocolInfoDtoFaqInner value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DefiProtocolInfoDtoFaqInner read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DefiProtocolInfoDtoFaqInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of DefiProtocolInfoDtoFaqInner + * @throws IOException if the JSON string is invalid with respect to DefiProtocolInfoDtoFaqInner + */ + public static DefiProtocolInfoDtoFaqInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DefiProtocolInfoDtoFaqInner.class); + } + + /** + * Convert an instance of DefiProtocolInfoDtoFaqInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiProtocolInfoDtoFundRaisingInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiProtocolInfoDtoFundRaisingInner.java new file mode 100644 index 0000000..9adcb42 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiProtocolInfoDtoFundRaisingInner.java @@ -0,0 +1,374 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** Fundraising round. */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class DefiProtocolInfoDtoFundRaisingInner { + public static final String SERIALIZED_NAME_ROUND = "round"; + + @SerializedName(SERIALIZED_NAME_ROUND) + @jakarta.annotation.Nullable + private String round; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + + @SerializedName(SERIALIZED_NAME_AMOUNT) + @jakarta.annotation.Nullable + private String amount; + + public static final String SERIALIZED_NAME_DATE = "date"; + + @SerializedName(SERIALIZED_NAME_DATE) + @jakarta.annotation.Nullable + private String date; + + public static final String SERIALIZED_NAME_INVESTORS = "investors"; + + @SerializedName(SERIALIZED_NAME_INVESTORS) + @jakarta.annotation.Nullable + private List investors; + + public DefiProtocolInfoDtoFundRaisingInner() {} + + public DefiProtocolInfoDtoFundRaisingInner round(@jakarta.annotation.Nullable String round) { + this.round = round; + return this; + } + + /** + * Round name (e.g. \"Strategic\"). + * + * @return round + */ + @jakarta.annotation.Nullable + public String getRound() { + return round; + } + + public void setRound(@jakarta.annotation.Nullable String round) { + this.round = round; + } + + public DefiProtocolInfoDtoFundRaisingInner amount(@jakarta.annotation.Nullable String amount) { + this.amount = amount; + return this; + } + + /** + * Amount raised. Null when not disclosed. + * + * @return amount + */ + @jakarta.annotation.Nullable + public String getAmount() { + return amount; + } + + public void setAmount(@jakarta.annotation.Nullable String amount) { + this.amount = amount; + } + + public DefiProtocolInfoDtoFundRaisingInner date(@jakarta.annotation.Nullable String date) { + this.date = date; + return this; + } + + /** + * Round date. + * + * @return date + */ + @jakarta.annotation.Nullable + public String getDate() { + return date; + } + + public void setDate(@jakarta.annotation.Nullable String date) { + this.date = date; + } + + public DefiProtocolInfoDtoFundRaisingInner investors( + @jakarta.annotation.Nullable List investors) { + this.investors = investors; + return this; + } + + public DefiProtocolInfoDtoFundRaisingInner addInvestorsItem(String investorsItem) { + if (this.investors == null) { + this.investors = new ArrayList<>(); + } + this.investors.add(investorsItem); + return this; + } + + /** + * Investor names. + * + * @return investors + */ + @jakarta.annotation.Nullable + public List getInvestors() { + return investors; + } + + public void setInvestors(@jakarta.annotation.Nullable List investors) { + this.investors = investors; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DefiProtocolInfoDtoFundRaisingInner defiProtocolInfoDtoFundRaisingInner = + (DefiProtocolInfoDtoFundRaisingInner) o; + return Objects.equals(this.round, defiProtocolInfoDtoFundRaisingInner.round) + && Objects.equals(this.amount, defiProtocolInfoDtoFundRaisingInner.amount) + && Objects.equals(this.date, defiProtocolInfoDtoFundRaisingInner.date) + && Objects.equals(this.investors, defiProtocolInfoDtoFundRaisingInner.investors); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(round, amount, date, investors); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DefiProtocolInfoDtoFundRaisingInner {\n"); + sb.append(" round: ").append(toIndentedString(round)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" date: ").append(toIndentedString(date)).append("\n"); + sb.append(" investors: ").append(toIndentedString(investors)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object roundValue = getRound(); + String roundValueAsString = ""; + roundValueAsString = roundValue.toString(); + sb.append("round=").append(urlEncode(roundValueAsString)).append(""); + Object amountValue = getAmount(); + String amountValueAsString = ""; + amountValueAsString = amountValue.toString(); + sb.append("amount=").append(urlEncode(amountValueAsString)).append(""); + Object dateValue = getDate(); + String dateValueAsString = ""; + dateValueAsString = dateValue.toString(); + sb.append("date=").append(urlEncode(dateValueAsString)).append(""); + Object investorsValue = getInvestors(); + String investorsValueAsString = ""; + investorsValueAsString = + (String) + ((Collection) investorsValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("investors=").append(urlEncode(investorsValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("round"); + openapiFields.add("amount"); + openapiFields.add("date"); + openapiFields.add("investors"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * DefiProtocolInfoDtoFundRaisingInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DefiProtocolInfoDtoFundRaisingInner.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DefiProtocolInfoDtoFundRaisingInner is" + + " not found in the empty JSON string", + DefiProtocolInfoDtoFundRaisingInner.openapiRequiredFields + .toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("round") != null && !jsonObj.get("round").isJsonNull()) + && !jsonObj.get("round").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `round` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("round").toString())); + } + if ((jsonObj.get("amount") != null && !jsonObj.get("amount").isJsonNull()) + && !jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `amount` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("amount").toString())); + } + if ((jsonObj.get("date") != null && !jsonObj.get("date").isJsonNull()) + && !jsonObj.get("date").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `date` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("date").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("investors") != null + && !jsonObj.get("investors").isJsonNull() + && !jsonObj.get("investors").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `investors` to be an array in the JSON string but" + + " got `%s`", + jsonObj.get("investors").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DefiProtocolInfoDtoFundRaisingInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DefiProtocolInfoDtoFundRaisingInner' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(DefiProtocolInfoDtoFundRaisingInner.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DefiProtocolInfoDtoFundRaisingInner value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DefiProtocolInfoDtoFundRaisingInner read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DefiProtocolInfoDtoFundRaisingInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of DefiProtocolInfoDtoFundRaisingInner + * @throws IOException if the JSON string is invalid with respect to + * DefiProtocolInfoDtoFundRaisingInner + */ + public static DefiProtocolInfoDtoFundRaisingInner fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, DefiProtocolInfoDtoFundRaisingInner.class); + } + + /** + * Convert an instance of DefiProtocolInfoDtoFundRaisingInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiProtocolInfoDtoSocialLinks.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiProtocolInfoDtoSocialLinks.java new file mode 100644 index 0000000..9591e13 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiProtocolInfoDtoSocialLinks.java @@ -0,0 +1,475 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** Protocol social media links. */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class DefiProtocolInfoDtoSocialLinks { + public static final String SERIALIZED_NAME_X_LOWER_CASE = "x"; + + @SerializedName(SERIALIZED_NAME_X_LOWER_CASE) + @jakarta.annotation.Nullable + private String xLowerCase; + + public static final String SERIALIZED_NAME_DISCORD = "discord"; + + @SerializedName(SERIALIZED_NAME_DISCORD) + @jakarta.annotation.Nullable + private String discord; + + public static final String SERIALIZED_NAME_GITHUB = "github"; + + @SerializedName(SERIALIZED_NAME_GITHUB) + @jakarta.annotation.Nullable + private String github; + + public static final String SERIALIZED_NAME_LINKEDIN = "linkedin"; + + @SerializedName(SERIALIZED_NAME_LINKEDIN) + @jakarta.annotation.Nullable + private String linkedin; + + public static final String SERIALIZED_NAME_TELEGRAM = "telegram"; + + @SerializedName(SERIALIZED_NAME_TELEGRAM) + @jakarta.annotation.Nullable + private String telegram; + + public static final String SERIALIZED_NAME_GITBOOK = "gitbook"; + + @SerializedName(SERIALIZED_NAME_GITBOOK) + @jakarta.annotation.Nullable + private String gitbook; + + public static final String SERIALIZED_NAME_WEBSITE = "website"; + + @SerializedName(SERIALIZED_NAME_WEBSITE) + @jakarta.annotation.Nullable + private String website; + + public DefiProtocolInfoDtoSocialLinks() {} + + public DefiProtocolInfoDtoSocialLinks xLowerCase( + @jakarta.annotation.Nullable String xLowerCase) { + this.xLowerCase = xLowerCase; + return this; + } + + /** + * X (Twitter) profile URL. Null when not available. + * + * @return xLowerCase + */ + @jakarta.annotation.Nullable + public String getxLowerCase() { + return xLowerCase; + } + + public void setxLowerCase(@jakarta.annotation.Nullable String xLowerCase) { + this.xLowerCase = xLowerCase; + } + + public DefiProtocolInfoDtoSocialLinks discord(@jakarta.annotation.Nullable String discord) { + this.discord = discord; + return this; + } + + /** + * Discord invite URL. Null when not available. + * + * @return discord + */ + @jakarta.annotation.Nullable + public String getDiscord() { + return discord; + } + + public void setDiscord(@jakarta.annotation.Nullable String discord) { + this.discord = discord; + } + + public DefiProtocolInfoDtoSocialLinks github(@jakarta.annotation.Nullable String github) { + this.github = github; + return this; + } + + /** + * GitHub organization URL. Null when not available. + * + * @return github + */ + @jakarta.annotation.Nullable + public String getGithub() { + return github; + } + + public void setGithub(@jakarta.annotation.Nullable String github) { + this.github = github; + } + + public DefiProtocolInfoDtoSocialLinks linkedin(@jakarta.annotation.Nullable String linkedin) { + this.linkedin = linkedin; + return this; + } + + /** + * LinkedIn company URL. Null when not available. + * + * @return linkedin + */ + @jakarta.annotation.Nullable + public String getLinkedin() { + return linkedin; + } + + public void setLinkedin(@jakarta.annotation.Nullable String linkedin) { + this.linkedin = linkedin; + } + + public DefiProtocolInfoDtoSocialLinks telegram(@jakarta.annotation.Nullable String telegram) { + this.telegram = telegram; + return this; + } + + /** + * Telegram channel URL. Null when not available. + * + * @return telegram + */ + @jakarta.annotation.Nullable + public String getTelegram() { + return telegram; + } + + public void setTelegram(@jakarta.annotation.Nullable String telegram) { + this.telegram = telegram; + } + + public DefiProtocolInfoDtoSocialLinks gitbook(@jakarta.annotation.Nullable String gitbook) { + this.gitbook = gitbook; + return this; + } + + /** + * GitBook documentation URL. Empty string or null when not available. + * + * @return gitbook + */ + @jakarta.annotation.Nullable + public String getGitbook() { + return gitbook; + } + + public void setGitbook(@jakarta.annotation.Nullable String gitbook) { + this.gitbook = gitbook; + } + + public DefiProtocolInfoDtoSocialLinks website(@jakarta.annotation.Nullable String website) { + this.website = website; + return this; + } + + /** + * Official website URL. + * + * @return website + */ + @jakarta.annotation.Nullable + public String getWebsite() { + return website; + } + + public void setWebsite(@jakarta.annotation.Nullable String website) { + this.website = website; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DefiProtocolInfoDtoSocialLinks defiProtocolInfoDtoSocialLinks = + (DefiProtocolInfoDtoSocialLinks) o; + return Objects.equals(this.xLowerCase, defiProtocolInfoDtoSocialLinks.xLowerCase) + && Objects.equals(this.discord, defiProtocolInfoDtoSocialLinks.discord) + && Objects.equals(this.github, defiProtocolInfoDtoSocialLinks.github) + && Objects.equals(this.linkedin, defiProtocolInfoDtoSocialLinks.linkedin) + && Objects.equals(this.telegram, defiProtocolInfoDtoSocialLinks.telegram) + && Objects.equals(this.gitbook, defiProtocolInfoDtoSocialLinks.gitbook) + && Objects.equals(this.website, defiProtocolInfoDtoSocialLinks.website); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(xLowerCase, discord, github, linkedin, telegram, gitbook, website); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DefiProtocolInfoDtoSocialLinks {\n"); + sb.append(" xLowerCase: ").append(toIndentedString(xLowerCase)).append("\n"); + sb.append(" discord: ").append(toIndentedString(discord)).append("\n"); + sb.append(" github: ").append(toIndentedString(github)).append("\n"); + sb.append(" linkedin: ").append(toIndentedString(linkedin)).append("\n"); + sb.append(" telegram: ").append(toIndentedString(telegram)).append("\n"); + sb.append(" gitbook: ").append(toIndentedString(gitbook)).append("\n"); + sb.append(" website: ").append(toIndentedString(website)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object xLowerCaseValue = getxLowerCase(); + String xLowerCaseValueAsString = ""; + xLowerCaseValueAsString = xLowerCaseValue.toString(); + sb.append("xLowerCase=").append(urlEncode(xLowerCaseValueAsString)).append(""); + Object discordValue = getDiscord(); + String discordValueAsString = ""; + discordValueAsString = discordValue.toString(); + sb.append("discord=").append(urlEncode(discordValueAsString)).append(""); + Object githubValue = getGithub(); + String githubValueAsString = ""; + githubValueAsString = githubValue.toString(); + sb.append("github=").append(urlEncode(githubValueAsString)).append(""); + Object linkedinValue = getLinkedin(); + String linkedinValueAsString = ""; + linkedinValueAsString = linkedinValue.toString(); + sb.append("linkedin=").append(urlEncode(linkedinValueAsString)).append(""); + Object telegramValue = getTelegram(); + String telegramValueAsString = ""; + telegramValueAsString = telegramValue.toString(); + sb.append("telegram=").append(urlEncode(telegramValueAsString)).append(""); + Object gitbookValue = getGitbook(); + String gitbookValueAsString = ""; + gitbookValueAsString = gitbookValue.toString(); + sb.append("gitbook=").append(urlEncode(gitbookValueAsString)).append(""); + Object websiteValue = getWebsite(); + String websiteValueAsString = ""; + websiteValueAsString = websiteValue.toString(); + sb.append("website=").append(urlEncode(websiteValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("x"); + openapiFields.add("discord"); + openapiFields.add("github"); + openapiFields.add("linkedin"); + openapiFields.add("telegram"); + openapiFields.add("gitbook"); + openapiFields.add("website"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * DefiProtocolInfoDtoSocialLinks + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DefiProtocolInfoDtoSocialLinks.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DefiProtocolInfoDtoSocialLinks is not" + + " found in the empty JSON string", + DefiProtocolInfoDtoSocialLinks.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("x") != null && !jsonObj.get("x").isJsonNull()) + && !jsonObj.get("x").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `x` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("x").toString())); + } + if ((jsonObj.get("discord") != null && !jsonObj.get("discord").isJsonNull()) + && !jsonObj.get("discord").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `discord` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("discord").toString())); + } + if ((jsonObj.get("github") != null && !jsonObj.get("github").isJsonNull()) + && !jsonObj.get("github").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `github` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("github").toString())); + } + if ((jsonObj.get("linkedin") != null && !jsonObj.get("linkedin").isJsonNull()) + && !jsonObj.get("linkedin").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `linkedin` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("linkedin").toString())); + } + if ((jsonObj.get("telegram") != null && !jsonObj.get("telegram").isJsonNull()) + && !jsonObj.get("telegram").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `telegram` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("telegram").toString())); + } + if ((jsonObj.get("gitbook") != null && !jsonObj.get("gitbook").isJsonNull()) + && !jsonObj.get("gitbook").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `gitbook` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("gitbook").toString())); + } + if ((jsonObj.get("website") != null && !jsonObj.get("website").isJsonNull()) + && !jsonObj.get("website").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `website` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("website").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DefiProtocolInfoDtoSocialLinks.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DefiProtocolInfoDtoSocialLinks' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(DefiProtocolInfoDtoSocialLinks.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DefiProtocolInfoDtoSocialLinks value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DefiProtocolInfoDtoSocialLinks read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DefiProtocolInfoDtoSocialLinks given an JSON string + * + * @param jsonString JSON string + * @return An instance of DefiProtocolInfoDtoSocialLinks + * @throws IOException if the JSON string is invalid with respect to + * DefiProtocolInfoDtoSocialLinks + */ + public static DefiProtocolInfoDtoSocialLinks fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DefiProtocolInfoDtoSocialLinks.class); + } + + /** + * Convert an instance of DefiProtocolInfoDtoSocialLinks to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiProtocolInfoDtoTeamInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiProtocolInfoDtoTeamInner.java new file mode 100644 index 0000000..22bed9a --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiProtocolInfoDtoTeamInner.java @@ -0,0 +1,393 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** Protocol team member. */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class DefiProtocolInfoDtoTeamInner { + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @jakarta.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_ROLE = "role"; + + @SerializedName(SERIALIZED_NAME_ROLE) + @jakarta.annotation.Nullable + private String role; + + public static final String SERIALIZED_NAME_TWITTER = "twitter"; + + @SerializedName(SERIALIZED_NAME_TWITTER) + @jakarta.annotation.Nullable + private String twitter; + + public static final String SERIALIZED_NAME_LINKEDIN = "linkedin"; + + @SerializedName(SERIALIZED_NAME_LINKEDIN) + @jakarta.annotation.Nullable + private String linkedin; + + public static final String SERIALIZED_NAME_BIO = "bio"; + + @SerializedName(SERIALIZED_NAME_BIO) + @jakarta.annotation.Nullable + private String bio; + + public DefiProtocolInfoDtoTeamInner() {} + + public DefiProtocolInfoDtoTeamInner name(@jakarta.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Member name. + * + * @return name + */ + @jakarta.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@jakarta.annotation.Nullable String name) { + this.name = name; + } + + public DefiProtocolInfoDtoTeamInner role(@jakarta.annotation.Nullable String role) { + this.role = role; + return this; + } + + /** + * Member role / title. + * + * @return role + */ + @jakarta.annotation.Nullable + public String getRole() { + return role; + } + + public void setRole(@jakarta.annotation.Nullable String role) { + this.role = role; + } + + public DefiProtocolInfoDtoTeamInner twitter(@jakarta.annotation.Nullable String twitter) { + this.twitter = twitter; + return this; + } + + /** + * Member's X (Twitter) handle URL. Null when not available. + * + * @return twitter + */ + @jakarta.annotation.Nullable + public String getTwitter() { + return twitter; + } + + public void setTwitter(@jakarta.annotation.Nullable String twitter) { + this.twitter = twitter; + } + + public DefiProtocolInfoDtoTeamInner linkedin(@jakarta.annotation.Nullable String linkedin) { + this.linkedin = linkedin; + return this; + } + + /** + * Member's LinkedIn URL. Null when not available. + * + * @return linkedin + */ + @jakarta.annotation.Nullable + public String getLinkedin() { + return linkedin; + } + + public void setLinkedin(@jakarta.annotation.Nullable String linkedin) { + this.linkedin = linkedin; + } + + public DefiProtocolInfoDtoTeamInner bio(@jakarta.annotation.Nullable String bio) { + this.bio = bio; + return this; + } + + /** + * Member biography. Null when not available. + * + * @return bio + */ + @jakarta.annotation.Nullable + public String getBio() { + return bio; + } + + public void setBio(@jakarta.annotation.Nullable String bio) { + this.bio = bio; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DefiProtocolInfoDtoTeamInner defiProtocolInfoDtoTeamInner = + (DefiProtocolInfoDtoTeamInner) o; + return Objects.equals(this.name, defiProtocolInfoDtoTeamInner.name) + && Objects.equals(this.role, defiProtocolInfoDtoTeamInner.role) + && Objects.equals(this.twitter, defiProtocolInfoDtoTeamInner.twitter) + && Objects.equals(this.linkedin, defiProtocolInfoDtoTeamInner.linkedin) + && Objects.equals(this.bio, defiProtocolInfoDtoTeamInner.bio); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(name, role, twitter, linkedin, bio); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DefiProtocolInfoDtoTeamInner {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" role: ").append(toIndentedString(role)).append("\n"); + sb.append(" twitter: ").append(toIndentedString(twitter)).append("\n"); + sb.append(" linkedin: ").append(toIndentedString(linkedin)).append("\n"); + sb.append(" bio: ").append(toIndentedString(bio)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object nameValue = getName(); + String nameValueAsString = ""; + nameValueAsString = nameValue.toString(); + sb.append("name=").append(urlEncode(nameValueAsString)).append(""); + Object roleValue = getRole(); + String roleValueAsString = ""; + roleValueAsString = roleValue.toString(); + sb.append("role=").append(urlEncode(roleValueAsString)).append(""); + Object twitterValue = getTwitter(); + String twitterValueAsString = ""; + twitterValueAsString = twitterValue.toString(); + sb.append("twitter=").append(urlEncode(twitterValueAsString)).append(""); + Object linkedinValue = getLinkedin(); + String linkedinValueAsString = ""; + linkedinValueAsString = linkedinValue.toString(); + sb.append("linkedin=").append(urlEncode(linkedinValueAsString)).append(""); + Object bioValue = getBio(); + String bioValueAsString = ""; + bioValueAsString = bioValue.toString(); + sb.append("bio=").append(urlEncode(bioValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("role"); + openapiFields.add("twitter"); + openapiFields.add("linkedin"); + openapiFields.add("bio"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * DefiProtocolInfoDtoTeamInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DefiProtocolInfoDtoTeamInner.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DefiProtocolInfoDtoTeamInner is not" + + " found in the empty JSON string", + DefiProtocolInfoDtoTeamInner.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) + && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `name` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("name").toString())); + } + if ((jsonObj.get("role") != null && !jsonObj.get("role").isJsonNull()) + && !jsonObj.get("role").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `role` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("role").toString())); + } + if ((jsonObj.get("twitter") != null && !jsonObj.get("twitter").isJsonNull()) + && !jsonObj.get("twitter").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `twitter` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("twitter").toString())); + } + if ((jsonObj.get("linkedin") != null && !jsonObj.get("linkedin").isJsonNull()) + && !jsonObj.get("linkedin").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `linkedin` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("linkedin").toString())); + } + if ((jsonObj.get("bio") != null && !jsonObj.get("bio").isJsonNull()) + && !jsonObj.get("bio").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `bio` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("bio").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DefiProtocolInfoDtoTeamInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DefiProtocolInfoDtoTeamInner' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(DefiProtocolInfoDtoTeamInner.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DefiProtocolInfoDtoTeamInner value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DefiProtocolInfoDtoTeamInner read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DefiProtocolInfoDtoTeamInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of DefiProtocolInfoDtoTeamInner + * @throws IOException if the JSON string is invalid with respect to + * DefiProtocolInfoDtoTeamInner + */ + public static DefiProtocolInfoDtoTeamInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DefiProtocolInfoDtoTeamInner.class); + } + + /** + * Convert an instance of DefiProtocolInfoDtoTeamInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiProtocolSocialLinksDto.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiProtocolSocialLinksDto.java new file mode 100644 index 0000000..65317eb --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiProtocolSocialLinksDto.java @@ -0,0 +1,469 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** Protocol social media links. */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class DefiProtocolSocialLinksDto { + public static final String SERIALIZED_NAME_X_LOWER_CASE = "x"; + + @SerializedName(SERIALIZED_NAME_X_LOWER_CASE) + @jakarta.annotation.Nullable + private String xLowerCase; + + public static final String SERIALIZED_NAME_DISCORD = "discord"; + + @SerializedName(SERIALIZED_NAME_DISCORD) + @jakarta.annotation.Nullable + private String discord; + + public static final String SERIALIZED_NAME_GITHUB = "github"; + + @SerializedName(SERIALIZED_NAME_GITHUB) + @jakarta.annotation.Nullable + private String github; + + public static final String SERIALIZED_NAME_LINKEDIN = "linkedin"; + + @SerializedName(SERIALIZED_NAME_LINKEDIN) + @jakarta.annotation.Nullable + private String linkedin; + + public static final String SERIALIZED_NAME_TELEGRAM = "telegram"; + + @SerializedName(SERIALIZED_NAME_TELEGRAM) + @jakarta.annotation.Nullable + private String telegram; + + public static final String SERIALIZED_NAME_GITBOOK = "gitbook"; + + @SerializedName(SERIALIZED_NAME_GITBOOK) + @jakarta.annotation.Nullable + private String gitbook; + + public static final String SERIALIZED_NAME_WEBSITE = "website"; + + @SerializedName(SERIALIZED_NAME_WEBSITE) + @jakarta.annotation.Nullable + private String website; + + public DefiProtocolSocialLinksDto() {} + + public DefiProtocolSocialLinksDto xLowerCase(@jakarta.annotation.Nullable String xLowerCase) { + this.xLowerCase = xLowerCase; + return this; + } + + /** + * X (Twitter) profile URL. Null when not available. + * + * @return xLowerCase + */ + @jakarta.annotation.Nullable + public String getxLowerCase() { + return xLowerCase; + } + + public void setxLowerCase(@jakarta.annotation.Nullable String xLowerCase) { + this.xLowerCase = xLowerCase; + } + + public DefiProtocolSocialLinksDto discord(@jakarta.annotation.Nullable String discord) { + this.discord = discord; + return this; + } + + /** + * Discord invite URL. Null when not available. + * + * @return discord + */ + @jakarta.annotation.Nullable + public String getDiscord() { + return discord; + } + + public void setDiscord(@jakarta.annotation.Nullable String discord) { + this.discord = discord; + } + + public DefiProtocolSocialLinksDto github(@jakarta.annotation.Nullable String github) { + this.github = github; + return this; + } + + /** + * GitHub organization URL. Null when not available. + * + * @return github + */ + @jakarta.annotation.Nullable + public String getGithub() { + return github; + } + + public void setGithub(@jakarta.annotation.Nullable String github) { + this.github = github; + } + + public DefiProtocolSocialLinksDto linkedin(@jakarta.annotation.Nullable String linkedin) { + this.linkedin = linkedin; + return this; + } + + /** + * LinkedIn company URL. Null when not available. + * + * @return linkedin + */ + @jakarta.annotation.Nullable + public String getLinkedin() { + return linkedin; + } + + public void setLinkedin(@jakarta.annotation.Nullable String linkedin) { + this.linkedin = linkedin; + } + + public DefiProtocolSocialLinksDto telegram(@jakarta.annotation.Nullable String telegram) { + this.telegram = telegram; + return this; + } + + /** + * Telegram channel URL. Null when not available. + * + * @return telegram + */ + @jakarta.annotation.Nullable + public String getTelegram() { + return telegram; + } + + public void setTelegram(@jakarta.annotation.Nullable String telegram) { + this.telegram = telegram; + } + + public DefiProtocolSocialLinksDto gitbook(@jakarta.annotation.Nullable String gitbook) { + this.gitbook = gitbook; + return this; + } + + /** + * GitBook documentation URL. Empty string or null when not available. + * + * @return gitbook + */ + @jakarta.annotation.Nullable + public String getGitbook() { + return gitbook; + } + + public void setGitbook(@jakarta.annotation.Nullable String gitbook) { + this.gitbook = gitbook; + } + + public DefiProtocolSocialLinksDto website(@jakarta.annotation.Nullable String website) { + this.website = website; + return this; + } + + /** + * Official website URL. + * + * @return website + */ + @jakarta.annotation.Nullable + public String getWebsite() { + return website; + } + + public void setWebsite(@jakarta.annotation.Nullable String website) { + this.website = website; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DefiProtocolSocialLinksDto defiProtocolSocialLinksDto = (DefiProtocolSocialLinksDto) o; + return Objects.equals(this.xLowerCase, defiProtocolSocialLinksDto.xLowerCase) + && Objects.equals(this.discord, defiProtocolSocialLinksDto.discord) + && Objects.equals(this.github, defiProtocolSocialLinksDto.github) + && Objects.equals(this.linkedin, defiProtocolSocialLinksDto.linkedin) + && Objects.equals(this.telegram, defiProtocolSocialLinksDto.telegram) + && Objects.equals(this.gitbook, defiProtocolSocialLinksDto.gitbook) + && Objects.equals(this.website, defiProtocolSocialLinksDto.website); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(xLowerCase, discord, github, linkedin, telegram, gitbook, website); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DefiProtocolSocialLinksDto {\n"); + sb.append(" xLowerCase: ").append(toIndentedString(xLowerCase)).append("\n"); + sb.append(" discord: ").append(toIndentedString(discord)).append("\n"); + sb.append(" github: ").append(toIndentedString(github)).append("\n"); + sb.append(" linkedin: ").append(toIndentedString(linkedin)).append("\n"); + sb.append(" telegram: ").append(toIndentedString(telegram)).append("\n"); + sb.append(" gitbook: ").append(toIndentedString(gitbook)).append("\n"); + sb.append(" website: ").append(toIndentedString(website)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object xLowerCaseValue = getxLowerCase(); + String xLowerCaseValueAsString = ""; + xLowerCaseValueAsString = xLowerCaseValue.toString(); + sb.append("xLowerCase=").append(urlEncode(xLowerCaseValueAsString)).append(""); + Object discordValue = getDiscord(); + String discordValueAsString = ""; + discordValueAsString = discordValue.toString(); + sb.append("discord=").append(urlEncode(discordValueAsString)).append(""); + Object githubValue = getGithub(); + String githubValueAsString = ""; + githubValueAsString = githubValue.toString(); + sb.append("github=").append(urlEncode(githubValueAsString)).append(""); + Object linkedinValue = getLinkedin(); + String linkedinValueAsString = ""; + linkedinValueAsString = linkedinValue.toString(); + sb.append("linkedin=").append(urlEncode(linkedinValueAsString)).append(""); + Object telegramValue = getTelegram(); + String telegramValueAsString = ""; + telegramValueAsString = telegramValue.toString(); + sb.append("telegram=").append(urlEncode(telegramValueAsString)).append(""); + Object gitbookValue = getGitbook(); + String gitbookValueAsString = ""; + gitbookValueAsString = gitbookValue.toString(); + sb.append("gitbook=").append(urlEncode(gitbookValueAsString)).append(""); + Object websiteValue = getWebsite(); + String websiteValueAsString = ""; + websiteValueAsString = websiteValue.toString(); + sb.append("website=").append(urlEncode(websiteValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("x"); + openapiFields.add("discord"); + openapiFields.add("github"); + openapiFields.add("linkedin"); + openapiFields.add("telegram"); + openapiFields.add("gitbook"); + openapiFields.add("website"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DefiProtocolSocialLinksDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DefiProtocolSocialLinksDto.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DefiProtocolSocialLinksDto is not" + + " found in the empty JSON string", + DefiProtocolSocialLinksDto.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("x") != null && !jsonObj.get("x").isJsonNull()) + && !jsonObj.get("x").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `x` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("x").toString())); + } + if ((jsonObj.get("discord") != null && !jsonObj.get("discord").isJsonNull()) + && !jsonObj.get("discord").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `discord` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("discord").toString())); + } + if ((jsonObj.get("github") != null && !jsonObj.get("github").isJsonNull()) + && !jsonObj.get("github").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `github` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("github").toString())); + } + if ((jsonObj.get("linkedin") != null && !jsonObj.get("linkedin").isJsonNull()) + && !jsonObj.get("linkedin").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `linkedin` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("linkedin").toString())); + } + if ((jsonObj.get("telegram") != null && !jsonObj.get("telegram").isJsonNull()) + && !jsonObj.get("telegram").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `telegram` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("telegram").toString())); + } + if ((jsonObj.get("gitbook") != null && !jsonObj.get("gitbook").isJsonNull()) + && !jsonObj.get("gitbook").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `gitbook` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("gitbook").toString())); + } + if ((jsonObj.get("website") != null && !jsonObj.get("website").isJsonNull()) + && !jsonObj.get("website").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `website` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("website").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DefiProtocolSocialLinksDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DefiProtocolSocialLinksDto' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(DefiProtocolSocialLinksDto.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DefiProtocolSocialLinksDto value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DefiProtocolSocialLinksDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DefiProtocolSocialLinksDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of DefiProtocolSocialLinksDto + * @throws IOException if the JSON string is invalid with respect to DefiProtocolSocialLinksDto + */ + public static DefiProtocolSocialLinksDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DefiProtocolSocialLinksDto.class); + } + + /** + * Convert an instance of DefiProtocolSocialLinksDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiProtocolTeamMemberDto.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiProtocolTeamMemberDto.java new file mode 100644 index 0000000..891d1ea --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiProtocolTeamMemberDto.java @@ -0,0 +1,389 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** Protocol team member. */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class DefiProtocolTeamMemberDto { + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @jakarta.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_ROLE = "role"; + + @SerializedName(SERIALIZED_NAME_ROLE) + @jakarta.annotation.Nullable + private String role; + + public static final String SERIALIZED_NAME_TWITTER = "twitter"; + + @SerializedName(SERIALIZED_NAME_TWITTER) + @jakarta.annotation.Nullable + private String twitter; + + public static final String SERIALIZED_NAME_LINKEDIN = "linkedin"; + + @SerializedName(SERIALIZED_NAME_LINKEDIN) + @jakarta.annotation.Nullable + private String linkedin; + + public static final String SERIALIZED_NAME_BIO = "bio"; + + @SerializedName(SERIALIZED_NAME_BIO) + @jakarta.annotation.Nullable + private String bio; + + public DefiProtocolTeamMemberDto() {} + + public DefiProtocolTeamMemberDto name(@jakarta.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Member name. + * + * @return name + */ + @jakarta.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@jakarta.annotation.Nullable String name) { + this.name = name; + } + + public DefiProtocolTeamMemberDto role(@jakarta.annotation.Nullable String role) { + this.role = role; + return this; + } + + /** + * Member role / title. + * + * @return role + */ + @jakarta.annotation.Nullable + public String getRole() { + return role; + } + + public void setRole(@jakarta.annotation.Nullable String role) { + this.role = role; + } + + public DefiProtocolTeamMemberDto twitter(@jakarta.annotation.Nullable String twitter) { + this.twitter = twitter; + return this; + } + + /** + * Member's X (Twitter) handle URL. Null when not available. + * + * @return twitter + */ + @jakarta.annotation.Nullable + public String getTwitter() { + return twitter; + } + + public void setTwitter(@jakarta.annotation.Nullable String twitter) { + this.twitter = twitter; + } + + public DefiProtocolTeamMemberDto linkedin(@jakarta.annotation.Nullable String linkedin) { + this.linkedin = linkedin; + return this; + } + + /** + * Member's LinkedIn URL. Null when not available. + * + * @return linkedin + */ + @jakarta.annotation.Nullable + public String getLinkedin() { + return linkedin; + } + + public void setLinkedin(@jakarta.annotation.Nullable String linkedin) { + this.linkedin = linkedin; + } + + public DefiProtocolTeamMemberDto bio(@jakarta.annotation.Nullable String bio) { + this.bio = bio; + return this; + } + + /** + * Member biography. Null when not available. + * + * @return bio + */ + @jakarta.annotation.Nullable + public String getBio() { + return bio; + } + + public void setBio(@jakarta.annotation.Nullable String bio) { + this.bio = bio; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DefiProtocolTeamMemberDto defiProtocolTeamMemberDto = (DefiProtocolTeamMemberDto) o; + return Objects.equals(this.name, defiProtocolTeamMemberDto.name) + && Objects.equals(this.role, defiProtocolTeamMemberDto.role) + && Objects.equals(this.twitter, defiProtocolTeamMemberDto.twitter) + && Objects.equals(this.linkedin, defiProtocolTeamMemberDto.linkedin) + && Objects.equals(this.bio, defiProtocolTeamMemberDto.bio); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(name, role, twitter, linkedin, bio); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DefiProtocolTeamMemberDto {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" role: ").append(toIndentedString(role)).append("\n"); + sb.append(" twitter: ").append(toIndentedString(twitter)).append("\n"); + sb.append(" linkedin: ").append(toIndentedString(linkedin)).append("\n"); + sb.append(" bio: ").append(toIndentedString(bio)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object nameValue = getName(); + String nameValueAsString = ""; + nameValueAsString = nameValue.toString(); + sb.append("name=").append(urlEncode(nameValueAsString)).append(""); + Object roleValue = getRole(); + String roleValueAsString = ""; + roleValueAsString = roleValue.toString(); + sb.append("role=").append(urlEncode(roleValueAsString)).append(""); + Object twitterValue = getTwitter(); + String twitterValueAsString = ""; + twitterValueAsString = twitterValue.toString(); + sb.append("twitter=").append(urlEncode(twitterValueAsString)).append(""); + Object linkedinValue = getLinkedin(); + String linkedinValueAsString = ""; + linkedinValueAsString = linkedinValue.toString(); + sb.append("linkedin=").append(urlEncode(linkedinValueAsString)).append(""); + Object bioValue = getBio(); + String bioValueAsString = ""; + bioValueAsString = bioValue.toString(); + sb.append("bio=").append(urlEncode(bioValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("role"); + openapiFields.add("twitter"); + openapiFields.add("linkedin"); + openapiFields.add("bio"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DefiProtocolTeamMemberDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DefiProtocolTeamMemberDto.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DefiProtocolTeamMemberDto is not found" + + " in the empty JSON string", + DefiProtocolTeamMemberDto.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) + && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `name` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("name").toString())); + } + if ((jsonObj.get("role") != null && !jsonObj.get("role").isJsonNull()) + && !jsonObj.get("role").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `role` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("role").toString())); + } + if ((jsonObj.get("twitter") != null && !jsonObj.get("twitter").isJsonNull()) + && !jsonObj.get("twitter").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `twitter` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("twitter").toString())); + } + if ((jsonObj.get("linkedin") != null && !jsonObj.get("linkedin").isJsonNull()) + && !jsonObj.get("linkedin").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `linkedin` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("linkedin").toString())); + } + if ((jsonObj.get("bio") != null && !jsonObj.get("bio").isJsonNull()) + && !jsonObj.get("bio").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `bio` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("bio").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DefiProtocolTeamMemberDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DefiProtocolTeamMemberDto' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(DefiProtocolTeamMemberDto.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DefiProtocolTeamMemberDto value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DefiProtocolTeamMemberDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DefiProtocolTeamMemberDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of DefiProtocolTeamMemberDto + * @throws IOException if the JSON string is invalid with respect to DefiProtocolTeamMemberDto + */ + public static DefiProtocolTeamMemberDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DefiProtocolTeamMemberDto.class); + } + + /** + * Convert an instance of DefiProtocolTeamMemberDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiTokenItem.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiTokenItem.java new file mode 100644 index 0000000..e99f1df --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiTokenItem.java @@ -0,0 +1,266 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** + * A `(tokenAddress, amount)` pair. `amount` is a human-readable decimal string + * (NOT the token's smallest unit); the service converts it according to the token's + * decimals. For the native asset use the sentinel + * `0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee` (40 `e`s). + */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class DefiTokenItem { + public static final String SERIALIZED_NAME_TOKEN_ADDRESS = "tokenAddress"; + + @SerializedName(SERIALIZED_NAME_TOKEN_ADDRESS) + @jakarta.annotation.Nonnull + private String tokenAddress; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + + @SerializedName(SERIALIZED_NAME_AMOUNT) + @jakarta.annotation.Nonnull + private String amount; + + public DefiTokenItem() {} + + public DefiTokenItem tokenAddress(@jakarta.annotation.Nonnull String tokenAddress) { + this.tokenAddress = tokenAddress; + return this; + } + + /** + * Token contract address; the native-asset sentinel for the native coin. + * + * @return tokenAddress + */ + @jakarta.annotation.Nonnull + @NotNull + public String getTokenAddress() { + return tokenAddress; + } + + public void setTokenAddress(@jakarta.annotation.Nonnull String tokenAddress) { + this.tokenAddress = tokenAddress; + } + + public DefiTokenItem amount(@jakarta.annotation.Nonnull String amount) { + this.amount = amount; + return this; + } + + /** + * Human-readable amount as a decimal string, e.g. \"1.5\", \"100\". + * + * @return amount + */ + @jakarta.annotation.Nonnull + @NotNull + public String getAmount() { + return amount; + } + + public void setAmount(@jakarta.annotation.Nonnull String amount) { + this.amount = amount; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DefiTokenItem defiTokenItem = (DefiTokenItem) o; + return Objects.equals(this.tokenAddress, defiTokenItem.tokenAddress) + && Objects.equals(this.amount, defiTokenItem.amount); + } + + @Override + public int hashCode() { + return Objects.hash(tokenAddress, amount); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DefiTokenItem {\n"); + sb.append(" tokenAddress: ").append(toIndentedString(tokenAddress)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object tokenAddressValue = getTokenAddress(); + String tokenAddressValueAsString = ""; + tokenAddressValueAsString = tokenAddressValue.toString(); + sb.append("tokenAddress=").append(urlEncode(tokenAddressValueAsString)).append(""); + Object amountValue = getAmount(); + String amountValueAsString = ""; + amountValueAsString = amountValue.toString(); + sb.append("amount=").append(urlEncode(amountValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("tokenAddress"); + openapiFields.add("amount"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("tokenAddress"); + openapiRequiredFields.add("amount"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DefiTokenItem + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DefiTokenItem.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DefiTokenItem is not found in the" + + " empty JSON string", + DefiTokenItem.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DefiTokenItem.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("tokenAddress").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `tokenAddress` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("tokenAddress").toString())); + } + if (!jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `amount` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("amount").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DefiTokenItem.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DefiTokenItem' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(DefiTokenItem.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DefiTokenItem value) throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DefiTokenItem read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DefiTokenItem given an JSON string + * + * @param jsonString JSON string + * @return An instance of DefiTokenItem + * @throws IOException if the JSON string is invalid with respect to DefiTokenItem + */ + public static DefiTokenItem fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DefiTokenItem.class); + } + + /** + * Convert an instance of DefiTokenItem to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiTxResponse.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiTxResponse.java new file mode 100644 index 0000000..13851e2 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiTxResponse.java @@ -0,0 +1,342 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; +import org.hibernate.validator.constraints.*; + +/** + * Unified response of the five build endpoints (deposit / redeem / lp-add / lp-remove / claim). + * `dataList` is ordered: APPROVE items come first, the main action follows — sign and + * broadcast each item in order. `preview` is non-null only when the request set + * `simulate=true`. `redeemDelayDays` is populated only by + * `/transaction/redeem`. + */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class DefiTxResponse { + public static final String SERIALIZED_NAME_DATA_LIST = "dataList"; + + @SerializedName(SERIALIZED_NAME_DATA_LIST) + @jakarta.annotation.Nullable + private List<@Valid DefiTxResponseDataListInner> dataList; + + public static final String SERIALIZED_NAME_PREVIEW = "preview"; + + @SerializedName(SERIALIZED_NAME_PREVIEW) + @jakarta.annotation.Nullable + private DefiTxResponsePreview preview; + + public static final String SERIALIZED_NAME_REDEEM_DELAY_DAYS = "redeemDelayDays"; + + @SerializedName(SERIALIZED_NAME_REDEEM_DELAY_DAYS) + @jakarta.annotation.Nullable + private List redeemDelayDays; + + public DefiTxResponse() {} + + public DefiTxResponse dataList( + @jakarta.annotation.Nullable List<@Valid DefiTxResponseDataListInner> dataList) { + this.dataList = dataList; + return this; + } + + public DefiTxResponse addDataListItem(DefiTxResponseDataListInner dataListItem) { + if (this.dataList == null) { + this.dataList = new ArrayList<>(); + } + this.dataList.add(dataListItem); + return this; + } + + /** + * Ordered unsigned transactions; APPROVE precedes the main action. + * + * @return dataList + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid DefiTxResponseDataListInner> getDataList() { + return dataList; + } + + public void setDataList( + @jakarta.annotation.Nullable List<@Valid DefiTxResponseDataListInner> dataList) { + this.dataList = dataList; + } + + public DefiTxResponse preview(@jakarta.annotation.Nullable DefiTxResponsePreview preview) { + this.preview = preview; + return this; + } + + /** + * Get preview + * + * @return preview + */ + @jakarta.annotation.Nullable + @Valid + public DefiTxResponsePreview getPreview() { + return preview; + } + + public void setPreview(@jakarta.annotation.Nullable DefiTxResponsePreview preview) { + this.preview = preview; + } + + public DefiTxResponse redeemDelayDays( + @jakarta.annotation.Nullable List redeemDelayDays) { + this.redeemDelayDays = redeemDelayDays; + return this; + } + + public DefiTxResponse addRedeemDelayDaysItem(String redeemDelayDaysItem) { + if (this.redeemDelayDays == null) { + this.redeemDelayDays = new ArrayList<>(); + } + this.redeemDelayDays.add(redeemDelayDaysItem); + return this; + } + + /** + * Redeem waiting period as a `[min, max]` day pair of decimal strings. Populated + * **only** by `/transaction/redeem`; `null` on the other build endpoints or + * when unavailable. Interpretation: `[]` (empty) = instant, no waiting period; + * `[\"7\",\"7\"]` = fixed 7 days; + * `[\"7\",\"10\"]` = 7–10 days. The wait starts after the + * redeem transaction is confirmed on-chain. + * + * @return redeemDelayDays + */ + @jakarta.annotation.Nullable + public List getRedeemDelayDays() { + return redeemDelayDays; + } + + public void setRedeemDelayDays(@jakarta.annotation.Nullable List redeemDelayDays) { + this.redeemDelayDays = redeemDelayDays; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DefiTxResponse defiTxResponse = (DefiTxResponse) o; + return Objects.equals(this.dataList, defiTxResponse.dataList) + && Objects.equals(this.preview, defiTxResponse.preview) + && Objects.equals(this.redeemDelayDays, defiTxResponse.redeemDelayDays); + } + + @Override + public int hashCode() { + return Objects.hash(dataList, preview, redeemDelayDays); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DefiTxResponse {\n"); + sb.append(" dataList: ").append(toIndentedString(dataList)).append("\n"); + sb.append(" preview: ").append(toIndentedString(preview)).append("\n"); + sb.append(" redeemDelayDays: ").append(toIndentedString(redeemDelayDays)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object dataListValue = getDataList(); + String dataListValueAsString = ""; + dataListValueAsString = + (String) + ((Collection) dataListValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("dataList=").append(urlEncode(dataListValueAsString)).append(""); + Object previewValue = getPreview(); + String previewValueAsString = ""; + previewValueAsString = previewValue.toString(); + sb.append("preview=").append(urlEncode(previewValueAsString)).append(""); + Object redeemDelayDaysValue = getRedeemDelayDays(); + String redeemDelayDaysValueAsString = ""; + redeemDelayDaysValueAsString = + (String) + ((Collection) redeemDelayDaysValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("redeemDelayDays=").append(urlEncode(redeemDelayDaysValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("dataList"); + openapiFields.add("preview"); + openapiFields.add("redeemDelayDays"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DefiTxResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DefiTxResponse.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DefiTxResponse is not found in the" + + " empty JSON string", + DefiTxResponse.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("dataList") != null && !jsonObj.get("dataList").isJsonNull()) { + JsonArray jsonArraydataList = jsonObj.getAsJsonArray("dataList"); + if (jsonArraydataList != null) { + // ensure the json data is an array + if (!jsonObj.get("dataList").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `dataList` to be an array in the JSON" + + " string but got `%s`", + jsonObj.get("dataList").toString())); + } + + // validate the optional field `dataList` (array) + for (int i = 0; i < jsonArraydataList.size(); i++) { + DefiTxResponseDataListInner.validateJsonElement(jsonArraydataList.get(i)); + } + ; + } + } + // validate the optional field `preview` + if (jsonObj.get("preview") != null && !jsonObj.get("preview").isJsonNull()) { + DefiTxResponsePreview.validateJsonElement(jsonObj.get("preview")); + } + // ensure the optional json data is an array if present + if (jsonObj.get("redeemDelayDays") != null + && !jsonObj.get("redeemDelayDays").isJsonNull() + && !jsonObj.get("redeemDelayDays").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `redeemDelayDays` to be an array in the JSON string" + + " but got `%s`", + jsonObj.get("redeemDelayDays").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DefiTxResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DefiTxResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(DefiTxResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DefiTxResponse value) throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DefiTxResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DefiTxResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of DefiTxResponse + * @throws IOException if the JSON string is invalid with respect to DefiTxResponse + */ + public static DefiTxResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DefiTxResponse.class); + } + + /** + * Convert an instance of DefiTxResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiTxResponseDataListInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiTxResponseDataListInner.java new file mode 100644 index 0000000..b7792f2 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiTxResponseDataListInner.java @@ -0,0 +1,661 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** + * A single unsigned transaction to sign and broadcast. The `dataList` is ordered: APPROVE + * items precede the main action. EVM chains return `to`/`value` (hex) and hex + * calldata in `data`. **Number-format conventions for this object** — `value` + * is a `0x`-prefixed hex string; `gasLimit`, `gasPrice`, + * `maxPriorityFeePerGas`, and `maxFeePerGas` are decimal strings. Mixed + * hex/decimal within the same object is by design (it mirrors the on-chain transaction fields); + * always parse gas fields with base-10 and `value` with base-16. **BSC and EIP-1559**: + * this release is BSC only. BSC is an EIP-1559 chain, so build responses populate + * `maxFeePerGas` and `maxPriorityFeePerGas`; `gasPrice` is + * `null` (legacy-only). The nullable markers below are retained so the schema also + * describes non-1559 chains in later releases — on BSC the 1559 fields are present and the legacy + * `gasPrice` is `null`. `to` and `value` are non-null for + * every action item on BSC. + */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class DefiTxResponseDataListInner { + /** + * Action kind of this item: - `APPROVE` — ERC-20 approval, must be signed/broadcast + * and confirmed before the main action - `DEPOSIT` / `REDEEM` / + * `LP_ADD` / `LP_REMOVE` / `CLAIM` — the main action. + * `LP_ADD` / `LP_REMOVE` are the LP add / remove legs (the same build path + * as deposit / redeem for liquidity-pool investments; the kind reflects the on-chain action, + * not the entry endpoint). + */ + @JsonAdapter(CallDataTypeEnum.Adapter.class) + public enum CallDataTypeEnum { + APPROVE("APPROVE"), + + DEPOSIT("DEPOSIT"), + + REDEEM("REDEEM"), + + LP_ADD("LP_ADD"), + + LP_REMOVE("LP_REMOVE"), + + CLAIM("CLAIM"); + + private String value; + + CallDataTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static CallDataTypeEnum fromValue(String value) { + for (CallDataTypeEnum b : CallDataTypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final CallDataTypeEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public CallDataTypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return CallDataTypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + CallDataTypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_CALL_DATA_TYPE = "callDataType"; + + @SerializedName(SERIALIZED_NAME_CALL_DATA_TYPE) + @jakarta.annotation.Nullable + private CallDataTypeEnum callDataType; + + public static final String SERIALIZED_NAME_FROM = "from"; + + @SerializedName(SERIALIZED_NAME_FROM) + @jakarta.annotation.Nullable + private String from; + + public static final String SERIALIZED_NAME_TO = "to"; + + @SerializedName(SERIALIZED_NAME_TO) + @jakarta.annotation.Nullable + private String to; + + public static final String SERIALIZED_NAME_VALUE = "value"; + + @SerializedName(SERIALIZED_NAME_VALUE) + @jakarta.annotation.Nullable + private String value; + + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + @jakarta.annotation.Nullable + private String data; + + public static final String SERIALIZED_NAME_GAS_LIMIT = "gasLimit"; + + @SerializedName(SERIALIZED_NAME_GAS_LIMIT) + @jakarta.annotation.Nullable + private String gasLimit; + + public static final String SERIALIZED_NAME_GAS_PRICE = "gasPrice"; + + @SerializedName(SERIALIZED_NAME_GAS_PRICE) + @jakarta.annotation.Nullable + private String gasPrice; + + public static final String SERIALIZED_NAME_MAX_PRIORITY_FEE_PER_GAS = "maxPriorityFeePerGas"; + + @SerializedName(SERIALIZED_NAME_MAX_PRIORITY_FEE_PER_GAS) + @jakarta.annotation.Nullable + private String maxPriorityFeePerGas; + + public static final String SERIALIZED_NAME_MAX_FEE_PER_GAS = "maxFeePerGas"; + + @SerializedName(SERIALIZED_NAME_MAX_FEE_PER_GAS) + @jakarta.annotation.Nullable + private String maxFeePerGas; + + public DefiTxResponseDataListInner() {} + + public DefiTxResponseDataListInner callDataType( + @jakarta.annotation.Nullable CallDataTypeEnum callDataType) { + this.callDataType = callDataType; + return this; + } + + /** + * Action kind of this item: - `APPROVE` — ERC-20 approval, must be signed/broadcast + * and confirmed before the main action - `DEPOSIT` / `REDEEM` / + * `LP_ADD` / `LP_REMOVE` / `CLAIM` — the main action. + * `LP_ADD` / `LP_REMOVE` are the LP add / remove legs (the same build path + * as deposit / redeem for liquidity-pool investments; the kind reflects the on-chain action, + * not the entry endpoint). + * + * @return callDataType + */ + @jakarta.annotation.Nullable + public CallDataTypeEnum getCallDataType() { + return callDataType; + } + + public void setCallDataType(@jakarta.annotation.Nullable CallDataTypeEnum callDataType) { + this.callDataType = callDataType; + } + + public DefiTxResponseDataListInner from(@jakarta.annotation.Nullable String from) { + this.from = from; + return this; + } + + /** + * User wallet address (the signer / sender). EIP-55 checksummed — normalize with + * `to_checksum_address` before signing if your signer requires it. + * + * @return from + */ + @jakarta.annotation.Nullable + public String getFrom() { + return from; + } + + public void setFrom(@jakarta.annotation.Nullable String from) { + this.from = from; + } + + public DefiTxResponseDataListInner to(@jakarta.annotation.Nullable String to) { + this.to = to; + return this; + } + + /** + * Target contract address. EIP-55 checksummed, same format as `from`. Non-null on BSC + * for every action item. + * + * @return to + */ + @jakarta.annotation.Nullable + public String getTo() { + return to; + } + + public void setTo(@jakarta.annotation.Nullable String to) { + this.to = to; + } + + public DefiTxResponseDataListInner value(@jakarta.annotation.Nullable String value) { + this.value = value; + return this; + } + + /** + * Native-asset value as a `0x`-prefixed hex string. Non-null on BSC for action items. + * + * @return value + */ + @jakarta.annotation.Nullable + public String getValue() { + return value; + } + + public void setValue(@jakarta.annotation.Nullable String value) { + this.value = value; + } + + public DefiTxResponseDataListInner data(@jakarta.annotation.Nullable String data) { + this.data = data; + return this; + } + + /** + * Serialized transaction data, as a `0x`-prefixed hex calldata string. + * + * @return data + */ + @jakarta.annotation.Nullable + public String getData() { + return data; + } + + public void setData(@jakarta.annotation.Nullable String data) { + this.data = data; + } + + public DefiTxResponseDataListInner gasLimit(@jakarta.annotation.Nullable String gasLimit) { + this.gasLimit = gasLimit; + return this; + } + + /** + * Suggested gas limit (decimal string). `null` when estimation fails. + * + * @return gasLimit + */ + @jakarta.annotation.Nullable + public String getGasLimit() { + return gasLimit; + } + + public void setGasLimit(@jakarta.annotation.Nullable String gasLimit) { + this.gasLimit = gasLimit; + } + + public DefiTxResponseDataListInner gasPrice(@jakarta.annotation.Nullable String gasPrice) { + this.gasPrice = gasPrice; + return this; + } + + /** + * Legacy gas price, decimal string. `null` on EIP-1559 chains such as BSC (use + * `maxFeePerGas` / `maxPriorityFeePerGas` instead). + * + * @return gasPrice + */ + @jakarta.annotation.Nullable + public String getGasPrice() { + return gasPrice; + } + + public void setGasPrice(@jakarta.annotation.Nullable String gasPrice) { + this.gasPrice = gasPrice; + } + + public DefiTxResponseDataListInner maxPriorityFeePerGas( + @jakarta.annotation.Nullable String maxPriorityFeePerGas) { + this.maxPriorityFeePerGas = maxPriorityFeePerGas; + return this; + } + + /** + * EIP-1559 priority fee in wei (decimal string). `null` on non-1559 chains. + * + * @return maxPriorityFeePerGas + */ + @jakarta.annotation.Nullable + public String getMaxPriorityFeePerGas() { + return maxPriorityFeePerGas; + } + + public void setMaxPriorityFeePerGas(@jakarta.annotation.Nullable String maxPriorityFeePerGas) { + this.maxPriorityFeePerGas = maxPriorityFeePerGas; + } + + public DefiTxResponseDataListInner maxFeePerGas( + @jakarta.annotation.Nullable String maxFeePerGas) { + this.maxFeePerGas = maxFeePerGas; + return this; + } + + /** + * EIP-1559 max fee per gas in wei (decimal string). `null` on non-1559 chains. + * + * @return maxFeePerGas + */ + @jakarta.annotation.Nullable + public String getMaxFeePerGas() { + return maxFeePerGas; + } + + public void setMaxFeePerGas(@jakarta.annotation.Nullable String maxFeePerGas) { + this.maxFeePerGas = maxFeePerGas; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DefiTxResponseDataListInner defiTxResponseDataListInner = (DefiTxResponseDataListInner) o; + return Objects.equals(this.callDataType, defiTxResponseDataListInner.callDataType) + && Objects.equals(this.from, defiTxResponseDataListInner.from) + && Objects.equals(this.to, defiTxResponseDataListInner.to) + && Objects.equals(this.value, defiTxResponseDataListInner.value) + && Objects.equals(this.data, defiTxResponseDataListInner.data) + && Objects.equals(this.gasLimit, defiTxResponseDataListInner.gasLimit) + && Objects.equals(this.gasPrice, defiTxResponseDataListInner.gasPrice) + && Objects.equals( + this.maxPriorityFeePerGas, defiTxResponseDataListInner.maxPriorityFeePerGas) + && Objects.equals(this.maxFeePerGas, defiTxResponseDataListInner.maxFeePerGas); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash( + callDataType, + from, + to, + value, + data, + gasLimit, + gasPrice, + maxPriorityFeePerGas, + maxFeePerGas); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DefiTxResponseDataListInner {\n"); + sb.append(" callDataType: ").append(toIndentedString(callDataType)).append("\n"); + sb.append(" from: ").append(toIndentedString(from)).append("\n"); + sb.append(" to: ").append(toIndentedString(to)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" gasLimit: ").append(toIndentedString(gasLimit)).append("\n"); + sb.append(" gasPrice: ").append(toIndentedString(gasPrice)).append("\n"); + sb.append(" maxPriorityFeePerGas: ") + .append(toIndentedString(maxPriorityFeePerGas)) + .append("\n"); + sb.append(" maxFeePerGas: ").append(toIndentedString(maxFeePerGas)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object callDataTypeValue = getCallDataType(); + String callDataTypeValueAsString = ""; + callDataTypeValueAsString = callDataTypeValue.toString(); + sb.append("callDataType=").append(urlEncode(callDataTypeValueAsString)).append(""); + Object fromValue = getFrom(); + String fromValueAsString = ""; + fromValueAsString = fromValue.toString(); + sb.append("from=").append(urlEncode(fromValueAsString)).append(""); + Object toValue = getTo(); + String toValueAsString = ""; + toValueAsString = toValue.toString(); + sb.append("to=").append(urlEncode(toValueAsString)).append(""); + Object valueValue = getValue(); + String valueValueAsString = ""; + valueValueAsString = valueValue.toString(); + sb.append("value=").append(urlEncode(valueValueAsString)).append(""); + Object dataValue = getData(); + String dataValueAsString = ""; + dataValueAsString = dataValue.toString(); + sb.append("data=").append(urlEncode(dataValueAsString)).append(""); + Object gasLimitValue = getGasLimit(); + String gasLimitValueAsString = ""; + gasLimitValueAsString = gasLimitValue.toString(); + sb.append("gasLimit=").append(urlEncode(gasLimitValueAsString)).append(""); + Object gasPriceValue = getGasPrice(); + String gasPriceValueAsString = ""; + gasPriceValueAsString = gasPriceValue.toString(); + sb.append("gasPrice=").append(urlEncode(gasPriceValueAsString)).append(""); + Object maxPriorityFeePerGasValue = getMaxPriorityFeePerGas(); + String maxPriorityFeePerGasValueAsString = ""; + maxPriorityFeePerGasValueAsString = maxPriorityFeePerGasValue.toString(); + sb.append("maxPriorityFeePerGas=") + .append(urlEncode(maxPriorityFeePerGasValueAsString)) + .append(""); + Object maxFeePerGasValue = getMaxFeePerGas(); + String maxFeePerGasValueAsString = ""; + maxFeePerGasValueAsString = maxFeePerGasValue.toString(); + sb.append("maxFeePerGas=").append(urlEncode(maxFeePerGasValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("callDataType"); + openapiFields.add("from"); + openapiFields.add("to"); + openapiFields.add("value"); + openapiFields.add("data"); + openapiFields.add("gasLimit"); + openapiFields.add("gasPrice"); + openapiFields.add("maxPriorityFeePerGas"); + openapiFields.add("maxFeePerGas"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * DefiTxResponseDataListInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DefiTxResponseDataListInner.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DefiTxResponseDataListInner is not" + + " found in the empty JSON string", + DefiTxResponseDataListInner.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("callDataType") != null && !jsonObj.get("callDataType").isJsonNull()) + && !jsonObj.get("callDataType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `callDataType` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("callDataType").toString())); + } + // validate the optional field `callDataType` + if (jsonObj.get("callDataType") != null && !jsonObj.get("callDataType").isJsonNull()) { + CallDataTypeEnum.validateJsonElement(jsonObj.get("callDataType")); + } + if ((jsonObj.get("from") != null && !jsonObj.get("from").isJsonNull()) + && !jsonObj.get("from").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `from` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("from").toString())); + } + if ((jsonObj.get("to") != null && !jsonObj.get("to").isJsonNull()) + && !jsonObj.get("to").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `to` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("to").toString())); + } + if ((jsonObj.get("value") != null && !jsonObj.get("value").isJsonNull()) + && !jsonObj.get("value").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `value` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("value").toString())); + } + if ((jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) + && !jsonObj.get("data").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `data` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("data").toString())); + } + if ((jsonObj.get("gasLimit") != null && !jsonObj.get("gasLimit").isJsonNull()) + && !jsonObj.get("gasLimit").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `gasLimit` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("gasLimit").toString())); + } + if ((jsonObj.get("gasPrice") != null && !jsonObj.get("gasPrice").isJsonNull()) + && !jsonObj.get("gasPrice").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `gasPrice` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("gasPrice").toString())); + } + if ((jsonObj.get("maxPriorityFeePerGas") != null + && !jsonObj.get("maxPriorityFeePerGas").isJsonNull()) + && !jsonObj.get("maxPriorityFeePerGas").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `maxPriorityFeePerGas` to be a primitive type in" + + " the JSON string but got `%s`", + jsonObj.get("maxPriorityFeePerGas").toString())); + } + if ((jsonObj.get("maxFeePerGas") != null && !jsonObj.get("maxFeePerGas").isJsonNull()) + && !jsonObj.get("maxFeePerGas").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `maxFeePerGas` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("maxFeePerGas").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DefiTxResponseDataListInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DefiTxResponseDataListInner' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(DefiTxResponseDataListInner.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DefiTxResponseDataListInner value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DefiTxResponseDataListInner read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DefiTxResponseDataListInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of DefiTxResponseDataListInner + * @throws IOException if the JSON string is invalid with respect to DefiTxResponseDataListInner + */ + public static DefiTxResponseDataListInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DefiTxResponseDataListInner.class); + } + + /** + * Convert an instance of DefiTxResponseDataListInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiTxResponsePreview.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiTxResponsePreview.java new file mode 100644 index 0000000..1adaaf5 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/DefiTxResponsePreview.java @@ -0,0 +1,467 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; +import org.hibernate.validator.constraints.*; + +/** + * Simulation result returned by the build endpoints when `simulate=true`. Includes + * whether the action is expected to succeed, the projected balance change, the estimated network + * fee, and — for lending protocols — the health-factor change. `balanceChange`, + * `feeAndContract`, `healthFactor`, and `warnings` each have a fixed + * structure (see below); the number of entries and some inner values vary by protocol. + */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class DefiTxResponsePreview { + public static final String SERIALIZED_NAME_SUCCESS = "success"; + + @SerializedName(SERIALIZED_NAME_SUCCESS) + @jakarta.annotation.Nullable + private Boolean success; + + public static final String SERIALIZED_NAME_BALANCE_CHANGE = "balanceChange"; + + @SerializedName(SERIALIZED_NAME_BALANCE_CHANGE) + @jakarta.annotation.Nullable + private List<@Valid DefiPreviewBalanceChangeInner> balanceChange; + + public static final String SERIALIZED_NAME_FEE_AND_CONTRACT = "feeAndContract"; + + @SerializedName(SERIALIZED_NAME_FEE_AND_CONTRACT) + @jakarta.annotation.Nullable + private DefiPreviewFeeAndContract feeAndContract; + + public static final String SERIALIZED_NAME_HEALTH_FACTOR = "healthFactor"; + + @SerializedName(SERIALIZED_NAME_HEALTH_FACTOR) + @jakarta.annotation.Nullable + private DefiPreviewHealthFactor healthFactor; + + public static final String SERIALIZED_NAME_WARNINGS = "warnings"; + + @SerializedName(SERIALIZED_NAME_WARNINGS) + @jakarta.annotation.Nullable + private List<@Valid DefiPreviewWarningsInner> warnings; + + public static final String SERIALIZED_NAME_ERROR_MESSAGE = "errorMessage"; + + @SerializedName(SERIALIZED_NAME_ERROR_MESSAGE) + @jakarta.annotation.Nullable + private String errorMessage; + + public DefiTxResponsePreview() {} + + public DefiTxResponsePreview success(@jakarta.annotation.Nullable Boolean success) { + this.success = success; + return this; + } + + /** + * Whether the simulated transaction is expected to succeed on-chain. + * + * @return success + */ + @jakarta.annotation.Nullable + public Boolean getSuccess() { + return success; + } + + public void setSuccess(@jakarta.annotation.Nullable Boolean success) { + this.success = success; + } + + public DefiTxResponsePreview balanceChange( + @jakarta.annotation.Nullable List<@Valid DefiPreviewBalanceChangeInner> balanceChange) { + this.balanceChange = balanceChange; + return this; + } + + public DefiTxResponsePreview addBalanceChangeItem( + DefiPreviewBalanceChangeInner balanceChangeItem) { + if (this.balanceChange == null) { + this.balanceChange = new ArrayList<>(); + } + this.balanceChange.add(balanceChangeItem); + return this; + } + + /** + * Signed token balance deltas from the simulation. Each entry has `tokenType`, + * `tokenSymbol`, `tokenAddress`, `tokenDecimals`, + * `amount` (positive = received, negative = spent), `valueUsd`, + * and an optional `tokenId`. + * + * @return balanceChange + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid DefiPreviewBalanceChangeInner> getBalanceChange() { + return balanceChange; + } + + public void setBalanceChange( + @jakarta.annotation.Nullable List<@Valid DefiPreviewBalanceChangeInner> balanceChange) { + this.balanceChange = balanceChange; + } + + public DefiTxResponsePreview feeAndContract( + @jakarta.annotation.Nullable DefiPreviewFeeAndContract feeAndContract) { + this.feeAndContract = feeAndContract; + return this; + } + + /** + * Get feeAndContract + * + * @return feeAndContract + */ + @jakarta.annotation.Nullable + @Valid + public DefiPreviewFeeAndContract getFeeAndContract() { + return feeAndContract; + } + + public void setFeeAndContract( + @jakarta.annotation.Nullable DefiPreviewFeeAndContract feeAndContract) { + this.feeAndContract = feeAndContract; + } + + public DefiTxResponsePreview healthFactor( + @jakarta.annotation.Nullable DefiPreviewHealthFactor healthFactor) { + this.healthFactor = healthFactor; + return this; + } + + /** + * Get healthFactor + * + * @return healthFactor + */ + @jakarta.annotation.Nullable + @Valid + public DefiPreviewHealthFactor getHealthFactor() { + return healthFactor; + } + + public void setHealthFactor(@jakarta.annotation.Nullable DefiPreviewHealthFactor healthFactor) { + this.healthFactor = healthFactor; + } + + public DefiTxResponsePreview warnings( + @jakarta.annotation.Nullable List<@Valid DefiPreviewWarningsInner> warnings) { + this.warnings = warnings; + return this; + } + + public DefiTxResponsePreview addWarningsItem(DefiPreviewWarningsInner warningsItem) { + if (this.warnings == null) { + this.warnings = new ArrayList<>(); + } + this.warnings.add(warningsItem); + return this; + } + + /** + * Non-blocking risk warnings. Empty array when there are no warnings. + * + * @return warnings + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid DefiPreviewWarningsInner> getWarnings() { + return warnings; + } + + public void setWarnings( + @jakarta.annotation.Nullable List<@Valid DefiPreviewWarningsInner> warnings) { + this.warnings = warnings; + } + + public DefiTxResponsePreview errorMessage(@jakarta.annotation.Nullable String errorMessage) { + this.errorMessage = errorMessage; + return this; + } + + /** + * Error message when the simulated transaction is expected to fail. + * + * @return errorMessage + */ + @jakarta.annotation.Nullable + public String getErrorMessage() { + return errorMessage; + } + + public void setErrorMessage(@jakarta.annotation.Nullable String errorMessage) { + this.errorMessage = errorMessage; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DefiTxResponsePreview defiTxResponsePreview = (DefiTxResponsePreview) o; + return Objects.equals(this.success, defiTxResponsePreview.success) + && Objects.equals(this.balanceChange, defiTxResponsePreview.balanceChange) + && Objects.equals(this.feeAndContract, defiTxResponsePreview.feeAndContract) + && Objects.equals(this.healthFactor, defiTxResponsePreview.healthFactor) + && Objects.equals(this.warnings, defiTxResponsePreview.warnings) + && Objects.equals(this.errorMessage, defiTxResponsePreview.errorMessage); + } + + @Override + public int hashCode() { + return Objects.hash( + success, balanceChange, feeAndContract, healthFactor, warnings, errorMessage); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DefiTxResponsePreview {\n"); + sb.append(" success: ").append(toIndentedString(success)).append("\n"); + sb.append(" balanceChange: ").append(toIndentedString(balanceChange)).append("\n"); + sb.append(" feeAndContract: ").append(toIndentedString(feeAndContract)).append("\n"); + sb.append(" healthFactor: ").append(toIndentedString(healthFactor)).append("\n"); + sb.append(" warnings: ").append(toIndentedString(warnings)).append("\n"); + sb.append(" errorMessage: ").append(toIndentedString(errorMessage)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object successValue = getSuccess(); + String successValueAsString = ""; + successValueAsString = successValue.toString(); + sb.append("success=").append(urlEncode(successValueAsString)).append(""); + Object balanceChangeValue = getBalanceChange(); + String balanceChangeValueAsString = ""; + balanceChangeValueAsString = + (String) + ((Collection) balanceChangeValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("balanceChange=").append(urlEncode(balanceChangeValueAsString)).append(""); + Object feeAndContractValue = getFeeAndContract(); + String feeAndContractValueAsString = ""; + feeAndContractValueAsString = feeAndContractValue.toString(); + sb.append("feeAndContract=").append(urlEncode(feeAndContractValueAsString)).append(""); + Object healthFactorValue = getHealthFactor(); + String healthFactorValueAsString = ""; + healthFactorValueAsString = healthFactorValue.toString(); + sb.append("healthFactor=").append(urlEncode(healthFactorValueAsString)).append(""); + Object warningsValue = getWarnings(); + String warningsValueAsString = ""; + warningsValueAsString = + (String) + ((Collection) warningsValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("warnings=").append(urlEncode(warningsValueAsString)).append(""); + Object errorMessageValue = getErrorMessage(); + String errorMessageValueAsString = ""; + errorMessageValueAsString = errorMessageValue.toString(); + sb.append("errorMessage=").append(urlEncode(errorMessageValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("success"); + openapiFields.add("balanceChange"); + openapiFields.add("feeAndContract"); + openapiFields.add("healthFactor"); + openapiFields.add("warnings"); + openapiFields.add("errorMessage"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DefiTxResponsePreview + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DefiTxResponsePreview.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DefiTxResponsePreview is not found in" + + " the empty JSON string", + DefiTxResponsePreview.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("balanceChange") != null && !jsonObj.get("balanceChange").isJsonNull()) { + JsonArray jsonArraybalanceChange = jsonObj.getAsJsonArray("balanceChange"); + if (jsonArraybalanceChange != null) { + // ensure the json data is an array + if (!jsonObj.get("balanceChange").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `balanceChange` to be an array in the JSON" + + " string but got `%s`", + jsonObj.get("balanceChange").toString())); + } + + // validate the optional field `balanceChange` (array) + for (int i = 0; i < jsonArraybalanceChange.size(); i++) { + DefiPreviewBalanceChangeInner.validateJsonElement( + jsonArraybalanceChange.get(i)); + } + ; + } + } + // validate the optional field `feeAndContract` + if (jsonObj.get("feeAndContract") != null && !jsonObj.get("feeAndContract").isJsonNull()) { + DefiPreviewFeeAndContract.validateJsonElement(jsonObj.get("feeAndContract")); + } + // validate the optional field `healthFactor` + if (jsonObj.get("healthFactor") != null && !jsonObj.get("healthFactor").isJsonNull()) { + DefiPreviewHealthFactor.validateJsonElement(jsonObj.get("healthFactor")); + } + if (jsonObj.get("warnings") != null && !jsonObj.get("warnings").isJsonNull()) { + JsonArray jsonArraywarnings = jsonObj.getAsJsonArray("warnings"); + if (jsonArraywarnings != null) { + // ensure the json data is an array + if (!jsonObj.get("warnings").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `warnings` to be an array in the JSON" + + " string but got `%s`", + jsonObj.get("warnings").toString())); + } + + // validate the optional field `warnings` (array) + for (int i = 0; i < jsonArraywarnings.size(); i++) { + DefiPreviewWarningsInner.validateJsonElement(jsonArraywarnings.get(i)); + } + ; + } + } + if ((jsonObj.get("errorMessage") != null && !jsonObj.get("errorMessage").isJsonNull()) + && !jsonObj.get("errorMessage").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `errorMessage` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("errorMessage").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DefiTxResponsePreview.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DefiTxResponsePreview' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(DefiTxResponsePreview.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DefiTxResponsePreview value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DefiTxResponsePreview read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DefiTxResponsePreview given an JSON string + * + * @param jsonString JSON string + * @return An instance of DefiTxResponsePreview + * @throws IOException if the JSON string is invalid with respect to DefiTxResponsePreview + */ + public static DefiTxResponsePreview fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DefiTxResponsePreview.class); + } + + /** + * Convert an instance of DefiTxResponsePreview to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/FeeSource.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/FeeSource.java index 130c1a5..9dd61fd 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/FeeSource.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/FeeSource.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GasLevel.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GasLevel.java index 6d4973b..ff5451a 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GasLevel.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GasLevel.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAddressPnLForSpecificTokenResponse.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAddressPnLForSpecificTokenResponse.java index 4a4c179..31b95d3 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAddressPnLForSpecificTokenResponse.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAddressPnLForSpecificTokenResponse.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAddressPnLForSpecificTokenResponseData.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAddressPnLForSpecificTokenResponseData.java index cbcc80b..f934a31 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAddressPnLForSpecificTokenResponseData.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAddressPnLForSpecificTokenResponseData.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAddressPortfolioOverviewResponse.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAddressPortfolioOverviewResponse.java index 79f80f5..4a338ab 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAddressPortfolioOverviewResponse.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAddressPortfolioOverviewResponse.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAddressPortfolioOverviewResponseData.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAddressPortfolioOverviewResponseData.java index 7e82374..addf979 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAddressPortfolioOverviewResponseData.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAddressPortfolioOverviewResponseData.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAddressPortfolioOverviewResponseDataDailyPnlInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAddressPortfolioOverviewResponseDataDailyPnlInner.java index a1663b2..310ffda 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAddressPortfolioOverviewResponseDataDailyPnlInner.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAddressPortfolioOverviewResponseDataDailyPnlInner.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAddressPortfolioOverviewResponseDataTokenCountByPnlPercent.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAddressPortfolioOverviewResponseDataTokenCountByPnlPercent.java index 2cebe92..7307f58 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAddressPortfolioOverviewResponseDataTokenCountByPnlPercent.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAddressPortfolioOverviewResponseDataTokenCountByPnlPercent.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAddressPortfolioOverviewResponseDataTopPnlTokenListInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAddressPortfolioOverviewResponseDataTopPnlTokenListInner.java index c6a71c2..e5b7b3f 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAddressPortfolioOverviewResponseDataTopPnlTokenListInner.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAddressPortfolioOverviewResponseDataTopPnlTokenListInner.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAddressRecentPnLResponse.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAddressRecentPnLResponse.java index 2b06b8d..705570f 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAddressRecentPnLResponse.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAddressRecentPnLResponse.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAddressRecentPnLResponseData.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAddressRecentPnLResponseData.java index 981d83e..17649dd 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAddressRecentPnLResponseData.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAddressRecentPnLResponseData.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAddressRecentPnLResponseDataPnlListInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAddressRecentPnLResponseDataPnlListInner.java index 219f0e5..f23a585 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAddressRecentPnLResponseDataPnlListInner.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAddressRecentPnLResponseDataPnlListInner.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAddressRecentPnLResponseDataPnlListInnerTokenPositionDuration.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAddressRecentPnLResponseDataPnlListInnerTokenPositionDuration.java index 38fa625..2529fd8 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAddressRecentPnLResponseDataPnlListInnerTokenPositionDuration.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAddressRecentPnLResponseDataPnlListInnerTokenPositionDuration.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAggregatedQuoteResponse.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAggregatedQuoteResponse.java index 9b654ce..3e8f126 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAggregatedQuoteResponse.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAggregatedQuoteResponse.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAggregatedQuoteResponseDataInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAggregatedQuoteResponseDataInner.java index 6fe1b92..d5043ab 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAggregatedQuoteResponseDataInner.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAggregatedQuoteResponseDataInner.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAggregatedQuoteResponseDataInnerDexRouterListInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAggregatedQuoteResponseDataInnerDexRouterListInner.java index 55be516..9974bf4 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAggregatedQuoteResponseDataInnerDexRouterListInner.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAggregatedQuoteResponseDataInnerDexRouterListInner.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAggregatedQuoteResponseDataInnerDexRouterListInnerDexProtocol.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAggregatedQuoteResponseDataInnerDexRouterListInnerDexProtocol.java index 55495bf..614a27e 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAggregatedQuoteResponseDataInnerDexRouterListInnerDexProtocol.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAggregatedQuoteResponseDataInnerDexRouterListInnerDexProtocol.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAggregatedQuoteResponseDataInnerDexRouterListInnerFromToken.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAggregatedQuoteResponseDataInnerDexRouterListInnerFromToken.java index c52983f..5e36b32 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAggregatedQuoteResponseDataInnerDexRouterListInnerFromToken.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAggregatedQuoteResponseDataInnerDexRouterListInnerFromToken.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAggregatedQuoteResponseDataInnerDexRouterListInnerToToken.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAggregatedQuoteResponseDataInnerDexRouterListInnerToToken.java index 04d38d1..6d0d5bd 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAggregatedQuoteResponseDataInnerDexRouterListInnerToToken.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAggregatedQuoteResponseDataInnerDexRouterListInnerToToken.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAggregatedQuoteResponseDataInnerFromToken.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAggregatedQuoteResponseDataInnerFromToken.java index 8bbeedb..3c7ee2c 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAggregatedQuoteResponseDataInnerFromToken.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAggregatedQuoteResponseDataInnerFromToken.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAggregatedQuoteResponseDataInnerToToken.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAggregatedQuoteResponseDataInnerToToken.java index 62a01ac..951cb8c 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAggregatedQuoteResponseDataInnerToToken.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAggregatedQuoteResponseDataInnerToToken.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAggregatorSupportedChainsResponse.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAggregatorSupportedChainsResponse.java index 276e884..e645d86 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAggregatorSupportedChainsResponse.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAggregatorSupportedChainsResponse.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAggregatorSupportedChainsResponseDataInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAggregatorSupportedChainsResponseDataInner.java index 6036b22..b586cb8 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAggregatorSupportedChainsResponseDataInner.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAggregatorSupportedChainsResponseDataInner.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAllTokenBalancesByAddressResponse.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAllTokenBalancesByAddressResponse.java index 30a80bb..7d16183 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAllTokenBalancesByAddressResponse.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAllTokenBalancesByAddressResponse.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAllTokenBalancesByAddressResponseDataInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAllTokenBalancesByAddressResponseDataInner.java index c5c59ea..fb7ace9 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAllTokenBalancesByAddressResponseDataInner.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAllTokenBalancesByAddressResponseDataInner.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAllTokenBalancesByAddressResponseDataInnerTokenAssetsInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAllTokenBalancesByAddressResponseDataInnerTokenAssetsInner.java index 6c37bcf..894474f 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAllTokenBalancesByAddressResponseDataInnerTokenAssetsInner.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetAllTokenBalancesByAddressResponseDataInnerTokenAssetsInner.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetB402SupportedConfigurationsV1Request.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetB402SupportedConfigurationsV1Request.java new file mode 100644 index 0000000..3f387f3 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetB402SupportedConfigurationsV1Request.java @@ -0,0 +1,225 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** GetB402SupportedConfigurationsV1Request */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class GetB402SupportedConfigurationsV1Request { + public static final String SERIALIZED_NAME_BODY = "body"; + + @SerializedName(SERIALIZED_NAME_BODY) + @jakarta.annotation.Nonnull + private Object body; + + public GetB402SupportedConfigurationsV1Request() {} + + public GetB402SupportedConfigurationsV1Request body(@jakarta.annotation.Nonnull Object body) { + this.body = body; + return this; + } + + /** + * Get body + * + * @return body + */ + @jakarta.annotation.Nonnull + @NotNull + public Object getBody() { + return body; + } + + public void setBody(@jakarta.annotation.Nonnull Object body) { + this.body = body; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetB402SupportedConfigurationsV1Request getB402SupportedConfigurationsV1Request = + (GetB402SupportedConfigurationsV1Request) o; + return Objects.equals(this.body, getB402SupportedConfigurationsV1Request.body); + } + + @Override + public int hashCode() { + return Objects.hash(body); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetB402SupportedConfigurationsV1Request {\n"); + sb.append(" body: ").append(toIndentedString(body)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object bodyValue = getBody(); + String bodyValueAsString = ""; + bodyValueAsString = bodyValue.toString(); + sb.append("body=").append(urlEncode(bodyValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("body"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("body"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetB402SupportedConfigurationsV1Request + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetB402SupportedConfigurationsV1Request.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " GetB402SupportedConfigurationsV1Request is not found in the" + + " empty JSON string", + GetB402SupportedConfigurationsV1Request.openapiRequiredFields + .toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GetB402SupportedConfigurationsV1Request.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetB402SupportedConfigurationsV1Request.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes 'GetB402SupportedConfigurationsV1Request' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(GetB402SupportedConfigurationsV1Request.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, GetB402SupportedConfigurationsV1Request value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetB402SupportedConfigurationsV1Request read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetB402SupportedConfigurationsV1Request given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetB402SupportedConfigurationsV1Request + * @throws IOException if the JSON string is invalid with respect to + * GetB402SupportedConfigurationsV1Request + */ + public static GetB402SupportedConfigurationsV1Request fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, GetB402SupportedConfigurationsV1Request.class); + } + + /** + * Convert an instance of GetB402SupportedConfigurationsV1Request to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetB402SupportedConfigurationsV1Response.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetB402SupportedConfigurationsV1Response.java new file mode 100644 index 0000000..f0ce88d --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetB402SupportedConfigurationsV1Response.java @@ -0,0 +1,339 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.common.AbstractOpenApiSchema; +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; +import org.hibernate.validator.constraints.*; + +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class GetB402SupportedConfigurationsV1Response extends AbstractOpenApiSchema { + private static final Logger log = + Logger.getLogger(GetB402SupportedConfigurationsV1Response.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetB402SupportedConfigurationsV1Response.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'GetB402SupportedConfigurationsV1Response' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter + adapterGetB402SupportedConfigurationsV1Response1 = + gson.getDelegateAdapter( + this, + TypeToken.get(GetB402SupportedConfigurationsV1Response1.class)); + final TypeAdapter + adapterGetB402SupportedConfigurationsV1Response2 = + gson.getDelegateAdapter( + this, + TypeToken.get(GetB402SupportedConfigurationsV1Response2.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, GetB402SupportedConfigurationsV1Response value) + throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type + // `GetB402SupportedConfigurationsV1Response1` + if (value.getActualInstance() + instanceof GetB402SupportedConfigurationsV1Response1) { + JsonElement element = + adapterGetB402SupportedConfigurationsV1Response1.toJsonTree( + (GetB402SupportedConfigurationsV1Response1) + value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type + // `GetB402SupportedConfigurationsV1Response2` + if (value.getActualInstance() + instanceof GetB402SupportedConfigurationsV1Response2) { + JsonElement element = + adapterGetB402SupportedConfigurationsV1Response2.toJsonTree( + (GetB402SupportedConfigurationsV1Response2) + value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException( + "Failed to serialize as the type doesn't match oneOf schemas:" + + " GetB402SupportedConfigurationsV1Response1," + + " GetB402SupportedConfigurationsV1Response2"); + } + + @Override + public GetB402SupportedConfigurationsV1Response read(JsonReader in) + throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize GetB402SupportedConfigurationsV1Response1 + try { + // validate the JSON object to see if any exception is thrown + GetB402SupportedConfigurationsV1Response1.validateJsonElement( + jsonElement); + actualAdapter = adapterGetB402SupportedConfigurationsV1Response1; + match++; + log.log( + Level.FINER, + "Input data matches schema" + + " 'GetB402SupportedConfigurationsV1Response1'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add( + String.format( + "Deserialization for" + + " GetB402SupportedConfigurationsV1Response1" + + " failed with `%s`.", + e.getMessage())); + log.log( + Level.FINER, + "Input data does not match schema" + + " 'GetB402SupportedConfigurationsV1Response1'", + e); + } + // deserialize GetB402SupportedConfigurationsV1Response2 + try { + // validate the JSON object to see if any exception is thrown + GetB402SupportedConfigurationsV1Response2.validateJsonElement( + jsonElement); + actualAdapter = adapterGetB402SupportedConfigurationsV1Response2; + match++; + log.log( + Level.FINER, + "Input data matches schema" + + " 'GetB402SupportedConfigurationsV1Response2'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add( + String.format( + "Deserialization for" + + " GetB402SupportedConfigurationsV1Response2" + + " failed with `%s`.", + e.getMessage())); + log.log( + Level.FINER, + "Input data does not match schema" + + " 'GetB402SupportedConfigurationsV1Response2'", + e); + } + + if (match == 1) { + GetB402SupportedConfigurationsV1Response ret = + new GetB402SupportedConfigurationsV1Response(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException( + String.format( + "Failed deserialization for" + + " GetB402SupportedConfigurationsV1Response: %d" + + " classes match result, expected 1. Detailed" + + " failure message for oneOf schemas: %s. JSON:" + + " %s", + match, errorMessages, jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap>(); + + public GetB402SupportedConfigurationsV1Response() { + super("oneOf", Boolean.FALSE); + } + + public GetB402SupportedConfigurationsV1Response(Object o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put( + "GetB402SupportedConfigurationsV1Response1", + GetB402SupportedConfigurationsV1Response1.class); + schemas.put( + "GetB402SupportedConfigurationsV1Response2", + GetB402SupportedConfigurationsV1Response2.class); + } + + @Override + public Map> getSchemas() { + return GetB402SupportedConfigurationsV1Response.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: GetB402SupportedConfigurationsV1Response1, + * GetB402SupportedConfigurationsV1Response2 + * + *

It could be an instance of the 'oneOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof GetB402SupportedConfigurationsV1Response1) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof GetB402SupportedConfigurationsV1Response2) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException( + "Invalid instance type. Must be GetB402SupportedConfigurationsV1Response1," + + " GetB402SupportedConfigurationsV1Response2"); + } + + /** + * Get the actual instance, which can be the following: + * GetB402SupportedConfigurationsV1Response1, GetB402SupportedConfigurationsV1Response2 + * + * @return The actual instance (GetB402SupportedConfigurationsV1Response1, + * GetB402SupportedConfigurationsV1Response2) + */ + @SuppressWarnings("unchecked") + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `GetB402SupportedConfigurationsV1Response1`. If the actual + * instance is not `GetB402SupportedConfigurationsV1Response1`, the ClassCastException will be + * thrown. + * + * @return The actual instance of `GetB402SupportedConfigurationsV1Response1` + * @throws ClassCastException if the instance is not `GetB402SupportedConfigurationsV1Response1` + */ + public GetB402SupportedConfigurationsV1Response1 getGetB402SupportedConfigurationsV1Response1() + throws ClassCastException { + return (GetB402SupportedConfigurationsV1Response1) super.getActualInstance(); + } + + /** + * Get the actual instance of `GetB402SupportedConfigurationsV1Response2`. If the actual + * instance is not `GetB402SupportedConfigurationsV1Response2`, the ClassCastException will be + * thrown. + * + * @return The actual instance of `GetB402SupportedConfigurationsV1Response2` + * @throws ClassCastException if the instance is not `GetB402SupportedConfigurationsV1Response2` + */ + public GetB402SupportedConfigurationsV1Response2 getGetB402SupportedConfigurationsV1Response2() + throws ClassCastException { + return (GetB402SupportedConfigurationsV1Response2) super.getActualInstance(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetB402SupportedConfigurationsV1Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate oneOf schemas one by one + int validCount = 0; + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with GetB402SupportedConfigurationsV1Response1 + try { + GetB402SupportedConfigurationsV1Response1.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add( + String.format( + "Deserialization for GetB402SupportedConfigurationsV1Response1 failed" + + " with `%s`.", + e.getMessage())); + // continue to the next one + } + // validate the json string with GetB402SupportedConfigurationsV1Response2 + try { + GetB402SupportedConfigurationsV1Response2.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add( + String.format( + "Deserialization for GetB402SupportedConfigurationsV1Response2 failed" + + " with `%s`.", + e.getMessage())); + // continue to the next one + } + if (validCount != 1) { + throw new IOException( + String.format( + "The JSON string is invalid for" + + " GetB402SupportedConfigurationsV1Response with oneOf schemas:" + + " GetB402SupportedConfigurationsV1Response1," + + " GetB402SupportedConfigurationsV1Response2. %d class(es) match" + + " the result, expected 1. Detailed failure message for oneOf" + + " schemas: %s. JSON: %s", + validCount, errorMessages, jsonElement.toString())); + } + } + + /** + * Create an instance of GetB402SupportedConfigurationsV1Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetB402SupportedConfigurationsV1Response + * @throws IOException if the JSON string is invalid with respect to + * GetB402SupportedConfigurationsV1Response + */ + public static GetB402SupportedConfigurationsV1Response fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, GetB402SupportedConfigurationsV1Response.class); + } + + /** + * Convert an instance of GetB402SupportedConfigurationsV1Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetB402SupportedConfigurationsV1Response1.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetB402SupportedConfigurationsV1Response1.java new file mode 100644 index 0000000..a06fc1c --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetB402SupportedConfigurationsV1Response1.java @@ -0,0 +1,470 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** GetB402SupportedConfigurationsV1Response1 */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class GetB402SupportedConfigurationsV1Response1 { + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + @jakarta.annotation.Nullable + private String status; + + public static final String SERIALIZED_NAME_TYPE = "type"; + + @SerializedName(SERIALIZED_NAME_TYPE) + @jakarta.annotation.Nullable + private String type; + + public static final String SERIALIZED_NAME_CODE = "code"; + + @SerializedName(SERIALIZED_NAME_CODE) + @jakarta.annotation.Nullable + private String code; + + public static final String SERIALIZED_NAME_ERROR_DATA = "errorData"; + + @SerializedName(SERIALIZED_NAME_ERROR_DATA) + @jakarta.annotation.Nullable + private String errorData; + + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + @jakarta.annotation.Nullable + private GetB402SupportedConfigurationsV1Response1Data data; + + public static final String SERIALIZED_NAME_SUB_DATA = "subData"; + + @SerializedName(SERIALIZED_NAME_SUB_DATA) + @jakarta.annotation.Nullable + private Object subData; + + public static final String SERIALIZED_NAME_PARAMS = "params"; + + @SerializedName(SERIALIZED_NAME_PARAMS) + @jakarta.annotation.Nullable + private Object params; + + public GetB402SupportedConfigurationsV1Response1() {} + + public GetB402SupportedConfigurationsV1Response1 status( + @jakarta.annotation.Nullable String status) { + this.status = status; + return this; + } + + /** + * Get status + * + * @return status + */ + @jakarta.annotation.Nullable + public String getStatus() { + return status; + } + + public void setStatus(@jakarta.annotation.Nullable String status) { + this.status = status; + } + + public GetB402SupportedConfigurationsV1Response1 type( + @jakarta.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * + * @return type + */ + @jakarta.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@jakarta.annotation.Nullable String type) { + this.type = type; + } + + public GetB402SupportedConfigurationsV1Response1 code( + @jakarta.annotation.Nullable String code) { + this.code = code; + return this; + } + + /** + * Get code + * + * @return code + */ + @jakarta.annotation.Nullable + public String getCode() { + return code; + } + + public void setCode(@jakarta.annotation.Nullable String code) { + this.code = code; + } + + public GetB402SupportedConfigurationsV1Response1 errorData( + @jakarta.annotation.Nullable String errorData) { + this.errorData = errorData; + return this; + } + + /** + * Get errorData + * + * @return errorData + */ + @jakarta.annotation.Nullable + public String getErrorData() { + return errorData; + } + + public void setErrorData(@jakarta.annotation.Nullable String errorData) { + this.errorData = errorData; + } + + public GetB402SupportedConfigurationsV1Response1 data( + @jakarta.annotation.Nullable GetB402SupportedConfigurationsV1Response1Data data) { + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @jakarta.annotation.Nullable + @Valid + public GetB402SupportedConfigurationsV1Response1Data getData() { + return data; + } + + public void setData( + @jakarta.annotation.Nullable GetB402SupportedConfigurationsV1Response1Data data) { + this.data = data; + } + + public GetB402SupportedConfigurationsV1Response1 subData( + @jakarta.annotation.Nullable Object subData) { + this.subData = subData; + return this; + } + + /** + * Get subData + * + * @return subData + */ + @jakarta.annotation.Nullable + public Object getSubData() { + return subData; + } + + public void setSubData(@jakarta.annotation.Nullable Object subData) { + this.subData = subData; + } + + public GetB402SupportedConfigurationsV1Response1 params( + @jakarta.annotation.Nullable Object params) { + this.params = params; + return this; + } + + /** + * Get params + * + * @return params + */ + @jakarta.annotation.Nullable + public Object getParams() { + return params; + } + + public void setParams(@jakarta.annotation.Nullable Object params) { + this.params = params; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetB402SupportedConfigurationsV1Response1 getB402SupportedConfigurationsV1Response1 = + (GetB402SupportedConfigurationsV1Response1) o; + return Objects.equals(this.status, getB402SupportedConfigurationsV1Response1.status) + && Objects.equals(this.type, getB402SupportedConfigurationsV1Response1.type) + && Objects.equals(this.code, getB402SupportedConfigurationsV1Response1.code) + && Objects.equals( + this.errorData, getB402SupportedConfigurationsV1Response1.errorData) + && Objects.equals(this.data, getB402SupportedConfigurationsV1Response1.data) + && Objects.equals(this.subData, getB402SupportedConfigurationsV1Response1.subData) + && Objects.equals(this.params, getB402SupportedConfigurationsV1Response1.params); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(status, type, code, errorData, data, subData, params); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetB402SupportedConfigurationsV1Response1 {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" errorData: ").append(toIndentedString(errorData)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" subData: ").append(toIndentedString(subData)).append("\n"); + sb.append(" params: ").append(toIndentedString(params)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object statusValue = getStatus(); + String statusValueAsString = ""; + statusValueAsString = statusValue.toString(); + sb.append("status=").append(urlEncode(statusValueAsString)).append(""); + Object typeValue = getType(); + String typeValueAsString = ""; + typeValueAsString = typeValue.toString(); + sb.append("type=").append(urlEncode(typeValueAsString)).append(""); + Object codeValue = getCode(); + String codeValueAsString = ""; + codeValueAsString = codeValue.toString(); + sb.append("code=").append(urlEncode(codeValueAsString)).append(""); + Object errorDataValue = getErrorData(); + String errorDataValueAsString = ""; + errorDataValueAsString = errorDataValue.toString(); + sb.append("errorData=").append(urlEncode(errorDataValueAsString)).append(""); + Object dataValue = getData(); + String dataValueAsString = ""; + dataValueAsString = dataValue.toString(); + sb.append("data=").append(urlEncode(dataValueAsString)).append(""); + Object subDataValue = getSubData(); + String subDataValueAsString = ""; + subDataValueAsString = subDataValue.toString(); + sb.append("subData=").append(urlEncode(subDataValueAsString)).append(""); + Object paramsValue = getParams(); + String paramsValueAsString = ""; + paramsValueAsString = paramsValue.toString(); + sb.append("params=").append(urlEncode(paramsValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("status"); + openapiFields.add("type"); + openapiFields.add("code"); + openapiFields.add("errorData"); + openapiFields.add("data"); + openapiFields.add("subData"); + openapiFields.add("params"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetB402SupportedConfigurationsV1Response1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetB402SupportedConfigurationsV1Response1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " GetB402SupportedConfigurationsV1Response1 is not found in" + + " the empty JSON string", + GetB402SupportedConfigurationsV1Response1.openapiRequiredFields + .toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) + && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `status` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("status").toString())); + } + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) + && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `type` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("type").toString())); + } + if ((jsonObj.get("code") != null && !jsonObj.get("code").isJsonNull()) + && !jsonObj.get("code").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `code` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("code").toString())); + } + if ((jsonObj.get("errorData") != null && !jsonObj.get("errorData").isJsonNull()) + && !jsonObj.get("errorData").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `errorData` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("errorData").toString())); + } + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + GetB402SupportedConfigurationsV1Response1Data.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetB402SupportedConfigurationsV1Response1.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'GetB402SupportedConfigurationsV1Response1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(GetB402SupportedConfigurationsV1Response1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, GetB402SupportedConfigurationsV1Response1 value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetB402SupportedConfigurationsV1Response1 read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetB402SupportedConfigurationsV1Response1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetB402SupportedConfigurationsV1Response1 + * @throws IOException if the JSON string is invalid with respect to + * GetB402SupportedConfigurationsV1Response1 + */ + public static GetB402SupportedConfigurationsV1Response1 fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, GetB402SupportedConfigurationsV1Response1.class); + } + + /** + * Convert an instance of GetB402SupportedConfigurationsV1Response1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetB402SupportedConfigurationsV1Response1Data.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetB402SupportedConfigurationsV1Response1Data.java new file mode 100644 index 0000000..299a41b --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetB402SupportedConfigurationsV1Response1Data.java @@ -0,0 +1,360 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; +import org.hibernate.validator.constraints.*; + +/** GetB402SupportedConfigurationsV1Response1Data */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class GetB402SupportedConfigurationsV1Response1Data { + public static final String SERIALIZED_NAME_KINDS = "kinds"; + + @SerializedName(SERIALIZED_NAME_KINDS) + @jakarta.annotation.Nullable + private List<@Valid GetB402SupportedConfigurationsV1Response1DataKindsInner> kinds; + + public static final String SERIALIZED_NAME_EXTENSIONS = "extensions"; + + @SerializedName(SERIALIZED_NAME_EXTENSIONS) + @jakarta.annotation.Nullable + private List extensions; + + public static final String SERIALIZED_NAME_SIGNERS = "signers"; + + @SerializedName(SERIALIZED_NAME_SIGNERS) + @jakarta.annotation.Nullable + private Map> signers; + + public GetB402SupportedConfigurationsV1Response1Data() {} + + public GetB402SupportedConfigurationsV1Response1Data kinds( + @jakarta.annotation.Nullable + List<@Valid GetB402SupportedConfigurationsV1Response1DataKindsInner> kinds) { + this.kinds = kinds; + return this; + } + + public GetB402SupportedConfigurationsV1Response1Data addKindsItem( + GetB402SupportedConfigurationsV1Response1DataKindsInner kindsItem) { + if (this.kinds == null) { + this.kinds = new ArrayList<>(); + } + this.kinds.add(kindsItem); + return this; + } + + /** + * Get kinds + * + * @return kinds + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid GetB402SupportedConfigurationsV1Response1DataKindsInner> getKinds() { + return kinds; + } + + public void setKinds( + @jakarta.annotation.Nullable + List<@Valid GetB402SupportedConfigurationsV1Response1DataKindsInner> kinds) { + this.kinds = kinds; + } + + public GetB402SupportedConfigurationsV1Response1Data extensions( + @jakarta.annotation.Nullable List extensions) { + this.extensions = extensions; + return this; + } + + public GetB402SupportedConfigurationsV1Response1Data addExtensionsItem(String extensionsItem) { + if (this.extensions == null) { + this.extensions = new ArrayList<>(); + } + this.extensions.add(extensionsItem); + return this; + } + + /** + * Get extensions + * + * @return extensions + */ + @jakarta.annotation.Nullable + public List getExtensions() { + return extensions; + } + + public void setExtensions(@jakarta.annotation.Nullable List extensions) { + this.extensions = extensions; + } + + public GetB402SupportedConfigurationsV1Response1Data signers( + @jakarta.annotation.Nullable Map> signers) { + this.signers = signers; + return this; + } + + public GetB402SupportedConfigurationsV1Response1Data putSignersItem( + String key, List signersItem) { + if (this.signers == null) { + this.signers = new HashMap<>(); + } + this.signers.put(key, signersItem); + return this; + } + + /** + * Get signers + * + * @return signers + */ + @jakarta.annotation.Nullable + @Valid + public Map> getSigners() { + return signers; + } + + public void setSigners(@jakarta.annotation.Nullable Map> signers) { + this.signers = signers; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetB402SupportedConfigurationsV1Response1Data + getB402SupportedConfigurationsV1Response1Data = + (GetB402SupportedConfigurationsV1Response1Data) o; + return Objects.equals(this.kinds, getB402SupportedConfigurationsV1Response1Data.kinds) + && Objects.equals( + this.extensions, getB402SupportedConfigurationsV1Response1Data.extensions) + && Objects.equals( + this.signers, getB402SupportedConfigurationsV1Response1Data.signers); + } + + @Override + public int hashCode() { + return Objects.hash(kinds, extensions, signers); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetB402SupportedConfigurationsV1Response1Data {\n"); + sb.append(" kinds: ").append(toIndentedString(kinds)).append("\n"); + sb.append(" extensions: ").append(toIndentedString(extensions)).append("\n"); + sb.append(" signers: ").append(toIndentedString(signers)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object kindsValue = getKinds(); + String kindsValueAsString = ""; + kindsValueAsString = + (String) + ((Collection) kindsValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("kinds=").append(urlEncode(kindsValueAsString)).append(""); + Object extensionsValue = getExtensions(); + String extensionsValueAsString = ""; + extensionsValueAsString = + (String) + ((Collection) extensionsValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("extensions=").append(urlEncode(extensionsValueAsString)).append(""); + Object signersValue = getSigners(); + String signersValueAsString = ""; + signersValueAsString = signersValue.toString(); + sb.append("signers=").append(urlEncode(signersValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("kinds"); + openapiFields.add("extensions"); + openapiFields.add("signers"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetB402SupportedConfigurationsV1Response1Data + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetB402SupportedConfigurationsV1Response1Data.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " GetB402SupportedConfigurationsV1Response1Data is not found" + + " in the empty JSON string", + GetB402SupportedConfigurationsV1Response1Data.openapiRequiredFields + .toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("kinds") != null && !jsonObj.get("kinds").isJsonNull()) { + JsonArray jsonArraykinds = jsonObj.getAsJsonArray("kinds"); + if (jsonArraykinds != null) { + // ensure the json data is an array + if (!jsonObj.get("kinds").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `kinds` to be an array in the JSON string" + + " but got `%s`", + jsonObj.get("kinds").toString())); + } + + // validate the optional field `kinds` (array) + for (int i = 0; i < jsonArraykinds.size(); i++) { + GetB402SupportedConfigurationsV1Response1DataKindsInner.validateJsonElement( + jsonArraykinds.get(i)); + } + ; + } + } + // ensure the optional json data is an array if present + if (jsonObj.get("extensions") != null + && !jsonObj.get("extensions").isJsonNull() + && !jsonObj.get("extensions").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `extensions` to be an array in the JSON string but" + + " got `%s`", + jsonObj.get("extensions").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetB402SupportedConfigurationsV1Response1Data.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'GetB402SupportedConfigurationsV1Response1Data' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, + TypeToken.get(GetB402SupportedConfigurationsV1Response1Data.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, GetB402SupportedConfigurationsV1Response1Data value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetB402SupportedConfigurationsV1Response1Data read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetB402SupportedConfigurationsV1Response1Data given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetB402SupportedConfigurationsV1Response1Data + * @throws IOException if the JSON string is invalid with respect to + * GetB402SupportedConfigurationsV1Response1Data + */ + public static GetB402SupportedConfigurationsV1Response1Data fromJson(String jsonString) + throws IOException { + return JSON.getGson() + .fromJson(jsonString, GetB402SupportedConfigurationsV1Response1Data.class); + } + + /** + * Convert an instance of GetB402SupportedConfigurationsV1Response1Data to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetB402SupportedConfigurationsV1Response1DataKindsInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetB402SupportedConfigurationsV1Response1DataKindsInner.java new file mode 100644 index 0000000..6e5b6e2 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetB402SupportedConfigurationsV1Response1DataKindsInner.java @@ -0,0 +1,355 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** GetB402SupportedConfigurationsV1Response1DataKindsInner */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class GetB402SupportedConfigurationsV1Response1DataKindsInner { + public static final String SERIALIZED_NAME_X402_VERSION = "x402Version"; + + @SerializedName(SERIALIZED_NAME_X402_VERSION) + @jakarta.annotation.Nullable + private Integer x402Version; + + public static final String SERIALIZED_NAME_SCHEME = "scheme"; + + @SerializedName(SERIALIZED_NAME_SCHEME) + @jakarta.annotation.Nullable + private String scheme; + + public static final String SERIALIZED_NAME_NETWORK = "network"; + + @SerializedName(SERIALIZED_NAME_NETWORK) + @jakarta.annotation.Nullable + private String network; + + public static final String SERIALIZED_NAME_EXTRA = "extra"; + + @SerializedName(SERIALIZED_NAME_EXTRA) + @jakarta.annotation.Nullable + private GetB402SupportedConfigurationsV1Response1DataKindsInnerExtra extra; + + public GetB402SupportedConfigurationsV1Response1DataKindsInner() {} + + public GetB402SupportedConfigurationsV1Response1DataKindsInner x402Version( + @jakarta.annotation.Nullable Integer x402Version) { + this.x402Version = x402Version; + return this; + } + + /** + * Get x402Version + * + * @return x402Version + */ + @jakarta.annotation.Nullable + public Integer getX402Version() { + return x402Version; + } + + public void setX402Version(@jakarta.annotation.Nullable Integer x402Version) { + this.x402Version = x402Version; + } + + public GetB402SupportedConfigurationsV1Response1DataKindsInner scheme( + @jakarta.annotation.Nullable String scheme) { + this.scheme = scheme; + return this; + } + + /** + * Get scheme + * + * @return scheme + */ + @jakarta.annotation.Nullable + public String getScheme() { + return scheme; + } + + public void setScheme(@jakarta.annotation.Nullable String scheme) { + this.scheme = scheme; + } + + public GetB402SupportedConfigurationsV1Response1DataKindsInner network( + @jakarta.annotation.Nullable String network) { + this.network = network; + return this; + } + + /** + * Get network + * + * @return network + */ + @jakarta.annotation.Nullable + public String getNetwork() { + return network; + } + + public void setNetwork(@jakarta.annotation.Nullable String network) { + this.network = network; + } + + public GetB402SupportedConfigurationsV1Response1DataKindsInner extra( + @jakarta.annotation.Nullable + GetB402SupportedConfigurationsV1Response1DataKindsInnerExtra extra) { + this.extra = extra; + return this; + } + + /** + * Get extra + * + * @return extra + */ + @jakarta.annotation.Nullable + @Valid + public GetB402SupportedConfigurationsV1Response1DataKindsInnerExtra getExtra() { + return extra; + } + + public void setExtra( + @jakarta.annotation.Nullable + GetB402SupportedConfigurationsV1Response1DataKindsInnerExtra extra) { + this.extra = extra; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetB402SupportedConfigurationsV1Response1DataKindsInner + getB402SupportedConfigurationsV1Response1DataKindsInner = + (GetB402SupportedConfigurationsV1Response1DataKindsInner) o; + return Objects.equals( + this.x402Version, + getB402SupportedConfigurationsV1Response1DataKindsInner.x402Version) + && Objects.equals( + this.scheme, getB402SupportedConfigurationsV1Response1DataKindsInner.scheme) + && Objects.equals( + this.network, + getB402SupportedConfigurationsV1Response1DataKindsInner.network) + && Objects.equals( + this.extra, getB402SupportedConfigurationsV1Response1DataKindsInner.extra); + } + + @Override + public int hashCode() { + return Objects.hash(x402Version, scheme, network, extra); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetB402SupportedConfigurationsV1Response1DataKindsInner {\n"); + sb.append(" x402Version: ").append(toIndentedString(x402Version)).append("\n"); + sb.append(" scheme: ").append(toIndentedString(scheme)).append("\n"); + sb.append(" network: ").append(toIndentedString(network)).append("\n"); + sb.append(" extra: ").append(toIndentedString(extra)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object x402VersionValue = getX402Version(); + String x402VersionValueAsString = ""; + x402VersionValueAsString = x402VersionValue.toString(); + sb.append("x402Version=").append(urlEncode(x402VersionValueAsString)).append(""); + Object schemeValue = getScheme(); + String schemeValueAsString = ""; + schemeValueAsString = schemeValue.toString(); + sb.append("scheme=").append(urlEncode(schemeValueAsString)).append(""); + Object networkValue = getNetwork(); + String networkValueAsString = ""; + networkValueAsString = networkValue.toString(); + sb.append("network=").append(urlEncode(networkValueAsString)).append(""); + Object extraValue = getExtra(); + String extraValueAsString = ""; + extraValueAsString = extraValue.toString(); + sb.append("extra=").append(urlEncode(extraValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("x402Version"); + openapiFields.add("scheme"); + openapiFields.add("network"); + openapiFields.add("extra"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetB402SupportedConfigurationsV1Response1DataKindsInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetB402SupportedConfigurationsV1Response1DataKindsInner.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " GetB402SupportedConfigurationsV1Response1DataKindsInner is" + + " not found in the empty JSON string", + GetB402SupportedConfigurationsV1Response1DataKindsInner + .openapiRequiredFields + .toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("scheme") != null && !jsonObj.get("scheme").isJsonNull()) + && !jsonObj.get("scheme").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `scheme` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("scheme").toString())); + } + if ((jsonObj.get("network") != null && !jsonObj.get("network").isJsonNull()) + && !jsonObj.get("network").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `network` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("network").toString())); + } + // validate the optional field `extra` + if (jsonObj.get("extra") != null && !jsonObj.get("extra").isJsonNull()) { + GetB402SupportedConfigurationsV1Response1DataKindsInnerExtra.validateJsonElement( + jsonObj.get("extra")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetB402SupportedConfigurationsV1Response1DataKindsInner.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'GetB402SupportedConfigurationsV1Response1DataKindsInner' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, + TypeToken.get( + GetB402SupportedConfigurationsV1Response1DataKindsInner.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, + GetB402SupportedConfigurationsV1Response1DataKindsInner value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetB402SupportedConfigurationsV1Response1DataKindsInner read( + JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetB402SupportedConfigurationsV1Response1DataKindsInner given an JSON + * string + * + * @param jsonString JSON string + * @return An instance of GetB402SupportedConfigurationsV1Response1DataKindsInner + * @throws IOException if the JSON string is invalid with respect to + * GetB402SupportedConfigurationsV1Response1DataKindsInner + */ + public static GetB402SupportedConfigurationsV1Response1DataKindsInner fromJson( + String jsonString) throws IOException { + return JSON.getGson() + .fromJson( + jsonString, GetB402SupportedConfigurationsV1Response1DataKindsInner.class); + } + + /** + * Convert an instance of GetB402SupportedConfigurationsV1Response1DataKindsInner to an JSON + * string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetB402SupportedConfigurationsV1Response1DataKindsInnerExtra.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetB402SupportedConfigurationsV1Response1DataKindsInnerExtra.java new file mode 100644 index 0000000..514215c --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetB402SupportedConfigurationsV1Response1DataKindsInnerExtra.java @@ -0,0 +1,379 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** GetB402SupportedConfigurationsV1Response1DataKindsInnerExtra */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class GetB402SupportedConfigurationsV1Response1DataKindsInnerExtra { + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @jakarta.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_VERSION = "version"; + + @SerializedName(SERIALIZED_NAME_VERSION) + @jakarta.annotation.Nullable + private String version; + + public static final String SERIALIZED_NAME_ASSET_TRANSFER_METHOD = "assetTransferMethod"; + + @SerializedName(SERIALIZED_NAME_ASSET_TRANSFER_METHOD) + @jakarta.annotation.Nullable + private String assetTransferMethod; + + public static final String SERIALIZED_NAME_FACILITATOR_ADDRESS = "facilitatorAddress"; + + @SerializedName(SERIALIZED_NAME_FACILITATOR_ADDRESS) + @jakarta.annotation.Nullable + private String facilitatorAddress; + + public GetB402SupportedConfigurationsV1Response1DataKindsInnerExtra() {} + + public GetB402SupportedConfigurationsV1Response1DataKindsInnerExtra name( + @jakarta.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * + * @return name + */ + @jakarta.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@jakarta.annotation.Nullable String name) { + this.name = name; + } + + public GetB402SupportedConfigurationsV1Response1DataKindsInnerExtra version( + @jakarta.annotation.Nullable String version) { + this.version = version; + return this; + } + + /** + * Get version + * + * @return version + */ + @jakarta.annotation.Nullable + public String getVersion() { + return version; + } + + public void setVersion(@jakarta.annotation.Nullable String version) { + this.version = version; + } + + public GetB402SupportedConfigurationsV1Response1DataKindsInnerExtra assetTransferMethod( + @jakarta.annotation.Nullable String assetTransferMethod) { + this.assetTransferMethod = assetTransferMethod; + return this; + } + + /** + * Get assetTransferMethod + * + * @return assetTransferMethod + */ + @jakarta.annotation.Nullable + public String getAssetTransferMethod() { + return assetTransferMethod; + } + + public void setAssetTransferMethod(@jakarta.annotation.Nullable String assetTransferMethod) { + this.assetTransferMethod = assetTransferMethod; + } + + public GetB402SupportedConfigurationsV1Response1DataKindsInnerExtra facilitatorAddress( + @jakarta.annotation.Nullable String facilitatorAddress) { + this.facilitatorAddress = facilitatorAddress; + return this; + } + + /** + * Get facilitatorAddress + * + * @return facilitatorAddress + */ + @jakarta.annotation.Nullable + public String getFacilitatorAddress() { + return facilitatorAddress; + } + + public void setFacilitatorAddress(@jakarta.annotation.Nullable String facilitatorAddress) { + this.facilitatorAddress = facilitatorAddress; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetB402SupportedConfigurationsV1Response1DataKindsInnerExtra + getB402SupportedConfigurationsV1Response1DataKindsInnerExtra = + (GetB402SupportedConfigurationsV1Response1DataKindsInnerExtra) o; + return Objects.equals( + this.name, + getB402SupportedConfigurationsV1Response1DataKindsInnerExtra.name) + && Objects.equals( + this.version, + getB402SupportedConfigurationsV1Response1DataKindsInnerExtra.version) + && Objects.equals( + this.assetTransferMethod, + getB402SupportedConfigurationsV1Response1DataKindsInnerExtra + .assetTransferMethod) + && Objects.equals( + this.facilitatorAddress, + getB402SupportedConfigurationsV1Response1DataKindsInnerExtra + .facilitatorAddress); + } + + @Override + public int hashCode() { + return Objects.hash(name, version, assetTransferMethod, facilitatorAddress); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetB402SupportedConfigurationsV1Response1DataKindsInnerExtra {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).append("\n"); + sb.append(" assetTransferMethod: ") + .append(toIndentedString(assetTransferMethod)) + .append("\n"); + sb.append(" facilitatorAddress: ") + .append(toIndentedString(facilitatorAddress)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object nameValue = getName(); + String nameValueAsString = ""; + nameValueAsString = nameValue.toString(); + sb.append("name=").append(urlEncode(nameValueAsString)).append(""); + Object versionValue = getVersion(); + String versionValueAsString = ""; + versionValueAsString = versionValue.toString(); + sb.append("version=").append(urlEncode(versionValueAsString)).append(""); + Object assetTransferMethodValue = getAssetTransferMethod(); + String assetTransferMethodValueAsString = ""; + assetTransferMethodValueAsString = assetTransferMethodValue.toString(); + sb.append("assetTransferMethod=") + .append(urlEncode(assetTransferMethodValueAsString)) + .append(""); + Object facilitatorAddressValue = getFacilitatorAddress(); + String facilitatorAddressValueAsString = ""; + facilitatorAddressValueAsString = facilitatorAddressValue.toString(); + sb.append("facilitatorAddress=") + .append(urlEncode(facilitatorAddressValueAsString)) + .append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("version"); + openapiFields.add("assetTransferMethod"); + openapiFields.add("facilitatorAddress"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetB402SupportedConfigurationsV1Response1DataKindsInnerExtra + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetB402SupportedConfigurationsV1Response1DataKindsInnerExtra.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " GetB402SupportedConfigurationsV1Response1DataKindsInnerExtra" + + " is not found in the empty JSON string", + GetB402SupportedConfigurationsV1Response1DataKindsInnerExtra + .openapiRequiredFields + .toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) + && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `name` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("name").toString())); + } + if ((jsonObj.get("version") != null && !jsonObj.get("version").isJsonNull()) + && !jsonObj.get("version").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `version` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("version").toString())); + } + if ((jsonObj.get("assetTransferMethod") != null + && !jsonObj.get("assetTransferMethod").isJsonNull()) + && !jsonObj.get("assetTransferMethod").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `assetTransferMethod` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("assetTransferMethod").toString())); + } + if ((jsonObj.get("facilitatorAddress") != null + && !jsonObj.get("facilitatorAddress").isJsonNull()) + && !jsonObj.get("facilitatorAddress").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `facilitatorAddress` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("facilitatorAddress").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetB402SupportedConfigurationsV1Response1DataKindsInnerExtra.class + .isAssignableFrom(type.getRawType())) { + return null; // this class only serializes + // 'GetB402SupportedConfigurationsV1Response1DataKindsInnerExtra' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter + thisAdapter = + gson.getDelegateAdapter( + this, + TypeToken.get( + GetB402SupportedConfigurationsV1Response1DataKindsInnerExtra + .class)); + + return (TypeAdapter) + new TypeAdapter< + GetB402SupportedConfigurationsV1Response1DataKindsInnerExtra>() { + @Override + public void write( + JsonWriter out, + GetB402SupportedConfigurationsV1Response1DataKindsInnerExtra value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetB402SupportedConfigurationsV1Response1DataKindsInnerExtra read( + JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetB402SupportedConfigurationsV1Response1DataKindsInnerExtra given an + * JSON string + * + * @param jsonString JSON string + * @return An instance of GetB402SupportedConfigurationsV1Response1DataKindsInnerExtra + * @throws IOException if the JSON string is invalid with respect to + * GetB402SupportedConfigurationsV1Response1DataKindsInnerExtra + */ + public static GetB402SupportedConfigurationsV1Response1DataKindsInnerExtra fromJson( + String jsonString) throws IOException { + return JSON.getGson() + .fromJson( + jsonString, + GetB402SupportedConfigurationsV1Response1DataKindsInnerExtra.class); + } + + /** + * Convert an instance of GetB402SupportedConfigurationsV1Response1DataKindsInnerExtra to an + * JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetB402SupportedConfigurationsV1Response2.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetB402SupportedConfigurationsV1Response2.java new file mode 100644 index 0000000..4c6cf2f --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetB402SupportedConfigurationsV1Response2.java @@ -0,0 +1,463 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** GetB402SupportedConfigurationsV1Response2 */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class GetB402SupportedConfigurationsV1Response2 { + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + @jakarta.annotation.Nullable + private String status; + + public static final String SERIALIZED_NAME_TYPE = "type"; + + @SerializedName(SERIALIZED_NAME_TYPE) + @jakarta.annotation.Nullable + private String type; + + public static final String SERIALIZED_NAME_CODE = "code"; + + @SerializedName(SERIALIZED_NAME_CODE) + @jakarta.annotation.Nullable + private String code; + + public static final String SERIALIZED_NAME_ERROR_DATA = "errorData"; + + @SerializedName(SERIALIZED_NAME_ERROR_DATA) + @jakarta.annotation.Nullable + private String errorData; + + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + @jakarta.annotation.Nullable + private Object data; + + public static final String SERIALIZED_NAME_SUB_DATA = "subData"; + + @SerializedName(SERIALIZED_NAME_SUB_DATA) + @jakarta.annotation.Nullable + private Object subData; + + public static final String SERIALIZED_NAME_PARAMS = "params"; + + @SerializedName(SERIALIZED_NAME_PARAMS) + @jakarta.annotation.Nullable + private Object params; + + public GetB402SupportedConfigurationsV1Response2() {} + + public GetB402SupportedConfigurationsV1Response2 status( + @jakarta.annotation.Nullable String status) { + this.status = status; + return this; + } + + /** + * Get status + * + * @return status + */ + @jakarta.annotation.Nullable + public String getStatus() { + return status; + } + + public void setStatus(@jakarta.annotation.Nullable String status) { + this.status = status; + } + + public GetB402SupportedConfigurationsV1Response2 type( + @jakarta.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * + * @return type + */ + @jakarta.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@jakarta.annotation.Nullable String type) { + this.type = type; + } + + public GetB402SupportedConfigurationsV1Response2 code( + @jakarta.annotation.Nullable String code) { + this.code = code; + return this; + } + + /** + * Get code + * + * @return code + */ + @jakarta.annotation.Nullable + public String getCode() { + return code; + } + + public void setCode(@jakarta.annotation.Nullable String code) { + this.code = code; + } + + public GetB402SupportedConfigurationsV1Response2 errorData( + @jakarta.annotation.Nullable String errorData) { + this.errorData = errorData; + return this; + } + + /** + * Get errorData + * + * @return errorData + */ + @jakarta.annotation.Nullable + public String getErrorData() { + return errorData; + } + + public void setErrorData(@jakarta.annotation.Nullable String errorData) { + this.errorData = errorData; + } + + public GetB402SupportedConfigurationsV1Response2 data( + @jakarta.annotation.Nullable Object data) { + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @jakarta.annotation.Nullable + public Object getData() { + return data; + } + + public void setData(@jakarta.annotation.Nullable Object data) { + this.data = data; + } + + public GetB402SupportedConfigurationsV1Response2 subData( + @jakarta.annotation.Nullable Object subData) { + this.subData = subData; + return this; + } + + /** + * Get subData + * + * @return subData + */ + @jakarta.annotation.Nullable + public Object getSubData() { + return subData; + } + + public void setSubData(@jakarta.annotation.Nullable Object subData) { + this.subData = subData; + } + + public GetB402SupportedConfigurationsV1Response2 params( + @jakarta.annotation.Nullable Object params) { + this.params = params; + return this; + } + + /** + * Get params + * + * @return params + */ + @jakarta.annotation.Nullable + public Object getParams() { + return params; + } + + public void setParams(@jakarta.annotation.Nullable Object params) { + this.params = params; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetB402SupportedConfigurationsV1Response2 getB402SupportedConfigurationsV1Response2 = + (GetB402SupportedConfigurationsV1Response2) o; + return Objects.equals(this.status, getB402SupportedConfigurationsV1Response2.status) + && Objects.equals(this.type, getB402SupportedConfigurationsV1Response2.type) + && Objects.equals(this.code, getB402SupportedConfigurationsV1Response2.code) + && Objects.equals( + this.errorData, getB402SupportedConfigurationsV1Response2.errorData) + && Objects.equals(this.data, getB402SupportedConfigurationsV1Response2.data) + && Objects.equals(this.subData, getB402SupportedConfigurationsV1Response2.subData) + && Objects.equals(this.params, getB402SupportedConfigurationsV1Response2.params); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(status, type, code, errorData, data, subData, params); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetB402SupportedConfigurationsV1Response2 {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" errorData: ").append(toIndentedString(errorData)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" subData: ").append(toIndentedString(subData)).append("\n"); + sb.append(" params: ").append(toIndentedString(params)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object statusValue = getStatus(); + String statusValueAsString = ""; + statusValueAsString = statusValue.toString(); + sb.append("status=").append(urlEncode(statusValueAsString)).append(""); + Object typeValue = getType(); + String typeValueAsString = ""; + typeValueAsString = typeValue.toString(); + sb.append("type=").append(urlEncode(typeValueAsString)).append(""); + Object codeValue = getCode(); + String codeValueAsString = ""; + codeValueAsString = codeValue.toString(); + sb.append("code=").append(urlEncode(codeValueAsString)).append(""); + Object errorDataValue = getErrorData(); + String errorDataValueAsString = ""; + errorDataValueAsString = errorDataValue.toString(); + sb.append("errorData=").append(urlEncode(errorDataValueAsString)).append(""); + Object dataValue = getData(); + String dataValueAsString = ""; + dataValueAsString = dataValue.toString(); + sb.append("data=").append(urlEncode(dataValueAsString)).append(""); + Object subDataValue = getSubData(); + String subDataValueAsString = ""; + subDataValueAsString = subDataValue.toString(); + sb.append("subData=").append(urlEncode(subDataValueAsString)).append(""); + Object paramsValue = getParams(); + String paramsValueAsString = ""; + paramsValueAsString = paramsValue.toString(); + sb.append("params=").append(urlEncode(paramsValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("status"); + openapiFields.add("type"); + openapiFields.add("code"); + openapiFields.add("errorData"); + openapiFields.add("data"); + openapiFields.add("subData"); + openapiFields.add("params"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetB402SupportedConfigurationsV1Response2 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetB402SupportedConfigurationsV1Response2.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " GetB402SupportedConfigurationsV1Response2 is not found in" + + " the empty JSON string", + GetB402SupportedConfigurationsV1Response2.openapiRequiredFields + .toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) + && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `status` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("status").toString())); + } + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) + && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `type` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("type").toString())); + } + if ((jsonObj.get("code") != null && !jsonObj.get("code").isJsonNull()) + && !jsonObj.get("code").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `code` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("code").toString())); + } + if ((jsonObj.get("errorData") != null && !jsonObj.get("errorData").isJsonNull()) + && !jsonObj.get("errorData").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `errorData` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("errorData").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetB402SupportedConfigurationsV1Response2.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'GetB402SupportedConfigurationsV1Response2' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(GetB402SupportedConfigurationsV1Response2.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, GetB402SupportedConfigurationsV1Response2 value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetB402SupportedConfigurationsV1Response2 read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetB402SupportedConfigurationsV1Response2 given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetB402SupportedConfigurationsV1Response2 + * @throws IOException if the JSON string is invalid with respect to + * GetB402SupportedConfigurationsV1Response2 + */ + public static GetB402SupportedConfigurationsV1Response2 fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, GetB402SupportedConfigurationsV1Response2.class); + } + + /** + * Convert an instance of GetB402SupportedConfigurationsV1Response2 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetB402SupportedConfigurationsV2Request.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetB402SupportedConfigurationsV2Request.java new file mode 100644 index 0000000..0816c7f --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetB402SupportedConfigurationsV2Request.java @@ -0,0 +1,225 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** GetB402SupportedConfigurationsV2Request */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class GetB402SupportedConfigurationsV2Request { + public static final String SERIALIZED_NAME_BODY = "body"; + + @SerializedName(SERIALIZED_NAME_BODY) + @jakarta.annotation.Nonnull + private Object body; + + public GetB402SupportedConfigurationsV2Request() {} + + public GetB402SupportedConfigurationsV2Request body(@jakarta.annotation.Nonnull Object body) { + this.body = body; + return this; + } + + /** + * Get body + * + * @return body + */ + @jakarta.annotation.Nonnull + @NotNull + public Object getBody() { + return body; + } + + public void setBody(@jakarta.annotation.Nonnull Object body) { + this.body = body; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetB402SupportedConfigurationsV2Request getB402SupportedConfigurationsV2Request = + (GetB402SupportedConfigurationsV2Request) o; + return Objects.equals(this.body, getB402SupportedConfigurationsV2Request.body); + } + + @Override + public int hashCode() { + return Objects.hash(body); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetB402SupportedConfigurationsV2Request {\n"); + sb.append(" body: ").append(toIndentedString(body)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object bodyValue = getBody(); + String bodyValueAsString = ""; + bodyValueAsString = bodyValue.toString(); + sb.append("body=").append(urlEncode(bodyValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("body"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("body"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetB402SupportedConfigurationsV2Request + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetB402SupportedConfigurationsV2Request.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " GetB402SupportedConfigurationsV2Request is not found in the" + + " empty JSON string", + GetB402SupportedConfigurationsV2Request.openapiRequiredFields + .toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GetB402SupportedConfigurationsV2Request.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetB402SupportedConfigurationsV2Request.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes 'GetB402SupportedConfigurationsV2Request' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(GetB402SupportedConfigurationsV2Request.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, GetB402SupportedConfigurationsV2Request value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetB402SupportedConfigurationsV2Request read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetB402SupportedConfigurationsV2Request given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetB402SupportedConfigurationsV2Request + * @throws IOException if the JSON string is invalid with respect to + * GetB402SupportedConfigurationsV2Request + */ + public static GetB402SupportedConfigurationsV2Request fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, GetB402SupportedConfigurationsV2Request.class); + } + + /** + * Convert an instance of GetB402SupportedConfigurationsV2Request to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetB402SupportedConfigurationsV2Response.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetB402SupportedConfigurationsV2Response.java new file mode 100644 index 0000000..9f4dcb0 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetB402SupportedConfigurationsV2Response.java @@ -0,0 +1,339 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.common.AbstractOpenApiSchema; +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; +import org.hibernate.validator.constraints.*; + +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class GetB402SupportedConfigurationsV2Response extends AbstractOpenApiSchema { + private static final Logger log = + Logger.getLogger(GetB402SupportedConfigurationsV2Response.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetB402SupportedConfigurationsV2Response.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'GetB402SupportedConfigurationsV2Response' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter + adapterGetB402SupportedConfigurationsV2Response1 = + gson.getDelegateAdapter( + this, + TypeToken.get(GetB402SupportedConfigurationsV2Response1.class)); + final TypeAdapter + adapterGetB402SupportedConfigurationsV2Response2 = + gson.getDelegateAdapter( + this, + TypeToken.get(GetB402SupportedConfigurationsV2Response2.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, GetB402SupportedConfigurationsV2Response value) + throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type + // `GetB402SupportedConfigurationsV2Response1` + if (value.getActualInstance() + instanceof GetB402SupportedConfigurationsV2Response1) { + JsonElement element = + adapterGetB402SupportedConfigurationsV2Response1.toJsonTree( + (GetB402SupportedConfigurationsV2Response1) + value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type + // `GetB402SupportedConfigurationsV2Response2` + if (value.getActualInstance() + instanceof GetB402SupportedConfigurationsV2Response2) { + JsonElement element = + adapterGetB402SupportedConfigurationsV2Response2.toJsonTree( + (GetB402SupportedConfigurationsV2Response2) + value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException( + "Failed to serialize as the type doesn't match oneOf schemas:" + + " GetB402SupportedConfigurationsV2Response1," + + " GetB402SupportedConfigurationsV2Response2"); + } + + @Override + public GetB402SupportedConfigurationsV2Response read(JsonReader in) + throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize GetB402SupportedConfigurationsV2Response1 + try { + // validate the JSON object to see if any exception is thrown + GetB402SupportedConfigurationsV2Response1.validateJsonElement( + jsonElement); + actualAdapter = adapterGetB402SupportedConfigurationsV2Response1; + match++; + log.log( + Level.FINER, + "Input data matches schema" + + " 'GetB402SupportedConfigurationsV2Response1'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add( + String.format( + "Deserialization for" + + " GetB402SupportedConfigurationsV2Response1" + + " failed with `%s`.", + e.getMessage())); + log.log( + Level.FINER, + "Input data does not match schema" + + " 'GetB402SupportedConfigurationsV2Response1'", + e); + } + // deserialize GetB402SupportedConfigurationsV2Response2 + try { + // validate the JSON object to see if any exception is thrown + GetB402SupportedConfigurationsV2Response2.validateJsonElement( + jsonElement); + actualAdapter = adapterGetB402SupportedConfigurationsV2Response2; + match++; + log.log( + Level.FINER, + "Input data matches schema" + + " 'GetB402SupportedConfigurationsV2Response2'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add( + String.format( + "Deserialization for" + + " GetB402SupportedConfigurationsV2Response2" + + " failed with `%s`.", + e.getMessage())); + log.log( + Level.FINER, + "Input data does not match schema" + + " 'GetB402SupportedConfigurationsV2Response2'", + e); + } + + if (match == 1) { + GetB402SupportedConfigurationsV2Response ret = + new GetB402SupportedConfigurationsV2Response(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException( + String.format( + "Failed deserialization for" + + " GetB402SupportedConfigurationsV2Response: %d" + + " classes match result, expected 1. Detailed" + + " failure message for oneOf schemas: %s. JSON:" + + " %s", + match, errorMessages, jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap>(); + + public GetB402SupportedConfigurationsV2Response() { + super("oneOf", Boolean.FALSE); + } + + public GetB402SupportedConfigurationsV2Response(Object o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put( + "GetB402SupportedConfigurationsV2Response1", + GetB402SupportedConfigurationsV2Response1.class); + schemas.put( + "GetB402SupportedConfigurationsV2Response2", + GetB402SupportedConfigurationsV2Response2.class); + } + + @Override + public Map> getSchemas() { + return GetB402SupportedConfigurationsV2Response.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: GetB402SupportedConfigurationsV2Response1, + * GetB402SupportedConfigurationsV2Response2 + * + *

It could be an instance of the 'oneOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof GetB402SupportedConfigurationsV2Response1) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof GetB402SupportedConfigurationsV2Response2) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException( + "Invalid instance type. Must be GetB402SupportedConfigurationsV2Response1," + + " GetB402SupportedConfigurationsV2Response2"); + } + + /** + * Get the actual instance, which can be the following: + * GetB402SupportedConfigurationsV2Response1, GetB402SupportedConfigurationsV2Response2 + * + * @return The actual instance (GetB402SupportedConfigurationsV2Response1, + * GetB402SupportedConfigurationsV2Response2) + */ + @SuppressWarnings("unchecked") + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `GetB402SupportedConfigurationsV2Response1`. If the actual + * instance is not `GetB402SupportedConfigurationsV2Response1`, the ClassCastException will be + * thrown. + * + * @return The actual instance of `GetB402SupportedConfigurationsV2Response1` + * @throws ClassCastException if the instance is not `GetB402SupportedConfigurationsV2Response1` + */ + public GetB402SupportedConfigurationsV2Response1 getGetB402SupportedConfigurationsV2Response1() + throws ClassCastException { + return (GetB402SupportedConfigurationsV2Response1) super.getActualInstance(); + } + + /** + * Get the actual instance of `GetB402SupportedConfigurationsV2Response2`. If the actual + * instance is not `GetB402SupportedConfigurationsV2Response2`, the ClassCastException will be + * thrown. + * + * @return The actual instance of `GetB402SupportedConfigurationsV2Response2` + * @throws ClassCastException if the instance is not `GetB402SupportedConfigurationsV2Response2` + */ + public GetB402SupportedConfigurationsV2Response2 getGetB402SupportedConfigurationsV2Response2() + throws ClassCastException { + return (GetB402SupportedConfigurationsV2Response2) super.getActualInstance(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetB402SupportedConfigurationsV2Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate oneOf schemas one by one + int validCount = 0; + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with GetB402SupportedConfigurationsV2Response1 + try { + GetB402SupportedConfigurationsV2Response1.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add( + String.format( + "Deserialization for GetB402SupportedConfigurationsV2Response1 failed" + + " with `%s`.", + e.getMessage())); + // continue to the next one + } + // validate the json string with GetB402SupportedConfigurationsV2Response2 + try { + GetB402SupportedConfigurationsV2Response2.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add( + String.format( + "Deserialization for GetB402SupportedConfigurationsV2Response2 failed" + + " with `%s`.", + e.getMessage())); + // continue to the next one + } + if (validCount != 1) { + throw new IOException( + String.format( + "The JSON string is invalid for" + + " GetB402SupportedConfigurationsV2Response with oneOf schemas:" + + " GetB402SupportedConfigurationsV2Response1," + + " GetB402SupportedConfigurationsV2Response2. %d class(es) match" + + " the result, expected 1. Detailed failure message for oneOf" + + " schemas: %s. JSON: %s", + validCount, errorMessages, jsonElement.toString())); + } + } + + /** + * Create an instance of GetB402SupportedConfigurationsV2Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetB402SupportedConfigurationsV2Response + * @throws IOException if the JSON string is invalid with respect to + * GetB402SupportedConfigurationsV2Response + */ + public static GetB402SupportedConfigurationsV2Response fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, GetB402SupportedConfigurationsV2Response.class); + } + + /** + * Convert an instance of GetB402SupportedConfigurationsV2Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetB402SupportedConfigurationsV2Response1.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetB402SupportedConfigurationsV2Response1.java new file mode 100644 index 0000000..38fc3e7 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetB402SupportedConfigurationsV2Response1.java @@ -0,0 +1,470 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** GetB402SupportedConfigurationsV2Response1 */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class GetB402SupportedConfigurationsV2Response1 { + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + @jakarta.annotation.Nullable + private String status; + + public static final String SERIALIZED_NAME_TYPE = "type"; + + @SerializedName(SERIALIZED_NAME_TYPE) + @jakarta.annotation.Nullable + private String type; + + public static final String SERIALIZED_NAME_CODE = "code"; + + @SerializedName(SERIALIZED_NAME_CODE) + @jakarta.annotation.Nullable + private String code; + + public static final String SERIALIZED_NAME_ERROR_DATA = "errorData"; + + @SerializedName(SERIALIZED_NAME_ERROR_DATA) + @jakarta.annotation.Nullable + private String errorData; + + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + @jakarta.annotation.Nullable + private GetB402SupportedConfigurationsV2Response1Data data; + + public static final String SERIALIZED_NAME_SUB_DATA = "subData"; + + @SerializedName(SERIALIZED_NAME_SUB_DATA) + @jakarta.annotation.Nullable + private Object subData; + + public static final String SERIALIZED_NAME_PARAMS = "params"; + + @SerializedName(SERIALIZED_NAME_PARAMS) + @jakarta.annotation.Nullable + private Object params; + + public GetB402SupportedConfigurationsV2Response1() {} + + public GetB402SupportedConfigurationsV2Response1 status( + @jakarta.annotation.Nullable String status) { + this.status = status; + return this; + } + + /** + * Get status + * + * @return status + */ + @jakarta.annotation.Nullable + public String getStatus() { + return status; + } + + public void setStatus(@jakarta.annotation.Nullable String status) { + this.status = status; + } + + public GetB402SupportedConfigurationsV2Response1 type( + @jakarta.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * + * @return type + */ + @jakarta.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@jakarta.annotation.Nullable String type) { + this.type = type; + } + + public GetB402SupportedConfigurationsV2Response1 code( + @jakarta.annotation.Nullable String code) { + this.code = code; + return this; + } + + /** + * Get code + * + * @return code + */ + @jakarta.annotation.Nullable + public String getCode() { + return code; + } + + public void setCode(@jakarta.annotation.Nullable String code) { + this.code = code; + } + + public GetB402SupportedConfigurationsV2Response1 errorData( + @jakarta.annotation.Nullable String errorData) { + this.errorData = errorData; + return this; + } + + /** + * Get errorData + * + * @return errorData + */ + @jakarta.annotation.Nullable + public String getErrorData() { + return errorData; + } + + public void setErrorData(@jakarta.annotation.Nullable String errorData) { + this.errorData = errorData; + } + + public GetB402SupportedConfigurationsV2Response1 data( + @jakarta.annotation.Nullable GetB402SupportedConfigurationsV2Response1Data data) { + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @jakarta.annotation.Nullable + @Valid + public GetB402SupportedConfigurationsV2Response1Data getData() { + return data; + } + + public void setData( + @jakarta.annotation.Nullable GetB402SupportedConfigurationsV2Response1Data data) { + this.data = data; + } + + public GetB402SupportedConfigurationsV2Response1 subData( + @jakarta.annotation.Nullable Object subData) { + this.subData = subData; + return this; + } + + /** + * Get subData + * + * @return subData + */ + @jakarta.annotation.Nullable + public Object getSubData() { + return subData; + } + + public void setSubData(@jakarta.annotation.Nullable Object subData) { + this.subData = subData; + } + + public GetB402SupportedConfigurationsV2Response1 params( + @jakarta.annotation.Nullable Object params) { + this.params = params; + return this; + } + + /** + * Get params + * + * @return params + */ + @jakarta.annotation.Nullable + public Object getParams() { + return params; + } + + public void setParams(@jakarta.annotation.Nullable Object params) { + this.params = params; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetB402SupportedConfigurationsV2Response1 getB402SupportedConfigurationsV2Response1 = + (GetB402SupportedConfigurationsV2Response1) o; + return Objects.equals(this.status, getB402SupportedConfigurationsV2Response1.status) + && Objects.equals(this.type, getB402SupportedConfigurationsV2Response1.type) + && Objects.equals(this.code, getB402SupportedConfigurationsV2Response1.code) + && Objects.equals( + this.errorData, getB402SupportedConfigurationsV2Response1.errorData) + && Objects.equals(this.data, getB402SupportedConfigurationsV2Response1.data) + && Objects.equals(this.subData, getB402SupportedConfigurationsV2Response1.subData) + && Objects.equals(this.params, getB402SupportedConfigurationsV2Response1.params); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(status, type, code, errorData, data, subData, params); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetB402SupportedConfigurationsV2Response1 {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" errorData: ").append(toIndentedString(errorData)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" subData: ").append(toIndentedString(subData)).append("\n"); + sb.append(" params: ").append(toIndentedString(params)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object statusValue = getStatus(); + String statusValueAsString = ""; + statusValueAsString = statusValue.toString(); + sb.append("status=").append(urlEncode(statusValueAsString)).append(""); + Object typeValue = getType(); + String typeValueAsString = ""; + typeValueAsString = typeValue.toString(); + sb.append("type=").append(urlEncode(typeValueAsString)).append(""); + Object codeValue = getCode(); + String codeValueAsString = ""; + codeValueAsString = codeValue.toString(); + sb.append("code=").append(urlEncode(codeValueAsString)).append(""); + Object errorDataValue = getErrorData(); + String errorDataValueAsString = ""; + errorDataValueAsString = errorDataValue.toString(); + sb.append("errorData=").append(urlEncode(errorDataValueAsString)).append(""); + Object dataValue = getData(); + String dataValueAsString = ""; + dataValueAsString = dataValue.toString(); + sb.append("data=").append(urlEncode(dataValueAsString)).append(""); + Object subDataValue = getSubData(); + String subDataValueAsString = ""; + subDataValueAsString = subDataValue.toString(); + sb.append("subData=").append(urlEncode(subDataValueAsString)).append(""); + Object paramsValue = getParams(); + String paramsValueAsString = ""; + paramsValueAsString = paramsValue.toString(); + sb.append("params=").append(urlEncode(paramsValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("status"); + openapiFields.add("type"); + openapiFields.add("code"); + openapiFields.add("errorData"); + openapiFields.add("data"); + openapiFields.add("subData"); + openapiFields.add("params"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetB402SupportedConfigurationsV2Response1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetB402SupportedConfigurationsV2Response1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " GetB402SupportedConfigurationsV2Response1 is not found in" + + " the empty JSON string", + GetB402SupportedConfigurationsV2Response1.openapiRequiredFields + .toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) + && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `status` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("status").toString())); + } + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) + && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `type` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("type").toString())); + } + if ((jsonObj.get("code") != null && !jsonObj.get("code").isJsonNull()) + && !jsonObj.get("code").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `code` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("code").toString())); + } + if ((jsonObj.get("errorData") != null && !jsonObj.get("errorData").isJsonNull()) + && !jsonObj.get("errorData").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `errorData` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("errorData").toString())); + } + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + GetB402SupportedConfigurationsV2Response1Data.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetB402SupportedConfigurationsV2Response1.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'GetB402SupportedConfigurationsV2Response1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(GetB402SupportedConfigurationsV2Response1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, GetB402SupportedConfigurationsV2Response1 value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetB402SupportedConfigurationsV2Response1 read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetB402SupportedConfigurationsV2Response1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetB402SupportedConfigurationsV2Response1 + * @throws IOException if the JSON string is invalid with respect to + * GetB402SupportedConfigurationsV2Response1 + */ + public static GetB402SupportedConfigurationsV2Response1 fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, GetB402SupportedConfigurationsV2Response1.class); + } + + /** + * Convert an instance of GetB402SupportedConfigurationsV2Response1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetB402SupportedConfigurationsV2Response1Data.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetB402SupportedConfigurationsV2Response1Data.java new file mode 100644 index 0000000..250acd8 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetB402SupportedConfigurationsV2Response1Data.java @@ -0,0 +1,375 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; +import org.hibernate.validator.constraints.*; + +/** GetB402SupportedConfigurationsV2Response1Data */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class GetB402SupportedConfigurationsV2Response1Data { + public static final String SERIALIZED_NAME_KINDS = "kinds"; + + @SerializedName(SERIALIZED_NAME_KINDS) + @jakarta.annotation.Nonnull + private List<@Valid GetB402SupportedConfigurationsV2Response1DataKindsInner> kinds; + + public static final String SERIALIZED_NAME_EXTENSIONS = "extensions"; + + @SerializedName(SERIALIZED_NAME_EXTENSIONS) + @jakarta.annotation.Nonnull + private List extensions; + + public static final String SERIALIZED_NAME_SIGNERS = "signers"; + + @SerializedName(SERIALIZED_NAME_SIGNERS) + @jakarta.annotation.Nonnull + private Map> signers; + + public GetB402SupportedConfigurationsV2Response1Data() {} + + public GetB402SupportedConfigurationsV2Response1Data kinds( + @jakarta.annotation.Nonnull + List<@Valid GetB402SupportedConfigurationsV2Response1DataKindsInner> kinds) { + this.kinds = kinds; + return this; + } + + public GetB402SupportedConfigurationsV2Response1Data addKindsItem( + GetB402SupportedConfigurationsV2Response1DataKindsInner kindsItem) { + if (this.kinds == null) { + this.kinds = new ArrayList<>(); + } + this.kinds.add(kindsItem); + return this; + } + + /** + * Get kinds + * + * @return kinds + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public List<@Valid GetB402SupportedConfigurationsV2Response1DataKindsInner> getKinds() { + return kinds; + } + + public void setKinds( + @jakarta.annotation.Nonnull + List<@Valid GetB402SupportedConfigurationsV2Response1DataKindsInner> kinds) { + this.kinds = kinds; + } + + public GetB402SupportedConfigurationsV2Response1Data extensions( + @jakarta.annotation.Nonnull List extensions) { + this.extensions = extensions; + return this; + } + + public GetB402SupportedConfigurationsV2Response1Data addExtensionsItem(String extensionsItem) { + if (this.extensions == null) { + this.extensions = new ArrayList<>(); + } + this.extensions.add(extensionsItem); + return this; + } + + /** + * Get extensions + * + * @return extensions + */ + @jakarta.annotation.Nonnull + @NotNull + public List getExtensions() { + return extensions; + } + + public void setExtensions(@jakarta.annotation.Nonnull List extensions) { + this.extensions = extensions; + } + + public GetB402SupportedConfigurationsV2Response1Data signers( + @jakarta.annotation.Nonnull Map> signers) { + this.signers = signers; + return this; + } + + public GetB402SupportedConfigurationsV2Response1Data putSignersItem( + String key, List signersItem) { + if (this.signers == null) { + this.signers = new HashMap<>(); + } + this.signers.put(key, signersItem); + return this; + } + + /** + * Get signers + * + * @return signers + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public Map> getSigners() { + return signers; + } + + public void setSigners(@jakarta.annotation.Nonnull Map> signers) { + this.signers = signers; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetB402SupportedConfigurationsV2Response1Data + getB402SupportedConfigurationsV2Response1Data = + (GetB402SupportedConfigurationsV2Response1Data) o; + return Objects.equals(this.kinds, getB402SupportedConfigurationsV2Response1Data.kinds) + && Objects.equals( + this.extensions, getB402SupportedConfigurationsV2Response1Data.extensions) + && Objects.equals( + this.signers, getB402SupportedConfigurationsV2Response1Data.signers); + } + + @Override + public int hashCode() { + return Objects.hash(kinds, extensions, signers); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetB402SupportedConfigurationsV2Response1Data {\n"); + sb.append(" kinds: ").append(toIndentedString(kinds)).append("\n"); + sb.append(" extensions: ").append(toIndentedString(extensions)).append("\n"); + sb.append(" signers: ").append(toIndentedString(signers)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object kindsValue = getKinds(); + String kindsValueAsString = ""; + kindsValueAsString = + (String) + ((Collection) kindsValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("kinds=").append(urlEncode(kindsValueAsString)).append(""); + Object extensionsValue = getExtensions(); + String extensionsValueAsString = ""; + extensionsValueAsString = + (String) + ((Collection) extensionsValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("extensions=").append(urlEncode(extensionsValueAsString)).append(""); + Object signersValue = getSigners(); + String signersValueAsString = ""; + signersValueAsString = signersValue.toString(); + sb.append("signers=").append(urlEncode(signersValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("kinds"); + openapiFields.add("extensions"); + openapiFields.add("signers"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("kinds"); + openapiRequiredFields.add("extensions"); + openapiRequiredFields.add("signers"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetB402SupportedConfigurationsV2Response1Data + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetB402SupportedConfigurationsV2Response1Data.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " GetB402SupportedConfigurationsV2Response1Data is not found" + + " in the empty JSON string", + GetB402SupportedConfigurationsV2Response1Data.openapiRequiredFields + .toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : + GetB402SupportedConfigurationsV2Response1Data.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("kinds").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `kinds` to be an array in the JSON string but got" + + " `%s`", + jsonObj.get("kinds").toString())); + } + + JsonArray jsonArraykinds = jsonObj.getAsJsonArray("kinds"); + // validate the required field `kinds` (array) + for (int i = 0; i < jsonArraykinds.size(); i++) { + GetB402SupportedConfigurationsV2Response1DataKindsInner.validateJsonElement( + jsonArraykinds.get(i)); + } + ; + // ensure the required json array is present + if (jsonObj.get("extensions") == null) { + throw new IllegalArgumentException( + "Expected the field `linkedContent` to be an array in the JSON string but got" + + " `null`"); + } else if (!jsonObj.get("extensions").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `extensions` to be an array in the JSON string but" + + " got `%s`", + jsonObj.get("extensions").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetB402SupportedConfigurationsV2Response1Data.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'GetB402SupportedConfigurationsV2Response1Data' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, + TypeToken.get(GetB402SupportedConfigurationsV2Response1Data.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, GetB402SupportedConfigurationsV2Response1Data value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetB402SupportedConfigurationsV2Response1Data read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetB402SupportedConfigurationsV2Response1Data given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetB402SupportedConfigurationsV2Response1Data + * @throws IOException if the JSON string is invalid with respect to + * GetB402SupportedConfigurationsV2Response1Data + */ + public static GetB402SupportedConfigurationsV2Response1Data fromJson(String jsonString) + throws IOException { + return JSON.getGson() + .fromJson(jsonString, GetB402SupportedConfigurationsV2Response1Data.class); + } + + /** + * Convert an instance of GetB402SupportedConfigurationsV2Response1Data to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetB402SupportedConfigurationsV2Response1DataKindsInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetB402SupportedConfigurationsV2Response1DataKindsInner.java new file mode 100644 index 0000000..5479743 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetB402SupportedConfigurationsV2Response1DataKindsInner.java @@ -0,0 +1,370 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** GetB402SupportedConfigurationsV2Response1DataKindsInner */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class GetB402SupportedConfigurationsV2Response1DataKindsInner { + public static final String SERIALIZED_NAME_X402_VERSION = "x402Version"; + + @SerializedName(SERIALIZED_NAME_X402_VERSION) + @jakarta.annotation.Nonnull + private Integer x402Version; + + public static final String SERIALIZED_NAME_SCHEME = "scheme"; + + @SerializedName(SERIALIZED_NAME_SCHEME) + @jakarta.annotation.Nonnull + private String scheme; + + public static final String SERIALIZED_NAME_NETWORK = "network"; + + @SerializedName(SERIALIZED_NAME_NETWORK) + @jakarta.annotation.Nonnull + private String network; + + public static final String SERIALIZED_NAME_EXTRA = "extra"; + + @SerializedName(SERIALIZED_NAME_EXTRA) + @jakarta.annotation.Nonnull + private GetB402SupportedConfigurationsV2Response1DataKindsInnerExtra extra; + + public GetB402SupportedConfigurationsV2Response1DataKindsInner() {} + + public GetB402SupportedConfigurationsV2Response1DataKindsInner x402Version( + @jakarta.annotation.Nonnull Integer x402Version) { + this.x402Version = x402Version; + return this; + } + + /** + * Get x402Version + * + * @return x402Version + */ + @jakarta.annotation.Nonnull + @NotNull + public Integer getX402Version() { + return x402Version; + } + + public void setX402Version(@jakarta.annotation.Nonnull Integer x402Version) { + this.x402Version = x402Version; + } + + public GetB402SupportedConfigurationsV2Response1DataKindsInner scheme( + @jakarta.annotation.Nonnull String scheme) { + this.scheme = scheme; + return this; + } + + /** + * Get scheme + * + * @return scheme + */ + @jakarta.annotation.Nonnull + @NotNull + public String getScheme() { + return scheme; + } + + public void setScheme(@jakarta.annotation.Nonnull String scheme) { + this.scheme = scheme; + } + + public GetB402SupportedConfigurationsV2Response1DataKindsInner network( + @jakarta.annotation.Nonnull String network) { + this.network = network; + return this; + } + + /** + * Get network + * + * @return network + */ + @jakarta.annotation.Nonnull + @NotNull + public String getNetwork() { + return network; + } + + public void setNetwork(@jakarta.annotation.Nonnull String network) { + this.network = network; + } + + public GetB402SupportedConfigurationsV2Response1DataKindsInner extra( + @jakarta.annotation.Nonnull + GetB402SupportedConfigurationsV2Response1DataKindsInnerExtra extra) { + this.extra = extra; + return this; + } + + /** + * Get extra + * + * @return extra + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public GetB402SupportedConfigurationsV2Response1DataKindsInnerExtra getExtra() { + return extra; + } + + public void setExtra( + @jakarta.annotation.Nonnull + GetB402SupportedConfigurationsV2Response1DataKindsInnerExtra extra) { + this.extra = extra; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetB402SupportedConfigurationsV2Response1DataKindsInner + getB402SupportedConfigurationsV2Response1DataKindsInner = + (GetB402SupportedConfigurationsV2Response1DataKindsInner) o; + return Objects.equals( + this.x402Version, + getB402SupportedConfigurationsV2Response1DataKindsInner.x402Version) + && Objects.equals( + this.scheme, getB402SupportedConfigurationsV2Response1DataKindsInner.scheme) + && Objects.equals( + this.network, + getB402SupportedConfigurationsV2Response1DataKindsInner.network) + && Objects.equals( + this.extra, getB402SupportedConfigurationsV2Response1DataKindsInner.extra); + } + + @Override + public int hashCode() { + return Objects.hash(x402Version, scheme, network, extra); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetB402SupportedConfigurationsV2Response1DataKindsInner {\n"); + sb.append(" x402Version: ").append(toIndentedString(x402Version)).append("\n"); + sb.append(" scheme: ").append(toIndentedString(scheme)).append("\n"); + sb.append(" network: ").append(toIndentedString(network)).append("\n"); + sb.append(" extra: ").append(toIndentedString(extra)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object x402VersionValue = getX402Version(); + String x402VersionValueAsString = ""; + x402VersionValueAsString = x402VersionValue.toString(); + sb.append("x402Version=").append(urlEncode(x402VersionValueAsString)).append(""); + Object schemeValue = getScheme(); + String schemeValueAsString = ""; + schemeValueAsString = schemeValue.toString(); + sb.append("scheme=").append(urlEncode(schemeValueAsString)).append(""); + Object networkValue = getNetwork(); + String networkValueAsString = ""; + networkValueAsString = networkValue.toString(); + sb.append("network=").append(urlEncode(networkValueAsString)).append(""); + Object extraValue = getExtra(); + String extraValueAsString = ""; + extraValueAsString = extraValue.toString(); + sb.append("extra=").append(urlEncode(extraValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("x402Version"); + openapiFields.add("scheme"); + openapiFields.add("network"); + openapiFields.add("extra"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("x402Version"); + openapiRequiredFields.add("scheme"); + openapiRequiredFields.add("network"); + openapiRequiredFields.add("extra"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetB402SupportedConfigurationsV2Response1DataKindsInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetB402SupportedConfigurationsV2Response1DataKindsInner.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " GetB402SupportedConfigurationsV2Response1DataKindsInner is" + + " not found in the empty JSON string", + GetB402SupportedConfigurationsV2Response1DataKindsInner + .openapiRequiredFields + .toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : + GetB402SupportedConfigurationsV2Response1DataKindsInner.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("scheme").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `scheme` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("scheme").toString())); + } + if (!jsonObj.get("network").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `network` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("network").toString())); + } + // validate the required field `extra` + GetB402SupportedConfigurationsV2Response1DataKindsInnerExtra.validateJsonElement( + jsonObj.get("extra")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetB402SupportedConfigurationsV2Response1DataKindsInner.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'GetB402SupportedConfigurationsV2Response1DataKindsInner' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, + TypeToken.get( + GetB402SupportedConfigurationsV2Response1DataKindsInner.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, + GetB402SupportedConfigurationsV2Response1DataKindsInner value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetB402SupportedConfigurationsV2Response1DataKindsInner read( + JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetB402SupportedConfigurationsV2Response1DataKindsInner given an JSON + * string + * + * @param jsonString JSON string + * @return An instance of GetB402SupportedConfigurationsV2Response1DataKindsInner + * @throws IOException if the JSON string is invalid with respect to + * GetB402SupportedConfigurationsV2Response1DataKindsInner + */ + public static GetB402SupportedConfigurationsV2Response1DataKindsInner fromJson( + String jsonString) throws IOException { + return JSON.getGson() + .fromJson( + jsonString, GetB402SupportedConfigurationsV2Response1DataKindsInner.class); + } + + /** + * Convert an instance of GetB402SupportedConfigurationsV2Response1DataKindsInner to an JSON + * string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetB402SupportedConfigurationsV2Response1DataKindsInnerExtra.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetB402SupportedConfigurationsV2Response1DataKindsInnerExtra.java new file mode 100644 index 0000000..48e5102 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetB402SupportedConfigurationsV2Response1DataKindsInnerExtra.java @@ -0,0 +1,450 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** GetB402SupportedConfigurationsV2Response1DataKindsInnerExtra */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class GetB402SupportedConfigurationsV2Response1DataKindsInnerExtra { + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @jakarta.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_VERSION = "version"; + + @SerializedName(SERIALIZED_NAME_VERSION) + @jakarta.annotation.Nonnull + private String version; + + public static final String SERIALIZED_NAME_ASSET_TRANSFER_METHOD = "assetTransferMethod"; + + @SerializedName(SERIALIZED_NAME_ASSET_TRANSFER_METHOD) + @jakarta.annotation.Nonnull + private String assetTransferMethod; + + public static final String SERIALIZED_NAME_SIGNER_ADDRESS = "signerAddress"; + + @SerializedName(SERIALIZED_NAME_SIGNER_ADDRESS) + @jakarta.annotation.Nonnull + private String signerAddress; + + public static final String SERIALIZED_NAME_SPENDER_ADDRESS = "spenderAddress"; + + @SerializedName(SERIALIZED_NAME_SPENDER_ADDRESS) + @jakarta.annotation.Nullable + private String spenderAddress; + + public GetB402SupportedConfigurationsV2Response1DataKindsInnerExtra() {} + + public GetB402SupportedConfigurationsV2Response1DataKindsInnerExtra name( + @jakarta.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * + * @return name + */ + @jakarta.annotation.Nonnull + @NotNull + public String getName() { + return name; + } + + public void setName(@jakarta.annotation.Nonnull String name) { + this.name = name; + } + + public GetB402SupportedConfigurationsV2Response1DataKindsInnerExtra version( + @jakarta.annotation.Nonnull String version) { + this.version = version; + return this; + } + + /** + * Get version + * + * @return version + */ + @jakarta.annotation.Nonnull + @NotNull + public String getVersion() { + return version; + } + + public void setVersion(@jakarta.annotation.Nonnull String version) { + this.version = version; + } + + public GetB402SupportedConfigurationsV2Response1DataKindsInnerExtra assetTransferMethod( + @jakarta.annotation.Nonnull String assetTransferMethod) { + this.assetTransferMethod = assetTransferMethod; + return this; + } + + /** + * Get assetTransferMethod + * + * @return assetTransferMethod + */ + @jakarta.annotation.Nonnull + @NotNull + public String getAssetTransferMethod() { + return assetTransferMethod; + } + + public void setAssetTransferMethod(@jakarta.annotation.Nonnull String assetTransferMethod) { + this.assetTransferMethod = assetTransferMethod; + } + + public GetB402SupportedConfigurationsV2Response1DataKindsInnerExtra signerAddress( + @jakarta.annotation.Nonnull String signerAddress) { + this.signerAddress = signerAddress; + return this; + } + + /** + * Get signerAddress + * + * @return signerAddress + */ + @jakarta.annotation.Nonnull + @NotNull + public String getSignerAddress() { + return signerAddress; + } + + public void setSignerAddress(@jakarta.annotation.Nonnull String signerAddress) { + this.signerAddress = signerAddress; + } + + public GetB402SupportedConfigurationsV2Response1DataKindsInnerExtra spenderAddress( + @jakarta.annotation.Nullable String spenderAddress) { + this.spenderAddress = spenderAddress; + return this; + } + + /** + * Get spenderAddress + * + * @return spenderAddress + */ + @jakarta.annotation.Nullable + public String getSpenderAddress() { + return spenderAddress; + } + + public void setSpenderAddress(@jakarta.annotation.Nullable String spenderAddress) { + this.spenderAddress = spenderAddress; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetB402SupportedConfigurationsV2Response1DataKindsInnerExtra + getB402SupportedConfigurationsV2Response1DataKindsInnerExtra = + (GetB402SupportedConfigurationsV2Response1DataKindsInnerExtra) o; + return Objects.equals( + this.name, + getB402SupportedConfigurationsV2Response1DataKindsInnerExtra.name) + && Objects.equals( + this.version, + getB402SupportedConfigurationsV2Response1DataKindsInnerExtra.version) + && Objects.equals( + this.assetTransferMethod, + getB402SupportedConfigurationsV2Response1DataKindsInnerExtra + .assetTransferMethod) + && Objects.equals( + this.signerAddress, + getB402SupportedConfigurationsV2Response1DataKindsInnerExtra.signerAddress) + && Objects.equals( + this.spenderAddress, + getB402SupportedConfigurationsV2Response1DataKindsInnerExtra + .spenderAddress); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(name, version, assetTransferMethod, signerAddress, spenderAddress); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetB402SupportedConfigurationsV2Response1DataKindsInnerExtra {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).append("\n"); + sb.append(" assetTransferMethod: ") + .append(toIndentedString(assetTransferMethod)) + .append("\n"); + sb.append(" signerAddress: ").append(toIndentedString(signerAddress)).append("\n"); + sb.append(" spenderAddress: ").append(toIndentedString(spenderAddress)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object nameValue = getName(); + String nameValueAsString = ""; + nameValueAsString = nameValue.toString(); + sb.append("name=").append(urlEncode(nameValueAsString)).append(""); + Object versionValue = getVersion(); + String versionValueAsString = ""; + versionValueAsString = versionValue.toString(); + sb.append("version=").append(urlEncode(versionValueAsString)).append(""); + Object assetTransferMethodValue = getAssetTransferMethod(); + String assetTransferMethodValueAsString = ""; + assetTransferMethodValueAsString = assetTransferMethodValue.toString(); + sb.append("assetTransferMethod=") + .append(urlEncode(assetTransferMethodValueAsString)) + .append(""); + Object signerAddressValue = getSignerAddress(); + String signerAddressValueAsString = ""; + signerAddressValueAsString = signerAddressValue.toString(); + sb.append("signerAddress=").append(urlEncode(signerAddressValueAsString)).append(""); + Object spenderAddressValue = getSpenderAddress(); + String spenderAddressValueAsString = ""; + spenderAddressValueAsString = spenderAddressValue.toString(); + sb.append("spenderAddress=").append(urlEncode(spenderAddressValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("version"); + openapiFields.add("assetTransferMethod"); + openapiFields.add("signerAddress"); + openapiFields.add("spenderAddress"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("version"); + openapiRequiredFields.add("assetTransferMethod"); + openapiRequiredFields.add("signerAddress"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetB402SupportedConfigurationsV2Response1DataKindsInnerExtra + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetB402SupportedConfigurationsV2Response1DataKindsInnerExtra.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " GetB402SupportedConfigurationsV2Response1DataKindsInnerExtra" + + " is not found in the empty JSON string", + GetB402SupportedConfigurationsV2Response1DataKindsInnerExtra + .openapiRequiredFields + .toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : + GetB402SupportedConfigurationsV2Response1DataKindsInnerExtra + .openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `name` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("name").toString())); + } + if (!jsonObj.get("version").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `version` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("version").toString())); + } + if (!jsonObj.get("assetTransferMethod").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `assetTransferMethod` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("assetTransferMethod").toString())); + } + if (!jsonObj.get("signerAddress").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `signerAddress` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("signerAddress").toString())); + } + if ((jsonObj.get("spenderAddress") != null && !jsonObj.get("spenderAddress").isJsonNull()) + && !jsonObj.get("spenderAddress").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `spenderAddress` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("spenderAddress").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetB402SupportedConfigurationsV2Response1DataKindsInnerExtra.class + .isAssignableFrom(type.getRawType())) { + return null; // this class only serializes + // 'GetB402SupportedConfigurationsV2Response1DataKindsInnerExtra' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter + thisAdapter = + gson.getDelegateAdapter( + this, + TypeToken.get( + GetB402SupportedConfigurationsV2Response1DataKindsInnerExtra + .class)); + + return (TypeAdapter) + new TypeAdapter< + GetB402SupportedConfigurationsV2Response1DataKindsInnerExtra>() { + @Override + public void write( + JsonWriter out, + GetB402SupportedConfigurationsV2Response1DataKindsInnerExtra value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetB402SupportedConfigurationsV2Response1DataKindsInnerExtra read( + JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetB402SupportedConfigurationsV2Response1DataKindsInnerExtra given an + * JSON string + * + * @param jsonString JSON string + * @return An instance of GetB402SupportedConfigurationsV2Response1DataKindsInnerExtra + * @throws IOException if the JSON string is invalid with respect to + * GetB402SupportedConfigurationsV2Response1DataKindsInnerExtra + */ + public static GetB402SupportedConfigurationsV2Response1DataKindsInnerExtra fromJson( + String jsonString) throws IOException { + return JSON.getGson() + .fromJson( + jsonString, + GetB402SupportedConfigurationsV2Response1DataKindsInnerExtra.class); + } + + /** + * Convert an instance of GetB402SupportedConfigurationsV2Response1DataKindsInnerExtra to an + * JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetB402SupportedConfigurationsV2Response2.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetB402SupportedConfigurationsV2Response2.java new file mode 100644 index 0000000..853c524 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetB402SupportedConfigurationsV2Response2.java @@ -0,0 +1,463 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** GetB402SupportedConfigurationsV2Response2 */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class GetB402SupportedConfigurationsV2Response2 { + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + @jakarta.annotation.Nullable + private String status; + + public static final String SERIALIZED_NAME_TYPE = "type"; + + @SerializedName(SERIALIZED_NAME_TYPE) + @jakarta.annotation.Nullable + private String type; + + public static final String SERIALIZED_NAME_CODE = "code"; + + @SerializedName(SERIALIZED_NAME_CODE) + @jakarta.annotation.Nullable + private String code; + + public static final String SERIALIZED_NAME_ERROR_DATA = "errorData"; + + @SerializedName(SERIALIZED_NAME_ERROR_DATA) + @jakarta.annotation.Nullable + private String errorData; + + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + @jakarta.annotation.Nullable + private Object data; + + public static final String SERIALIZED_NAME_SUB_DATA = "subData"; + + @SerializedName(SERIALIZED_NAME_SUB_DATA) + @jakarta.annotation.Nullable + private Object subData; + + public static final String SERIALIZED_NAME_PARAMS = "params"; + + @SerializedName(SERIALIZED_NAME_PARAMS) + @jakarta.annotation.Nullable + private Object params; + + public GetB402SupportedConfigurationsV2Response2() {} + + public GetB402SupportedConfigurationsV2Response2 status( + @jakarta.annotation.Nullable String status) { + this.status = status; + return this; + } + + /** + * Get status + * + * @return status + */ + @jakarta.annotation.Nullable + public String getStatus() { + return status; + } + + public void setStatus(@jakarta.annotation.Nullable String status) { + this.status = status; + } + + public GetB402SupportedConfigurationsV2Response2 type( + @jakarta.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * + * @return type + */ + @jakarta.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@jakarta.annotation.Nullable String type) { + this.type = type; + } + + public GetB402SupportedConfigurationsV2Response2 code( + @jakarta.annotation.Nullable String code) { + this.code = code; + return this; + } + + /** + * Get code + * + * @return code + */ + @jakarta.annotation.Nullable + public String getCode() { + return code; + } + + public void setCode(@jakarta.annotation.Nullable String code) { + this.code = code; + } + + public GetB402SupportedConfigurationsV2Response2 errorData( + @jakarta.annotation.Nullable String errorData) { + this.errorData = errorData; + return this; + } + + /** + * Get errorData + * + * @return errorData + */ + @jakarta.annotation.Nullable + public String getErrorData() { + return errorData; + } + + public void setErrorData(@jakarta.annotation.Nullable String errorData) { + this.errorData = errorData; + } + + public GetB402SupportedConfigurationsV2Response2 data( + @jakarta.annotation.Nullable Object data) { + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @jakarta.annotation.Nullable + public Object getData() { + return data; + } + + public void setData(@jakarta.annotation.Nullable Object data) { + this.data = data; + } + + public GetB402SupportedConfigurationsV2Response2 subData( + @jakarta.annotation.Nullable Object subData) { + this.subData = subData; + return this; + } + + /** + * Get subData + * + * @return subData + */ + @jakarta.annotation.Nullable + public Object getSubData() { + return subData; + } + + public void setSubData(@jakarta.annotation.Nullable Object subData) { + this.subData = subData; + } + + public GetB402SupportedConfigurationsV2Response2 params( + @jakarta.annotation.Nullable Object params) { + this.params = params; + return this; + } + + /** + * Get params + * + * @return params + */ + @jakarta.annotation.Nullable + public Object getParams() { + return params; + } + + public void setParams(@jakarta.annotation.Nullable Object params) { + this.params = params; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetB402SupportedConfigurationsV2Response2 getB402SupportedConfigurationsV2Response2 = + (GetB402SupportedConfigurationsV2Response2) o; + return Objects.equals(this.status, getB402SupportedConfigurationsV2Response2.status) + && Objects.equals(this.type, getB402SupportedConfigurationsV2Response2.type) + && Objects.equals(this.code, getB402SupportedConfigurationsV2Response2.code) + && Objects.equals( + this.errorData, getB402SupportedConfigurationsV2Response2.errorData) + && Objects.equals(this.data, getB402SupportedConfigurationsV2Response2.data) + && Objects.equals(this.subData, getB402SupportedConfigurationsV2Response2.subData) + && Objects.equals(this.params, getB402SupportedConfigurationsV2Response2.params); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(status, type, code, errorData, data, subData, params); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetB402SupportedConfigurationsV2Response2 {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" errorData: ").append(toIndentedString(errorData)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" subData: ").append(toIndentedString(subData)).append("\n"); + sb.append(" params: ").append(toIndentedString(params)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object statusValue = getStatus(); + String statusValueAsString = ""; + statusValueAsString = statusValue.toString(); + sb.append("status=").append(urlEncode(statusValueAsString)).append(""); + Object typeValue = getType(); + String typeValueAsString = ""; + typeValueAsString = typeValue.toString(); + sb.append("type=").append(urlEncode(typeValueAsString)).append(""); + Object codeValue = getCode(); + String codeValueAsString = ""; + codeValueAsString = codeValue.toString(); + sb.append("code=").append(urlEncode(codeValueAsString)).append(""); + Object errorDataValue = getErrorData(); + String errorDataValueAsString = ""; + errorDataValueAsString = errorDataValue.toString(); + sb.append("errorData=").append(urlEncode(errorDataValueAsString)).append(""); + Object dataValue = getData(); + String dataValueAsString = ""; + dataValueAsString = dataValue.toString(); + sb.append("data=").append(urlEncode(dataValueAsString)).append(""); + Object subDataValue = getSubData(); + String subDataValueAsString = ""; + subDataValueAsString = subDataValue.toString(); + sb.append("subData=").append(urlEncode(subDataValueAsString)).append(""); + Object paramsValue = getParams(); + String paramsValueAsString = ""; + paramsValueAsString = paramsValue.toString(); + sb.append("params=").append(urlEncode(paramsValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("status"); + openapiFields.add("type"); + openapiFields.add("code"); + openapiFields.add("errorData"); + openapiFields.add("data"); + openapiFields.add("subData"); + openapiFields.add("params"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetB402SupportedConfigurationsV2Response2 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetB402SupportedConfigurationsV2Response2.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " GetB402SupportedConfigurationsV2Response2 is not found in" + + " the empty JSON string", + GetB402SupportedConfigurationsV2Response2.openapiRequiredFields + .toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) + && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `status` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("status").toString())); + } + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) + && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `type` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("type").toString())); + } + if ((jsonObj.get("code") != null && !jsonObj.get("code").isJsonNull()) + && !jsonObj.get("code").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `code` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("code").toString())); + } + if ((jsonObj.get("errorData") != null && !jsonObj.get("errorData").isJsonNull()) + && !jsonObj.get("errorData").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `errorData` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("errorData").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetB402SupportedConfigurationsV2Response2.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'GetB402SupportedConfigurationsV2Response2' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(GetB402SupportedConfigurationsV2Response2.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, GetB402SupportedConfigurationsV2Response2 value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetB402SupportedConfigurationsV2Response2 read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetB402SupportedConfigurationsV2Response2 given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetB402SupportedConfigurationsV2Response2 + * @throws IOException if the JSON string is invalid with respect to + * GetB402SupportedConfigurationsV2Response2 + */ + public static GetB402SupportedConfigurationsV2Response2 fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, GetB402SupportedConfigurationsV2Response2.class); + } + + /** + * Convert an instance of GetB402SupportedConfigurationsV2Response2 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetBroadcastOrdersResponse.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetBroadcastOrdersResponse.java index 7d4f8aa..27b3b4d 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetBroadcastOrdersResponse.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetBroadcastOrdersResponse.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetBroadcastOrdersResponseData.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetBroadcastOrdersResponseData.java index 0a8ad12..cc74750 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetBroadcastOrdersResponseData.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetBroadcastOrdersResponseData.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetBroadcastOrdersResponseDataOrdersInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetBroadcastOrdersResponseDataOrdersInner.java index f6c5798..0db3824 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetBroadcastOrdersResponseDataOrdersInner.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetBroadcastOrdersResponseDataOrdersInner.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetCandlesResponse.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetCandlesResponse.java index f13fd2a..3e75268 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetCandlesResponse.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetCandlesResponse.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetDeFiPositionsRequest.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetDeFiPositionsRequest.java new file mode 100644 index 0000000..e17dcab --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetDeFiPositionsRequest.java @@ -0,0 +1,299 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; +import org.hibernate.validator.constraints.*; + +/** GetDeFiPositionsRequest */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class GetDeFiPositionsRequest { + public static final String SERIALIZED_NAME_ADDRESSES = "addresses"; + + @SerializedName(SERIALIZED_NAME_ADDRESSES) + @jakarta.annotation.Nonnull + private List addresses; + + public static final String SERIALIZED_NAME_BINANCE_CHAIN_IDS = "binanceChainIds"; + + @SerializedName(SERIALIZED_NAME_BINANCE_CHAIN_IDS) + @jakarta.annotation.Nullable + private List binanceChainIds; + + public GetDeFiPositionsRequest() {} + + public GetDeFiPositionsRequest addresses(@jakarta.annotation.Nonnull List addresses) { + this.addresses = addresses; + return this; + } + + public GetDeFiPositionsRequest addAddressesItem(String addressesItem) { + if (this.addresses == null) { + this.addresses = new ArrayList<>(); + } + this.addresses.add(addressesItem); + return this; + } + + /** + * Wallet addresses to query positions for. Up to 3 addresses per request (server-side + * configured and subject to change). + * + * @return addresses + */ + @jakarta.annotation.Nonnull + @NotNull + @Size(max = 3) + public List getAddresses() { + return addresses; + } + + public void setAddresses(@jakarta.annotation.Nonnull List addresses) { + this.addresses = addresses; + } + + public GetDeFiPositionsRequest binanceChainIds( + @jakarta.annotation.Nullable List binanceChainIds) { + this.binanceChainIds = binanceChainIds; + return this; + } + + public GetDeFiPositionsRequest addBinanceChainIdsItem(String binanceChainIdsItem) { + if (this.binanceChainIds == null) { + this.binanceChainIds = new ArrayList<>(); + } + this.binanceChainIds.add(binanceChainIdsItem); + return this; + } + + /** + * Optional chain filter. When set, only positions on the specified chains are returned. This + * release supports BSC (\"56\") only. + * + * @return binanceChainIds + */ + @jakarta.annotation.Nullable + public List getBinanceChainIds() { + return binanceChainIds; + } + + public void setBinanceChainIds(@jakarta.annotation.Nullable List binanceChainIds) { + this.binanceChainIds = binanceChainIds; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetDeFiPositionsRequest getDeFiPositionsRequest = (GetDeFiPositionsRequest) o; + return Objects.equals(this.addresses, getDeFiPositionsRequest.addresses) + && Objects.equals(this.binanceChainIds, getDeFiPositionsRequest.binanceChainIds); + } + + @Override + public int hashCode() { + return Objects.hash(addresses, binanceChainIds); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetDeFiPositionsRequest {\n"); + sb.append(" addresses: ").append(toIndentedString(addresses)).append("\n"); + sb.append(" binanceChainIds: ").append(toIndentedString(binanceChainIds)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object addressesValue = getAddresses(); + String addressesValueAsString = ""; + addressesValueAsString = + (String) + ((Collection) addressesValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("addresses=").append(urlEncode(addressesValueAsString)).append(""); + Object binanceChainIdsValue = getBinanceChainIds(); + String binanceChainIdsValueAsString = ""; + binanceChainIdsValueAsString = + (String) + ((Collection) binanceChainIdsValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("binanceChainIds=").append(urlEncode(binanceChainIdsValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("addresses"); + openapiFields.add("binanceChainIds"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("addresses"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to GetDeFiPositionsRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetDeFiPositionsRequest.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetDeFiPositionsRequest is not found" + + " in the empty JSON string", + GetDeFiPositionsRequest.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GetDeFiPositionsRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the required json array is present + if (jsonObj.get("addresses") == null) { + throw new IllegalArgumentException( + "Expected the field `linkedContent` to be an array in the JSON string but got" + + " `null`"); + } else if (!jsonObj.get("addresses").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `addresses` to be an array in the JSON string but" + + " got `%s`", + jsonObj.get("addresses").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("binanceChainIds") != null + && !jsonObj.get("binanceChainIds").isJsonNull() + && !jsonObj.get("binanceChainIds").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `binanceChainIds` to be an array in the JSON string" + + " but got `%s`", + jsonObj.get("binanceChainIds").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetDeFiPositionsRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetDeFiPositionsRequest' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(GetDeFiPositionsRequest.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetDeFiPositionsRequest value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetDeFiPositionsRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetDeFiPositionsRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetDeFiPositionsRequest + * @throws IOException if the JSON string is invalid with respect to GetDeFiPositionsRequest + */ + public static GetDeFiPositionsRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetDeFiPositionsRequest.class); + } + + /** + * Convert an instance of GetDeFiPositionsRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetDeFiPositionsResponse.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetDeFiPositionsResponse.java new file mode 100644 index 0000000..41b2fcb --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetDeFiPositionsResponse.java @@ -0,0 +1,346 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** GetDeFiPositionsResponse */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class GetDeFiPositionsResponse { + public static final String SERIALIZED_NAME_CODE = "code"; + + @SerializedName(SERIALIZED_NAME_CODE) + @jakarta.annotation.Nullable + private Integer code; + + public static final String SERIALIZED_NAME_MSG = "msg"; + + @SerializedName(SERIALIZED_NAME_MSG) + @jakarta.annotation.Nullable + private String msg; + + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + @jakarta.annotation.Nullable + private GetDeFiPositionsResponseData data; + + public static final String SERIALIZED_NAME_TIMESTAMP = "timestamp"; + + @SerializedName(SERIALIZED_NAME_TIMESTAMP) + @jakarta.annotation.Nullable + private Long timestamp; + + public static final String SERIALIZED_NAME_SUCCESS = "success"; + + @SerializedName(SERIALIZED_NAME_SUCCESS) + @jakarta.annotation.Nullable + private Boolean success; + + public GetDeFiPositionsResponse() {} + + public GetDeFiPositionsResponse code(@jakarta.annotation.Nullable Integer code) { + this.code = code; + return this; + } + + /** + * Business status code. 0 indicates success. + * + * @return code + */ + @jakarta.annotation.Nullable + public Integer getCode() { + return code; + } + + public void setCode(@jakarta.annotation.Nullable Integer code) { + this.code = code; + } + + public GetDeFiPositionsResponse msg(@jakarta.annotation.Nullable String msg) { + this.msg = msg; + return this; + } + + /** + * Human-readable status message. + * + * @return msg + */ + @jakarta.annotation.Nullable + public String getMsg() { + return msg; + } + + public void setMsg(@jakarta.annotation.Nullable String msg) { + this.msg = msg; + } + + public GetDeFiPositionsResponse data( + @jakarta.annotation.Nullable GetDeFiPositionsResponseData data) { + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @jakarta.annotation.Nullable + @Valid + public GetDeFiPositionsResponseData getData() { + return data; + } + + public void setData(@jakarta.annotation.Nullable GetDeFiPositionsResponseData data) { + this.data = data; + } + + public GetDeFiPositionsResponse timestamp(@jakarta.annotation.Nullable Long timestamp) { + this.timestamp = timestamp; + return this; + } + + /** + * Server timestamp in milliseconds. + * + * @return timestamp + */ + @jakarta.annotation.Nullable + public Long getTimestamp() { + return timestamp; + } + + public void setTimestamp(@jakarta.annotation.Nullable Long timestamp) { + this.timestamp = timestamp; + } + + public GetDeFiPositionsResponse success(@jakarta.annotation.Nullable Boolean success) { + this.success = success; + return this; + } + + /** + * Whether the request succeeded (mirrors `code == 0`). + * + * @return success + */ + @jakarta.annotation.Nullable + public Boolean getSuccess() { + return success; + } + + public void setSuccess(@jakarta.annotation.Nullable Boolean success) { + this.success = success; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetDeFiPositionsResponse getDeFiPositionsResponse = (GetDeFiPositionsResponse) o; + return Objects.equals(this.code, getDeFiPositionsResponse.code) + && Objects.equals(this.msg, getDeFiPositionsResponse.msg) + && Objects.equals(this.data, getDeFiPositionsResponse.data) + && Objects.equals(this.timestamp, getDeFiPositionsResponse.timestamp) + && Objects.equals(this.success, getDeFiPositionsResponse.success); + } + + @Override + public int hashCode() { + return Objects.hash(code, msg, data, timestamp, success); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetDeFiPositionsResponse {\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" msg: ").append(toIndentedString(msg)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" timestamp: ").append(toIndentedString(timestamp)).append("\n"); + sb.append(" success: ").append(toIndentedString(success)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object codeValue = getCode(); + String codeValueAsString = ""; + codeValueAsString = codeValue.toString(); + sb.append("code=").append(urlEncode(codeValueAsString)).append(""); + Object msgValue = getMsg(); + String msgValueAsString = ""; + msgValueAsString = msgValue.toString(); + sb.append("msg=").append(urlEncode(msgValueAsString)).append(""); + Object dataValue = getData(); + String dataValueAsString = ""; + dataValueAsString = dataValue.toString(); + sb.append("data=").append(urlEncode(dataValueAsString)).append(""); + Object timestampValue = getTimestamp(); + String timestampValueAsString = ""; + timestampValueAsString = timestampValue.toString(); + sb.append("timestamp=").append(urlEncode(timestampValueAsString)).append(""); + Object successValue = getSuccess(); + String successValueAsString = ""; + successValueAsString = successValue.toString(); + sb.append("success=").append(urlEncode(successValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("code"); + openapiFields.add("msg"); + openapiFields.add("data"); + openapiFields.add("timestamp"); + openapiFields.add("success"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to GetDeFiPositionsResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetDeFiPositionsResponse.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetDeFiPositionsResponse is not found" + + " in the empty JSON string", + GetDeFiPositionsResponse.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("msg") != null && !jsonObj.get("msg").isJsonNull()) + && !jsonObj.get("msg").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `msg` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("msg").toString())); + } + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + GetDeFiPositionsResponseData.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetDeFiPositionsResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetDeFiPositionsResponse' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(GetDeFiPositionsResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetDeFiPositionsResponse value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetDeFiPositionsResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetDeFiPositionsResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetDeFiPositionsResponse + * @throws IOException if the JSON string is invalid with respect to GetDeFiPositionsResponse + */ + public static GetDeFiPositionsResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetDeFiPositionsResponse.class); + } + + /** + * Convert an instance of GetDeFiPositionsResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetDeFiPositionsResponseData.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetDeFiPositionsResponseData.java new file mode 100644 index 0000000..9901e45 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetDeFiPositionsResponseData.java @@ -0,0 +1,291 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; +import org.hibernate.validator.constraints.*; + +/** Aggregated DeFi positions response. */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class GetDeFiPositionsResponseData { + public static final String SERIALIZED_NAME_TOTAL_VALUE = "totalValue"; + + @SerializedName(SERIALIZED_NAME_TOTAL_VALUE) + @jakarta.annotation.Nullable + private String totalValue; + + public static final String SERIALIZED_NAME_ADDRESS_LIST = "addressList"; + + @SerializedName(SERIALIZED_NAME_ADDRESS_LIST) + @jakarta.annotation.Nullable + private List<@Valid GetDeFiPositionsResponseDataAddressListInner> addressList; + + public GetDeFiPositionsResponseData() {} + + public GetDeFiPositionsResponseData totalValue(@jakarta.annotation.Nullable String totalValue) { + this.totalValue = totalValue; + return this; + } + + /** + * Total value of all DeFi positions of all queried addresses (USD). Same raw precision as + * addressTotalValue. + * + * @return totalValue + */ + @jakarta.annotation.Nullable + public String getTotalValue() { + return totalValue; + } + + public void setTotalValue(@jakarta.annotation.Nullable String totalValue) { + this.totalValue = totalValue; + } + + public GetDeFiPositionsResponseData addressList( + @jakarta.annotation.Nullable + List<@Valid GetDeFiPositionsResponseDataAddressListInner> addressList) { + this.addressList = addressList; + return this; + } + + public GetDeFiPositionsResponseData addAddressListItem( + GetDeFiPositionsResponseDataAddressListInner addressListItem) { + if (this.addressList == null) { + this.addressList = new ArrayList<>(); + } + this.addressList.add(addressListItem); + return this; + } + + /** + * Address-level position summaries. + * + * @return addressList + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid GetDeFiPositionsResponseDataAddressListInner> getAddressList() { + return addressList; + } + + public void setAddressList( + @jakarta.annotation.Nullable + List<@Valid GetDeFiPositionsResponseDataAddressListInner> addressList) { + this.addressList = addressList; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetDeFiPositionsResponseData getDeFiPositionsResponseData = + (GetDeFiPositionsResponseData) o; + return Objects.equals(this.totalValue, getDeFiPositionsResponseData.totalValue) + && Objects.equals(this.addressList, getDeFiPositionsResponseData.addressList); + } + + @Override + public int hashCode() { + return Objects.hash(totalValue, addressList); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetDeFiPositionsResponseData {\n"); + sb.append(" totalValue: ").append(toIndentedString(totalValue)).append("\n"); + sb.append(" addressList: ").append(toIndentedString(addressList)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object totalValueValue = getTotalValue(); + String totalValueValueAsString = ""; + totalValueValueAsString = totalValueValue.toString(); + sb.append("totalValue=").append(urlEncode(totalValueValueAsString)).append(""); + Object addressListValue = getAddressList(); + String addressListValueAsString = ""; + addressListValueAsString = + (String) + ((Collection) addressListValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("addressList=").append(urlEncode(addressListValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("totalValue"); + openapiFields.add("addressList"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetDeFiPositionsResponseData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetDeFiPositionsResponseData.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetDeFiPositionsResponseData is not" + + " found in the empty JSON string", + GetDeFiPositionsResponseData.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("totalValue") != null && !jsonObj.get("totalValue").isJsonNull()) + && !jsonObj.get("totalValue").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `totalValue` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("totalValue").toString())); + } + if (jsonObj.get("addressList") != null && !jsonObj.get("addressList").isJsonNull()) { + JsonArray jsonArrayaddressList = jsonObj.getAsJsonArray("addressList"); + if (jsonArrayaddressList != null) { + // ensure the json data is an array + if (!jsonObj.get("addressList").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `addressList` to be an array in the JSON" + + " string but got `%s`", + jsonObj.get("addressList").toString())); + } + + // validate the optional field `addressList` (array) + for (int i = 0; i < jsonArrayaddressList.size(); i++) { + GetDeFiPositionsResponseDataAddressListInner.validateJsonElement( + jsonArrayaddressList.get(i)); + } + ; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetDeFiPositionsResponseData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetDeFiPositionsResponseData' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(GetDeFiPositionsResponseData.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetDeFiPositionsResponseData value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetDeFiPositionsResponseData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetDeFiPositionsResponseData given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetDeFiPositionsResponseData + * @throws IOException if the JSON string is invalid with respect to + * GetDeFiPositionsResponseData + */ + public static GetDeFiPositionsResponseData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetDeFiPositionsResponseData.class); + } + + /** + * Convert an instance of GetDeFiPositionsResponseData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetDeFiPositionsResponseDataAddressListInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetDeFiPositionsResponseDataAddressListInner.java new file mode 100644 index 0000000..bba99cf --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetDeFiPositionsResponseDataAddressListInner.java @@ -0,0 +1,353 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; +import org.hibernate.validator.constraints.*; + +/** + * Address-level aggregation. Groups the protocol-level position summaries of one wallet address. + */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class GetDeFiPositionsResponseDataAddressListInner { + public static final String SERIALIZED_NAME_ADDRESS = "address"; + + @SerializedName(SERIALIZED_NAME_ADDRESS) + @jakarta.annotation.Nullable + private String address; + + public static final String SERIALIZED_NAME_ADDRESS_TOTAL_VALUE = "addressTotalValue"; + + @SerializedName(SERIALIZED_NAME_ADDRESS_TOTAL_VALUE) + @jakarta.annotation.Nullable + private String addressTotalValue; + + public static final String SERIALIZED_NAME_PROTOCOL_LIST = "protocolList"; + + @SerializedName(SERIALIZED_NAME_PROTOCOL_LIST) + @jakarta.annotation.Nullable + private List<@Valid GetDeFiPositionsResponseDataAddressListInnerProtocolListInner> protocolList; + + public GetDeFiPositionsResponseDataAddressListInner() {} + + public GetDeFiPositionsResponseDataAddressListInner address( + @jakarta.annotation.Nullable String address) { + this.address = address; + return this; + } + + /** + * Wallet address. + * + * @return address + */ + @jakarta.annotation.Nullable + public String getAddress() { + return address; + } + + public void setAddress(@jakarta.annotation.Nullable String address) { + this.address = address; + } + + public GetDeFiPositionsResponseDataAddressListInner addressTotalValue( + @jakarta.annotation.Nullable String addressTotalValue) { + this.addressTotalValue = addressTotalValue; + return this; + } + + /** + * Total DeFi position value of this address across all chains (USD). Same raw precision as the + * position values. + * + * @return addressTotalValue + */ + @jakarta.annotation.Nullable + public String getAddressTotalValue() { + return addressTotalValue; + } + + public void setAddressTotalValue(@jakarta.annotation.Nullable String addressTotalValue) { + this.addressTotalValue = addressTotalValue; + } + + public GetDeFiPositionsResponseDataAddressListInner protocolList( + @jakarta.annotation.Nullable + List<@Valid GetDeFiPositionsResponseDataAddressListInnerProtocolListInner> + protocolList) { + this.protocolList = protocolList; + return this; + } + + public GetDeFiPositionsResponseDataAddressListInner addProtocolListItem( + GetDeFiPositionsResponseDataAddressListInnerProtocolListInner protocolListItem) { + if (this.protocolList == null) { + this.protocolList = new ArrayList<>(); + } + this.protocolList.add(protocolListItem); + return this; + } + + /** + * Protocol-level position summaries of this address. + * + * @return protocolList + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid GetDeFiPositionsResponseDataAddressListInnerProtocolListInner> + getProtocolList() { + return protocolList; + } + + public void setProtocolList( + @jakarta.annotation.Nullable + List<@Valid GetDeFiPositionsResponseDataAddressListInnerProtocolListInner> + protocolList) { + this.protocolList = protocolList; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetDeFiPositionsResponseDataAddressListInner getDeFiPositionsResponseDataAddressListInner = + (GetDeFiPositionsResponseDataAddressListInner) o; + return Objects.equals(this.address, getDeFiPositionsResponseDataAddressListInner.address) + && Objects.equals( + this.addressTotalValue, + getDeFiPositionsResponseDataAddressListInner.addressTotalValue) + && Objects.equals( + this.protocolList, + getDeFiPositionsResponseDataAddressListInner.protocolList); + } + + @Override + public int hashCode() { + return Objects.hash(address, addressTotalValue, protocolList); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetDeFiPositionsResponseDataAddressListInner {\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append(" addressTotalValue: ").append(toIndentedString(addressTotalValue)).append("\n"); + sb.append(" protocolList: ").append(toIndentedString(protocolList)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object addressValue = getAddress(); + String addressValueAsString = ""; + addressValueAsString = addressValue.toString(); + sb.append("address=").append(urlEncode(addressValueAsString)).append(""); + Object addressTotalValueValue = getAddressTotalValue(); + String addressTotalValueValueAsString = ""; + addressTotalValueValueAsString = addressTotalValueValue.toString(); + sb.append("addressTotalValue=") + .append(urlEncode(addressTotalValueValueAsString)) + .append(""); + Object protocolListValue = getProtocolList(); + String protocolListValueAsString = ""; + protocolListValueAsString = + (String) + ((Collection) protocolListValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("protocolList=").append(urlEncode(protocolListValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("address"); + openapiFields.add("addressTotalValue"); + openapiFields.add("protocolList"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetDeFiPositionsResponseDataAddressListInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetDeFiPositionsResponseDataAddressListInner.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " GetDeFiPositionsResponseDataAddressListInner is not found" + + " in the empty JSON string", + GetDeFiPositionsResponseDataAddressListInner.openapiRequiredFields + .toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("address") != null && !jsonObj.get("address").isJsonNull()) + && !jsonObj.get("address").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `address` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("address").toString())); + } + if ((jsonObj.get("addressTotalValue") != null + && !jsonObj.get("addressTotalValue").isJsonNull()) + && !jsonObj.get("addressTotalValue").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `addressTotalValue` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("addressTotalValue").toString())); + } + if (jsonObj.get("protocolList") != null && !jsonObj.get("protocolList").isJsonNull()) { + JsonArray jsonArrayprotocolList = jsonObj.getAsJsonArray("protocolList"); + if (jsonArrayprotocolList != null) { + // ensure the json data is an array + if (!jsonObj.get("protocolList").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `protocolList` to be an array in the JSON" + + " string but got `%s`", + jsonObj.get("protocolList").toString())); + } + + // validate the optional field `protocolList` (array) + for (int i = 0; i < jsonArrayprotocolList.size(); i++) { + GetDeFiPositionsResponseDataAddressListInnerProtocolListInner + .validateJsonElement(jsonArrayprotocolList.get(i)); + } + ; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetDeFiPositionsResponseDataAddressListInner.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'GetDeFiPositionsResponseDataAddressListInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, + TypeToken.get(GetDeFiPositionsResponseDataAddressListInner.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, GetDeFiPositionsResponseDataAddressListInner value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetDeFiPositionsResponseDataAddressListInner read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetDeFiPositionsResponseDataAddressListInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetDeFiPositionsResponseDataAddressListInner + * @throws IOException if the JSON string is invalid with respect to + * GetDeFiPositionsResponseDataAddressListInner + */ + public static GetDeFiPositionsResponseDataAddressListInner fromJson(String jsonString) + throws IOException { + return JSON.getGson() + .fromJson(jsonString, GetDeFiPositionsResponseDataAddressListInner.class); + } + + /** + * Convert an instance of GetDeFiPositionsResponseDataAddressListInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetDeFiPositionsResponseDataAddressListInnerProtocolListInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetDeFiPositionsResponseDataAddressListInnerProtocolListInner.java new file mode 100644 index 0000000..f8d2d90 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetDeFiPositionsResponseDataAddressListInnerProtocolListInner.java @@ -0,0 +1,466 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; +import org.hibernate.validator.constraints.*; + +/** + * Protocol-level position summary for one address on one chain. `binanceChainId` + + * `defiProtocolId` uniquely identify a protocol on a chain. + */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class GetDeFiPositionsResponseDataAddressListInnerProtocolListInner { + public static final String SERIALIZED_NAME_BINANCE_CHAIN_ID = "binanceChainId"; + + @SerializedName(SERIALIZED_NAME_BINANCE_CHAIN_ID) + @jakarta.annotation.Nullable + private String binanceChainId; + + public static final String SERIALIZED_NAME_DEFI_PROTOCOL_ID = "defiProtocolId"; + + @SerializedName(SERIALIZED_NAME_DEFI_PROTOCOL_ID) + @jakarta.annotation.Nullable + private String defiProtocolId; + + public static final String SERIALIZED_NAME_PROTOCOL_NAME = "protocolName"; + + @SerializedName(SERIALIZED_NAME_PROTOCOL_NAME) + @jakarta.annotation.Nullable + private String protocolName; + + public static final String SERIALIZED_NAME_PROTOCOL_TOTAL_VALUE = "protocolTotalValue"; + + @SerializedName(SERIALIZED_NAME_PROTOCOL_TOTAL_VALUE) + @jakarta.annotation.Nullable + private String protocolTotalValue; + + public static final String SERIALIZED_NAME_POOL_LIST = "poolList"; + + @SerializedName(SERIALIZED_NAME_POOL_LIST) + @jakarta.annotation.Nullable + private List<@Valid GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInner> + poolList; + + public GetDeFiPositionsResponseDataAddressListInnerProtocolListInner() {} + + public GetDeFiPositionsResponseDataAddressListInnerProtocolListInner binanceChainId( + @jakarta.annotation.Nullable String binanceChainId) { + this.binanceChainId = binanceChainId; + return this; + } + + /** + * Binance chain ID (e.g. \"56\"=BSC). + * + * @return binanceChainId + */ + @jakarta.annotation.Nullable + public String getBinanceChainId() { + return binanceChainId; + } + + public void setBinanceChainId(@jakarta.annotation.Nullable String binanceChainId) { + this.binanceChainId = binanceChainId; + } + + public GetDeFiPositionsResponseDataAddressListInnerProtocolListInner defiProtocolId( + @jakarta.annotation.Nullable String defiProtocolId) { + this.defiProtocolId = defiProtocolId; + return this; + } + + /** + * Protocol identifier consistent with `POST /api/v1/defi/data/protocol/list`. Use + * this value when calling investment/list, transaction endpoints, etc. + * + * @return defiProtocolId + */ + @jakarta.annotation.Nullable + public String getDefiProtocolId() { + return defiProtocolId; + } + + public void setDefiProtocolId(@jakarta.annotation.Nullable String defiProtocolId) { + this.defiProtocolId = defiProtocolId; + } + + public GetDeFiPositionsResponseDataAddressListInnerProtocolListInner protocolName( + @jakarta.annotation.Nullable String protocolName) { + this.protocolName = protocolName; + return this; + } + + /** + * Protocol display name. + * + * @return protocolName + */ + @jakarta.annotation.Nullable + public String getProtocolName() { + return protocolName; + } + + public void setProtocolName(@jakarta.annotation.Nullable String protocolName) { + this.protocolName = protocolName; + } + + public GetDeFiPositionsResponseDataAddressListInnerProtocolListInner protocolTotalValue( + @jakarta.annotation.Nullable String protocolTotalValue) { + this.protocolTotalValue = protocolTotalValue; + return this; + } + + /** + * Total position value in this protocol (USD). + * + * @return protocolTotalValue + */ + @jakarta.annotation.Nullable + public String getProtocolTotalValue() { + return protocolTotalValue; + } + + public void setProtocolTotalValue(@jakarta.annotation.Nullable String protocolTotalValue) { + this.protocolTotalValue = protocolTotalValue; + } + + public GetDeFiPositionsResponseDataAddressListInnerProtocolListInner poolList( + @jakarta.annotation.Nullable + List< + @Valid + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInner> + poolList) { + this.poolList = poolList; + return this; + } + + public GetDeFiPositionsResponseDataAddressListInnerProtocolListInner addPoolListItem( + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInner + poolListItem) { + if (this.poolList == null) { + this.poolList = new ArrayList<>(); + } + this.poolList.add(poolListItem); + return this; + } + + /** + * Pools with positions in this protocol. + * + * @return poolList + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInner> + getPoolList() { + return poolList; + } + + public void setPoolList( + @jakarta.annotation.Nullable + List< + @Valid + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInner> + poolList) { + this.poolList = poolList; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetDeFiPositionsResponseDataAddressListInnerProtocolListInner + getDeFiPositionsResponseDataAddressListInnerProtocolListInner = + (GetDeFiPositionsResponseDataAddressListInnerProtocolListInner) o; + return Objects.equals( + this.binanceChainId, + getDeFiPositionsResponseDataAddressListInnerProtocolListInner + .binanceChainId) + && Objects.equals( + this.defiProtocolId, + getDeFiPositionsResponseDataAddressListInnerProtocolListInner + .defiProtocolId) + && Objects.equals( + this.protocolName, + getDeFiPositionsResponseDataAddressListInnerProtocolListInner.protocolName) + && Objects.equals( + this.protocolTotalValue, + getDeFiPositionsResponseDataAddressListInnerProtocolListInner + .protocolTotalValue) + && Objects.equals( + this.poolList, + getDeFiPositionsResponseDataAddressListInnerProtocolListInner.poolList); + } + + @Override + public int hashCode() { + return Objects.hash( + binanceChainId, defiProtocolId, protocolName, protocolTotalValue, poolList); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetDeFiPositionsResponseDataAddressListInnerProtocolListInner {\n"); + sb.append(" binanceChainId: ").append(toIndentedString(binanceChainId)).append("\n"); + sb.append(" defiProtocolId: ").append(toIndentedString(defiProtocolId)).append("\n"); + sb.append(" protocolName: ").append(toIndentedString(protocolName)).append("\n"); + sb.append(" protocolTotalValue: ") + .append(toIndentedString(protocolTotalValue)) + .append("\n"); + sb.append(" poolList: ").append(toIndentedString(poolList)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object binanceChainIdValue = getBinanceChainId(); + String binanceChainIdValueAsString = ""; + binanceChainIdValueAsString = binanceChainIdValue.toString(); + sb.append("binanceChainId=").append(urlEncode(binanceChainIdValueAsString)).append(""); + Object defiProtocolIdValue = getDefiProtocolId(); + String defiProtocolIdValueAsString = ""; + defiProtocolIdValueAsString = defiProtocolIdValue.toString(); + sb.append("defiProtocolId=").append(urlEncode(defiProtocolIdValueAsString)).append(""); + Object protocolNameValue = getProtocolName(); + String protocolNameValueAsString = ""; + protocolNameValueAsString = protocolNameValue.toString(); + sb.append("protocolName=").append(urlEncode(protocolNameValueAsString)).append(""); + Object protocolTotalValueValue = getProtocolTotalValue(); + String protocolTotalValueValueAsString = ""; + protocolTotalValueValueAsString = protocolTotalValueValue.toString(); + sb.append("protocolTotalValue=") + .append(urlEncode(protocolTotalValueValueAsString)) + .append(""); + Object poolListValue = getPoolList(); + String poolListValueAsString = ""; + poolListValueAsString = + (String) + ((Collection) poolListValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("poolList=").append(urlEncode(poolListValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("binanceChainId"); + openapiFields.add("defiProtocolId"); + openapiFields.add("protocolName"); + openapiFields.add("protocolTotalValue"); + openapiFields.add("poolList"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetDeFiPositionsResponseDataAddressListInnerProtocolListInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetDeFiPositionsResponseDataAddressListInnerProtocolListInner.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " GetDeFiPositionsResponseDataAddressListInnerProtocolListInner" + + " is not found in the empty JSON string", + GetDeFiPositionsResponseDataAddressListInnerProtocolListInner + .openapiRequiredFields + .toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("binanceChainId") != null && !jsonObj.get("binanceChainId").isJsonNull()) + && !jsonObj.get("binanceChainId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `binanceChainId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("binanceChainId").toString())); + } + if ((jsonObj.get("defiProtocolId") != null && !jsonObj.get("defiProtocolId").isJsonNull()) + && !jsonObj.get("defiProtocolId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `defiProtocolId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("defiProtocolId").toString())); + } + if ((jsonObj.get("protocolName") != null && !jsonObj.get("protocolName").isJsonNull()) + && !jsonObj.get("protocolName").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `protocolName` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("protocolName").toString())); + } + if ((jsonObj.get("protocolTotalValue") != null + && !jsonObj.get("protocolTotalValue").isJsonNull()) + && !jsonObj.get("protocolTotalValue").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `protocolTotalValue` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("protocolTotalValue").toString())); + } + if (jsonObj.get("poolList") != null && !jsonObj.get("poolList").isJsonNull()) { + JsonArray jsonArraypoolList = jsonObj.getAsJsonArray("poolList"); + if (jsonArraypoolList != null) { + // ensure the json data is an array + if (!jsonObj.get("poolList").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `poolList` to be an array in the JSON" + + " string but got `%s`", + jsonObj.get("poolList").toString())); + } + + // validate the optional field `poolList` (array) + for (int i = 0; i < jsonArraypoolList.size(); i++) { + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInner + .validateJsonElement(jsonArraypoolList.get(i)); + } + ; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetDeFiPositionsResponseDataAddressListInnerProtocolListInner.class + .isAssignableFrom(type.getRawType())) { + return null; // this class only serializes + // 'GetDeFiPositionsResponseDataAddressListInnerProtocolListInner' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter + thisAdapter = + gson.getDelegateAdapter( + this, + TypeToken.get( + GetDeFiPositionsResponseDataAddressListInnerProtocolListInner + .class)); + + return (TypeAdapter) + new TypeAdapter< + GetDeFiPositionsResponseDataAddressListInnerProtocolListInner>() { + @Override + public void write( + JsonWriter out, + GetDeFiPositionsResponseDataAddressListInnerProtocolListInner value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetDeFiPositionsResponseDataAddressListInnerProtocolListInner read( + JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetDeFiPositionsResponseDataAddressListInnerProtocolListInner given an + * JSON string + * + * @param jsonString JSON string + * @return An instance of GetDeFiPositionsResponseDataAddressListInnerProtocolListInner + * @throws IOException if the JSON string is invalid with respect to + * GetDeFiPositionsResponseDataAddressListInnerProtocolListInner + */ + public static GetDeFiPositionsResponseDataAddressListInnerProtocolListInner fromJson( + String jsonString) throws IOException { + return JSON.getGson() + .fromJson( + jsonString, + GetDeFiPositionsResponseDataAddressListInnerProtocolListInner.class); + } + + /** + * Convert an instance of GetDeFiPositionsResponseDataAddressListInnerProtocolListInner to an + * JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInner.java new file mode 100644 index 0000000..a026bc2 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInner.java @@ -0,0 +1,508 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** A pool containing position collections. */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInner { + public static final String SERIALIZED_NAME_BN_POOL_ID = "bnPoolId"; + + @SerializedName(SERIALIZED_NAME_BN_POOL_ID) + @jakarta.annotation.Nullable + private String bnPoolId; + + public static final String SERIALIZED_NAME_POOL_CA = "poolCa"; + + @SerializedName(SERIALIZED_NAME_POOL_CA) + @jakarta.annotation.Nullable + private String poolCa; + + public static final String SERIALIZED_NAME_POOL_TYPE = "poolType"; + + @SerializedName(SERIALIZED_NAME_POOL_TYPE) + @jakarta.annotation.Nullable + private String poolType; + + public static final String SERIALIZED_NAME_POSITION_COLLECTION_LIST = "positionCollectionList"; + + @SerializedName(SERIALIZED_NAME_POSITION_COLLECTION_LIST) + @jakarta.annotation.Nullable + private List< + @Valid + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInner> + positionCollectionList; + + public static final String SERIALIZED_NAME_POOL_DETAIL = "poolDetail"; + + @SerializedName(SERIALIZED_NAME_POOL_DETAIL) + @jakarta.annotation.Nullable + private GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPoolDetail + poolDetail; + + public GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInner() {} + + public GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInner bnPoolId( + @jakarta.annotation.Nullable String bnPoolId) { + this.bnPoolId = bnPoolId; + return this; + } + + /** + * Pool identifier (`0x` + 64-char hex). + * + * @return bnPoolId + */ + @jakarta.annotation.Nullable + public String getBnPoolId() { + return bnPoolId; + } + + public void setBnPoolId(@jakarta.annotation.Nullable String bnPoolId) { + this.bnPoolId = bnPoolId; + } + + public GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInner poolCa( + @jakarta.annotation.Nullable String poolCa) { + this.poolCa = poolCa; + return this; + } + + /** + * Pool contract address. + * + * @return poolCa + */ + @jakarta.annotation.Nullable + public String getPoolCa() { + return poolCa; + } + + public void setPoolCa(@jakarta.annotation.Nullable String poolCa) { + this.poolCa = poolCa; + } + + public GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInner poolType( + @jakarta.annotation.Nullable String poolType) { + this.poolType = poolType; + return this; + } + + /** + * Pool type. Complete value set: `Lending` (supply/borrow market), `Staked` + * (native staking), `Yield` (yield vault / receipt token), `Deposit` (fixed + * deposit), `Rewards` (reward claims, e.g. PancakeSwap Infinity), `Liquidity + * Pool` (AMM / concentrated liquidity), `Farming` (MasterChef farming), + * `Locked` (locked staking with unlock time), `Vesting` (vesting schedule). + * Treat unknown values as generic display. + * + * @return poolType + */ + @jakarta.annotation.Nullable + public String getPoolType() { + return poolType; + } + + public void setPoolType(@jakarta.annotation.Nullable String poolType) { + this.poolType = poolType; + } + + public GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInner + positionCollectionList( + @jakarta.annotation.Nullable + List< + @Valid + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInner> + positionCollectionList) { + this.positionCollectionList = positionCollectionList; + return this; + } + + public GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInner + addPositionCollectionListItem( + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInner + positionCollectionListItem) { + if (this.positionCollectionList == null) { + this.positionCollectionList = new ArrayList<>(); + } + this.positionCollectionList.add(positionCollectionListItem); + return this; + } + + /** + * Get positionCollectionList + * + * @return positionCollectionList + */ + @jakarta.annotation.Nullable + @Valid + public List< + @Valid + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInner> + getPositionCollectionList() { + return positionCollectionList; + } + + public void setPositionCollectionList( + @jakarta.annotation.Nullable + List< + @Valid + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInner> + positionCollectionList) { + this.positionCollectionList = positionCollectionList; + } + + public GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInner poolDetail( + @jakarta.annotation.Nullable + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPoolDetail + poolDetail) { + this.poolDetail = poolDetail; + return this; + } + + /** + * Get poolDetail + * + * @return poolDetail + */ + @jakarta.annotation.Nullable + @Valid + public GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPoolDetail + getPoolDetail() { + return poolDetail; + } + + public void setPoolDetail( + @jakarta.annotation.Nullable + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPoolDetail + poolDetail) { + this.poolDetail = poolDetail; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInner + getDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInner = + (GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInner) + o; + return Objects.equals( + this.bnPoolId, + getDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInner + .bnPoolId) + && Objects.equals( + this.poolCa, + getDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInner + .poolCa) + && Objects.equals( + this.poolType, + getDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInner + .poolType) + && Objects.equals( + this.positionCollectionList, + getDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInner + .positionCollectionList) + && Objects.equals( + this.poolDetail, + getDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInner + .poolDetail); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(bnPoolId, poolCa, poolType, positionCollectionList, poolDetail); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append( + "class GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInner" + + " {\n"); + sb.append(" bnPoolId: ").append(toIndentedString(bnPoolId)).append("\n"); + sb.append(" poolCa: ").append(toIndentedString(poolCa)).append("\n"); + sb.append(" poolType: ").append(toIndentedString(poolType)).append("\n"); + sb.append(" positionCollectionList: ") + .append(toIndentedString(positionCollectionList)) + .append("\n"); + sb.append(" poolDetail: ").append(toIndentedString(poolDetail)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object bnPoolIdValue = getBnPoolId(); + String bnPoolIdValueAsString = ""; + bnPoolIdValueAsString = bnPoolIdValue.toString(); + sb.append("bnPoolId=").append(urlEncode(bnPoolIdValueAsString)).append(""); + Object poolCaValue = getPoolCa(); + String poolCaValueAsString = ""; + poolCaValueAsString = poolCaValue.toString(); + sb.append("poolCa=").append(urlEncode(poolCaValueAsString)).append(""); + Object poolTypeValue = getPoolType(); + String poolTypeValueAsString = ""; + poolTypeValueAsString = poolTypeValue.toString(); + sb.append("poolType=").append(urlEncode(poolTypeValueAsString)).append(""); + Object positionCollectionListValue = getPositionCollectionList(); + String positionCollectionListValueAsString = ""; + positionCollectionListValueAsString = + (String) + ((Collection) positionCollectionListValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("positionCollectionList=") + .append(urlEncode(positionCollectionListValueAsString)) + .append(""); + Object poolDetailValue = getPoolDetail(); + String poolDetailValueAsString = ""; + poolDetailValueAsString = poolDetailValue.toString(); + sb.append("poolDetail=").append(urlEncode(poolDetailValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("bnPoolId"); + openapiFields.add("poolCa"); + openapiFields.add("poolType"); + openapiFields.add("positionCollectionList"); + openapiFields.add("poolDetail"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInner + .openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInner" + + " is not found in the empty JSON string", + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInner + .openapiRequiredFields + .toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("bnPoolId") != null && !jsonObj.get("bnPoolId").isJsonNull()) + && !jsonObj.get("bnPoolId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `bnPoolId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("bnPoolId").toString())); + } + if ((jsonObj.get("poolCa") != null && !jsonObj.get("poolCa").isJsonNull()) + && !jsonObj.get("poolCa").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `poolCa` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("poolCa").toString())); + } + if ((jsonObj.get("poolType") != null && !jsonObj.get("poolType").isJsonNull()) + && !jsonObj.get("poolType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `poolType` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("poolType").toString())); + } + if (jsonObj.get("positionCollectionList") != null + && !jsonObj.get("positionCollectionList").isJsonNull()) { + JsonArray jsonArraypositionCollectionList = + jsonObj.getAsJsonArray("positionCollectionList"); + if (jsonArraypositionCollectionList != null) { + // ensure the json data is an array + if (!jsonObj.get("positionCollectionList").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `positionCollectionList` to be an array in" + + " the JSON string but got `%s`", + jsonObj.get("positionCollectionList").toString())); + } + + // validate the optional field `positionCollectionList` (array) + for (int i = 0; i < jsonArraypositionCollectionList.size(); i++) { + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInner + .validateJsonElement(jsonArraypositionCollectionList.get(i)); + } + ; + } + } + // validate the optional field `poolDetail` + if (jsonObj.get("poolDetail") != null && !jsonObj.get("poolDetail").isJsonNull()) { + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPoolDetail + .validateJsonElement(jsonObj.get("poolDetail")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInner.class + .isAssignableFrom(type.getRawType())) { + return null; // this class only serializes + // 'GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInner' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter< + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInner> + thisAdapter = + gson.getDelegateAdapter( + this, + TypeToken.get( + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInner + .class)); + + return (TypeAdapter) + new TypeAdapter< + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInner>() { + @Override + public void write( + JsonWriter out, + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInner + value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInner + read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of + * GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInner given an JSON + * string + * + * @param jsonString JSON string + * @return An instance of + * GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInner + * @throws IOException if the JSON string is invalid with respect to + * GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInner + */ + public static GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInner + fromJson(String jsonString) throws IOException { + return JSON.getGson() + .fromJson( + jsonString, + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInner + .class); + } + + /** + * Convert an instance of + * GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPoolDetail.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPoolDetail.java new file mode 100644 index 0000000..663403e --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPoolDetail.java @@ -0,0 +1,844 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** + * Pool-level metadata. Fields are null when not applicable to the pool type (e.g. + * `tickSpacing`/`hooks` only for concentrated-liquidity pools). + */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPoolDetail { + public static final String SERIALIZED_NAME_EXPIRY = "expiry"; + + @SerializedName(SERIALIZED_NAME_EXPIRY) + @jakarta.annotation.Nullable + private Long expiry; + + public static final String SERIALIZED_NAME_FEE_TIER = "feeTier"; + + @SerializedName(SERIALIZED_NAME_FEE_TIER) + @jakarta.annotation.Nullable + private String feeTier; + + public static final String SERIALIZED_NAME_LP_FEE = "lpFee"; + + @SerializedName(SERIALIZED_NAME_LP_FEE) + @jakarta.annotation.Nullable + private String lpFee; + + public static final String SERIALIZED_NAME_TICK_SPACING = "tickSpacing"; + + @SerializedName(SERIALIZED_NAME_TICK_SPACING) + @jakarta.annotation.Nullable + private String tickSpacing; + + public static final String SERIALIZED_NAME_IS_DYNAMIC_FEE = "isDynamicFee"; + + @SerializedName(SERIALIZED_NAME_IS_DYNAMIC_FEE) + @jakarta.annotation.Nullable + private Boolean isDynamicFee; + + public static final String SERIALIZED_NAME_HOOK_FEE = "hookFee"; + + @SerializedName(SERIALIZED_NAME_HOOK_FEE) + @jakarta.annotation.Nullable + private String hookFee; + + public static final String SERIALIZED_NAME_TICK = "tick"; + + @SerializedName(SERIALIZED_NAME_TICK) + @jakarta.annotation.Nullable + private String tick; + + public static final String SERIALIZED_NAME_HOOKS = "hooks"; + + @SerializedName(SERIALIZED_NAME_HOOKS) + @jakarta.annotation.Nullable + private String hooks; + + public static final String SERIALIZED_NAME_SWAP_PROTOCOL_FEE = "swapProtocolFee"; + + @SerializedName(SERIALIZED_NAME_SWAP_PROTOCOL_FEE) + @jakarta.annotation.Nullable + private String swapProtocolFee; + + public static final String SERIALIZED_NAME_PARAMETERS = "parameters"; + + @SerializedName(SERIALIZED_NAME_PARAMETERS) + @jakarta.annotation.Nullable + private String parameters; + + public static final String SERIALIZED_NAME_FEE = "fee"; + + @SerializedName(SERIALIZED_NAME_FEE) + @jakarta.annotation.Nullable + private String fee; + + public static final String SERIALIZED_NAME_SPOKE_NAME = "spokeName"; + + @SerializedName(SERIALIZED_NAME_SPOKE_NAME) + @jakarta.annotation.Nullable + private String spokeName; + + public static final String SERIALIZED_NAME_RESERVE_COUNT = "reserveCount"; + + @SerializedName(SERIALIZED_NAME_RESERVE_COUNT) + @jakarta.annotation.Nullable + private String reserveCount; + + public static final String SERIALIZED_NAME_VAULT_NAME = "vaultName"; + + @SerializedName(SERIALIZED_NAME_VAULT_NAME) + @jakarta.annotation.Nullable + private String vaultName; + + public GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPoolDetail() {} + + public GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPoolDetail + expiry(@jakarta.annotation.Nullable Long expiry) { + this.expiry = expiry; + return this; + } + + /** + * Pool expiry timestamp (Unix seconds). Null if no expiry. + * + * @return expiry + */ + @jakarta.annotation.Nullable + public Long getExpiry() { + return expiry; + } + + public void setExpiry(@jakarta.annotation.Nullable Long expiry) { + this.expiry = expiry; + } + + public GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPoolDetail + feeTier(@jakarta.annotation.Nullable String feeTier) { + this.feeTier = feeTier; + return this; + } + + /** + * Fee tier. For PancakeSwap V3-style pools this is the encoded fee (e.g. \"500\" + * = 0.05%); for V4-style pools a flag-encoded value. + * + * @return feeTier + */ + @jakarta.annotation.Nullable + public String getFeeTier() { + return feeTier; + } + + public void setFeeTier(@jakarta.annotation.Nullable String feeTier) { + this.feeTier = feeTier; + } + + public GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPoolDetail + lpFee(@jakarta.annotation.Nullable String lpFee) { + this.lpFee = lpFee; + return this; + } + + /** + * LP fee portion in basis points (V4-style pools). + * + * @return lpFee + */ + @jakarta.annotation.Nullable + public String getLpFee() { + return lpFee; + } + + public void setLpFee(@jakarta.annotation.Nullable String lpFee) { + this.lpFee = lpFee; + } + + public GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPoolDetail + tickSpacing(@jakarta.annotation.Nullable String tickSpacing) { + this.tickSpacing = tickSpacing; + return this; + } + + /** + * Tick spacing for concentrated-liquidity pools. + * + * @return tickSpacing + */ + @jakarta.annotation.Nullable + public String getTickSpacing() { + return tickSpacing; + } + + public void setTickSpacing(@jakarta.annotation.Nullable String tickSpacing) { + this.tickSpacing = tickSpacing; + } + + public GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPoolDetail + isDynamicFee(@jakarta.annotation.Nullable Boolean isDynamicFee) { + this.isDynamicFee = isDynamicFee; + return this; + } + + /** + * Whether the pool uses a dynamic (hook-managed) fee (V4-style pools). + * + * @return isDynamicFee + */ + @jakarta.annotation.Nullable + public Boolean getIsDynamicFee() { + return isDynamicFee; + } + + public void setIsDynamicFee(@jakarta.annotation.Nullable Boolean isDynamicFee) { + this.isDynamicFee = isDynamicFee; + } + + public GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPoolDetail + hookFee(@jakarta.annotation.Nullable String hookFee) { + this.hookFee = hookFee; + return this; + } + + /** + * Hook fee portion in basis points (V4-style pools). + * + * @return hookFee + */ + @jakarta.annotation.Nullable + public String getHookFee() { + return hookFee; + } + + public void setHookFee(@jakarta.annotation.Nullable String hookFee) { + this.hookFee = hookFee; + } + + public GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPoolDetail + tick(@jakarta.annotation.Nullable String tick) { + this.tick = tick; + return this; + } + + /** + * Current pool tick (V4-style pools). + * + * @return tick + */ + @jakarta.annotation.Nullable + public String getTick() { + return tick; + } + + public void setTick(@jakarta.annotation.Nullable String tick) { + this.tick = tick; + } + + public GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPoolDetail + hooks(@jakarta.annotation.Nullable String hooks) { + this.hooks = hooks; + return this; + } + + /** + * Hook contract address (V4-style pools). Zero address when no hook. + * + * @return hooks + */ + @jakarta.annotation.Nullable + public String getHooks() { + return hooks; + } + + public void setHooks(@jakarta.annotation.Nullable String hooks) { + this.hooks = hooks; + } + + public GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPoolDetail + swapProtocolFee(@jakarta.annotation.Nullable String swapProtocolFee) { + this.swapProtocolFee = swapProtocolFee; + return this; + } + + /** + * Protocol fee on swaps in basis points (V4-style pools). + * + * @return swapProtocolFee + */ + @jakarta.annotation.Nullable + public String getSwapProtocolFee() { + return swapProtocolFee; + } + + public void setSwapProtocolFee(@jakarta.annotation.Nullable String swapProtocolFee) { + this.swapProtocolFee = swapProtocolFee; + } + + public GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPoolDetail + parameters(@jakarta.annotation.Nullable String parameters) { + this.parameters = parameters; + return this; + } + + /** + * Encoded pool parameters, e.g. `0x` + 64-char hex (V4-style pools). + * + * @return parameters + */ + @jakarta.annotation.Nullable + public String getParameters() { + return parameters; + } + + public void setParameters(@jakarta.annotation.Nullable String parameters) { + this.parameters = parameters; + } + + public GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPoolDetail fee( + @jakarta.annotation.Nullable String fee) { + this.fee = fee; + return this; + } + + /** + * Total pool fee in basis points (V4-style pools). + * + * @return fee + */ + @jakarta.annotation.Nullable + public String getFee() { + return fee; + } + + public void setFee(@jakarta.annotation.Nullable String fee) { + this.fee = fee; + } + + public GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPoolDetail + spokeName(@jakarta.annotation.Nullable String spokeName) { + this.spokeName = spokeName; + return this; + } + + /** + * Spoke pool name (e.g. across-protocol bridges). + * + * @return spokeName + */ + @jakarta.annotation.Nullable + public String getSpokeName() { + return spokeName; + } + + public void setSpokeName(@jakarta.annotation.Nullable String spokeName) { + this.spokeName = spokeName; + } + + public GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPoolDetail + reserveCount(@jakarta.annotation.Nullable String reserveCount) { + this.reserveCount = reserveCount; + return this; + } + + /** + * Number of reserves in multi-asset pools. + * + * @return reserveCount + */ + @jakarta.annotation.Nullable + public String getReserveCount() { + return reserveCount; + } + + public void setReserveCount(@jakarta.annotation.Nullable String reserveCount) { + this.reserveCount = reserveCount; + } + + public GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPoolDetail + vaultName(@jakarta.annotation.Nullable String vaultName) { + this.vaultName = vaultName; + return this; + } + + /** + * Vault name for vault-style protocols. + * + * @return vaultName + */ + @jakarta.annotation.Nullable + public String getVaultName() { + return vaultName; + } + + public void setVaultName(@jakarta.annotation.Nullable String vaultName) { + this.vaultName = vaultName; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPoolDetail + getDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPoolDetail = + (GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPoolDetail) + o; + return Objects.equals( + this.expiry, + getDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPoolDetail + .expiry) + && Objects.equals( + this.feeTier, + getDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPoolDetail + .feeTier) + && Objects.equals( + this.lpFee, + getDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPoolDetail + .lpFee) + && Objects.equals( + this.tickSpacing, + getDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPoolDetail + .tickSpacing) + && Objects.equals( + this.isDynamicFee, + getDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPoolDetail + .isDynamicFee) + && Objects.equals( + this.hookFee, + getDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPoolDetail + .hookFee) + && Objects.equals( + this.tick, + getDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPoolDetail + .tick) + && Objects.equals( + this.hooks, + getDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPoolDetail + .hooks) + && Objects.equals( + this.swapProtocolFee, + getDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPoolDetail + .swapProtocolFee) + && Objects.equals( + this.parameters, + getDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPoolDetail + .parameters) + && Objects.equals( + this.fee, + getDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPoolDetail + .fee) + && Objects.equals( + this.spokeName, + getDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPoolDetail + .spokeName) + && Objects.equals( + this.reserveCount, + getDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPoolDetail + .reserveCount) + && Objects.equals( + this.vaultName, + getDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPoolDetail + .vaultName); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash( + expiry, + feeTier, + lpFee, + tickSpacing, + isDynamicFee, + hookFee, + tick, + hooks, + swapProtocolFee, + parameters, + fee, + spokeName, + reserveCount, + vaultName); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append( + "class" + + " GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPoolDetail" + + " {\n"); + sb.append(" expiry: ").append(toIndentedString(expiry)).append("\n"); + sb.append(" feeTier: ").append(toIndentedString(feeTier)).append("\n"); + sb.append(" lpFee: ").append(toIndentedString(lpFee)).append("\n"); + sb.append(" tickSpacing: ").append(toIndentedString(tickSpacing)).append("\n"); + sb.append(" isDynamicFee: ").append(toIndentedString(isDynamicFee)).append("\n"); + sb.append(" hookFee: ").append(toIndentedString(hookFee)).append("\n"); + sb.append(" tick: ").append(toIndentedString(tick)).append("\n"); + sb.append(" hooks: ").append(toIndentedString(hooks)).append("\n"); + sb.append(" swapProtocolFee: ").append(toIndentedString(swapProtocolFee)).append("\n"); + sb.append(" parameters: ").append(toIndentedString(parameters)).append("\n"); + sb.append(" fee: ").append(toIndentedString(fee)).append("\n"); + sb.append(" spokeName: ").append(toIndentedString(spokeName)).append("\n"); + sb.append(" reserveCount: ").append(toIndentedString(reserveCount)).append("\n"); + sb.append(" vaultName: ").append(toIndentedString(vaultName)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object expiryValue = getExpiry(); + String expiryValueAsString = ""; + expiryValueAsString = expiryValue.toString(); + sb.append("expiry=").append(urlEncode(expiryValueAsString)).append(""); + Object feeTierValue = getFeeTier(); + String feeTierValueAsString = ""; + feeTierValueAsString = feeTierValue.toString(); + sb.append("feeTier=").append(urlEncode(feeTierValueAsString)).append(""); + Object lpFeeValue = getLpFee(); + String lpFeeValueAsString = ""; + lpFeeValueAsString = lpFeeValue.toString(); + sb.append("lpFee=").append(urlEncode(lpFeeValueAsString)).append(""); + Object tickSpacingValue = getTickSpacing(); + String tickSpacingValueAsString = ""; + tickSpacingValueAsString = tickSpacingValue.toString(); + sb.append("tickSpacing=").append(urlEncode(tickSpacingValueAsString)).append(""); + Object isDynamicFeeValue = getIsDynamicFee(); + String isDynamicFeeValueAsString = ""; + isDynamicFeeValueAsString = isDynamicFeeValue.toString(); + sb.append("isDynamicFee=").append(urlEncode(isDynamicFeeValueAsString)).append(""); + Object hookFeeValue = getHookFee(); + String hookFeeValueAsString = ""; + hookFeeValueAsString = hookFeeValue.toString(); + sb.append("hookFee=").append(urlEncode(hookFeeValueAsString)).append(""); + Object tickValue = getTick(); + String tickValueAsString = ""; + tickValueAsString = tickValue.toString(); + sb.append("tick=").append(urlEncode(tickValueAsString)).append(""); + Object hooksValue = getHooks(); + String hooksValueAsString = ""; + hooksValueAsString = hooksValue.toString(); + sb.append("hooks=").append(urlEncode(hooksValueAsString)).append(""); + Object swapProtocolFeeValue = getSwapProtocolFee(); + String swapProtocolFeeValueAsString = ""; + swapProtocolFeeValueAsString = swapProtocolFeeValue.toString(); + sb.append("swapProtocolFee=").append(urlEncode(swapProtocolFeeValueAsString)).append(""); + Object parametersValue = getParameters(); + String parametersValueAsString = ""; + parametersValueAsString = parametersValue.toString(); + sb.append("parameters=").append(urlEncode(parametersValueAsString)).append(""); + Object feeValue = getFee(); + String feeValueAsString = ""; + feeValueAsString = feeValue.toString(); + sb.append("fee=").append(urlEncode(feeValueAsString)).append(""); + Object spokeNameValue = getSpokeName(); + String spokeNameValueAsString = ""; + spokeNameValueAsString = spokeNameValue.toString(); + sb.append("spokeName=").append(urlEncode(spokeNameValueAsString)).append(""); + Object reserveCountValue = getReserveCount(); + String reserveCountValueAsString = ""; + reserveCountValueAsString = reserveCountValue.toString(); + sb.append("reserveCount=").append(urlEncode(reserveCountValueAsString)).append(""); + Object vaultNameValue = getVaultName(); + String vaultNameValueAsString = ""; + vaultNameValueAsString = vaultNameValue.toString(); + sb.append("vaultName=").append(urlEncode(vaultNameValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("expiry"); + openapiFields.add("feeTier"); + openapiFields.add("lpFee"); + openapiFields.add("tickSpacing"); + openapiFields.add("isDynamicFee"); + openapiFields.add("hookFee"); + openapiFields.add("tick"); + openapiFields.add("hooks"); + openapiFields.add("swapProtocolFee"); + openapiFields.add("parameters"); + openapiFields.add("fee"); + openapiFields.add("spokeName"); + openapiFields.add("reserveCount"); + openapiFields.add("vaultName"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPoolDetail + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPoolDetail + .openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPoolDetail" + + " is not found in the empty JSON string", + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPoolDetail + .openapiRequiredFields + .toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("feeTier") != null && !jsonObj.get("feeTier").isJsonNull()) + && !jsonObj.get("feeTier").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `feeTier` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("feeTier").toString())); + } + if ((jsonObj.get("lpFee") != null && !jsonObj.get("lpFee").isJsonNull()) + && !jsonObj.get("lpFee").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `lpFee` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("lpFee").toString())); + } + if ((jsonObj.get("tickSpacing") != null && !jsonObj.get("tickSpacing").isJsonNull()) + && !jsonObj.get("tickSpacing").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `tickSpacing` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("tickSpacing").toString())); + } + if ((jsonObj.get("hookFee") != null && !jsonObj.get("hookFee").isJsonNull()) + && !jsonObj.get("hookFee").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `hookFee` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("hookFee").toString())); + } + if ((jsonObj.get("tick") != null && !jsonObj.get("tick").isJsonNull()) + && !jsonObj.get("tick").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `tick` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("tick").toString())); + } + if ((jsonObj.get("hooks") != null && !jsonObj.get("hooks").isJsonNull()) + && !jsonObj.get("hooks").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `hooks` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("hooks").toString())); + } + if ((jsonObj.get("swapProtocolFee") != null && !jsonObj.get("swapProtocolFee").isJsonNull()) + && !jsonObj.get("swapProtocolFee").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `swapProtocolFee` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("swapProtocolFee").toString())); + } + if ((jsonObj.get("parameters") != null && !jsonObj.get("parameters").isJsonNull()) + && !jsonObj.get("parameters").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `parameters` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("parameters").toString())); + } + if ((jsonObj.get("fee") != null && !jsonObj.get("fee").isJsonNull()) + && !jsonObj.get("fee").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `fee` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("fee").toString())); + } + if ((jsonObj.get("spokeName") != null && !jsonObj.get("spokeName").isJsonNull()) + && !jsonObj.get("spokeName").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `spokeName` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("spokeName").toString())); + } + if ((jsonObj.get("reserveCount") != null && !jsonObj.get("reserveCount").isJsonNull()) + && !jsonObj.get("reserveCount").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `reserveCount` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("reserveCount").toString())); + } + if ((jsonObj.get("vaultName") != null && !jsonObj.get("vaultName").isJsonNull()) + && !jsonObj.get("vaultName").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `vaultName` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("vaultName").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPoolDetail + .class + .isAssignableFrom(type.getRawType())) { + return null; // this class only serializes + // 'GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPoolDetail' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter< + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPoolDetail> + thisAdapter = + gson.getDelegateAdapter( + this, + TypeToken.get( + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPoolDetail + .class)); + + return (TypeAdapter) + new TypeAdapter< + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPoolDetail>() { + @Override + public void write( + JsonWriter out, + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPoolDetail + value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPoolDetail + read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of + * GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPoolDetail given an + * JSON string + * + * @param jsonString JSON string + * @return An instance of + * GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPoolDetail + * @throws IOException if the JSON string is invalid with respect to + * GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPoolDetail + */ + public static + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPoolDetail fromJson( + String jsonString) throws IOException { + return JSON.getGson() + .fromJson( + jsonString, + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPoolDetail + .class); + } + + /** + * Convert an instance of + * GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPoolDetail to an + * JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInner.java new file mode 100644 index 0000000..2b8e989 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInner.java @@ -0,0 +1,489 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** A collection of positions grouped under the same underlying asset. */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public +class GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInner { + public static final String SERIALIZED_NAME_POSITION_COLLECTION_ID = "positionCollectionId"; + + @SerializedName(SERIALIZED_NAME_POSITION_COLLECTION_ID) + @jakarta.annotation.Nullable + private String positionCollectionId; + + public static final String SERIALIZED_NAME_POSITION_COLLECTION_DETAIL = + "positionCollectionDetail"; + + @SerializedName(SERIALIZED_NAME_POSITION_COLLECTION_DETAIL) + @jakarta.annotation.Nullable + private + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionCollectionDetail + positionCollectionDetail; + + public static final String SERIALIZED_NAME_POSITION_COLLECTION_TOTAL_VALUE = + "positionCollectionTotalValue"; + + @SerializedName(SERIALIZED_NAME_POSITION_COLLECTION_TOTAL_VALUE) + @jakarta.annotation.Nullable + private String positionCollectionTotalValue; + + public static final String SERIALIZED_NAME_POSITION_LIST = "positionList"; + + @SerializedName(SERIALIZED_NAME_POSITION_LIST) + @jakarta.annotation.Nullable + private List< + @Valid + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInner> + positionList; + + public + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInner() {} + + public + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInner + positionCollectionId(@jakarta.annotation.Nullable String positionCollectionId) { + this.positionCollectionId = positionCollectionId; + return this; + } + + /** + * Collection unique identifier (64-char hex, no `0x` prefix). + * + * @return positionCollectionId + */ + @jakarta.annotation.Nullable + public String getPositionCollectionId() { + return positionCollectionId; + } + + public void setPositionCollectionId(@jakarta.annotation.Nullable String positionCollectionId) { + this.positionCollectionId = positionCollectionId; + } + + public + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInner + positionCollectionDetail( + @jakarta.annotation.Nullable + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionCollectionDetail + positionCollectionDetail) { + this.positionCollectionDetail = positionCollectionDetail; + return this; + } + + /** + * Get positionCollectionDetail + * + * @return positionCollectionDetail + */ + @jakarta.annotation.Nullable + @Valid + public + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionCollectionDetail + getPositionCollectionDetail() { + return positionCollectionDetail; + } + + public void setPositionCollectionDetail( + @jakarta.annotation.Nullable + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionCollectionDetail + positionCollectionDetail) { + this.positionCollectionDetail = positionCollectionDetail; + } + + public + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInner + positionCollectionTotalValue( + @jakarta.annotation.Nullable String positionCollectionTotalValue) { + this.positionCollectionTotalValue = positionCollectionTotalValue; + return this; + } + + /** + * Total value of all positions in this collection (USD). + * + * @return positionCollectionTotalValue + */ + @jakarta.annotation.Nullable + public String getPositionCollectionTotalValue() { + return positionCollectionTotalValue; + } + + public void setPositionCollectionTotalValue( + @jakarta.annotation.Nullable String positionCollectionTotalValue) { + this.positionCollectionTotalValue = positionCollectionTotalValue; + } + + public + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInner + positionList( + @jakarta.annotation.Nullable + List< + @Valid + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInner> + positionList) { + this.positionList = positionList; + return this; + } + + public + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInner + addPositionListItem( + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInner + positionListItem) { + if (this.positionList == null) { + this.positionList = new ArrayList<>(); + } + this.positionList.add(positionListItem); + return this; + } + + /** + * List of positions in this collection. + * + * @return positionList + */ + @jakarta.annotation.Nullable + @Valid + public List< + @Valid + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInner> + getPositionList() { + return positionList; + } + + public void setPositionList( + @jakarta.annotation.Nullable + List< + @Valid + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInner> + positionList) { + this.positionList = positionList; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInner + getDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInner = + (GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInner) + o; + return Objects.equals( + this.positionCollectionId, + getDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInner + .positionCollectionId) + && Objects.equals( + this.positionCollectionDetail, + getDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInner + .positionCollectionDetail) + && Objects.equals( + this.positionCollectionTotalValue, + getDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInner + .positionCollectionTotalValue) + && Objects.equals( + this.positionList, + getDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInner + .positionList); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash( + positionCollectionId, + positionCollectionDetail, + positionCollectionTotalValue, + positionList); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append( + "class" + + " GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInner" + + " {\n"); + sb.append(" positionCollectionId: ") + .append(toIndentedString(positionCollectionId)) + .append("\n"); + sb.append(" positionCollectionDetail: ") + .append(toIndentedString(positionCollectionDetail)) + .append("\n"); + sb.append(" positionCollectionTotalValue: ") + .append(toIndentedString(positionCollectionTotalValue)) + .append("\n"); + sb.append(" positionList: ").append(toIndentedString(positionList)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object positionCollectionIdValue = getPositionCollectionId(); + String positionCollectionIdValueAsString = ""; + positionCollectionIdValueAsString = positionCollectionIdValue.toString(); + sb.append("positionCollectionId=") + .append(urlEncode(positionCollectionIdValueAsString)) + .append(""); + Object positionCollectionDetailValue = getPositionCollectionDetail(); + String positionCollectionDetailValueAsString = ""; + positionCollectionDetailValueAsString = positionCollectionDetailValue.toString(); + sb.append("positionCollectionDetail=") + .append(urlEncode(positionCollectionDetailValueAsString)) + .append(""); + Object positionCollectionTotalValueValue = getPositionCollectionTotalValue(); + String positionCollectionTotalValueValueAsString = ""; + positionCollectionTotalValueValueAsString = positionCollectionTotalValueValue.toString(); + sb.append("positionCollectionTotalValue=") + .append(urlEncode(positionCollectionTotalValueValueAsString)) + .append(""); + Object positionListValue = getPositionList(); + String positionListValueAsString = ""; + positionListValueAsString = + (String) + ((Collection) positionListValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("positionList=").append(urlEncode(positionListValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("positionCollectionId"); + openapiFields.add("positionCollectionDetail"); + openapiFields.add("positionCollectionTotalValue"); + openapiFields.add("positionList"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInner + .openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInner" + + " is not found in the empty JSON string", + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInner + .openapiRequiredFields + .toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("positionCollectionId") != null + && !jsonObj.get("positionCollectionId").isJsonNull()) + && !jsonObj.get("positionCollectionId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `positionCollectionId` to be a primitive type in" + + " the JSON string but got `%s`", + jsonObj.get("positionCollectionId").toString())); + } + // validate the optional field `positionCollectionDetail` + if (jsonObj.get("positionCollectionDetail") != null + && !jsonObj.get("positionCollectionDetail").isJsonNull()) { + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionCollectionDetail + .validateJsonElement(jsonObj.get("positionCollectionDetail")); + } + if ((jsonObj.get("positionCollectionTotalValue") != null + && !jsonObj.get("positionCollectionTotalValue").isJsonNull()) + && !jsonObj.get("positionCollectionTotalValue").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `positionCollectionTotalValue` to be a primitive" + + " type in the JSON string but got `%s`", + jsonObj.get("positionCollectionTotalValue").toString())); + } + if (jsonObj.get("positionList") != null && !jsonObj.get("positionList").isJsonNull()) { + JsonArray jsonArraypositionList = jsonObj.getAsJsonArray("positionList"); + if (jsonArraypositionList != null) { + // ensure the json data is an array + if (!jsonObj.get("positionList").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `positionList` to be an array in the JSON" + + " string but got `%s`", + jsonObj.get("positionList").toString())); + } + + // validate the optional field `positionList` (array) + for (int i = 0; i < jsonArraypositionList.size(); i++) { + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInner + .validateJsonElement(jsonArraypositionList.get(i)); + } + ; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInner + .class + .isAssignableFrom(type.getRawType())) { + return null; // this class only serializes + // 'GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter< + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInner> + thisAdapter = + gson.getDelegateAdapter( + this, + TypeToken.get( + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInner + .class)); + + return (TypeAdapter) + new TypeAdapter< + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInner>() { + @Override + public void write( + JsonWriter out, + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInner + value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInner + read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of + * GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInner + * given an JSON string + * + * @param jsonString JSON string + * @return An instance of + * GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInner + * @throws IOException if the JSON string is invalid with respect to + * GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInner + */ + public static + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInner + fromJson(String jsonString) throws IOException { + return JSON.getGson() + .fromJson( + jsonString, + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInner + .class); + } + + /** + * Convert an instance of + * GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInner + * to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionCollectionDetail.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionCollectionDetail.java new file mode 100644 index 0000000..355b43c --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionCollectionDetail.java @@ -0,0 +1,373 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** + * Collection metadata. Null when the collection has no metadata. Fields are null when not + * applicable. + */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public +class GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionCollectionDetail { + public static final String SERIALIZED_NAME_COLLECTION_INDEX = "collectionIndex"; + + @SerializedName(SERIALIZED_NAME_COLLECTION_INDEX) + @jakarta.annotation.Nullable + private String collectionIndex; + + public static final String SERIALIZED_NAME_COLLECTION_DISPLAY_NAME = "collectionDisplayName"; + + @SerializedName(SERIALIZED_NAME_COLLECTION_DISPLAY_NAME) + @jakarta.annotation.Nullable + private String collectionDisplayName; + + public static final String SERIALIZED_NAME_HEALTH_FACTOR = "healthFactor"; + + @SerializedName(SERIALIZED_NAME_HEALTH_FACTOR) + @jakarta.annotation.Nullable + private String healthFactor; + + public + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionCollectionDetail() {} + + public + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionCollectionDetail + collectionIndex(@jakarta.annotation.Nullable String collectionIndex) { + this.collectionIndex = collectionIndex; + return this; + } + + /** + * Index of this collection within the pool. For single-asset collections this is the + * ABI-encoded (left-padded) token address; other pools use their own index format. + * + * @return collectionIndex + */ + @jakarta.annotation.Nullable + public String getCollectionIndex() { + return collectionIndex; + } + + public void setCollectionIndex(@jakarta.annotation.Nullable String collectionIndex) { + this.collectionIndex = collectionIndex; + } + + public + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionCollectionDetail + collectionDisplayName(@jakarta.annotation.Nullable String collectionDisplayName) { + this.collectionDisplayName = collectionDisplayName; + return this; + } + + /** + * Human-readable collection name. + * + * @return collectionDisplayName + */ + @jakarta.annotation.Nullable + public String getCollectionDisplayName() { + return collectionDisplayName; + } + + public void setCollectionDisplayName( + @jakarta.annotation.Nullable String collectionDisplayName) { + this.collectionDisplayName = collectionDisplayName; + } + + public + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionCollectionDetail + healthFactor(@jakarta.annotation.Nullable String healthFactor) { + this.healthFactor = healthFactor; + return this; + } + + /** + * Health factor for lending positions. Null for non-lending positions. + * + * @return healthFactor + */ + @jakarta.annotation.Nullable + public String getHealthFactor() { + return healthFactor; + } + + public void setHealthFactor(@jakarta.annotation.Nullable String healthFactor) { + this.healthFactor = healthFactor; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionCollectionDetail + getDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionCollectionDetail = + (GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionCollectionDetail) + o; + return Objects.equals( + this.collectionIndex, + getDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionCollectionDetail + .collectionIndex) + && Objects.equals( + this.collectionDisplayName, + getDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionCollectionDetail + .collectionDisplayName) + && Objects.equals( + this.healthFactor, + getDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionCollectionDetail + .healthFactor); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(collectionIndex, collectionDisplayName, healthFactor); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append( + "class" + + " GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionCollectionDetail" + + " {\n"); + sb.append(" collectionIndex: ").append(toIndentedString(collectionIndex)).append("\n"); + sb.append(" collectionDisplayName: ") + .append(toIndentedString(collectionDisplayName)) + .append("\n"); + sb.append(" healthFactor: ").append(toIndentedString(healthFactor)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object collectionIndexValue = getCollectionIndex(); + String collectionIndexValueAsString = ""; + collectionIndexValueAsString = collectionIndexValue.toString(); + sb.append("collectionIndex=").append(urlEncode(collectionIndexValueAsString)).append(""); + Object collectionDisplayNameValue = getCollectionDisplayName(); + String collectionDisplayNameValueAsString = ""; + collectionDisplayNameValueAsString = collectionDisplayNameValue.toString(); + sb.append("collectionDisplayName=") + .append(urlEncode(collectionDisplayNameValueAsString)) + .append(""); + Object healthFactorValue = getHealthFactor(); + String healthFactorValueAsString = ""; + healthFactorValueAsString = healthFactorValue.toString(); + sb.append("healthFactor=").append(urlEncode(healthFactorValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("collectionIndex"); + openapiFields.add("collectionDisplayName"); + openapiFields.add("healthFactor"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionCollectionDetail + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionCollectionDetail + .openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionCollectionDetail" + + " is not found in the empty JSON string", + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionCollectionDetail + .openapiRequiredFields + .toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("collectionIndex") != null && !jsonObj.get("collectionIndex").isJsonNull()) + && !jsonObj.get("collectionIndex").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `collectionIndex` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("collectionIndex").toString())); + } + if ((jsonObj.get("collectionDisplayName") != null + && !jsonObj.get("collectionDisplayName").isJsonNull()) + && !jsonObj.get("collectionDisplayName").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `collectionDisplayName` to be a primitive type in" + + " the JSON string but got `%s`", + jsonObj.get("collectionDisplayName").toString())); + } + if ((jsonObj.get("healthFactor") != null && !jsonObj.get("healthFactor").isJsonNull()) + && !jsonObj.get("healthFactor").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `healthFactor` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("healthFactor").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionCollectionDetail + .class + .isAssignableFrom(type.getRawType())) { + return null; // this class only serializes + // 'GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionCollectionDetail' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter< + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionCollectionDetail> + thisAdapter = + gson.getDelegateAdapter( + this, + TypeToken.get( + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionCollectionDetail + .class)); + + return (TypeAdapter) + new TypeAdapter< + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionCollectionDetail>() { + @Override + public void write( + JsonWriter out, + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionCollectionDetail + value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionCollectionDetail + read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of + * GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionCollectionDetail + * given an JSON string + * + * @param jsonString JSON string + * @return An instance of + * GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionCollectionDetail + * @throws IOException if the JSON string is invalid with respect to + * GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionCollectionDetail + */ + public static + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionCollectionDetail + fromJson(String jsonString) throws IOException { + return JSON.getGson() + .fromJson( + jsonString, + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionCollectionDetail + .class); + } + + /** + * Convert an instance of + * GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionCollectionDetail + * to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInner.java new file mode 100644 index 0000000..58bdbed --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInner.java @@ -0,0 +1,639 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** A single DeFi position with underlying asset and token breakdown. */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public +class GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInner { + public static final String SERIALIZED_NAME_POSITION_ID = "positionId"; + + @SerializedName(SERIALIZED_NAME_POSITION_ID) + @jakarta.annotation.Nullable + private String positionId; + + public static final String SERIALIZED_NAME_UNDERLYING_ASSET_NAME = "underlyingAssetName"; + + @SerializedName(SERIALIZED_NAME_UNDERLYING_ASSET_NAME) + @jakarta.annotation.Nullable + private String underlyingAssetName; + + public static final String SERIALIZED_NAME_UNDERLYING_ASSET_ID = "underlyingAssetId"; + + @SerializedName(SERIALIZED_NAME_UNDERLYING_ASSET_ID) + @jakarta.annotation.Nullable + private String underlyingAssetId; + + public static final String SERIALIZED_NAME_ASSET_TYPE = "assetType"; + + @SerializedName(SERIALIZED_NAME_ASSET_TYPE) + @jakarta.annotation.Nullable + private String assetType; + + public static final String SERIALIZED_NAME_INVESTMENT_IDS = "investmentIds"; + + @SerializedName(SERIALIZED_NAME_INVESTMENT_IDS) + @jakarta.annotation.Nullable + private List investmentIds; + + public static final String SERIALIZED_NAME_POSITION_DETAIL = "positionDetail"; + + @SerializedName(SERIALIZED_NAME_POSITION_DETAIL) + @jakarta.annotation.Nullable + private + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInnerPositionDetail + positionDetail; + + public static final String SERIALIZED_NAME_POSITION_VALUE = "positionValue"; + + @SerializedName(SERIALIZED_NAME_POSITION_VALUE) + @jakarta.annotation.Nullable + private String positionValue; + + public static final String SERIALIZED_NAME_TOKEN_LIST = "tokenList"; + + @SerializedName(SERIALIZED_NAME_TOKEN_LIST) + @jakarta.annotation.Nullable + private PositionRespTokenList tokenList; + + public + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInner() {} + + public + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInner + positionId(@jakarta.annotation.Nullable String positionId) { + this.positionId = positionId; + return this; + } + + /** + * Unique position identifier (64-char hex, no `0x` prefix). + * + * @return positionId + */ + @jakarta.annotation.Nullable + public String getPositionId() { + return positionId; + } + + public void setPositionId(@jakarta.annotation.Nullable String positionId) { + this.positionId = positionId; + } + + public + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInner + underlyingAssetName(@jakarta.annotation.Nullable String underlyingAssetName) { + this.underlyingAssetName = underlyingAssetName; + return this; + } + + /** + * Display name of the underlying asset (e.g. \"USDT-USDC\", \"lisUSD\"). + * + * @return underlyingAssetName + */ + @jakarta.annotation.Nullable + public String getUnderlyingAssetName() { + return underlyingAssetName; + } + + public void setUnderlyingAssetName(@jakarta.annotation.Nullable String underlyingAssetName) { + this.underlyingAssetName = underlyingAssetName; + } + + public + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInner + underlyingAssetId(@jakarta.annotation.Nullable String underlyingAssetId) { + this.underlyingAssetId = underlyingAssetId; + return this; + } + + /** + * Underlying asset identifier (64-char hex, no `0x` prefix). Hashed from the pool and + * underlying token addresses. + * + * @return underlyingAssetId + */ + @jakarta.annotation.Nullable + public String getUnderlyingAssetId() { + return underlyingAssetId; + } + + public void setUnderlyingAssetId(@jakarta.annotation.Nullable String underlyingAssetId) { + this.underlyingAssetId = underlyingAssetId; + } + + public + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInner + assetType(@jakarta.annotation.Nullable String assetType) { + this.assetType = assetType; + return this; + } + + /** + * Asset structure type. Null for a regular position; `locked` for a locked position + * (e.g. locked staking — check `unlockTime` on positionDetail); `farming` + * for a MasterChef-style farming position (rewards accrue under the `farming_reward` + * token group). + * + * @return assetType + */ + @jakarta.annotation.Nullable + public String getAssetType() { + return assetType; + } + + public void setAssetType(@jakarta.annotation.Nullable String assetType) { + this.assetType = assetType; + } + + public + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInner + investmentIds(@jakarta.annotation.Nullable List investmentIds) { + this.investmentIds = investmentIds; + return this; + } + + public + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInner + addInvestmentIdsItem(String investmentIdsItem) { + if (this.investmentIds == null) { + this.investmentIds = new ArrayList<>(); + } + this.investmentIds.add(investmentIdsItem); + return this; + } + + /** + * Related investment IDs (64-char hex, no `0x` prefix). Use with `POST + * /api/v1/defi/data/investment/detail`. Usually a single entry; a position can relate to + * several investments when the pool stacks products on top of each other (e.g. a farming + * position wraps the underlying LP investment plus its incentive product, or a staked vault + * layers a receipt token over the base deposit). When there are several, query each with + * investment/detail and pick by the action you want to perform — redeeming the principal uses + * the base investment, claiming farming incentives uses the incentive one. + * + * @return investmentIds + */ + @jakarta.annotation.Nullable + public List getInvestmentIds() { + return investmentIds; + } + + public void setInvestmentIds(@jakarta.annotation.Nullable List investmentIds) { + this.investmentIds = investmentIds; + } + + public + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInner + positionDetail( + @jakarta.annotation.Nullable + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInnerPositionDetail + positionDetail) { + this.positionDetail = positionDetail; + return this; + } + + /** + * Get positionDetail + * + * @return positionDetail + */ + @jakarta.annotation.Nullable + @Valid + public + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInnerPositionDetail + getPositionDetail() { + return positionDetail; + } + + public void setPositionDetail( + @jakarta.annotation.Nullable + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInnerPositionDetail + positionDetail) { + this.positionDetail = positionDetail; + } + + public + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInner + positionValue(@jakarta.annotation.Nullable String positionValue) { + this.positionValue = positionValue; + return this; + } + + /** + * Total position value in USD (sum of all token values; may be negative for borrow positions). + * + * @return positionValue + */ + @jakarta.annotation.Nullable + public String getPositionValue() { + return positionValue; + } + + public void setPositionValue(@jakarta.annotation.Nullable String positionValue) { + this.positionValue = positionValue; + } + + public + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInner + tokenList(@jakarta.annotation.Nullable PositionRespTokenList tokenList) { + this.tokenList = tokenList; + return this; + } + + /** + * Get tokenList + * + * @return tokenList + */ + @jakarta.annotation.Nullable + @Valid + public PositionRespTokenList getTokenList() { + return tokenList; + } + + public void setTokenList(@jakarta.annotation.Nullable PositionRespTokenList tokenList) { + this.tokenList = tokenList; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInner + getDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInner = + (GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInner) + o; + return Objects.equals( + this.positionId, + getDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInner + .positionId) + && Objects.equals( + this.underlyingAssetName, + getDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInner + .underlyingAssetName) + && Objects.equals( + this.underlyingAssetId, + getDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInner + .underlyingAssetId) + && Objects.equals( + this.assetType, + getDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInner + .assetType) + && Objects.equals( + this.investmentIds, + getDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInner + .investmentIds) + && Objects.equals( + this.positionDetail, + getDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInner + .positionDetail) + && Objects.equals( + this.positionValue, + getDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInner + .positionValue) + && Objects.equals( + this.tokenList, + getDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInner + .tokenList); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash( + positionId, + underlyingAssetName, + underlyingAssetId, + assetType, + investmentIds, + positionDetail, + positionValue, + tokenList); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append( + "class" + + " GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInner" + + " {\n"); + sb.append(" positionId: ").append(toIndentedString(positionId)).append("\n"); + sb.append(" underlyingAssetName: ") + .append(toIndentedString(underlyingAssetName)) + .append("\n"); + sb.append(" underlyingAssetId: ").append(toIndentedString(underlyingAssetId)).append("\n"); + sb.append(" assetType: ").append(toIndentedString(assetType)).append("\n"); + sb.append(" investmentIds: ").append(toIndentedString(investmentIds)).append("\n"); + sb.append(" positionDetail: ").append(toIndentedString(positionDetail)).append("\n"); + sb.append(" positionValue: ").append(toIndentedString(positionValue)).append("\n"); + sb.append(" tokenList: ").append(toIndentedString(tokenList)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object positionIdValue = getPositionId(); + String positionIdValueAsString = ""; + positionIdValueAsString = positionIdValue.toString(); + sb.append("positionId=").append(urlEncode(positionIdValueAsString)).append(""); + Object underlyingAssetNameValue = getUnderlyingAssetName(); + String underlyingAssetNameValueAsString = ""; + underlyingAssetNameValueAsString = underlyingAssetNameValue.toString(); + sb.append("underlyingAssetName=") + .append(urlEncode(underlyingAssetNameValueAsString)) + .append(""); + Object underlyingAssetIdValue = getUnderlyingAssetId(); + String underlyingAssetIdValueAsString = ""; + underlyingAssetIdValueAsString = underlyingAssetIdValue.toString(); + sb.append("underlyingAssetId=") + .append(urlEncode(underlyingAssetIdValueAsString)) + .append(""); + Object assetTypeValue = getAssetType(); + String assetTypeValueAsString = ""; + assetTypeValueAsString = assetTypeValue.toString(); + sb.append("assetType=").append(urlEncode(assetTypeValueAsString)).append(""); + Object investmentIdsValue = getInvestmentIds(); + String investmentIdsValueAsString = ""; + investmentIdsValueAsString = + (String) + ((Collection) investmentIdsValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("investmentIds=").append(urlEncode(investmentIdsValueAsString)).append(""); + Object positionDetailValue = getPositionDetail(); + String positionDetailValueAsString = ""; + positionDetailValueAsString = positionDetailValue.toString(); + sb.append("positionDetail=").append(urlEncode(positionDetailValueAsString)).append(""); + Object positionValueValue = getPositionValue(); + String positionValueValueAsString = ""; + positionValueValueAsString = positionValueValue.toString(); + sb.append("positionValue=").append(urlEncode(positionValueValueAsString)).append(""); + Object tokenListValue = getTokenList(); + String tokenListValueAsString = ""; + tokenListValueAsString = tokenListValue.toString(); + sb.append("tokenList=").append(urlEncode(tokenListValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("positionId"); + openapiFields.add("underlyingAssetName"); + openapiFields.add("underlyingAssetId"); + openapiFields.add("assetType"); + openapiFields.add("investmentIds"); + openapiFields.add("positionDetail"); + openapiFields.add("positionValue"); + openapiFields.add("tokenList"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInner + .openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInner" + + " is not found in the empty JSON string", + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInner + .openapiRequiredFields + .toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("positionId") != null && !jsonObj.get("positionId").isJsonNull()) + && !jsonObj.get("positionId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `positionId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("positionId").toString())); + } + if ((jsonObj.get("underlyingAssetName") != null + && !jsonObj.get("underlyingAssetName").isJsonNull()) + && !jsonObj.get("underlyingAssetName").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `underlyingAssetName` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("underlyingAssetName").toString())); + } + if ((jsonObj.get("underlyingAssetId") != null + && !jsonObj.get("underlyingAssetId").isJsonNull()) + && !jsonObj.get("underlyingAssetId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `underlyingAssetId` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("underlyingAssetId").toString())); + } + if ((jsonObj.get("assetType") != null && !jsonObj.get("assetType").isJsonNull()) + && !jsonObj.get("assetType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `assetType` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("assetType").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("investmentIds") != null + && !jsonObj.get("investmentIds").isJsonNull() + && !jsonObj.get("investmentIds").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `investmentIds` to be an array in the JSON string" + + " but got `%s`", + jsonObj.get("investmentIds").toString())); + } + // validate the optional field `positionDetail` + if (jsonObj.get("positionDetail") != null && !jsonObj.get("positionDetail").isJsonNull()) { + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInnerPositionDetail + .validateJsonElement(jsonObj.get("positionDetail")); + } + if ((jsonObj.get("positionValue") != null && !jsonObj.get("positionValue").isJsonNull()) + && !jsonObj.get("positionValue").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `positionValue` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("positionValue").toString())); + } + // validate the optional field `tokenList` + if (jsonObj.get("tokenList") != null && !jsonObj.get("tokenList").isJsonNull()) { + PositionRespTokenList.validateJsonElement(jsonObj.get("tokenList")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInner + .class + .isAssignableFrom(type.getRawType())) { + return null; // this class only serializes + // 'GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter< + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInner> + thisAdapter = + gson.getDelegateAdapter( + this, + TypeToken.get( + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInner + .class)); + + return (TypeAdapter) + new TypeAdapter< + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInner>() { + @Override + public void write( + JsonWriter out, + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInner + value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInner + read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of + * GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInner + * given an JSON string + * + * @param jsonString JSON string + * @return An instance of + * GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInner + * @throws IOException if the JSON string is invalid with respect to + * GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInner + */ + public static + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInner + fromJson(String jsonString) throws IOException { + return JSON.getGson() + .fromJson( + jsonString, + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInner + .class); + } + + /** + * Convert an instance of + * GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInner + * to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInnerPositionDetail.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInnerPositionDetail.java new file mode 100644 index 0000000..00de2af --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInnerPositionDetail.java @@ -0,0 +1,755 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** + * Position-level metadata. Present for concentrated-liquidity / locked / farming positions; null + * otherwise. Fields are null when not applicable to the position type. + */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public +class GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInnerPositionDetail { + public static final String SERIALIZED_NAME_POSITION_INDEX = "positionIndex"; + + @SerializedName(SERIALIZED_NAME_POSITION_INDEX) + @jakarta.annotation.Nullable + private String positionIndex; + + public static final String SERIALIZED_NAME_NFT_ID = "nftId"; + + @SerializedName(SERIALIZED_NAME_NFT_ID) + @jakarta.annotation.Nullable + private String nftId; + + public static final String SERIALIZED_NAME_UNLOCK_TIME = "unlockTime"; + + @SerializedName(SERIALIZED_NAME_UNLOCK_TIME) + @jakarta.annotation.Nullable + private String unlockTime; + + public static final String SERIALIZED_NAME_UNLOCK_TIME_REACHED = "unlockTimeReached"; + + @SerializedName(SERIALIZED_NAME_UNLOCK_TIME_REACHED) + @jakarta.annotation.Nullable + private Boolean unlockTimeReached; + + public static final String SERIALIZED_NAME_TICK_LOWER = "tickLower"; + + @SerializedName(SERIALIZED_NAME_TICK_LOWER) + @jakarta.annotation.Nullable + private String tickLower; + + public static final String SERIALIZED_NAME_TICK_UPPER = "tickUpper"; + + @SerializedName(SERIALIZED_NAME_TICK_UPPER) + @jakarta.annotation.Nullable + private String tickUpper; + + public static final String SERIALIZED_NAME_ACTIVE = "active"; + + @SerializedName(SERIALIZED_NAME_ACTIVE) + @jakarta.annotation.Nullable + private Boolean active; + + public static final String SERIALIZED_NAME_PROOFS = "proofs"; + + @SerializedName(SERIALIZED_NAME_PROOFS) + @jakarta.annotation.Nullable + private Map> proofs; + + public static final String SERIALIZED_NAME_STAKE_STATE = "stakeState"; + + @SerializedName(SERIALIZED_NAME_STAKE_STATE) + @jakarta.annotation.Nullable + private String stakeState; + + public static final String SERIALIZED_NAME_CLAIM_TYPES = "claimTypes"; + + @SerializedName(SERIALIZED_NAME_CLAIM_TYPES) + @jakarta.annotation.Nullable + private List claimTypes; + + public static final String SERIALIZED_NAME_REDEMPTION_ID = "redemptionId"; + + @SerializedName(SERIALIZED_NAME_REDEMPTION_ID) + @jakarta.annotation.Nullable + private String redemptionId; + + public + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInnerPositionDetail() {} + + public + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInnerPositionDetail + positionIndex(@jakarta.annotation.Nullable String positionIndex) { + this.positionIndex = positionIndex; + return this; + } + + /** + * Position index (e.g. the Uniswap-V3-style position number). + * + * @return positionIndex + */ + @jakarta.annotation.Nullable + public String getPositionIndex() { + return positionIndex; + } + + public void setPositionIndex(@jakarta.annotation.Nullable String positionIndex) { + this.positionIndex = positionIndex; + } + + public + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInnerPositionDetail + nftId(@jakarta.annotation.Nullable String nftId) { + this.nftId = nftId; + return this; + } + + /** + * NFT token ID for concentrated-liquidity positions, prefixed with `#` (e.g. + * `\"#7225901\"`). Null for non-NFT positions. The `#` prefix may + * be passed as-is to a transaction build endpoint (`lp-add` / `lp-remove` / + * `claim` `LP_FEE`) — the service strips it automatically; passing the raw + * id without `#` is also accepted. + * + * @return nftId + */ + @jakarta.annotation.Nullable + public String getNftId() { + return nftId; + } + + public void setNftId(@jakarta.annotation.Nullable String nftId) { + this.nftId = nftId; + } + + public + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInnerPositionDetail + unlockTime(@jakarta.annotation.Nullable String unlockTime) { + this.unlockTime = unlockTime; + return this; + } + + /** + * Unix timestamp (seconds) when the position unlocks. Null if no lock. + * + * @return unlockTime + */ + @jakarta.annotation.Nullable + public String getUnlockTime() { + return unlockTime; + } + + public void setUnlockTime(@jakarta.annotation.Nullable String unlockTime) { + this.unlockTime = unlockTime; + } + + public + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInnerPositionDetail + unlockTimeReached(@jakarta.annotation.Nullable Boolean unlockTimeReached) { + this.unlockTimeReached = unlockTimeReached; + return this; + } + + /** + * Whether the unlock time has been reached. + * + * @return unlockTimeReached + */ + @jakarta.annotation.Nullable + public Boolean getUnlockTimeReached() { + return unlockTimeReached; + } + + public void setUnlockTimeReached(@jakarta.annotation.Nullable Boolean unlockTimeReached) { + this.unlockTimeReached = unlockTimeReached; + } + + public + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInnerPositionDetail + tickLower(@jakarta.annotation.Nullable String tickLower) { + this.tickLower = tickLower; + return this; + } + + /** + * Lower tick bound for concentrated-liquidity positions. + * + * @return tickLower + */ + @jakarta.annotation.Nullable + public String getTickLower() { + return tickLower; + } + + public void setTickLower(@jakarta.annotation.Nullable String tickLower) { + this.tickLower = tickLower; + } + + public + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInnerPositionDetail + tickUpper(@jakarta.annotation.Nullable String tickUpper) { + this.tickUpper = tickUpper; + return this; + } + + /** + * Upper tick bound for concentrated-liquidity positions. + * + * @return tickUpper + */ + @jakarta.annotation.Nullable + public String getTickUpper() { + return tickUpper; + } + + public void setTickUpper(@jakarta.annotation.Nullable String tickUpper) { + this.tickUpper = tickUpper; + } + + public + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInnerPositionDetail + active(@jakarta.annotation.Nullable Boolean active) { + this.active = active; + return this; + } + + /** + * Whether the position is currently in-range (active). + * + * @return active + */ + @jakarta.annotation.Nullable + public Boolean getActive() { + return active; + } + + public void setActive(@jakarta.annotation.Nullable Boolean active) { + this.active = active; + } + + public + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInnerPositionDetail + proofs(@jakarta.annotation.Nullable Map> proofs) { + this.proofs = proofs; + return this; + } + + public + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInnerPositionDetail + putProofsItem(String key, List proofsItem) { + if (this.proofs == null) { + this.proofs = new HashMap<>(); + } + this.proofs.put(key, proofsItem); + return this; + } + + /** + * Merkle proofs keyed by reward token address. Required when claiming PancakeSwap Infinity (V4) + * rewards. + * + * @return proofs + */ + @jakarta.annotation.Nullable + @Valid + public Map> getProofs() { + return proofs; + } + + public void setProofs(@jakarta.annotation.Nullable Map> proofs) { + this.proofs = proofs; + } + + public + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInnerPositionDetail + stakeState(@jakarta.annotation.Nullable String stakeState) { + this.stakeState = stakeState; + return this; + } + + /** + * Staking lifecycle state. Complete value set: active (earning), deactivating (unstaking in + * progress, rewards stop), inactive (fully unstaked). + * + * @return stakeState + */ + @jakarta.annotation.Nullable + public String getStakeState() { + return stakeState; + } + + public void setStakeState(@jakarta.annotation.Nullable String stakeState) { + this.stakeState = stakeState; + } + + public + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInnerPositionDetail + claimTypes(@jakarta.annotation.Nullable List claimTypes) { + this.claimTypes = claimTypes; + return this; + } + + public + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInnerPositionDetail + addClaimTypesItem(String claimTypesItem) { + if (this.claimTypes == null) { + this.claimTypes = new ArrayList<>(); + } + this.claimTypes.add(claimTypesItem); + return this; + } + + /** + * Claim types available for this position. Values map to the `claimType` field of + * `POST /transaction/claim` and determine which companion fields a claim requires. + * + * @return claimTypes + */ + @jakarta.annotation.Nullable + public List getClaimTypes() { + return claimTypes; + } + + public void setClaimTypes(@jakarta.annotation.Nullable List claimTypes) { + this.claimTypes = claimTypes; + } + + public + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInnerPositionDetail + redemptionId(@jakarta.annotation.Nullable String redemptionId) { + this.redemptionId = redemptionId; + return this; + } + + /** + * Redemption record ID (for pending redemptions). Null when not a pending redemption. + * + * @return redemptionId + */ + @jakarta.annotation.Nullable + public String getRedemptionId() { + return redemptionId; + } + + public void setRedemptionId(@jakarta.annotation.Nullable String redemptionId) { + this.redemptionId = redemptionId; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInnerPositionDetail + getDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInnerPositionDetail = + (GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInnerPositionDetail) + o; + return Objects.equals( + this.positionIndex, + getDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInnerPositionDetail + .positionIndex) + && Objects.equals( + this.nftId, + getDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInnerPositionDetail + .nftId) + && Objects.equals( + this.unlockTime, + getDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInnerPositionDetail + .unlockTime) + && Objects.equals( + this.unlockTimeReached, + getDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInnerPositionDetail + .unlockTimeReached) + && Objects.equals( + this.tickLower, + getDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInnerPositionDetail + .tickLower) + && Objects.equals( + this.tickUpper, + getDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInnerPositionDetail + .tickUpper) + && Objects.equals( + this.active, + getDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInnerPositionDetail + .active) + && Objects.equals( + this.proofs, + getDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInnerPositionDetail + .proofs) + && Objects.equals( + this.stakeState, + getDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInnerPositionDetail + .stakeState) + && Objects.equals( + this.claimTypes, + getDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInnerPositionDetail + .claimTypes) + && Objects.equals( + this.redemptionId, + getDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInnerPositionDetail + .redemptionId); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash( + positionIndex, + nftId, + unlockTime, + unlockTimeReached, + tickLower, + tickUpper, + active, + proofs, + stakeState, + claimTypes, + redemptionId); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append( + "class" + + " GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInnerPositionDetail" + + " {\n"); + sb.append(" positionIndex: ").append(toIndentedString(positionIndex)).append("\n"); + sb.append(" nftId: ").append(toIndentedString(nftId)).append("\n"); + sb.append(" unlockTime: ").append(toIndentedString(unlockTime)).append("\n"); + sb.append(" unlockTimeReached: ").append(toIndentedString(unlockTimeReached)).append("\n"); + sb.append(" tickLower: ").append(toIndentedString(tickLower)).append("\n"); + sb.append(" tickUpper: ").append(toIndentedString(tickUpper)).append("\n"); + sb.append(" active: ").append(toIndentedString(active)).append("\n"); + sb.append(" proofs: ").append(toIndentedString(proofs)).append("\n"); + sb.append(" stakeState: ").append(toIndentedString(stakeState)).append("\n"); + sb.append(" claimTypes: ").append(toIndentedString(claimTypes)).append("\n"); + sb.append(" redemptionId: ").append(toIndentedString(redemptionId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object positionIndexValue = getPositionIndex(); + String positionIndexValueAsString = ""; + positionIndexValueAsString = positionIndexValue.toString(); + sb.append("positionIndex=").append(urlEncode(positionIndexValueAsString)).append(""); + Object nftIdValue = getNftId(); + String nftIdValueAsString = ""; + nftIdValueAsString = nftIdValue.toString(); + sb.append("nftId=").append(urlEncode(nftIdValueAsString)).append(""); + Object unlockTimeValue = getUnlockTime(); + String unlockTimeValueAsString = ""; + unlockTimeValueAsString = unlockTimeValue.toString(); + sb.append("unlockTime=").append(urlEncode(unlockTimeValueAsString)).append(""); + Object unlockTimeReachedValue = getUnlockTimeReached(); + String unlockTimeReachedValueAsString = ""; + unlockTimeReachedValueAsString = unlockTimeReachedValue.toString(); + sb.append("unlockTimeReached=") + .append(urlEncode(unlockTimeReachedValueAsString)) + .append(""); + Object tickLowerValue = getTickLower(); + String tickLowerValueAsString = ""; + tickLowerValueAsString = tickLowerValue.toString(); + sb.append("tickLower=").append(urlEncode(tickLowerValueAsString)).append(""); + Object tickUpperValue = getTickUpper(); + String tickUpperValueAsString = ""; + tickUpperValueAsString = tickUpperValue.toString(); + sb.append("tickUpper=").append(urlEncode(tickUpperValueAsString)).append(""); + Object activeValue = getActive(); + String activeValueAsString = ""; + activeValueAsString = activeValue.toString(); + sb.append("active=").append(urlEncode(activeValueAsString)).append(""); + Object proofsValue = getProofs(); + String proofsValueAsString = ""; + proofsValueAsString = proofsValue.toString(); + sb.append("proofs=").append(urlEncode(proofsValueAsString)).append(""); + Object stakeStateValue = getStakeState(); + String stakeStateValueAsString = ""; + stakeStateValueAsString = stakeStateValue.toString(); + sb.append("stakeState=").append(urlEncode(stakeStateValueAsString)).append(""); + Object claimTypesValue = getClaimTypes(); + String claimTypesValueAsString = ""; + claimTypesValueAsString = + (String) + ((Collection) claimTypesValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("claimTypes=").append(urlEncode(claimTypesValueAsString)).append(""); + Object redemptionIdValue = getRedemptionId(); + String redemptionIdValueAsString = ""; + redemptionIdValueAsString = redemptionIdValue.toString(); + sb.append("redemptionId=").append(urlEncode(redemptionIdValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("positionIndex"); + openapiFields.add("nftId"); + openapiFields.add("unlockTime"); + openapiFields.add("unlockTimeReached"); + openapiFields.add("tickLower"); + openapiFields.add("tickUpper"); + openapiFields.add("active"); + openapiFields.add("proofs"); + openapiFields.add("stakeState"); + openapiFields.add("claimTypes"); + openapiFields.add("redemptionId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInnerPositionDetail + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInnerPositionDetail + .openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInnerPositionDetail" + + " is not found in the empty JSON string", + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInnerPositionDetail + .openapiRequiredFields + .toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("positionIndex") != null && !jsonObj.get("positionIndex").isJsonNull()) + && !jsonObj.get("positionIndex").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `positionIndex` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("positionIndex").toString())); + } + if ((jsonObj.get("nftId") != null && !jsonObj.get("nftId").isJsonNull()) + && !jsonObj.get("nftId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `nftId` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("nftId").toString())); + } + if ((jsonObj.get("unlockTime") != null && !jsonObj.get("unlockTime").isJsonNull()) + && !jsonObj.get("unlockTime").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `unlockTime` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("unlockTime").toString())); + } + if ((jsonObj.get("tickLower") != null && !jsonObj.get("tickLower").isJsonNull()) + && !jsonObj.get("tickLower").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `tickLower` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("tickLower").toString())); + } + if ((jsonObj.get("tickUpper") != null && !jsonObj.get("tickUpper").isJsonNull()) + && !jsonObj.get("tickUpper").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `tickUpper` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("tickUpper").toString())); + } + if ((jsonObj.get("stakeState") != null && !jsonObj.get("stakeState").isJsonNull()) + && !jsonObj.get("stakeState").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `stakeState` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("stakeState").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("claimTypes") != null + && !jsonObj.get("claimTypes").isJsonNull() + && !jsonObj.get("claimTypes").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `claimTypes` to be an array in the JSON string but" + + " got `%s`", + jsonObj.get("claimTypes").toString())); + } + if ((jsonObj.get("redemptionId") != null && !jsonObj.get("redemptionId").isJsonNull()) + && !jsonObj.get("redemptionId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `redemptionId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("redemptionId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInnerPositionDetail + .class + .isAssignableFrom(type.getRawType())) { + return null; // this class only serializes + // 'GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInnerPositionDetail' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter< + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInnerPositionDetail> + thisAdapter = + gson.getDelegateAdapter( + this, + TypeToken.get( + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInnerPositionDetail + .class)); + + return (TypeAdapter) + new TypeAdapter< + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInnerPositionDetail>() { + @Override + public void write( + JsonWriter out, + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInnerPositionDetail + value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInnerPositionDetail + read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of + * GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInnerPositionDetail + * given an JSON string + * + * @param jsonString JSON string + * @return An instance of + * GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInnerPositionDetail + * @throws IOException if the JSON string is invalid with respect to + * GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInnerPositionDetail + */ + public static + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInnerPositionDetail + fromJson(String jsonString) throws IOException { + return JSON.getGson() + .fromJson( + jsonString, + GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInnerPositionDetail + .class); + } + + /** + * Convert an instance of + * GetDeFiPositionsResponseDataAddressListInnerProtocolListInnerPoolListInnerPositionCollectionListInnerPositionListInnerPositionDetail + * to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetDexTradeHistoryResponse.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetDexTradeHistoryResponse.java index b75a64b..d798aff 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetDexTradeHistoryResponse.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetDexTradeHistoryResponse.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetDexTradeHistoryResponseData.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetDexTradeHistoryResponseData.java index b97e26f..0918a85 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetDexTradeHistoryResponseData.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetDexTradeHistoryResponseData.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetDexTradeHistoryResponseDataTransactionListInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetDexTradeHistoryResponseDataTransactionListInner.java index 56540de..a1ee198 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetDexTradeHistoryResponseDataTransactionListInner.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetDexTradeHistoryResponseDataTransactionListInner.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetErc20ApproveTransactionResponse.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetErc20ApproveTransactionResponse.java index 62492a1..38f9413 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetErc20ApproveTransactionResponse.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetErc20ApproveTransactionResponse.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetErc20ApproveTransactionResponseDataInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetErc20ApproveTransactionResponseDataInner.java index 4902e83..56d1328 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetErc20ApproveTransactionResponseDataInner.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetErc20ApproveTransactionResponseDataInner.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetGasLimitRequest.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetGasLimitRequest.java index f73bd7e..5dda77b 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetGasLimitRequest.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetGasLimitRequest.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetGasLimitRequestEvmTx.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetGasLimitRequestEvmTx.java index a34c479..87eee35 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetGasLimitRequestEvmTx.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetGasLimitRequestEvmTx.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetGasLimitRequestSolTx.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetGasLimitRequestSolTx.java index d99ff4a..377f1a0 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetGasLimitRequestSolTx.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetGasLimitRequestSolTx.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetGasLimitRequestTronTx.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetGasLimitRequestTronTx.java index 10bd7cb..94db5b9 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetGasLimitRequestTronTx.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetGasLimitRequestTronTx.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetGasLimitRequestTronTxTransferContractParams.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetGasLimitRequestTronTxTransferContractParams.java index ba94ed5..5b3d653 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetGasLimitRequestTronTxTransferContractParams.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetGasLimitRequestTronTxTransferContractParams.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetGasLimitRequestTronTxTriggerSmartContractParams.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetGasLimitRequestTronTxTriggerSmartContractParams.java index a4b6ff0..f3087d2 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetGasLimitRequestTronTxTriggerSmartContractParams.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetGasLimitRequestTronTxTriggerSmartContractParams.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetGasLimitResponse.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetGasLimitResponse.java index 85c4c54..b8ac695 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetGasLimitResponse.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetGasLimitResponse.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetGasLimitResponseData.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetGasLimitResponseData.java index 49982c3..ec6f2af 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetGasLimitResponseData.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetGasLimitResponseData.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetGasPriceResponse.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetGasPriceResponse.java index 8d50f6e..b3c1e4d 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetGasPriceResponse.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetGasPriceResponse.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetGasPriceResponseData.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetGasPriceResponseData.java index 74de051..02c68dc 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetGasPriceResponseData.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetGasPriceResponseData.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetGasPriceResponseDataEip1559GasPrice.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetGasPriceResponseDataEip1559GasPrice.java index 7edbfd8..eca532f 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetGasPriceResponseDataEip1559GasPrice.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetGasPriceResponseDataEip1559GasPrice.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetGasPriceResponseDataEvmLegacyGasPrice.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetGasPriceResponseDataEvmLegacyGasPrice.java index c869736..5af7164 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetGasPriceResponseDataEvmLegacyGasPrice.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetGasPriceResponseDataEvmLegacyGasPrice.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetGasPriceResponseDataSolanaGasPrice.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetGasPriceResponseDataSolanaGasPrice.java index ccffff1..0d0ec99 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetGasPriceResponseDataSolanaGasPrice.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetGasPriceResponseDataSolanaGasPrice.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetHoldersRankingResponse.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetHoldersRankingResponse.java index f781b5c..c715e28 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetHoldersRankingResponse.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetHoldersRankingResponse.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetHoldersRankingResponseDataInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetHoldersRankingResponseDataInner.java index c06ef93..122e580 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetHoldersRankingResponseDataInner.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetHoldersRankingResponseDataInner.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetHoldersRankingResponseDataInnerFundingSourceLabel.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetHoldersRankingResponseDataInnerFundingSourceLabel.java index 4358e7f..c229656 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetHoldersRankingResponseDataInnerFundingSourceLabel.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetHoldersRankingResponseDataInnerFundingSourceLabel.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetHotTokenListResponse.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetHotTokenListResponse.java index abc3423..b75384e 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetHotTokenListResponse.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetHotTokenListResponse.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetHotTokenListResponseData.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetHotTokenListResponseData.java index 1095270..142fca6 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetHotTokenListResponseData.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetHotTokenListResponseData.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetHotTokenListResponseDataItemsInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetHotTokenListResponseDataItemsInner.java index 56a220e..cf49464 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetHotTokenListResponseDataItemsInner.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetHotTokenListResponseDataItemsInner.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetInvestmentDetailRequest.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetInvestmentDetailRequest.java new file mode 100644 index 0000000..3000c53 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetInvestmentDetailRequest.java @@ -0,0 +1,224 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** GetInvestmentDetailRequest */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class GetInvestmentDetailRequest { + public static final String SERIALIZED_NAME_INVESTMENT_ID = "investmentId"; + + @SerializedName(SERIALIZED_NAME_INVESTMENT_ID) + @jakarta.annotation.Nonnull + private String investmentId; + + public GetInvestmentDetailRequest() {} + + public GetInvestmentDetailRequest investmentId( + @jakarta.annotation.Nonnull String investmentId) { + this.investmentId = investmentId; + return this; + } + + /** + * Investment product identifier (64-char hex, no `0x` prefix). Same format as the + * `investmentIds` returned by `POST /api/v1/defi/data/position/list`. + * + * @return investmentId + */ + @jakarta.annotation.Nonnull + @NotNull + public String getInvestmentId() { + return investmentId; + } + + public void setInvestmentId(@jakarta.annotation.Nonnull String investmentId) { + this.investmentId = investmentId; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetInvestmentDetailRequest getInvestmentDetailRequest = (GetInvestmentDetailRequest) o; + return Objects.equals(this.investmentId, getInvestmentDetailRequest.investmentId); + } + + @Override + public int hashCode() { + return Objects.hash(investmentId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetInvestmentDetailRequest {\n"); + sb.append(" investmentId: ").append(toIndentedString(investmentId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object investmentIdValue = getInvestmentId(); + String investmentIdValueAsString = ""; + investmentIdValueAsString = investmentIdValue.toString(); + sb.append("investmentId=").append(urlEncode(investmentIdValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("investmentId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("investmentId"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to GetInvestmentDetailRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetInvestmentDetailRequest.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetInvestmentDetailRequest is not" + + " found in the empty JSON string", + GetInvestmentDetailRequest.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GetInvestmentDetailRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("investmentId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `investmentId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("investmentId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetInvestmentDetailRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetInvestmentDetailRequest' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(GetInvestmentDetailRequest.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetInvestmentDetailRequest value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetInvestmentDetailRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetInvestmentDetailRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetInvestmentDetailRequest + * @throws IOException if the JSON string is invalid with respect to GetInvestmentDetailRequest + */ + public static GetInvestmentDetailRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetInvestmentDetailRequest.class); + } + + /** + * Convert an instance of GetInvestmentDetailRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetInvestmentDetailResponse.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetInvestmentDetailResponse.java new file mode 100644 index 0000000..492130a --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetInvestmentDetailResponse.java @@ -0,0 +1,347 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** GetInvestmentDetailResponse */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class GetInvestmentDetailResponse { + public static final String SERIALIZED_NAME_CODE = "code"; + + @SerializedName(SERIALIZED_NAME_CODE) + @jakarta.annotation.Nullable + private Integer code; + + public static final String SERIALIZED_NAME_MSG = "msg"; + + @SerializedName(SERIALIZED_NAME_MSG) + @jakarta.annotation.Nullable + private String msg; + + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + @jakarta.annotation.Nullable + private GetInvestmentDetailResponseData data; + + public static final String SERIALIZED_NAME_TIMESTAMP = "timestamp"; + + @SerializedName(SERIALIZED_NAME_TIMESTAMP) + @jakarta.annotation.Nullable + private Long timestamp; + + public static final String SERIALIZED_NAME_SUCCESS = "success"; + + @SerializedName(SERIALIZED_NAME_SUCCESS) + @jakarta.annotation.Nullable + private Boolean success; + + public GetInvestmentDetailResponse() {} + + public GetInvestmentDetailResponse code(@jakarta.annotation.Nullable Integer code) { + this.code = code; + return this; + } + + /** + * Business status code. 0 indicates success. + * + * @return code + */ + @jakarta.annotation.Nullable + public Integer getCode() { + return code; + } + + public void setCode(@jakarta.annotation.Nullable Integer code) { + this.code = code; + } + + public GetInvestmentDetailResponse msg(@jakarta.annotation.Nullable String msg) { + this.msg = msg; + return this; + } + + /** + * Human-readable status message. + * + * @return msg + */ + @jakarta.annotation.Nullable + public String getMsg() { + return msg; + } + + public void setMsg(@jakarta.annotation.Nullable String msg) { + this.msg = msg; + } + + public GetInvestmentDetailResponse data( + @jakarta.annotation.Nullable GetInvestmentDetailResponseData data) { + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @jakarta.annotation.Nullable + @Valid + public GetInvestmentDetailResponseData getData() { + return data; + } + + public void setData(@jakarta.annotation.Nullable GetInvestmentDetailResponseData data) { + this.data = data; + } + + public GetInvestmentDetailResponse timestamp(@jakarta.annotation.Nullable Long timestamp) { + this.timestamp = timestamp; + return this; + } + + /** + * Server timestamp in milliseconds. + * + * @return timestamp + */ + @jakarta.annotation.Nullable + public Long getTimestamp() { + return timestamp; + } + + public void setTimestamp(@jakarta.annotation.Nullable Long timestamp) { + this.timestamp = timestamp; + } + + public GetInvestmentDetailResponse success(@jakarta.annotation.Nullable Boolean success) { + this.success = success; + return this; + } + + /** + * Whether the request succeeded (mirrors `code == 0`). + * + * @return success + */ + @jakarta.annotation.Nullable + public Boolean getSuccess() { + return success; + } + + public void setSuccess(@jakarta.annotation.Nullable Boolean success) { + this.success = success; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetInvestmentDetailResponse getInvestmentDetailResponse = (GetInvestmentDetailResponse) o; + return Objects.equals(this.code, getInvestmentDetailResponse.code) + && Objects.equals(this.msg, getInvestmentDetailResponse.msg) + && Objects.equals(this.data, getInvestmentDetailResponse.data) + && Objects.equals(this.timestamp, getInvestmentDetailResponse.timestamp) + && Objects.equals(this.success, getInvestmentDetailResponse.success); + } + + @Override + public int hashCode() { + return Objects.hash(code, msg, data, timestamp, success); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetInvestmentDetailResponse {\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" msg: ").append(toIndentedString(msg)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" timestamp: ").append(toIndentedString(timestamp)).append("\n"); + sb.append(" success: ").append(toIndentedString(success)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object codeValue = getCode(); + String codeValueAsString = ""; + codeValueAsString = codeValue.toString(); + sb.append("code=").append(urlEncode(codeValueAsString)).append(""); + Object msgValue = getMsg(); + String msgValueAsString = ""; + msgValueAsString = msgValue.toString(); + sb.append("msg=").append(urlEncode(msgValueAsString)).append(""); + Object dataValue = getData(); + String dataValueAsString = ""; + dataValueAsString = dataValue.toString(); + sb.append("data=").append(urlEncode(dataValueAsString)).append(""); + Object timestampValue = getTimestamp(); + String timestampValueAsString = ""; + timestampValueAsString = timestampValue.toString(); + sb.append("timestamp=").append(urlEncode(timestampValueAsString)).append(""); + Object successValue = getSuccess(); + String successValueAsString = ""; + successValueAsString = successValue.toString(); + sb.append("success=").append(urlEncode(successValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("code"); + openapiFields.add("msg"); + openapiFields.add("data"); + openapiFields.add("timestamp"); + openapiFields.add("success"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetInvestmentDetailResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetInvestmentDetailResponse.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetInvestmentDetailResponse is not" + + " found in the empty JSON string", + GetInvestmentDetailResponse.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("msg") != null && !jsonObj.get("msg").isJsonNull()) + && !jsonObj.get("msg").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `msg` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("msg").toString())); + } + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + GetInvestmentDetailResponseData.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetInvestmentDetailResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetInvestmentDetailResponse' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(GetInvestmentDetailResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetInvestmentDetailResponse value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetInvestmentDetailResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetInvestmentDetailResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetInvestmentDetailResponse + * @throws IOException if the JSON string is invalid with respect to GetInvestmentDetailResponse + */ + public static GetInvestmentDetailResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetInvestmentDetailResponse.class); + } + + /** + * Convert an instance of GetInvestmentDetailResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetInvestmentDetailResponseData.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetInvestmentDetailResponseData.java new file mode 100644 index 0000000..cdfc37f --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetInvestmentDetailResponseData.java @@ -0,0 +1,1043 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; +import org.hibernate.validator.constraints.*; + +/** DeFi investment product detail. */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class GetInvestmentDetailResponseData { + public static final String SERIALIZED_NAME_BINANCE_CHAIN_ID = "binanceChainId"; + + @SerializedName(SERIALIZED_NAME_BINANCE_CHAIN_ID) + @jakarta.annotation.Nullable + private String binanceChainId; + + public static final String SERIALIZED_NAME_DEFI_PROTOCOL_ID = "defiProtocolId"; + + @SerializedName(SERIALIZED_NAME_DEFI_PROTOCOL_ID) + @jakarta.annotation.Nullable + private String defiProtocolId; + + public static final String SERIALIZED_NAME_PROTOCOL_NAME = "protocolName"; + + @SerializedName(SERIALIZED_NAME_PROTOCOL_NAME) + @jakarta.annotation.Nullable + private String protocolName; + + public static final String SERIALIZED_NAME_PROTOCOL_LOGO = "protocolLogo"; + + @SerializedName(SERIALIZED_NAME_PROTOCOL_LOGO) + @jakarta.annotation.Nullable + private String protocolLogo; + + public static final String SERIALIZED_NAME_INVESTMENT_ID = "investmentId"; + + @SerializedName(SERIALIZED_NAME_INVESTMENT_ID) + @jakarta.annotation.Nullable + private String investmentId; + + public static final String SERIALIZED_NAME_INVESTMENT_NAME = "investmentName"; + + @SerializedName(SERIALIZED_NAME_INVESTMENT_NAME) + @jakarta.annotation.Nullable + private String investmentName; + + public static final String SERIALIZED_NAME_INVEST_TYPE = "investType"; + + @SerializedName(SERIALIZED_NAME_INVEST_TYPE) + @jakarta.annotation.Nullable + private String investType; + + public static final String SERIALIZED_NAME_INVESTABLE = "investable"; + + @SerializedName(SERIALIZED_NAME_INVESTABLE) + @jakarta.annotation.Nullable + private Boolean investable; + + public static final String SERIALIZED_NAME_APY_BPS = "apyBps"; + + @SerializedName(SERIALIZED_NAME_APY_BPS) + @jakarta.annotation.Nullable + private Long apyBps; + + public static final String SERIALIZED_NAME_APY_DISPLAY = "apyDisplay"; + + @SerializedName(SERIALIZED_NAME_APY_DISPLAY) + @jakarta.annotation.Nullable + private String apyDisplay; + + public static final String SERIALIZED_NAME_APY_TYPE = "apyType"; + + @SerializedName(SERIALIZED_NAME_APY_TYPE) + @jakarta.annotation.Nullable + private String apyType; + + public static final String SERIALIZED_NAME_TVL = "tvl"; + + @SerializedName(SERIALIZED_NAME_TVL) + @jakarta.annotation.Nullable + private String tvl; + + public static final String SERIALIZED_NAME_POOL_ADDRESS = "poolAddress"; + + @SerializedName(SERIALIZED_NAME_POOL_ADDRESS) + @jakarta.annotation.Nullable + private String poolAddress; + + public static final String SERIALIZED_NAME_FEE_RATE = "feeRate"; + + @SerializedName(SERIALIZED_NAME_FEE_RATE) + @jakarta.annotation.Nullable + private String feeRate; + + public static final String SERIALIZED_NAME_ASSET_TOKEN_LIST = "assetTokenList"; + + @SerializedName(SERIALIZED_NAME_ASSET_TOKEN_LIST) + @jakarta.annotation.Nullable + private List<@Valid DefiInvestmentInfoDtoAssetTokenListInner> assetTokenList; + + public static final String SERIALIZED_NAME_REWARD_TOKEN_LIST = "rewardTokenList"; + + @SerializedName(SERIALIZED_NAME_REWARD_TOKEN_LIST) + @jakarta.annotation.Nullable + private List<@Valid DefiInvestmentInfoDtoAssetTokenListInner> rewardTokenList; + + public static final String SERIALIZED_NAME_LP_TOKEN_LIST = "lpTokenList"; + + @SerializedName(SERIALIZED_NAME_LP_TOKEN_LIST) + @jakarta.annotation.Nullable + private List<@Valid DefiInvestmentInfoDtoAssetTokenListInner> lpTokenList; + + public static final String SERIALIZED_NAME_BORROW_TOKEN_LIST = "borrowTokenList"; + + @SerializedName(SERIALIZED_NAME_BORROW_TOKEN_LIST) + @jakarta.annotation.Nullable + private List<@Valid DefiInvestmentInfoDtoAssetTokenListInner> borrowTokenList; + + public GetInvestmentDetailResponseData() {} + + public GetInvestmentDetailResponseData binanceChainId( + @jakarta.annotation.Nullable String binanceChainId) { + this.binanceChainId = binanceChainId; + return this; + } + + /** + * Binance chain ID. + * + * @return binanceChainId + */ + @jakarta.annotation.Nullable + public String getBinanceChainId() { + return binanceChainId; + } + + public void setBinanceChainId(@jakarta.annotation.Nullable String binanceChainId) { + this.binanceChainId = binanceChainId; + } + + public GetInvestmentDetailResponseData defiProtocolId( + @jakarta.annotation.Nullable String defiProtocolId) { + this.defiProtocolId = defiProtocolId; + return this; + } + + /** + * Parent DeFi protocol identifier. + * + * @return defiProtocolId + */ + @jakarta.annotation.Nullable + public String getDefiProtocolId() { + return defiProtocolId; + } + + public void setDefiProtocolId(@jakarta.annotation.Nullable String defiProtocolId) { + this.defiProtocolId = defiProtocolId; + } + + public GetInvestmentDetailResponseData protocolName( + @jakarta.annotation.Nullable String protocolName) { + this.protocolName = protocolName; + return this; + } + + /** + * Protocol display name. + * + * @return protocolName + */ + @jakarta.annotation.Nullable + public String getProtocolName() { + return protocolName; + } + + public void setProtocolName(@jakarta.annotation.Nullable String protocolName) { + this.protocolName = protocolName; + } + + public GetInvestmentDetailResponseData protocolLogo( + @jakarta.annotation.Nullable String protocolLogo) { + this.protocolLogo = protocolLogo; + return this; + } + + /** + * Protocol logo image URL (full URL; quote as-is). + * + * @return protocolLogo + */ + @jakarta.annotation.Nullable + public String getProtocolLogo() { + return protocolLogo; + } + + public void setProtocolLogo(@jakarta.annotation.Nullable String protocolLogo) { + this.protocolLogo = protocolLogo; + } + + public GetInvestmentDetailResponseData investmentId( + @jakarta.annotation.Nullable String investmentId) { + this.investmentId = investmentId; + return this; + } + + /** + * Investment product identifier (64-char hex, no `0x` prefix). Same format as the + * `investmentIds` returned by `POST /api/v1/defi/data/position/list` and + * accepted by the transaction build endpoints. + * + * @return investmentId + */ + @jakarta.annotation.Nullable + public String getInvestmentId() { + return investmentId; + } + + public void setInvestmentId(@jakarta.annotation.Nullable String investmentId) { + this.investmentId = investmentId; + } + + public GetInvestmentDetailResponseData investmentName( + @jakarta.annotation.Nullable String investmentName) { + this.investmentName = investmentName; + return this; + } + + /** + * Investment display name. + * + * @return investmentName + */ + @jakarta.annotation.Nullable + public String getInvestmentName() { + return investmentName; + } + + public void setInvestmentName(@jakarta.annotation.Nullable String investmentName) { + this.investmentName = investmentName; + } + + public GetInvestmentDetailResponseData investType( + @jakarta.annotation.Nullable String investType) { + this.investType = investType; + return this; + } + + /** + * Investment type of this product — a single string here (each product has exactly one). Note: + * the protocol-level investType (in protocol list/detail) is an array. Known values: Earn, + * LiquidityPool. + * + * @return investType + */ + @jakarta.annotation.Nullable + public String getInvestType() { + return investType; + } + + public void setInvestType(@jakarta.annotation.Nullable String investType) { + this.investType = investType; + } + + public GetInvestmentDetailResponseData investable( + @jakarta.annotation.Nullable Boolean investable) { + this.investable = investable; + return this; + } + + /** + * Whether this investment is currently investable. + * + * @return investable + */ + @jakarta.annotation.Nullable + public Boolean getInvestable() { + return investable; + } + + public void setInvestable(@jakarta.annotation.Nullable Boolean investable) { + this.investable = investable; + } + + public GetInvestmentDetailResponseData apyBps(@jakarta.annotation.Nullable Long apyBps) { + this.apyBps = apyBps; + return this; + } + + /** + * Annual percentage yield in basis points (1 bps = 0.01%). Integer value — use this for + * sorting / comparing / filtering, never the raw decimal. + * + * @return apyBps + */ + @jakarta.annotation.Nullable + public Long getApyBps() { + return apyBps; + } + + public void setApyBps(@jakarta.annotation.Nullable Long apyBps) { + this.apyBps = apyBps; + } + + public GetInvestmentDetailResponseData apyDisplay( + @jakarta.annotation.Nullable String apyDisplay) { + this.apyDisplay = apyDisplay; + return this; + } + + /** + * Pre-formatted, human-readable APY string for display (e.g. \"1,562.65%\"). Quote + * as-is; do not re-compute or transform. + * + * @return apyDisplay + */ + @jakarta.annotation.Nullable + public String getApyDisplay() { + return apyDisplay; + } + + public void setApyDisplay(@jakarta.annotation.Nullable String apyDisplay) { + this.apyDisplay = apyDisplay; + } + + public GetInvestmentDetailResponseData apyType(@jakarta.annotation.Nullable String apyType) { + this.apyType = apyType; + return this; + } + + /** + * Rate yield type. Known values: APY, APR. + * + * @return apyType + */ + @jakarta.annotation.Nullable + public String getApyType() { + return apyType; + } + + public void setApyType(@jakarta.annotation.Nullable String apyType) { + this.apyType = apyType; + } + + public GetInvestmentDetailResponseData tvl(@jakarta.annotation.Nullable String tvl) { + this.tvl = tvl; + return this; + } + + /** + * Total value locked (USD). String, raw precision from the data source. + * + * @return tvl + */ + @jakarta.annotation.Nullable + public String getTvl() { + return tvl; + } + + public void setTvl(@jakarta.annotation.Nullable String tvl) { + this.tvl = tvl; + } + + public GetInvestmentDetailResponseData poolAddress( + @jakarta.annotation.Nullable String poolAddress) { + this.poolAddress = poolAddress; + return this; + } + + /** + * Pool / strategy contract address. + * + * @return poolAddress + */ + @jakarta.annotation.Nullable + public String getPoolAddress() { + return poolAddress; + } + + public void setPoolAddress(@jakarta.annotation.Nullable String poolAddress) { + this.poolAddress = poolAddress; + } + + public GetInvestmentDetailResponseData feeRate(@jakarta.annotation.Nullable String feeRate) { + this.feeRate = feeRate; + return this; + } + + /** + * Fee rate string (e.g. \"0.001\" = 0.1%). + * + * @return feeRate + */ + @jakarta.annotation.Nullable + public String getFeeRate() { + return feeRate; + } + + public void setFeeRate(@jakarta.annotation.Nullable String feeRate) { + this.feeRate = feeRate; + } + + public GetInvestmentDetailResponseData assetTokenList( + @jakarta.annotation.Nullable + List<@Valid DefiInvestmentInfoDtoAssetTokenListInner> assetTokenList) { + this.assetTokenList = assetTokenList; + return this; + } + + public GetInvestmentDetailResponseData addAssetTokenListItem( + DefiInvestmentInfoDtoAssetTokenListInner assetTokenListItem) { + if (this.assetTokenList == null) { + this.assetTokenList = new ArrayList<>(); + } + this.assetTokenList.add(assetTokenListItem); + return this; + } + + /** + * Tokens to supply / deposit. + * + * @return assetTokenList + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid DefiInvestmentInfoDtoAssetTokenListInner> getAssetTokenList() { + return assetTokenList; + } + + public void setAssetTokenList( + @jakarta.annotation.Nullable + List<@Valid DefiInvestmentInfoDtoAssetTokenListInner> assetTokenList) { + this.assetTokenList = assetTokenList; + } + + public GetInvestmentDetailResponseData rewardTokenList( + @jakarta.annotation.Nullable + List<@Valid DefiInvestmentInfoDtoAssetTokenListInner> rewardTokenList) { + this.rewardTokenList = rewardTokenList; + return this; + } + + public GetInvestmentDetailResponseData addRewardTokenListItem( + DefiInvestmentInfoDtoAssetTokenListInner rewardTokenListItem) { + if (this.rewardTokenList == null) { + this.rewardTokenList = new ArrayList<>(); + } + this.rewardTokenList.add(rewardTokenListItem); + return this; + } + + /** + * Reward tokens. + * + * @return rewardTokenList + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid DefiInvestmentInfoDtoAssetTokenListInner> getRewardTokenList() { + return rewardTokenList; + } + + public void setRewardTokenList( + @jakarta.annotation.Nullable + List<@Valid DefiInvestmentInfoDtoAssetTokenListInner> rewardTokenList) { + this.rewardTokenList = rewardTokenList; + } + + public GetInvestmentDetailResponseData lpTokenList( + @jakarta.annotation.Nullable + List<@Valid DefiInvestmentInfoDtoAssetTokenListInner> lpTokenList) { + this.lpTokenList = lpTokenList; + return this; + } + + public GetInvestmentDetailResponseData addLpTokenListItem( + DefiInvestmentInfoDtoAssetTokenListInner lpTokenListItem) { + if (this.lpTokenList == null) { + this.lpTokenList = new ArrayList<>(); + } + this.lpTokenList.add(lpTokenListItem); + return this; + } + + /** + * LP tokens (for liquidity positions). + * + * @return lpTokenList + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid DefiInvestmentInfoDtoAssetTokenListInner> getLpTokenList() { + return lpTokenList; + } + + public void setLpTokenList( + @jakarta.annotation.Nullable + List<@Valid DefiInvestmentInfoDtoAssetTokenListInner> lpTokenList) { + this.lpTokenList = lpTokenList; + } + + public GetInvestmentDetailResponseData borrowTokenList( + @jakarta.annotation.Nullable + List<@Valid DefiInvestmentInfoDtoAssetTokenListInner> borrowTokenList) { + this.borrowTokenList = borrowTokenList; + return this; + } + + public GetInvestmentDetailResponseData addBorrowTokenListItem( + DefiInvestmentInfoDtoAssetTokenListInner borrowTokenListItem) { + if (this.borrowTokenList == null) { + this.borrowTokenList = new ArrayList<>(); + } + this.borrowTokenList.add(borrowTokenListItem); + return this; + } + + /** + * Borrow tokens (for lending borrow positions). + * + * @return borrowTokenList + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid DefiInvestmentInfoDtoAssetTokenListInner> getBorrowTokenList() { + return borrowTokenList; + } + + public void setBorrowTokenList( + @jakarta.annotation.Nullable + List<@Valid DefiInvestmentInfoDtoAssetTokenListInner> borrowTokenList) { + this.borrowTokenList = borrowTokenList; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetInvestmentDetailResponseData getInvestmentDetailResponseData = + (GetInvestmentDetailResponseData) o; + return Objects.equals(this.binanceChainId, getInvestmentDetailResponseData.binanceChainId) + && Objects.equals( + this.defiProtocolId, getInvestmentDetailResponseData.defiProtocolId) + && Objects.equals(this.protocolName, getInvestmentDetailResponseData.protocolName) + && Objects.equals(this.protocolLogo, getInvestmentDetailResponseData.protocolLogo) + && Objects.equals(this.investmentId, getInvestmentDetailResponseData.investmentId) + && Objects.equals( + this.investmentName, getInvestmentDetailResponseData.investmentName) + && Objects.equals(this.investType, getInvestmentDetailResponseData.investType) + && Objects.equals(this.investable, getInvestmentDetailResponseData.investable) + && Objects.equals(this.apyBps, getInvestmentDetailResponseData.apyBps) + && Objects.equals(this.apyDisplay, getInvestmentDetailResponseData.apyDisplay) + && Objects.equals(this.apyType, getInvestmentDetailResponseData.apyType) + && Objects.equals(this.tvl, getInvestmentDetailResponseData.tvl) + && Objects.equals(this.poolAddress, getInvestmentDetailResponseData.poolAddress) + && Objects.equals(this.feeRate, getInvestmentDetailResponseData.feeRate) + && Objects.equals( + this.assetTokenList, getInvestmentDetailResponseData.assetTokenList) + && Objects.equals( + this.rewardTokenList, getInvestmentDetailResponseData.rewardTokenList) + && Objects.equals(this.lpTokenList, getInvestmentDetailResponseData.lpTokenList) + && Objects.equals( + this.borrowTokenList, getInvestmentDetailResponseData.borrowTokenList); + } + + @Override + public int hashCode() { + return Objects.hash( + binanceChainId, + defiProtocolId, + protocolName, + protocolLogo, + investmentId, + investmentName, + investType, + investable, + apyBps, + apyDisplay, + apyType, + tvl, + poolAddress, + feeRate, + assetTokenList, + rewardTokenList, + lpTokenList, + borrowTokenList); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetInvestmentDetailResponseData {\n"); + sb.append(" binanceChainId: ").append(toIndentedString(binanceChainId)).append("\n"); + sb.append(" defiProtocolId: ").append(toIndentedString(defiProtocolId)).append("\n"); + sb.append(" protocolName: ").append(toIndentedString(protocolName)).append("\n"); + sb.append(" protocolLogo: ").append(toIndentedString(protocolLogo)).append("\n"); + sb.append(" investmentId: ").append(toIndentedString(investmentId)).append("\n"); + sb.append(" investmentName: ").append(toIndentedString(investmentName)).append("\n"); + sb.append(" investType: ").append(toIndentedString(investType)).append("\n"); + sb.append(" investable: ").append(toIndentedString(investable)).append("\n"); + sb.append(" apyBps: ").append(toIndentedString(apyBps)).append("\n"); + sb.append(" apyDisplay: ").append(toIndentedString(apyDisplay)).append("\n"); + sb.append(" apyType: ").append(toIndentedString(apyType)).append("\n"); + sb.append(" tvl: ").append(toIndentedString(tvl)).append("\n"); + sb.append(" poolAddress: ").append(toIndentedString(poolAddress)).append("\n"); + sb.append(" feeRate: ").append(toIndentedString(feeRate)).append("\n"); + sb.append(" assetTokenList: ").append(toIndentedString(assetTokenList)).append("\n"); + sb.append(" rewardTokenList: ").append(toIndentedString(rewardTokenList)).append("\n"); + sb.append(" lpTokenList: ").append(toIndentedString(lpTokenList)).append("\n"); + sb.append(" borrowTokenList: ").append(toIndentedString(borrowTokenList)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object binanceChainIdValue = getBinanceChainId(); + String binanceChainIdValueAsString = ""; + binanceChainIdValueAsString = binanceChainIdValue.toString(); + sb.append("binanceChainId=").append(urlEncode(binanceChainIdValueAsString)).append(""); + Object defiProtocolIdValue = getDefiProtocolId(); + String defiProtocolIdValueAsString = ""; + defiProtocolIdValueAsString = defiProtocolIdValue.toString(); + sb.append("defiProtocolId=").append(urlEncode(defiProtocolIdValueAsString)).append(""); + Object protocolNameValue = getProtocolName(); + String protocolNameValueAsString = ""; + protocolNameValueAsString = protocolNameValue.toString(); + sb.append("protocolName=").append(urlEncode(protocolNameValueAsString)).append(""); + Object protocolLogoValue = getProtocolLogo(); + String protocolLogoValueAsString = ""; + protocolLogoValueAsString = protocolLogoValue.toString(); + sb.append("protocolLogo=").append(urlEncode(protocolLogoValueAsString)).append(""); + Object investmentIdValue = getInvestmentId(); + String investmentIdValueAsString = ""; + investmentIdValueAsString = investmentIdValue.toString(); + sb.append("investmentId=").append(urlEncode(investmentIdValueAsString)).append(""); + Object investmentNameValue = getInvestmentName(); + String investmentNameValueAsString = ""; + investmentNameValueAsString = investmentNameValue.toString(); + sb.append("investmentName=").append(urlEncode(investmentNameValueAsString)).append(""); + Object investTypeValue = getInvestType(); + String investTypeValueAsString = ""; + investTypeValueAsString = investTypeValue.toString(); + sb.append("investType=").append(urlEncode(investTypeValueAsString)).append(""); + Object investableValue = getInvestable(); + String investableValueAsString = ""; + investableValueAsString = investableValue.toString(); + sb.append("investable=").append(urlEncode(investableValueAsString)).append(""); + Object apyBpsValue = getApyBps(); + String apyBpsValueAsString = ""; + apyBpsValueAsString = apyBpsValue.toString(); + sb.append("apyBps=").append(urlEncode(apyBpsValueAsString)).append(""); + Object apyDisplayValue = getApyDisplay(); + String apyDisplayValueAsString = ""; + apyDisplayValueAsString = apyDisplayValue.toString(); + sb.append("apyDisplay=").append(urlEncode(apyDisplayValueAsString)).append(""); + Object apyTypeValue = getApyType(); + String apyTypeValueAsString = ""; + apyTypeValueAsString = apyTypeValue.toString(); + sb.append("apyType=").append(urlEncode(apyTypeValueAsString)).append(""); + Object tvlValue = getTvl(); + String tvlValueAsString = ""; + tvlValueAsString = tvlValue.toString(); + sb.append("tvl=").append(urlEncode(tvlValueAsString)).append(""); + Object poolAddressValue = getPoolAddress(); + String poolAddressValueAsString = ""; + poolAddressValueAsString = poolAddressValue.toString(); + sb.append("poolAddress=").append(urlEncode(poolAddressValueAsString)).append(""); + Object feeRateValue = getFeeRate(); + String feeRateValueAsString = ""; + feeRateValueAsString = feeRateValue.toString(); + sb.append("feeRate=").append(urlEncode(feeRateValueAsString)).append(""); + Object assetTokenListValue = getAssetTokenList(); + String assetTokenListValueAsString = ""; + assetTokenListValueAsString = + (String) + ((Collection) assetTokenListValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("assetTokenList=").append(urlEncode(assetTokenListValueAsString)).append(""); + Object rewardTokenListValue = getRewardTokenList(); + String rewardTokenListValueAsString = ""; + rewardTokenListValueAsString = + (String) + ((Collection) rewardTokenListValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("rewardTokenList=").append(urlEncode(rewardTokenListValueAsString)).append(""); + Object lpTokenListValue = getLpTokenList(); + String lpTokenListValueAsString = ""; + lpTokenListValueAsString = + (String) + ((Collection) lpTokenListValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("lpTokenList=").append(urlEncode(lpTokenListValueAsString)).append(""); + Object borrowTokenListValue = getBorrowTokenList(); + String borrowTokenListValueAsString = ""; + borrowTokenListValueAsString = + (String) + ((Collection) borrowTokenListValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("borrowTokenList=").append(urlEncode(borrowTokenListValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("binanceChainId"); + openapiFields.add("defiProtocolId"); + openapiFields.add("protocolName"); + openapiFields.add("protocolLogo"); + openapiFields.add("investmentId"); + openapiFields.add("investmentName"); + openapiFields.add("investType"); + openapiFields.add("investable"); + openapiFields.add("apyBps"); + openapiFields.add("apyDisplay"); + openapiFields.add("apyType"); + openapiFields.add("tvl"); + openapiFields.add("poolAddress"); + openapiFields.add("feeRate"); + openapiFields.add("assetTokenList"); + openapiFields.add("rewardTokenList"); + openapiFields.add("lpTokenList"); + openapiFields.add("borrowTokenList"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetInvestmentDetailResponseData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetInvestmentDetailResponseData.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetInvestmentDetailResponseData is not" + + " found in the empty JSON string", + GetInvestmentDetailResponseData.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("binanceChainId") != null && !jsonObj.get("binanceChainId").isJsonNull()) + && !jsonObj.get("binanceChainId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `binanceChainId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("binanceChainId").toString())); + } + if ((jsonObj.get("defiProtocolId") != null && !jsonObj.get("defiProtocolId").isJsonNull()) + && !jsonObj.get("defiProtocolId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `defiProtocolId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("defiProtocolId").toString())); + } + if ((jsonObj.get("protocolName") != null && !jsonObj.get("protocolName").isJsonNull()) + && !jsonObj.get("protocolName").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `protocolName` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("protocolName").toString())); + } + if ((jsonObj.get("protocolLogo") != null && !jsonObj.get("protocolLogo").isJsonNull()) + && !jsonObj.get("protocolLogo").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `protocolLogo` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("protocolLogo").toString())); + } + if ((jsonObj.get("investmentId") != null && !jsonObj.get("investmentId").isJsonNull()) + && !jsonObj.get("investmentId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `investmentId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("investmentId").toString())); + } + if ((jsonObj.get("investmentName") != null && !jsonObj.get("investmentName").isJsonNull()) + && !jsonObj.get("investmentName").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `investmentName` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("investmentName").toString())); + } + if ((jsonObj.get("investType") != null && !jsonObj.get("investType").isJsonNull()) + && !jsonObj.get("investType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `investType` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("investType").toString())); + } + if ((jsonObj.get("apyDisplay") != null && !jsonObj.get("apyDisplay").isJsonNull()) + && !jsonObj.get("apyDisplay").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `apyDisplay` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("apyDisplay").toString())); + } + if ((jsonObj.get("apyType") != null && !jsonObj.get("apyType").isJsonNull()) + && !jsonObj.get("apyType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `apyType` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("apyType").toString())); + } + if ((jsonObj.get("tvl") != null && !jsonObj.get("tvl").isJsonNull()) + && !jsonObj.get("tvl").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `tvl` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("tvl").toString())); + } + if ((jsonObj.get("poolAddress") != null && !jsonObj.get("poolAddress").isJsonNull()) + && !jsonObj.get("poolAddress").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `poolAddress` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("poolAddress").toString())); + } + if ((jsonObj.get("feeRate") != null && !jsonObj.get("feeRate").isJsonNull()) + && !jsonObj.get("feeRate").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `feeRate` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("feeRate").toString())); + } + if (jsonObj.get("assetTokenList") != null && !jsonObj.get("assetTokenList").isJsonNull()) { + JsonArray jsonArrayassetTokenList = jsonObj.getAsJsonArray("assetTokenList"); + if (jsonArrayassetTokenList != null) { + // ensure the json data is an array + if (!jsonObj.get("assetTokenList").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `assetTokenList` to be an array in the JSON" + + " string but got `%s`", + jsonObj.get("assetTokenList").toString())); + } + + // validate the optional field `assetTokenList` (array) + for (int i = 0; i < jsonArrayassetTokenList.size(); i++) { + DefiInvestmentInfoDtoAssetTokenListInner.validateJsonElement( + jsonArrayassetTokenList.get(i)); + } + ; + } + } + if (jsonObj.get("rewardTokenList") != null + && !jsonObj.get("rewardTokenList").isJsonNull()) { + JsonArray jsonArrayrewardTokenList = jsonObj.getAsJsonArray("rewardTokenList"); + if (jsonArrayrewardTokenList != null) { + // ensure the json data is an array + if (!jsonObj.get("rewardTokenList").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `rewardTokenList` to be an array in the" + + " JSON string but got `%s`", + jsonObj.get("rewardTokenList").toString())); + } + + // validate the optional field `rewardTokenList` (array) + for (int i = 0; i < jsonArrayrewardTokenList.size(); i++) { + DefiInvestmentInfoDtoAssetTokenListInner.validateJsonElement( + jsonArrayrewardTokenList.get(i)); + } + ; + } + } + if (jsonObj.get("lpTokenList") != null && !jsonObj.get("lpTokenList").isJsonNull()) { + JsonArray jsonArraylpTokenList = jsonObj.getAsJsonArray("lpTokenList"); + if (jsonArraylpTokenList != null) { + // ensure the json data is an array + if (!jsonObj.get("lpTokenList").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `lpTokenList` to be an array in the JSON" + + " string but got `%s`", + jsonObj.get("lpTokenList").toString())); + } + + // validate the optional field `lpTokenList` (array) + for (int i = 0; i < jsonArraylpTokenList.size(); i++) { + DefiInvestmentInfoDtoAssetTokenListInner.validateJsonElement( + jsonArraylpTokenList.get(i)); + } + ; + } + } + if (jsonObj.get("borrowTokenList") != null + && !jsonObj.get("borrowTokenList").isJsonNull()) { + JsonArray jsonArrayborrowTokenList = jsonObj.getAsJsonArray("borrowTokenList"); + if (jsonArrayborrowTokenList != null) { + // ensure the json data is an array + if (!jsonObj.get("borrowTokenList").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `borrowTokenList` to be an array in the" + + " JSON string but got `%s`", + jsonObj.get("borrowTokenList").toString())); + } + + // validate the optional field `borrowTokenList` (array) + for (int i = 0; i < jsonArrayborrowTokenList.size(); i++) { + DefiInvestmentInfoDtoAssetTokenListInner.validateJsonElement( + jsonArrayborrowTokenList.get(i)); + } + ; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetInvestmentDetailResponseData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetInvestmentDetailResponseData' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(GetInvestmentDetailResponseData.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetInvestmentDetailResponseData value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetInvestmentDetailResponseData read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetInvestmentDetailResponseData given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetInvestmentDetailResponseData + * @throws IOException if the JSON string is invalid with respect to + * GetInvestmentDetailResponseData + */ + public static GetInvestmentDetailResponseData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetInvestmentDetailResponseData.class); + } + + /** + * Convert an instance of GetInvestmentDetailResponseData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetLatestBlockHeightResponse.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetLatestBlockHeightResponse.java index 09472cc..01cd180 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetLatestBlockHeightResponse.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetLatestBlockHeightResponse.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetLatestBlockHeightResponseData.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetLatestBlockHeightResponseData.java index acc6b03..c8ccfdb 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetLatestBlockHeightResponseData.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetLatestBlockHeightResponseData.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetLeaderboardResponse.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetLeaderboardResponse.java index ab68584..661f09a 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetLeaderboardResponse.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetLeaderboardResponse.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetLeaderboardResponseData.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetLeaderboardResponseData.java index 0b0a3a3..c42dcab 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetLeaderboardResponseData.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetLeaderboardResponseData.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetLeaderboardResponseDataItemsInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetLeaderboardResponseDataItemsInner.java index 59fa15f..cee1877 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetLeaderboardResponseDataItemsInner.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetLeaderboardResponseDataItemsInner.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetLeaderboardResponseDataItemsInnerDailyPnlInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetLeaderboardResponseDataItemsInnerDailyPnlInner.java index 061b8c4..c5dd7c6 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetLeaderboardResponseDataItemsInnerDailyPnlInner.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetLeaderboardResponseDataItemsInnerDailyPnlInner.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetLeaderboardResponseDataItemsInnerTokenCountByPnlPercent.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetLeaderboardResponseDataItemsInnerTokenCountByPnlPercent.java index b6278c8..b0c61bf 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetLeaderboardResponseDataItemsInnerTokenCountByPnlPercent.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetLeaderboardResponseDataItemsInnerTokenCountByPnlPercent.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetLeaderboardResponseDataItemsInnerTopPnlTokenListInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetLeaderboardResponseDataItemsInnerTopPnlTokenListInner.java index ea1f739..82635fb 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetLeaderboardResponseDataItemsInnerTopPnlTokenListInner.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetLeaderboardResponseDataItemsInnerTopPnlTokenListInner.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetPortfolioSupportedChainsResponse.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetPortfolioSupportedChainsResponse.java index ff09cbf..a6a7dca 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetPortfolioSupportedChainsResponse.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetPortfolioSupportedChainsResponse.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetPortfolioSupportedChainsResponseDataInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetPortfolioSupportedChainsResponseDataInner.java index a83936f..306363c 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetPortfolioSupportedChainsResponseDataInner.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetPortfolioSupportedChainsResponseDataInner.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetProtocolDetailRequest.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetProtocolDetailRequest.java new file mode 100644 index 0000000..a3b0cd5 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetProtocolDetailRequest.java @@ -0,0 +1,223 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** GetProtocolDetailRequest */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class GetProtocolDetailRequest { + public static final String SERIALIZED_NAME_DEFI_PROTOCOL_ID = "defiProtocolId"; + + @SerializedName(SERIALIZED_NAME_DEFI_PROTOCOL_ID) + @jakarta.annotation.Nonnull + private String defiProtocolId; + + public GetProtocolDetailRequest() {} + + public GetProtocolDetailRequest defiProtocolId( + @jakarta.annotation.Nonnull String defiProtocolId) { + this.defiProtocolId = defiProtocolId; + return this; + } + + /** + * DeFi protocol identifier. + * + * @return defiProtocolId + */ + @jakarta.annotation.Nonnull + @NotNull + public String getDefiProtocolId() { + return defiProtocolId; + } + + public void setDefiProtocolId(@jakarta.annotation.Nonnull String defiProtocolId) { + this.defiProtocolId = defiProtocolId; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetProtocolDetailRequest getProtocolDetailRequest = (GetProtocolDetailRequest) o; + return Objects.equals(this.defiProtocolId, getProtocolDetailRequest.defiProtocolId); + } + + @Override + public int hashCode() { + return Objects.hash(defiProtocolId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetProtocolDetailRequest {\n"); + sb.append(" defiProtocolId: ").append(toIndentedString(defiProtocolId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object defiProtocolIdValue = getDefiProtocolId(); + String defiProtocolIdValueAsString = ""; + defiProtocolIdValueAsString = defiProtocolIdValue.toString(); + sb.append("defiProtocolId=").append(urlEncode(defiProtocolIdValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("defiProtocolId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("defiProtocolId"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to GetProtocolDetailRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetProtocolDetailRequest.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetProtocolDetailRequest is not found" + + " in the empty JSON string", + GetProtocolDetailRequest.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GetProtocolDetailRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("defiProtocolId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `defiProtocolId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("defiProtocolId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetProtocolDetailRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetProtocolDetailRequest' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(GetProtocolDetailRequest.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetProtocolDetailRequest value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetProtocolDetailRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetProtocolDetailRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetProtocolDetailRequest + * @throws IOException if the JSON string is invalid with respect to GetProtocolDetailRequest + */ + public static GetProtocolDetailRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetProtocolDetailRequest.class); + } + + /** + * Convert an instance of GetProtocolDetailRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetProtocolDetailResponse.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetProtocolDetailResponse.java new file mode 100644 index 0000000..09faa63 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetProtocolDetailResponse.java @@ -0,0 +1,346 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** GetProtocolDetailResponse */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class GetProtocolDetailResponse { + public static final String SERIALIZED_NAME_CODE = "code"; + + @SerializedName(SERIALIZED_NAME_CODE) + @jakarta.annotation.Nullable + private Integer code; + + public static final String SERIALIZED_NAME_MSG = "msg"; + + @SerializedName(SERIALIZED_NAME_MSG) + @jakarta.annotation.Nullable + private String msg; + + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + @jakarta.annotation.Nullable + private GetProtocolDetailResponseData data; + + public static final String SERIALIZED_NAME_TIMESTAMP = "timestamp"; + + @SerializedName(SERIALIZED_NAME_TIMESTAMP) + @jakarta.annotation.Nullable + private Long timestamp; + + public static final String SERIALIZED_NAME_SUCCESS = "success"; + + @SerializedName(SERIALIZED_NAME_SUCCESS) + @jakarta.annotation.Nullable + private Boolean success; + + public GetProtocolDetailResponse() {} + + public GetProtocolDetailResponse code(@jakarta.annotation.Nullable Integer code) { + this.code = code; + return this; + } + + /** + * Business status code. 0 indicates success. + * + * @return code + */ + @jakarta.annotation.Nullable + public Integer getCode() { + return code; + } + + public void setCode(@jakarta.annotation.Nullable Integer code) { + this.code = code; + } + + public GetProtocolDetailResponse msg(@jakarta.annotation.Nullable String msg) { + this.msg = msg; + return this; + } + + /** + * Human-readable status message. + * + * @return msg + */ + @jakarta.annotation.Nullable + public String getMsg() { + return msg; + } + + public void setMsg(@jakarta.annotation.Nullable String msg) { + this.msg = msg; + } + + public GetProtocolDetailResponse data( + @jakarta.annotation.Nullable GetProtocolDetailResponseData data) { + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @jakarta.annotation.Nullable + @Valid + public GetProtocolDetailResponseData getData() { + return data; + } + + public void setData(@jakarta.annotation.Nullable GetProtocolDetailResponseData data) { + this.data = data; + } + + public GetProtocolDetailResponse timestamp(@jakarta.annotation.Nullable Long timestamp) { + this.timestamp = timestamp; + return this; + } + + /** + * Server timestamp in milliseconds. + * + * @return timestamp + */ + @jakarta.annotation.Nullable + public Long getTimestamp() { + return timestamp; + } + + public void setTimestamp(@jakarta.annotation.Nullable Long timestamp) { + this.timestamp = timestamp; + } + + public GetProtocolDetailResponse success(@jakarta.annotation.Nullable Boolean success) { + this.success = success; + return this; + } + + /** + * Whether the request succeeded (mirrors `code == 0`). + * + * @return success + */ + @jakarta.annotation.Nullable + public Boolean getSuccess() { + return success; + } + + public void setSuccess(@jakarta.annotation.Nullable Boolean success) { + this.success = success; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetProtocolDetailResponse getProtocolDetailResponse = (GetProtocolDetailResponse) o; + return Objects.equals(this.code, getProtocolDetailResponse.code) + && Objects.equals(this.msg, getProtocolDetailResponse.msg) + && Objects.equals(this.data, getProtocolDetailResponse.data) + && Objects.equals(this.timestamp, getProtocolDetailResponse.timestamp) + && Objects.equals(this.success, getProtocolDetailResponse.success); + } + + @Override + public int hashCode() { + return Objects.hash(code, msg, data, timestamp, success); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetProtocolDetailResponse {\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" msg: ").append(toIndentedString(msg)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" timestamp: ").append(toIndentedString(timestamp)).append("\n"); + sb.append(" success: ").append(toIndentedString(success)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object codeValue = getCode(); + String codeValueAsString = ""; + codeValueAsString = codeValue.toString(); + sb.append("code=").append(urlEncode(codeValueAsString)).append(""); + Object msgValue = getMsg(); + String msgValueAsString = ""; + msgValueAsString = msgValue.toString(); + sb.append("msg=").append(urlEncode(msgValueAsString)).append(""); + Object dataValue = getData(); + String dataValueAsString = ""; + dataValueAsString = dataValue.toString(); + sb.append("data=").append(urlEncode(dataValueAsString)).append(""); + Object timestampValue = getTimestamp(); + String timestampValueAsString = ""; + timestampValueAsString = timestampValue.toString(); + sb.append("timestamp=").append(urlEncode(timestampValueAsString)).append(""); + Object successValue = getSuccess(); + String successValueAsString = ""; + successValueAsString = successValue.toString(); + sb.append("success=").append(urlEncode(successValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("code"); + openapiFields.add("msg"); + openapiFields.add("data"); + openapiFields.add("timestamp"); + openapiFields.add("success"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to GetProtocolDetailResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetProtocolDetailResponse.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetProtocolDetailResponse is not found" + + " in the empty JSON string", + GetProtocolDetailResponse.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("msg") != null && !jsonObj.get("msg").isJsonNull()) + && !jsonObj.get("msg").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `msg` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("msg").toString())); + } + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + GetProtocolDetailResponseData.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetProtocolDetailResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetProtocolDetailResponse' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(GetProtocolDetailResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetProtocolDetailResponse value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetProtocolDetailResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetProtocolDetailResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetProtocolDetailResponse + * @throws IOException if the JSON string is invalid with respect to GetProtocolDetailResponse + */ + public static GetProtocolDetailResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetProtocolDetailResponse.class); + } + + /** + * Convert an instance of GetProtocolDetailResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetProtocolDetailResponseData.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetProtocolDetailResponseData.java new file mode 100644 index 0000000..c522583 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetProtocolDetailResponseData.java @@ -0,0 +1,1126 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** DeFi protocol detail. */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class GetProtocolDetailResponseData { + public static final String SERIALIZED_NAME_DEFI_PROTOCOL_ID = "defiProtocolId"; + + @SerializedName(SERIALIZED_NAME_DEFI_PROTOCOL_ID) + @jakarta.annotation.Nullable + private String defiProtocolId; + + public static final String SERIALIZED_NAME_PROTOCOL_NAME = "protocolName"; + + @SerializedName(SERIALIZED_NAME_PROTOCOL_NAME) + @jakarta.annotation.Nullable + private String protocolName; + + public static final String SERIALIZED_NAME_PROTOCOL_LOGO = "protocolLogo"; + + @SerializedName(SERIALIZED_NAME_PROTOCOL_LOGO) + @jakarta.annotation.Nullable + private String protocolLogo; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @jakarta.annotation.Nullable + private String description; + + public static final String SERIALIZED_NAME_WEBSITE_URL = "websiteUrl"; + + @SerializedName(SERIALIZED_NAME_WEBSITE_URL) + @jakarta.annotation.Nullable + private String websiteUrl; + + public static final String SERIALIZED_NAME_INVEST_TYPE = "investType"; + + @SerializedName(SERIALIZED_NAME_INVEST_TYPE) + @jakarta.annotation.Nullable + private List investType; + + public static final String SERIALIZED_NAME_SUPPORTED_CHAINS = "supportedChains"; + + @SerializedName(SERIALIZED_NAME_SUPPORTED_CHAINS) + @jakarta.annotation.Nullable + private List supportedChains; + + public static final String SERIALIZED_NAME_TVL = "tvl"; + + @SerializedName(SERIALIZED_NAME_TVL) + @jakarta.annotation.Nullable + private String tvl; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + + @SerializedName(SERIALIZED_NAME_TAGS) + @jakarta.annotation.Nullable + private List tags; + + public static final String SERIALIZED_NAME_FOUNDED = "founded"; + + @SerializedName(SERIALIZED_NAME_FOUNDED) + @jakarta.annotation.Nullable + private String founded; + + public static final String SERIALIZED_NAME_FDV = "fdv"; + + @SerializedName(SERIALIZED_NAME_FDV) + @jakarta.annotation.Nullable + private String fdv; + + public static final String SERIALIZED_NAME_TOTAL_FUNDING = "totalFunding"; + + @SerializedName(SERIALIZED_NAME_TOTAL_FUNDING) + @jakarta.annotation.Nullable + private String totalFunding; + + public static final String SERIALIZED_NAME_SOCIAL_LINKS = "socialLinks"; + + @SerializedName(SERIALIZED_NAME_SOCIAL_LINKS) + @jakarta.annotation.Nullable + private GetProtocolDetailResponseDataSocialLinks socialLinks; + + public static final String SERIALIZED_NAME_TEAM = "team"; + + @SerializedName(SERIALIZED_NAME_TEAM) + @jakarta.annotation.Nullable + private List<@Valid DefiProtocolInfoDtoTeamInner> team; + + public static final String SERIALIZED_NAME_FUND_RAISING = "fundRaising"; + + @SerializedName(SERIALIZED_NAME_FUND_RAISING) + @jakarta.annotation.Nullable + private List<@Valid DefiProtocolInfoDtoFundRaisingInner> fundRaising; + + public static final String SERIALIZED_NAME_SECURITY_SCORE = "securityScore"; + + @SerializedName(SERIALIZED_NAME_SECURITY_SCORE) + @jakarta.annotation.Nullable + private String securityScore; + + public static final String SERIALIZED_NAME_DIMENSION_SCORES = "dimensionScores"; + + @SerializedName(SERIALIZED_NAME_DIMENSION_SCORES) + @jakarta.annotation.Nullable + private GetProtocolDetailResponseDataDimensionScores dimensionScores; + + public static final String SERIALIZED_NAME_HIGHLIGHTS = "highlights"; + + @SerializedName(SERIALIZED_NAME_HIGHLIGHTS) + @jakarta.annotation.Nullable + private List highlights; + + public static final String SERIALIZED_NAME_FAQ = "faq"; + + @SerializedName(SERIALIZED_NAME_FAQ) + @jakarta.annotation.Nullable + private List<@Valid DefiProtocolInfoDtoFaqInner> faq; + + public GetProtocolDetailResponseData() {} + + public GetProtocolDetailResponseData defiProtocolId( + @jakarta.annotation.Nullable String defiProtocolId) { + this.defiProtocolId = defiProtocolId; + return this; + } + + /** + * DeFi protocol identifier. + * + * @return defiProtocolId + */ + @jakarta.annotation.Nullable + public String getDefiProtocolId() { + return defiProtocolId; + } + + public void setDefiProtocolId(@jakarta.annotation.Nullable String defiProtocolId) { + this.defiProtocolId = defiProtocolId; + } + + public GetProtocolDetailResponseData protocolName( + @jakarta.annotation.Nullable String protocolName) { + this.protocolName = protocolName; + return this; + } + + /** + * Protocol display name. + * + * @return protocolName + */ + @jakarta.annotation.Nullable + public String getProtocolName() { + return protocolName; + } + + public void setProtocolName(@jakarta.annotation.Nullable String protocolName) { + this.protocolName = protocolName; + } + + public GetProtocolDetailResponseData protocolLogo( + @jakarta.annotation.Nullable String protocolLogo) { + this.protocolLogo = protocolLogo; + return this; + } + + /** + * Protocol logo image URL (full URL under `https://bin.bnbstatic.com`). + * + * @return protocolLogo + */ + @jakarta.annotation.Nullable + public String getProtocolLogo() { + return protocolLogo; + } + + public void setProtocolLogo(@jakarta.annotation.Nullable String protocolLogo) { + this.protocolLogo = protocolLogo; + } + + public GetProtocolDetailResponseData description( + @jakarta.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Protocol description (already translated; quote as-is). + * + * @return description + */ + @jakarta.annotation.Nullable + public String getDescription() { + return description; + } + + public void setDescription(@jakarta.annotation.Nullable String description) { + this.description = description; + } + + public GetProtocolDetailResponseData websiteUrl( + @jakarta.annotation.Nullable String websiteUrl) { + this.websiteUrl = websiteUrl; + return this; + } + + /** + * Official website URL. + * + * @return websiteUrl + */ + @jakarta.annotation.Nullable + public String getWebsiteUrl() { + return websiteUrl; + } + + public void setWebsiteUrl(@jakarta.annotation.Nullable String websiteUrl) { + this.websiteUrl = websiteUrl; + } + + public GetProtocolDetailResponseData investType( + @jakarta.annotation.Nullable List investType) { + this.investType = investType; + return this; + } + + public GetProtocolDetailResponseData addInvestTypeItem(String investTypeItem) { + if (this.investType == null) { + this.investType = new ArrayList<>(); + } + this.investType.add(investTypeItem); + return this; + } + + /** + * Investment types supported by this protocol — an array here (a protocol may support several). + * Note: the investment-level investType (in investment list/detail) is a single string. Known + * values: Earn, LiquidityPool. + * + * @return investType + */ + @jakarta.annotation.Nullable + public List getInvestType() { + return investType; + } + + public void setInvestType(@jakarta.annotation.Nullable List investType) { + this.investType = investType; + } + + public GetProtocolDetailResponseData supportedChains( + @jakarta.annotation.Nullable List supportedChains) { + this.supportedChains = supportedChains; + return this; + } + + public GetProtocolDetailResponseData addSupportedChainsItem(String supportedChainsItem) { + if (this.supportedChains == null) { + this.supportedChains = new ArrayList<>(); + } + this.supportedChains.add(supportedChainsItem); + return this; + } + + /** + * Supported Binance chain IDs. + * + * @return supportedChains + */ + @jakarta.annotation.Nullable + public List getSupportedChains() { + return supportedChains; + } + + public void setSupportedChains(@jakarta.annotation.Nullable List supportedChains) { + this.supportedChains = supportedChains; + } + + public GetProtocolDetailResponseData tvl(@jakarta.annotation.Nullable String tvl) { + this.tvl = tvl; + return this; + } + + /** + * Total value locked (USD). String, raw precision from the data source. + * + * @return tvl + */ + @jakarta.annotation.Nullable + public String getTvl() { + return tvl; + } + + public void setTvl(@jakarta.annotation.Nullable String tvl) { + this.tvl = tvl; + } + + public GetProtocolDetailResponseData tags(@jakarta.annotation.Nullable List tags) { + this.tags = tags; + return this; + } + + public GetProtocolDetailResponseData addTagsItem(String tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList<>(); + } + this.tags.add(tagsItem); + return this; + } + + /** + * Protocol tags / categories. + * + * @return tags + */ + @jakarta.annotation.Nullable + public List getTags() { + return tags; + } + + public void setTags(@jakarta.annotation.Nullable List tags) { + this.tags = tags; + } + + public GetProtocolDetailResponseData founded(@jakarta.annotation.Nullable String founded) { + this.founded = founded; + return this; + } + + /** + * Founding year (YYYY). + * + * @return founded + */ + @jakarta.annotation.Nullable + public String getFounded() { + return founded; + } + + public void setFounded(@jakarta.annotation.Nullable String founded) { + this.founded = founded; + } + + public GetProtocolDetailResponseData fdv(@jakarta.annotation.Nullable String fdv) { + this.fdv = fdv; + return this; + } + + /** + * Fully diluted valuation. + * + * @return fdv + */ + @jakarta.annotation.Nullable + public String getFdv() { + return fdv; + } + + public void setFdv(@jakarta.annotation.Nullable String fdv) { + this.fdv = fdv; + } + + public GetProtocolDetailResponseData totalFunding( + @jakarta.annotation.Nullable String totalFunding) { + this.totalFunding = totalFunding; + return this; + } + + /** + * Total funding raised. Null when not disclosed. + * + * @return totalFunding + */ + @jakarta.annotation.Nullable + public String getTotalFunding() { + return totalFunding; + } + + public void setTotalFunding(@jakarta.annotation.Nullable String totalFunding) { + this.totalFunding = totalFunding; + } + + public GetProtocolDetailResponseData socialLinks( + @jakarta.annotation.Nullable GetProtocolDetailResponseDataSocialLinks socialLinks) { + this.socialLinks = socialLinks; + return this; + } + + /** + * Get socialLinks + * + * @return socialLinks + */ + @jakarta.annotation.Nullable + @Valid + public GetProtocolDetailResponseDataSocialLinks getSocialLinks() { + return socialLinks; + } + + public void setSocialLinks( + @jakarta.annotation.Nullable GetProtocolDetailResponseDataSocialLinks socialLinks) { + this.socialLinks = socialLinks; + } + + public GetProtocolDetailResponseData team( + @jakarta.annotation.Nullable List<@Valid DefiProtocolInfoDtoTeamInner> team) { + this.team = team; + return this; + } + + public GetProtocolDetailResponseData addTeamItem(DefiProtocolInfoDtoTeamInner teamItem) { + if (this.team == null) { + this.team = new ArrayList<>(); + } + this.team.add(teamItem); + return this; + } + + /** + * Team members. + * + * @return team + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid DefiProtocolInfoDtoTeamInner> getTeam() { + return team; + } + + public void setTeam( + @jakarta.annotation.Nullable List<@Valid DefiProtocolInfoDtoTeamInner> team) { + this.team = team; + } + + public GetProtocolDetailResponseData fundRaising( + @jakarta.annotation.Nullable + List<@Valid DefiProtocolInfoDtoFundRaisingInner> fundRaising) { + this.fundRaising = fundRaising; + return this; + } + + public GetProtocolDetailResponseData addFundRaisingItem( + DefiProtocolInfoDtoFundRaisingInner fundRaisingItem) { + if (this.fundRaising == null) { + this.fundRaising = new ArrayList<>(); + } + this.fundRaising.add(fundRaisingItem); + return this; + } + + /** + * Fundraising history. + * + * @return fundRaising + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid DefiProtocolInfoDtoFundRaisingInner> getFundRaising() { + return fundRaising; + } + + public void setFundRaising( + @jakarta.annotation.Nullable + List<@Valid DefiProtocolInfoDtoFundRaisingInner> fundRaising) { + this.fundRaising = fundRaising; + } + + public GetProtocolDetailResponseData securityScore( + @jakarta.annotation.Nullable String securityScore) { + this.securityScore = securityScore; + return this; + } + + /** + * Overall CertiK security score. + * + * @return securityScore + */ + @jakarta.annotation.Nullable + public String getSecurityScore() { + return securityScore; + } + + public void setSecurityScore(@jakarta.annotation.Nullable String securityScore) { + this.securityScore = securityScore; + } + + public GetProtocolDetailResponseData dimensionScores( + @jakarta.annotation.Nullable + GetProtocolDetailResponseDataDimensionScores dimensionScores) { + this.dimensionScores = dimensionScores; + return this; + } + + /** + * Get dimensionScores + * + * @return dimensionScores + */ + @jakarta.annotation.Nullable + @Valid + public GetProtocolDetailResponseDataDimensionScores getDimensionScores() { + return dimensionScores; + } + + public void setDimensionScores( + @jakarta.annotation.Nullable + GetProtocolDetailResponseDataDimensionScores dimensionScores) { + this.dimensionScores = dimensionScores; + } + + public GetProtocolDetailResponseData highlights( + @jakarta.annotation.Nullable List highlights) { + this.highlights = highlights; + return this; + } + + public GetProtocolDetailResponseData addHighlightsItem(String highlightsItem) { + if (this.highlights == null) { + this.highlights = new ArrayList<>(); + } + this.highlights.add(highlightsItem); + return this; + } + + /** + * Protocol highlights (already translated; quote as-is). + * + * @return highlights + */ + @jakarta.annotation.Nullable + public List getHighlights() { + return highlights; + } + + public void setHighlights(@jakarta.annotation.Nullable List highlights) { + this.highlights = highlights; + } + + public GetProtocolDetailResponseData faq( + @jakarta.annotation.Nullable List<@Valid DefiProtocolInfoDtoFaqInner> faq) { + this.faq = faq; + return this; + } + + public GetProtocolDetailResponseData addFaqItem(DefiProtocolInfoDtoFaqInner faqItem) { + if (this.faq == null) { + this.faq = new ArrayList<>(); + } + this.faq.add(faqItem); + return this; + } + + /** + * FAQ entries (question and answer text, already translated). + * + * @return faq + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid DefiProtocolInfoDtoFaqInner> getFaq() { + return faq; + } + + public void setFaq(@jakarta.annotation.Nullable List<@Valid DefiProtocolInfoDtoFaqInner> faq) { + this.faq = faq; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetProtocolDetailResponseData getProtocolDetailResponseData = + (GetProtocolDetailResponseData) o; + return Objects.equals(this.defiProtocolId, getProtocolDetailResponseData.defiProtocolId) + && Objects.equals(this.protocolName, getProtocolDetailResponseData.protocolName) + && Objects.equals(this.protocolLogo, getProtocolDetailResponseData.protocolLogo) + && Objects.equals(this.description, getProtocolDetailResponseData.description) + && Objects.equals(this.websiteUrl, getProtocolDetailResponseData.websiteUrl) + && Objects.equals(this.investType, getProtocolDetailResponseData.investType) + && Objects.equals( + this.supportedChains, getProtocolDetailResponseData.supportedChains) + && Objects.equals(this.tvl, getProtocolDetailResponseData.tvl) + && Objects.equals(this.tags, getProtocolDetailResponseData.tags) + && Objects.equals(this.founded, getProtocolDetailResponseData.founded) + && Objects.equals(this.fdv, getProtocolDetailResponseData.fdv) + && Objects.equals(this.totalFunding, getProtocolDetailResponseData.totalFunding) + && Objects.equals(this.socialLinks, getProtocolDetailResponseData.socialLinks) + && Objects.equals(this.team, getProtocolDetailResponseData.team) + && Objects.equals(this.fundRaising, getProtocolDetailResponseData.fundRaising) + && Objects.equals(this.securityScore, getProtocolDetailResponseData.securityScore) + && Objects.equals( + this.dimensionScores, getProtocolDetailResponseData.dimensionScores) + && Objects.equals(this.highlights, getProtocolDetailResponseData.highlights) + && Objects.equals(this.faq, getProtocolDetailResponseData.faq); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash( + defiProtocolId, + protocolName, + protocolLogo, + description, + websiteUrl, + investType, + supportedChains, + tvl, + tags, + founded, + fdv, + totalFunding, + socialLinks, + team, + fundRaising, + securityScore, + dimensionScores, + highlights, + faq); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetProtocolDetailResponseData {\n"); + sb.append(" defiProtocolId: ").append(toIndentedString(defiProtocolId)).append("\n"); + sb.append(" protocolName: ").append(toIndentedString(protocolName)).append("\n"); + sb.append(" protocolLogo: ").append(toIndentedString(protocolLogo)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" websiteUrl: ").append(toIndentedString(websiteUrl)).append("\n"); + sb.append(" investType: ").append(toIndentedString(investType)).append("\n"); + sb.append(" supportedChains: ").append(toIndentedString(supportedChains)).append("\n"); + sb.append(" tvl: ").append(toIndentedString(tvl)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" founded: ").append(toIndentedString(founded)).append("\n"); + sb.append(" fdv: ").append(toIndentedString(fdv)).append("\n"); + sb.append(" totalFunding: ").append(toIndentedString(totalFunding)).append("\n"); + sb.append(" socialLinks: ").append(toIndentedString(socialLinks)).append("\n"); + sb.append(" team: ").append(toIndentedString(team)).append("\n"); + sb.append(" fundRaising: ").append(toIndentedString(fundRaising)).append("\n"); + sb.append(" securityScore: ").append(toIndentedString(securityScore)).append("\n"); + sb.append(" dimensionScores: ").append(toIndentedString(dimensionScores)).append("\n"); + sb.append(" highlights: ").append(toIndentedString(highlights)).append("\n"); + sb.append(" faq: ").append(toIndentedString(faq)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object defiProtocolIdValue = getDefiProtocolId(); + String defiProtocolIdValueAsString = ""; + defiProtocolIdValueAsString = defiProtocolIdValue.toString(); + sb.append("defiProtocolId=").append(urlEncode(defiProtocolIdValueAsString)).append(""); + Object protocolNameValue = getProtocolName(); + String protocolNameValueAsString = ""; + protocolNameValueAsString = protocolNameValue.toString(); + sb.append("protocolName=").append(urlEncode(protocolNameValueAsString)).append(""); + Object protocolLogoValue = getProtocolLogo(); + String protocolLogoValueAsString = ""; + protocolLogoValueAsString = protocolLogoValue.toString(); + sb.append("protocolLogo=").append(urlEncode(protocolLogoValueAsString)).append(""); + Object descriptionValue = getDescription(); + String descriptionValueAsString = ""; + descriptionValueAsString = descriptionValue.toString(); + sb.append("description=").append(urlEncode(descriptionValueAsString)).append(""); + Object websiteUrlValue = getWebsiteUrl(); + String websiteUrlValueAsString = ""; + websiteUrlValueAsString = websiteUrlValue.toString(); + sb.append("websiteUrl=").append(urlEncode(websiteUrlValueAsString)).append(""); + Object investTypeValue = getInvestType(); + String investTypeValueAsString = ""; + investTypeValueAsString = + (String) + ((Collection) investTypeValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("investType=").append(urlEncode(investTypeValueAsString)).append(""); + Object supportedChainsValue = getSupportedChains(); + String supportedChainsValueAsString = ""; + supportedChainsValueAsString = + (String) + ((Collection) supportedChainsValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("supportedChains=").append(urlEncode(supportedChainsValueAsString)).append(""); + Object tvlValue = getTvl(); + String tvlValueAsString = ""; + tvlValueAsString = tvlValue.toString(); + sb.append("tvl=").append(urlEncode(tvlValueAsString)).append(""); + Object tagsValue = getTags(); + String tagsValueAsString = ""; + tagsValueAsString = + (String) + ((Collection) tagsValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("tags=").append(urlEncode(tagsValueAsString)).append(""); + Object foundedValue = getFounded(); + String foundedValueAsString = ""; + foundedValueAsString = foundedValue.toString(); + sb.append("founded=").append(urlEncode(foundedValueAsString)).append(""); + Object fdvValue = getFdv(); + String fdvValueAsString = ""; + fdvValueAsString = fdvValue.toString(); + sb.append("fdv=").append(urlEncode(fdvValueAsString)).append(""); + Object totalFundingValue = getTotalFunding(); + String totalFundingValueAsString = ""; + totalFundingValueAsString = totalFundingValue.toString(); + sb.append("totalFunding=").append(urlEncode(totalFundingValueAsString)).append(""); + Object socialLinksValue = getSocialLinks(); + String socialLinksValueAsString = ""; + socialLinksValueAsString = socialLinksValue.toString(); + sb.append("socialLinks=").append(urlEncode(socialLinksValueAsString)).append(""); + Object teamValue = getTeam(); + String teamValueAsString = ""; + teamValueAsString = + (String) + ((Collection) teamValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("team=").append(urlEncode(teamValueAsString)).append(""); + Object fundRaisingValue = getFundRaising(); + String fundRaisingValueAsString = ""; + fundRaisingValueAsString = + (String) + ((Collection) fundRaisingValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("fundRaising=").append(urlEncode(fundRaisingValueAsString)).append(""); + Object securityScoreValue = getSecurityScore(); + String securityScoreValueAsString = ""; + securityScoreValueAsString = securityScoreValue.toString(); + sb.append("securityScore=").append(urlEncode(securityScoreValueAsString)).append(""); + Object dimensionScoresValue = getDimensionScores(); + String dimensionScoresValueAsString = ""; + dimensionScoresValueAsString = dimensionScoresValue.toString(); + sb.append("dimensionScores=").append(urlEncode(dimensionScoresValueAsString)).append(""); + Object highlightsValue = getHighlights(); + String highlightsValueAsString = ""; + highlightsValueAsString = + (String) + ((Collection) highlightsValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("highlights=").append(urlEncode(highlightsValueAsString)).append(""); + Object faqValue = getFaq(); + String faqValueAsString = ""; + faqValueAsString = + (String) + ((Collection) faqValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("faq=").append(urlEncode(faqValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("defiProtocolId"); + openapiFields.add("protocolName"); + openapiFields.add("protocolLogo"); + openapiFields.add("description"); + openapiFields.add("websiteUrl"); + openapiFields.add("investType"); + openapiFields.add("supportedChains"); + openapiFields.add("tvl"); + openapiFields.add("tags"); + openapiFields.add("founded"); + openapiFields.add("fdv"); + openapiFields.add("totalFunding"); + openapiFields.add("socialLinks"); + openapiFields.add("team"); + openapiFields.add("fundRaising"); + openapiFields.add("securityScore"); + openapiFields.add("dimensionScores"); + openapiFields.add("highlights"); + openapiFields.add("faq"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetProtocolDetailResponseData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetProtocolDetailResponseData.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetProtocolDetailResponseData is not" + + " found in the empty JSON string", + GetProtocolDetailResponseData.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("defiProtocolId") != null && !jsonObj.get("defiProtocolId").isJsonNull()) + && !jsonObj.get("defiProtocolId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `defiProtocolId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("defiProtocolId").toString())); + } + if ((jsonObj.get("protocolName") != null && !jsonObj.get("protocolName").isJsonNull()) + && !jsonObj.get("protocolName").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `protocolName` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("protocolName").toString())); + } + if ((jsonObj.get("protocolLogo") != null && !jsonObj.get("protocolLogo").isJsonNull()) + && !jsonObj.get("protocolLogo").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `protocolLogo` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("protocolLogo").toString())); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) + && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `description` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("description").toString())); + } + if ((jsonObj.get("websiteUrl") != null && !jsonObj.get("websiteUrl").isJsonNull()) + && !jsonObj.get("websiteUrl").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `websiteUrl` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("websiteUrl").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("investType") != null + && !jsonObj.get("investType").isJsonNull() + && !jsonObj.get("investType").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `investType` to be an array in the JSON string but" + + " got `%s`", + jsonObj.get("investType").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("supportedChains") != null + && !jsonObj.get("supportedChains").isJsonNull() + && !jsonObj.get("supportedChains").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `supportedChains` to be an array in the JSON string" + + " but got `%s`", + jsonObj.get("supportedChains").toString())); + } + if ((jsonObj.get("tvl") != null && !jsonObj.get("tvl").isJsonNull()) + && !jsonObj.get("tvl").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `tvl` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("tvl").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("tags") != null + && !jsonObj.get("tags").isJsonNull() + && !jsonObj.get("tags").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `tags` to be an array in the JSON string but got" + + " `%s`", + jsonObj.get("tags").toString())); + } + if ((jsonObj.get("founded") != null && !jsonObj.get("founded").isJsonNull()) + && !jsonObj.get("founded").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `founded` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("founded").toString())); + } + if ((jsonObj.get("fdv") != null && !jsonObj.get("fdv").isJsonNull()) + && !jsonObj.get("fdv").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `fdv` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("fdv").toString())); + } + if ((jsonObj.get("totalFunding") != null && !jsonObj.get("totalFunding").isJsonNull()) + && !jsonObj.get("totalFunding").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `totalFunding` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("totalFunding").toString())); + } + // validate the optional field `socialLinks` + if (jsonObj.get("socialLinks") != null && !jsonObj.get("socialLinks").isJsonNull()) { + GetProtocolDetailResponseDataSocialLinks.validateJsonElement( + jsonObj.get("socialLinks")); + } + if (jsonObj.get("team") != null && !jsonObj.get("team").isJsonNull()) { + JsonArray jsonArrayteam = jsonObj.getAsJsonArray("team"); + if (jsonArrayteam != null) { + // ensure the json data is an array + if (!jsonObj.get("team").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `team` to be an array in the JSON string" + + " but got `%s`", + jsonObj.get("team").toString())); + } + + // validate the optional field `team` (array) + for (int i = 0; i < jsonArrayteam.size(); i++) { + DefiProtocolInfoDtoTeamInner.validateJsonElement(jsonArrayteam.get(i)); + } + ; + } + } + if (jsonObj.get("fundRaising") != null && !jsonObj.get("fundRaising").isJsonNull()) { + JsonArray jsonArrayfundRaising = jsonObj.getAsJsonArray("fundRaising"); + if (jsonArrayfundRaising != null) { + // ensure the json data is an array + if (!jsonObj.get("fundRaising").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `fundRaising` to be an array in the JSON" + + " string but got `%s`", + jsonObj.get("fundRaising").toString())); + } + + // validate the optional field `fundRaising` (array) + for (int i = 0; i < jsonArrayfundRaising.size(); i++) { + DefiProtocolInfoDtoFundRaisingInner.validateJsonElement( + jsonArrayfundRaising.get(i)); + } + ; + } + } + if ((jsonObj.get("securityScore") != null && !jsonObj.get("securityScore").isJsonNull()) + && !jsonObj.get("securityScore").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `securityScore` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("securityScore").toString())); + } + // validate the optional field `dimensionScores` + if (jsonObj.get("dimensionScores") != null + && !jsonObj.get("dimensionScores").isJsonNull()) { + GetProtocolDetailResponseDataDimensionScores.validateJsonElement( + jsonObj.get("dimensionScores")); + } + // ensure the optional json data is an array if present + if (jsonObj.get("highlights") != null + && !jsonObj.get("highlights").isJsonNull() + && !jsonObj.get("highlights").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `highlights` to be an array in the JSON string but" + + " got `%s`", + jsonObj.get("highlights").toString())); + } + if (jsonObj.get("faq") != null && !jsonObj.get("faq").isJsonNull()) { + JsonArray jsonArrayfaq = jsonObj.getAsJsonArray("faq"); + if (jsonArrayfaq != null) { + // ensure the json data is an array + if (!jsonObj.get("faq").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `faq` to be an array in the JSON string but" + + " got `%s`", + jsonObj.get("faq").toString())); + } + + // validate the optional field `faq` (array) + for (int i = 0; i < jsonArrayfaq.size(); i++) { + DefiProtocolInfoDtoFaqInner.validateJsonElement(jsonArrayfaq.get(i)); + } + ; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetProtocolDetailResponseData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetProtocolDetailResponseData' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(GetProtocolDetailResponseData.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetProtocolDetailResponseData value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetProtocolDetailResponseData read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetProtocolDetailResponseData given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetProtocolDetailResponseData + * @throws IOException if the JSON string is invalid with respect to + * GetProtocolDetailResponseData + */ + public static GetProtocolDetailResponseData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetProtocolDetailResponseData.class); + } + + /** + * Convert an instance of GetProtocolDetailResponseData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetProtocolDetailResponseDataDimensionScores.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetProtocolDetailResponseDataDimensionScores.java new file mode 100644 index 0000000..235b3cc --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetProtocolDetailResponseDataDimensionScores.java @@ -0,0 +1,461 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** CertiK six-dimension security scores. */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class GetProtocolDetailResponseDataDimensionScores { + public static final String SERIALIZED_NAME_CODE_SECURITY = "codeSecurity"; + + @SerializedName(SERIALIZED_NAME_CODE_SECURITY) + @jakarta.annotation.Nullable + private String codeSecurity; + + public static final String SERIALIZED_NAME_FUNDAMENTAL_HEALTH = "fundamentalHealth"; + + @SerializedName(SERIALIZED_NAME_FUNDAMENTAL_HEALTH) + @jakarta.annotation.Nullable + private String fundamentalHealth; + + public static final String SERIALIZED_NAME_OPERATIONAL_RESILIENCE = "operationalResilience"; + + @SerializedName(SERIALIZED_NAME_OPERATIONAL_RESILIENCE) + @jakarta.annotation.Nullable + private String operationalResilience; + + public static final String SERIALIZED_NAME_COMMUNITY_TRUST = "communityTrust"; + + @SerializedName(SERIALIZED_NAME_COMMUNITY_TRUST) + @jakarta.annotation.Nullable + private String communityTrust; + + public static final String SERIALIZED_NAME_GOVERNANCE_STRENGTH = "governanceStrength"; + + @SerializedName(SERIALIZED_NAME_GOVERNANCE_STRENGTH) + @jakarta.annotation.Nullable + private String governanceStrength; + + public static final String SERIALIZED_NAME_MARKET_STABILITY = "marketStability"; + + @SerializedName(SERIALIZED_NAME_MARKET_STABILITY) + @jakarta.annotation.Nullable + private String marketStability; + + public GetProtocolDetailResponseDataDimensionScores() {} + + public GetProtocolDetailResponseDataDimensionScores codeSecurity( + @jakarta.annotation.Nullable String codeSecurity) { + this.codeSecurity = codeSecurity; + return this; + } + + /** + * Code security score. + * + * @return codeSecurity + */ + @jakarta.annotation.Nullable + public String getCodeSecurity() { + return codeSecurity; + } + + public void setCodeSecurity(@jakarta.annotation.Nullable String codeSecurity) { + this.codeSecurity = codeSecurity; + } + + public GetProtocolDetailResponseDataDimensionScores fundamentalHealth( + @jakarta.annotation.Nullable String fundamentalHealth) { + this.fundamentalHealth = fundamentalHealth; + return this; + } + + /** + * Fundamental health score. + * + * @return fundamentalHealth + */ + @jakarta.annotation.Nullable + public String getFundamentalHealth() { + return fundamentalHealth; + } + + public void setFundamentalHealth(@jakarta.annotation.Nullable String fundamentalHealth) { + this.fundamentalHealth = fundamentalHealth; + } + + public GetProtocolDetailResponseDataDimensionScores operationalResilience( + @jakarta.annotation.Nullable String operationalResilience) { + this.operationalResilience = operationalResilience; + return this; + } + + /** + * Operational resilience score. + * + * @return operationalResilience + */ + @jakarta.annotation.Nullable + public String getOperationalResilience() { + return operationalResilience; + } + + public void setOperationalResilience( + @jakarta.annotation.Nullable String operationalResilience) { + this.operationalResilience = operationalResilience; + } + + public GetProtocolDetailResponseDataDimensionScores communityTrust( + @jakarta.annotation.Nullable String communityTrust) { + this.communityTrust = communityTrust; + return this; + } + + /** + * Community trust score. + * + * @return communityTrust + */ + @jakarta.annotation.Nullable + public String getCommunityTrust() { + return communityTrust; + } + + public void setCommunityTrust(@jakarta.annotation.Nullable String communityTrust) { + this.communityTrust = communityTrust; + } + + public GetProtocolDetailResponseDataDimensionScores governanceStrength( + @jakarta.annotation.Nullable String governanceStrength) { + this.governanceStrength = governanceStrength; + return this; + } + + /** + * Governance strength score. + * + * @return governanceStrength + */ + @jakarta.annotation.Nullable + public String getGovernanceStrength() { + return governanceStrength; + } + + public void setGovernanceStrength(@jakarta.annotation.Nullable String governanceStrength) { + this.governanceStrength = governanceStrength; + } + + public GetProtocolDetailResponseDataDimensionScores marketStability( + @jakarta.annotation.Nullable String marketStability) { + this.marketStability = marketStability; + return this; + } + + /** + * Market stability score. + * + * @return marketStability + */ + @jakarta.annotation.Nullable + public String getMarketStability() { + return marketStability; + } + + public void setMarketStability(@jakarta.annotation.Nullable String marketStability) { + this.marketStability = marketStability; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetProtocolDetailResponseDataDimensionScores getProtocolDetailResponseDataDimensionScores = + (GetProtocolDetailResponseDataDimensionScores) o; + return Objects.equals( + this.codeSecurity, + getProtocolDetailResponseDataDimensionScores.codeSecurity) + && Objects.equals( + this.fundamentalHealth, + getProtocolDetailResponseDataDimensionScores.fundamentalHealth) + && Objects.equals( + this.operationalResilience, + getProtocolDetailResponseDataDimensionScores.operationalResilience) + && Objects.equals( + this.communityTrust, + getProtocolDetailResponseDataDimensionScores.communityTrust) + && Objects.equals( + this.governanceStrength, + getProtocolDetailResponseDataDimensionScores.governanceStrength) + && Objects.equals( + this.marketStability, + getProtocolDetailResponseDataDimensionScores.marketStability); + } + + @Override + public int hashCode() { + return Objects.hash( + codeSecurity, + fundamentalHealth, + operationalResilience, + communityTrust, + governanceStrength, + marketStability); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetProtocolDetailResponseDataDimensionScores {\n"); + sb.append(" codeSecurity: ").append(toIndentedString(codeSecurity)).append("\n"); + sb.append(" fundamentalHealth: ").append(toIndentedString(fundamentalHealth)).append("\n"); + sb.append(" operationalResilience: ") + .append(toIndentedString(operationalResilience)) + .append("\n"); + sb.append(" communityTrust: ").append(toIndentedString(communityTrust)).append("\n"); + sb.append(" governanceStrength: ") + .append(toIndentedString(governanceStrength)) + .append("\n"); + sb.append(" marketStability: ").append(toIndentedString(marketStability)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object codeSecurityValue = getCodeSecurity(); + String codeSecurityValueAsString = ""; + codeSecurityValueAsString = codeSecurityValue.toString(); + sb.append("codeSecurity=").append(urlEncode(codeSecurityValueAsString)).append(""); + Object fundamentalHealthValue = getFundamentalHealth(); + String fundamentalHealthValueAsString = ""; + fundamentalHealthValueAsString = fundamentalHealthValue.toString(); + sb.append("fundamentalHealth=") + .append(urlEncode(fundamentalHealthValueAsString)) + .append(""); + Object operationalResilienceValue = getOperationalResilience(); + String operationalResilienceValueAsString = ""; + operationalResilienceValueAsString = operationalResilienceValue.toString(); + sb.append("operationalResilience=") + .append(urlEncode(operationalResilienceValueAsString)) + .append(""); + Object communityTrustValue = getCommunityTrust(); + String communityTrustValueAsString = ""; + communityTrustValueAsString = communityTrustValue.toString(); + sb.append("communityTrust=").append(urlEncode(communityTrustValueAsString)).append(""); + Object governanceStrengthValue = getGovernanceStrength(); + String governanceStrengthValueAsString = ""; + governanceStrengthValueAsString = governanceStrengthValue.toString(); + sb.append("governanceStrength=") + .append(urlEncode(governanceStrengthValueAsString)) + .append(""); + Object marketStabilityValue = getMarketStability(); + String marketStabilityValueAsString = ""; + marketStabilityValueAsString = marketStabilityValue.toString(); + sb.append("marketStability=").append(urlEncode(marketStabilityValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("codeSecurity"); + openapiFields.add("fundamentalHealth"); + openapiFields.add("operationalResilience"); + openapiFields.add("communityTrust"); + openapiFields.add("governanceStrength"); + openapiFields.add("marketStability"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetProtocolDetailResponseDataDimensionScores + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetProtocolDetailResponseDataDimensionScores.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " GetProtocolDetailResponseDataDimensionScores is not found" + + " in the empty JSON string", + GetProtocolDetailResponseDataDimensionScores.openapiRequiredFields + .toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("codeSecurity") != null && !jsonObj.get("codeSecurity").isJsonNull()) + && !jsonObj.get("codeSecurity").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `codeSecurity` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("codeSecurity").toString())); + } + if ((jsonObj.get("fundamentalHealth") != null + && !jsonObj.get("fundamentalHealth").isJsonNull()) + && !jsonObj.get("fundamentalHealth").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `fundamentalHealth` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("fundamentalHealth").toString())); + } + if ((jsonObj.get("operationalResilience") != null + && !jsonObj.get("operationalResilience").isJsonNull()) + && !jsonObj.get("operationalResilience").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `operationalResilience` to be a primitive type in" + + " the JSON string but got `%s`", + jsonObj.get("operationalResilience").toString())); + } + if ((jsonObj.get("communityTrust") != null && !jsonObj.get("communityTrust").isJsonNull()) + && !jsonObj.get("communityTrust").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `communityTrust` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("communityTrust").toString())); + } + if ((jsonObj.get("governanceStrength") != null + && !jsonObj.get("governanceStrength").isJsonNull()) + && !jsonObj.get("governanceStrength").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `governanceStrength` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("governanceStrength").toString())); + } + if ((jsonObj.get("marketStability") != null && !jsonObj.get("marketStability").isJsonNull()) + && !jsonObj.get("marketStability").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `marketStability` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("marketStability").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetProtocolDetailResponseDataDimensionScores.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'GetProtocolDetailResponseDataDimensionScores' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, + TypeToken.get(GetProtocolDetailResponseDataDimensionScores.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, GetProtocolDetailResponseDataDimensionScores value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetProtocolDetailResponseDataDimensionScores read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetProtocolDetailResponseDataDimensionScores given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetProtocolDetailResponseDataDimensionScores + * @throws IOException if the JSON string is invalid with respect to + * GetProtocolDetailResponseDataDimensionScores + */ + public static GetProtocolDetailResponseDataDimensionScores fromJson(String jsonString) + throws IOException { + return JSON.getGson() + .fromJson(jsonString, GetProtocolDetailResponseDataDimensionScores.class); + } + + /** + * Convert an instance of GetProtocolDetailResponseDataDimensionScores to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetProtocolDetailResponseDataSocialLinks.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetProtocolDetailResponseDataSocialLinks.java new file mode 100644 index 0000000..1f58dbb --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetProtocolDetailResponseDataSocialLinks.java @@ -0,0 +1,486 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** Protocol social media links. */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class GetProtocolDetailResponseDataSocialLinks { + public static final String SERIALIZED_NAME_X_LOWER_CASE = "x"; + + @SerializedName(SERIALIZED_NAME_X_LOWER_CASE) + @jakarta.annotation.Nullable + private String xLowerCase; + + public static final String SERIALIZED_NAME_DISCORD = "discord"; + + @SerializedName(SERIALIZED_NAME_DISCORD) + @jakarta.annotation.Nullable + private String discord; + + public static final String SERIALIZED_NAME_GITHUB = "github"; + + @SerializedName(SERIALIZED_NAME_GITHUB) + @jakarta.annotation.Nullable + private String github; + + public static final String SERIALIZED_NAME_LINKEDIN = "linkedin"; + + @SerializedName(SERIALIZED_NAME_LINKEDIN) + @jakarta.annotation.Nullable + private String linkedin; + + public static final String SERIALIZED_NAME_TELEGRAM = "telegram"; + + @SerializedName(SERIALIZED_NAME_TELEGRAM) + @jakarta.annotation.Nullable + private String telegram; + + public static final String SERIALIZED_NAME_GITBOOK = "gitbook"; + + @SerializedName(SERIALIZED_NAME_GITBOOK) + @jakarta.annotation.Nullable + private String gitbook; + + public static final String SERIALIZED_NAME_WEBSITE = "website"; + + @SerializedName(SERIALIZED_NAME_WEBSITE) + @jakarta.annotation.Nullable + private String website; + + public GetProtocolDetailResponseDataSocialLinks() {} + + public GetProtocolDetailResponseDataSocialLinks xLowerCase( + @jakarta.annotation.Nullable String xLowerCase) { + this.xLowerCase = xLowerCase; + return this; + } + + /** + * X (Twitter) profile URL. Null when not available. + * + * @return xLowerCase + */ + @jakarta.annotation.Nullable + public String getxLowerCase() { + return xLowerCase; + } + + public void setxLowerCase(@jakarta.annotation.Nullable String xLowerCase) { + this.xLowerCase = xLowerCase; + } + + public GetProtocolDetailResponseDataSocialLinks discord( + @jakarta.annotation.Nullable String discord) { + this.discord = discord; + return this; + } + + /** + * Discord invite URL. Null when not available. + * + * @return discord + */ + @jakarta.annotation.Nullable + public String getDiscord() { + return discord; + } + + public void setDiscord(@jakarta.annotation.Nullable String discord) { + this.discord = discord; + } + + public GetProtocolDetailResponseDataSocialLinks github( + @jakarta.annotation.Nullable String github) { + this.github = github; + return this; + } + + /** + * GitHub organization URL. Null when not available. + * + * @return github + */ + @jakarta.annotation.Nullable + public String getGithub() { + return github; + } + + public void setGithub(@jakarta.annotation.Nullable String github) { + this.github = github; + } + + public GetProtocolDetailResponseDataSocialLinks linkedin( + @jakarta.annotation.Nullable String linkedin) { + this.linkedin = linkedin; + return this; + } + + /** + * LinkedIn company URL. Null when not available. + * + * @return linkedin + */ + @jakarta.annotation.Nullable + public String getLinkedin() { + return linkedin; + } + + public void setLinkedin(@jakarta.annotation.Nullable String linkedin) { + this.linkedin = linkedin; + } + + public GetProtocolDetailResponseDataSocialLinks telegram( + @jakarta.annotation.Nullable String telegram) { + this.telegram = telegram; + return this; + } + + /** + * Telegram channel URL. Null when not available. + * + * @return telegram + */ + @jakarta.annotation.Nullable + public String getTelegram() { + return telegram; + } + + public void setTelegram(@jakarta.annotation.Nullable String telegram) { + this.telegram = telegram; + } + + public GetProtocolDetailResponseDataSocialLinks gitbook( + @jakarta.annotation.Nullable String gitbook) { + this.gitbook = gitbook; + return this; + } + + /** + * GitBook documentation URL. Empty string or null when not available. + * + * @return gitbook + */ + @jakarta.annotation.Nullable + public String getGitbook() { + return gitbook; + } + + public void setGitbook(@jakarta.annotation.Nullable String gitbook) { + this.gitbook = gitbook; + } + + public GetProtocolDetailResponseDataSocialLinks website( + @jakarta.annotation.Nullable String website) { + this.website = website; + return this; + } + + /** + * Official website URL. + * + * @return website + */ + @jakarta.annotation.Nullable + public String getWebsite() { + return website; + } + + public void setWebsite(@jakarta.annotation.Nullable String website) { + this.website = website; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetProtocolDetailResponseDataSocialLinks getProtocolDetailResponseDataSocialLinks = + (GetProtocolDetailResponseDataSocialLinks) o; + return Objects.equals(this.xLowerCase, getProtocolDetailResponseDataSocialLinks.xLowerCase) + && Objects.equals(this.discord, getProtocolDetailResponseDataSocialLinks.discord) + && Objects.equals(this.github, getProtocolDetailResponseDataSocialLinks.github) + && Objects.equals(this.linkedin, getProtocolDetailResponseDataSocialLinks.linkedin) + && Objects.equals(this.telegram, getProtocolDetailResponseDataSocialLinks.telegram) + && Objects.equals(this.gitbook, getProtocolDetailResponseDataSocialLinks.gitbook) + && Objects.equals(this.website, getProtocolDetailResponseDataSocialLinks.website); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(xLowerCase, discord, github, linkedin, telegram, gitbook, website); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetProtocolDetailResponseDataSocialLinks {\n"); + sb.append(" xLowerCase: ").append(toIndentedString(xLowerCase)).append("\n"); + sb.append(" discord: ").append(toIndentedString(discord)).append("\n"); + sb.append(" github: ").append(toIndentedString(github)).append("\n"); + sb.append(" linkedin: ").append(toIndentedString(linkedin)).append("\n"); + sb.append(" telegram: ").append(toIndentedString(telegram)).append("\n"); + sb.append(" gitbook: ").append(toIndentedString(gitbook)).append("\n"); + sb.append(" website: ").append(toIndentedString(website)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object xLowerCaseValue = getxLowerCase(); + String xLowerCaseValueAsString = ""; + xLowerCaseValueAsString = xLowerCaseValue.toString(); + sb.append("xLowerCase=").append(urlEncode(xLowerCaseValueAsString)).append(""); + Object discordValue = getDiscord(); + String discordValueAsString = ""; + discordValueAsString = discordValue.toString(); + sb.append("discord=").append(urlEncode(discordValueAsString)).append(""); + Object githubValue = getGithub(); + String githubValueAsString = ""; + githubValueAsString = githubValue.toString(); + sb.append("github=").append(urlEncode(githubValueAsString)).append(""); + Object linkedinValue = getLinkedin(); + String linkedinValueAsString = ""; + linkedinValueAsString = linkedinValue.toString(); + sb.append("linkedin=").append(urlEncode(linkedinValueAsString)).append(""); + Object telegramValue = getTelegram(); + String telegramValueAsString = ""; + telegramValueAsString = telegramValue.toString(); + sb.append("telegram=").append(urlEncode(telegramValueAsString)).append(""); + Object gitbookValue = getGitbook(); + String gitbookValueAsString = ""; + gitbookValueAsString = gitbookValue.toString(); + sb.append("gitbook=").append(urlEncode(gitbookValueAsString)).append(""); + Object websiteValue = getWebsite(); + String websiteValueAsString = ""; + websiteValueAsString = websiteValue.toString(); + sb.append("website=").append(urlEncode(websiteValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("x"); + openapiFields.add("discord"); + openapiFields.add("github"); + openapiFields.add("linkedin"); + openapiFields.add("telegram"); + openapiFields.add("gitbook"); + openapiFields.add("website"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetProtocolDetailResponseDataSocialLinks + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetProtocolDetailResponseDataSocialLinks.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " GetProtocolDetailResponseDataSocialLinks is not found in" + + " the empty JSON string", + GetProtocolDetailResponseDataSocialLinks.openapiRequiredFields + .toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("x") != null && !jsonObj.get("x").isJsonNull()) + && !jsonObj.get("x").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `x` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("x").toString())); + } + if ((jsonObj.get("discord") != null && !jsonObj.get("discord").isJsonNull()) + && !jsonObj.get("discord").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `discord` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("discord").toString())); + } + if ((jsonObj.get("github") != null && !jsonObj.get("github").isJsonNull()) + && !jsonObj.get("github").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `github` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("github").toString())); + } + if ((jsonObj.get("linkedin") != null && !jsonObj.get("linkedin").isJsonNull()) + && !jsonObj.get("linkedin").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `linkedin` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("linkedin").toString())); + } + if ((jsonObj.get("telegram") != null && !jsonObj.get("telegram").isJsonNull()) + && !jsonObj.get("telegram").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `telegram` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("telegram").toString())); + } + if ((jsonObj.get("gitbook") != null && !jsonObj.get("gitbook").isJsonNull()) + && !jsonObj.get("gitbook").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `gitbook` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("gitbook").toString())); + } + if ((jsonObj.get("website") != null && !jsonObj.get("website").isJsonNull()) + && !jsonObj.get("website").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `website` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("website").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetProtocolDetailResponseDataSocialLinks.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'GetProtocolDetailResponseDataSocialLinks' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(GetProtocolDetailResponseDataSocialLinks.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, GetProtocolDetailResponseDataSocialLinks value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetProtocolDetailResponseDataSocialLinks read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetProtocolDetailResponseDataSocialLinks given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetProtocolDetailResponseDataSocialLinks + * @throws IOException if the JSON string is invalid with respect to + * GetProtocolDetailResponseDataSocialLinks + */ + public static GetProtocolDetailResponseDataSocialLinks fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, GetProtocolDetailResponseDataSocialLinks.class); + } + + /** + * Convert an instance of GetProtocolDetailResponseDataSocialLinks to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetRfqOrderStatusResponse.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetRfqOrderStatusResponse.java index d8b5dde..5ebc2d7 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetRfqOrderStatusResponse.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetRfqOrderStatusResponse.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetRfqOrderStatusResponseData.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetRfqOrderStatusResponseData.java index fb6597a..791397a 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetRfqOrderStatusResponseData.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetRfqOrderStatusResponseData.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetRwaTokenIssuancePlatformsResponse.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetRwaTokenIssuancePlatformsResponse.java index a243432..def4079 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetRwaTokenIssuancePlatformsResponse.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetRwaTokenIssuancePlatformsResponse.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetRwaTokenIssuancePlatformsResponseDataInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetRwaTokenIssuancePlatformsResponseDataInner.java index 9d14e1e..4780ee6 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetRwaTokenIssuancePlatformsResponseDataInner.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetRwaTokenIssuancePlatformsResponseDataInner.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetRwaTokenIssuancePlatformsResponseDataInnerChainDistributionInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetRwaTokenIssuancePlatformsResponseDataInnerChainDistributionInner.java index 07f15a7..d21d8c5 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetRwaTokenIssuancePlatformsResponseDataInnerChainDistributionInner.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetRwaTokenIssuancePlatformsResponseDataInnerChainDistributionInner.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetRwaTokenListResponse.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetRwaTokenListResponse.java index 33f9cc8..5723828 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetRwaTokenListResponse.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetRwaTokenListResponse.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetRwaTokenListResponseDataInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetRwaTokenListResponseDataInner.java index 77fed78..7238a5f 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetRwaTokenListResponseDataInner.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetRwaTokenListResponseDataInner.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetRwaTokenListResponseDataInnerStatusInfo.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetRwaTokenListResponseDataInnerStatusInfo.java index 96de73b..a1e65f1 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetRwaTokenListResponseDataInnerStatusInfo.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetRwaTokenListResponseDataInnerStatusInfo.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetRwaTokenPriceResponse.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetRwaTokenPriceResponse.java index 21d72b5..f8f6793 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetRwaTokenPriceResponse.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetRwaTokenPriceResponse.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetRwaTokenPriceResponseDataInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetRwaTokenPriceResponseDataInner.java index e4d8726..bae5d08 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetRwaTokenPriceResponseDataInner.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetRwaTokenPriceResponseDataInner.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetRwaUnderlyingInfoResponse.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetRwaUnderlyingInfoResponse.java index a9b8cc5..052ea69 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetRwaUnderlyingInfoResponse.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetRwaUnderlyingInfoResponse.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetRwaUnderlyingInfoResponseData.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetRwaUnderlyingInfoResponseData.java index b6b8865..6a8623b 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetRwaUnderlyingInfoResponseData.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetRwaUnderlyingInfoResponseData.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetRwaUnderlyingInfoResponseDataCompanyInfo.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetRwaUnderlyingInfoResponseDataCompanyInfo.java index 9fc6dd5..a918067 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetRwaUnderlyingInfoResponseDataCompanyInfo.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetRwaUnderlyingInfoResponseDataCompanyInfo.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetRwaUnderlyingInfoResponseDataProtectionsValue.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetRwaUnderlyingInfoResponseDataProtectionsValue.java index 7643e0d..873ea0b 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetRwaUnderlyingInfoResponseDataProtectionsValue.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetRwaUnderlyingInfoResponseDataProtectionsValue.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetRwaUnderlyingMarketDataResponse.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetRwaUnderlyingMarketDataResponse.java index b0b9172..b3fdfd9 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetRwaUnderlyingMarketDataResponse.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetRwaUnderlyingMarketDataResponse.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetRwaUnderlyingMarketDataResponseData.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetRwaUnderlyingMarketDataResponseData.java index 40aa297..e80f233 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetRwaUnderlyingMarketDataResponseData.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetRwaUnderlyingMarketDataResponseData.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetRwaUnderlyingMarketDataResponseDataMarketData.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetRwaUnderlyingMarketDataResponseDataMarketData.java index 1df0c51..99fddfd 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetRwaUnderlyingMarketDataResponseDataMarketData.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetRwaUnderlyingMarketDataResponseDataMarketData.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetRwaUnderlyingMarketDataResponseDataStatusInfo.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetRwaUnderlyingMarketDataResponseDataStatusInfo.java index 29fcf7f..9ab5b03 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetRwaUnderlyingMarketDataResponseDataStatusInfo.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetRwaUnderlyingMarketDataResponseDataStatusInfo.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetSupportedChainsResponse.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetSupportedChainsResponse.java index 7445863..b5cf26c 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetSupportedChainsResponse.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetSupportedChainsResponse.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetSupportedChainsResponseDataInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetSupportedChainsResponseDataInner.java index 8aa2ff3..0289455 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetSupportedChainsResponseDataInner.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetSupportedChainsResponseDataInner.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenAdvancedInfoResponse.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenAdvancedInfoResponse.java index ed74c2b..4383b89 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenAdvancedInfoResponse.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenAdvancedInfoResponse.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenAdvancedInfoResponseData.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenAdvancedInfoResponseData.java index 14bfc70..b5dff7a 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenAdvancedInfoResponseData.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenAdvancedInfoResponseData.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenBalancesByAddressRequest.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenBalancesByAddressRequest.java index e788943..7f87023 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenBalancesByAddressRequest.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenBalancesByAddressRequest.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenBalancesByAddressRequestTokenContractAddressesInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenBalancesByAddressRequestTokenContractAddressesInner.java index 692f115..c681377 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenBalancesByAddressRequestTokenContractAddressesInner.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenBalancesByAddressRequestTokenContractAddressesInner.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenBalancesByAddressResponse.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenBalancesByAddressResponse.java index fbbf3dc..d53509c 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenBalancesByAddressResponse.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenBalancesByAddressResponse.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenBalancesByAddressResponseDataInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenBalancesByAddressResponseDataInner.java index 5eabb3b..2bba608 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenBalancesByAddressResponseDataInner.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenBalancesByAddressResponseDataInner.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenBalancesByAddressResponseDataInnerTokenAssetsInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenBalancesByAddressResponseDataInnerTokenAssetsInner.java index 61ae2f9..26ff898 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenBalancesByAddressResponseDataInnerTokenAssetsInner.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenBalancesByAddressResponseDataInnerTokenAssetsInner.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenBasicInfoResponse.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenBasicInfoResponse.java index 48c6663..88dedb2 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenBasicInfoResponse.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenBasicInfoResponse.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenDevInfoResponse.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenDevInfoResponse.java index 02e59a0..a4890c0 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenDevInfoResponse.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenDevInfoResponse.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenDevInfoResponseData.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenDevInfoResponseData.java index bf31356..2b515c8 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenDevInfoResponseData.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenDevInfoResponseData.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenDevInfoResponseDataDevHoldingInfo.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenDevInfoResponseDataDevHoldingInfo.java index 4bbab5f..6b78532 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenDevInfoResponseDataDevHoldingInfo.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenDevInfoResponseDataDevHoldingInfo.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenDevInfoResponseDataDevLaunchedInfo.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenDevInfoResponseDataDevLaunchedInfo.java index 3d760cc..5c42bf0 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenDevInfoResponseDataDevLaunchedInfo.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenDevInfoResponseDataDevLaunchedInfo.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenPriceResponse.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenPriceResponse.java index e010ee0..14cfb25 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenPriceResponse.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenPriceResponse.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenPriceResponseDataInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenPriceResponseDataInner.java index f05197a..bdb1589 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenPriceResponseDataInner.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenPriceResponseDataInner.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenTradesResponse.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenTradesResponse.java index 9186d4a..5762d64 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenTradesResponse.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenTradesResponse.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenTradesResponseData.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenTradesResponseData.java index bc9ca79..3e1dbce 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenTradesResponseData.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenTradesResponseData.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenTradesResponseDataTradesInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenTradesResponseDataTradesInner.java index 55c9857..ce27850 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenTradesResponseDataTradesInner.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenTradesResponseDataTradesInner.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenTradesResponseDataTradesInnerChangedTokenInfoInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenTradesResponseDataTradesInnerChangedTokenInfoInner.java index 5d70569..cfc9a43 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenTradesResponseDataTradesInnerChangedTokenInfoInner.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenTradesResponseDataTradesInnerChangedTokenInfoInner.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenTradingInfoResponse.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenTradingInfoResponse.java index adb4946..27da32c 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenTradingInfoResponse.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenTradingInfoResponse.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenTradingInfoResponseDataInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenTradingInfoResponseDataInner.java index 6dd7b53..e64ab2e 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenTradingInfoResponseDataInner.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTokenTradingInfoResponseDataInner.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTopLiquidityPoolsResponse.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTopLiquidityPoolsResponse.java index 23d7580..047e368 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTopLiquidityPoolsResponse.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTopLiquidityPoolsResponse.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTopLiquidityPoolsResponseDataInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTopLiquidityPoolsResponseDataInner.java index dbad51b..bed717e 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTopLiquidityPoolsResponseDataInner.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTopLiquidityPoolsResponseDataInner.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTopLiquidityPoolsResponseDataInnerLiquidityAmountInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTopLiquidityPoolsResponseDataInnerLiquidityAmountInner.java index aac1c6d..32ac58f 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTopLiquidityPoolsResponseDataInnerLiquidityAmountInner.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTopLiquidityPoolsResponseDataInnerLiquidityAmountInner.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTopTradersResponse.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTopTradersResponse.java index 6be6734..565a2bd 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTopTradersResponse.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTopTradersResponse.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTopTradersResponseDataInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTopTradersResponseDataInner.java index 93f44c8..f12ca68 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTopTradersResponseDataInner.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTopTradersResponseDataInner.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTrackedTradesResponse.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTrackedTradesResponse.java index 7a59f43..d838ffd 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTrackedTradesResponse.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTrackedTradesResponse.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTrackedTradesResponseData.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTrackedTradesResponseData.java index eb824d1..fdcedb4 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTrackedTradesResponseData.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTrackedTradesResponseData.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTrackedTradesResponseDataTradesInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTrackedTradesResponseDataTradesInner.java index 1bf47a6..7be36bd 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTrackedTradesResponseDataTradesInner.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTrackedTradesResponseDataTradesInner.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTransactionDetailByHashResponse.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTransactionDetailByHashResponse.java index 7e0852b..ad9c8aa 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTransactionDetailByHashResponse.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTransactionDetailByHashResponse.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTransactionDetailByHashResponseDataInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTransactionDetailByHashResponseDataInner.java index 348e3f3..7d8a06b 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTransactionDetailByHashResponseDataInner.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTransactionDetailByHashResponseDataInner.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTransactionDetailByHashResponseDataInnerFromDetailsInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTransactionDetailByHashResponseDataInnerFromDetailsInner.java index 2b2b350..507c217 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTransactionDetailByHashResponseDataInnerFromDetailsInner.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTransactionDetailByHashResponseDataInnerFromDetailsInner.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTransactionDetailByHashResponseDataInnerInternalTransactionDetailsInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTransactionDetailByHashResponseDataInnerInternalTransactionDetailsInner.java index bf28ff7..d31d75c 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTransactionDetailByHashResponseDataInnerInternalTransactionDetailsInner.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTransactionDetailByHashResponseDataInnerInternalTransactionDetailsInner.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTransactionDetailByHashResponseDataInnerToDetailsInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTransactionDetailByHashResponseDataInnerToDetailsInner.java index a743039..06cf971 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTransactionDetailByHashResponseDataInnerToDetailsInner.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTransactionDetailByHashResponseDataInnerToDetailsInner.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTransactionDetailByHashResponseDataInnerTokenTransferDetailsInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTransactionDetailByHashResponseDataInnerTokenTransferDetailsInner.java index 57d4dd7..3b44919 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTransactionDetailByHashResponseDataInnerTokenTransferDetailsInner.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTransactionDetailByHashResponseDataInnerTokenTransferDetailsInner.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTransactionStatusResponse.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTransactionStatusResponse.java index 22b4213..a3e8392 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTransactionStatusResponse.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTransactionStatusResponse.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTransactionStatusResponseData.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTransactionStatusResponseData.java index a160bdc..4282159 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTransactionStatusResponseData.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTransactionStatusResponseData.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTransactionStatusResponseDataFromTokenDetailsInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTransactionStatusResponseDataFromTokenDetailsInner.java index d9112e5..b56590c 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTransactionStatusResponseDataFromTokenDetailsInner.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTransactionStatusResponseDataFromTokenDetailsInner.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTransactionStatusResponseDataToTokenDetailsInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTransactionStatusResponseDataToTokenDetailsInner.java index dee0ceb..6c5f325 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTransactionStatusResponseDataToTokenDetailsInner.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTransactionStatusResponseDataToTokenDetailsInner.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTransactionSupportedChainsResponse.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTransactionSupportedChainsResponse.java index 0e6f9ec..5fe5045 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTransactionSupportedChainsResponse.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTransactionSupportedChainsResponse.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTransactionSupportedChainsResponseDataInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTransactionSupportedChainsResponseDataInner.java index b4ce4d3..c9d1c78 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTransactionSupportedChainsResponseDataInner.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTransactionSupportedChainsResponseDataInner.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTransactionsByAddressResponse.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTransactionsByAddressResponse.java index a276bf4..10a07f3 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTransactionsByAddressResponse.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTransactionsByAddressResponse.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTransactionsByAddressResponseDataInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTransactionsByAddressResponseDataInner.java index c1f7e89..0e79101 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTransactionsByAddressResponseDataInner.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTransactionsByAddressResponseDataInner.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTransactionsByAddressResponseDataInnerTransactionListInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTransactionsByAddressResponseDataInnerTransactionListInner.java index 0c7a717..c92cd67 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTransactionsByAddressResponseDataInnerTransactionListInner.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTransactionsByAddressResponseDataInnerTransactionListInner.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTransactionsByAddressResponseDataInnerTransactionListInnerFromInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTransactionsByAddressResponseDataInnerTransactionListInnerFromInner.java index 4d118db..bcba58c 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTransactionsByAddressResponseDataInnerTransactionListInnerFromInner.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTransactionsByAddressResponseDataInnerTransactionListInnerFromInner.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTransactionsByAddressResponseDataInnerTransactionListInnerToInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTransactionsByAddressResponseDataInnerTransactionListInnerToInner.java index 41a05f6..fff8cc4 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTransactionsByAddressResponseDataInnerTransactionListInnerToInner.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetTransactionsByAddressResponseDataInnerTransactionListInnerToInner.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetWalletSupportedChainsResponse.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetWalletSupportedChainsResponse.java index 06d7144..944372f 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetWalletSupportedChainsResponse.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetWalletSupportedChainsResponse.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetWalletSupportedChainsResponseDataInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetWalletSupportedChainsResponseDataInner.java index a01ee50..a2f1f63 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetWalletSupportedChainsResponseDataInner.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetWalletSupportedChainsResponseDataInner.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetWebSocketAuthTokenResponse.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetWebSocketAuthTokenResponse.java new file mode 100644 index 0000000..d47a84a --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetWebSocketAuthTokenResponse.java @@ -0,0 +1,351 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** GetWebSocketAuthTokenResponse */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class GetWebSocketAuthTokenResponse { + public static final String SERIALIZED_NAME_CODE = "code"; + + @SerializedName(SERIALIZED_NAME_CODE) + @jakarta.annotation.Nullable + private Integer code; + + public static final String SERIALIZED_NAME_MSG = "msg"; + + @SerializedName(SERIALIZED_NAME_MSG) + @jakarta.annotation.Nullable + private String msg; + + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + @jakarta.annotation.Nullable + private GetWebSocketAuthTokenResponseData data; + + public static final String SERIALIZED_NAME_TIMESTAMP = "timestamp"; + + @SerializedName(SERIALIZED_NAME_TIMESTAMP) + @jakarta.annotation.Nullable + private Long timestamp; + + public static final String SERIALIZED_NAME_SUCCESS = "success"; + + @SerializedName(SERIALIZED_NAME_SUCCESS) + @jakarta.annotation.Nullable + private Boolean success; + + public GetWebSocketAuthTokenResponse() {} + + public GetWebSocketAuthTokenResponse code(@jakarta.annotation.Nullable Integer code) { + this.code = code; + return this; + } + + /** + * Response code. 0 indicates success. + * + * @return code + */ + @jakarta.annotation.Nullable + public Integer getCode() { + return code; + } + + public void setCode(@jakarta.annotation.Nullable Integer code) { + this.code = code; + } + + public GetWebSocketAuthTokenResponse msg(@jakarta.annotation.Nullable String msg) { + this.msg = msg; + return this; + } + + /** + * Response message. + * + * @return msg + */ + @jakarta.annotation.Nullable + public String getMsg() { + return msg; + } + + public void setMsg(@jakarta.annotation.Nullable String msg) { + this.msg = msg; + } + + public GetWebSocketAuthTokenResponse data( + @jakarta.annotation.Nullable GetWebSocketAuthTokenResponseData data) { + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @jakarta.annotation.Nullable + @Valid + public GetWebSocketAuthTokenResponseData getData() { + return data; + } + + public void setData(@jakarta.annotation.Nullable GetWebSocketAuthTokenResponseData data) { + this.data = data; + } + + public GetWebSocketAuthTokenResponse timestamp(@jakarta.annotation.Nullable Long timestamp) { + this.timestamp = timestamp; + return this; + } + + /** + * Server timestamp in milliseconds. + * + * @return timestamp + */ + @jakarta.annotation.Nullable + public Long getTimestamp() { + return timestamp; + } + + public void setTimestamp(@jakarta.annotation.Nullable Long timestamp) { + this.timestamp = timestamp; + } + + public GetWebSocketAuthTokenResponse success(@jakarta.annotation.Nullable Boolean success) { + this.success = success; + return this; + } + + /** + * Whether the request was successful. + * + * @return success + */ + @jakarta.annotation.Nullable + public Boolean getSuccess() { + return success; + } + + public void setSuccess(@jakarta.annotation.Nullable Boolean success) { + this.success = success; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetWebSocketAuthTokenResponse getWebSocketAuthTokenResponse = + (GetWebSocketAuthTokenResponse) o; + return Objects.equals(this.code, getWebSocketAuthTokenResponse.code) + && Objects.equals(this.msg, getWebSocketAuthTokenResponse.msg) + && Objects.equals(this.data, getWebSocketAuthTokenResponse.data) + && Objects.equals(this.timestamp, getWebSocketAuthTokenResponse.timestamp) + && Objects.equals(this.success, getWebSocketAuthTokenResponse.success); + } + + @Override + public int hashCode() { + return Objects.hash(code, msg, data, timestamp, success); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetWebSocketAuthTokenResponse {\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" msg: ").append(toIndentedString(msg)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" timestamp: ").append(toIndentedString(timestamp)).append("\n"); + sb.append(" success: ").append(toIndentedString(success)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object codeValue = getCode(); + String codeValueAsString = ""; + codeValueAsString = codeValue.toString(); + sb.append("code=").append(urlEncode(codeValueAsString)).append(""); + Object msgValue = getMsg(); + String msgValueAsString = ""; + msgValueAsString = msgValue.toString(); + sb.append("msg=").append(urlEncode(msgValueAsString)).append(""); + Object dataValue = getData(); + String dataValueAsString = ""; + dataValueAsString = dataValue.toString(); + sb.append("data=").append(urlEncode(dataValueAsString)).append(""); + Object timestampValue = getTimestamp(); + String timestampValueAsString = ""; + timestampValueAsString = timestampValue.toString(); + sb.append("timestamp=").append(urlEncode(timestampValueAsString)).append(""); + Object successValue = getSuccess(); + String successValueAsString = ""; + successValueAsString = successValue.toString(); + sb.append("success=").append(urlEncode(successValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("code"); + openapiFields.add("msg"); + openapiFields.add("data"); + openapiFields.add("timestamp"); + openapiFields.add("success"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetWebSocketAuthTokenResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetWebSocketAuthTokenResponse.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetWebSocketAuthTokenResponse is not" + + " found in the empty JSON string", + GetWebSocketAuthTokenResponse.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("msg") != null && !jsonObj.get("msg").isJsonNull()) + && !jsonObj.get("msg").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `msg` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("msg").toString())); + } + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + GetWebSocketAuthTokenResponseData.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetWebSocketAuthTokenResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetWebSocketAuthTokenResponse' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(GetWebSocketAuthTokenResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetWebSocketAuthTokenResponse value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetWebSocketAuthTokenResponse read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetWebSocketAuthTokenResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetWebSocketAuthTokenResponse + * @throws IOException if the JSON string is invalid with respect to + * GetWebSocketAuthTokenResponse + */ + public static GetWebSocketAuthTokenResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetWebSocketAuthTokenResponse.class); + } + + /** + * Convert an instance of GetWebSocketAuthTokenResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetWebSocketAuthTokenResponseData.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetWebSocketAuthTokenResponseData.java new file mode 100644 index 0000000..6092ad8 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/GetWebSocketAuthTokenResponseData.java @@ -0,0 +1,217 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** GetWebSocketAuthTokenResponseData */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class GetWebSocketAuthTokenResponseData { + public static final String SERIALIZED_NAME_TOKEN = "token"; + + @SerializedName(SERIALIZED_NAME_TOKEN) + @jakarta.annotation.Nullable + private String token; + + public GetWebSocketAuthTokenResponseData() {} + + public GetWebSocketAuthTokenResponseData token(@jakarta.annotation.Nullable String token) { + this.token = token; + return this; + } + + /** + * WebSocket auth token (JWT). + * + * @return token + */ + @jakarta.annotation.Nullable + public String getToken() { + return token; + } + + public void setToken(@jakarta.annotation.Nullable String token) { + this.token = token; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetWebSocketAuthTokenResponseData getWebSocketAuthTokenResponseData = + (GetWebSocketAuthTokenResponseData) o; + return Objects.equals(this.token, getWebSocketAuthTokenResponseData.token); + } + + @Override + public int hashCode() { + return Objects.hash(token); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetWebSocketAuthTokenResponseData {\n"); + sb.append(" token: ").append(toIndentedString(token)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object tokenValue = getToken(); + String tokenValueAsString = ""; + tokenValueAsString = tokenValue.toString(); + sb.append("token=").append(urlEncode(tokenValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("token"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetWebSocketAuthTokenResponseData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetWebSocketAuthTokenResponseData.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetWebSocketAuthTokenResponseData is" + + " not found in the empty JSON string", + GetWebSocketAuthTokenResponseData.openapiRequiredFields + .toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("token") != null && !jsonObj.get("token").isJsonNull()) + && !jsonObj.get("token").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `token` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("token").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetWebSocketAuthTokenResponseData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetWebSocketAuthTokenResponseData' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(GetWebSocketAuthTokenResponseData.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetWebSocketAuthTokenResponseData value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetWebSocketAuthTokenResponseData read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetWebSocketAuthTokenResponseData given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetWebSocketAuthTokenResponseData + * @throws IOException if the JSON string is invalid with respect to + * GetWebSocketAuthTokenResponseData + */ + public static GetWebSocketAuthTokenResponseData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetWebSocketAuthTokenResponseData.class); + } + + /** + * Convert an instance of GetWebSocketAuthTokenResponseData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/InvestmentPageResult.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/InvestmentPageResult.java new file mode 100644 index 0000000..6e9921c --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/InvestmentPageResult.java @@ -0,0 +1,337 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; +import org.hibernate.validator.constraints.*; + +/** Paginated investment list result. */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class InvestmentPageResult { + public static final String SERIALIZED_NAME_PAGE = "page"; + + @SerializedName(SERIALIZED_NAME_PAGE) + @jakarta.annotation.Nullable + private Integer page; + + public static final String SERIALIZED_NAME_SIZE = "size"; + + @SerializedName(SERIALIZED_NAME_SIZE) + @jakarta.annotation.Nullable + private Integer size; + + public static final String SERIALIZED_NAME_TOTAL = "total"; + + @SerializedName(SERIALIZED_NAME_TOTAL) + @jakarta.annotation.Nullable + private Long total; + + public static final String SERIALIZED_NAME_LIST = "list"; + + @SerializedName(SERIALIZED_NAME_LIST) + @jakarta.annotation.Nullable + private List<@Valid InvestmentPageResultListInner> _list; + + public InvestmentPageResult() {} + + public InvestmentPageResult page(@jakarta.annotation.Nullable Integer page) { + this.page = page; + return this; + } + + /** + * Current page number (1-based). + * + * @return page + */ + @jakarta.annotation.Nullable + public Integer getPage() { + return page; + } + + public void setPage(@jakarta.annotation.Nullable Integer page) { + this.page = page; + } + + public InvestmentPageResult size(@jakarta.annotation.Nullable Integer size) { + this.size = size; + return this; + } + + /** + * Page size. + * + * @return size + */ + @jakarta.annotation.Nullable + public Integer getSize() { + return size; + } + + public void setSize(@jakarta.annotation.Nullable Integer size) { + this.size = size; + } + + public InvestmentPageResult total(@jakarta.annotation.Nullable Long total) { + this.total = total; + return this; + } + + /** + * Total number of records. + * + * @return total + */ + @jakarta.annotation.Nullable + public Long getTotal() { + return total; + } + + public void setTotal(@jakarta.annotation.Nullable Long total) { + this.total = total; + } + + public InvestmentPageResult _list( + @jakarta.annotation.Nullable List<@Valid InvestmentPageResultListInner> _list) { + this._list = _list; + return this; + } + + public InvestmentPageResult addListItem(InvestmentPageResultListInner _listItem) { + if (this._list == null) { + this._list = new ArrayList<>(); + } + this._list.add(_listItem); + return this; + } + + /** + * Investments for the current page. + * + * @return _list + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid InvestmentPageResultListInner> getList() { + return _list; + } + + public void setList( + @jakarta.annotation.Nullable List<@Valid InvestmentPageResultListInner> _list) { + this._list = _list; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + InvestmentPageResult investmentPageResult = (InvestmentPageResult) o; + return Objects.equals(this.page, investmentPageResult.page) + && Objects.equals(this.size, investmentPageResult.size) + && Objects.equals(this.total, investmentPageResult.total) + && Objects.equals(this._list, investmentPageResult._list); + } + + @Override + public int hashCode() { + return Objects.hash(page, size, total, _list); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class InvestmentPageResult {\n"); + sb.append(" page: ").append(toIndentedString(page)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append(" total: ").append(toIndentedString(total)).append("\n"); + sb.append(" _list: ").append(toIndentedString(_list)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object pageValue = getPage(); + String pageValueAsString = ""; + pageValueAsString = pageValue.toString(); + sb.append("page=").append(urlEncode(pageValueAsString)).append(""); + Object sizeValue = getSize(); + String sizeValueAsString = ""; + sizeValueAsString = sizeValue.toString(); + sb.append("size=").append(urlEncode(sizeValueAsString)).append(""); + Object totalValue = getTotal(); + String totalValueAsString = ""; + totalValueAsString = totalValue.toString(); + sb.append("total=").append(urlEncode(totalValueAsString)).append(""); + Object _listValue = getList(); + String _listValueAsString = ""; + _listValueAsString = + (String) + ((Collection) _listValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("_list=").append(urlEncode(_listValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("page"); + openapiFields.add("size"); + openapiFields.add("total"); + openapiFields.add("list"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to InvestmentPageResult + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!InvestmentPageResult.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in InvestmentPageResult is not found in" + + " the empty JSON string", + InvestmentPageResult.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("list") != null && !jsonObj.get("list").isJsonNull()) { + JsonArray jsonArray_list = jsonObj.getAsJsonArray("list"); + if (jsonArray_list != null) { + // ensure the json data is an array + if (!jsonObj.get("list").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `list` to be an array in the JSON string" + + " but got `%s`", + jsonObj.get("list").toString())); + } + + // validate the optional field `list` (array) + for (int i = 0; i < jsonArray_list.size(); i++) { + InvestmentPageResultListInner.validateJsonElement(jsonArray_list.get(i)); + } + ; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!InvestmentPageResult.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'InvestmentPageResult' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(InvestmentPageResult.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, InvestmentPageResult value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public InvestmentPageResult read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of InvestmentPageResult given an JSON string + * + * @param jsonString JSON string + * @return An instance of InvestmentPageResult + * @throws IOException if the JSON string is invalid with respect to InvestmentPageResult + */ + public static InvestmentPageResult fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, InvestmentPageResult.class); + } + + /** + * Convert an instance of InvestmentPageResult to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/InvestmentPageResultListInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/InvestmentPageResultListInner.java new file mode 100644 index 0000000..0225824 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/InvestmentPageResultListInner.java @@ -0,0 +1,591 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** DeFi investment product summary (list item). */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class InvestmentPageResultListInner { + public static final String SERIALIZED_NAME_BINANCE_CHAIN_ID = "binanceChainId"; + + @SerializedName(SERIALIZED_NAME_BINANCE_CHAIN_ID) + @jakarta.annotation.Nullable + private String binanceChainId; + + public static final String SERIALIZED_NAME_DEFI_PROTOCOL_ID = "defiProtocolId"; + + @SerializedName(SERIALIZED_NAME_DEFI_PROTOCOL_ID) + @jakarta.annotation.Nullable + private String defiProtocolId; + + public static final String SERIALIZED_NAME_PROTOCOL_NAME = "protocolName"; + + @SerializedName(SERIALIZED_NAME_PROTOCOL_NAME) + @jakarta.annotation.Nullable + private String protocolName; + + public static final String SERIALIZED_NAME_INVESTMENT_ID = "investmentId"; + + @SerializedName(SERIALIZED_NAME_INVESTMENT_ID) + @jakarta.annotation.Nullable + private String investmentId; + + public static final String SERIALIZED_NAME_INVESTMENT_NAME = "investmentName"; + + @SerializedName(SERIALIZED_NAME_INVESTMENT_NAME) + @jakarta.annotation.Nullable + private String investmentName; + + public static final String SERIALIZED_NAME_INVEST_TYPE = "investType"; + + @SerializedName(SERIALIZED_NAME_INVEST_TYPE) + @jakarta.annotation.Nullable + private String investType; + + public static final String SERIALIZED_NAME_APY_TYPE = "apyType"; + + @SerializedName(SERIALIZED_NAME_APY_TYPE) + @jakarta.annotation.Nullable + private String apyType; + + public static final String SERIALIZED_NAME_APY_BPS = "apyBps"; + + @SerializedName(SERIALIZED_NAME_APY_BPS) + @jakarta.annotation.Nullable + private Long apyBps; + + public static final String SERIALIZED_NAME_APY_DISPLAY = "apyDisplay"; + + @SerializedName(SERIALIZED_NAME_APY_DISPLAY) + @jakarta.annotation.Nullable + private String apyDisplay; + + public static final String SERIALIZED_NAME_TVL = "tvl"; + + @SerializedName(SERIALIZED_NAME_TVL) + @jakarta.annotation.Nullable + private String tvl; + + public InvestmentPageResultListInner() {} + + public InvestmentPageResultListInner binanceChainId( + @jakarta.annotation.Nullable String binanceChainId) { + this.binanceChainId = binanceChainId; + return this; + } + + /** + * Binance chain ID. + * + * @return binanceChainId + */ + @jakarta.annotation.Nullable + public String getBinanceChainId() { + return binanceChainId; + } + + public void setBinanceChainId(@jakarta.annotation.Nullable String binanceChainId) { + this.binanceChainId = binanceChainId; + } + + public InvestmentPageResultListInner defiProtocolId( + @jakarta.annotation.Nullable String defiProtocolId) { + this.defiProtocolId = defiProtocolId; + return this; + } + + /** + * Parent DeFi protocol identifier. + * + * @return defiProtocolId + */ + @jakarta.annotation.Nullable + public String getDefiProtocolId() { + return defiProtocolId; + } + + public void setDefiProtocolId(@jakarta.annotation.Nullable String defiProtocolId) { + this.defiProtocolId = defiProtocolId; + } + + public InvestmentPageResultListInner protocolName( + @jakarta.annotation.Nullable String protocolName) { + this.protocolName = protocolName; + return this; + } + + /** + * Protocol display name. + * + * @return protocolName + */ + @jakarta.annotation.Nullable + public String getProtocolName() { + return protocolName; + } + + public void setProtocolName(@jakarta.annotation.Nullable String protocolName) { + this.protocolName = protocolName; + } + + public InvestmentPageResultListInner investmentId( + @jakarta.annotation.Nullable String investmentId) { + this.investmentId = investmentId; + return this; + } + + /** + * Investment product identifier (64-char hex, no `0x` prefix). Same format as the + * `investmentIds` returned by `POST /api/v1/defi/data/position/list` and + * accepted by the transaction build endpoints. + * + * @return investmentId + */ + @jakarta.annotation.Nullable + public String getInvestmentId() { + return investmentId; + } + + public void setInvestmentId(@jakarta.annotation.Nullable String investmentId) { + this.investmentId = investmentId; + } + + public InvestmentPageResultListInner investmentName( + @jakarta.annotation.Nullable String investmentName) { + this.investmentName = investmentName; + return this; + } + + /** + * Investment display name. + * + * @return investmentName + */ + @jakarta.annotation.Nullable + public String getInvestmentName() { + return investmentName; + } + + public void setInvestmentName(@jakarta.annotation.Nullable String investmentName) { + this.investmentName = investmentName; + } + + public InvestmentPageResultListInner investType( + @jakarta.annotation.Nullable String investType) { + this.investType = investType; + return this; + } + + /** + * Investment type of this product — a single string here (each product has exactly one). Note: + * the protocol-level investType (in protocol list/detail) is an array. Known values: Earn, + * LiquidityPool. + * + * @return investType + */ + @jakarta.annotation.Nullable + public String getInvestType() { + return investType; + } + + public void setInvestType(@jakarta.annotation.Nullable String investType) { + this.investType = investType; + } + + public InvestmentPageResultListInner apyType(@jakarta.annotation.Nullable String apyType) { + this.apyType = apyType; + return this; + } + + /** + * Rate yield type. Known values: APY, APR. + * + * @return apyType + */ + @jakarta.annotation.Nullable + public String getApyType() { + return apyType; + } + + public void setApyType(@jakarta.annotation.Nullable String apyType) { + this.apyType = apyType; + } + + public InvestmentPageResultListInner apyBps(@jakarta.annotation.Nullable Long apyBps) { + this.apyBps = apyBps; + return this; + } + + /** + * Annual percentage yield in basis points (1 bps = 0.01%). Integer value — use this for + * sorting / comparing / filtering, never the raw decimal. + * + * @return apyBps + */ + @jakarta.annotation.Nullable + public Long getApyBps() { + return apyBps; + } + + public void setApyBps(@jakarta.annotation.Nullable Long apyBps) { + this.apyBps = apyBps; + } + + public InvestmentPageResultListInner apyDisplay( + @jakarta.annotation.Nullable String apyDisplay) { + this.apyDisplay = apyDisplay; + return this; + } + + /** + * Pre-formatted, human-readable APY string for display (e.g. \"1,562.65%\"). Quote + * as-is; do not re-compute or transform. + * + * @return apyDisplay + */ + @jakarta.annotation.Nullable + public String getApyDisplay() { + return apyDisplay; + } + + public void setApyDisplay(@jakarta.annotation.Nullable String apyDisplay) { + this.apyDisplay = apyDisplay; + } + + public InvestmentPageResultListInner tvl(@jakarta.annotation.Nullable String tvl) { + this.tvl = tvl; + return this; + } + + /** + * Total value locked in this investment (USD). String, raw precision from the data source. + * + * @return tvl + */ + @jakarta.annotation.Nullable + public String getTvl() { + return tvl; + } + + public void setTvl(@jakarta.annotation.Nullable String tvl) { + this.tvl = tvl; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + InvestmentPageResultListInner investmentPageResultListInner = + (InvestmentPageResultListInner) o; + return Objects.equals(this.binanceChainId, investmentPageResultListInner.binanceChainId) + && Objects.equals(this.defiProtocolId, investmentPageResultListInner.defiProtocolId) + && Objects.equals(this.protocolName, investmentPageResultListInner.protocolName) + && Objects.equals(this.investmentId, investmentPageResultListInner.investmentId) + && Objects.equals(this.investmentName, investmentPageResultListInner.investmentName) + && Objects.equals(this.investType, investmentPageResultListInner.investType) + && Objects.equals(this.apyType, investmentPageResultListInner.apyType) + && Objects.equals(this.apyBps, investmentPageResultListInner.apyBps) + && Objects.equals(this.apyDisplay, investmentPageResultListInner.apyDisplay) + && Objects.equals(this.tvl, investmentPageResultListInner.tvl); + } + + @Override + public int hashCode() { + return Objects.hash( + binanceChainId, + defiProtocolId, + protocolName, + investmentId, + investmentName, + investType, + apyType, + apyBps, + apyDisplay, + tvl); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class InvestmentPageResultListInner {\n"); + sb.append(" binanceChainId: ").append(toIndentedString(binanceChainId)).append("\n"); + sb.append(" defiProtocolId: ").append(toIndentedString(defiProtocolId)).append("\n"); + sb.append(" protocolName: ").append(toIndentedString(protocolName)).append("\n"); + sb.append(" investmentId: ").append(toIndentedString(investmentId)).append("\n"); + sb.append(" investmentName: ").append(toIndentedString(investmentName)).append("\n"); + sb.append(" investType: ").append(toIndentedString(investType)).append("\n"); + sb.append(" apyType: ").append(toIndentedString(apyType)).append("\n"); + sb.append(" apyBps: ").append(toIndentedString(apyBps)).append("\n"); + sb.append(" apyDisplay: ").append(toIndentedString(apyDisplay)).append("\n"); + sb.append(" tvl: ").append(toIndentedString(tvl)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object binanceChainIdValue = getBinanceChainId(); + String binanceChainIdValueAsString = ""; + binanceChainIdValueAsString = binanceChainIdValue.toString(); + sb.append("binanceChainId=").append(urlEncode(binanceChainIdValueAsString)).append(""); + Object defiProtocolIdValue = getDefiProtocolId(); + String defiProtocolIdValueAsString = ""; + defiProtocolIdValueAsString = defiProtocolIdValue.toString(); + sb.append("defiProtocolId=").append(urlEncode(defiProtocolIdValueAsString)).append(""); + Object protocolNameValue = getProtocolName(); + String protocolNameValueAsString = ""; + protocolNameValueAsString = protocolNameValue.toString(); + sb.append("protocolName=").append(urlEncode(protocolNameValueAsString)).append(""); + Object investmentIdValue = getInvestmentId(); + String investmentIdValueAsString = ""; + investmentIdValueAsString = investmentIdValue.toString(); + sb.append("investmentId=").append(urlEncode(investmentIdValueAsString)).append(""); + Object investmentNameValue = getInvestmentName(); + String investmentNameValueAsString = ""; + investmentNameValueAsString = investmentNameValue.toString(); + sb.append("investmentName=").append(urlEncode(investmentNameValueAsString)).append(""); + Object investTypeValue = getInvestType(); + String investTypeValueAsString = ""; + investTypeValueAsString = investTypeValue.toString(); + sb.append("investType=").append(urlEncode(investTypeValueAsString)).append(""); + Object apyTypeValue = getApyType(); + String apyTypeValueAsString = ""; + apyTypeValueAsString = apyTypeValue.toString(); + sb.append("apyType=").append(urlEncode(apyTypeValueAsString)).append(""); + Object apyBpsValue = getApyBps(); + String apyBpsValueAsString = ""; + apyBpsValueAsString = apyBpsValue.toString(); + sb.append("apyBps=").append(urlEncode(apyBpsValueAsString)).append(""); + Object apyDisplayValue = getApyDisplay(); + String apyDisplayValueAsString = ""; + apyDisplayValueAsString = apyDisplayValue.toString(); + sb.append("apyDisplay=").append(urlEncode(apyDisplayValueAsString)).append(""); + Object tvlValue = getTvl(); + String tvlValueAsString = ""; + tvlValueAsString = tvlValue.toString(); + sb.append("tvl=").append(urlEncode(tvlValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("binanceChainId"); + openapiFields.add("defiProtocolId"); + openapiFields.add("protocolName"); + openapiFields.add("investmentId"); + openapiFields.add("investmentName"); + openapiFields.add("investType"); + openapiFields.add("apyType"); + openapiFields.add("apyBps"); + openapiFields.add("apyDisplay"); + openapiFields.add("tvl"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * InvestmentPageResultListInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!InvestmentPageResultListInner.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in InvestmentPageResultListInner is not" + + " found in the empty JSON string", + InvestmentPageResultListInner.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("binanceChainId") != null && !jsonObj.get("binanceChainId").isJsonNull()) + && !jsonObj.get("binanceChainId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `binanceChainId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("binanceChainId").toString())); + } + if ((jsonObj.get("defiProtocolId") != null && !jsonObj.get("defiProtocolId").isJsonNull()) + && !jsonObj.get("defiProtocolId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `defiProtocolId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("defiProtocolId").toString())); + } + if ((jsonObj.get("protocolName") != null && !jsonObj.get("protocolName").isJsonNull()) + && !jsonObj.get("protocolName").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `protocolName` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("protocolName").toString())); + } + if ((jsonObj.get("investmentId") != null && !jsonObj.get("investmentId").isJsonNull()) + && !jsonObj.get("investmentId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `investmentId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("investmentId").toString())); + } + if ((jsonObj.get("investmentName") != null && !jsonObj.get("investmentName").isJsonNull()) + && !jsonObj.get("investmentName").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `investmentName` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("investmentName").toString())); + } + if ((jsonObj.get("investType") != null && !jsonObj.get("investType").isJsonNull()) + && !jsonObj.get("investType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `investType` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("investType").toString())); + } + if ((jsonObj.get("apyType") != null && !jsonObj.get("apyType").isJsonNull()) + && !jsonObj.get("apyType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `apyType` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("apyType").toString())); + } + if ((jsonObj.get("apyDisplay") != null && !jsonObj.get("apyDisplay").isJsonNull()) + && !jsonObj.get("apyDisplay").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `apyDisplay` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("apyDisplay").toString())); + } + if ((jsonObj.get("tvl") != null && !jsonObj.get("tvl").isJsonNull()) + && !jsonObj.get("tvl").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `tvl` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("tvl").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!InvestmentPageResultListInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'InvestmentPageResultListInner' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(InvestmentPageResultListInner.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, InvestmentPageResultListInner value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public InvestmentPageResultListInner read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of InvestmentPageResultListInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of InvestmentPageResultListInner + * @throws IOException if the JSON string is invalid with respect to + * InvestmentPageResultListInner + */ + public static InvestmentPageResultListInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, InvestmentPageResultListInner.class); + } + + /** + * Convert an instance of InvestmentPageResultListInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/ListDeFiInvestmentsRequest.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/ListDeFiInvestmentsRequest.java new file mode 100644 index 0000000..8039ed9 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/ListDeFiInvestmentsRequest.java @@ -0,0 +1,635 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; +import org.hibernate.validator.constraints.*; + +/** ListDeFiInvestmentsRequest */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class ListDeFiInvestmentsRequest { + /** + * Filter by investment type. Required. Known values: `Earn`, + * `LiquidityPool`. + */ + @JsonAdapter(InvestTypeEnum.Adapter.class) + public enum InvestTypeEnum { + Earn("Earn"), + + LiquidityPool("LiquidityPool"); + + private String value; + + InvestTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static InvestTypeEnum fromValue(String value) { + for (InvestTypeEnum b : InvestTypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final InvestTypeEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public InvestTypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return InvestTypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + InvestTypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_INVEST_TYPE = "investType"; + + @SerializedName(SERIALIZED_NAME_INVEST_TYPE) + @jakarta.annotation.Nonnull + private InvestTypeEnum investType; + + public static final String SERIALIZED_NAME_DEFI_PROTOCOL_ID = "defiProtocolId"; + + @SerializedName(SERIALIZED_NAME_DEFI_PROTOCOL_ID) + @jakarta.annotation.Nullable + private String defiProtocolId; + + public static final String SERIALIZED_NAME_TOKEN_ADDRESS_LIST = "tokenAddressList"; + + @SerializedName(SERIALIZED_NAME_TOKEN_ADDRESS_LIST) + @jakarta.annotation.Nullable + private List tokenAddressList; + + public static final String SERIALIZED_NAME_BINANCE_CHAIN_ID = "binanceChainId"; + + @SerializedName(SERIALIZED_NAME_BINANCE_CHAIN_ID) + @jakarta.annotation.Nullable + private String binanceChainId; + + public static final String SERIALIZED_NAME_SORT_FIELD = "sortField"; + + @SerializedName(SERIALIZED_NAME_SORT_FIELD) + @jakarta.annotation.Nullable + private String sortField; + + /** Sort direction. */ + @JsonAdapter(SortDirectionEnum.Adapter.class) + public enum SortDirectionEnum { + ASC("ASC"), + + DESC("DESC"); + + private String value; + + SortDirectionEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static SortDirectionEnum fromValue(String value) { + for (SortDirectionEnum b : SortDirectionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final SortDirectionEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public SortDirectionEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return SortDirectionEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + SortDirectionEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_SORT_DIRECTION = "sortDirection"; + + @SerializedName(SERIALIZED_NAME_SORT_DIRECTION) + @jakarta.annotation.Nullable + private SortDirectionEnum sortDirection; + + public static final String SERIALIZED_NAME_PAGE = "page"; + + @SerializedName(SERIALIZED_NAME_PAGE) + @jakarta.annotation.Nullable + private Integer page; + + public static final String SERIALIZED_NAME_SIZE = "size"; + + @SerializedName(SERIALIZED_NAME_SIZE) + @jakarta.annotation.Nullable + private Integer size; + + public ListDeFiInvestmentsRequest() {} + + public ListDeFiInvestmentsRequest investType( + @jakarta.annotation.Nonnull InvestTypeEnum investType) { + this.investType = investType; + return this; + } + + /** + * Filter by investment type. Required. Known values: `Earn`, + * `LiquidityPool`. + * + * @return investType + */ + @jakarta.annotation.Nonnull + @NotNull + public InvestTypeEnum getInvestType() { + return investType; + } + + public void setInvestType(@jakarta.annotation.Nonnull InvestTypeEnum investType) { + this.investType = investType; + } + + public ListDeFiInvestmentsRequest defiProtocolId( + @jakarta.annotation.Nullable String defiProtocolId) { + this.defiProtocolId = defiProtocolId; + return this; + } + + /** + * Filter by DeFi protocol ID. + * + * @return defiProtocolId + */ + @jakarta.annotation.Nullable + public String getDefiProtocolId() { + return defiProtocolId; + } + + public void setDefiProtocolId(@jakarta.annotation.Nullable String defiProtocolId) { + this.defiProtocolId = defiProtocolId; + } + + public ListDeFiInvestmentsRequest tokenAddressList( + @jakarta.annotation.Nullable List tokenAddressList) { + this.tokenAddressList = tokenAddressList; + return this; + } + + public ListDeFiInvestmentsRequest addTokenAddressListItem(String tokenAddressListItem) { + if (this.tokenAddressList == null) { + this.tokenAddressList = new ArrayList<>(); + } + this.tokenAddressList.add(tokenAddressListItem); + return this; + } + + /** + * Filter by token addresses. + * + * @return tokenAddressList + */ + @jakarta.annotation.Nullable + public List getTokenAddressList() { + return tokenAddressList; + } + + public void setTokenAddressList(@jakarta.annotation.Nullable List tokenAddressList) { + this.tokenAddressList = tokenAddressList; + } + + public ListDeFiInvestmentsRequest binanceChainId( + @jakarta.annotation.Nullable String binanceChainId) { + this.binanceChainId = binanceChainId; + return this; + } + + /** + * Filter by Binance chain ID (e.g. \"56\"=BSC). + * + * @return binanceChainId + */ + @jakarta.annotation.Nullable + public String getBinanceChainId() { + return binanceChainId; + } + + public void setBinanceChainId(@jakarta.annotation.Nullable String binanceChainId) { + this.binanceChainId = binanceChainId; + } + + public ListDeFiInvestmentsRequest sortField(@jakarta.annotation.Nullable String sortField) { + this.sortField = sortField; + return this; + } + + /** + * Field to sort by. Only two values are accepted: `tvl`, `apy`. Note: + * sorting by APY uses `apy` (the server-side field name), even though the response + * exposes `apyBps` / `apyDisplay`. Other values are not supported. + * + * @return sortField + */ + @jakarta.annotation.Nullable + public String getSortField() { + return sortField; + } + + public void setSortField(@jakarta.annotation.Nullable String sortField) { + this.sortField = sortField; + } + + public ListDeFiInvestmentsRequest sortDirection( + @jakarta.annotation.Nullable SortDirectionEnum sortDirection) { + this.sortDirection = sortDirection; + return this; + } + + /** + * Sort direction. + * + * @return sortDirection + */ + @jakarta.annotation.Nullable + public SortDirectionEnum getSortDirection() { + return sortDirection; + } + + public void setSortDirection(@jakarta.annotation.Nullable SortDirectionEnum sortDirection) { + this.sortDirection = sortDirection; + } + + public ListDeFiInvestmentsRequest page(@jakarta.annotation.Nullable Integer page) { + this.page = page; + return this; + } + + /** + * Page number (1-based). minimum: 1 + * + * @return page + */ + @jakarta.annotation.Nullable + @Min(1) + public Integer getPage() { + return page; + } + + public void setPage(@jakarta.annotation.Nullable Integer page) { + this.page = page; + } + + public ListDeFiInvestmentsRequest size(@jakarta.annotation.Nullable Integer size) { + this.size = size; + return this; + } + + /** + * Page size. Max: 100. minimum: 1 maximum: 100 + * + * @return size + */ + @jakarta.annotation.Nullable + @Min(1) + @Max(100) + public Integer getSize() { + return size; + } + + public void setSize(@jakarta.annotation.Nullable Integer size) { + this.size = size; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ListDeFiInvestmentsRequest listDeFiInvestmentsRequest = (ListDeFiInvestmentsRequest) o; + return Objects.equals(this.investType, listDeFiInvestmentsRequest.investType) + && Objects.equals(this.defiProtocolId, listDeFiInvestmentsRequest.defiProtocolId) + && Objects.equals( + this.tokenAddressList, listDeFiInvestmentsRequest.tokenAddressList) + && Objects.equals(this.binanceChainId, listDeFiInvestmentsRequest.binanceChainId) + && Objects.equals(this.sortField, listDeFiInvestmentsRequest.sortField) + && Objects.equals(this.sortDirection, listDeFiInvestmentsRequest.sortDirection) + && Objects.equals(this.page, listDeFiInvestmentsRequest.page) + && Objects.equals(this.size, listDeFiInvestmentsRequest.size); + } + + @Override + public int hashCode() { + return Objects.hash( + investType, + defiProtocolId, + tokenAddressList, + binanceChainId, + sortField, + sortDirection, + page, + size); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ListDeFiInvestmentsRequest {\n"); + sb.append(" investType: ").append(toIndentedString(investType)).append("\n"); + sb.append(" defiProtocolId: ").append(toIndentedString(defiProtocolId)).append("\n"); + sb.append(" tokenAddressList: ").append(toIndentedString(tokenAddressList)).append("\n"); + sb.append(" binanceChainId: ").append(toIndentedString(binanceChainId)).append("\n"); + sb.append(" sortField: ").append(toIndentedString(sortField)).append("\n"); + sb.append(" sortDirection: ").append(toIndentedString(sortDirection)).append("\n"); + sb.append(" page: ").append(toIndentedString(page)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object investTypeValue = getInvestType(); + String investTypeValueAsString = ""; + investTypeValueAsString = investTypeValue.toString(); + sb.append("investType=").append(urlEncode(investTypeValueAsString)).append(""); + Object defiProtocolIdValue = getDefiProtocolId(); + String defiProtocolIdValueAsString = ""; + defiProtocolIdValueAsString = defiProtocolIdValue.toString(); + sb.append("defiProtocolId=").append(urlEncode(defiProtocolIdValueAsString)).append(""); + Object tokenAddressListValue = getTokenAddressList(); + String tokenAddressListValueAsString = ""; + tokenAddressListValueAsString = + (String) + ((Collection) tokenAddressListValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("tokenAddressList=").append(urlEncode(tokenAddressListValueAsString)).append(""); + Object binanceChainIdValue = getBinanceChainId(); + String binanceChainIdValueAsString = ""; + binanceChainIdValueAsString = binanceChainIdValue.toString(); + sb.append("binanceChainId=").append(urlEncode(binanceChainIdValueAsString)).append(""); + Object sortFieldValue = getSortField(); + String sortFieldValueAsString = ""; + sortFieldValueAsString = sortFieldValue.toString(); + sb.append("sortField=").append(urlEncode(sortFieldValueAsString)).append(""); + Object sortDirectionValue = getSortDirection(); + String sortDirectionValueAsString = ""; + sortDirectionValueAsString = sortDirectionValue.toString(); + sb.append("sortDirection=").append(urlEncode(sortDirectionValueAsString)).append(""); + Object pageValue = getPage(); + String pageValueAsString = ""; + pageValueAsString = pageValue.toString(); + sb.append("page=").append(urlEncode(pageValueAsString)).append(""); + Object sizeValue = getSize(); + String sizeValueAsString = ""; + sizeValueAsString = sizeValue.toString(); + sb.append("size=").append(urlEncode(sizeValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("investType"); + openapiFields.add("defiProtocolId"); + openapiFields.add("tokenAddressList"); + openapiFields.add("binanceChainId"); + openapiFields.add("sortField"); + openapiFields.add("sortDirection"); + openapiFields.add("page"); + openapiFields.add("size"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("investType"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ListDeFiInvestmentsRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ListDeFiInvestmentsRequest.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in ListDeFiInvestmentsRequest is not" + + " found in the empty JSON string", + ListDeFiInvestmentsRequest.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ListDeFiInvestmentsRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("investType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `investType` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("investType").toString())); + } + // validate the required field `investType` + InvestTypeEnum.validateJsonElement(jsonObj.get("investType")); + if ((jsonObj.get("defiProtocolId") != null && !jsonObj.get("defiProtocolId").isJsonNull()) + && !jsonObj.get("defiProtocolId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `defiProtocolId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("defiProtocolId").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("tokenAddressList") != null + && !jsonObj.get("tokenAddressList").isJsonNull() + && !jsonObj.get("tokenAddressList").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `tokenAddressList` to be an array in the JSON" + + " string but got `%s`", + jsonObj.get("tokenAddressList").toString())); + } + if ((jsonObj.get("binanceChainId") != null && !jsonObj.get("binanceChainId").isJsonNull()) + && !jsonObj.get("binanceChainId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `binanceChainId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("binanceChainId").toString())); + } + if ((jsonObj.get("sortField") != null && !jsonObj.get("sortField").isJsonNull()) + && !jsonObj.get("sortField").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `sortField` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("sortField").toString())); + } + if ((jsonObj.get("sortDirection") != null && !jsonObj.get("sortDirection").isJsonNull()) + && !jsonObj.get("sortDirection").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `sortDirection` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("sortDirection").toString())); + } + // validate the optional field `sortDirection` + if (jsonObj.get("sortDirection") != null && !jsonObj.get("sortDirection").isJsonNull()) { + SortDirectionEnum.validateJsonElement(jsonObj.get("sortDirection")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ListDeFiInvestmentsRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ListDeFiInvestmentsRequest' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(ListDeFiInvestmentsRequest.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ListDeFiInvestmentsRequest value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ListDeFiInvestmentsRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of ListDeFiInvestmentsRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of ListDeFiInvestmentsRequest + * @throws IOException if the JSON string is invalid with respect to ListDeFiInvestmentsRequest + */ + public static ListDeFiInvestmentsRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ListDeFiInvestmentsRequest.class); + } + + /** + * Convert an instance of ListDeFiInvestmentsRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/ListDeFiInvestmentsResponse.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/ListDeFiInvestmentsResponse.java new file mode 100644 index 0000000..80c7b35 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/ListDeFiInvestmentsResponse.java @@ -0,0 +1,347 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** ListDeFiInvestmentsResponse */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class ListDeFiInvestmentsResponse { + public static final String SERIALIZED_NAME_CODE = "code"; + + @SerializedName(SERIALIZED_NAME_CODE) + @jakarta.annotation.Nullable + private Integer code; + + public static final String SERIALIZED_NAME_MSG = "msg"; + + @SerializedName(SERIALIZED_NAME_MSG) + @jakarta.annotation.Nullable + private String msg; + + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + @jakarta.annotation.Nullable + private ListDeFiInvestmentsResponseData data; + + public static final String SERIALIZED_NAME_TIMESTAMP = "timestamp"; + + @SerializedName(SERIALIZED_NAME_TIMESTAMP) + @jakarta.annotation.Nullable + private Long timestamp; + + public static final String SERIALIZED_NAME_SUCCESS = "success"; + + @SerializedName(SERIALIZED_NAME_SUCCESS) + @jakarta.annotation.Nullable + private Boolean success; + + public ListDeFiInvestmentsResponse() {} + + public ListDeFiInvestmentsResponse code(@jakarta.annotation.Nullable Integer code) { + this.code = code; + return this; + } + + /** + * Business status code. 0 indicates success. + * + * @return code + */ + @jakarta.annotation.Nullable + public Integer getCode() { + return code; + } + + public void setCode(@jakarta.annotation.Nullable Integer code) { + this.code = code; + } + + public ListDeFiInvestmentsResponse msg(@jakarta.annotation.Nullable String msg) { + this.msg = msg; + return this; + } + + /** + * Human-readable status message. + * + * @return msg + */ + @jakarta.annotation.Nullable + public String getMsg() { + return msg; + } + + public void setMsg(@jakarta.annotation.Nullable String msg) { + this.msg = msg; + } + + public ListDeFiInvestmentsResponse data( + @jakarta.annotation.Nullable ListDeFiInvestmentsResponseData data) { + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @jakarta.annotation.Nullable + @Valid + public ListDeFiInvestmentsResponseData getData() { + return data; + } + + public void setData(@jakarta.annotation.Nullable ListDeFiInvestmentsResponseData data) { + this.data = data; + } + + public ListDeFiInvestmentsResponse timestamp(@jakarta.annotation.Nullable Long timestamp) { + this.timestamp = timestamp; + return this; + } + + /** + * Server timestamp in milliseconds. + * + * @return timestamp + */ + @jakarta.annotation.Nullable + public Long getTimestamp() { + return timestamp; + } + + public void setTimestamp(@jakarta.annotation.Nullable Long timestamp) { + this.timestamp = timestamp; + } + + public ListDeFiInvestmentsResponse success(@jakarta.annotation.Nullable Boolean success) { + this.success = success; + return this; + } + + /** + * Whether the request succeeded (mirrors `code == 0`). + * + * @return success + */ + @jakarta.annotation.Nullable + public Boolean getSuccess() { + return success; + } + + public void setSuccess(@jakarta.annotation.Nullable Boolean success) { + this.success = success; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ListDeFiInvestmentsResponse listDeFiInvestmentsResponse = (ListDeFiInvestmentsResponse) o; + return Objects.equals(this.code, listDeFiInvestmentsResponse.code) + && Objects.equals(this.msg, listDeFiInvestmentsResponse.msg) + && Objects.equals(this.data, listDeFiInvestmentsResponse.data) + && Objects.equals(this.timestamp, listDeFiInvestmentsResponse.timestamp) + && Objects.equals(this.success, listDeFiInvestmentsResponse.success); + } + + @Override + public int hashCode() { + return Objects.hash(code, msg, data, timestamp, success); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ListDeFiInvestmentsResponse {\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" msg: ").append(toIndentedString(msg)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" timestamp: ").append(toIndentedString(timestamp)).append("\n"); + sb.append(" success: ").append(toIndentedString(success)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object codeValue = getCode(); + String codeValueAsString = ""; + codeValueAsString = codeValue.toString(); + sb.append("code=").append(urlEncode(codeValueAsString)).append(""); + Object msgValue = getMsg(); + String msgValueAsString = ""; + msgValueAsString = msgValue.toString(); + sb.append("msg=").append(urlEncode(msgValueAsString)).append(""); + Object dataValue = getData(); + String dataValueAsString = ""; + dataValueAsString = dataValue.toString(); + sb.append("data=").append(urlEncode(dataValueAsString)).append(""); + Object timestampValue = getTimestamp(); + String timestampValueAsString = ""; + timestampValueAsString = timestampValue.toString(); + sb.append("timestamp=").append(urlEncode(timestampValueAsString)).append(""); + Object successValue = getSuccess(); + String successValueAsString = ""; + successValueAsString = successValue.toString(); + sb.append("success=").append(urlEncode(successValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("code"); + openapiFields.add("msg"); + openapiFields.add("data"); + openapiFields.add("timestamp"); + openapiFields.add("success"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * ListDeFiInvestmentsResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ListDeFiInvestmentsResponse.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in ListDeFiInvestmentsResponse is not" + + " found in the empty JSON string", + ListDeFiInvestmentsResponse.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("msg") != null && !jsonObj.get("msg").isJsonNull()) + && !jsonObj.get("msg").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `msg` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("msg").toString())); + } + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + ListDeFiInvestmentsResponseData.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ListDeFiInvestmentsResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ListDeFiInvestmentsResponse' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(ListDeFiInvestmentsResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ListDeFiInvestmentsResponse value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ListDeFiInvestmentsResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of ListDeFiInvestmentsResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of ListDeFiInvestmentsResponse + * @throws IOException if the JSON string is invalid with respect to ListDeFiInvestmentsResponse + */ + public static ListDeFiInvestmentsResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ListDeFiInvestmentsResponse.class); + } + + /** + * Convert an instance of ListDeFiInvestmentsResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/ListDeFiInvestmentsResponseData.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/ListDeFiInvestmentsResponseData.java new file mode 100644 index 0000000..0a812b2 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/ListDeFiInvestmentsResponseData.java @@ -0,0 +1,343 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; +import org.hibernate.validator.constraints.*; + +/** Paginated investment list result. */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class ListDeFiInvestmentsResponseData { + public static final String SERIALIZED_NAME_PAGE = "page"; + + @SerializedName(SERIALIZED_NAME_PAGE) + @jakarta.annotation.Nullable + private Integer page; + + public static final String SERIALIZED_NAME_SIZE = "size"; + + @SerializedName(SERIALIZED_NAME_SIZE) + @jakarta.annotation.Nullable + private Integer size; + + public static final String SERIALIZED_NAME_TOTAL = "total"; + + @SerializedName(SERIALIZED_NAME_TOTAL) + @jakarta.annotation.Nullable + private Long total; + + public static final String SERIALIZED_NAME_LIST = "list"; + + @SerializedName(SERIALIZED_NAME_LIST) + @jakarta.annotation.Nullable + private List<@Valid InvestmentPageResultListInner> _list; + + public ListDeFiInvestmentsResponseData() {} + + public ListDeFiInvestmentsResponseData page(@jakarta.annotation.Nullable Integer page) { + this.page = page; + return this; + } + + /** + * Current page number (1-based). + * + * @return page + */ + @jakarta.annotation.Nullable + public Integer getPage() { + return page; + } + + public void setPage(@jakarta.annotation.Nullable Integer page) { + this.page = page; + } + + public ListDeFiInvestmentsResponseData size(@jakarta.annotation.Nullable Integer size) { + this.size = size; + return this; + } + + /** + * Page size. + * + * @return size + */ + @jakarta.annotation.Nullable + public Integer getSize() { + return size; + } + + public void setSize(@jakarta.annotation.Nullable Integer size) { + this.size = size; + } + + public ListDeFiInvestmentsResponseData total(@jakarta.annotation.Nullable Long total) { + this.total = total; + return this; + } + + /** + * Total number of records. + * + * @return total + */ + @jakarta.annotation.Nullable + public Long getTotal() { + return total; + } + + public void setTotal(@jakarta.annotation.Nullable Long total) { + this.total = total; + } + + public ListDeFiInvestmentsResponseData _list( + @jakarta.annotation.Nullable List<@Valid InvestmentPageResultListInner> _list) { + this._list = _list; + return this; + } + + public ListDeFiInvestmentsResponseData addListItem(InvestmentPageResultListInner _listItem) { + if (this._list == null) { + this._list = new ArrayList<>(); + } + this._list.add(_listItem); + return this; + } + + /** + * Investments for the current page. + * + * @return _list + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid InvestmentPageResultListInner> getList() { + return _list; + } + + public void setList( + @jakarta.annotation.Nullable List<@Valid InvestmentPageResultListInner> _list) { + this._list = _list; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ListDeFiInvestmentsResponseData listDeFiInvestmentsResponseData = + (ListDeFiInvestmentsResponseData) o; + return Objects.equals(this.page, listDeFiInvestmentsResponseData.page) + && Objects.equals(this.size, listDeFiInvestmentsResponseData.size) + && Objects.equals(this.total, listDeFiInvestmentsResponseData.total) + && Objects.equals(this._list, listDeFiInvestmentsResponseData._list); + } + + @Override + public int hashCode() { + return Objects.hash(page, size, total, _list); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ListDeFiInvestmentsResponseData {\n"); + sb.append(" page: ").append(toIndentedString(page)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append(" total: ").append(toIndentedString(total)).append("\n"); + sb.append(" _list: ").append(toIndentedString(_list)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object pageValue = getPage(); + String pageValueAsString = ""; + pageValueAsString = pageValue.toString(); + sb.append("page=").append(urlEncode(pageValueAsString)).append(""); + Object sizeValue = getSize(); + String sizeValueAsString = ""; + sizeValueAsString = sizeValue.toString(); + sb.append("size=").append(urlEncode(sizeValueAsString)).append(""); + Object totalValue = getTotal(); + String totalValueAsString = ""; + totalValueAsString = totalValue.toString(); + sb.append("total=").append(urlEncode(totalValueAsString)).append(""); + Object _listValue = getList(); + String _listValueAsString = ""; + _listValueAsString = + (String) + ((Collection) _listValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("_list=").append(urlEncode(_listValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("page"); + openapiFields.add("size"); + openapiFields.add("total"); + openapiFields.add("list"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * ListDeFiInvestmentsResponseData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ListDeFiInvestmentsResponseData.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in ListDeFiInvestmentsResponseData is not" + + " found in the empty JSON string", + ListDeFiInvestmentsResponseData.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("list") != null && !jsonObj.get("list").isJsonNull()) { + JsonArray jsonArray_list = jsonObj.getAsJsonArray("list"); + if (jsonArray_list != null) { + // ensure the json data is an array + if (!jsonObj.get("list").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `list` to be an array in the JSON string" + + " but got `%s`", + jsonObj.get("list").toString())); + } + + // validate the optional field `list` (array) + for (int i = 0; i < jsonArray_list.size(); i++) { + InvestmentPageResultListInner.validateJsonElement(jsonArray_list.get(i)); + } + ; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ListDeFiInvestmentsResponseData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ListDeFiInvestmentsResponseData' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(ListDeFiInvestmentsResponseData.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ListDeFiInvestmentsResponseData value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ListDeFiInvestmentsResponseData read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of ListDeFiInvestmentsResponseData given an JSON string + * + * @param jsonString JSON string + * @return An instance of ListDeFiInvestmentsResponseData + * @throws IOException if the JSON string is invalid with respect to + * ListDeFiInvestmentsResponseData + */ + public static ListDeFiInvestmentsResponseData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ListDeFiInvestmentsResponseData.class); + } + + /** + * Convert an instance of ListDeFiInvestmentsResponseData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/ListDeFiProtocolsRequest.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/ListDeFiProtocolsRequest.java new file mode 100644 index 0000000..63a4022 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/ListDeFiProtocolsRequest.java @@ -0,0 +1,514 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** ListDeFiProtocolsRequest */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class ListDeFiProtocolsRequest { + public static final String SERIALIZED_NAME_BINANCE_CHAIN_ID = "binanceChainId"; + + @SerializedName(SERIALIZED_NAME_BINANCE_CHAIN_ID) + @jakarta.annotation.Nullable + private String binanceChainId; + + /** Filter by investment type. Known values: `Earn`, `LiquidityPool`. */ + @JsonAdapter(InvestTypeEnum.Adapter.class) + public enum InvestTypeEnum { + Earn("Earn"), + + LiquidityPool("LiquidityPool"); + + private String value; + + InvestTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static InvestTypeEnum fromValue(String value) { + for (InvestTypeEnum b : InvestTypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final InvestTypeEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public InvestTypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return InvestTypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + InvestTypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_INVEST_TYPE = "investType"; + + @SerializedName(SERIALIZED_NAME_INVEST_TYPE) + @jakarta.annotation.Nullable + private InvestTypeEnum investType; + + public static final String SERIALIZED_NAME_SORT_FIELD = "sortField"; + + @SerializedName(SERIALIZED_NAME_SORT_FIELD) + @jakarta.annotation.Nullable + private String sortField; + + /** Sort direction. */ + @JsonAdapter(SortDirectionEnum.Adapter.class) + public enum SortDirectionEnum { + ASC("ASC"), + + DESC("DESC"); + + private String value; + + SortDirectionEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static SortDirectionEnum fromValue(String value) { + for (SortDirectionEnum b : SortDirectionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final SortDirectionEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public SortDirectionEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return SortDirectionEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + SortDirectionEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_SORT_DIRECTION = "sortDirection"; + + @SerializedName(SERIALIZED_NAME_SORT_DIRECTION) + @jakarta.annotation.Nullable + private SortDirectionEnum sortDirection; + + public static final String SERIALIZED_NAME_PAGE = "page"; + + @SerializedName(SERIALIZED_NAME_PAGE) + @jakarta.annotation.Nullable + private Integer page; + + public static final String SERIALIZED_NAME_SIZE = "size"; + + @SerializedName(SERIALIZED_NAME_SIZE) + @jakarta.annotation.Nullable + private Integer size; + + public ListDeFiProtocolsRequest() {} + + public ListDeFiProtocolsRequest binanceChainId( + @jakarta.annotation.Nullable String binanceChainId) { + this.binanceChainId = binanceChainId; + return this; + } + + /** + * Filter by Binance chain ID (e.g. \"56\"=BSC). + * + * @return binanceChainId + */ + @jakarta.annotation.Nullable + public String getBinanceChainId() { + return binanceChainId; + } + + public void setBinanceChainId(@jakarta.annotation.Nullable String binanceChainId) { + this.binanceChainId = binanceChainId; + } + + public ListDeFiProtocolsRequest investType( + @jakarta.annotation.Nullable InvestTypeEnum investType) { + this.investType = investType; + return this; + } + + /** + * Filter by investment type. Known values: `Earn`, `LiquidityPool`. + * + * @return investType + */ + @jakarta.annotation.Nullable + public InvestTypeEnum getInvestType() { + return investType; + } + + public void setInvestType(@jakarta.annotation.Nullable InvestTypeEnum investType) { + this.investType = investType; + } + + public ListDeFiProtocolsRequest sortField(@jakarta.annotation.Nullable String sortField) { + this.sortField = sortField; + return this; + } + + /** + * Field to sort by. Only two values are accepted: `tvl`, `apy`. Note: + * sorting by APY uses `apy` (the server-side field name), even though the response + * exposes `apyBps` / `apyDisplay`. Other values are not supported. + * + * @return sortField + */ + @jakarta.annotation.Nullable + public String getSortField() { + return sortField; + } + + public void setSortField(@jakarta.annotation.Nullable String sortField) { + this.sortField = sortField; + } + + public ListDeFiProtocolsRequest sortDirection( + @jakarta.annotation.Nullable SortDirectionEnum sortDirection) { + this.sortDirection = sortDirection; + return this; + } + + /** + * Sort direction. + * + * @return sortDirection + */ + @jakarta.annotation.Nullable + public SortDirectionEnum getSortDirection() { + return sortDirection; + } + + public void setSortDirection(@jakarta.annotation.Nullable SortDirectionEnum sortDirection) { + this.sortDirection = sortDirection; + } + + public ListDeFiProtocolsRequest page(@jakarta.annotation.Nullable Integer page) { + this.page = page; + return this; + } + + /** + * Page number (1-based). minimum: 1 + * + * @return page + */ + @jakarta.annotation.Nullable + @Min(1) + public Integer getPage() { + return page; + } + + public void setPage(@jakarta.annotation.Nullable Integer page) { + this.page = page; + } + + public ListDeFiProtocolsRequest size(@jakarta.annotation.Nullable Integer size) { + this.size = size; + return this; + } + + /** + * Page size. Max: 200. minimum: 1 maximum: 200 + * + * @return size + */ + @jakarta.annotation.Nullable + @Min(1) + @Max(200) + public Integer getSize() { + return size; + } + + public void setSize(@jakarta.annotation.Nullable Integer size) { + this.size = size; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ListDeFiProtocolsRequest listDeFiProtocolsRequest = (ListDeFiProtocolsRequest) o; + return Objects.equals(this.binanceChainId, listDeFiProtocolsRequest.binanceChainId) + && Objects.equals(this.investType, listDeFiProtocolsRequest.investType) + && Objects.equals(this.sortField, listDeFiProtocolsRequest.sortField) + && Objects.equals(this.sortDirection, listDeFiProtocolsRequest.sortDirection) + && Objects.equals(this.page, listDeFiProtocolsRequest.page) + && Objects.equals(this.size, listDeFiProtocolsRequest.size); + } + + @Override + public int hashCode() { + return Objects.hash(binanceChainId, investType, sortField, sortDirection, page, size); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ListDeFiProtocolsRequest {\n"); + sb.append(" binanceChainId: ").append(toIndentedString(binanceChainId)).append("\n"); + sb.append(" investType: ").append(toIndentedString(investType)).append("\n"); + sb.append(" sortField: ").append(toIndentedString(sortField)).append("\n"); + sb.append(" sortDirection: ").append(toIndentedString(sortDirection)).append("\n"); + sb.append(" page: ").append(toIndentedString(page)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object binanceChainIdValue = getBinanceChainId(); + String binanceChainIdValueAsString = ""; + binanceChainIdValueAsString = binanceChainIdValue.toString(); + sb.append("binanceChainId=").append(urlEncode(binanceChainIdValueAsString)).append(""); + Object investTypeValue = getInvestType(); + String investTypeValueAsString = ""; + investTypeValueAsString = investTypeValue.toString(); + sb.append("investType=").append(urlEncode(investTypeValueAsString)).append(""); + Object sortFieldValue = getSortField(); + String sortFieldValueAsString = ""; + sortFieldValueAsString = sortFieldValue.toString(); + sb.append("sortField=").append(urlEncode(sortFieldValueAsString)).append(""); + Object sortDirectionValue = getSortDirection(); + String sortDirectionValueAsString = ""; + sortDirectionValueAsString = sortDirectionValue.toString(); + sb.append("sortDirection=").append(urlEncode(sortDirectionValueAsString)).append(""); + Object pageValue = getPage(); + String pageValueAsString = ""; + pageValueAsString = pageValue.toString(); + sb.append("page=").append(urlEncode(pageValueAsString)).append(""); + Object sizeValue = getSize(); + String sizeValueAsString = ""; + sizeValueAsString = sizeValue.toString(); + sb.append("size=").append(urlEncode(sizeValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("binanceChainId"); + openapiFields.add("investType"); + openapiFields.add("sortField"); + openapiFields.add("sortDirection"); + openapiFields.add("page"); + openapiFields.add("size"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ListDeFiProtocolsRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ListDeFiProtocolsRequest.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in ListDeFiProtocolsRequest is not found" + + " in the empty JSON string", + ListDeFiProtocolsRequest.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("binanceChainId") != null && !jsonObj.get("binanceChainId").isJsonNull()) + && !jsonObj.get("binanceChainId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `binanceChainId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("binanceChainId").toString())); + } + if ((jsonObj.get("investType") != null && !jsonObj.get("investType").isJsonNull()) + && !jsonObj.get("investType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `investType` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("investType").toString())); + } + // validate the optional field `investType` + if (jsonObj.get("investType") != null && !jsonObj.get("investType").isJsonNull()) { + InvestTypeEnum.validateJsonElement(jsonObj.get("investType")); + } + if ((jsonObj.get("sortField") != null && !jsonObj.get("sortField").isJsonNull()) + && !jsonObj.get("sortField").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `sortField` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("sortField").toString())); + } + if ((jsonObj.get("sortDirection") != null && !jsonObj.get("sortDirection").isJsonNull()) + && !jsonObj.get("sortDirection").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `sortDirection` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("sortDirection").toString())); + } + // validate the optional field `sortDirection` + if (jsonObj.get("sortDirection") != null && !jsonObj.get("sortDirection").isJsonNull()) { + SortDirectionEnum.validateJsonElement(jsonObj.get("sortDirection")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ListDeFiProtocolsRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ListDeFiProtocolsRequest' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(ListDeFiProtocolsRequest.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ListDeFiProtocolsRequest value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ListDeFiProtocolsRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of ListDeFiProtocolsRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of ListDeFiProtocolsRequest + * @throws IOException if the JSON string is invalid with respect to ListDeFiProtocolsRequest + */ + public static ListDeFiProtocolsRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ListDeFiProtocolsRequest.class); + } + + /** + * Convert an instance of ListDeFiProtocolsRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/ListDeFiProtocolsResponse.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/ListDeFiProtocolsResponse.java new file mode 100644 index 0000000..4a7f36e --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/ListDeFiProtocolsResponse.java @@ -0,0 +1,346 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** ListDeFiProtocolsResponse */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class ListDeFiProtocolsResponse { + public static final String SERIALIZED_NAME_CODE = "code"; + + @SerializedName(SERIALIZED_NAME_CODE) + @jakarta.annotation.Nullable + private Integer code; + + public static final String SERIALIZED_NAME_MSG = "msg"; + + @SerializedName(SERIALIZED_NAME_MSG) + @jakarta.annotation.Nullable + private String msg; + + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + @jakarta.annotation.Nullable + private ListDeFiProtocolsResponseData data; + + public static final String SERIALIZED_NAME_TIMESTAMP = "timestamp"; + + @SerializedName(SERIALIZED_NAME_TIMESTAMP) + @jakarta.annotation.Nullable + private Long timestamp; + + public static final String SERIALIZED_NAME_SUCCESS = "success"; + + @SerializedName(SERIALIZED_NAME_SUCCESS) + @jakarta.annotation.Nullable + private Boolean success; + + public ListDeFiProtocolsResponse() {} + + public ListDeFiProtocolsResponse code(@jakarta.annotation.Nullable Integer code) { + this.code = code; + return this; + } + + /** + * Business status code. 0 indicates success. + * + * @return code + */ + @jakarta.annotation.Nullable + public Integer getCode() { + return code; + } + + public void setCode(@jakarta.annotation.Nullable Integer code) { + this.code = code; + } + + public ListDeFiProtocolsResponse msg(@jakarta.annotation.Nullable String msg) { + this.msg = msg; + return this; + } + + /** + * Human-readable status message. + * + * @return msg + */ + @jakarta.annotation.Nullable + public String getMsg() { + return msg; + } + + public void setMsg(@jakarta.annotation.Nullable String msg) { + this.msg = msg; + } + + public ListDeFiProtocolsResponse data( + @jakarta.annotation.Nullable ListDeFiProtocolsResponseData data) { + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @jakarta.annotation.Nullable + @Valid + public ListDeFiProtocolsResponseData getData() { + return data; + } + + public void setData(@jakarta.annotation.Nullable ListDeFiProtocolsResponseData data) { + this.data = data; + } + + public ListDeFiProtocolsResponse timestamp(@jakarta.annotation.Nullable Long timestamp) { + this.timestamp = timestamp; + return this; + } + + /** + * Server timestamp in milliseconds. + * + * @return timestamp + */ + @jakarta.annotation.Nullable + public Long getTimestamp() { + return timestamp; + } + + public void setTimestamp(@jakarta.annotation.Nullable Long timestamp) { + this.timestamp = timestamp; + } + + public ListDeFiProtocolsResponse success(@jakarta.annotation.Nullable Boolean success) { + this.success = success; + return this; + } + + /** + * Whether the request succeeded (mirrors `code == 0`). + * + * @return success + */ + @jakarta.annotation.Nullable + public Boolean getSuccess() { + return success; + } + + public void setSuccess(@jakarta.annotation.Nullable Boolean success) { + this.success = success; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ListDeFiProtocolsResponse listDeFiProtocolsResponse = (ListDeFiProtocolsResponse) o; + return Objects.equals(this.code, listDeFiProtocolsResponse.code) + && Objects.equals(this.msg, listDeFiProtocolsResponse.msg) + && Objects.equals(this.data, listDeFiProtocolsResponse.data) + && Objects.equals(this.timestamp, listDeFiProtocolsResponse.timestamp) + && Objects.equals(this.success, listDeFiProtocolsResponse.success); + } + + @Override + public int hashCode() { + return Objects.hash(code, msg, data, timestamp, success); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ListDeFiProtocolsResponse {\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" msg: ").append(toIndentedString(msg)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" timestamp: ").append(toIndentedString(timestamp)).append("\n"); + sb.append(" success: ").append(toIndentedString(success)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object codeValue = getCode(); + String codeValueAsString = ""; + codeValueAsString = codeValue.toString(); + sb.append("code=").append(urlEncode(codeValueAsString)).append(""); + Object msgValue = getMsg(); + String msgValueAsString = ""; + msgValueAsString = msgValue.toString(); + sb.append("msg=").append(urlEncode(msgValueAsString)).append(""); + Object dataValue = getData(); + String dataValueAsString = ""; + dataValueAsString = dataValue.toString(); + sb.append("data=").append(urlEncode(dataValueAsString)).append(""); + Object timestampValue = getTimestamp(); + String timestampValueAsString = ""; + timestampValueAsString = timestampValue.toString(); + sb.append("timestamp=").append(urlEncode(timestampValueAsString)).append(""); + Object successValue = getSuccess(); + String successValueAsString = ""; + successValueAsString = successValue.toString(); + sb.append("success=").append(urlEncode(successValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("code"); + openapiFields.add("msg"); + openapiFields.add("data"); + openapiFields.add("timestamp"); + openapiFields.add("success"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ListDeFiProtocolsResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ListDeFiProtocolsResponse.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in ListDeFiProtocolsResponse is not found" + + " in the empty JSON string", + ListDeFiProtocolsResponse.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("msg") != null && !jsonObj.get("msg").isJsonNull()) + && !jsonObj.get("msg").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `msg` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("msg").toString())); + } + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + ListDeFiProtocolsResponseData.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ListDeFiProtocolsResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ListDeFiProtocolsResponse' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(ListDeFiProtocolsResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ListDeFiProtocolsResponse value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ListDeFiProtocolsResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of ListDeFiProtocolsResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of ListDeFiProtocolsResponse + * @throws IOException if the JSON string is invalid with respect to ListDeFiProtocolsResponse + */ + public static ListDeFiProtocolsResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ListDeFiProtocolsResponse.class); + } + + /** + * Convert an instance of ListDeFiProtocolsResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/ListDeFiProtocolsResponseData.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/ListDeFiProtocolsResponseData.java new file mode 100644 index 0000000..5805f4d --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/ListDeFiProtocolsResponseData.java @@ -0,0 +1,343 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; +import org.hibernate.validator.constraints.*; + +/** Paginated protocol list result. */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class ListDeFiProtocolsResponseData { + public static final String SERIALIZED_NAME_PAGE = "page"; + + @SerializedName(SERIALIZED_NAME_PAGE) + @jakarta.annotation.Nullable + private Integer page; + + public static final String SERIALIZED_NAME_SIZE = "size"; + + @SerializedName(SERIALIZED_NAME_SIZE) + @jakarta.annotation.Nullable + private Integer size; + + public static final String SERIALIZED_NAME_TOTAL = "total"; + + @SerializedName(SERIALIZED_NAME_TOTAL) + @jakarta.annotation.Nullable + private Long total; + + public static final String SERIALIZED_NAME_LIST = "list"; + + @SerializedName(SERIALIZED_NAME_LIST) + @jakarta.annotation.Nullable + private List<@Valid ProtocolPageResultListInner> _list; + + public ListDeFiProtocolsResponseData() {} + + public ListDeFiProtocolsResponseData page(@jakarta.annotation.Nullable Integer page) { + this.page = page; + return this; + } + + /** + * Current page number (1-based). + * + * @return page + */ + @jakarta.annotation.Nullable + public Integer getPage() { + return page; + } + + public void setPage(@jakarta.annotation.Nullable Integer page) { + this.page = page; + } + + public ListDeFiProtocolsResponseData size(@jakarta.annotation.Nullable Integer size) { + this.size = size; + return this; + } + + /** + * Page size. + * + * @return size + */ + @jakarta.annotation.Nullable + public Integer getSize() { + return size; + } + + public void setSize(@jakarta.annotation.Nullable Integer size) { + this.size = size; + } + + public ListDeFiProtocolsResponseData total(@jakarta.annotation.Nullable Long total) { + this.total = total; + return this; + } + + /** + * Total number of records. + * + * @return total + */ + @jakarta.annotation.Nullable + public Long getTotal() { + return total; + } + + public void setTotal(@jakarta.annotation.Nullable Long total) { + this.total = total; + } + + public ListDeFiProtocolsResponseData _list( + @jakarta.annotation.Nullable List<@Valid ProtocolPageResultListInner> _list) { + this._list = _list; + return this; + } + + public ListDeFiProtocolsResponseData addListItem(ProtocolPageResultListInner _listItem) { + if (this._list == null) { + this._list = new ArrayList<>(); + } + this._list.add(_listItem); + return this; + } + + /** + * Protocols for the current page. + * + * @return _list + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid ProtocolPageResultListInner> getList() { + return _list; + } + + public void setList( + @jakarta.annotation.Nullable List<@Valid ProtocolPageResultListInner> _list) { + this._list = _list; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ListDeFiProtocolsResponseData listDeFiProtocolsResponseData = + (ListDeFiProtocolsResponseData) o; + return Objects.equals(this.page, listDeFiProtocolsResponseData.page) + && Objects.equals(this.size, listDeFiProtocolsResponseData.size) + && Objects.equals(this.total, listDeFiProtocolsResponseData.total) + && Objects.equals(this._list, listDeFiProtocolsResponseData._list); + } + + @Override + public int hashCode() { + return Objects.hash(page, size, total, _list); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ListDeFiProtocolsResponseData {\n"); + sb.append(" page: ").append(toIndentedString(page)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append(" total: ").append(toIndentedString(total)).append("\n"); + sb.append(" _list: ").append(toIndentedString(_list)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object pageValue = getPage(); + String pageValueAsString = ""; + pageValueAsString = pageValue.toString(); + sb.append("page=").append(urlEncode(pageValueAsString)).append(""); + Object sizeValue = getSize(); + String sizeValueAsString = ""; + sizeValueAsString = sizeValue.toString(); + sb.append("size=").append(urlEncode(sizeValueAsString)).append(""); + Object totalValue = getTotal(); + String totalValueAsString = ""; + totalValueAsString = totalValue.toString(); + sb.append("total=").append(urlEncode(totalValueAsString)).append(""); + Object _listValue = getList(); + String _listValueAsString = ""; + _listValueAsString = + (String) + ((Collection) _listValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("_list=").append(urlEncode(_listValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("page"); + openapiFields.add("size"); + openapiFields.add("total"); + openapiFields.add("list"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * ListDeFiProtocolsResponseData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ListDeFiProtocolsResponseData.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in ListDeFiProtocolsResponseData is not" + + " found in the empty JSON string", + ListDeFiProtocolsResponseData.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("list") != null && !jsonObj.get("list").isJsonNull()) { + JsonArray jsonArray_list = jsonObj.getAsJsonArray("list"); + if (jsonArray_list != null) { + // ensure the json data is an array + if (!jsonObj.get("list").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `list` to be an array in the JSON string" + + " but got `%s`", + jsonObj.get("list").toString())); + } + + // validate the optional field `list` (array) + for (int i = 0; i < jsonArray_list.size(); i++) { + ProtocolPageResultListInner.validateJsonElement(jsonArray_list.get(i)); + } + ; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ListDeFiProtocolsResponseData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ListDeFiProtocolsResponseData' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(ListDeFiProtocolsResponseData.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ListDeFiProtocolsResponseData value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ListDeFiProtocolsResponseData read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of ListDeFiProtocolsResponseData given an JSON string + * + * @param jsonString JSON string + * @return An instance of ListDeFiProtocolsResponseData + * @throws IOException if the JSON string is invalid with respect to + * ListDeFiProtocolsResponseData + */ + public static ListDeFiProtocolsResponseData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ListDeFiProtocolsResponseData.class); + } + + /** + * Convert an instance of ListDeFiProtocolsResponseData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/LpAddCalculateResponse.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/LpAddCalculateResponse.java new file mode 100644 index 0000000..87982bd --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/LpAddCalculateResponse.java @@ -0,0 +1,307 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** + * Result of `/transaction/lp-add/calculate`. Returns the paired token amounts derived + * from the single input token. This endpoint is pure computation — it does not touch the chain and + * does not deduct any fee. + */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class LpAddCalculateResponse { + public static final String SERIALIZED_NAME_INPUT_TOKEN_AMOUNT = "inputTokenAmount"; + + @SerializedName(SERIALIZED_NAME_INPUT_TOKEN_AMOUNT) + @jakarta.annotation.Nullable + private String inputTokenAmount; + + public static final String SERIALIZED_NAME_PAIRED_TOKEN_ADDRESS = "pairedTokenAddress"; + + @SerializedName(SERIALIZED_NAME_PAIRED_TOKEN_ADDRESS) + @jakarta.annotation.Nullable + private String pairedTokenAddress; + + public static final String SERIALIZED_NAME_PAIRED_TOKEN_AMOUNT = "pairedTokenAmount"; + + @SerializedName(SERIALIZED_NAME_PAIRED_TOKEN_AMOUNT) + @jakarta.annotation.Nullable + private String pairedTokenAmount; + + public LpAddCalculateResponse() {} + + public LpAddCalculateResponse inputTokenAmount( + @jakarta.annotation.Nullable String inputTokenAmount) { + this.inputTokenAmount = inputTokenAmount; + return this; + } + + /** + * Echo of the input token amount (human-readable). + * + * @return inputTokenAmount + */ + @jakarta.annotation.Nullable + public String getInputTokenAmount() { + return inputTokenAmount; + } + + public void setInputTokenAmount(@jakarta.annotation.Nullable String inputTokenAmount) { + this.inputTokenAmount = inputTokenAmount; + } + + public LpAddCalculateResponse pairedTokenAddress( + @jakarta.annotation.Nullable String pairedTokenAddress) { + this.pairedTokenAddress = pairedTokenAddress; + return this; + } + + /** + * The paired token contract address derived from the investment. + * + * @return pairedTokenAddress + */ + @jakarta.annotation.Nullable + public String getPairedTokenAddress() { + return pairedTokenAddress; + } + + public void setPairedTokenAddress(@jakarta.annotation.Nullable String pairedTokenAddress) { + this.pairedTokenAddress = pairedTokenAddress; + } + + public LpAddCalculateResponse pairedTokenAmount( + @jakarta.annotation.Nullable String pairedTokenAmount) { + this.pairedTokenAmount = pairedTokenAmount; + return this; + } + + /** + * Calculated paired token amount (human-readable). + * + * @return pairedTokenAmount + */ + @jakarta.annotation.Nullable + public String getPairedTokenAmount() { + return pairedTokenAmount; + } + + public void setPairedTokenAmount(@jakarta.annotation.Nullable String pairedTokenAmount) { + this.pairedTokenAmount = pairedTokenAmount; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + LpAddCalculateResponse lpAddCalculateResponse = (LpAddCalculateResponse) o; + return Objects.equals(this.inputTokenAmount, lpAddCalculateResponse.inputTokenAmount) + && Objects.equals( + this.pairedTokenAddress, lpAddCalculateResponse.pairedTokenAddress) + && Objects.equals(this.pairedTokenAmount, lpAddCalculateResponse.pairedTokenAmount); + } + + @Override + public int hashCode() { + return Objects.hash(inputTokenAmount, pairedTokenAddress, pairedTokenAmount); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class LpAddCalculateResponse {\n"); + sb.append(" inputTokenAmount: ").append(toIndentedString(inputTokenAmount)).append("\n"); + sb.append(" pairedTokenAddress: ") + .append(toIndentedString(pairedTokenAddress)) + .append("\n"); + sb.append(" pairedTokenAmount: ").append(toIndentedString(pairedTokenAmount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object inputTokenAmountValue = getInputTokenAmount(); + String inputTokenAmountValueAsString = ""; + inputTokenAmountValueAsString = inputTokenAmountValue.toString(); + sb.append("inputTokenAmount=").append(urlEncode(inputTokenAmountValueAsString)).append(""); + Object pairedTokenAddressValue = getPairedTokenAddress(); + String pairedTokenAddressValueAsString = ""; + pairedTokenAddressValueAsString = pairedTokenAddressValue.toString(); + sb.append("pairedTokenAddress=") + .append(urlEncode(pairedTokenAddressValueAsString)) + .append(""); + Object pairedTokenAmountValue = getPairedTokenAmount(); + String pairedTokenAmountValueAsString = ""; + pairedTokenAmountValueAsString = pairedTokenAmountValue.toString(); + sb.append("pairedTokenAmount=") + .append(urlEncode(pairedTokenAmountValueAsString)) + .append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("inputTokenAmount"); + openapiFields.add("pairedTokenAddress"); + openapiFields.add("pairedTokenAmount"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to LpAddCalculateResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!LpAddCalculateResponse.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in LpAddCalculateResponse is not found in" + + " the empty JSON string", + LpAddCalculateResponse.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("inputTokenAmount") != null + && !jsonObj.get("inputTokenAmount").isJsonNull()) + && !jsonObj.get("inputTokenAmount").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `inputTokenAmount` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("inputTokenAmount").toString())); + } + if ((jsonObj.get("pairedTokenAddress") != null + && !jsonObj.get("pairedTokenAddress").isJsonNull()) + && !jsonObj.get("pairedTokenAddress").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `pairedTokenAddress` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("pairedTokenAddress").toString())); + } + if ((jsonObj.get("pairedTokenAmount") != null + && !jsonObj.get("pairedTokenAmount").isJsonNull()) + && !jsonObj.get("pairedTokenAmount").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `pairedTokenAmount` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("pairedTokenAmount").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!LpAddCalculateResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'LpAddCalculateResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(LpAddCalculateResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, LpAddCalculateResponse value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public LpAddCalculateResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of LpAddCalculateResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of LpAddCalculateResponse + * @throws IOException if the JSON string is invalid with respect to LpAddCalculateResponse + */ + public static LpAddCalculateResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, LpAddCalculateResponse.class); + } + + /** + * Convert an instance of LpAddCalculateResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/OrderType.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/OrderType.java index 210a0fc..212dbfd 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/OrderType.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/OrderType.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/PlatformId.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/PlatformId.java index e428db4..1d3e9e2 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/PlatformId.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/PlatformId.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/PoolDetailResp.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/PoolDetailResp.java new file mode 100644 index 0000000..2624ce0 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/PoolDetailResp.java @@ -0,0 +1,749 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** + * Pool-level metadata. Fields are null when not applicable to the pool type (e.g. + * `tickSpacing`/`hooks` only for concentrated-liquidity pools). + */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class PoolDetailResp { + public static final String SERIALIZED_NAME_EXPIRY = "expiry"; + + @SerializedName(SERIALIZED_NAME_EXPIRY) + @jakarta.annotation.Nullable + private Long expiry; + + public static final String SERIALIZED_NAME_FEE_TIER = "feeTier"; + + @SerializedName(SERIALIZED_NAME_FEE_TIER) + @jakarta.annotation.Nullable + private String feeTier; + + public static final String SERIALIZED_NAME_LP_FEE = "lpFee"; + + @SerializedName(SERIALIZED_NAME_LP_FEE) + @jakarta.annotation.Nullable + private String lpFee; + + public static final String SERIALIZED_NAME_TICK_SPACING = "tickSpacing"; + + @SerializedName(SERIALIZED_NAME_TICK_SPACING) + @jakarta.annotation.Nullable + private String tickSpacing; + + public static final String SERIALIZED_NAME_IS_DYNAMIC_FEE = "isDynamicFee"; + + @SerializedName(SERIALIZED_NAME_IS_DYNAMIC_FEE) + @jakarta.annotation.Nullable + private Boolean isDynamicFee; + + public static final String SERIALIZED_NAME_HOOK_FEE = "hookFee"; + + @SerializedName(SERIALIZED_NAME_HOOK_FEE) + @jakarta.annotation.Nullable + private String hookFee; + + public static final String SERIALIZED_NAME_TICK = "tick"; + + @SerializedName(SERIALIZED_NAME_TICK) + @jakarta.annotation.Nullable + private String tick; + + public static final String SERIALIZED_NAME_HOOKS = "hooks"; + + @SerializedName(SERIALIZED_NAME_HOOKS) + @jakarta.annotation.Nullable + private String hooks; + + public static final String SERIALIZED_NAME_SWAP_PROTOCOL_FEE = "swapProtocolFee"; + + @SerializedName(SERIALIZED_NAME_SWAP_PROTOCOL_FEE) + @jakarta.annotation.Nullable + private String swapProtocolFee; + + public static final String SERIALIZED_NAME_PARAMETERS = "parameters"; + + @SerializedName(SERIALIZED_NAME_PARAMETERS) + @jakarta.annotation.Nullable + private String parameters; + + public static final String SERIALIZED_NAME_FEE = "fee"; + + @SerializedName(SERIALIZED_NAME_FEE) + @jakarta.annotation.Nullable + private String fee; + + public static final String SERIALIZED_NAME_SPOKE_NAME = "spokeName"; + + @SerializedName(SERIALIZED_NAME_SPOKE_NAME) + @jakarta.annotation.Nullable + private String spokeName; + + public static final String SERIALIZED_NAME_RESERVE_COUNT = "reserveCount"; + + @SerializedName(SERIALIZED_NAME_RESERVE_COUNT) + @jakarta.annotation.Nullable + private String reserveCount; + + public static final String SERIALIZED_NAME_VAULT_NAME = "vaultName"; + + @SerializedName(SERIALIZED_NAME_VAULT_NAME) + @jakarta.annotation.Nullable + private String vaultName; + + public PoolDetailResp() {} + + public PoolDetailResp expiry(@jakarta.annotation.Nullable Long expiry) { + this.expiry = expiry; + return this; + } + + /** + * Pool expiry timestamp (Unix seconds). Null if no expiry. + * + * @return expiry + */ + @jakarta.annotation.Nullable + public Long getExpiry() { + return expiry; + } + + public void setExpiry(@jakarta.annotation.Nullable Long expiry) { + this.expiry = expiry; + } + + public PoolDetailResp feeTier(@jakarta.annotation.Nullable String feeTier) { + this.feeTier = feeTier; + return this; + } + + /** + * Fee tier. For PancakeSwap V3-style pools this is the encoded fee (e.g. \"500\" + * = 0.05%); for V4-style pools a flag-encoded value. + * + * @return feeTier + */ + @jakarta.annotation.Nullable + public String getFeeTier() { + return feeTier; + } + + public void setFeeTier(@jakarta.annotation.Nullable String feeTier) { + this.feeTier = feeTier; + } + + public PoolDetailResp lpFee(@jakarta.annotation.Nullable String lpFee) { + this.lpFee = lpFee; + return this; + } + + /** + * LP fee portion in basis points (V4-style pools). + * + * @return lpFee + */ + @jakarta.annotation.Nullable + public String getLpFee() { + return lpFee; + } + + public void setLpFee(@jakarta.annotation.Nullable String lpFee) { + this.lpFee = lpFee; + } + + public PoolDetailResp tickSpacing(@jakarta.annotation.Nullable String tickSpacing) { + this.tickSpacing = tickSpacing; + return this; + } + + /** + * Tick spacing for concentrated-liquidity pools. + * + * @return tickSpacing + */ + @jakarta.annotation.Nullable + public String getTickSpacing() { + return tickSpacing; + } + + public void setTickSpacing(@jakarta.annotation.Nullable String tickSpacing) { + this.tickSpacing = tickSpacing; + } + + public PoolDetailResp isDynamicFee(@jakarta.annotation.Nullable Boolean isDynamicFee) { + this.isDynamicFee = isDynamicFee; + return this; + } + + /** + * Whether the pool uses a dynamic (hook-managed) fee (V4-style pools). + * + * @return isDynamicFee + */ + @jakarta.annotation.Nullable + public Boolean getIsDynamicFee() { + return isDynamicFee; + } + + public void setIsDynamicFee(@jakarta.annotation.Nullable Boolean isDynamicFee) { + this.isDynamicFee = isDynamicFee; + } + + public PoolDetailResp hookFee(@jakarta.annotation.Nullable String hookFee) { + this.hookFee = hookFee; + return this; + } + + /** + * Hook fee portion in basis points (V4-style pools). + * + * @return hookFee + */ + @jakarta.annotation.Nullable + public String getHookFee() { + return hookFee; + } + + public void setHookFee(@jakarta.annotation.Nullable String hookFee) { + this.hookFee = hookFee; + } + + public PoolDetailResp tick(@jakarta.annotation.Nullable String tick) { + this.tick = tick; + return this; + } + + /** + * Current pool tick (V4-style pools). + * + * @return tick + */ + @jakarta.annotation.Nullable + public String getTick() { + return tick; + } + + public void setTick(@jakarta.annotation.Nullable String tick) { + this.tick = tick; + } + + public PoolDetailResp hooks(@jakarta.annotation.Nullable String hooks) { + this.hooks = hooks; + return this; + } + + /** + * Hook contract address (V4-style pools). Zero address when no hook. + * + * @return hooks + */ + @jakarta.annotation.Nullable + public String getHooks() { + return hooks; + } + + public void setHooks(@jakarta.annotation.Nullable String hooks) { + this.hooks = hooks; + } + + public PoolDetailResp swapProtocolFee(@jakarta.annotation.Nullable String swapProtocolFee) { + this.swapProtocolFee = swapProtocolFee; + return this; + } + + /** + * Protocol fee on swaps in basis points (V4-style pools). + * + * @return swapProtocolFee + */ + @jakarta.annotation.Nullable + public String getSwapProtocolFee() { + return swapProtocolFee; + } + + public void setSwapProtocolFee(@jakarta.annotation.Nullable String swapProtocolFee) { + this.swapProtocolFee = swapProtocolFee; + } + + public PoolDetailResp parameters(@jakarta.annotation.Nullable String parameters) { + this.parameters = parameters; + return this; + } + + /** + * Encoded pool parameters, e.g. `0x` + 64-char hex (V4-style pools). + * + * @return parameters + */ + @jakarta.annotation.Nullable + public String getParameters() { + return parameters; + } + + public void setParameters(@jakarta.annotation.Nullable String parameters) { + this.parameters = parameters; + } + + public PoolDetailResp fee(@jakarta.annotation.Nullable String fee) { + this.fee = fee; + return this; + } + + /** + * Total pool fee in basis points (V4-style pools). + * + * @return fee + */ + @jakarta.annotation.Nullable + public String getFee() { + return fee; + } + + public void setFee(@jakarta.annotation.Nullable String fee) { + this.fee = fee; + } + + public PoolDetailResp spokeName(@jakarta.annotation.Nullable String spokeName) { + this.spokeName = spokeName; + return this; + } + + /** + * Spoke pool name (e.g. across-protocol bridges). + * + * @return spokeName + */ + @jakarta.annotation.Nullable + public String getSpokeName() { + return spokeName; + } + + public void setSpokeName(@jakarta.annotation.Nullable String spokeName) { + this.spokeName = spokeName; + } + + public PoolDetailResp reserveCount(@jakarta.annotation.Nullable String reserveCount) { + this.reserveCount = reserveCount; + return this; + } + + /** + * Number of reserves in multi-asset pools. + * + * @return reserveCount + */ + @jakarta.annotation.Nullable + public String getReserveCount() { + return reserveCount; + } + + public void setReserveCount(@jakarta.annotation.Nullable String reserveCount) { + this.reserveCount = reserveCount; + } + + public PoolDetailResp vaultName(@jakarta.annotation.Nullable String vaultName) { + this.vaultName = vaultName; + return this; + } + + /** + * Vault name for vault-style protocols. + * + * @return vaultName + */ + @jakarta.annotation.Nullable + public String getVaultName() { + return vaultName; + } + + public void setVaultName(@jakarta.annotation.Nullable String vaultName) { + this.vaultName = vaultName; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PoolDetailResp poolDetailResp = (PoolDetailResp) o; + return Objects.equals(this.expiry, poolDetailResp.expiry) + && Objects.equals(this.feeTier, poolDetailResp.feeTier) + && Objects.equals(this.lpFee, poolDetailResp.lpFee) + && Objects.equals(this.tickSpacing, poolDetailResp.tickSpacing) + && Objects.equals(this.isDynamicFee, poolDetailResp.isDynamicFee) + && Objects.equals(this.hookFee, poolDetailResp.hookFee) + && Objects.equals(this.tick, poolDetailResp.tick) + && Objects.equals(this.hooks, poolDetailResp.hooks) + && Objects.equals(this.swapProtocolFee, poolDetailResp.swapProtocolFee) + && Objects.equals(this.parameters, poolDetailResp.parameters) + && Objects.equals(this.fee, poolDetailResp.fee) + && Objects.equals(this.spokeName, poolDetailResp.spokeName) + && Objects.equals(this.reserveCount, poolDetailResp.reserveCount) + && Objects.equals(this.vaultName, poolDetailResp.vaultName); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash( + expiry, + feeTier, + lpFee, + tickSpacing, + isDynamicFee, + hookFee, + tick, + hooks, + swapProtocolFee, + parameters, + fee, + spokeName, + reserveCount, + vaultName); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PoolDetailResp {\n"); + sb.append(" expiry: ").append(toIndentedString(expiry)).append("\n"); + sb.append(" feeTier: ").append(toIndentedString(feeTier)).append("\n"); + sb.append(" lpFee: ").append(toIndentedString(lpFee)).append("\n"); + sb.append(" tickSpacing: ").append(toIndentedString(tickSpacing)).append("\n"); + sb.append(" isDynamicFee: ").append(toIndentedString(isDynamicFee)).append("\n"); + sb.append(" hookFee: ").append(toIndentedString(hookFee)).append("\n"); + sb.append(" tick: ").append(toIndentedString(tick)).append("\n"); + sb.append(" hooks: ").append(toIndentedString(hooks)).append("\n"); + sb.append(" swapProtocolFee: ").append(toIndentedString(swapProtocolFee)).append("\n"); + sb.append(" parameters: ").append(toIndentedString(parameters)).append("\n"); + sb.append(" fee: ").append(toIndentedString(fee)).append("\n"); + sb.append(" spokeName: ").append(toIndentedString(spokeName)).append("\n"); + sb.append(" reserveCount: ").append(toIndentedString(reserveCount)).append("\n"); + sb.append(" vaultName: ").append(toIndentedString(vaultName)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object expiryValue = getExpiry(); + String expiryValueAsString = ""; + expiryValueAsString = expiryValue.toString(); + sb.append("expiry=").append(urlEncode(expiryValueAsString)).append(""); + Object feeTierValue = getFeeTier(); + String feeTierValueAsString = ""; + feeTierValueAsString = feeTierValue.toString(); + sb.append("feeTier=").append(urlEncode(feeTierValueAsString)).append(""); + Object lpFeeValue = getLpFee(); + String lpFeeValueAsString = ""; + lpFeeValueAsString = lpFeeValue.toString(); + sb.append("lpFee=").append(urlEncode(lpFeeValueAsString)).append(""); + Object tickSpacingValue = getTickSpacing(); + String tickSpacingValueAsString = ""; + tickSpacingValueAsString = tickSpacingValue.toString(); + sb.append("tickSpacing=").append(urlEncode(tickSpacingValueAsString)).append(""); + Object isDynamicFeeValue = getIsDynamicFee(); + String isDynamicFeeValueAsString = ""; + isDynamicFeeValueAsString = isDynamicFeeValue.toString(); + sb.append("isDynamicFee=").append(urlEncode(isDynamicFeeValueAsString)).append(""); + Object hookFeeValue = getHookFee(); + String hookFeeValueAsString = ""; + hookFeeValueAsString = hookFeeValue.toString(); + sb.append("hookFee=").append(urlEncode(hookFeeValueAsString)).append(""); + Object tickValue = getTick(); + String tickValueAsString = ""; + tickValueAsString = tickValue.toString(); + sb.append("tick=").append(urlEncode(tickValueAsString)).append(""); + Object hooksValue = getHooks(); + String hooksValueAsString = ""; + hooksValueAsString = hooksValue.toString(); + sb.append("hooks=").append(urlEncode(hooksValueAsString)).append(""); + Object swapProtocolFeeValue = getSwapProtocolFee(); + String swapProtocolFeeValueAsString = ""; + swapProtocolFeeValueAsString = swapProtocolFeeValue.toString(); + sb.append("swapProtocolFee=").append(urlEncode(swapProtocolFeeValueAsString)).append(""); + Object parametersValue = getParameters(); + String parametersValueAsString = ""; + parametersValueAsString = parametersValue.toString(); + sb.append("parameters=").append(urlEncode(parametersValueAsString)).append(""); + Object feeValue = getFee(); + String feeValueAsString = ""; + feeValueAsString = feeValue.toString(); + sb.append("fee=").append(urlEncode(feeValueAsString)).append(""); + Object spokeNameValue = getSpokeName(); + String spokeNameValueAsString = ""; + spokeNameValueAsString = spokeNameValue.toString(); + sb.append("spokeName=").append(urlEncode(spokeNameValueAsString)).append(""); + Object reserveCountValue = getReserveCount(); + String reserveCountValueAsString = ""; + reserveCountValueAsString = reserveCountValue.toString(); + sb.append("reserveCount=").append(urlEncode(reserveCountValueAsString)).append(""); + Object vaultNameValue = getVaultName(); + String vaultNameValueAsString = ""; + vaultNameValueAsString = vaultNameValue.toString(); + sb.append("vaultName=").append(urlEncode(vaultNameValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("expiry"); + openapiFields.add("feeTier"); + openapiFields.add("lpFee"); + openapiFields.add("tickSpacing"); + openapiFields.add("isDynamicFee"); + openapiFields.add("hookFee"); + openapiFields.add("tick"); + openapiFields.add("hooks"); + openapiFields.add("swapProtocolFee"); + openapiFields.add("parameters"); + openapiFields.add("fee"); + openapiFields.add("spokeName"); + openapiFields.add("reserveCount"); + openapiFields.add("vaultName"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PoolDetailResp + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PoolDetailResp.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in PoolDetailResp is not found in the" + + " empty JSON string", + PoolDetailResp.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("feeTier") != null && !jsonObj.get("feeTier").isJsonNull()) + && !jsonObj.get("feeTier").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `feeTier` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("feeTier").toString())); + } + if ((jsonObj.get("lpFee") != null && !jsonObj.get("lpFee").isJsonNull()) + && !jsonObj.get("lpFee").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `lpFee` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("lpFee").toString())); + } + if ((jsonObj.get("tickSpacing") != null && !jsonObj.get("tickSpacing").isJsonNull()) + && !jsonObj.get("tickSpacing").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `tickSpacing` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("tickSpacing").toString())); + } + if ((jsonObj.get("hookFee") != null && !jsonObj.get("hookFee").isJsonNull()) + && !jsonObj.get("hookFee").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `hookFee` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("hookFee").toString())); + } + if ((jsonObj.get("tick") != null && !jsonObj.get("tick").isJsonNull()) + && !jsonObj.get("tick").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `tick` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("tick").toString())); + } + if ((jsonObj.get("hooks") != null && !jsonObj.get("hooks").isJsonNull()) + && !jsonObj.get("hooks").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `hooks` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("hooks").toString())); + } + if ((jsonObj.get("swapProtocolFee") != null && !jsonObj.get("swapProtocolFee").isJsonNull()) + && !jsonObj.get("swapProtocolFee").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `swapProtocolFee` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("swapProtocolFee").toString())); + } + if ((jsonObj.get("parameters") != null && !jsonObj.get("parameters").isJsonNull()) + && !jsonObj.get("parameters").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `parameters` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("parameters").toString())); + } + if ((jsonObj.get("fee") != null && !jsonObj.get("fee").isJsonNull()) + && !jsonObj.get("fee").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `fee` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("fee").toString())); + } + if ((jsonObj.get("spokeName") != null && !jsonObj.get("spokeName").isJsonNull()) + && !jsonObj.get("spokeName").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `spokeName` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("spokeName").toString())); + } + if ((jsonObj.get("reserveCount") != null && !jsonObj.get("reserveCount").isJsonNull()) + && !jsonObj.get("reserveCount").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `reserveCount` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("reserveCount").toString())); + } + if ((jsonObj.get("vaultName") != null && !jsonObj.get("vaultName").isJsonNull()) + && !jsonObj.get("vaultName").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `vaultName` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("vaultName").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PoolDetailResp.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PoolDetailResp' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(PoolDetailResp.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, PoolDetailResp value) throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PoolDetailResp read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of PoolDetailResp given an JSON string + * + * @param jsonString JSON string + * @return An instance of PoolDetailResp + * @throws IOException if the JSON string is invalid with respect to PoolDetailResp + */ + public static PoolDetailResp fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PoolDetailResp.class); + } + + /** + * Convert an instance of PoolDetailResp to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/PoolResp.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/PoolResp.java new file mode 100644 index 0000000..7f3411e --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/PoolResp.java @@ -0,0 +1,430 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** A pool containing position collections. */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class PoolResp { + public static final String SERIALIZED_NAME_BN_POOL_ID = "bnPoolId"; + + @SerializedName(SERIALIZED_NAME_BN_POOL_ID) + @jakarta.annotation.Nullable + private String bnPoolId; + + public static final String SERIALIZED_NAME_POOL_CA = "poolCa"; + + @SerializedName(SERIALIZED_NAME_POOL_CA) + @jakarta.annotation.Nullable + private String poolCa; + + public static final String SERIALIZED_NAME_POOL_TYPE = "poolType"; + + @SerializedName(SERIALIZED_NAME_POOL_TYPE) + @jakarta.annotation.Nullable + private String poolType; + + public static final String SERIALIZED_NAME_POSITION_COLLECTION_LIST = "positionCollectionList"; + + @SerializedName(SERIALIZED_NAME_POSITION_COLLECTION_LIST) + @jakarta.annotation.Nullable + private List<@Valid PoolRespPositionCollectionListInner> positionCollectionList; + + public static final String SERIALIZED_NAME_POOL_DETAIL = "poolDetail"; + + @SerializedName(SERIALIZED_NAME_POOL_DETAIL) + @jakarta.annotation.Nullable + private PoolRespPoolDetail poolDetail; + + public PoolResp() {} + + public PoolResp bnPoolId(@jakarta.annotation.Nullable String bnPoolId) { + this.bnPoolId = bnPoolId; + return this; + } + + /** + * Pool identifier (`0x` + 64-char hex). + * + * @return bnPoolId + */ + @jakarta.annotation.Nullable + public String getBnPoolId() { + return bnPoolId; + } + + public void setBnPoolId(@jakarta.annotation.Nullable String bnPoolId) { + this.bnPoolId = bnPoolId; + } + + public PoolResp poolCa(@jakarta.annotation.Nullable String poolCa) { + this.poolCa = poolCa; + return this; + } + + /** + * Pool contract address. + * + * @return poolCa + */ + @jakarta.annotation.Nullable + public String getPoolCa() { + return poolCa; + } + + public void setPoolCa(@jakarta.annotation.Nullable String poolCa) { + this.poolCa = poolCa; + } + + public PoolResp poolType(@jakarta.annotation.Nullable String poolType) { + this.poolType = poolType; + return this; + } + + /** + * Pool type. Complete value set: `Lending` (supply/borrow market), `Staked` + * (native staking), `Yield` (yield vault / receipt token), `Deposit` (fixed + * deposit), `Rewards` (reward claims, e.g. PancakeSwap Infinity), `Liquidity + * Pool` (AMM / concentrated liquidity), `Farming` (MasterChef farming), + * `Locked` (locked staking with unlock time), `Vesting` (vesting schedule). + * Treat unknown values as generic display. + * + * @return poolType + */ + @jakarta.annotation.Nullable + public String getPoolType() { + return poolType; + } + + public void setPoolType(@jakarta.annotation.Nullable String poolType) { + this.poolType = poolType; + } + + public PoolResp positionCollectionList( + @jakarta.annotation.Nullable + List<@Valid PoolRespPositionCollectionListInner> positionCollectionList) { + this.positionCollectionList = positionCollectionList; + return this; + } + + public PoolResp addPositionCollectionListItem( + PoolRespPositionCollectionListInner positionCollectionListItem) { + if (this.positionCollectionList == null) { + this.positionCollectionList = new ArrayList<>(); + } + this.positionCollectionList.add(positionCollectionListItem); + return this; + } + + /** + * Get positionCollectionList + * + * @return positionCollectionList + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid PoolRespPositionCollectionListInner> getPositionCollectionList() { + return positionCollectionList; + } + + public void setPositionCollectionList( + @jakarta.annotation.Nullable + List<@Valid PoolRespPositionCollectionListInner> positionCollectionList) { + this.positionCollectionList = positionCollectionList; + } + + public PoolResp poolDetail(@jakarta.annotation.Nullable PoolRespPoolDetail poolDetail) { + this.poolDetail = poolDetail; + return this; + } + + /** + * Get poolDetail + * + * @return poolDetail + */ + @jakarta.annotation.Nullable + @Valid + public PoolRespPoolDetail getPoolDetail() { + return poolDetail; + } + + public void setPoolDetail(@jakarta.annotation.Nullable PoolRespPoolDetail poolDetail) { + this.poolDetail = poolDetail; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PoolResp poolResp = (PoolResp) o; + return Objects.equals(this.bnPoolId, poolResp.bnPoolId) + && Objects.equals(this.poolCa, poolResp.poolCa) + && Objects.equals(this.poolType, poolResp.poolType) + && Objects.equals(this.positionCollectionList, poolResp.positionCollectionList) + && Objects.equals(this.poolDetail, poolResp.poolDetail); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(bnPoolId, poolCa, poolType, positionCollectionList, poolDetail); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PoolResp {\n"); + sb.append(" bnPoolId: ").append(toIndentedString(bnPoolId)).append("\n"); + sb.append(" poolCa: ").append(toIndentedString(poolCa)).append("\n"); + sb.append(" poolType: ").append(toIndentedString(poolType)).append("\n"); + sb.append(" positionCollectionList: ") + .append(toIndentedString(positionCollectionList)) + .append("\n"); + sb.append(" poolDetail: ").append(toIndentedString(poolDetail)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object bnPoolIdValue = getBnPoolId(); + String bnPoolIdValueAsString = ""; + bnPoolIdValueAsString = bnPoolIdValue.toString(); + sb.append("bnPoolId=").append(urlEncode(bnPoolIdValueAsString)).append(""); + Object poolCaValue = getPoolCa(); + String poolCaValueAsString = ""; + poolCaValueAsString = poolCaValue.toString(); + sb.append("poolCa=").append(urlEncode(poolCaValueAsString)).append(""); + Object poolTypeValue = getPoolType(); + String poolTypeValueAsString = ""; + poolTypeValueAsString = poolTypeValue.toString(); + sb.append("poolType=").append(urlEncode(poolTypeValueAsString)).append(""); + Object positionCollectionListValue = getPositionCollectionList(); + String positionCollectionListValueAsString = ""; + positionCollectionListValueAsString = + (String) + ((Collection) positionCollectionListValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("positionCollectionList=") + .append(urlEncode(positionCollectionListValueAsString)) + .append(""); + Object poolDetailValue = getPoolDetail(); + String poolDetailValueAsString = ""; + poolDetailValueAsString = poolDetailValue.toString(); + sb.append("poolDetail=").append(urlEncode(poolDetailValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("bnPoolId"); + openapiFields.add("poolCa"); + openapiFields.add("poolType"); + openapiFields.add("positionCollectionList"); + openapiFields.add("poolDetail"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PoolResp + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PoolResp.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in PoolResp is not found in the empty" + + " JSON string", + PoolResp.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("bnPoolId") != null && !jsonObj.get("bnPoolId").isJsonNull()) + && !jsonObj.get("bnPoolId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `bnPoolId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("bnPoolId").toString())); + } + if ((jsonObj.get("poolCa") != null && !jsonObj.get("poolCa").isJsonNull()) + && !jsonObj.get("poolCa").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `poolCa` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("poolCa").toString())); + } + if ((jsonObj.get("poolType") != null && !jsonObj.get("poolType").isJsonNull()) + && !jsonObj.get("poolType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `poolType` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("poolType").toString())); + } + if (jsonObj.get("positionCollectionList") != null + && !jsonObj.get("positionCollectionList").isJsonNull()) { + JsonArray jsonArraypositionCollectionList = + jsonObj.getAsJsonArray("positionCollectionList"); + if (jsonArraypositionCollectionList != null) { + // ensure the json data is an array + if (!jsonObj.get("positionCollectionList").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `positionCollectionList` to be an array in" + + " the JSON string but got `%s`", + jsonObj.get("positionCollectionList").toString())); + } + + // validate the optional field `positionCollectionList` (array) + for (int i = 0; i < jsonArraypositionCollectionList.size(); i++) { + PoolRespPositionCollectionListInner.validateJsonElement( + jsonArraypositionCollectionList.get(i)); + } + ; + } + } + // validate the optional field `poolDetail` + if (jsonObj.get("poolDetail") != null && !jsonObj.get("poolDetail").isJsonNull()) { + PoolRespPoolDetail.validateJsonElement(jsonObj.get("poolDetail")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PoolResp.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PoolResp' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(PoolResp.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, PoolResp value) throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PoolResp read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of PoolResp given an JSON string + * + * @param jsonString JSON string + * @return An instance of PoolResp + * @throws IOException if the JSON string is invalid with respect to PoolResp + */ + public static PoolResp fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PoolResp.class); + } + + /** + * Convert an instance of PoolResp to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/PoolRespPoolDetail.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/PoolRespPoolDetail.java new file mode 100644 index 0000000..cff988d --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/PoolRespPoolDetail.java @@ -0,0 +1,750 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** + * Pool-level metadata. Fields are null when not applicable to the pool type (e.g. + * `tickSpacing`/`hooks` only for concentrated-liquidity pools). + */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class PoolRespPoolDetail { + public static final String SERIALIZED_NAME_EXPIRY = "expiry"; + + @SerializedName(SERIALIZED_NAME_EXPIRY) + @jakarta.annotation.Nullable + private Long expiry; + + public static final String SERIALIZED_NAME_FEE_TIER = "feeTier"; + + @SerializedName(SERIALIZED_NAME_FEE_TIER) + @jakarta.annotation.Nullable + private String feeTier; + + public static final String SERIALIZED_NAME_LP_FEE = "lpFee"; + + @SerializedName(SERIALIZED_NAME_LP_FEE) + @jakarta.annotation.Nullable + private String lpFee; + + public static final String SERIALIZED_NAME_TICK_SPACING = "tickSpacing"; + + @SerializedName(SERIALIZED_NAME_TICK_SPACING) + @jakarta.annotation.Nullable + private String tickSpacing; + + public static final String SERIALIZED_NAME_IS_DYNAMIC_FEE = "isDynamicFee"; + + @SerializedName(SERIALIZED_NAME_IS_DYNAMIC_FEE) + @jakarta.annotation.Nullable + private Boolean isDynamicFee; + + public static final String SERIALIZED_NAME_HOOK_FEE = "hookFee"; + + @SerializedName(SERIALIZED_NAME_HOOK_FEE) + @jakarta.annotation.Nullable + private String hookFee; + + public static final String SERIALIZED_NAME_TICK = "tick"; + + @SerializedName(SERIALIZED_NAME_TICK) + @jakarta.annotation.Nullable + private String tick; + + public static final String SERIALIZED_NAME_HOOKS = "hooks"; + + @SerializedName(SERIALIZED_NAME_HOOKS) + @jakarta.annotation.Nullable + private String hooks; + + public static final String SERIALIZED_NAME_SWAP_PROTOCOL_FEE = "swapProtocolFee"; + + @SerializedName(SERIALIZED_NAME_SWAP_PROTOCOL_FEE) + @jakarta.annotation.Nullable + private String swapProtocolFee; + + public static final String SERIALIZED_NAME_PARAMETERS = "parameters"; + + @SerializedName(SERIALIZED_NAME_PARAMETERS) + @jakarta.annotation.Nullable + private String parameters; + + public static final String SERIALIZED_NAME_FEE = "fee"; + + @SerializedName(SERIALIZED_NAME_FEE) + @jakarta.annotation.Nullable + private String fee; + + public static final String SERIALIZED_NAME_SPOKE_NAME = "spokeName"; + + @SerializedName(SERIALIZED_NAME_SPOKE_NAME) + @jakarta.annotation.Nullable + private String spokeName; + + public static final String SERIALIZED_NAME_RESERVE_COUNT = "reserveCount"; + + @SerializedName(SERIALIZED_NAME_RESERVE_COUNT) + @jakarta.annotation.Nullable + private String reserveCount; + + public static final String SERIALIZED_NAME_VAULT_NAME = "vaultName"; + + @SerializedName(SERIALIZED_NAME_VAULT_NAME) + @jakarta.annotation.Nullable + private String vaultName; + + public PoolRespPoolDetail() {} + + public PoolRespPoolDetail expiry(@jakarta.annotation.Nullable Long expiry) { + this.expiry = expiry; + return this; + } + + /** + * Pool expiry timestamp (Unix seconds). Null if no expiry. + * + * @return expiry + */ + @jakarta.annotation.Nullable + public Long getExpiry() { + return expiry; + } + + public void setExpiry(@jakarta.annotation.Nullable Long expiry) { + this.expiry = expiry; + } + + public PoolRespPoolDetail feeTier(@jakarta.annotation.Nullable String feeTier) { + this.feeTier = feeTier; + return this; + } + + /** + * Fee tier. For PancakeSwap V3-style pools this is the encoded fee (e.g. \"500\" + * = 0.05%); for V4-style pools a flag-encoded value. + * + * @return feeTier + */ + @jakarta.annotation.Nullable + public String getFeeTier() { + return feeTier; + } + + public void setFeeTier(@jakarta.annotation.Nullable String feeTier) { + this.feeTier = feeTier; + } + + public PoolRespPoolDetail lpFee(@jakarta.annotation.Nullable String lpFee) { + this.lpFee = lpFee; + return this; + } + + /** + * LP fee portion in basis points (V4-style pools). + * + * @return lpFee + */ + @jakarta.annotation.Nullable + public String getLpFee() { + return lpFee; + } + + public void setLpFee(@jakarta.annotation.Nullable String lpFee) { + this.lpFee = lpFee; + } + + public PoolRespPoolDetail tickSpacing(@jakarta.annotation.Nullable String tickSpacing) { + this.tickSpacing = tickSpacing; + return this; + } + + /** + * Tick spacing for concentrated-liquidity pools. + * + * @return tickSpacing + */ + @jakarta.annotation.Nullable + public String getTickSpacing() { + return tickSpacing; + } + + public void setTickSpacing(@jakarta.annotation.Nullable String tickSpacing) { + this.tickSpacing = tickSpacing; + } + + public PoolRespPoolDetail isDynamicFee(@jakarta.annotation.Nullable Boolean isDynamicFee) { + this.isDynamicFee = isDynamicFee; + return this; + } + + /** + * Whether the pool uses a dynamic (hook-managed) fee (V4-style pools). + * + * @return isDynamicFee + */ + @jakarta.annotation.Nullable + public Boolean getIsDynamicFee() { + return isDynamicFee; + } + + public void setIsDynamicFee(@jakarta.annotation.Nullable Boolean isDynamicFee) { + this.isDynamicFee = isDynamicFee; + } + + public PoolRespPoolDetail hookFee(@jakarta.annotation.Nullable String hookFee) { + this.hookFee = hookFee; + return this; + } + + /** + * Hook fee portion in basis points (V4-style pools). + * + * @return hookFee + */ + @jakarta.annotation.Nullable + public String getHookFee() { + return hookFee; + } + + public void setHookFee(@jakarta.annotation.Nullable String hookFee) { + this.hookFee = hookFee; + } + + public PoolRespPoolDetail tick(@jakarta.annotation.Nullable String tick) { + this.tick = tick; + return this; + } + + /** + * Current pool tick (V4-style pools). + * + * @return tick + */ + @jakarta.annotation.Nullable + public String getTick() { + return tick; + } + + public void setTick(@jakarta.annotation.Nullable String tick) { + this.tick = tick; + } + + public PoolRespPoolDetail hooks(@jakarta.annotation.Nullable String hooks) { + this.hooks = hooks; + return this; + } + + /** + * Hook contract address (V4-style pools). Zero address when no hook. + * + * @return hooks + */ + @jakarta.annotation.Nullable + public String getHooks() { + return hooks; + } + + public void setHooks(@jakarta.annotation.Nullable String hooks) { + this.hooks = hooks; + } + + public PoolRespPoolDetail swapProtocolFee(@jakarta.annotation.Nullable String swapProtocolFee) { + this.swapProtocolFee = swapProtocolFee; + return this; + } + + /** + * Protocol fee on swaps in basis points (V4-style pools). + * + * @return swapProtocolFee + */ + @jakarta.annotation.Nullable + public String getSwapProtocolFee() { + return swapProtocolFee; + } + + public void setSwapProtocolFee(@jakarta.annotation.Nullable String swapProtocolFee) { + this.swapProtocolFee = swapProtocolFee; + } + + public PoolRespPoolDetail parameters(@jakarta.annotation.Nullable String parameters) { + this.parameters = parameters; + return this; + } + + /** + * Encoded pool parameters, e.g. `0x` + 64-char hex (V4-style pools). + * + * @return parameters + */ + @jakarta.annotation.Nullable + public String getParameters() { + return parameters; + } + + public void setParameters(@jakarta.annotation.Nullable String parameters) { + this.parameters = parameters; + } + + public PoolRespPoolDetail fee(@jakarta.annotation.Nullable String fee) { + this.fee = fee; + return this; + } + + /** + * Total pool fee in basis points (V4-style pools). + * + * @return fee + */ + @jakarta.annotation.Nullable + public String getFee() { + return fee; + } + + public void setFee(@jakarta.annotation.Nullable String fee) { + this.fee = fee; + } + + public PoolRespPoolDetail spokeName(@jakarta.annotation.Nullable String spokeName) { + this.spokeName = spokeName; + return this; + } + + /** + * Spoke pool name (e.g. across-protocol bridges). + * + * @return spokeName + */ + @jakarta.annotation.Nullable + public String getSpokeName() { + return spokeName; + } + + public void setSpokeName(@jakarta.annotation.Nullable String spokeName) { + this.spokeName = spokeName; + } + + public PoolRespPoolDetail reserveCount(@jakarta.annotation.Nullable String reserveCount) { + this.reserveCount = reserveCount; + return this; + } + + /** + * Number of reserves in multi-asset pools. + * + * @return reserveCount + */ + @jakarta.annotation.Nullable + public String getReserveCount() { + return reserveCount; + } + + public void setReserveCount(@jakarta.annotation.Nullable String reserveCount) { + this.reserveCount = reserveCount; + } + + public PoolRespPoolDetail vaultName(@jakarta.annotation.Nullable String vaultName) { + this.vaultName = vaultName; + return this; + } + + /** + * Vault name for vault-style protocols. + * + * @return vaultName + */ + @jakarta.annotation.Nullable + public String getVaultName() { + return vaultName; + } + + public void setVaultName(@jakarta.annotation.Nullable String vaultName) { + this.vaultName = vaultName; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PoolRespPoolDetail poolRespPoolDetail = (PoolRespPoolDetail) o; + return Objects.equals(this.expiry, poolRespPoolDetail.expiry) + && Objects.equals(this.feeTier, poolRespPoolDetail.feeTier) + && Objects.equals(this.lpFee, poolRespPoolDetail.lpFee) + && Objects.equals(this.tickSpacing, poolRespPoolDetail.tickSpacing) + && Objects.equals(this.isDynamicFee, poolRespPoolDetail.isDynamicFee) + && Objects.equals(this.hookFee, poolRespPoolDetail.hookFee) + && Objects.equals(this.tick, poolRespPoolDetail.tick) + && Objects.equals(this.hooks, poolRespPoolDetail.hooks) + && Objects.equals(this.swapProtocolFee, poolRespPoolDetail.swapProtocolFee) + && Objects.equals(this.parameters, poolRespPoolDetail.parameters) + && Objects.equals(this.fee, poolRespPoolDetail.fee) + && Objects.equals(this.spokeName, poolRespPoolDetail.spokeName) + && Objects.equals(this.reserveCount, poolRespPoolDetail.reserveCount) + && Objects.equals(this.vaultName, poolRespPoolDetail.vaultName); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash( + expiry, + feeTier, + lpFee, + tickSpacing, + isDynamicFee, + hookFee, + tick, + hooks, + swapProtocolFee, + parameters, + fee, + spokeName, + reserveCount, + vaultName); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PoolRespPoolDetail {\n"); + sb.append(" expiry: ").append(toIndentedString(expiry)).append("\n"); + sb.append(" feeTier: ").append(toIndentedString(feeTier)).append("\n"); + sb.append(" lpFee: ").append(toIndentedString(lpFee)).append("\n"); + sb.append(" tickSpacing: ").append(toIndentedString(tickSpacing)).append("\n"); + sb.append(" isDynamicFee: ").append(toIndentedString(isDynamicFee)).append("\n"); + sb.append(" hookFee: ").append(toIndentedString(hookFee)).append("\n"); + sb.append(" tick: ").append(toIndentedString(tick)).append("\n"); + sb.append(" hooks: ").append(toIndentedString(hooks)).append("\n"); + sb.append(" swapProtocolFee: ").append(toIndentedString(swapProtocolFee)).append("\n"); + sb.append(" parameters: ").append(toIndentedString(parameters)).append("\n"); + sb.append(" fee: ").append(toIndentedString(fee)).append("\n"); + sb.append(" spokeName: ").append(toIndentedString(spokeName)).append("\n"); + sb.append(" reserveCount: ").append(toIndentedString(reserveCount)).append("\n"); + sb.append(" vaultName: ").append(toIndentedString(vaultName)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object expiryValue = getExpiry(); + String expiryValueAsString = ""; + expiryValueAsString = expiryValue.toString(); + sb.append("expiry=").append(urlEncode(expiryValueAsString)).append(""); + Object feeTierValue = getFeeTier(); + String feeTierValueAsString = ""; + feeTierValueAsString = feeTierValue.toString(); + sb.append("feeTier=").append(urlEncode(feeTierValueAsString)).append(""); + Object lpFeeValue = getLpFee(); + String lpFeeValueAsString = ""; + lpFeeValueAsString = lpFeeValue.toString(); + sb.append("lpFee=").append(urlEncode(lpFeeValueAsString)).append(""); + Object tickSpacingValue = getTickSpacing(); + String tickSpacingValueAsString = ""; + tickSpacingValueAsString = tickSpacingValue.toString(); + sb.append("tickSpacing=").append(urlEncode(tickSpacingValueAsString)).append(""); + Object isDynamicFeeValue = getIsDynamicFee(); + String isDynamicFeeValueAsString = ""; + isDynamicFeeValueAsString = isDynamicFeeValue.toString(); + sb.append("isDynamicFee=").append(urlEncode(isDynamicFeeValueAsString)).append(""); + Object hookFeeValue = getHookFee(); + String hookFeeValueAsString = ""; + hookFeeValueAsString = hookFeeValue.toString(); + sb.append("hookFee=").append(urlEncode(hookFeeValueAsString)).append(""); + Object tickValue = getTick(); + String tickValueAsString = ""; + tickValueAsString = tickValue.toString(); + sb.append("tick=").append(urlEncode(tickValueAsString)).append(""); + Object hooksValue = getHooks(); + String hooksValueAsString = ""; + hooksValueAsString = hooksValue.toString(); + sb.append("hooks=").append(urlEncode(hooksValueAsString)).append(""); + Object swapProtocolFeeValue = getSwapProtocolFee(); + String swapProtocolFeeValueAsString = ""; + swapProtocolFeeValueAsString = swapProtocolFeeValue.toString(); + sb.append("swapProtocolFee=").append(urlEncode(swapProtocolFeeValueAsString)).append(""); + Object parametersValue = getParameters(); + String parametersValueAsString = ""; + parametersValueAsString = parametersValue.toString(); + sb.append("parameters=").append(urlEncode(parametersValueAsString)).append(""); + Object feeValue = getFee(); + String feeValueAsString = ""; + feeValueAsString = feeValue.toString(); + sb.append("fee=").append(urlEncode(feeValueAsString)).append(""); + Object spokeNameValue = getSpokeName(); + String spokeNameValueAsString = ""; + spokeNameValueAsString = spokeNameValue.toString(); + sb.append("spokeName=").append(urlEncode(spokeNameValueAsString)).append(""); + Object reserveCountValue = getReserveCount(); + String reserveCountValueAsString = ""; + reserveCountValueAsString = reserveCountValue.toString(); + sb.append("reserveCount=").append(urlEncode(reserveCountValueAsString)).append(""); + Object vaultNameValue = getVaultName(); + String vaultNameValueAsString = ""; + vaultNameValueAsString = vaultNameValue.toString(); + sb.append("vaultName=").append(urlEncode(vaultNameValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("expiry"); + openapiFields.add("feeTier"); + openapiFields.add("lpFee"); + openapiFields.add("tickSpacing"); + openapiFields.add("isDynamicFee"); + openapiFields.add("hookFee"); + openapiFields.add("tick"); + openapiFields.add("hooks"); + openapiFields.add("swapProtocolFee"); + openapiFields.add("parameters"); + openapiFields.add("fee"); + openapiFields.add("spokeName"); + openapiFields.add("reserveCount"); + openapiFields.add("vaultName"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PoolRespPoolDetail + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PoolRespPoolDetail.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in PoolRespPoolDetail is not found in the" + + " empty JSON string", + PoolRespPoolDetail.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("feeTier") != null && !jsonObj.get("feeTier").isJsonNull()) + && !jsonObj.get("feeTier").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `feeTier` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("feeTier").toString())); + } + if ((jsonObj.get("lpFee") != null && !jsonObj.get("lpFee").isJsonNull()) + && !jsonObj.get("lpFee").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `lpFee` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("lpFee").toString())); + } + if ((jsonObj.get("tickSpacing") != null && !jsonObj.get("tickSpacing").isJsonNull()) + && !jsonObj.get("tickSpacing").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `tickSpacing` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("tickSpacing").toString())); + } + if ((jsonObj.get("hookFee") != null && !jsonObj.get("hookFee").isJsonNull()) + && !jsonObj.get("hookFee").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `hookFee` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("hookFee").toString())); + } + if ((jsonObj.get("tick") != null && !jsonObj.get("tick").isJsonNull()) + && !jsonObj.get("tick").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `tick` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("tick").toString())); + } + if ((jsonObj.get("hooks") != null && !jsonObj.get("hooks").isJsonNull()) + && !jsonObj.get("hooks").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `hooks` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("hooks").toString())); + } + if ((jsonObj.get("swapProtocolFee") != null && !jsonObj.get("swapProtocolFee").isJsonNull()) + && !jsonObj.get("swapProtocolFee").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `swapProtocolFee` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("swapProtocolFee").toString())); + } + if ((jsonObj.get("parameters") != null && !jsonObj.get("parameters").isJsonNull()) + && !jsonObj.get("parameters").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `parameters` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("parameters").toString())); + } + if ((jsonObj.get("fee") != null && !jsonObj.get("fee").isJsonNull()) + && !jsonObj.get("fee").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `fee` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("fee").toString())); + } + if ((jsonObj.get("spokeName") != null && !jsonObj.get("spokeName").isJsonNull()) + && !jsonObj.get("spokeName").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `spokeName` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("spokeName").toString())); + } + if ((jsonObj.get("reserveCount") != null && !jsonObj.get("reserveCount").isJsonNull()) + && !jsonObj.get("reserveCount").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `reserveCount` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("reserveCount").toString())); + } + if ((jsonObj.get("vaultName") != null && !jsonObj.get("vaultName").isJsonNull()) + && !jsonObj.get("vaultName").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `vaultName` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("vaultName").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PoolRespPoolDetail.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PoolRespPoolDetail' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(PoolRespPoolDetail.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, PoolRespPoolDetail value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PoolRespPoolDetail read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of PoolRespPoolDetail given an JSON string + * + * @param jsonString JSON string + * @return An instance of PoolRespPoolDetail + * @throws IOException if the JSON string is invalid with respect to PoolRespPoolDetail + */ + public static PoolRespPoolDetail fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PoolRespPoolDetail.class); + } + + /** + * Convert an instance of PoolRespPoolDetail to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/PoolRespPositionCollectionListInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/PoolRespPositionCollectionListInner.java new file mode 100644 index 0000000..8b1f3bd --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/PoolRespPositionCollectionListInner.java @@ -0,0 +1,424 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** A collection of positions grouped under the same underlying asset. */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class PoolRespPositionCollectionListInner { + public static final String SERIALIZED_NAME_POSITION_COLLECTION_ID = "positionCollectionId"; + + @SerializedName(SERIALIZED_NAME_POSITION_COLLECTION_ID) + @jakarta.annotation.Nullable + private String positionCollectionId; + + public static final String SERIALIZED_NAME_POSITION_COLLECTION_DETAIL = + "positionCollectionDetail"; + + @SerializedName(SERIALIZED_NAME_POSITION_COLLECTION_DETAIL) + @jakarta.annotation.Nullable + private PositionCollectionRespPositionCollectionDetail positionCollectionDetail; + + public static final String SERIALIZED_NAME_POSITION_COLLECTION_TOTAL_VALUE = + "positionCollectionTotalValue"; + + @SerializedName(SERIALIZED_NAME_POSITION_COLLECTION_TOTAL_VALUE) + @jakarta.annotation.Nullable + private String positionCollectionTotalValue; + + public static final String SERIALIZED_NAME_POSITION_LIST = "positionList"; + + @SerializedName(SERIALIZED_NAME_POSITION_LIST) + @jakarta.annotation.Nullable + private List<@Valid PositionCollectionRespPositionListInner> positionList; + + public PoolRespPositionCollectionListInner() {} + + public PoolRespPositionCollectionListInner positionCollectionId( + @jakarta.annotation.Nullable String positionCollectionId) { + this.positionCollectionId = positionCollectionId; + return this; + } + + /** + * Collection unique identifier (64-char hex, no `0x` prefix). + * + * @return positionCollectionId + */ + @jakarta.annotation.Nullable + public String getPositionCollectionId() { + return positionCollectionId; + } + + public void setPositionCollectionId(@jakarta.annotation.Nullable String positionCollectionId) { + this.positionCollectionId = positionCollectionId; + } + + public PoolRespPositionCollectionListInner positionCollectionDetail( + @jakarta.annotation.Nullable + PositionCollectionRespPositionCollectionDetail positionCollectionDetail) { + this.positionCollectionDetail = positionCollectionDetail; + return this; + } + + /** + * Get positionCollectionDetail + * + * @return positionCollectionDetail + */ + @jakarta.annotation.Nullable + @Valid + public PositionCollectionRespPositionCollectionDetail getPositionCollectionDetail() { + return positionCollectionDetail; + } + + public void setPositionCollectionDetail( + @jakarta.annotation.Nullable + PositionCollectionRespPositionCollectionDetail positionCollectionDetail) { + this.positionCollectionDetail = positionCollectionDetail; + } + + public PoolRespPositionCollectionListInner positionCollectionTotalValue( + @jakarta.annotation.Nullable String positionCollectionTotalValue) { + this.positionCollectionTotalValue = positionCollectionTotalValue; + return this; + } + + /** + * Total value of all positions in this collection (USD). + * + * @return positionCollectionTotalValue + */ + @jakarta.annotation.Nullable + public String getPositionCollectionTotalValue() { + return positionCollectionTotalValue; + } + + public void setPositionCollectionTotalValue( + @jakarta.annotation.Nullable String positionCollectionTotalValue) { + this.positionCollectionTotalValue = positionCollectionTotalValue; + } + + public PoolRespPositionCollectionListInner positionList( + @jakarta.annotation.Nullable + List<@Valid PositionCollectionRespPositionListInner> positionList) { + this.positionList = positionList; + return this; + } + + public PoolRespPositionCollectionListInner addPositionListItem( + PositionCollectionRespPositionListInner positionListItem) { + if (this.positionList == null) { + this.positionList = new ArrayList<>(); + } + this.positionList.add(positionListItem); + return this; + } + + /** + * List of positions in this collection. + * + * @return positionList + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid PositionCollectionRespPositionListInner> getPositionList() { + return positionList; + } + + public void setPositionList( + @jakarta.annotation.Nullable + List<@Valid PositionCollectionRespPositionListInner> positionList) { + this.positionList = positionList; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PoolRespPositionCollectionListInner poolRespPositionCollectionListInner = + (PoolRespPositionCollectionListInner) o; + return Objects.equals( + this.positionCollectionId, + poolRespPositionCollectionListInner.positionCollectionId) + && Objects.equals( + this.positionCollectionDetail, + poolRespPositionCollectionListInner.positionCollectionDetail) + && Objects.equals( + this.positionCollectionTotalValue, + poolRespPositionCollectionListInner.positionCollectionTotalValue) + && Objects.equals( + this.positionList, poolRespPositionCollectionListInner.positionList); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash( + positionCollectionId, + positionCollectionDetail, + positionCollectionTotalValue, + positionList); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PoolRespPositionCollectionListInner {\n"); + sb.append(" positionCollectionId: ") + .append(toIndentedString(positionCollectionId)) + .append("\n"); + sb.append(" positionCollectionDetail: ") + .append(toIndentedString(positionCollectionDetail)) + .append("\n"); + sb.append(" positionCollectionTotalValue: ") + .append(toIndentedString(positionCollectionTotalValue)) + .append("\n"); + sb.append(" positionList: ").append(toIndentedString(positionList)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object positionCollectionIdValue = getPositionCollectionId(); + String positionCollectionIdValueAsString = ""; + positionCollectionIdValueAsString = positionCollectionIdValue.toString(); + sb.append("positionCollectionId=") + .append(urlEncode(positionCollectionIdValueAsString)) + .append(""); + Object positionCollectionDetailValue = getPositionCollectionDetail(); + String positionCollectionDetailValueAsString = ""; + positionCollectionDetailValueAsString = positionCollectionDetailValue.toString(); + sb.append("positionCollectionDetail=") + .append(urlEncode(positionCollectionDetailValueAsString)) + .append(""); + Object positionCollectionTotalValueValue = getPositionCollectionTotalValue(); + String positionCollectionTotalValueValueAsString = ""; + positionCollectionTotalValueValueAsString = positionCollectionTotalValueValue.toString(); + sb.append("positionCollectionTotalValue=") + .append(urlEncode(positionCollectionTotalValueValueAsString)) + .append(""); + Object positionListValue = getPositionList(); + String positionListValueAsString = ""; + positionListValueAsString = + (String) + ((Collection) positionListValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("positionList=").append(urlEncode(positionListValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("positionCollectionId"); + openapiFields.add("positionCollectionDetail"); + openapiFields.add("positionCollectionTotalValue"); + openapiFields.add("positionList"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * PoolRespPositionCollectionListInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PoolRespPositionCollectionListInner.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in PoolRespPositionCollectionListInner is" + + " not found in the empty JSON string", + PoolRespPositionCollectionListInner.openapiRequiredFields + .toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("positionCollectionId") != null + && !jsonObj.get("positionCollectionId").isJsonNull()) + && !jsonObj.get("positionCollectionId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `positionCollectionId` to be a primitive type in" + + " the JSON string but got `%s`", + jsonObj.get("positionCollectionId").toString())); + } + // validate the optional field `positionCollectionDetail` + if (jsonObj.get("positionCollectionDetail") != null + && !jsonObj.get("positionCollectionDetail").isJsonNull()) { + PositionCollectionRespPositionCollectionDetail.validateJsonElement( + jsonObj.get("positionCollectionDetail")); + } + if ((jsonObj.get("positionCollectionTotalValue") != null + && !jsonObj.get("positionCollectionTotalValue").isJsonNull()) + && !jsonObj.get("positionCollectionTotalValue").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `positionCollectionTotalValue` to be a primitive" + + " type in the JSON string but got `%s`", + jsonObj.get("positionCollectionTotalValue").toString())); + } + if (jsonObj.get("positionList") != null && !jsonObj.get("positionList").isJsonNull()) { + JsonArray jsonArraypositionList = jsonObj.getAsJsonArray("positionList"); + if (jsonArraypositionList != null) { + // ensure the json data is an array + if (!jsonObj.get("positionList").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `positionList` to be an array in the JSON" + + " string but got `%s`", + jsonObj.get("positionList").toString())); + } + + // validate the optional field `positionList` (array) + for (int i = 0; i < jsonArraypositionList.size(); i++) { + PositionCollectionRespPositionListInner.validateJsonElement( + jsonArraypositionList.get(i)); + } + ; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PoolRespPositionCollectionListInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PoolRespPositionCollectionListInner' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(PoolRespPositionCollectionListInner.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, PoolRespPositionCollectionListInner value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PoolRespPositionCollectionListInner read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of PoolRespPositionCollectionListInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of PoolRespPositionCollectionListInner + * @throws IOException if the JSON string is invalid with respect to + * PoolRespPositionCollectionListInner + */ + public static PoolRespPositionCollectionListInner fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, PoolRespPositionCollectionListInner.class); + } + + /** + * Convert an instance of PoolRespPositionCollectionListInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/PositionCollectionResp.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/PositionCollectionResp.java new file mode 100644 index 0000000..d6c3038 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/PositionCollectionResp.java @@ -0,0 +1,414 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** A collection of positions grouped under the same underlying asset. */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class PositionCollectionResp { + public static final String SERIALIZED_NAME_POSITION_COLLECTION_ID = "positionCollectionId"; + + @SerializedName(SERIALIZED_NAME_POSITION_COLLECTION_ID) + @jakarta.annotation.Nullable + private String positionCollectionId; + + public static final String SERIALIZED_NAME_POSITION_COLLECTION_DETAIL = + "positionCollectionDetail"; + + @SerializedName(SERIALIZED_NAME_POSITION_COLLECTION_DETAIL) + @jakarta.annotation.Nullable + private PositionCollectionRespPositionCollectionDetail positionCollectionDetail; + + public static final String SERIALIZED_NAME_POSITION_COLLECTION_TOTAL_VALUE = + "positionCollectionTotalValue"; + + @SerializedName(SERIALIZED_NAME_POSITION_COLLECTION_TOTAL_VALUE) + @jakarta.annotation.Nullable + private String positionCollectionTotalValue; + + public static final String SERIALIZED_NAME_POSITION_LIST = "positionList"; + + @SerializedName(SERIALIZED_NAME_POSITION_LIST) + @jakarta.annotation.Nullable + private List<@Valid PositionCollectionRespPositionListInner> positionList; + + public PositionCollectionResp() {} + + public PositionCollectionResp positionCollectionId( + @jakarta.annotation.Nullable String positionCollectionId) { + this.positionCollectionId = positionCollectionId; + return this; + } + + /** + * Collection unique identifier (64-char hex, no `0x` prefix). + * + * @return positionCollectionId + */ + @jakarta.annotation.Nullable + public String getPositionCollectionId() { + return positionCollectionId; + } + + public void setPositionCollectionId(@jakarta.annotation.Nullable String positionCollectionId) { + this.positionCollectionId = positionCollectionId; + } + + public PositionCollectionResp positionCollectionDetail( + @jakarta.annotation.Nullable + PositionCollectionRespPositionCollectionDetail positionCollectionDetail) { + this.positionCollectionDetail = positionCollectionDetail; + return this; + } + + /** + * Get positionCollectionDetail + * + * @return positionCollectionDetail + */ + @jakarta.annotation.Nullable + @Valid + public PositionCollectionRespPositionCollectionDetail getPositionCollectionDetail() { + return positionCollectionDetail; + } + + public void setPositionCollectionDetail( + @jakarta.annotation.Nullable + PositionCollectionRespPositionCollectionDetail positionCollectionDetail) { + this.positionCollectionDetail = positionCollectionDetail; + } + + public PositionCollectionResp positionCollectionTotalValue( + @jakarta.annotation.Nullable String positionCollectionTotalValue) { + this.positionCollectionTotalValue = positionCollectionTotalValue; + return this; + } + + /** + * Total value of all positions in this collection (USD). + * + * @return positionCollectionTotalValue + */ + @jakarta.annotation.Nullable + public String getPositionCollectionTotalValue() { + return positionCollectionTotalValue; + } + + public void setPositionCollectionTotalValue( + @jakarta.annotation.Nullable String positionCollectionTotalValue) { + this.positionCollectionTotalValue = positionCollectionTotalValue; + } + + public PositionCollectionResp positionList( + @jakarta.annotation.Nullable + List<@Valid PositionCollectionRespPositionListInner> positionList) { + this.positionList = positionList; + return this; + } + + public PositionCollectionResp addPositionListItem( + PositionCollectionRespPositionListInner positionListItem) { + if (this.positionList == null) { + this.positionList = new ArrayList<>(); + } + this.positionList.add(positionListItem); + return this; + } + + /** + * List of positions in this collection. + * + * @return positionList + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid PositionCollectionRespPositionListInner> getPositionList() { + return positionList; + } + + public void setPositionList( + @jakarta.annotation.Nullable + List<@Valid PositionCollectionRespPositionListInner> positionList) { + this.positionList = positionList; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PositionCollectionResp positionCollectionResp = (PositionCollectionResp) o; + return Objects.equals( + this.positionCollectionId, positionCollectionResp.positionCollectionId) + && Objects.equals( + this.positionCollectionDetail, + positionCollectionResp.positionCollectionDetail) + && Objects.equals( + this.positionCollectionTotalValue, + positionCollectionResp.positionCollectionTotalValue) + && Objects.equals(this.positionList, positionCollectionResp.positionList); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash( + positionCollectionId, + positionCollectionDetail, + positionCollectionTotalValue, + positionList); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PositionCollectionResp {\n"); + sb.append(" positionCollectionId: ") + .append(toIndentedString(positionCollectionId)) + .append("\n"); + sb.append(" positionCollectionDetail: ") + .append(toIndentedString(positionCollectionDetail)) + .append("\n"); + sb.append(" positionCollectionTotalValue: ") + .append(toIndentedString(positionCollectionTotalValue)) + .append("\n"); + sb.append(" positionList: ").append(toIndentedString(positionList)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object positionCollectionIdValue = getPositionCollectionId(); + String positionCollectionIdValueAsString = ""; + positionCollectionIdValueAsString = positionCollectionIdValue.toString(); + sb.append("positionCollectionId=") + .append(urlEncode(positionCollectionIdValueAsString)) + .append(""); + Object positionCollectionDetailValue = getPositionCollectionDetail(); + String positionCollectionDetailValueAsString = ""; + positionCollectionDetailValueAsString = positionCollectionDetailValue.toString(); + sb.append("positionCollectionDetail=") + .append(urlEncode(positionCollectionDetailValueAsString)) + .append(""); + Object positionCollectionTotalValueValue = getPositionCollectionTotalValue(); + String positionCollectionTotalValueValueAsString = ""; + positionCollectionTotalValueValueAsString = positionCollectionTotalValueValue.toString(); + sb.append("positionCollectionTotalValue=") + .append(urlEncode(positionCollectionTotalValueValueAsString)) + .append(""); + Object positionListValue = getPositionList(); + String positionListValueAsString = ""; + positionListValueAsString = + (String) + ((Collection) positionListValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("positionList=").append(urlEncode(positionListValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("positionCollectionId"); + openapiFields.add("positionCollectionDetail"); + openapiFields.add("positionCollectionTotalValue"); + openapiFields.add("positionList"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PositionCollectionResp + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PositionCollectionResp.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in PositionCollectionResp is not found in" + + " the empty JSON string", + PositionCollectionResp.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("positionCollectionId") != null + && !jsonObj.get("positionCollectionId").isJsonNull()) + && !jsonObj.get("positionCollectionId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `positionCollectionId` to be a primitive type in" + + " the JSON string but got `%s`", + jsonObj.get("positionCollectionId").toString())); + } + // validate the optional field `positionCollectionDetail` + if (jsonObj.get("positionCollectionDetail") != null + && !jsonObj.get("positionCollectionDetail").isJsonNull()) { + PositionCollectionRespPositionCollectionDetail.validateJsonElement( + jsonObj.get("positionCollectionDetail")); + } + if ((jsonObj.get("positionCollectionTotalValue") != null + && !jsonObj.get("positionCollectionTotalValue").isJsonNull()) + && !jsonObj.get("positionCollectionTotalValue").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `positionCollectionTotalValue` to be a primitive" + + " type in the JSON string but got `%s`", + jsonObj.get("positionCollectionTotalValue").toString())); + } + if (jsonObj.get("positionList") != null && !jsonObj.get("positionList").isJsonNull()) { + JsonArray jsonArraypositionList = jsonObj.getAsJsonArray("positionList"); + if (jsonArraypositionList != null) { + // ensure the json data is an array + if (!jsonObj.get("positionList").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `positionList` to be an array in the JSON" + + " string but got `%s`", + jsonObj.get("positionList").toString())); + } + + // validate the optional field `positionList` (array) + for (int i = 0; i < jsonArraypositionList.size(); i++) { + PositionCollectionRespPositionListInner.validateJsonElement( + jsonArraypositionList.get(i)); + } + ; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PositionCollectionResp.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PositionCollectionResp' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(PositionCollectionResp.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, PositionCollectionResp value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PositionCollectionResp read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of PositionCollectionResp given an JSON string + * + * @param jsonString JSON string + * @return An instance of PositionCollectionResp + * @throws IOException if the JSON string is invalid with respect to PositionCollectionResp + */ + public static PositionCollectionResp fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PositionCollectionResp.class); + } + + /** + * Convert an instance of PositionCollectionResp to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/PositionCollectionRespPositionCollectionDetail.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/PositionCollectionRespPositionCollectionDetail.java new file mode 100644 index 0000000..077dd17 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/PositionCollectionRespPositionCollectionDetail.java @@ -0,0 +1,342 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** + * Collection metadata. Null when the collection has no metadata. Fields are null when not + * applicable. + */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class PositionCollectionRespPositionCollectionDetail { + public static final String SERIALIZED_NAME_COLLECTION_INDEX = "collectionIndex"; + + @SerializedName(SERIALIZED_NAME_COLLECTION_INDEX) + @jakarta.annotation.Nullable + private String collectionIndex; + + public static final String SERIALIZED_NAME_COLLECTION_DISPLAY_NAME = "collectionDisplayName"; + + @SerializedName(SERIALIZED_NAME_COLLECTION_DISPLAY_NAME) + @jakarta.annotation.Nullable + private String collectionDisplayName; + + public static final String SERIALIZED_NAME_HEALTH_FACTOR = "healthFactor"; + + @SerializedName(SERIALIZED_NAME_HEALTH_FACTOR) + @jakarta.annotation.Nullable + private String healthFactor; + + public PositionCollectionRespPositionCollectionDetail() {} + + public PositionCollectionRespPositionCollectionDetail collectionIndex( + @jakarta.annotation.Nullable String collectionIndex) { + this.collectionIndex = collectionIndex; + return this; + } + + /** + * Index of this collection within the pool. For single-asset collections this is the + * ABI-encoded (left-padded) token address; other pools use their own index format. + * + * @return collectionIndex + */ + @jakarta.annotation.Nullable + public String getCollectionIndex() { + return collectionIndex; + } + + public void setCollectionIndex(@jakarta.annotation.Nullable String collectionIndex) { + this.collectionIndex = collectionIndex; + } + + public PositionCollectionRespPositionCollectionDetail collectionDisplayName( + @jakarta.annotation.Nullable String collectionDisplayName) { + this.collectionDisplayName = collectionDisplayName; + return this; + } + + /** + * Human-readable collection name. + * + * @return collectionDisplayName + */ + @jakarta.annotation.Nullable + public String getCollectionDisplayName() { + return collectionDisplayName; + } + + public void setCollectionDisplayName( + @jakarta.annotation.Nullable String collectionDisplayName) { + this.collectionDisplayName = collectionDisplayName; + } + + public PositionCollectionRespPositionCollectionDetail healthFactor( + @jakarta.annotation.Nullable String healthFactor) { + this.healthFactor = healthFactor; + return this; + } + + /** + * Health factor for lending positions. Null for non-lending positions. + * + * @return healthFactor + */ + @jakarta.annotation.Nullable + public String getHealthFactor() { + return healthFactor; + } + + public void setHealthFactor(@jakarta.annotation.Nullable String healthFactor) { + this.healthFactor = healthFactor; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PositionCollectionRespPositionCollectionDetail + positionCollectionRespPositionCollectionDetail = + (PositionCollectionRespPositionCollectionDetail) o; + return Objects.equals( + this.collectionIndex, + positionCollectionRespPositionCollectionDetail.collectionIndex) + && Objects.equals( + this.collectionDisplayName, + positionCollectionRespPositionCollectionDetail.collectionDisplayName) + && Objects.equals( + this.healthFactor, + positionCollectionRespPositionCollectionDetail.healthFactor); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(collectionIndex, collectionDisplayName, healthFactor); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PositionCollectionRespPositionCollectionDetail {\n"); + sb.append(" collectionIndex: ").append(toIndentedString(collectionIndex)).append("\n"); + sb.append(" collectionDisplayName: ") + .append(toIndentedString(collectionDisplayName)) + .append("\n"); + sb.append(" healthFactor: ").append(toIndentedString(healthFactor)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object collectionIndexValue = getCollectionIndex(); + String collectionIndexValueAsString = ""; + collectionIndexValueAsString = collectionIndexValue.toString(); + sb.append("collectionIndex=").append(urlEncode(collectionIndexValueAsString)).append(""); + Object collectionDisplayNameValue = getCollectionDisplayName(); + String collectionDisplayNameValueAsString = ""; + collectionDisplayNameValueAsString = collectionDisplayNameValue.toString(); + sb.append("collectionDisplayName=") + .append(urlEncode(collectionDisplayNameValueAsString)) + .append(""); + Object healthFactorValue = getHealthFactor(); + String healthFactorValueAsString = ""; + healthFactorValueAsString = healthFactorValue.toString(); + sb.append("healthFactor=").append(urlEncode(healthFactorValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("collectionIndex"); + openapiFields.add("collectionDisplayName"); + openapiFields.add("healthFactor"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * PositionCollectionRespPositionCollectionDetail + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PositionCollectionRespPositionCollectionDetail.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " PositionCollectionRespPositionCollectionDetail is not found" + + " in the empty JSON string", + PositionCollectionRespPositionCollectionDetail.openapiRequiredFields + .toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("collectionIndex") != null && !jsonObj.get("collectionIndex").isJsonNull()) + && !jsonObj.get("collectionIndex").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `collectionIndex` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("collectionIndex").toString())); + } + if ((jsonObj.get("collectionDisplayName") != null + && !jsonObj.get("collectionDisplayName").isJsonNull()) + && !jsonObj.get("collectionDisplayName").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `collectionDisplayName` to be a primitive type in" + + " the JSON string but got `%s`", + jsonObj.get("collectionDisplayName").toString())); + } + if ((jsonObj.get("healthFactor") != null && !jsonObj.get("healthFactor").isJsonNull()) + && !jsonObj.get("healthFactor").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `healthFactor` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("healthFactor").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PositionCollectionRespPositionCollectionDetail.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'PositionCollectionRespPositionCollectionDetail' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, + TypeToken.get(PositionCollectionRespPositionCollectionDetail.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, + PositionCollectionRespPositionCollectionDetail value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PositionCollectionRespPositionCollectionDetail read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of PositionCollectionRespPositionCollectionDetail given an JSON string + * + * @param jsonString JSON string + * @return An instance of PositionCollectionRespPositionCollectionDetail + * @throws IOException if the JSON string is invalid with respect to + * PositionCollectionRespPositionCollectionDetail + */ + public static PositionCollectionRespPositionCollectionDetail fromJson(String jsonString) + throws IOException { + return JSON.getGson() + .fromJson(jsonString, PositionCollectionRespPositionCollectionDetail.class); + } + + /** + * Convert an instance of PositionCollectionRespPositionCollectionDetail to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/PositionCollectionRespPositionListInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/PositionCollectionRespPositionListInner.java new file mode 100644 index 0000000..ddc0c5e --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/PositionCollectionRespPositionListInner.java @@ -0,0 +1,574 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** A single DeFi position with underlying asset and token breakdown. */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class PositionCollectionRespPositionListInner { + public static final String SERIALIZED_NAME_POSITION_ID = "positionId"; + + @SerializedName(SERIALIZED_NAME_POSITION_ID) + @jakarta.annotation.Nullable + private String positionId; + + public static final String SERIALIZED_NAME_UNDERLYING_ASSET_NAME = "underlyingAssetName"; + + @SerializedName(SERIALIZED_NAME_UNDERLYING_ASSET_NAME) + @jakarta.annotation.Nullable + private String underlyingAssetName; + + public static final String SERIALIZED_NAME_UNDERLYING_ASSET_ID = "underlyingAssetId"; + + @SerializedName(SERIALIZED_NAME_UNDERLYING_ASSET_ID) + @jakarta.annotation.Nullable + private String underlyingAssetId; + + public static final String SERIALIZED_NAME_ASSET_TYPE = "assetType"; + + @SerializedName(SERIALIZED_NAME_ASSET_TYPE) + @jakarta.annotation.Nullable + private String assetType; + + public static final String SERIALIZED_NAME_INVESTMENT_IDS = "investmentIds"; + + @SerializedName(SERIALIZED_NAME_INVESTMENT_IDS) + @jakarta.annotation.Nullable + private List investmentIds; + + public static final String SERIALIZED_NAME_POSITION_DETAIL = "positionDetail"; + + @SerializedName(SERIALIZED_NAME_POSITION_DETAIL) + @jakarta.annotation.Nullable + private PositionRespPositionDetail positionDetail; + + public static final String SERIALIZED_NAME_POSITION_VALUE = "positionValue"; + + @SerializedName(SERIALIZED_NAME_POSITION_VALUE) + @jakarta.annotation.Nullable + private String positionValue; + + public static final String SERIALIZED_NAME_TOKEN_LIST = "tokenList"; + + @SerializedName(SERIALIZED_NAME_TOKEN_LIST) + @jakarta.annotation.Nullable + private PositionRespTokenList tokenList; + + public PositionCollectionRespPositionListInner() {} + + public PositionCollectionRespPositionListInner positionId( + @jakarta.annotation.Nullable String positionId) { + this.positionId = positionId; + return this; + } + + /** + * Unique position identifier (64-char hex, no `0x` prefix). + * + * @return positionId + */ + @jakarta.annotation.Nullable + public String getPositionId() { + return positionId; + } + + public void setPositionId(@jakarta.annotation.Nullable String positionId) { + this.positionId = positionId; + } + + public PositionCollectionRespPositionListInner underlyingAssetName( + @jakarta.annotation.Nullable String underlyingAssetName) { + this.underlyingAssetName = underlyingAssetName; + return this; + } + + /** + * Display name of the underlying asset (e.g. \"USDT-USDC\", \"lisUSD\"). + * + * @return underlyingAssetName + */ + @jakarta.annotation.Nullable + public String getUnderlyingAssetName() { + return underlyingAssetName; + } + + public void setUnderlyingAssetName(@jakarta.annotation.Nullable String underlyingAssetName) { + this.underlyingAssetName = underlyingAssetName; + } + + public PositionCollectionRespPositionListInner underlyingAssetId( + @jakarta.annotation.Nullable String underlyingAssetId) { + this.underlyingAssetId = underlyingAssetId; + return this; + } + + /** + * Underlying asset identifier (64-char hex, no `0x` prefix). Hashed from the pool and + * underlying token addresses. + * + * @return underlyingAssetId + */ + @jakarta.annotation.Nullable + public String getUnderlyingAssetId() { + return underlyingAssetId; + } + + public void setUnderlyingAssetId(@jakarta.annotation.Nullable String underlyingAssetId) { + this.underlyingAssetId = underlyingAssetId; + } + + public PositionCollectionRespPositionListInner assetType( + @jakarta.annotation.Nullable String assetType) { + this.assetType = assetType; + return this; + } + + /** + * Asset structure type. Null for a regular position; `locked` for a locked position + * (e.g. locked staking — check `unlockTime` on positionDetail); `farming` + * for a MasterChef-style farming position (rewards accrue under the `farming_reward` + * token group). + * + * @return assetType + */ + @jakarta.annotation.Nullable + public String getAssetType() { + return assetType; + } + + public void setAssetType(@jakarta.annotation.Nullable String assetType) { + this.assetType = assetType; + } + + public PositionCollectionRespPositionListInner investmentIds( + @jakarta.annotation.Nullable List investmentIds) { + this.investmentIds = investmentIds; + return this; + } + + public PositionCollectionRespPositionListInner addInvestmentIdsItem(String investmentIdsItem) { + if (this.investmentIds == null) { + this.investmentIds = new ArrayList<>(); + } + this.investmentIds.add(investmentIdsItem); + return this; + } + + /** + * Related investment IDs (64-char hex, no `0x` prefix). Use with `POST + * /api/v1/defi/data/investment/detail`. Usually a single entry; a position can relate to + * several investments when the pool stacks products on top of each other (e.g. a farming + * position wraps the underlying LP investment plus its incentive product, or a staked vault + * layers a receipt token over the base deposit). When there are several, query each with + * investment/detail and pick by the action you want to perform — redeeming the principal uses + * the base investment, claiming farming incentives uses the incentive one. + * + * @return investmentIds + */ + @jakarta.annotation.Nullable + public List getInvestmentIds() { + return investmentIds; + } + + public void setInvestmentIds(@jakarta.annotation.Nullable List investmentIds) { + this.investmentIds = investmentIds; + } + + public PositionCollectionRespPositionListInner positionDetail( + @jakarta.annotation.Nullable PositionRespPositionDetail positionDetail) { + this.positionDetail = positionDetail; + return this; + } + + /** + * Get positionDetail + * + * @return positionDetail + */ + @jakarta.annotation.Nullable + @Valid + public PositionRespPositionDetail getPositionDetail() { + return positionDetail; + } + + public void setPositionDetail( + @jakarta.annotation.Nullable PositionRespPositionDetail positionDetail) { + this.positionDetail = positionDetail; + } + + public PositionCollectionRespPositionListInner positionValue( + @jakarta.annotation.Nullable String positionValue) { + this.positionValue = positionValue; + return this; + } + + /** + * Total position value in USD (sum of all token values; may be negative for borrow positions). + * + * @return positionValue + */ + @jakarta.annotation.Nullable + public String getPositionValue() { + return positionValue; + } + + public void setPositionValue(@jakarta.annotation.Nullable String positionValue) { + this.positionValue = positionValue; + } + + public PositionCollectionRespPositionListInner tokenList( + @jakarta.annotation.Nullable PositionRespTokenList tokenList) { + this.tokenList = tokenList; + return this; + } + + /** + * Get tokenList + * + * @return tokenList + */ + @jakarta.annotation.Nullable + @Valid + public PositionRespTokenList getTokenList() { + return tokenList; + } + + public void setTokenList(@jakarta.annotation.Nullable PositionRespTokenList tokenList) { + this.tokenList = tokenList; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PositionCollectionRespPositionListInner positionCollectionRespPositionListInner = + (PositionCollectionRespPositionListInner) o; + return Objects.equals(this.positionId, positionCollectionRespPositionListInner.positionId) + && Objects.equals( + this.underlyingAssetName, + positionCollectionRespPositionListInner.underlyingAssetName) + && Objects.equals( + this.underlyingAssetId, + positionCollectionRespPositionListInner.underlyingAssetId) + && Objects.equals(this.assetType, positionCollectionRespPositionListInner.assetType) + && Objects.equals( + this.investmentIds, positionCollectionRespPositionListInner.investmentIds) + && Objects.equals( + this.positionDetail, positionCollectionRespPositionListInner.positionDetail) + && Objects.equals( + this.positionValue, positionCollectionRespPositionListInner.positionValue) + && Objects.equals( + this.tokenList, positionCollectionRespPositionListInner.tokenList); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash( + positionId, + underlyingAssetName, + underlyingAssetId, + assetType, + investmentIds, + positionDetail, + positionValue, + tokenList); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PositionCollectionRespPositionListInner {\n"); + sb.append(" positionId: ").append(toIndentedString(positionId)).append("\n"); + sb.append(" underlyingAssetName: ") + .append(toIndentedString(underlyingAssetName)) + .append("\n"); + sb.append(" underlyingAssetId: ").append(toIndentedString(underlyingAssetId)).append("\n"); + sb.append(" assetType: ").append(toIndentedString(assetType)).append("\n"); + sb.append(" investmentIds: ").append(toIndentedString(investmentIds)).append("\n"); + sb.append(" positionDetail: ").append(toIndentedString(positionDetail)).append("\n"); + sb.append(" positionValue: ").append(toIndentedString(positionValue)).append("\n"); + sb.append(" tokenList: ").append(toIndentedString(tokenList)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object positionIdValue = getPositionId(); + String positionIdValueAsString = ""; + positionIdValueAsString = positionIdValue.toString(); + sb.append("positionId=").append(urlEncode(positionIdValueAsString)).append(""); + Object underlyingAssetNameValue = getUnderlyingAssetName(); + String underlyingAssetNameValueAsString = ""; + underlyingAssetNameValueAsString = underlyingAssetNameValue.toString(); + sb.append("underlyingAssetName=") + .append(urlEncode(underlyingAssetNameValueAsString)) + .append(""); + Object underlyingAssetIdValue = getUnderlyingAssetId(); + String underlyingAssetIdValueAsString = ""; + underlyingAssetIdValueAsString = underlyingAssetIdValue.toString(); + sb.append("underlyingAssetId=") + .append(urlEncode(underlyingAssetIdValueAsString)) + .append(""); + Object assetTypeValue = getAssetType(); + String assetTypeValueAsString = ""; + assetTypeValueAsString = assetTypeValue.toString(); + sb.append("assetType=").append(urlEncode(assetTypeValueAsString)).append(""); + Object investmentIdsValue = getInvestmentIds(); + String investmentIdsValueAsString = ""; + investmentIdsValueAsString = + (String) + ((Collection) investmentIdsValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("investmentIds=").append(urlEncode(investmentIdsValueAsString)).append(""); + Object positionDetailValue = getPositionDetail(); + String positionDetailValueAsString = ""; + positionDetailValueAsString = positionDetailValue.toString(); + sb.append("positionDetail=").append(urlEncode(positionDetailValueAsString)).append(""); + Object positionValueValue = getPositionValue(); + String positionValueValueAsString = ""; + positionValueValueAsString = positionValueValue.toString(); + sb.append("positionValue=").append(urlEncode(positionValueValueAsString)).append(""); + Object tokenListValue = getTokenList(); + String tokenListValueAsString = ""; + tokenListValueAsString = tokenListValue.toString(); + sb.append("tokenList=").append(urlEncode(tokenListValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("positionId"); + openapiFields.add("underlyingAssetName"); + openapiFields.add("underlyingAssetId"); + openapiFields.add("assetType"); + openapiFields.add("investmentIds"); + openapiFields.add("positionDetail"); + openapiFields.add("positionValue"); + openapiFields.add("tokenList"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * PositionCollectionRespPositionListInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PositionCollectionRespPositionListInner.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " PositionCollectionRespPositionListInner is not found in the" + + " empty JSON string", + PositionCollectionRespPositionListInner.openapiRequiredFields + .toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("positionId") != null && !jsonObj.get("positionId").isJsonNull()) + && !jsonObj.get("positionId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `positionId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("positionId").toString())); + } + if ((jsonObj.get("underlyingAssetName") != null + && !jsonObj.get("underlyingAssetName").isJsonNull()) + && !jsonObj.get("underlyingAssetName").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `underlyingAssetName` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("underlyingAssetName").toString())); + } + if ((jsonObj.get("underlyingAssetId") != null + && !jsonObj.get("underlyingAssetId").isJsonNull()) + && !jsonObj.get("underlyingAssetId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `underlyingAssetId` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("underlyingAssetId").toString())); + } + if ((jsonObj.get("assetType") != null && !jsonObj.get("assetType").isJsonNull()) + && !jsonObj.get("assetType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `assetType` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("assetType").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("investmentIds") != null + && !jsonObj.get("investmentIds").isJsonNull() + && !jsonObj.get("investmentIds").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `investmentIds` to be an array in the JSON string" + + " but got `%s`", + jsonObj.get("investmentIds").toString())); + } + // validate the optional field `positionDetail` + if (jsonObj.get("positionDetail") != null && !jsonObj.get("positionDetail").isJsonNull()) { + PositionRespPositionDetail.validateJsonElement(jsonObj.get("positionDetail")); + } + if ((jsonObj.get("positionValue") != null && !jsonObj.get("positionValue").isJsonNull()) + && !jsonObj.get("positionValue").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `positionValue` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("positionValue").toString())); + } + // validate the optional field `tokenList` + if (jsonObj.get("tokenList") != null && !jsonObj.get("tokenList").isJsonNull()) { + PositionRespTokenList.validateJsonElement(jsonObj.get("tokenList")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PositionCollectionRespPositionListInner.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes 'PositionCollectionRespPositionListInner' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(PositionCollectionRespPositionListInner.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, PositionCollectionRespPositionListInner value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PositionCollectionRespPositionListInner read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of PositionCollectionRespPositionListInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of PositionCollectionRespPositionListInner + * @throws IOException if the JSON string is invalid with respect to + * PositionCollectionRespPositionListInner + */ + public static PositionCollectionRespPositionListInner fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, PositionCollectionRespPositionListInner.class); + } + + /** + * Convert an instance of PositionCollectionRespPositionListInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/PositionDetailResp.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/PositionDetailResp.java new file mode 100644 index 0000000..c3ba4ca --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/PositionDetailResp.java @@ -0,0 +1,715 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** + * Position-level metadata. Present for concentrated-liquidity / locked / farming positions; null + * otherwise. Fields are null when not applicable to the position type. + */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class PositionDetailResp { + public static final String SERIALIZED_NAME_POSITION_INDEX = "positionIndex"; + + @SerializedName(SERIALIZED_NAME_POSITION_INDEX) + @jakarta.annotation.Nullable + private String positionIndex; + + public static final String SERIALIZED_NAME_NFT_ID = "nftId"; + + @SerializedName(SERIALIZED_NAME_NFT_ID) + @jakarta.annotation.Nullable + private String nftId; + + public static final String SERIALIZED_NAME_UNLOCK_TIME = "unlockTime"; + + @SerializedName(SERIALIZED_NAME_UNLOCK_TIME) + @jakarta.annotation.Nullable + private String unlockTime; + + public static final String SERIALIZED_NAME_UNLOCK_TIME_REACHED = "unlockTimeReached"; + + @SerializedName(SERIALIZED_NAME_UNLOCK_TIME_REACHED) + @jakarta.annotation.Nullable + private Boolean unlockTimeReached; + + public static final String SERIALIZED_NAME_TICK_LOWER = "tickLower"; + + @SerializedName(SERIALIZED_NAME_TICK_LOWER) + @jakarta.annotation.Nullable + private String tickLower; + + public static final String SERIALIZED_NAME_TICK_UPPER = "tickUpper"; + + @SerializedName(SERIALIZED_NAME_TICK_UPPER) + @jakarta.annotation.Nullable + private String tickUpper; + + public static final String SERIALIZED_NAME_ACTIVE = "active"; + + @SerializedName(SERIALIZED_NAME_ACTIVE) + @jakarta.annotation.Nullable + private Boolean active; + + public static final String SERIALIZED_NAME_PROOFS = "proofs"; + + @SerializedName(SERIALIZED_NAME_PROOFS) + @jakarta.annotation.Nullable + private Map> proofs; + + public static final String SERIALIZED_NAME_STAKE_STATE = "stakeState"; + + @SerializedName(SERIALIZED_NAME_STAKE_STATE) + @jakarta.annotation.Nullable + private String stakeState; + + /** Gets or Sets claimTypes */ + @JsonAdapter(ClaimTypesEnum.Adapter.class) + public enum ClaimTypesEnum { + REWARD_PROTOCOL("REWARD_PROTOCOL"), + + REWARD_INVESTMENT("REWARD_INVESTMENT"), + + LP_FEE("LP_FEE"), + + REDEMPTION("REDEMPTION"); + + private String value; + + ClaimTypesEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ClaimTypesEnum fromValue(String value) { + for (ClaimTypesEnum b : ClaimTypesEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ClaimTypesEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ClaimTypesEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ClaimTypesEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + ClaimTypesEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_CLAIM_TYPES = "claimTypes"; + + @SerializedName(SERIALIZED_NAME_CLAIM_TYPES) + @jakarta.annotation.Nullable + private List claimTypes; + + public static final String SERIALIZED_NAME_REDEMPTION_ID = "redemptionId"; + + @SerializedName(SERIALIZED_NAME_REDEMPTION_ID) + @jakarta.annotation.Nullable + private String redemptionId; + + public PositionDetailResp() {} + + public PositionDetailResp positionIndex(@jakarta.annotation.Nullable String positionIndex) { + this.positionIndex = positionIndex; + return this; + } + + /** + * Position index (e.g. the Uniswap-V3-style position number). + * + * @return positionIndex + */ + @jakarta.annotation.Nullable + public String getPositionIndex() { + return positionIndex; + } + + public void setPositionIndex(@jakarta.annotation.Nullable String positionIndex) { + this.positionIndex = positionIndex; + } + + public PositionDetailResp nftId(@jakarta.annotation.Nullable String nftId) { + this.nftId = nftId; + return this; + } + + /** + * NFT token ID for concentrated-liquidity positions, prefixed with `#` (e.g. + * `\"#7225901\"`). Null for non-NFT positions. The `#` prefix may + * be passed as-is to a transaction build endpoint (`lp-add` / `lp-remove` / + * `claim` `LP_FEE`) — the service strips it automatically; passing the raw + * id without `#` is also accepted. + * + * @return nftId + */ + @jakarta.annotation.Nullable + public String getNftId() { + return nftId; + } + + public void setNftId(@jakarta.annotation.Nullable String nftId) { + this.nftId = nftId; + } + + public PositionDetailResp unlockTime(@jakarta.annotation.Nullable String unlockTime) { + this.unlockTime = unlockTime; + return this; + } + + /** + * Unix timestamp (seconds) when the position unlocks. Null if no lock. + * + * @return unlockTime + */ + @jakarta.annotation.Nullable + public String getUnlockTime() { + return unlockTime; + } + + public void setUnlockTime(@jakarta.annotation.Nullable String unlockTime) { + this.unlockTime = unlockTime; + } + + public PositionDetailResp unlockTimeReached( + @jakarta.annotation.Nullable Boolean unlockTimeReached) { + this.unlockTimeReached = unlockTimeReached; + return this; + } + + /** + * Whether the unlock time has been reached. + * + * @return unlockTimeReached + */ + @jakarta.annotation.Nullable + public Boolean getUnlockTimeReached() { + return unlockTimeReached; + } + + public void setUnlockTimeReached(@jakarta.annotation.Nullable Boolean unlockTimeReached) { + this.unlockTimeReached = unlockTimeReached; + } + + public PositionDetailResp tickLower(@jakarta.annotation.Nullable String tickLower) { + this.tickLower = tickLower; + return this; + } + + /** + * Lower tick bound for concentrated-liquidity positions. + * + * @return tickLower + */ + @jakarta.annotation.Nullable + public String getTickLower() { + return tickLower; + } + + public void setTickLower(@jakarta.annotation.Nullable String tickLower) { + this.tickLower = tickLower; + } + + public PositionDetailResp tickUpper(@jakarta.annotation.Nullable String tickUpper) { + this.tickUpper = tickUpper; + return this; + } + + /** + * Upper tick bound for concentrated-liquidity positions. + * + * @return tickUpper + */ + @jakarta.annotation.Nullable + public String getTickUpper() { + return tickUpper; + } + + public void setTickUpper(@jakarta.annotation.Nullable String tickUpper) { + this.tickUpper = tickUpper; + } + + public PositionDetailResp active(@jakarta.annotation.Nullable Boolean active) { + this.active = active; + return this; + } + + /** + * Whether the position is currently in-range (active). + * + * @return active + */ + @jakarta.annotation.Nullable + public Boolean getActive() { + return active; + } + + public void setActive(@jakarta.annotation.Nullable Boolean active) { + this.active = active; + } + + public PositionDetailResp proofs( + @jakarta.annotation.Nullable Map> proofs) { + this.proofs = proofs; + return this; + } + + public PositionDetailResp putProofsItem(String key, List proofsItem) { + if (this.proofs == null) { + this.proofs = new HashMap<>(); + } + this.proofs.put(key, proofsItem); + return this; + } + + /** + * Merkle proofs keyed by reward token address. Required when claiming PancakeSwap Infinity (V4) + * rewards. + * + * @return proofs + */ + @jakarta.annotation.Nullable + @Valid + public Map> getProofs() { + return proofs; + } + + public void setProofs(@jakarta.annotation.Nullable Map> proofs) { + this.proofs = proofs; + } + + public PositionDetailResp stakeState(@jakarta.annotation.Nullable String stakeState) { + this.stakeState = stakeState; + return this; + } + + /** + * Staking lifecycle state. Complete value set: active (earning), deactivating (unstaking in + * progress, rewards stop), inactive (fully unstaked). + * + * @return stakeState + */ + @jakarta.annotation.Nullable + public String getStakeState() { + return stakeState; + } + + public void setStakeState(@jakarta.annotation.Nullable String stakeState) { + this.stakeState = stakeState; + } + + public PositionDetailResp claimTypes( + @jakarta.annotation.Nullable List claimTypes) { + this.claimTypes = claimTypes; + return this; + } + + public PositionDetailResp addClaimTypesItem(ClaimTypesEnum claimTypesItem) { + if (this.claimTypes == null) { + this.claimTypes = new ArrayList<>(); + } + this.claimTypes.add(claimTypesItem); + return this; + } + + /** + * Claim types available for this position. Values map to the `claimType` field of + * `POST /transaction/claim` and determine which companion fields a claim requires. + * + * @return claimTypes + */ + @jakarta.annotation.Nullable + public List getClaimTypes() { + return claimTypes; + } + + public void setClaimTypes(@jakarta.annotation.Nullable List claimTypes) { + this.claimTypes = claimTypes; + } + + public PositionDetailResp redemptionId(@jakarta.annotation.Nullable String redemptionId) { + this.redemptionId = redemptionId; + return this; + } + + /** + * Redemption record ID (for pending redemptions). Null when not a pending redemption. + * + * @return redemptionId + */ + @jakarta.annotation.Nullable + public String getRedemptionId() { + return redemptionId; + } + + public void setRedemptionId(@jakarta.annotation.Nullable String redemptionId) { + this.redemptionId = redemptionId; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PositionDetailResp positionDetailResp = (PositionDetailResp) o; + return Objects.equals(this.positionIndex, positionDetailResp.positionIndex) + && Objects.equals(this.nftId, positionDetailResp.nftId) + && Objects.equals(this.unlockTime, positionDetailResp.unlockTime) + && Objects.equals(this.unlockTimeReached, positionDetailResp.unlockTimeReached) + && Objects.equals(this.tickLower, positionDetailResp.tickLower) + && Objects.equals(this.tickUpper, positionDetailResp.tickUpper) + && Objects.equals(this.active, positionDetailResp.active) + && Objects.equals(this.proofs, positionDetailResp.proofs) + && Objects.equals(this.stakeState, positionDetailResp.stakeState) + && Objects.equals(this.claimTypes, positionDetailResp.claimTypes) + && Objects.equals(this.redemptionId, positionDetailResp.redemptionId); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash( + positionIndex, + nftId, + unlockTime, + unlockTimeReached, + tickLower, + tickUpper, + active, + proofs, + stakeState, + claimTypes, + redemptionId); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PositionDetailResp {\n"); + sb.append(" positionIndex: ").append(toIndentedString(positionIndex)).append("\n"); + sb.append(" nftId: ").append(toIndentedString(nftId)).append("\n"); + sb.append(" unlockTime: ").append(toIndentedString(unlockTime)).append("\n"); + sb.append(" unlockTimeReached: ").append(toIndentedString(unlockTimeReached)).append("\n"); + sb.append(" tickLower: ").append(toIndentedString(tickLower)).append("\n"); + sb.append(" tickUpper: ").append(toIndentedString(tickUpper)).append("\n"); + sb.append(" active: ").append(toIndentedString(active)).append("\n"); + sb.append(" proofs: ").append(toIndentedString(proofs)).append("\n"); + sb.append(" stakeState: ").append(toIndentedString(stakeState)).append("\n"); + sb.append(" claimTypes: ").append(toIndentedString(claimTypes)).append("\n"); + sb.append(" redemptionId: ").append(toIndentedString(redemptionId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object positionIndexValue = getPositionIndex(); + String positionIndexValueAsString = ""; + positionIndexValueAsString = positionIndexValue.toString(); + sb.append("positionIndex=").append(urlEncode(positionIndexValueAsString)).append(""); + Object nftIdValue = getNftId(); + String nftIdValueAsString = ""; + nftIdValueAsString = nftIdValue.toString(); + sb.append("nftId=").append(urlEncode(nftIdValueAsString)).append(""); + Object unlockTimeValue = getUnlockTime(); + String unlockTimeValueAsString = ""; + unlockTimeValueAsString = unlockTimeValue.toString(); + sb.append("unlockTime=").append(urlEncode(unlockTimeValueAsString)).append(""); + Object unlockTimeReachedValue = getUnlockTimeReached(); + String unlockTimeReachedValueAsString = ""; + unlockTimeReachedValueAsString = unlockTimeReachedValue.toString(); + sb.append("unlockTimeReached=") + .append(urlEncode(unlockTimeReachedValueAsString)) + .append(""); + Object tickLowerValue = getTickLower(); + String tickLowerValueAsString = ""; + tickLowerValueAsString = tickLowerValue.toString(); + sb.append("tickLower=").append(urlEncode(tickLowerValueAsString)).append(""); + Object tickUpperValue = getTickUpper(); + String tickUpperValueAsString = ""; + tickUpperValueAsString = tickUpperValue.toString(); + sb.append("tickUpper=").append(urlEncode(tickUpperValueAsString)).append(""); + Object activeValue = getActive(); + String activeValueAsString = ""; + activeValueAsString = activeValue.toString(); + sb.append("active=").append(urlEncode(activeValueAsString)).append(""); + Object proofsValue = getProofs(); + String proofsValueAsString = ""; + proofsValueAsString = proofsValue.toString(); + sb.append("proofs=").append(urlEncode(proofsValueAsString)).append(""); + Object stakeStateValue = getStakeState(); + String stakeStateValueAsString = ""; + stakeStateValueAsString = stakeStateValue.toString(); + sb.append("stakeState=").append(urlEncode(stakeStateValueAsString)).append(""); + Object claimTypesValue = getClaimTypes(); + String claimTypesValueAsString = ""; + claimTypesValueAsString = + (String) + ((Collection) claimTypesValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("claimTypes=").append(urlEncode(claimTypesValueAsString)).append(""); + Object redemptionIdValue = getRedemptionId(); + String redemptionIdValueAsString = ""; + redemptionIdValueAsString = redemptionIdValue.toString(); + sb.append("redemptionId=").append(urlEncode(redemptionIdValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("positionIndex"); + openapiFields.add("nftId"); + openapiFields.add("unlockTime"); + openapiFields.add("unlockTimeReached"); + openapiFields.add("tickLower"); + openapiFields.add("tickUpper"); + openapiFields.add("active"); + openapiFields.add("proofs"); + openapiFields.add("stakeState"); + openapiFields.add("claimTypes"); + openapiFields.add("redemptionId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PositionDetailResp + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PositionDetailResp.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in PositionDetailResp is not found in the" + + " empty JSON string", + PositionDetailResp.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("positionIndex") != null && !jsonObj.get("positionIndex").isJsonNull()) + && !jsonObj.get("positionIndex").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `positionIndex` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("positionIndex").toString())); + } + if ((jsonObj.get("nftId") != null && !jsonObj.get("nftId").isJsonNull()) + && !jsonObj.get("nftId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `nftId` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("nftId").toString())); + } + if ((jsonObj.get("unlockTime") != null && !jsonObj.get("unlockTime").isJsonNull()) + && !jsonObj.get("unlockTime").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `unlockTime` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("unlockTime").toString())); + } + if ((jsonObj.get("tickLower") != null && !jsonObj.get("tickLower").isJsonNull()) + && !jsonObj.get("tickLower").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `tickLower` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("tickLower").toString())); + } + if ((jsonObj.get("tickUpper") != null && !jsonObj.get("tickUpper").isJsonNull()) + && !jsonObj.get("tickUpper").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `tickUpper` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("tickUpper").toString())); + } + if ((jsonObj.get("stakeState") != null && !jsonObj.get("stakeState").isJsonNull()) + && !jsonObj.get("stakeState").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `stakeState` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("stakeState").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("claimTypes") != null + && !jsonObj.get("claimTypes").isJsonNull() + && !jsonObj.get("claimTypes").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `claimTypes` to be an array in the JSON string but" + + " got `%s`", + jsonObj.get("claimTypes").toString())); + } + if ((jsonObj.get("redemptionId") != null && !jsonObj.get("redemptionId").isJsonNull()) + && !jsonObj.get("redemptionId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `redemptionId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("redemptionId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PositionDetailResp.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PositionDetailResp' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(PositionDetailResp.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, PositionDetailResp value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PositionDetailResp read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of PositionDetailResp given an JSON string + * + * @param jsonString JSON string + * @return An instance of PositionDetailResp + * @throws IOException if the JSON string is invalid with respect to PositionDetailResp + */ + public static PositionDetailResp fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PositionDetailResp.class); + } + + /** + * Convert an instance of PositionDetailResp to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/PositionListResp.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/PositionListResp.java new file mode 100644 index 0000000..b10ba9b --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/PositionListResp.java @@ -0,0 +1,285 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; +import org.hibernate.validator.constraints.*; + +/** Aggregated DeFi positions response. */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class PositionListResp { + public static final String SERIALIZED_NAME_TOTAL_VALUE = "totalValue"; + + @SerializedName(SERIALIZED_NAME_TOTAL_VALUE) + @jakarta.annotation.Nullable + private String totalValue; + + public static final String SERIALIZED_NAME_ADDRESS_LIST = "addressList"; + + @SerializedName(SERIALIZED_NAME_ADDRESS_LIST) + @jakarta.annotation.Nullable + private List<@Valid PositionListRespAddressListInner> addressList; + + public PositionListResp() {} + + public PositionListResp totalValue(@jakarta.annotation.Nullable String totalValue) { + this.totalValue = totalValue; + return this; + } + + /** + * Total value of all DeFi positions of all queried addresses (USD). Same raw precision as + * addressTotalValue. + * + * @return totalValue + */ + @jakarta.annotation.Nullable + public String getTotalValue() { + return totalValue; + } + + public void setTotalValue(@jakarta.annotation.Nullable String totalValue) { + this.totalValue = totalValue; + } + + public PositionListResp addressList( + @jakarta.annotation.Nullable + List<@Valid PositionListRespAddressListInner> addressList) { + this.addressList = addressList; + return this; + } + + public PositionListResp addAddressListItem(PositionListRespAddressListInner addressListItem) { + if (this.addressList == null) { + this.addressList = new ArrayList<>(); + } + this.addressList.add(addressListItem); + return this; + } + + /** + * Address-level position summaries. + * + * @return addressList + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid PositionListRespAddressListInner> getAddressList() { + return addressList; + } + + public void setAddressList( + @jakarta.annotation.Nullable + List<@Valid PositionListRespAddressListInner> addressList) { + this.addressList = addressList; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PositionListResp positionListResp = (PositionListResp) o; + return Objects.equals(this.totalValue, positionListResp.totalValue) + && Objects.equals(this.addressList, positionListResp.addressList); + } + + @Override + public int hashCode() { + return Objects.hash(totalValue, addressList); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PositionListResp {\n"); + sb.append(" totalValue: ").append(toIndentedString(totalValue)).append("\n"); + sb.append(" addressList: ").append(toIndentedString(addressList)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object totalValueValue = getTotalValue(); + String totalValueValueAsString = ""; + totalValueValueAsString = totalValueValue.toString(); + sb.append("totalValue=").append(urlEncode(totalValueValueAsString)).append(""); + Object addressListValue = getAddressList(); + String addressListValueAsString = ""; + addressListValueAsString = + (String) + ((Collection) addressListValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("addressList=").append(urlEncode(addressListValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("totalValue"); + openapiFields.add("addressList"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PositionListResp + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PositionListResp.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in PositionListResp is not found in the" + + " empty JSON string", + PositionListResp.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("totalValue") != null && !jsonObj.get("totalValue").isJsonNull()) + && !jsonObj.get("totalValue").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `totalValue` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("totalValue").toString())); + } + if (jsonObj.get("addressList") != null && !jsonObj.get("addressList").isJsonNull()) { + JsonArray jsonArrayaddressList = jsonObj.getAsJsonArray("addressList"); + if (jsonArrayaddressList != null) { + // ensure the json data is an array + if (!jsonObj.get("addressList").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `addressList` to be an array in the JSON" + + " string but got `%s`", + jsonObj.get("addressList").toString())); + } + + // validate the optional field `addressList` (array) + for (int i = 0; i < jsonArrayaddressList.size(); i++) { + PositionListRespAddressListInner.validateJsonElement( + jsonArrayaddressList.get(i)); + } + ; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PositionListResp.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PositionListResp' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(PositionListResp.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, PositionListResp value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PositionListResp read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of PositionListResp given an JSON string + * + * @param jsonString JSON string + * @return An instance of PositionListResp + * @throws IOException if the JSON string is invalid with respect to PositionListResp + */ + public static PositionListResp fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PositionListResp.class); + } + + /** + * Convert an instance of PositionListResp to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/PositionListRespAddressListInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/PositionListRespAddressListInner.java new file mode 100644 index 0000000..a518891 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/PositionListRespAddressListInner.java @@ -0,0 +1,336 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; +import org.hibernate.validator.constraints.*; + +/** + * Address-level aggregation. Groups the protocol-level position summaries of one wallet address. + */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class PositionListRespAddressListInner { + public static final String SERIALIZED_NAME_ADDRESS = "address"; + + @SerializedName(SERIALIZED_NAME_ADDRESS) + @jakarta.annotation.Nullable + private String address; + + public static final String SERIALIZED_NAME_ADDRESS_TOTAL_VALUE = "addressTotalValue"; + + @SerializedName(SERIALIZED_NAME_ADDRESS_TOTAL_VALUE) + @jakarta.annotation.Nullable + private String addressTotalValue; + + public static final String SERIALIZED_NAME_PROTOCOL_LIST = "protocolList"; + + @SerializedName(SERIALIZED_NAME_PROTOCOL_LIST) + @jakarta.annotation.Nullable + private List<@Valid AddressRespProtocolListInner> protocolList; + + public PositionListRespAddressListInner() {} + + public PositionListRespAddressListInner address(@jakarta.annotation.Nullable String address) { + this.address = address; + return this; + } + + /** + * Wallet address. + * + * @return address + */ + @jakarta.annotation.Nullable + public String getAddress() { + return address; + } + + public void setAddress(@jakarta.annotation.Nullable String address) { + this.address = address; + } + + public PositionListRespAddressListInner addressTotalValue( + @jakarta.annotation.Nullable String addressTotalValue) { + this.addressTotalValue = addressTotalValue; + return this; + } + + /** + * Total DeFi position value of this address across all chains (USD). Same raw precision as the + * position values. + * + * @return addressTotalValue + */ + @jakarta.annotation.Nullable + public String getAddressTotalValue() { + return addressTotalValue; + } + + public void setAddressTotalValue(@jakarta.annotation.Nullable String addressTotalValue) { + this.addressTotalValue = addressTotalValue; + } + + public PositionListRespAddressListInner protocolList( + @jakarta.annotation.Nullable List<@Valid AddressRespProtocolListInner> protocolList) { + this.protocolList = protocolList; + return this; + } + + public PositionListRespAddressListInner addProtocolListItem( + AddressRespProtocolListInner protocolListItem) { + if (this.protocolList == null) { + this.protocolList = new ArrayList<>(); + } + this.protocolList.add(protocolListItem); + return this; + } + + /** + * Protocol-level position summaries of this address. + * + * @return protocolList + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid AddressRespProtocolListInner> getProtocolList() { + return protocolList; + } + + public void setProtocolList( + @jakarta.annotation.Nullable List<@Valid AddressRespProtocolListInner> protocolList) { + this.protocolList = protocolList; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PositionListRespAddressListInner positionListRespAddressListInner = + (PositionListRespAddressListInner) o; + return Objects.equals(this.address, positionListRespAddressListInner.address) + && Objects.equals( + this.addressTotalValue, positionListRespAddressListInner.addressTotalValue) + && Objects.equals(this.protocolList, positionListRespAddressListInner.protocolList); + } + + @Override + public int hashCode() { + return Objects.hash(address, addressTotalValue, protocolList); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PositionListRespAddressListInner {\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append(" addressTotalValue: ").append(toIndentedString(addressTotalValue)).append("\n"); + sb.append(" protocolList: ").append(toIndentedString(protocolList)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object addressValue = getAddress(); + String addressValueAsString = ""; + addressValueAsString = addressValue.toString(); + sb.append("address=").append(urlEncode(addressValueAsString)).append(""); + Object addressTotalValueValue = getAddressTotalValue(); + String addressTotalValueValueAsString = ""; + addressTotalValueValueAsString = addressTotalValueValue.toString(); + sb.append("addressTotalValue=") + .append(urlEncode(addressTotalValueValueAsString)) + .append(""); + Object protocolListValue = getProtocolList(); + String protocolListValueAsString = ""; + protocolListValueAsString = + (String) + ((Collection) protocolListValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("protocolList=").append(urlEncode(protocolListValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("address"); + openapiFields.add("addressTotalValue"); + openapiFields.add("protocolList"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * PositionListRespAddressListInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PositionListRespAddressListInner.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in PositionListRespAddressListInner is" + + " not found in the empty JSON string", + PositionListRespAddressListInner.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("address") != null && !jsonObj.get("address").isJsonNull()) + && !jsonObj.get("address").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `address` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("address").toString())); + } + if ((jsonObj.get("addressTotalValue") != null + && !jsonObj.get("addressTotalValue").isJsonNull()) + && !jsonObj.get("addressTotalValue").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `addressTotalValue` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("addressTotalValue").toString())); + } + if (jsonObj.get("protocolList") != null && !jsonObj.get("protocolList").isJsonNull()) { + JsonArray jsonArrayprotocolList = jsonObj.getAsJsonArray("protocolList"); + if (jsonArrayprotocolList != null) { + // ensure the json data is an array + if (!jsonObj.get("protocolList").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `protocolList` to be an array in the JSON" + + " string but got `%s`", + jsonObj.get("protocolList").toString())); + } + + // validate the optional field `protocolList` (array) + for (int i = 0; i < jsonArrayprotocolList.size(); i++) { + AddressRespProtocolListInner.validateJsonElement(jsonArrayprotocolList.get(i)); + } + ; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PositionListRespAddressListInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PositionListRespAddressListInner' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(PositionListRespAddressListInner.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, PositionListRespAddressListInner value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PositionListRespAddressListInner read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of PositionListRespAddressListInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of PositionListRespAddressListInner + * @throws IOException if the JSON string is invalid with respect to + * PositionListRespAddressListInner + */ + public static PositionListRespAddressListInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PositionListRespAddressListInner.class); + } + + /** + * Convert an instance of PositionListRespAddressListInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/PositionResp.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/PositionResp.java new file mode 100644 index 0000000..b3446b5 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/PositionResp.java @@ -0,0 +1,548 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** A single DeFi position with underlying asset and token breakdown. */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class PositionResp { + public static final String SERIALIZED_NAME_POSITION_ID = "positionId"; + + @SerializedName(SERIALIZED_NAME_POSITION_ID) + @jakarta.annotation.Nullable + private String positionId; + + public static final String SERIALIZED_NAME_UNDERLYING_ASSET_NAME = "underlyingAssetName"; + + @SerializedName(SERIALIZED_NAME_UNDERLYING_ASSET_NAME) + @jakarta.annotation.Nullable + private String underlyingAssetName; + + public static final String SERIALIZED_NAME_UNDERLYING_ASSET_ID = "underlyingAssetId"; + + @SerializedName(SERIALIZED_NAME_UNDERLYING_ASSET_ID) + @jakarta.annotation.Nullable + private String underlyingAssetId; + + public static final String SERIALIZED_NAME_ASSET_TYPE = "assetType"; + + @SerializedName(SERIALIZED_NAME_ASSET_TYPE) + @jakarta.annotation.Nullable + private String assetType; + + public static final String SERIALIZED_NAME_INVESTMENT_IDS = "investmentIds"; + + @SerializedName(SERIALIZED_NAME_INVESTMENT_IDS) + @jakarta.annotation.Nullable + private List investmentIds; + + public static final String SERIALIZED_NAME_POSITION_DETAIL = "positionDetail"; + + @SerializedName(SERIALIZED_NAME_POSITION_DETAIL) + @jakarta.annotation.Nullable + private PositionRespPositionDetail positionDetail; + + public static final String SERIALIZED_NAME_POSITION_VALUE = "positionValue"; + + @SerializedName(SERIALIZED_NAME_POSITION_VALUE) + @jakarta.annotation.Nullable + private String positionValue; + + public static final String SERIALIZED_NAME_TOKEN_LIST = "tokenList"; + + @SerializedName(SERIALIZED_NAME_TOKEN_LIST) + @jakarta.annotation.Nullable + private PositionRespTokenList tokenList; + + public PositionResp() {} + + public PositionResp positionId(@jakarta.annotation.Nullable String positionId) { + this.positionId = positionId; + return this; + } + + /** + * Unique position identifier (64-char hex, no `0x` prefix). + * + * @return positionId + */ + @jakarta.annotation.Nullable + public String getPositionId() { + return positionId; + } + + public void setPositionId(@jakarta.annotation.Nullable String positionId) { + this.positionId = positionId; + } + + public PositionResp underlyingAssetName( + @jakarta.annotation.Nullable String underlyingAssetName) { + this.underlyingAssetName = underlyingAssetName; + return this; + } + + /** + * Display name of the underlying asset (e.g. \"USDT-USDC\", \"lisUSD\"). + * + * @return underlyingAssetName + */ + @jakarta.annotation.Nullable + public String getUnderlyingAssetName() { + return underlyingAssetName; + } + + public void setUnderlyingAssetName(@jakarta.annotation.Nullable String underlyingAssetName) { + this.underlyingAssetName = underlyingAssetName; + } + + public PositionResp underlyingAssetId(@jakarta.annotation.Nullable String underlyingAssetId) { + this.underlyingAssetId = underlyingAssetId; + return this; + } + + /** + * Underlying asset identifier (64-char hex, no `0x` prefix). Hashed from the pool and + * underlying token addresses. + * + * @return underlyingAssetId + */ + @jakarta.annotation.Nullable + public String getUnderlyingAssetId() { + return underlyingAssetId; + } + + public void setUnderlyingAssetId(@jakarta.annotation.Nullable String underlyingAssetId) { + this.underlyingAssetId = underlyingAssetId; + } + + public PositionResp assetType(@jakarta.annotation.Nullable String assetType) { + this.assetType = assetType; + return this; + } + + /** + * Asset structure type. Null for a regular position; `locked` for a locked position + * (e.g. locked staking — check `unlockTime` on positionDetail); `farming` + * for a MasterChef-style farming position (rewards accrue under the `farming_reward` + * token group). + * + * @return assetType + */ + @jakarta.annotation.Nullable + public String getAssetType() { + return assetType; + } + + public void setAssetType(@jakarta.annotation.Nullable String assetType) { + this.assetType = assetType; + } + + public PositionResp investmentIds(@jakarta.annotation.Nullable List investmentIds) { + this.investmentIds = investmentIds; + return this; + } + + public PositionResp addInvestmentIdsItem(String investmentIdsItem) { + if (this.investmentIds == null) { + this.investmentIds = new ArrayList<>(); + } + this.investmentIds.add(investmentIdsItem); + return this; + } + + /** + * Related investment IDs (64-char hex, no `0x` prefix). Use with `POST + * /api/v1/defi/data/investment/detail`. Usually a single entry; a position can relate to + * several investments when the pool stacks products on top of each other (e.g. a farming + * position wraps the underlying LP investment plus its incentive product, or a staked vault + * layers a receipt token over the base deposit). When there are several, query each with + * investment/detail and pick by the action you want to perform — redeeming the principal uses + * the base investment, claiming farming incentives uses the incentive one. + * + * @return investmentIds + */ + @jakarta.annotation.Nullable + public List getInvestmentIds() { + return investmentIds; + } + + public void setInvestmentIds(@jakarta.annotation.Nullable List investmentIds) { + this.investmentIds = investmentIds; + } + + public PositionResp positionDetail( + @jakarta.annotation.Nullable PositionRespPositionDetail positionDetail) { + this.positionDetail = positionDetail; + return this; + } + + /** + * Get positionDetail + * + * @return positionDetail + */ + @jakarta.annotation.Nullable + @Valid + public PositionRespPositionDetail getPositionDetail() { + return positionDetail; + } + + public void setPositionDetail( + @jakarta.annotation.Nullable PositionRespPositionDetail positionDetail) { + this.positionDetail = positionDetail; + } + + public PositionResp positionValue(@jakarta.annotation.Nullable String positionValue) { + this.positionValue = positionValue; + return this; + } + + /** + * Total position value in USD (sum of all token values; may be negative for borrow positions). + * + * @return positionValue + */ + @jakarta.annotation.Nullable + public String getPositionValue() { + return positionValue; + } + + public void setPositionValue(@jakarta.annotation.Nullable String positionValue) { + this.positionValue = positionValue; + } + + public PositionResp tokenList(@jakarta.annotation.Nullable PositionRespTokenList tokenList) { + this.tokenList = tokenList; + return this; + } + + /** + * Get tokenList + * + * @return tokenList + */ + @jakarta.annotation.Nullable + @Valid + public PositionRespTokenList getTokenList() { + return tokenList; + } + + public void setTokenList(@jakarta.annotation.Nullable PositionRespTokenList tokenList) { + this.tokenList = tokenList; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PositionResp positionResp = (PositionResp) o; + return Objects.equals(this.positionId, positionResp.positionId) + && Objects.equals(this.underlyingAssetName, positionResp.underlyingAssetName) + && Objects.equals(this.underlyingAssetId, positionResp.underlyingAssetId) + && Objects.equals(this.assetType, positionResp.assetType) + && Objects.equals(this.investmentIds, positionResp.investmentIds) + && Objects.equals(this.positionDetail, positionResp.positionDetail) + && Objects.equals(this.positionValue, positionResp.positionValue) + && Objects.equals(this.tokenList, positionResp.tokenList); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash( + positionId, + underlyingAssetName, + underlyingAssetId, + assetType, + investmentIds, + positionDetail, + positionValue, + tokenList); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PositionResp {\n"); + sb.append(" positionId: ").append(toIndentedString(positionId)).append("\n"); + sb.append(" underlyingAssetName: ") + .append(toIndentedString(underlyingAssetName)) + .append("\n"); + sb.append(" underlyingAssetId: ").append(toIndentedString(underlyingAssetId)).append("\n"); + sb.append(" assetType: ").append(toIndentedString(assetType)).append("\n"); + sb.append(" investmentIds: ").append(toIndentedString(investmentIds)).append("\n"); + sb.append(" positionDetail: ").append(toIndentedString(positionDetail)).append("\n"); + sb.append(" positionValue: ").append(toIndentedString(positionValue)).append("\n"); + sb.append(" tokenList: ").append(toIndentedString(tokenList)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object positionIdValue = getPositionId(); + String positionIdValueAsString = ""; + positionIdValueAsString = positionIdValue.toString(); + sb.append("positionId=").append(urlEncode(positionIdValueAsString)).append(""); + Object underlyingAssetNameValue = getUnderlyingAssetName(); + String underlyingAssetNameValueAsString = ""; + underlyingAssetNameValueAsString = underlyingAssetNameValue.toString(); + sb.append("underlyingAssetName=") + .append(urlEncode(underlyingAssetNameValueAsString)) + .append(""); + Object underlyingAssetIdValue = getUnderlyingAssetId(); + String underlyingAssetIdValueAsString = ""; + underlyingAssetIdValueAsString = underlyingAssetIdValue.toString(); + sb.append("underlyingAssetId=") + .append(urlEncode(underlyingAssetIdValueAsString)) + .append(""); + Object assetTypeValue = getAssetType(); + String assetTypeValueAsString = ""; + assetTypeValueAsString = assetTypeValue.toString(); + sb.append("assetType=").append(urlEncode(assetTypeValueAsString)).append(""); + Object investmentIdsValue = getInvestmentIds(); + String investmentIdsValueAsString = ""; + investmentIdsValueAsString = + (String) + ((Collection) investmentIdsValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("investmentIds=").append(urlEncode(investmentIdsValueAsString)).append(""); + Object positionDetailValue = getPositionDetail(); + String positionDetailValueAsString = ""; + positionDetailValueAsString = positionDetailValue.toString(); + sb.append("positionDetail=").append(urlEncode(positionDetailValueAsString)).append(""); + Object positionValueValue = getPositionValue(); + String positionValueValueAsString = ""; + positionValueValueAsString = positionValueValue.toString(); + sb.append("positionValue=").append(urlEncode(positionValueValueAsString)).append(""); + Object tokenListValue = getTokenList(); + String tokenListValueAsString = ""; + tokenListValueAsString = tokenListValue.toString(); + sb.append("tokenList=").append(urlEncode(tokenListValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("positionId"); + openapiFields.add("underlyingAssetName"); + openapiFields.add("underlyingAssetId"); + openapiFields.add("assetType"); + openapiFields.add("investmentIds"); + openapiFields.add("positionDetail"); + openapiFields.add("positionValue"); + openapiFields.add("tokenList"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PositionResp + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PositionResp.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in PositionResp is not found in the empty" + + " JSON string", + PositionResp.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("positionId") != null && !jsonObj.get("positionId").isJsonNull()) + && !jsonObj.get("positionId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `positionId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("positionId").toString())); + } + if ((jsonObj.get("underlyingAssetName") != null + && !jsonObj.get("underlyingAssetName").isJsonNull()) + && !jsonObj.get("underlyingAssetName").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `underlyingAssetName` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("underlyingAssetName").toString())); + } + if ((jsonObj.get("underlyingAssetId") != null + && !jsonObj.get("underlyingAssetId").isJsonNull()) + && !jsonObj.get("underlyingAssetId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `underlyingAssetId` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("underlyingAssetId").toString())); + } + if ((jsonObj.get("assetType") != null && !jsonObj.get("assetType").isJsonNull()) + && !jsonObj.get("assetType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `assetType` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("assetType").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("investmentIds") != null + && !jsonObj.get("investmentIds").isJsonNull() + && !jsonObj.get("investmentIds").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `investmentIds` to be an array in the JSON string" + + " but got `%s`", + jsonObj.get("investmentIds").toString())); + } + // validate the optional field `positionDetail` + if (jsonObj.get("positionDetail") != null && !jsonObj.get("positionDetail").isJsonNull()) { + PositionRespPositionDetail.validateJsonElement(jsonObj.get("positionDetail")); + } + if ((jsonObj.get("positionValue") != null && !jsonObj.get("positionValue").isJsonNull()) + && !jsonObj.get("positionValue").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `positionValue` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("positionValue").toString())); + } + // validate the optional field `tokenList` + if (jsonObj.get("tokenList") != null && !jsonObj.get("tokenList").isJsonNull()) { + PositionRespTokenList.validateJsonElement(jsonObj.get("tokenList")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PositionResp.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PositionResp' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(PositionResp.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, PositionResp value) throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PositionResp read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of PositionResp given an JSON string + * + * @param jsonString JSON string + * @return An instance of PositionResp + * @throws IOException if the JSON string is invalid with respect to PositionResp + */ + public static PositionResp fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PositionResp.class); + } + + /** + * Convert an instance of PositionResp to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/PositionRespPositionDetail.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/PositionRespPositionDetail.java new file mode 100644 index 0000000..f143957 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/PositionRespPositionDetail.java @@ -0,0 +1,719 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** + * Position-level metadata. Present for concentrated-liquidity / locked / farming positions; null + * otherwise. Fields are null when not applicable to the position type. + */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class PositionRespPositionDetail { + public static final String SERIALIZED_NAME_POSITION_INDEX = "positionIndex"; + + @SerializedName(SERIALIZED_NAME_POSITION_INDEX) + @jakarta.annotation.Nullable + private String positionIndex; + + public static final String SERIALIZED_NAME_NFT_ID = "nftId"; + + @SerializedName(SERIALIZED_NAME_NFT_ID) + @jakarta.annotation.Nullable + private String nftId; + + public static final String SERIALIZED_NAME_UNLOCK_TIME = "unlockTime"; + + @SerializedName(SERIALIZED_NAME_UNLOCK_TIME) + @jakarta.annotation.Nullable + private String unlockTime; + + public static final String SERIALIZED_NAME_UNLOCK_TIME_REACHED = "unlockTimeReached"; + + @SerializedName(SERIALIZED_NAME_UNLOCK_TIME_REACHED) + @jakarta.annotation.Nullable + private Boolean unlockTimeReached; + + public static final String SERIALIZED_NAME_TICK_LOWER = "tickLower"; + + @SerializedName(SERIALIZED_NAME_TICK_LOWER) + @jakarta.annotation.Nullable + private String tickLower; + + public static final String SERIALIZED_NAME_TICK_UPPER = "tickUpper"; + + @SerializedName(SERIALIZED_NAME_TICK_UPPER) + @jakarta.annotation.Nullable + private String tickUpper; + + public static final String SERIALIZED_NAME_ACTIVE = "active"; + + @SerializedName(SERIALIZED_NAME_ACTIVE) + @jakarta.annotation.Nullable + private Boolean active; + + public static final String SERIALIZED_NAME_PROOFS = "proofs"; + + @SerializedName(SERIALIZED_NAME_PROOFS) + @jakarta.annotation.Nullable + private Map> proofs; + + public static final String SERIALIZED_NAME_STAKE_STATE = "stakeState"; + + @SerializedName(SERIALIZED_NAME_STAKE_STATE) + @jakarta.annotation.Nullable + private String stakeState; + + /** Gets or Sets claimTypes */ + @JsonAdapter(ClaimTypesEnum.Adapter.class) + public enum ClaimTypesEnum { + REWARD_PROTOCOL("REWARD_PROTOCOL"), + + REWARD_INVESTMENT("REWARD_INVESTMENT"), + + LP_FEE("LP_FEE"), + + REDEMPTION("REDEMPTION"); + + private String value; + + ClaimTypesEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ClaimTypesEnum fromValue(String value) { + for (ClaimTypesEnum b : ClaimTypesEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ClaimTypesEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ClaimTypesEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ClaimTypesEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + ClaimTypesEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_CLAIM_TYPES = "claimTypes"; + + @SerializedName(SERIALIZED_NAME_CLAIM_TYPES) + @jakarta.annotation.Nullable + private List claimTypes; + + public static final String SERIALIZED_NAME_REDEMPTION_ID = "redemptionId"; + + @SerializedName(SERIALIZED_NAME_REDEMPTION_ID) + @jakarta.annotation.Nullable + private String redemptionId; + + public PositionRespPositionDetail() {} + + public PositionRespPositionDetail positionIndex( + @jakarta.annotation.Nullable String positionIndex) { + this.positionIndex = positionIndex; + return this; + } + + /** + * Position index (e.g. the Uniswap-V3-style position number). + * + * @return positionIndex + */ + @jakarta.annotation.Nullable + public String getPositionIndex() { + return positionIndex; + } + + public void setPositionIndex(@jakarta.annotation.Nullable String positionIndex) { + this.positionIndex = positionIndex; + } + + public PositionRespPositionDetail nftId(@jakarta.annotation.Nullable String nftId) { + this.nftId = nftId; + return this; + } + + /** + * NFT token ID for concentrated-liquidity positions, prefixed with `#` (e.g. + * `\"#7225901\"`). Null for non-NFT positions. The `#` prefix may + * be passed as-is to a transaction build endpoint (`lp-add` / `lp-remove` / + * `claim` `LP_FEE`) — the service strips it automatically; passing the raw + * id without `#` is also accepted. + * + * @return nftId + */ + @jakarta.annotation.Nullable + public String getNftId() { + return nftId; + } + + public void setNftId(@jakarta.annotation.Nullable String nftId) { + this.nftId = nftId; + } + + public PositionRespPositionDetail unlockTime(@jakarta.annotation.Nullable String unlockTime) { + this.unlockTime = unlockTime; + return this; + } + + /** + * Unix timestamp (seconds) when the position unlocks. Null if no lock. + * + * @return unlockTime + */ + @jakarta.annotation.Nullable + public String getUnlockTime() { + return unlockTime; + } + + public void setUnlockTime(@jakarta.annotation.Nullable String unlockTime) { + this.unlockTime = unlockTime; + } + + public PositionRespPositionDetail unlockTimeReached( + @jakarta.annotation.Nullable Boolean unlockTimeReached) { + this.unlockTimeReached = unlockTimeReached; + return this; + } + + /** + * Whether the unlock time has been reached. + * + * @return unlockTimeReached + */ + @jakarta.annotation.Nullable + public Boolean getUnlockTimeReached() { + return unlockTimeReached; + } + + public void setUnlockTimeReached(@jakarta.annotation.Nullable Boolean unlockTimeReached) { + this.unlockTimeReached = unlockTimeReached; + } + + public PositionRespPositionDetail tickLower(@jakarta.annotation.Nullable String tickLower) { + this.tickLower = tickLower; + return this; + } + + /** + * Lower tick bound for concentrated-liquidity positions. + * + * @return tickLower + */ + @jakarta.annotation.Nullable + public String getTickLower() { + return tickLower; + } + + public void setTickLower(@jakarta.annotation.Nullable String tickLower) { + this.tickLower = tickLower; + } + + public PositionRespPositionDetail tickUpper(@jakarta.annotation.Nullable String tickUpper) { + this.tickUpper = tickUpper; + return this; + } + + /** + * Upper tick bound for concentrated-liquidity positions. + * + * @return tickUpper + */ + @jakarta.annotation.Nullable + public String getTickUpper() { + return tickUpper; + } + + public void setTickUpper(@jakarta.annotation.Nullable String tickUpper) { + this.tickUpper = tickUpper; + } + + public PositionRespPositionDetail active(@jakarta.annotation.Nullable Boolean active) { + this.active = active; + return this; + } + + /** + * Whether the position is currently in-range (active). + * + * @return active + */ + @jakarta.annotation.Nullable + public Boolean getActive() { + return active; + } + + public void setActive(@jakarta.annotation.Nullable Boolean active) { + this.active = active; + } + + public PositionRespPositionDetail proofs( + @jakarta.annotation.Nullable Map> proofs) { + this.proofs = proofs; + return this; + } + + public PositionRespPositionDetail putProofsItem(String key, List proofsItem) { + if (this.proofs == null) { + this.proofs = new HashMap<>(); + } + this.proofs.put(key, proofsItem); + return this; + } + + /** + * Merkle proofs keyed by reward token address. Required when claiming PancakeSwap Infinity (V4) + * rewards. + * + * @return proofs + */ + @jakarta.annotation.Nullable + @Valid + public Map> getProofs() { + return proofs; + } + + public void setProofs(@jakarta.annotation.Nullable Map> proofs) { + this.proofs = proofs; + } + + public PositionRespPositionDetail stakeState(@jakarta.annotation.Nullable String stakeState) { + this.stakeState = stakeState; + return this; + } + + /** + * Staking lifecycle state. Complete value set: active (earning), deactivating (unstaking in + * progress, rewards stop), inactive (fully unstaked). + * + * @return stakeState + */ + @jakarta.annotation.Nullable + public String getStakeState() { + return stakeState; + } + + public void setStakeState(@jakarta.annotation.Nullable String stakeState) { + this.stakeState = stakeState; + } + + public PositionRespPositionDetail claimTypes( + @jakarta.annotation.Nullable List claimTypes) { + this.claimTypes = claimTypes; + return this; + } + + public PositionRespPositionDetail addClaimTypesItem(ClaimTypesEnum claimTypesItem) { + if (this.claimTypes == null) { + this.claimTypes = new ArrayList<>(); + } + this.claimTypes.add(claimTypesItem); + return this; + } + + /** + * Claim types available for this position. Values map to the `claimType` field of + * `POST /transaction/claim` and determine which companion fields a claim requires. + * + * @return claimTypes + */ + @jakarta.annotation.Nullable + public List getClaimTypes() { + return claimTypes; + } + + public void setClaimTypes(@jakarta.annotation.Nullable List claimTypes) { + this.claimTypes = claimTypes; + } + + public PositionRespPositionDetail redemptionId( + @jakarta.annotation.Nullable String redemptionId) { + this.redemptionId = redemptionId; + return this; + } + + /** + * Redemption record ID (for pending redemptions). Null when not a pending redemption. + * + * @return redemptionId + */ + @jakarta.annotation.Nullable + public String getRedemptionId() { + return redemptionId; + } + + public void setRedemptionId(@jakarta.annotation.Nullable String redemptionId) { + this.redemptionId = redemptionId; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PositionRespPositionDetail positionRespPositionDetail = (PositionRespPositionDetail) o; + return Objects.equals(this.positionIndex, positionRespPositionDetail.positionIndex) + && Objects.equals(this.nftId, positionRespPositionDetail.nftId) + && Objects.equals(this.unlockTime, positionRespPositionDetail.unlockTime) + && Objects.equals( + this.unlockTimeReached, positionRespPositionDetail.unlockTimeReached) + && Objects.equals(this.tickLower, positionRespPositionDetail.tickLower) + && Objects.equals(this.tickUpper, positionRespPositionDetail.tickUpper) + && Objects.equals(this.active, positionRespPositionDetail.active) + && Objects.equals(this.proofs, positionRespPositionDetail.proofs) + && Objects.equals(this.stakeState, positionRespPositionDetail.stakeState) + && Objects.equals(this.claimTypes, positionRespPositionDetail.claimTypes) + && Objects.equals(this.redemptionId, positionRespPositionDetail.redemptionId); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash( + positionIndex, + nftId, + unlockTime, + unlockTimeReached, + tickLower, + tickUpper, + active, + proofs, + stakeState, + claimTypes, + redemptionId); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PositionRespPositionDetail {\n"); + sb.append(" positionIndex: ").append(toIndentedString(positionIndex)).append("\n"); + sb.append(" nftId: ").append(toIndentedString(nftId)).append("\n"); + sb.append(" unlockTime: ").append(toIndentedString(unlockTime)).append("\n"); + sb.append(" unlockTimeReached: ").append(toIndentedString(unlockTimeReached)).append("\n"); + sb.append(" tickLower: ").append(toIndentedString(tickLower)).append("\n"); + sb.append(" tickUpper: ").append(toIndentedString(tickUpper)).append("\n"); + sb.append(" active: ").append(toIndentedString(active)).append("\n"); + sb.append(" proofs: ").append(toIndentedString(proofs)).append("\n"); + sb.append(" stakeState: ").append(toIndentedString(stakeState)).append("\n"); + sb.append(" claimTypes: ").append(toIndentedString(claimTypes)).append("\n"); + sb.append(" redemptionId: ").append(toIndentedString(redemptionId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object positionIndexValue = getPositionIndex(); + String positionIndexValueAsString = ""; + positionIndexValueAsString = positionIndexValue.toString(); + sb.append("positionIndex=").append(urlEncode(positionIndexValueAsString)).append(""); + Object nftIdValue = getNftId(); + String nftIdValueAsString = ""; + nftIdValueAsString = nftIdValue.toString(); + sb.append("nftId=").append(urlEncode(nftIdValueAsString)).append(""); + Object unlockTimeValue = getUnlockTime(); + String unlockTimeValueAsString = ""; + unlockTimeValueAsString = unlockTimeValue.toString(); + sb.append("unlockTime=").append(urlEncode(unlockTimeValueAsString)).append(""); + Object unlockTimeReachedValue = getUnlockTimeReached(); + String unlockTimeReachedValueAsString = ""; + unlockTimeReachedValueAsString = unlockTimeReachedValue.toString(); + sb.append("unlockTimeReached=") + .append(urlEncode(unlockTimeReachedValueAsString)) + .append(""); + Object tickLowerValue = getTickLower(); + String tickLowerValueAsString = ""; + tickLowerValueAsString = tickLowerValue.toString(); + sb.append("tickLower=").append(urlEncode(tickLowerValueAsString)).append(""); + Object tickUpperValue = getTickUpper(); + String tickUpperValueAsString = ""; + tickUpperValueAsString = tickUpperValue.toString(); + sb.append("tickUpper=").append(urlEncode(tickUpperValueAsString)).append(""); + Object activeValue = getActive(); + String activeValueAsString = ""; + activeValueAsString = activeValue.toString(); + sb.append("active=").append(urlEncode(activeValueAsString)).append(""); + Object proofsValue = getProofs(); + String proofsValueAsString = ""; + proofsValueAsString = proofsValue.toString(); + sb.append("proofs=").append(urlEncode(proofsValueAsString)).append(""); + Object stakeStateValue = getStakeState(); + String stakeStateValueAsString = ""; + stakeStateValueAsString = stakeStateValue.toString(); + sb.append("stakeState=").append(urlEncode(stakeStateValueAsString)).append(""); + Object claimTypesValue = getClaimTypes(); + String claimTypesValueAsString = ""; + claimTypesValueAsString = + (String) + ((Collection) claimTypesValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("claimTypes=").append(urlEncode(claimTypesValueAsString)).append(""); + Object redemptionIdValue = getRedemptionId(); + String redemptionIdValueAsString = ""; + redemptionIdValueAsString = redemptionIdValue.toString(); + sb.append("redemptionId=").append(urlEncode(redemptionIdValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("positionIndex"); + openapiFields.add("nftId"); + openapiFields.add("unlockTime"); + openapiFields.add("unlockTimeReached"); + openapiFields.add("tickLower"); + openapiFields.add("tickUpper"); + openapiFields.add("active"); + openapiFields.add("proofs"); + openapiFields.add("stakeState"); + openapiFields.add("claimTypes"); + openapiFields.add("redemptionId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PositionRespPositionDetail + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PositionRespPositionDetail.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in PositionRespPositionDetail is not" + + " found in the empty JSON string", + PositionRespPositionDetail.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("positionIndex") != null && !jsonObj.get("positionIndex").isJsonNull()) + && !jsonObj.get("positionIndex").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `positionIndex` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("positionIndex").toString())); + } + if ((jsonObj.get("nftId") != null && !jsonObj.get("nftId").isJsonNull()) + && !jsonObj.get("nftId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `nftId` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("nftId").toString())); + } + if ((jsonObj.get("unlockTime") != null && !jsonObj.get("unlockTime").isJsonNull()) + && !jsonObj.get("unlockTime").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `unlockTime` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("unlockTime").toString())); + } + if ((jsonObj.get("tickLower") != null && !jsonObj.get("tickLower").isJsonNull()) + && !jsonObj.get("tickLower").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `tickLower` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("tickLower").toString())); + } + if ((jsonObj.get("tickUpper") != null && !jsonObj.get("tickUpper").isJsonNull()) + && !jsonObj.get("tickUpper").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `tickUpper` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("tickUpper").toString())); + } + if ((jsonObj.get("stakeState") != null && !jsonObj.get("stakeState").isJsonNull()) + && !jsonObj.get("stakeState").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `stakeState` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("stakeState").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("claimTypes") != null + && !jsonObj.get("claimTypes").isJsonNull() + && !jsonObj.get("claimTypes").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `claimTypes` to be an array in the JSON string but" + + " got `%s`", + jsonObj.get("claimTypes").toString())); + } + if ((jsonObj.get("redemptionId") != null && !jsonObj.get("redemptionId").isJsonNull()) + && !jsonObj.get("redemptionId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `redemptionId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("redemptionId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PositionRespPositionDetail.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PositionRespPositionDetail' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(PositionRespPositionDetail.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, PositionRespPositionDetail value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PositionRespPositionDetail read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of PositionRespPositionDetail given an JSON string + * + * @param jsonString JSON string + * @return An instance of PositionRespPositionDetail + * @throws IOException if the JSON string is invalid with respect to PositionRespPositionDetail + */ + public static PositionRespPositionDetail fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PositionRespPositionDetail.class); + } + + /** + * Convert an instance of PositionRespPositionDetail to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/PositionRespTokenList.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/PositionRespTokenList.java new file mode 100644 index 0000000..8256306 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/PositionRespTokenList.java @@ -0,0 +1,445 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; +import org.hibernate.validator.constraints.*; + +/** + * Token breakdown grouped by role. Keys: `supply` (supplied assets), `borrow` + * (borrowed assets, lending positions), `reward` (claimable rewards), + * `farming_reward` (MasterChef farming incentives). A key is absent when the position has + * no tokens in that role. + */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class PositionRespTokenList { + public static final String SERIALIZED_NAME_SUPPLY = "supply"; + + @SerializedName(SERIALIZED_NAME_SUPPLY) + @jakarta.annotation.Nullable + private List<@Valid PositionRespTokenListSupplyInner> supply; + + public static final String SERIALIZED_NAME_BORROW = "borrow"; + + @SerializedName(SERIALIZED_NAME_BORROW) + @jakarta.annotation.Nullable + private List<@Valid PositionRespTokenListSupplyInner> borrow; + + public static final String SERIALIZED_NAME_REWARD = "reward"; + + @SerializedName(SERIALIZED_NAME_REWARD) + @jakarta.annotation.Nullable + private List<@Valid PositionRespTokenListSupplyInner> reward; + + public static final String SERIALIZED_NAME_FARMING_REWARD = "farming_reward"; + + @SerializedName(SERIALIZED_NAME_FARMING_REWARD) + @jakarta.annotation.Nullable + private List<@Valid PositionRespTokenListSupplyInner> farmingReward; + + public PositionRespTokenList() {} + + public PositionRespTokenList supply( + @jakarta.annotation.Nullable List<@Valid PositionRespTokenListSupplyInner> supply) { + this.supply = supply; + return this; + } + + public PositionRespTokenList addSupplyItem(PositionRespTokenListSupplyInner supplyItem) { + if (this.supply == null) { + this.supply = new ArrayList<>(); + } + this.supply.add(supplyItem); + return this; + } + + /** + * Get supply + * + * @return supply + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid PositionRespTokenListSupplyInner> getSupply() { + return supply; + } + + public void setSupply( + @jakarta.annotation.Nullable List<@Valid PositionRespTokenListSupplyInner> supply) { + this.supply = supply; + } + + public PositionRespTokenList borrow( + @jakarta.annotation.Nullable List<@Valid PositionRespTokenListSupplyInner> borrow) { + this.borrow = borrow; + return this; + } + + public PositionRespTokenList addBorrowItem(PositionRespTokenListSupplyInner borrowItem) { + if (this.borrow == null) { + this.borrow = new ArrayList<>(); + } + this.borrow.add(borrowItem); + return this; + } + + /** + * Get borrow + * + * @return borrow + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid PositionRespTokenListSupplyInner> getBorrow() { + return borrow; + } + + public void setBorrow( + @jakarta.annotation.Nullable List<@Valid PositionRespTokenListSupplyInner> borrow) { + this.borrow = borrow; + } + + public PositionRespTokenList reward( + @jakarta.annotation.Nullable List<@Valid PositionRespTokenListSupplyInner> reward) { + this.reward = reward; + return this; + } + + public PositionRespTokenList addRewardItem(PositionRespTokenListSupplyInner rewardItem) { + if (this.reward == null) { + this.reward = new ArrayList<>(); + } + this.reward.add(rewardItem); + return this; + } + + /** + * Get reward + * + * @return reward + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid PositionRespTokenListSupplyInner> getReward() { + return reward; + } + + public void setReward( + @jakarta.annotation.Nullable List<@Valid PositionRespTokenListSupplyInner> reward) { + this.reward = reward; + } + + public PositionRespTokenList farmingReward( + @jakarta.annotation.Nullable + List<@Valid PositionRespTokenListSupplyInner> farmingReward) { + this.farmingReward = farmingReward; + return this; + } + + public PositionRespTokenList addFarmingRewardItem( + PositionRespTokenListSupplyInner farmingRewardItem) { + if (this.farmingReward == null) { + this.farmingReward = new ArrayList<>(); + } + this.farmingReward.add(farmingRewardItem); + return this; + } + + /** + * Get farmingReward + * + * @return farmingReward + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid PositionRespTokenListSupplyInner> getFarmingReward() { + return farmingReward; + } + + public void setFarmingReward( + @jakarta.annotation.Nullable + List<@Valid PositionRespTokenListSupplyInner> farmingReward) { + this.farmingReward = farmingReward; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PositionRespTokenList positionRespTokenList = (PositionRespTokenList) o; + return Objects.equals(this.supply, positionRespTokenList.supply) + && Objects.equals(this.borrow, positionRespTokenList.borrow) + && Objects.equals(this.reward, positionRespTokenList.reward) + && Objects.equals(this.farmingReward, positionRespTokenList.farmingReward); + } + + @Override + public int hashCode() { + return Objects.hash(supply, borrow, reward, farmingReward); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PositionRespTokenList {\n"); + sb.append(" supply: ").append(toIndentedString(supply)).append("\n"); + sb.append(" borrow: ").append(toIndentedString(borrow)).append("\n"); + sb.append(" reward: ").append(toIndentedString(reward)).append("\n"); + sb.append(" farmingReward: ").append(toIndentedString(farmingReward)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object supplyValue = getSupply(); + String supplyValueAsString = ""; + supplyValueAsString = + (String) + ((Collection) supplyValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("supply=").append(urlEncode(supplyValueAsString)).append(""); + Object borrowValue = getBorrow(); + String borrowValueAsString = ""; + borrowValueAsString = + (String) + ((Collection) borrowValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("borrow=").append(urlEncode(borrowValueAsString)).append(""); + Object rewardValue = getReward(); + String rewardValueAsString = ""; + rewardValueAsString = + (String) + ((Collection) rewardValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("reward=").append(urlEncode(rewardValueAsString)).append(""); + Object farmingRewardValue = getFarmingReward(); + String farmingRewardValueAsString = ""; + farmingRewardValueAsString = + (String) + ((Collection) farmingRewardValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("farmingReward=").append(urlEncode(farmingRewardValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("supply"); + openapiFields.add("borrow"); + openapiFields.add("reward"); + openapiFields.add("farming_reward"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PositionRespTokenList + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PositionRespTokenList.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in PositionRespTokenList is not found in" + + " the empty JSON string", + PositionRespTokenList.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("supply") != null && !jsonObj.get("supply").isJsonNull()) { + JsonArray jsonArraysupply = jsonObj.getAsJsonArray("supply"); + if (jsonArraysupply != null) { + // ensure the json data is an array + if (!jsonObj.get("supply").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `supply` to be an array in the JSON string" + + " but got `%s`", + jsonObj.get("supply").toString())); + } + + // validate the optional field `supply` (array) + for (int i = 0; i < jsonArraysupply.size(); i++) { + PositionRespTokenListSupplyInner.validateJsonElement(jsonArraysupply.get(i)); + } + ; + } + } + if (jsonObj.get("borrow") != null && !jsonObj.get("borrow").isJsonNull()) { + JsonArray jsonArrayborrow = jsonObj.getAsJsonArray("borrow"); + if (jsonArrayborrow != null) { + // ensure the json data is an array + if (!jsonObj.get("borrow").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `borrow` to be an array in the JSON string" + + " but got `%s`", + jsonObj.get("borrow").toString())); + } + + // validate the optional field `borrow` (array) + for (int i = 0; i < jsonArrayborrow.size(); i++) { + PositionRespTokenListSupplyInner.validateJsonElement(jsonArrayborrow.get(i)); + } + ; + } + } + if (jsonObj.get("reward") != null && !jsonObj.get("reward").isJsonNull()) { + JsonArray jsonArrayreward = jsonObj.getAsJsonArray("reward"); + if (jsonArrayreward != null) { + // ensure the json data is an array + if (!jsonObj.get("reward").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `reward` to be an array in the JSON string" + + " but got `%s`", + jsonObj.get("reward").toString())); + } + + // validate the optional field `reward` (array) + for (int i = 0; i < jsonArrayreward.size(); i++) { + PositionRespTokenListSupplyInner.validateJsonElement(jsonArrayreward.get(i)); + } + ; + } + } + if (jsonObj.get("farming_reward") != null && !jsonObj.get("farming_reward").isJsonNull()) { + JsonArray jsonArrayfarmingReward = jsonObj.getAsJsonArray("farming_reward"); + if (jsonArrayfarmingReward != null) { + // ensure the json data is an array + if (!jsonObj.get("farming_reward").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `farming_reward` to be an array in the JSON" + + " string but got `%s`", + jsonObj.get("farming_reward").toString())); + } + + // validate the optional field `farming_reward` (array) + for (int i = 0; i < jsonArrayfarmingReward.size(); i++) { + PositionRespTokenListSupplyInner.validateJsonElement( + jsonArrayfarmingReward.get(i)); + } + ; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PositionRespTokenList.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PositionRespTokenList' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(PositionRespTokenList.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, PositionRespTokenList value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PositionRespTokenList read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of PositionRespTokenList given an JSON string + * + * @param jsonString JSON string + * @return An instance of PositionRespTokenList + * @throws IOException if the JSON string is invalid with respect to PositionRespTokenList + */ + public static PositionRespTokenList fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PositionRespTokenList.class); + } + + /** + * Convert an instance of PositionRespTokenList to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/PositionRespTokenListSupplyInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/PositionRespTokenListSupplyInner.java new file mode 100644 index 0000000..6c657ff --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/PositionRespTokenListSupplyInner.java @@ -0,0 +1,472 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** Token balance information within a position. */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class PositionRespTokenListSupplyInner { + public static final String SERIALIZED_NAME_TOKEN_ADDRESS = "tokenAddress"; + + @SerializedName(SERIALIZED_NAME_TOKEN_ADDRESS) + @jakarta.annotation.Nullable + private String tokenAddress; + + public static final String SERIALIZED_NAME_TOKEN_NAME = "tokenName"; + + @SerializedName(SERIALIZED_NAME_TOKEN_NAME) + @jakarta.annotation.Nullable + private String tokenName; + + public static final String SERIALIZED_NAME_TOKEN_SYMBOL = "tokenSymbol"; + + @SerializedName(SERIALIZED_NAME_TOKEN_SYMBOL) + @jakarta.annotation.Nullable + private String tokenSymbol; + + public static final String SERIALIZED_NAME_TOKEN_AMOUNT = "tokenAmount"; + + @SerializedName(SERIALIZED_NAME_TOKEN_AMOUNT) + @jakarta.annotation.Nullable + private String tokenAmount; + + public static final String SERIALIZED_NAME_TOKEN_PRICE = "tokenPrice"; + + @SerializedName(SERIALIZED_NAME_TOKEN_PRICE) + @jakarta.annotation.Nullable + private String tokenPrice; + + public static final String SERIALIZED_NAME_TOKEN_VALUE = "tokenValue"; + + @SerializedName(SERIALIZED_NAME_TOKEN_VALUE) + @jakarta.annotation.Nullable + private String tokenValue; + + public static final String SERIALIZED_NAME_TOKEN_DECIMALS = "tokenDecimals"; + + @SerializedName(SERIALIZED_NAME_TOKEN_DECIMALS) + @jakarta.annotation.Nullable + private String tokenDecimals; + + public PositionRespTokenListSupplyInner() {} + + public PositionRespTokenListSupplyInner tokenAddress( + @jakarta.annotation.Nullable String tokenAddress) { + this.tokenAddress = tokenAddress; + return this; + } + + /** + * Token contract address. The native-asset sentinel + * `0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee` (40 `e`s) for native coins. + * + * @return tokenAddress + */ + @jakarta.annotation.Nullable + public String getTokenAddress() { + return tokenAddress; + } + + public void setTokenAddress(@jakarta.annotation.Nullable String tokenAddress) { + this.tokenAddress = tokenAddress; + } + + public PositionRespTokenListSupplyInner tokenName( + @jakarta.annotation.Nullable String tokenName) { + this.tokenName = tokenName; + return this; + } + + /** + * Token name. + * + * @return tokenName + */ + @jakarta.annotation.Nullable + public String getTokenName() { + return tokenName; + } + + public void setTokenName(@jakarta.annotation.Nullable String tokenName) { + this.tokenName = tokenName; + } + + public PositionRespTokenListSupplyInner tokenSymbol( + @jakarta.annotation.Nullable String tokenSymbol) { + this.tokenSymbol = tokenSymbol; + return this; + } + + /** + * Token symbol. + * + * @return tokenSymbol + */ + @jakarta.annotation.Nullable + public String getTokenSymbol() { + return tokenSymbol; + } + + public void setTokenSymbol(@jakarta.annotation.Nullable String tokenSymbol) { + this.tokenSymbol = tokenSymbol; + } + + public PositionRespTokenListSupplyInner tokenAmount( + @jakarta.annotation.Nullable String tokenAmount) { + this.tokenAmount = tokenAmount; + return this; + } + + /** + * Human-readable token amount (NOT the smallest unit). + * + * @return tokenAmount + */ + @jakarta.annotation.Nullable + public String getTokenAmount() { + return tokenAmount; + } + + public void setTokenAmount(@jakarta.annotation.Nullable String tokenAmount) { + this.tokenAmount = tokenAmount; + } + + public PositionRespTokenListSupplyInner tokenPrice( + @jakarta.annotation.Nullable String tokenPrice) { + this.tokenPrice = tokenPrice; + return this; + } + + /** + * Current token price in USD. + * + * @return tokenPrice + */ + @jakarta.annotation.Nullable + public String getTokenPrice() { + return tokenPrice; + } + + public void setTokenPrice(@jakarta.annotation.Nullable String tokenPrice) { + this.tokenPrice = tokenPrice; + } + + public PositionRespTokenListSupplyInner tokenValue( + @jakarta.annotation.Nullable String tokenValue) { + this.tokenValue = tokenValue; + return this; + } + + /** + * Token value in USD (amount × price). + * + * @return tokenValue + */ + @jakarta.annotation.Nullable + public String getTokenValue() { + return tokenValue; + } + + public void setTokenValue(@jakarta.annotation.Nullable String tokenValue) { + this.tokenValue = tokenValue; + } + + public PositionRespTokenListSupplyInner tokenDecimals( + @jakarta.annotation.Nullable String tokenDecimals) { + this.tokenDecimals = tokenDecimals; + return this; + } + + /** + * Token decimals (string). + * + * @return tokenDecimals + */ + @jakarta.annotation.Nullable + public String getTokenDecimals() { + return tokenDecimals; + } + + public void setTokenDecimals(@jakarta.annotation.Nullable String tokenDecimals) { + this.tokenDecimals = tokenDecimals; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PositionRespTokenListSupplyInner positionRespTokenListSupplyInner = + (PositionRespTokenListSupplyInner) o; + return Objects.equals(this.tokenAddress, positionRespTokenListSupplyInner.tokenAddress) + && Objects.equals(this.tokenName, positionRespTokenListSupplyInner.tokenName) + && Objects.equals(this.tokenSymbol, positionRespTokenListSupplyInner.tokenSymbol) + && Objects.equals(this.tokenAmount, positionRespTokenListSupplyInner.tokenAmount) + && Objects.equals(this.tokenPrice, positionRespTokenListSupplyInner.tokenPrice) + && Objects.equals(this.tokenValue, positionRespTokenListSupplyInner.tokenValue) + && Objects.equals( + this.tokenDecimals, positionRespTokenListSupplyInner.tokenDecimals); + } + + @Override + public int hashCode() { + return Objects.hash( + tokenAddress, + tokenName, + tokenSymbol, + tokenAmount, + tokenPrice, + tokenValue, + tokenDecimals); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PositionRespTokenListSupplyInner {\n"); + sb.append(" tokenAddress: ").append(toIndentedString(tokenAddress)).append("\n"); + sb.append(" tokenName: ").append(toIndentedString(tokenName)).append("\n"); + sb.append(" tokenSymbol: ").append(toIndentedString(tokenSymbol)).append("\n"); + sb.append(" tokenAmount: ").append(toIndentedString(tokenAmount)).append("\n"); + sb.append(" tokenPrice: ").append(toIndentedString(tokenPrice)).append("\n"); + sb.append(" tokenValue: ").append(toIndentedString(tokenValue)).append("\n"); + sb.append(" tokenDecimals: ").append(toIndentedString(tokenDecimals)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object tokenAddressValue = getTokenAddress(); + String tokenAddressValueAsString = ""; + tokenAddressValueAsString = tokenAddressValue.toString(); + sb.append("tokenAddress=").append(urlEncode(tokenAddressValueAsString)).append(""); + Object tokenNameValue = getTokenName(); + String tokenNameValueAsString = ""; + tokenNameValueAsString = tokenNameValue.toString(); + sb.append("tokenName=").append(urlEncode(tokenNameValueAsString)).append(""); + Object tokenSymbolValue = getTokenSymbol(); + String tokenSymbolValueAsString = ""; + tokenSymbolValueAsString = tokenSymbolValue.toString(); + sb.append("tokenSymbol=").append(urlEncode(tokenSymbolValueAsString)).append(""); + Object tokenAmountValue = getTokenAmount(); + String tokenAmountValueAsString = ""; + tokenAmountValueAsString = tokenAmountValue.toString(); + sb.append("tokenAmount=").append(urlEncode(tokenAmountValueAsString)).append(""); + Object tokenPriceValue = getTokenPrice(); + String tokenPriceValueAsString = ""; + tokenPriceValueAsString = tokenPriceValue.toString(); + sb.append("tokenPrice=").append(urlEncode(tokenPriceValueAsString)).append(""); + Object tokenValueValue = getTokenValue(); + String tokenValueValueAsString = ""; + tokenValueValueAsString = tokenValueValue.toString(); + sb.append("tokenValue=").append(urlEncode(tokenValueValueAsString)).append(""); + Object tokenDecimalsValue = getTokenDecimals(); + String tokenDecimalsValueAsString = ""; + tokenDecimalsValueAsString = tokenDecimalsValue.toString(); + sb.append("tokenDecimals=").append(urlEncode(tokenDecimalsValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("tokenAddress"); + openapiFields.add("tokenName"); + openapiFields.add("tokenSymbol"); + openapiFields.add("tokenAmount"); + openapiFields.add("tokenPrice"); + openapiFields.add("tokenValue"); + openapiFields.add("tokenDecimals"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * PositionRespTokenListSupplyInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PositionRespTokenListSupplyInner.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in PositionRespTokenListSupplyInner is" + + " not found in the empty JSON string", + PositionRespTokenListSupplyInner.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("tokenAddress") != null && !jsonObj.get("tokenAddress").isJsonNull()) + && !jsonObj.get("tokenAddress").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `tokenAddress` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("tokenAddress").toString())); + } + if ((jsonObj.get("tokenName") != null && !jsonObj.get("tokenName").isJsonNull()) + && !jsonObj.get("tokenName").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `tokenName` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("tokenName").toString())); + } + if ((jsonObj.get("tokenSymbol") != null && !jsonObj.get("tokenSymbol").isJsonNull()) + && !jsonObj.get("tokenSymbol").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `tokenSymbol` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("tokenSymbol").toString())); + } + if ((jsonObj.get("tokenAmount") != null && !jsonObj.get("tokenAmount").isJsonNull()) + && !jsonObj.get("tokenAmount").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `tokenAmount` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("tokenAmount").toString())); + } + if ((jsonObj.get("tokenPrice") != null && !jsonObj.get("tokenPrice").isJsonNull()) + && !jsonObj.get("tokenPrice").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `tokenPrice` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("tokenPrice").toString())); + } + if ((jsonObj.get("tokenValue") != null && !jsonObj.get("tokenValue").isJsonNull()) + && !jsonObj.get("tokenValue").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `tokenValue` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("tokenValue").toString())); + } + if ((jsonObj.get("tokenDecimals") != null && !jsonObj.get("tokenDecimals").isJsonNull()) + && !jsonObj.get("tokenDecimals").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `tokenDecimals` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("tokenDecimals").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PositionRespTokenListSupplyInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PositionRespTokenListSupplyInner' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(PositionRespTokenListSupplyInner.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, PositionRespTokenListSupplyInner value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PositionRespTokenListSupplyInner read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of PositionRespTokenListSupplyInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of PositionRespTokenListSupplyInner + * @throws IOException if the JSON string is invalid with respect to + * PositionRespTokenListSupplyInner + */ + public static PositionRespTokenListSupplyInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PositionRespTokenListSupplyInner.class); + } + + /** + * Convert an instance of PositionRespTokenListSupplyInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/ProtocolPageResult.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/ProtocolPageResult.java new file mode 100644 index 0000000..a0f0c47 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/ProtocolPageResult.java @@ -0,0 +1,337 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; +import org.hibernate.validator.constraints.*; + +/** Paginated protocol list result. */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class ProtocolPageResult { + public static final String SERIALIZED_NAME_PAGE = "page"; + + @SerializedName(SERIALIZED_NAME_PAGE) + @jakarta.annotation.Nullable + private Integer page; + + public static final String SERIALIZED_NAME_SIZE = "size"; + + @SerializedName(SERIALIZED_NAME_SIZE) + @jakarta.annotation.Nullable + private Integer size; + + public static final String SERIALIZED_NAME_TOTAL = "total"; + + @SerializedName(SERIALIZED_NAME_TOTAL) + @jakarta.annotation.Nullable + private Long total; + + public static final String SERIALIZED_NAME_LIST = "list"; + + @SerializedName(SERIALIZED_NAME_LIST) + @jakarta.annotation.Nullable + private List<@Valid ProtocolPageResultListInner> _list; + + public ProtocolPageResult() {} + + public ProtocolPageResult page(@jakarta.annotation.Nullable Integer page) { + this.page = page; + return this; + } + + /** + * Current page number (1-based). + * + * @return page + */ + @jakarta.annotation.Nullable + public Integer getPage() { + return page; + } + + public void setPage(@jakarta.annotation.Nullable Integer page) { + this.page = page; + } + + public ProtocolPageResult size(@jakarta.annotation.Nullable Integer size) { + this.size = size; + return this; + } + + /** + * Page size. + * + * @return size + */ + @jakarta.annotation.Nullable + public Integer getSize() { + return size; + } + + public void setSize(@jakarta.annotation.Nullable Integer size) { + this.size = size; + } + + public ProtocolPageResult total(@jakarta.annotation.Nullable Long total) { + this.total = total; + return this; + } + + /** + * Total number of records. + * + * @return total + */ + @jakarta.annotation.Nullable + public Long getTotal() { + return total; + } + + public void setTotal(@jakarta.annotation.Nullable Long total) { + this.total = total; + } + + public ProtocolPageResult _list( + @jakarta.annotation.Nullable List<@Valid ProtocolPageResultListInner> _list) { + this._list = _list; + return this; + } + + public ProtocolPageResult addListItem(ProtocolPageResultListInner _listItem) { + if (this._list == null) { + this._list = new ArrayList<>(); + } + this._list.add(_listItem); + return this; + } + + /** + * Protocols for the current page. + * + * @return _list + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid ProtocolPageResultListInner> getList() { + return _list; + } + + public void setList( + @jakarta.annotation.Nullable List<@Valid ProtocolPageResultListInner> _list) { + this._list = _list; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProtocolPageResult protocolPageResult = (ProtocolPageResult) o; + return Objects.equals(this.page, protocolPageResult.page) + && Objects.equals(this.size, protocolPageResult.size) + && Objects.equals(this.total, protocolPageResult.total) + && Objects.equals(this._list, protocolPageResult._list); + } + + @Override + public int hashCode() { + return Objects.hash(page, size, total, _list); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProtocolPageResult {\n"); + sb.append(" page: ").append(toIndentedString(page)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append(" total: ").append(toIndentedString(total)).append("\n"); + sb.append(" _list: ").append(toIndentedString(_list)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object pageValue = getPage(); + String pageValueAsString = ""; + pageValueAsString = pageValue.toString(); + sb.append("page=").append(urlEncode(pageValueAsString)).append(""); + Object sizeValue = getSize(); + String sizeValueAsString = ""; + sizeValueAsString = sizeValue.toString(); + sb.append("size=").append(urlEncode(sizeValueAsString)).append(""); + Object totalValue = getTotal(); + String totalValueAsString = ""; + totalValueAsString = totalValue.toString(); + sb.append("total=").append(urlEncode(totalValueAsString)).append(""); + Object _listValue = getList(); + String _listValueAsString = ""; + _listValueAsString = + (String) + ((Collection) _listValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("_list=").append(urlEncode(_listValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("page"); + openapiFields.add("size"); + openapiFields.add("total"); + openapiFields.add("list"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ProtocolPageResult + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ProtocolPageResult.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in ProtocolPageResult is not found in the" + + " empty JSON string", + ProtocolPageResult.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("list") != null && !jsonObj.get("list").isJsonNull()) { + JsonArray jsonArray_list = jsonObj.getAsJsonArray("list"); + if (jsonArray_list != null) { + // ensure the json data is an array + if (!jsonObj.get("list").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `list` to be an array in the JSON string" + + " but got `%s`", + jsonObj.get("list").toString())); + } + + // validate the optional field `list` (array) + for (int i = 0; i < jsonArray_list.size(); i++) { + ProtocolPageResultListInner.validateJsonElement(jsonArray_list.get(i)); + } + ; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ProtocolPageResult.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ProtocolPageResult' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(ProtocolPageResult.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ProtocolPageResult value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ProtocolPageResult read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of ProtocolPageResult given an JSON string + * + * @param jsonString JSON string + * @return An instance of ProtocolPageResult + * @throws IOException if the JSON string is invalid with respect to ProtocolPageResult + */ + public static ProtocolPageResult fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ProtocolPageResult.class); + } + + /** + * Convert an instance of ProtocolPageResult to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/ProtocolPageResultListInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/ProtocolPageResultListInner.java new file mode 100644 index 0000000..77d722b --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/ProtocolPageResultListInner.java @@ -0,0 +1,532 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; +import org.hibernate.validator.constraints.*; + +/** DeFi protocol summary (list item). */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class ProtocolPageResultListInner { + public static final String SERIALIZED_NAME_DEFI_PROTOCOL_ID = "defiProtocolId"; + + @SerializedName(SERIALIZED_NAME_DEFI_PROTOCOL_ID) + @jakarta.annotation.Nullable + private String defiProtocolId; + + public static final String SERIALIZED_NAME_PROTOCOL_NAME = "protocolName"; + + @SerializedName(SERIALIZED_NAME_PROTOCOL_NAME) + @jakarta.annotation.Nullable + private String protocolName; + + public static final String SERIALIZED_NAME_PROTOCOL_LOGO = "protocolLogo"; + + @SerializedName(SERIALIZED_NAME_PROTOCOL_LOGO) + @jakarta.annotation.Nullable + private String protocolLogo; + + public static final String SERIALIZED_NAME_TVL = "tvl"; + + @SerializedName(SERIALIZED_NAME_TVL) + @jakarta.annotation.Nullable + private String tvl; + + public static final String SERIALIZED_NAME_APY_BPS = "apyBps"; + + @SerializedName(SERIALIZED_NAME_APY_BPS) + @jakarta.annotation.Nullable + private Long apyBps; + + public static final String SERIALIZED_NAME_APY_DISPLAY = "apyDisplay"; + + @SerializedName(SERIALIZED_NAME_APY_DISPLAY) + @jakarta.annotation.Nullable + private String apyDisplay; + + public static final String SERIALIZED_NAME_INVEST_TYPE = "investType"; + + @SerializedName(SERIALIZED_NAME_INVEST_TYPE) + @jakarta.annotation.Nullable + private List investType; + + public static final String SERIALIZED_NAME_SUPPORTED_CHAINS = "supportedChains"; + + @SerializedName(SERIALIZED_NAME_SUPPORTED_CHAINS) + @jakarta.annotation.Nullable + private List supportedChains; + + public ProtocolPageResultListInner() {} + + public ProtocolPageResultListInner defiProtocolId( + @jakarta.annotation.Nullable String defiProtocolId) { + this.defiProtocolId = defiProtocolId; + return this; + } + + /** + * DeFi protocol identifier. + * + * @return defiProtocolId + */ + @jakarta.annotation.Nullable + public String getDefiProtocolId() { + return defiProtocolId; + } + + public void setDefiProtocolId(@jakarta.annotation.Nullable String defiProtocolId) { + this.defiProtocolId = defiProtocolId; + } + + public ProtocolPageResultListInner protocolName( + @jakarta.annotation.Nullable String protocolName) { + this.protocolName = protocolName; + return this; + } + + /** + * Protocol display name. + * + * @return protocolName + */ + @jakarta.annotation.Nullable + public String getProtocolName() { + return protocolName; + } + + public void setProtocolName(@jakarta.annotation.Nullable String protocolName) { + this.protocolName = protocolName; + } + + public ProtocolPageResultListInner protocolLogo( + @jakarta.annotation.Nullable String protocolLogo) { + this.protocolLogo = protocolLogo; + return this; + } + + /** + * Protocol logo image URL (full URL; quote as-is). + * + * @return protocolLogo + */ + @jakarta.annotation.Nullable + public String getProtocolLogo() { + return protocolLogo; + } + + public void setProtocolLogo(@jakarta.annotation.Nullable String protocolLogo) { + this.protocolLogo = protocolLogo; + } + + public ProtocolPageResultListInner tvl(@jakarta.annotation.Nullable String tvl) { + this.tvl = tvl; + return this; + } + + /** + * Total value locked in the protocol (USD). String, raw precision from the data source. + * + * @return tvl + */ + @jakarta.annotation.Nullable + public String getTvl() { + return tvl; + } + + public void setTvl(@jakarta.annotation.Nullable String tvl) { + this.tvl = tvl; + } + + public ProtocolPageResultListInner apyBps(@jakarta.annotation.Nullable Long apyBps) { + this.apyBps = apyBps; + return this; + } + + /** + * Highest APY across the protocol's investments, in basis points (1 bps = 0.01%). + * Integer value — use this for sorting / comparing / filtering, never the raw decimal. + * + * @return apyBps + */ + @jakarta.annotation.Nullable + public Long getApyBps() { + return apyBps; + } + + public void setApyBps(@jakarta.annotation.Nullable Long apyBps) { + this.apyBps = apyBps; + } + + public ProtocolPageResultListInner apyDisplay(@jakarta.annotation.Nullable String apyDisplay) { + this.apyDisplay = apyDisplay; + return this; + } + + /** + * Pre-formatted, human-readable APY string for display (e.g. \"12.35%\"). Quote + * as-is; do not re-compute or transform. + * + * @return apyDisplay + */ + @jakarta.annotation.Nullable + public String getApyDisplay() { + return apyDisplay; + } + + public void setApyDisplay(@jakarta.annotation.Nullable String apyDisplay) { + this.apyDisplay = apyDisplay; + } + + public ProtocolPageResultListInner investType( + @jakarta.annotation.Nullable List investType) { + this.investType = investType; + return this; + } + + public ProtocolPageResultListInner addInvestTypeItem(String investTypeItem) { + if (this.investType == null) { + this.investType = new ArrayList<>(); + } + this.investType.add(investTypeItem); + return this; + } + + /** + * Investment types supported by this protocol — an array here (a protocol may support several). + * Note: the investment-level investType (in investment list/detail) is a single string. Known + * values: Earn, LiquidityPool. + * + * @return investType + */ + @jakarta.annotation.Nullable + public List getInvestType() { + return investType; + } + + public void setInvestType(@jakarta.annotation.Nullable List investType) { + this.investType = investType; + } + + public ProtocolPageResultListInner supportedChains( + @jakarta.annotation.Nullable List supportedChains) { + this.supportedChains = supportedChains; + return this; + } + + public ProtocolPageResultListInner addSupportedChainsItem(String supportedChainsItem) { + if (this.supportedChains == null) { + this.supportedChains = new ArrayList<>(); + } + this.supportedChains.add(supportedChainsItem); + return this; + } + + /** + * Supported Binance chain IDs. + * + * @return supportedChains + */ + @jakarta.annotation.Nullable + public List getSupportedChains() { + return supportedChains; + } + + public void setSupportedChains(@jakarta.annotation.Nullable List supportedChains) { + this.supportedChains = supportedChains; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProtocolPageResultListInner protocolPageResultListInner = (ProtocolPageResultListInner) o; + return Objects.equals(this.defiProtocolId, protocolPageResultListInner.defiProtocolId) + && Objects.equals(this.protocolName, protocolPageResultListInner.protocolName) + && Objects.equals(this.protocolLogo, protocolPageResultListInner.protocolLogo) + && Objects.equals(this.tvl, protocolPageResultListInner.tvl) + && Objects.equals(this.apyBps, protocolPageResultListInner.apyBps) + && Objects.equals(this.apyDisplay, protocolPageResultListInner.apyDisplay) + && Objects.equals(this.investType, protocolPageResultListInner.investType) + && Objects.equals( + this.supportedChains, protocolPageResultListInner.supportedChains); + } + + @Override + public int hashCode() { + return Objects.hash( + defiProtocolId, + protocolName, + protocolLogo, + tvl, + apyBps, + apyDisplay, + investType, + supportedChains); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProtocolPageResultListInner {\n"); + sb.append(" defiProtocolId: ").append(toIndentedString(defiProtocolId)).append("\n"); + sb.append(" protocolName: ").append(toIndentedString(protocolName)).append("\n"); + sb.append(" protocolLogo: ").append(toIndentedString(protocolLogo)).append("\n"); + sb.append(" tvl: ").append(toIndentedString(tvl)).append("\n"); + sb.append(" apyBps: ").append(toIndentedString(apyBps)).append("\n"); + sb.append(" apyDisplay: ").append(toIndentedString(apyDisplay)).append("\n"); + sb.append(" investType: ").append(toIndentedString(investType)).append("\n"); + sb.append(" supportedChains: ").append(toIndentedString(supportedChains)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object defiProtocolIdValue = getDefiProtocolId(); + String defiProtocolIdValueAsString = ""; + defiProtocolIdValueAsString = defiProtocolIdValue.toString(); + sb.append("defiProtocolId=").append(urlEncode(defiProtocolIdValueAsString)).append(""); + Object protocolNameValue = getProtocolName(); + String protocolNameValueAsString = ""; + protocolNameValueAsString = protocolNameValue.toString(); + sb.append("protocolName=").append(urlEncode(protocolNameValueAsString)).append(""); + Object protocolLogoValue = getProtocolLogo(); + String protocolLogoValueAsString = ""; + protocolLogoValueAsString = protocolLogoValue.toString(); + sb.append("protocolLogo=").append(urlEncode(protocolLogoValueAsString)).append(""); + Object tvlValue = getTvl(); + String tvlValueAsString = ""; + tvlValueAsString = tvlValue.toString(); + sb.append("tvl=").append(urlEncode(tvlValueAsString)).append(""); + Object apyBpsValue = getApyBps(); + String apyBpsValueAsString = ""; + apyBpsValueAsString = apyBpsValue.toString(); + sb.append("apyBps=").append(urlEncode(apyBpsValueAsString)).append(""); + Object apyDisplayValue = getApyDisplay(); + String apyDisplayValueAsString = ""; + apyDisplayValueAsString = apyDisplayValue.toString(); + sb.append("apyDisplay=").append(urlEncode(apyDisplayValueAsString)).append(""); + Object investTypeValue = getInvestType(); + String investTypeValueAsString = ""; + investTypeValueAsString = + (String) + ((Collection) investTypeValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("investType=").append(urlEncode(investTypeValueAsString)).append(""); + Object supportedChainsValue = getSupportedChains(); + String supportedChainsValueAsString = ""; + supportedChainsValueAsString = + (String) + ((Collection) supportedChainsValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("supportedChains=").append(urlEncode(supportedChainsValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("defiProtocolId"); + openapiFields.add("protocolName"); + openapiFields.add("protocolLogo"); + openapiFields.add("tvl"); + openapiFields.add("apyBps"); + openapiFields.add("apyDisplay"); + openapiFields.add("investType"); + openapiFields.add("supportedChains"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * ProtocolPageResultListInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ProtocolPageResultListInner.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in ProtocolPageResultListInner is not" + + " found in the empty JSON string", + ProtocolPageResultListInner.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("defiProtocolId") != null && !jsonObj.get("defiProtocolId").isJsonNull()) + && !jsonObj.get("defiProtocolId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `defiProtocolId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("defiProtocolId").toString())); + } + if ((jsonObj.get("protocolName") != null && !jsonObj.get("protocolName").isJsonNull()) + && !jsonObj.get("protocolName").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `protocolName` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("protocolName").toString())); + } + if ((jsonObj.get("protocolLogo") != null && !jsonObj.get("protocolLogo").isJsonNull()) + && !jsonObj.get("protocolLogo").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `protocolLogo` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("protocolLogo").toString())); + } + if ((jsonObj.get("tvl") != null && !jsonObj.get("tvl").isJsonNull()) + && !jsonObj.get("tvl").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `tvl` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("tvl").toString())); + } + if ((jsonObj.get("apyDisplay") != null && !jsonObj.get("apyDisplay").isJsonNull()) + && !jsonObj.get("apyDisplay").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `apyDisplay` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("apyDisplay").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("investType") != null + && !jsonObj.get("investType").isJsonNull() + && !jsonObj.get("investType").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `investType` to be an array in the JSON string but" + + " got `%s`", + jsonObj.get("investType").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("supportedChains") != null + && !jsonObj.get("supportedChains").isJsonNull() + && !jsonObj.get("supportedChains").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `supportedChains` to be an array in the JSON string" + + " but got `%s`", + jsonObj.get("supportedChains").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ProtocolPageResultListInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ProtocolPageResultListInner' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(ProtocolPageResultListInner.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ProtocolPageResultListInner value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ProtocolPageResultListInner read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of ProtocolPageResultListInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of ProtocolPageResultListInner + * @throws IOException if the JSON string is invalid with respect to ProtocolPageResultListInner + */ + public static ProtocolPageResultListInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ProtocolPageResultListInner.class); + } + + /** + * Convert an instance of ProtocolPageResultListInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/ProtocolResp.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/ProtocolResp.java new file mode 100644 index 0000000..482b775 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/ProtocolResp.java @@ -0,0 +1,410 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; +import org.hibernate.validator.constraints.*; + +/** + * Protocol-level position summary for one address on one chain. `binanceChainId` + + * `defiProtocolId` uniquely identify a protocol on a chain. + */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class ProtocolResp { + public static final String SERIALIZED_NAME_BINANCE_CHAIN_ID = "binanceChainId"; + + @SerializedName(SERIALIZED_NAME_BINANCE_CHAIN_ID) + @jakarta.annotation.Nullable + private String binanceChainId; + + public static final String SERIALIZED_NAME_DEFI_PROTOCOL_ID = "defiProtocolId"; + + @SerializedName(SERIALIZED_NAME_DEFI_PROTOCOL_ID) + @jakarta.annotation.Nullable + private String defiProtocolId; + + public static final String SERIALIZED_NAME_PROTOCOL_NAME = "protocolName"; + + @SerializedName(SERIALIZED_NAME_PROTOCOL_NAME) + @jakarta.annotation.Nullable + private String protocolName; + + public static final String SERIALIZED_NAME_PROTOCOL_TOTAL_VALUE = "protocolTotalValue"; + + @SerializedName(SERIALIZED_NAME_PROTOCOL_TOTAL_VALUE) + @jakarta.annotation.Nullable + private String protocolTotalValue; + + public static final String SERIALIZED_NAME_POOL_LIST = "poolList"; + + @SerializedName(SERIALIZED_NAME_POOL_LIST) + @jakarta.annotation.Nullable + private List<@Valid ProtocolRespPoolListInner> poolList; + + public ProtocolResp() {} + + public ProtocolResp binanceChainId(@jakarta.annotation.Nullable String binanceChainId) { + this.binanceChainId = binanceChainId; + return this; + } + + /** + * Binance chain ID (e.g. \"56\"=BSC). + * + * @return binanceChainId + */ + @jakarta.annotation.Nullable + public String getBinanceChainId() { + return binanceChainId; + } + + public void setBinanceChainId(@jakarta.annotation.Nullable String binanceChainId) { + this.binanceChainId = binanceChainId; + } + + public ProtocolResp defiProtocolId(@jakarta.annotation.Nullable String defiProtocolId) { + this.defiProtocolId = defiProtocolId; + return this; + } + + /** + * Protocol identifier consistent with `POST /api/v1/defi/data/protocol/list`. Use + * this value when calling investment/list, transaction endpoints, etc. + * + * @return defiProtocolId + */ + @jakarta.annotation.Nullable + public String getDefiProtocolId() { + return defiProtocolId; + } + + public void setDefiProtocolId(@jakarta.annotation.Nullable String defiProtocolId) { + this.defiProtocolId = defiProtocolId; + } + + public ProtocolResp protocolName(@jakarta.annotation.Nullable String protocolName) { + this.protocolName = protocolName; + return this; + } + + /** + * Protocol display name. + * + * @return protocolName + */ + @jakarta.annotation.Nullable + public String getProtocolName() { + return protocolName; + } + + public void setProtocolName(@jakarta.annotation.Nullable String protocolName) { + this.protocolName = protocolName; + } + + public ProtocolResp protocolTotalValue(@jakarta.annotation.Nullable String protocolTotalValue) { + this.protocolTotalValue = protocolTotalValue; + return this; + } + + /** + * Total position value in this protocol (USD). + * + * @return protocolTotalValue + */ + @jakarta.annotation.Nullable + public String getProtocolTotalValue() { + return protocolTotalValue; + } + + public void setProtocolTotalValue(@jakarta.annotation.Nullable String protocolTotalValue) { + this.protocolTotalValue = protocolTotalValue; + } + + public ProtocolResp poolList( + @jakarta.annotation.Nullable List<@Valid ProtocolRespPoolListInner> poolList) { + this.poolList = poolList; + return this; + } + + public ProtocolResp addPoolListItem(ProtocolRespPoolListInner poolListItem) { + if (this.poolList == null) { + this.poolList = new ArrayList<>(); + } + this.poolList.add(poolListItem); + return this; + } + + /** + * Pools with positions in this protocol. + * + * @return poolList + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid ProtocolRespPoolListInner> getPoolList() { + return poolList; + } + + public void setPoolList( + @jakarta.annotation.Nullable List<@Valid ProtocolRespPoolListInner> poolList) { + this.poolList = poolList; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProtocolResp protocolResp = (ProtocolResp) o; + return Objects.equals(this.binanceChainId, protocolResp.binanceChainId) + && Objects.equals(this.defiProtocolId, protocolResp.defiProtocolId) + && Objects.equals(this.protocolName, protocolResp.protocolName) + && Objects.equals(this.protocolTotalValue, protocolResp.protocolTotalValue) + && Objects.equals(this.poolList, protocolResp.poolList); + } + + @Override + public int hashCode() { + return Objects.hash( + binanceChainId, defiProtocolId, protocolName, protocolTotalValue, poolList); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProtocolResp {\n"); + sb.append(" binanceChainId: ").append(toIndentedString(binanceChainId)).append("\n"); + sb.append(" defiProtocolId: ").append(toIndentedString(defiProtocolId)).append("\n"); + sb.append(" protocolName: ").append(toIndentedString(protocolName)).append("\n"); + sb.append(" protocolTotalValue: ") + .append(toIndentedString(protocolTotalValue)) + .append("\n"); + sb.append(" poolList: ").append(toIndentedString(poolList)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object binanceChainIdValue = getBinanceChainId(); + String binanceChainIdValueAsString = ""; + binanceChainIdValueAsString = binanceChainIdValue.toString(); + sb.append("binanceChainId=").append(urlEncode(binanceChainIdValueAsString)).append(""); + Object defiProtocolIdValue = getDefiProtocolId(); + String defiProtocolIdValueAsString = ""; + defiProtocolIdValueAsString = defiProtocolIdValue.toString(); + sb.append("defiProtocolId=").append(urlEncode(defiProtocolIdValueAsString)).append(""); + Object protocolNameValue = getProtocolName(); + String protocolNameValueAsString = ""; + protocolNameValueAsString = protocolNameValue.toString(); + sb.append("protocolName=").append(urlEncode(protocolNameValueAsString)).append(""); + Object protocolTotalValueValue = getProtocolTotalValue(); + String protocolTotalValueValueAsString = ""; + protocolTotalValueValueAsString = protocolTotalValueValue.toString(); + sb.append("protocolTotalValue=") + .append(urlEncode(protocolTotalValueValueAsString)) + .append(""); + Object poolListValue = getPoolList(); + String poolListValueAsString = ""; + poolListValueAsString = + (String) + ((Collection) poolListValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("poolList=").append(urlEncode(poolListValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("binanceChainId"); + openapiFields.add("defiProtocolId"); + openapiFields.add("protocolName"); + openapiFields.add("protocolTotalValue"); + openapiFields.add("poolList"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ProtocolResp + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ProtocolResp.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in ProtocolResp is not found in the empty" + + " JSON string", + ProtocolResp.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("binanceChainId") != null && !jsonObj.get("binanceChainId").isJsonNull()) + && !jsonObj.get("binanceChainId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `binanceChainId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("binanceChainId").toString())); + } + if ((jsonObj.get("defiProtocolId") != null && !jsonObj.get("defiProtocolId").isJsonNull()) + && !jsonObj.get("defiProtocolId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `defiProtocolId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("defiProtocolId").toString())); + } + if ((jsonObj.get("protocolName") != null && !jsonObj.get("protocolName").isJsonNull()) + && !jsonObj.get("protocolName").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `protocolName` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("protocolName").toString())); + } + if ((jsonObj.get("protocolTotalValue") != null + && !jsonObj.get("protocolTotalValue").isJsonNull()) + && !jsonObj.get("protocolTotalValue").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `protocolTotalValue` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("protocolTotalValue").toString())); + } + if (jsonObj.get("poolList") != null && !jsonObj.get("poolList").isJsonNull()) { + JsonArray jsonArraypoolList = jsonObj.getAsJsonArray("poolList"); + if (jsonArraypoolList != null) { + // ensure the json data is an array + if (!jsonObj.get("poolList").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `poolList` to be an array in the JSON" + + " string but got `%s`", + jsonObj.get("poolList").toString())); + } + + // validate the optional field `poolList` (array) + for (int i = 0; i < jsonArraypoolList.size(); i++) { + ProtocolRespPoolListInner.validateJsonElement(jsonArraypoolList.get(i)); + } + ; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ProtocolResp.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ProtocolResp' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(ProtocolResp.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ProtocolResp value) throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ProtocolResp read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of ProtocolResp given an JSON string + * + * @param jsonString JSON string + * @return An instance of ProtocolResp + * @throws IOException if the JSON string is invalid with respect to ProtocolResp + */ + public static ProtocolResp fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ProtocolResp.class); + } + + /** + * Convert an instance of ProtocolResp to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/ProtocolRespPoolListInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/ProtocolRespPoolListInner.java new file mode 100644 index 0000000..924c551 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/ProtocolRespPoolListInner.java @@ -0,0 +1,435 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** A pool containing position collections. */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class ProtocolRespPoolListInner { + public static final String SERIALIZED_NAME_BN_POOL_ID = "bnPoolId"; + + @SerializedName(SERIALIZED_NAME_BN_POOL_ID) + @jakarta.annotation.Nullable + private String bnPoolId; + + public static final String SERIALIZED_NAME_POOL_CA = "poolCa"; + + @SerializedName(SERIALIZED_NAME_POOL_CA) + @jakarta.annotation.Nullable + private String poolCa; + + public static final String SERIALIZED_NAME_POOL_TYPE = "poolType"; + + @SerializedName(SERIALIZED_NAME_POOL_TYPE) + @jakarta.annotation.Nullable + private String poolType; + + public static final String SERIALIZED_NAME_POSITION_COLLECTION_LIST = "positionCollectionList"; + + @SerializedName(SERIALIZED_NAME_POSITION_COLLECTION_LIST) + @jakarta.annotation.Nullable + private List<@Valid PoolRespPositionCollectionListInner> positionCollectionList; + + public static final String SERIALIZED_NAME_POOL_DETAIL = "poolDetail"; + + @SerializedName(SERIALIZED_NAME_POOL_DETAIL) + @jakarta.annotation.Nullable + private PoolRespPoolDetail poolDetail; + + public ProtocolRespPoolListInner() {} + + public ProtocolRespPoolListInner bnPoolId(@jakarta.annotation.Nullable String bnPoolId) { + this.bnPoolId = bnPoolId; + return this; + } + + /** + * Pool identifier (`0x` + 64-char hex). + * + * @return bnPoolId + */ + @jakarta.annotation.Nullable + public String getBnPoolId() { + return bnPoolId; + } + + public void setBnPoolId(@jakarta.annotation.Nullable String bnPoolId) { + this.bnPoolId = bnPoolId; + } + + public ProtocolRespPoolListInner poolCa(@jakarta.annotation.Nullable String poolCa) { + this.poolCa = poolCa; + return this; + } + + /** + * Pool contract address. + * + * @return poolCa + */ + @jakarta.annotation.Nullable + public String getPoolCa() { + return poolCa; + } + + public void setPoolCa(@jakarta.annotation.Nullable String poolCa) { + this.poolCa = poolCa; + } + + public ProtocolRespPoolListInner poolType(@jakarta.annotation.Nullable String poolType) { + this.poolType = poolType; + return this; + } + + /** + * Pool type. Complete value set: `Lending` (supply/borrow market), `Staked` + * (native staking), `Yield` (yield vault / receipt token), `Deposit` (fixed + * deposit), `Rewards` (reward claims, e.g. PancakeSwap Infinity), `Liquidity + * Pool` (AMM / concentrated liquidity), `Farming` (MasterChef farming), + * `Locked` (locked staking with unlock time), `Vesting` (vesting schedule). + * Treat unknown values as generic display. + * + * @return poolType + */ + @jakarta.annotation.Nullable + public String getPoolType() { + return poolType; + } + + public void setPoolType(@jakarta.annotation.Nullable String poolType) { + this.poolType = poolType; + } + + public ProtocolRespPoolListInner positionCollectionList( + @jakarta.annotation.Nullable + List<@Valid PoolRespPositionCollectionListInner> positionCollectionList) { + this.positionCollectionList = positionCollectionList; + return this; + } + + public ProtocolRespPoolListInner addPositionCollectionListItem( + PoolRespPositionCollectionListInner positionCollectionListItem) { + if (this.positionCollectionList == null) { + this.positionCollectionList = new ArrayList<>(); + } + this.positionCollectionList.add(positionCollectionListItem); + return this; + } + + /** + * Get positionCollectionList + * + * @return positionCollectionList + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid PoolRespPositionCollectionListInner> getPositionCollectionList() { + return positionCollectionList; + } + + public void setPositionCollectionList( + @jakarta.annotation.Nullable + List<@Valid PoolRespPositionCollectionListInner> positionCollectionList) { + this.positionCollectionList = positionCollectionList; + } + + public ProtocolRespPoolListInner poolDetail( + @jakarta.annotation.Nullable PoolRespPoolDetail poolDetail) { + this.poolDetail = poolDetail; + return this; + } + + /** + * Get poolDetail + * + * @return poolDetail + */ + @jakarta.annotation.Nullable + @Valid + public PoolRespPoolDetail getPoolDetail() { + return poolDetail; + } + + public void setPoolDetail(@jakarta.annotation.Nullable PoolRespPoolDetail poolDetail) { + this.poolDetail = poolDetail; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProtocolRespPoolListInner protocolRespPoolListInner = (ProtocolRespPoolListInner) o; + return Objects.equals(this.bnPoolId, protocolRespPoolListInner.bnPoolId) + && Objects.equals(this.poolCa, protocolRespPoolListInner.poolCa) + && Objects.equals(this.poolType, protocolRespPoolListInner.poolType) + && Objects.equals( + this.positionCollectionList, + protocolRespPoolListInner.positionCollectionList) + && Objects.equals(this.poolDetail, protocolRespPoolListInner.poolDetail); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(bnPoolId, poolCa, poolType, positionCollectionList, poolDetail); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProtocolRespPoolListInner {\n"); + sb.append(" bnPoolId: ").append(toIndentedString(bnPoolId)).append("\n"); + sb.append(" poolCa: ").append(toIndentedString(poolCa)).append("\n"); + sb.append(" poolType: ").append(toIndentedString(poolType)).append("\n"); + sb.append(" positionCollectionList: ") + .append(toIndentedString(positionCollectionList)) + .append("\n"); + sb.append(" poolDetail: ").append(toIndentedString(poolDetail)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object bnPoolIdValue = getBnPoolId(); + String bnPoolIdValueAsString = ""; + bnPoolIdValueAsString = bnPoolIdValue.toString(); + sb.append("bnPoolId=").append(urlEncode(bnPoolIdValueAsString)).append(""); + Object poolCaValue = getPoolCa(); + String poolCaValueAsString = ""; + poolCaValueAsString = poolCaValue.toString(); + sb.append("poolCa=").append(urlEncode(poolCaValueAsString)).append(""); + Object poolTypeValue = getPoolType(); + String poolTypeValueAsString = ""; + poolTypeValueAsString = poolTypeValue.toString(); + sb.append("poolType=").append(urlEncode(poolTypeValueAsString)).append(""); + Object positionCollectionListValue = getPositionCollectionList(); + String positionCollectionListValueAsString = ""; + positionCollectionListValueAsString = + (String) + ((Collection) positionCollectionListValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("positionCollectionList=") + .append(urlEncode(positionCollectionListValueAsString)) + .append(""); + Object poolDetailValue = getPoolDetail(); + String poolDetailValueAsString = ""; + poolDetailValueAsString = poolDetailValue.toString(); + sb.append("poolDetail=").append(urlEncode(poolDetailValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("bnPoolId"); + openapiFields.add("poolCa"); + openapiFields.add("poolType"); + openapiFields.add("positionCollectionList"); + openapiFields.add("poolDetail"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ProtocolRespPoolListInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ProtocolRespPoolListInner.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in ProtocolRespPoolListInner is not found" + + " in the empty JSON string", + ProtocolRespPoolListInner.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("bnPoolId") != null && !jsonObj.get("bnPoolId").isJsonNull()) + && !jsonObj.get("bnPoolId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `bnPoolId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("bnPoolId").toString())); + } + if ((jsonObj.get("poolCa") != null && !jsonObj.get("poolCa").isJsonNull()) + && !jsonObj.get("poolCa").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `poolCa` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("poolCa").toString())); + } + if ((jsonObj.get("poolType") != null && !jsonObj.get("poolType").isJsonNull()) + && !jsonObj.get("poolType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `poolType` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("poolType").toString())); + } + if (jsonObj.get("positionCollectionList") != null + && !jsonObj.get("positionCollectionList").isJsonNull()) { + JsonArray jsonArraypositionCollectionList = + jsonObj.getAsJsonArray("positionCollectionList"); + if (jsonArraypositionCollectionList != null) { + // ensure the json data is an array + if (!jsonObj.get("positionCollectionList").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `positionCollectionList` to be an array in" + + " the JSON string but got `%s`", + jsonObj.get("positionCollectionList").toString())); + } + + // validate the optional field `positionCollectionList` (array) + for (int i = 0; i < jsonArraypositionCollectionList.size(); i++) { + PoolRespPositionCollectionListInner.validateJsonElement( + jsonArraypositionCollectionList.get(i)); + } + ; + } + } + // validate the optional field `poolDetail` + if (jsonObj.get("poolDetail") != null && !jsonObj.get("poolDetail").isJsonNull()) { + PoolRespPoolDetail.validateJsonElement(jsonObj.get("poolDetail")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ProtocolRespPoolListInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ProtocolRespPoolListInner' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(ProtocolRespPoolListInner.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ProtocolRespPoolListInner value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ProtocolRespPoolListInner read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of ProtocolRespPoolListInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of ProtocolRespPoolListInner + * @throws IOException if the JSON string is invalid with respect to ProtocolRespPoolListInner + */ + public static ProtocolRespPoolListInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ProtocolRespPoolListInner.class); + } + + /** + * Convert an instance of ProtocolRespPoolListInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/QuoteAndBuildSwapTransactionResponse.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/QuoteAndBuildSwapTransactionResponse.java index a344388..e0df9e9 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/QuoteAndBuildSwapTransactionResponse.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/QuoteAndBuildSwapTransactionResponse.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/QuoteAndBuildSwapTransactionResponseData.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/QuoteAndBuildSwapTransactionResponseData.java index e233a48..6afa1d8 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/QuoteAndBuildSwapTransactionResponseData.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/QuoteAndBuildSwapTransactionResponseData.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/QuoteAndBuildSwapTransactionResponseDataRfq.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/QuoteAndBuildSwapTransactionResponseDataRfq.java index f505f80..9fb951a 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/QuoteAndBuildSwapTransactionResponseDataRfq.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/QuoteAndBuildSwapTransactionResponseDataRfq.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/RankBy.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/RankBy.java index f021980..cd8809a 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/RankBy.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/RankBy.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/RankingTimeFrame.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/RankingTimeFrame.java index ad38000..9ceb387 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/RankingTimeFrame.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/RankingTimeFrame.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SearchRwaTokenResponse.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SearchRwaTokenResponse.java index 0c205c9..f0a079d 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SearchRwaTokenResponse.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SearchRwaTokenResponse.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SearchRwaTokenResponseDataInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SearchRwaTokenResponseDataInner.java index 0574247..3610b1e 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SearchRwaTokenResponseDataInner.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SearchRwaTokenResponseDataInner.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SearchRwaTokenResponseDataInnerAssetsInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SearchRwaTokenResponseDataInnerAssetsInner.java index a4653a9..0addc99 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SearchRwaTokenResponseDataInnerAssetsInner.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SearchRwaTokenResponseDataInnerAssetsInner.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SearchTokenResponse.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SearchTokenResponse.java index ebf5f2e..4f059b1 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SearchTokenResponse.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SearchTokenResponse.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SearchTokenResponseDataInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SearchTokenResponseDataInner.java index 4580107..99acacf 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SearchTokenResponseDataInner.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SearchTokenResponseDataInner.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SettleB402PaymentV1Request.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SettleB402PaymentV1Request.java new file mode 100644 index 0000000..07867a2 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SettleB402PaymentV1Request.java @@ -0,0 +1,220 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** SettleB402PaymentV1Request */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class SettleB402PaymentV1Request { + public static final String SERIALIZED_NAME_BODY = "body"; + + @SerializedName(SERIALIZED_NAME_BODY) + @jakarta.annotation.Nonnull + private B402SettleEnvelopeV1Body body; + + public SettleB402PaymentV1Request() {} + + public SettleB402PaymentV1Request body( + @jakarta.annotation.Nonnull B402SettleEnvelopeV1Body body) { + this.body = body; + return this; + } + + /** + * Get body + * + * @return body + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public B402SettleEnvelopeV1Body getBody() { + return body; + } + + public void setBody(@jakarta.annotation.Nonnull B402SettleEnvelopeV1Body body) { + this.body = body; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SettleB402PaymentV1Request settleB402PaymentV1Request = (SettleB402PaymentV1Request) o; + return Objects.equals(this.body, settleB402PaymentV1Request.body); + } + + @Override + public int hashCode() { + return Objects.hash(body); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SettleB402PaymentV1Request {\n"); + sb.append(" body: ").append(toIndentedString(body)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object bodyValue = getBody(); + String bodyValueAsString = ""; + bodyValueAsString = bodyValue.toString(); + sb.append("body=").append(urlEncode(bodyValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("body"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("body"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SettleB402PaymentV1Request + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SettleB402PaymentV1Request.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in SettleB402PaymentV1Request is not" + + " found in the empty JSON string", + SettleB402PaymentV1Request.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SettleB402PaymentV1Request.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `body` + B402SettleEnvelopeV1Body.validateJsonElement(jsonObj.get("body")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SettleB402PaymentV1Request.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SettleB402PaymentV1Request' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(SettleB402PaymentV1Request.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, SettleB402PaymentV1Request value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SettleB402PaymentV1Request read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of SettleB402PaymentV1Request given an JSON string + * + * @param jsonString JSON string + * @return An instance of SettleB402PaymentV1Request + * @throws IOException if the JSON string is invalid with respect to SettleB402PaymentV1Request + */ + public static SettleB402PaymentV1Request fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SettleB402PaymentV1Request.class); + } + + /** + * Convert an instance of SettleB402PaymentV1Request to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SettleB402PaymentV1Response.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SettleB402PaymentV1Response.java new file mode 100644 index 0000000..bfb00d9 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SettleB402PaymentV1Response.java @@ -0,0 +1,308 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.common.AbstractOpenApiSchema; +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; +import org.hibernate.validator.constraints.*; + +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class SettleB402PaymentV1Response extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(SettleB402PaymentV1Response.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SettleB402PaymentV1Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SettleB402PaymentV1Response' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterSettleB402PaymentV1Response1 = + gson.getDelegateAdapter( + this, TypeToken.get(SettleB402PaymentV1Response1.class)); + final TypeAdapter adapterSettleB402PaymentV1Response2 = + gson.getDelegateAdapter( + this, TypeToken.get(SettleB402PaymentV1Response2.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, SettleB402PaymentV1Response value) + throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type + // `SettleB402PaymentV1Response1` + if (value.getActualInstance() instanceof SettleB402PaymentV1Response1) { + JsonElement element = + adapterSettleB402PaymentV1Response1.toJsonTree( + (SettleB402PaymentV1Response1) + value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type + // `SettleB402PaymentV1Response2` + if (value.getActualInstance() instanceof SettleB402PaymentV1Response2) { + JsonElement element = + adapterSettleB402PaymentV1Response2.toJsonTree( + (SettleB402PaymentV1Response2) + value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException( + "Failed to serialize as the type doesn't match oneOf schemas:" + + " SettleB402PaymentV1Response1," + + " SettleB402PaymentV1Response2"); + } + + @Override + public SettleB402PaymentV1Response read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize SettleB402PaymentV1Response1 + try { + // validate the JSON object to see if any exception is thrown + SettleB402PaymentV1Response1.validateJsonElement(jsonElement); + actualAdapter = adapterSettleB402PaymentV1Response1; + match++; + log.log( + Level.FINER, + "Input data matches schema 'SettleB402PaymentV1Response1'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add( + String.format( + "Deserialization for SettleB402PaymentV1Response1" + + " failed with `%s`.", + e.getMessage())); + log.log( + Level.FINER, + "Input data does not match schema" + + " 'SettleB402PaymentV1Response1'", + e); + } + // deserialize SettleB402PaymentV1Response2 + try { + // validate the JSON object to see if any exception is thrown + SettleB402PaymentV1Response2.validateJsonElement(jsonElement); + actualAdapter = adapterSettleB402PaymentV1Response2; + match++; + log.log( + Level.FINER, + "Input data matches schema 'SettleB402PaymentV1Response2'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add( + String.format( + "Deserialization for SettleB402PaymentV1Response2" + + " failed with `%s`.", + e.getMessage())); + log.log( + Level.FINER, + "Input data does not match schema" + + " 'SettleB402PaymentV1Response2'", + e); + } + + if (match == 1) { + SettleB402PaymentV1Response ret = new SettleB402PaymentV1Response(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException( + String.format( + "Failed deserialization for" + + " SettleB402PaymentV1Response: %d classes match" + + " result, expected 1. Detailed failure message" + + " for oneOf schemas: %s. JSON: %s", + match, errorMessages, jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap>(); + + public SettleB402PaymentV1Response() { + super("oneOf", Boolean.FALSE); + } + + public SettleB402PaymentV1Response(Object o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("SettleB402PaymentV1Response1", SettleB402PaymentV1Response1.class); + schemas.put("SettleB402PaymentV1Response2", SettleB402PaymentV1Response2.class); + } + + @Override + public Map> getSchemas() { + return SettleB402PaymentV1Response.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: SettleB402PaymentV1Response1, SettleB402PaymentV1Response2 + * + *

It could be an instance of the 'oneOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof SettleB402PaymentV1Response1) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof SettleB402PaymentV1Response2) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException( + "Invalid instance type. Must be SettleB402PaymentV1Response1," + + " SettleB402PaymentV1Response2"); + } + + /** + * Get the actual instance, which can be the following: SettleB402PaymentV1Response1, + * SettleB402PaymentV1Response2 + * + * @return The actual instance (SettleB402PaymentV1Response1, SettleB402PaymentV1Response2) + */ + @SuppressWarnings("unchecked") + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `SettleB402PaymentV1Response1`. If the actual instance is not + * `SettleB402PaymentV1Response1`, the ClassCastException will be thrown. + * + * @return The actual instance of `SettleB402PaymentV1Response1` + * @throws ClassCastException if the instance is not `SettleB402PaymentV1Response1` + */ + public SettleB402PaymentV1Response1 getSettleB402PaymentV1Response1() + throws ClassCastException { + return (SettleB402PaymentV1Response1) super.getActualInstance(); + } + + /** + * Get the actual instance of `SettleB402PaymentV1Response2`. If the actual instance is not + * `SettleB402PaymentV1Response2`, the ClassCastException will be thrown. + * + * @return The actual instance of `SettleB402PaymentV1Response2` + * @throws ClassCastException if the instance is not `SettleB402PaymentV1Response2` + */ + public SettleB402PaymentV1Response2 getSettleB402PaymentV1Response2() + throws ClassCastException { + return (SettleB402PaymentV1Response2) super.getActualInstance(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * SettleB402PaymentV1Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate oneOf schemas one by one + int validCount = 0; + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with SettleB402PaymentV1Response1 + try { + SettleB402PaymentV1Response1.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add( + String.format( + "Deserialization for SettleB402PaymentV1Response1 failed with `%s`.", + e.getMessage())); + // continue to the next one + } + // validate the json string with SettleB402PaymentV1Response2 + try { + SettleB402PaymentV1Response2.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add( + String.format( + "Deserialization for SettleB402PaymentV1Response2 failed with `%s`.", + e.getMessage())); + // continue to the next one + } + if (validCount != 1) { + throw new IOException( + String.format( + "The JSON string is invalid for SettleB402PaymentV1Response with oneOf" + + " schemas: SettleB402PaymentV1Response1," + + " SettleB402PaymentV1Response2. %d class(es) match the result," + + " expected 1. Detailed failure message for oneOf schemas: %s." + + " JSON: %s", + validCount, errorMessages, jsonElement.toString())); + } + } + + /** + * Create an instance of SettleB402PaymentV1Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of SettleB402PaymentV1Response + * @throws IOException if the JSON string is invalid with respect to SettleB402PaymentV1Response + */ + public static SettleB402PaymentV1Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SettleB402PaymentV1Response.class); + } + + /** + * Convert an instance of SettleB402PaymentV1Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SettleB402PaymentV1Response1.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SettleB402PaymentV1Response1.java new file mode 100644 index 0000000..738826d --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SettleB402PaymentV1Response1.java @@ -0,0 +1,456 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** SettleB402PaymentV1Response1 */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class SettleB402PaymentV1Response1 { + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + @jakarta.annotation.Nullable + private String status; + + public static final String SERIALIZED_NAME_TYPE = "type"; + + @SerializedName(SERIALIZED_NAME_TYPE) + @jakarta.annotation.Nullable + private String type; + + public static final String SERIALIZED_NAME_CODE = "code"; + + @SerializedName(SERIALIZED_NAME_CODE) + @jakarta.annotation.Nullable + private String code; + + public static final String SERIALIZED_NAME_ERROR_DATA = "errorData"; + + @SerializedName(SERIALIZED_NAME_ERROR_DATA) + @jakarta.annotation.Nullable + private String errorData; + + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + @jakarta.annotation.Nullable + private SettleB402PaymentV1Response1Data data; + + public static final String SERIALIZED_NAME_SUB_DATA = "subData"; + + @SerializedName(SERIALIZED_NAME_SUB_DATA) + @jakarta.annotation.Nullable + private Object subData; + + public static final String SERIALIZED_NAME_PARAMS = "params"; + + @SerializedName(SERIALIZED_NAME_PARAMS) + @jakarta.annotation.Nullable + private Object params; + + public SettleB402PaymentV1Response1() {} + + public SettleB402PaymentV1Response1 status(@jakarta.annotation.Nullable String status) { + this.status = status; + return this; + } + + /** + * Get status + * + * @return status + */ + @jakarta.annotation.Nullable + public String getStatus() { + return status; + } + + public void setStatus(@jakarta.annotation.Nullable String status) { + this.status = status; + } + + public SettleB402PaymentV1Response1 type(@jakarta.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * + * @return type + */ + @jakarta.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@jakarta.annotation.Nullable String type) { + this.type = type; + } + + public SettleB402PaymentV1Response1 code(@jakarta.annotation.Nullable String code) { + this.code = code; + return this; + } + + /** + * Get code + * + * @return code + */ + @jakarta.annotation.Nullable + public String getCode() { + return code; + } + + public void setCode(@jakarta.annotation.Nullable String code) { + this.code = code; + } + + public SettleB402PaymentV1Response1 errorData(@jakarta.annotation.Nullable String errorData) { + this.errorData = errorData; + return this; + } + + /** + * Get errorData + * + * @return errorData + */ + @jakarta.annotation.Nullable + public String getErrorData() { + return errorData; + } + + public void setErrorData(@jakarta.annotation.Nullable String errorData) { + this.errorData = errorData; + } + + public SettleB402PaymentV1Response1 data( + @jakarta.annotation.Nullable SettleB402PaymentV1Response1Data data) { + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @jakarta.annotation.Nullable + @Valid + public SettleB402PaymentV1Response1Data getData() { + return data; + } + + public void setData(@jakarta.annotation.Nullable SettleB402PaymentV1Response1Data data) { + this.data = data; + } + + public SettleB402PaymentV1Response1 subData(@jakarta.annotation.Nullable Object subData) { + this.subData = subData; + return this; + } + + /** + * Get subData + * + * @return subData + */ + @jakarta.annotation.Nullable + public Object getSubData() { + return subData; + } + + public void setSubData(@jakarta.annotation.Nullable Object subData) { + this.subData = subData; + } + + public SettleB402PaymentV1Response1 params(@jakarta.annotation.Nullable Object params) { + this.params = params; + return this; + } + + /** + * Get params + * + * @return params + */ + @jakarta.annotation.Nullable + public Object getParams() { + return params; + } + + public void setParams(@jakarta.annotation.Nullable Object params) { + this.params = params; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SettleB402PaymentV1Response1 settleB402PaymentV1Response1 = + (SettleB402PaymentV1Response1) o; + return Objects.equals(this.status, settleB402PaymentV1Response1.status) + && Objects.equals(this.type, settleB402PaymentV1Response1.type) + && Objects.equals(this.code, settleB402PaymentV1Response1.code) + && Objects.equals(this.errorData, settleB402PaymentV1Response1.errorData) + && Objects.equals(this.data, settleB402PaymentV1Response1.data) + && Objects.equals(this.subData, settleB402PaymentV1Response1.subData) + && Objects.equals(this.params, settleB402PaymentV1Response1.params); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(status, type, code, errorData, data, subData, params); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SettleB402PaymentV1Response1 {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" errorData: ").append(toIndentedString(errorData)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" subData: ").append(toIndentedString(subData)).append("\n"); + sb.append(" params: ").append(toIndentedString(params)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object statusValue = getStatus(); + String statusValueAsString = ""; + statusValueAsString = statusValue.toString(); + sb.append("status=").append(urlEncode(statusValueAsString)).append(""); + Object typeValue = getType(); + String typeValueAsString = ""; + typeValueAsString = typeValue.toString(); + sb.append("type=").append(urlEncode(typeValueAsString)).append(""); + Object codeValue = getCode(); + String codeValueAsString = ""; + codeValueAsString = codeValue.toString(); + sb.append("code=").append(urlEncode(codeValueAsString)).append(""); + Object errorDataValue = getErrorData(); + String errorDataValueAsString = ""; + errorDataValueAsString = errorDataValue.toString(); + sb.append("errorData=").append(urlEncode(errorDataValueAsString)).append(""); + Object dataValue = getData(); + String dataValueAsString = ""; + dataValueAsString = dataValue.toString(); + sb.append("data=").append(urlEncode(dataValueAsString)).append(""); + Object subDataValue = getSubData(); + String subDataValueAsString = ""; + subDataValueAsString = subDataValue.toString(); + sb.append("subData=").append(urlEncode(subDataValueAsString)).append(""); + Object paramsValue = getParams(); + String paramsValueAsString = ""; + paramsValueAsString = paramsValue.toString(); + sb.append("params=").append(urlEncode(paramsValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("status"); + openapiFields.add("type"); + openapiFields.add("code"); + openapiFields.add("errorData"); + openapiFields.add("data"); + openapiFields.add("subData"); + openapiFields.add("params"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * SettleB402PaymentV1Response1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SettleB402PaymentV1Response1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in SettleB402PaymentV1Response1 is not" + + " found in the empty JSON string", + SettleB402PaymentV1Response1.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) + && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `status` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("status").toString())); + } + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) + && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `type` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("type").toString())); + } + if ((jsonObj.get("code") != null && !jsonObj.get("code").isJsonNull()) + && !jsonObj.get("code").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `code` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("code").toString())); + } + if ((jsonObj.get("errorData") != null && !jsonObj.get("errorData").isJsonNull()) + && !jsonObj.get("errorData").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `errorData` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("errorData").toString())); + } + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + SettleB402PaymentV1Response1Data.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SettleB402PaymentV1Response1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SettleB402PaymentV1Response1' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(SettleB402PaymentV1Response1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, SettleB402PaymentV1Response1 value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SettleB402PaymentV1Response1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of SettleB402PaymentV1Response1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of SettleB402PaymentV1Response1 + * @throws IOException if the JSON string is invalid with respect to + * SettleB402PaymentV1Response1 + */ + public static SettleB402PaymentV1Response1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SettleB402PaymentV1Response1.class); + } + + /** + * Convert an instance of SettleB402PaymentV1Response1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SettleB402PaymentV1Response1Data.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SettleB402PaymentV1Response1Data.java new file mode 100644 index 0000000..148bc9e --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SettleB402PaymentV1Response1Data.java @@ -0,0 +1,523 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** SettleB402PaymentV1Response1Data */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class SettleB402PaymentV1Response1Data { + public static final String SERIALIZED_NAME_SUCCESS = "success"; + + @SerializedName(SERIALIZED_NAME_SUCCESS) + @jakarta.annotation.Nonnull + private Boolean success; + + public static final String SERIALIZED_NAME_TRANSACTION = "transaction"; + + @SerializedName(SERIALIZED_NAME_TRANSACTION) + @jakarta.annotation.Nullable + private String transaction; + + public static final String SERIALIZED_NAME_PAYER = "payer"; + + @SerializedName(SERIALIZED_NAME_PAYER) + @jakarta.annotation.Nullable + private String payer; + + public static final String SERIALIZED_NAME_NETWORK = "network"; + + @SerializedName(SERIALIZED_NAME_NETWORK) + @jakarta.annotation.Nullable + private String network; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + + @SerializedName(SERIALIZED_NAME_AMOUNT) + @jakarta.annotation.Nullable + private String amount; + + public static final String SERIALIZED_NAME_CONFIRMATIONS = "confirmations"; + + @SerializedName(SERIALIZED_NAME_CONFIRMATIONS) + @jakarta.annotation.Nullable + private Integer confirmations; + + public static final String SERIALIZED_NAME_ERROR_REASON = "errorReason"; + + @SerializedName(SERIALIZED_NAME_ERROR_REASON) + @jakarta.annotation.Nullable + private String errorReason; + + public static final String SERIALIZED_NAME_ERROR_MESSAGE = "errorMessage"; + + @SerializedName(SERIALIZED_NAME_ERROR_MESSAGE) + @jakarta.annotation.Nullable + private String errorMessage; + + public SettleB402PaymentV1Response1Data() {} + + public SettleB402PaymentV1Response1Data success(@jakarta.annotation.Nonnull Boolean success) { + this.success = success; + return this; + } + + /** + * Get success + * + * @return success + */ + @jakarta.annotation.Nonnull + @NotNull + public Boolean getSuccess() { + return success; + } + + public void setSuccess(@jakarta.annotation.Nonnull Boolean success) { + this.success = success; + } + + public SettleB402PaymentV1Response1Data transaction( + @jakarta.annotation.Nullable String transaction) { + this.transaction = transaction; + return this; + } + + /** + * Get transaction + * + * @return transaction + */ + @jakarta.annotation.Nullable + public String getTransaction() { + return transaction; + } + + public void setTransaction(@jakarta.annotation.Nullable String transaction) { + this.transaction = transaction; + } + + public SettleB402PaymentV1Response1Data payer(@jakarta.annotation.Nullable String payer) { + this.payer = payer; + return this; + } + + /** + * Get payer + * + * @return payer + */ + @jakarta.annotation.Nullable + public String getPayer() { + return payer; + } + + public void setPayer(@jakarta.annotation.Nullable String payer) { + this.payer = payer; + } + + public SettleB402PaymentV1Response1Data network(@jakarta.annotation.Nullable String network) { + this.network = network; + return this; + } + + /** + * Get network + * + * @return network + */ + @jakarta.annotation.Nullable + public String getNetwork() { + return network; + } + + public void setNetwork(@jakarta.annotation.Nullable String network) { + this.network = network; + } + + public SettleB402PaymentV1Response1Data amount(@jakarta.annotation.Nullable String amount) { + this.amount = amount; + return this; + } + + /** + * Get amount + * + * @return amount + */ + @jakarta.annotation.Nullable + public String getAmount() { + return amount; + } + + public void setAmount(@jakarta.annotation.Nullable String amount) { + this.amount = amount; + } + + public SettleB402PaymentV1Response1Data confirmations( + @jakarta.annotation.Nullable Integer confirmations) { + this.confirmations = confirmations; + return this; + } + + /** + * Get confirmations + * + * @return confirmations + */ + @jakarta.annotation.Nullable + public Integer getConfirmations() { + return confirmations; + } + + public void setConfirmations(@jakarta.annotation.Nullable Integer confirmations) { + this.confirmations = confirmations; + } + + public SettleB402PaymentV1Response1Data errorReason( + @jakarta.annotation.Nullable String errorReason) { + this.errorReason = errorReason; + return this; + } + + /** + * Get errorReason + * + * @return errorReason + */ + @jakarta.annotation.Nullable + public String getErrorReason() { + return errorReason; + } + + public void setErrorReason(@jakarta.annotation.Nullable String errorReason) { + this.errorReason = errorReason; + } + + public SettleB402PaymentV1Response1Data errorMessage( + @jakarta.annotation.Nullable String errorMessage) { + this.errorMessage = errorMessage; + return this; + } + + /** + * Get errorMessage + * + * @return errorMessage + */ + @jakarta.annotation.Nullable + public String getErrorMessage() { + return errorMessage; + } + + public void setErrorMessage(@jakarta.annotation.Nullable String errorMessage) { + this.errorMessage = errorMessage; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SettleB402PaymentV1Response1Data settleB402PaymentV1Response1Data = + (SettleB402PaymentV1Response1Data) o; + return Objects.equals(this.success, settleB402PaymentV1Response1Data.success) + && Objects.equals(this.transaction, settleB402PaymentV1Response1Data.transaction) + && Objects.equals(this.payer, settleB402PaymentV1Response1Data.payer) + && Objects.equals(this.network, settleB402PaymentV1Response1Data.network) + && Objects.equals(this.amount, settleB402PaymentV1Response1Data.amount) + && Objects.equals( + this.confirmations, settleB402PaymentV1Response1Data.confirmations) + && Objects.equals(this.errorReason, settleB402PaymentV1Response1Data.errorReason) + && Objects.equals(this.errorMessage, settleB402PaymentV1Response1Data.errorMessage); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash( + success, + transaction, + payer, + network, + amount, + confirmations, + errorReason, + errorMessage); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SettleB402PaymentV1Response1Data {\n"); + sb.append(" success: ").append(toIndentedString(success)).append("\n"); + sb.append(" transaction: ").append(toIndentedString(transaction)).append("\n"); + sb.append(" payer: ").append(toIndentedString(payer)).append("\n"); + sb.append(" network: ").append(toIndentedString(network)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" confirmations: ").append(toIndentedString(confirmations)).append("\n"); + sb.append(" errorReason: ").append(toIndentedString(errorReason)).append("\n"); + sb.append(" errorMessage: ").append(toIndentedString(errorMessage)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object successValue = getSuccess(); + String successValueAsString = ""; + successValueAsString = successValue.toString(); + sb.append("success=").append(urlEncode(successValueAsString)).append(""); + Object transactionValue = getTransaction(); + String transactionValueAsString = ""; + transactionValueAsString = transactionValue.toString(); + sb.append("transaction=").append(urlEncode(transactionValueAsString)).append(""); + Object payerValue = getPayer(); + String payerValueAsString = ""; + payerValueAsString = payerValue.toString(); + sb.append("payer=").append(urlEncode(payerValueAsString)).append(""); + Object networkValue = getNetwork(); + String networkValueAsString = ""; + networkValueAsString = networkValue.toString(); + sb.append("network=").append(urlEncode(networkValueAsString)).append(""); + Object amountValue = getAmount(); + String amountValueAsString = ""; + amountValueAsString = amountValue.toString(); + sb.append("amount=").append(urlEncode(amountValueAsString)).append(""); + Object confirmationsValue = getConfirmations(); + String confirmationsValueAsString = ""; + confirmationsValueAsString = confirmationsValue.toString(); + sb.append("confirmations=").append(urlEncode(confirmationsValueAsString)).append(""); + Object errorReasonValue = getErrorReason(); + String errorReasonValueAsString = ""; + errorReasonValueAsString = errorReasonValue.toString(); + sb.append("errorReason=").append(urlEncode(errorReasonValueAsString)).append(""); + Object errorMessageValue = getErrorMessage(); + String errorMessageValueAsString = ""; + errorMessageValueAsString = errorMessageValue.toString(); + sb.append("errorMessage=").append(urlEncode(errorMessageValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("success"); + openapiFields.add("transaction"); + openapiFields.add("payer"); + openapiFields.add("network"); + openapiFields.add("amount"); + openapiFields.add("confirmations"); + openapiFields.add("errorReason"); + openapiFields.add("errorMessage"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("success"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * SettleB402PaymentV1Response1Data + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SettleB402PaymentV1Response1Data.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in SettleB402PaymentV1Response1Data is" + + " not found in the empty JSON string", + SettleB402PaymentV1Response1Data.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SettleB402PaymentV1Response1Data.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("transaction") != null && !jsonObj.get("transaction").isJsonNull()) + && !jsonObj.get("transaction").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `transaction` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("transaction").toString())); + } + if ((jsonObj.get("payer") != null && !jsonObj.get("payer").isJsonNull()) + && !jsonObj.get("payer").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `payer` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("payer").toString())); + } + if ((jsonObj.get("network") != null && !jsonObj.get("network").isJsonNull()) + && !jsonObj.get("network").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `network` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("network").toString())); + } + if ((jsonObj.get("amount") != null && !jsonObj.get("amount").isJsonNull()) + && !jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `amount` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("amount").toString())); + } + if ((jsonObj.get("errorReason") != null && !jsonObj.get("errorReason").isJsonNull()) + && !jsonObj.get("errorReason").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `errorReason` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("errorReason").toString())); + } + if ((jsonObj.get("errorMessage") != null && !jsonObj.get("errorMessage").isJsonNull()) + && !jsonObj.get("errorMessage").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `errorMessage` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("errorMessage").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SettleB402PaymentV1Response1Data.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SettleB402PaymentV1Response1Data' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(SettleB402PaymentV1Response1Data.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, SettleB402PaymentV1Response1Data value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SettleB402PaymentV1Response1Data read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of SettleB402PaymentV1Response1Data given an JSON string + * + * @param jsonString JSON string + * @return An instance of SettleB402PaymentV1Response1Data + * @throws IOException if the JSON string is invalid with respect to + * SettleB402PaymentV1Response1Data + */ + public static SettleB402PaymentV1Response1Data fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SettleB402PaymentV1Response1Data.class); + } + + /** + * Convert an instance of SettleB402PaymentV1Response1Data to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SettleB402PaymentV1Response2.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SettleB402PaymentV1Response2.java new file mode 100644 index 0000000..e8473f6 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SettleB402PaymentV1Response2.java @@ -0,0 +1,449 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** SettleB402PaymentV1Response2 */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class SettleB402PaymentV1Response2 { + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + @jakarta.annotation.Nullable + private String status; + + public static final String SERIALIZED_NAME_TYPE = "type"; + + @SerializedName(SERIALIZED_NAME_TYPE) + @jakarta.annotation.Nullable + private String type; + + public static final String SERIALIZED_NAME_CODE = "code"; + + @SerializedName(SERIALIZED_NAME_CODE) + @jakarta.annotation.Nullable + private String code; + + public static final String SERIALIZED_NAME_ERROR_DATA = "errorData"; + + @SerializedName(SERIALIZED_NAME_ERROR_DATA) + @jakarta.annotation.Nullable + private String errorData; + + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + @jakarta.annotation.Nullable + private Object data; + + public static final String SERIALIZED_NAME_SUB_DATA = "subData"; + + @SerializedName(SERIALIZED_NAME_SUB_DATA) + @jakarta.annotation.Nullable + private Object subData; + + public static final String SERIALIZED_NAME_PARAMS = "params"; + + @SerializedName(SERIALIZED_NAME_PARAMS) + @jakarta.annotation.Nullable + private Object params; + + public SettleB402PaymentV1Response2() {} + + public SettleB402PaymentV1Response2 status(@jakarta.annotation.Nullable String status) { + this.status = status; + return this; + } + + /** + * Get status + * + * @return status + */ + @jakarta.annotation.Nullable + public String getStatus() { + return status; + } + + public void setStatus(@jakarta.annotation.Nullable String status) { + this.status = status; + } + + public SettleB402PaymentV1Response2 type(@jakarta.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * + * @return type + */ + @jakarta.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@jakarta.annotation.Nullable String type) { + this.type = type; + } + + public SettleB402PaymentV1Response2 code(@jakarta.annotation.Nullable String code) { + this.code = code; + return this; + } + + /** + * Get code + * + * @return code + */ + @jakarta.annotation.Nullable + public String getCode() { + return code; + } + + public void setCode(@jakarta.annotation.Nullable String code) { + this.code = code; + } + + public SettleB402PaymentV1Response2 errorData(@jakarta.annotation.Nullable String errorData) { + this.errorData = errorData; + return this; + } + + /** + * Get errorData + * + * @return errorData + */ + @jakarta.annotation.Nullable + public String getErrorData() { + return errorData; + } + + public void setErrorData(@jakarta.annotation.Nullable String errorData) { + this.errorData = errorData; + } + + public SettleB402PaymentV1Response2 data(@jakarta.annotation.Nullable Object data) { + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @jakarta.annotation.Nullable + public Object getData() { + return data; + } + + public void setData(@jakarta.annotation.Nullable Object data) { + this.data = data; + } + + public SettleB402PaymentV1Response2 subData(@jakarta.annotation.Nullable Object subData) { + this.subData = subData; + return this; + } + + /** + * Get subData + * + * @return subData + */ + @jakarta.annotation.Nullable + public Object getSubData() { + return subData; + } + + public void setSubData(@jakarta.annotation.Nullable Object subData) { + this.subData = subData; + } + + public SettleB402PaymentV1Response2 params(@jakarta.annotation.Nullable Object params) { + this.params = params; + return this; + } + + /** + * Get params + * + * @return params + */ + @jakarta.annotation.Nullable + public Object getParams() { + return params; + } + + public void setParams(@jakarta.annotation.Nullable Object params) { + this.params = params; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SettleB402PaymentV1Response2 settleB402PaymentV1Response2 = + (SettleB402PaymentV1Response2) o; + return Objects.equals(this.status, settleB402PaymentV1Response2.status) + && Objects.equals(this.type, settleB402PaymentV1Response2.type) + && Objects.equals(this.code, settleB402PaymentV1Response2.code) + && Objects.equals(this.errorData, settleB402PaymentV1Response2.errorData) + && Objects.equals(this.data, settleB402PaymentV1Response2.data) + && Objects.equals(this.subData, settleB402PaymentV1Response2.subData) + && Objects.equals(this.params, settleB402PaymentV1Response2.params); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(status, type, code, errorData, data, subData, params); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SettleB402PaymentV1Response2 {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" errorData: ").append(toIndentedString(errorData)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" subData: ").append(toIndentedString(subData)).append("\n"); + sb.append(" params: ").append(toIndentedString(params)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object statusValue = getStatus(); + String statusValueAsString = ""; + statusValueAsString = statusValue.toString(); + sb.append("status=").append(urlEncode(statusValueAsString)).append(""); + Object typeValue = getType(); + String typeValueAsString = ""; + typeValueAsString = typeValue.toString(); + sb.append("type=").append(urlEncode(typeValueAsString)).append(""); + Object codeValue = getCode(); + String codeValueAsString = ""; + codeValueAsString = codeValue.toString(); + sb.append("code=").append(urlEncode(codeValueAsString)).append(""); + Object errorDataValue = getErrorData(); + String errorDataValueAsString = ""; + errorDataValueAsString = errorDataValue.toString(); + sb.append("errorData=").append(urlEncode(errorDataValueAsString)).append(""); + Object dataValue = getData(); + String dataValueAsString = ""; + dataValueAsString = dataValue.toString(); + sb.append("data=").append(urlEncode(dataValueAsString)).append(""); + Object subDataValue = getSubData(); + String subDataValueAsString = ""; + subDataValueAsString = subDataValue.toString(); + sb.append("subData=").append(urlEncode(subDataValueAsString)).append(""); + Object paramsValue = getParams(); + String paramsValueAsString = ""; + paramsValueAsString = paramsValue.toString(); + sb.append("params=").append(urlEncode(paramsValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("status"); + openapiFields.add("type"); + openapiFields.add("code"); + openapiFields.add("errorData"); + openapiFields.add("data"); + openapiFields.add("subData"); + openapiFields.add("params"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * SettleB402PaymentV1Response2 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SettleB402PaymentV1Response2.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in SettleB402PaymentV1Response2 is not" + + " found in the empty JSON string", + SettleB402PaymentV1Response2.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) + && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `status` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("status").toString())); + } + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) + && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `type` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("type").toString())); + } + if ((jsonObj.get("code") != null && !jsonObj.get("code").isJsonNull()) + && !jsonObj.get("code").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `code` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("code").toString())); + } + if ((jsonObj.get("errorData") != null && !jsonObj.get("errorData").isJsonNull()) + && !jsonObj.get("errorData").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `errorData` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("errorData").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SettleB402PaymentV1Response2.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SettleB402PaymentV1Response2' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(SettleB402PaymentV1Response2.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, SettleB402PaymentV1Response2 value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SettleB402PaymentV1Response2 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of SettleB402PaymentV1Response2 given an JSON string + * + * @param jsonString JSON string + * @return An instance of SettleB402PaymentV1Response2 + * @throws IOException if the JSON string is invalid with respect to + * SettleB402PaymentV1Response2 + */ + public static SettleB402PaymentV1Response2 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SettleB402PaymentV1Response2.class); + } + + /** + * Convert an instance of SettleB402PaymentV1Response2 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SettleB402PaymentV2Request.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SettleB402PaymentV2Request.java new file mode 100644 index 0000000..1a0e380 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SettleB402PaymentV2Request.java @@ -0,0 +1,220 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** SettleB402PaymentV2Request */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class SettleB402PaymentV2Request { + public static final String SERIALIZED_NAME_BODY = "body"; + + @SerializedName(SERIALIZED_NAME_BODY) + @jakarta.annotation.Nonnull + private B402SettleEnvelopeV2Body body; + + public SettleB402PaymentV2Request() {} + + public SettleB402PaymentV2Request body( + @jakarta.annotation.Nonnull B402SettleEnvelopeV2Body body) { + this.body = body; + return this; + } + + /** + * Get body + * + * @return body + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public B402SettleEnvelopeV2Body getBody() { + return body; + } + + public void setBody(@jakarta.annotation.Nonnull B402SettleEnvelopeV2Body body) { + this.body = body; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SettleB402PaymentV2Request settleB402PaymentV2Request = (SettleB402PaymentV2Request) o; + return Objects.equals(this.body, settleB402PaymentV2Request.body); + } + + @Override + public int hashCode() { + return Objects.hash(body); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SettleB402PaymentV2Request {\n"); + sb.append(" body: ").append(toIndentedString(body)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object bodyValue = getBody(); + String bodyValueAsString = ""; + bodyValueAsString = bodyValue.toString(); + sb.append("body=").append(urlEncode(bodyValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("body"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("body"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SettleB402PaymentV2Request + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SettleB402PaymentV2Request.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in SettleB402PaymentV2Request is not" + + " found in the empty JSON string", + SettleB402PaymentV2Request.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SettleB402PaymentV2Request.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `body` + B402SettleEnvelopeV2Body.validateJsonElement(jsonObj.get("body")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SettleB402PaymentV2Request.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SettleB402PaymentV2Request' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(SettleB402PaymentV2Request.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, SettleB402PaymentV2Request value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SettleB402PaymentV2Request read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of SettleB402PaymentV2Request given an JSON string + * + * @param jsonString JSON string + * @return An instance of SettleB402PaymentV2Request + * @throws IOException if the JSON string is invalid with respect to SettleB402PaymentV2Request + */ + public static SettleB402PaymentV2Request fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SettleB402PaymentV2Request.class); + } + + /** + * Convert an instance of SettleB402PaymentV2Request to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SettleB402PaymentV2Response.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SettleB402PaymentV2Response.java new file mode 100644 index 0000000..c0d5612 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SettleB402PaymentV2Response.java @@ -0,0 +1,308 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.common.AbstractOpenApiSchema; +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; +import org.hibernate.validator.constraints.*; + +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class SettleB402PaymentV2Response extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(SettleB402PaymentV2Response.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SettleB402PaymentV2Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SettleB402PaymentV2Response' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterSettleB402PaymentV2Response1 = + gson.getDelegateAdapter( + this, TypeToken.get(SettleB402PaymentV2Response1.class)); + final TypeAdapter adapterSettleB402PaymentV2Response2 = + gson.getDelegateAdapter( + this, TypeToken.get(SettleB402PaymentV2Response2.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, SettleB402PaymentV2Response value) + throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type + // `SettleB402PaymentV2Response1` + if (value.getActualInstance() instanceof SettleB402PaymentV2Response1) { + JsonElement element = + adapterSettleB402PaymentV2Response1.toJsonTree( + (SettleB402PaymentV2Response1) + value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type + // `SettleB402PaymentV2Response2` + if (value.getActualInstance() instanceof SettleB402PaymentV2Response2) { + JsonElement element = + adapterSettleB402PaymentV2Response2.toJsonTree( + (SettleB402PaymentV2Response2) + value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException( + "Failed to serialize as the type doesn't match oneOf schemas:" + + " SettleB402PaymentV2Response1," + + " SettleB402PaymentV2Response2"); + } + + @Override + public SettleB402PaymentV2Response read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize SettleB402PaymentV2Response1 + try { + // validate the JSON object to see if any exception is thrown + SettleB402PaymentV2Response1.validateJsonElement(jsonElement); + actualAdapter = adapterSettleB402PaymentV2Response1; + match++; + log.log( + Level.FINER, + "Input data matches schema 'SettleB402PaymentV2Response1'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add( + String.format( + "Deserialization for SettleB402PaymentV2Response1" + + " failed with `%s`.", + e.getMessage())); + log.log( + Level.FINER, + "Input data does not match schema" + + " 'SettleB402PaymentV2Response1'", + e); + } + // deserialize SettleB402PaymentV2Response2 + try { + // validate the JSON object to see if any exception is thrown + SettleB402PaymentV2Response2.validateJsonElement(jsonElement); + actualAdapter = adapterSettleB402PaymentV2Response2; + match++; + log.log( + Level.FINER, + "Input data matches schema 'SettleB402PaymentV2Response2'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add( + String.format( + "Deserialization for SettleB402PaymentV2Response2" + + " failed with `%s`.", + e.getMessage())); + log.log( + Level.FINER, + "Input data does not match schema" + + " 'SettleB402PaymentV2Response2'", + e); + } + + if (match == 1) { + SettleB402PaymentV2Response ret = new SettleB402PaymentV2Response(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException( + String.format( + "Failed deserialization for" + + " SettleB402PaymentV2Response: %d classes match" + + " result, expected 1. Detailed failure message" + + " for oneOf schemas: %s. JSON: %s", + match, errorMessages, jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap>(); + + public SettleB402PaymentV2Response() { + super("oneOf", Boolean.FALSE); + } + + public SettleB402PaymentV2Response(Object o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("SettleB402PaymentV2Response1", SettleB402PaymentV2Response1.class); + schemas.put("SettleB402PaymentV2Response2", SettleB402PaymentV2Response2.class); + } + + @Override + public Map> getSchemas() { + return SettleB402PaymentV2Response.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: SettleB402PaymentV2Response1, SettleB402PaymentV2Response2 + * + *

It could be an instance of the 'oneOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof SettleB402PaymentV2Response1) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof SettleB402PaymentV2Response2) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException( + "Invalid instance type. Must be SettleB402PaymentV2Response1," + + " SettleB402PaymentV2Response2"); + } + + /** + * Get the actual instance, which can be the following: SettleB402PaymentV2Response1, + * SettleB402PaymentV2Response2 + * + * @return The actual instance (SettleB402PaymentV2Response1, SettleB402PaymentV2Response2) + */ + @SuppressWarnings("unchecked") + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `SettleB402PaymentV2Response1`. If the actual instance is not + * `SettleB402PaymentV2Response1`, the ClassCastException will be thrown. + * + * @return The actual instance of `SettleB402PaymentV2Response1` + * @throws ClassCastException if the instance is not `SettleB402PaymentV2Response1` + */ + public SettleB402PaymentV2Response1 getSettleB402PaymentV2Response1() + throws ClassCastException { + return (SettleB402PaymentV2Response1) super.getActualInstance(); + } + + /** + * Get the actual instance of `SettleB402PaymentV2Response2`. If the actual instance is not + * `SettleB402PaymentV2Response2`, the ClassCastException will be thrown. + * + * @return The actual instance of `SettleB402PaymentV2Response2` + * @throws ClassCastException if the instance is not `SettleB402PaymentV2Response2` + */ + public SettleB402PaymentV2Response2 getSettleB402PaymentV2Response2() + throws ClassCastException { + return (SettleB402PaymentV2Response2) super.getActualInstance(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * SettleB402PaymentV2Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate oneOf schemas one by one + int validCount = 0; + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with SettleB402PaymentV2Response1 + try { + SettleB402PaymentV2Response1.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add( + String.format( + "Deserialization for SettleB402PaymentV2Response1 failed with `%s`.", + e.getMessage())); + // continue to the next one + } + // validate the json string with SettleB402PaymentV2Response2 + try { + SettleB402PaymentV2Response2.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add( + String.format( + "Deserialization for SettleB402PaymentV2Response2 failed with `%s`.", + e.getMessage())); + // continue to the next one + } + if (validCount != 1) { + throw new IOException( + String.format( + "The JSON string is invalid for SettleB402PaymentV2Response with oneOf" + + " schemas: SettleB402PaymentV2Response1," + + " SettleB402PaymentV2Response2. %d class(es) match the result," + + " expected 1. Detailed failure message for oneOf schemas: %s." + + " JSON: %s", + validCount, errorMessages, jsonElement.toString())); + } + } + + /** + * Create an instance of SettleB402PaymentV2Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of SettleB402PaymentV2Response + * @throws IOException if the JSON string is invalid with respect to SettleB402PaymentV2Response + */ + public static SettleB402PaymentV2Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SettleB402PaymentV2Response.class); + } + + /** + * Convert an instance of SettleB402PaymentV2Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SettleB402PaymentV2Response1.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SettleB402PaymentV2Response1.java new file mode 100644 index 0000000..759ef71 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SettleB402PaymentV2Response1.java @@ -0,0 +1,456 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** SettleB402PaymentV2Response1 */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class SettleB402PaymentV2Response1 { + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + @jakarta.annotation.Nullable + private String status; + + public static final String SERIALIZED_NAME_TYPE = "type"; + + @SerializedName(SERIALIZED_NAME_TYPE) + @jakarta.annotation.Nullable + private String type; + + public static final String SERIALIZED_NAME_CODE = "code"; + + @SerializedName(SERIALIZED_NAME_CODE) + @jakarta.annotation.Nullable + private String code; + + public static final String SERIALIZED_NAME_ERROR_DATA = "errorData"; + + @SerializedName(SERIALIZED_NAME_ERROR_DATA) + @jakarta.annotation.Nullable + private String errorData; + + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + @jakarta.annotation.Nullable + private SettleB402PaymentV2Response1Data data; + + public static final String SERIALIZED_NAME_SUB_DATA = "subData"; + + @SerializedName(SERIALIZED_NAME_SUB_DATA) + @jakarta.annotation.Nullable + private Object subData; + + public static final String SERIALIZED_NAME_PARAMS = "params"; + + @SerializedName(SERIALIZED_NAME_PARAMS) + @jakarta.annotation.Nullable + private Object params; + + public SettleB402PaymentV2Response1() {} + + public SettleB402PaymentV2Response1 status(@jakarta.annotation.Nullable String status) { + this.status = status; + return this; + } + + /** + * Get status + * + * @return status + */ + @jakarta.annotation.Nullable + public String getStatus() { + return status; + } + + public void setStatus(@jakarta.annotation.Nullable String status) { + this.status = status; + } + + public SettleB402PaymentV2Response1 type(@jakarta.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * + * @return type + */ + @jakarta.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@jakarta.annotation.Nullable String type) { + this.type = type; + } + + public SettleB402PaymentV2Response1 code(@jakarta.annotation.Nullable String code) { + this.code = code; + return this; + } + + /** + * Get code + * + * @return code + */ + @jakarta.annotation.Nullable + public String getCode() { + return code; + } + + public void setCode(@jakarta.annotation.Nullable String code) { + this.code = code; + } + + public SettleB402PaymentV2Response1 errorData(@jakarta.annotation.Nullable String errorData) { + this.errorData = errorData; + return this; + } + + /** + * Get errorData + * + * @return errorData + */ + @jakarta.annotation.Nullable + public String getErrorData() { + return errorData; + } + + public void setErrorData(@jakarta.annotation.Nullable String errorData) { + this.errorData = errorData; + } + + public SettleB402PaymentV2Response1 data( + @jakarta.annotation.Nullable SettleB402PaymentV2Response1Data data) { + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @jakarta.annotation.Nullable + @Valid + public SettleB402PaymentV2Response1Data getData() { + return data; + } + + public void setData(@jakarta.annotation.Nullable SettleB402PaymentV2Response1Data data) { + this.data = data; + } + + public SettleB402PaymentV2Response1 subData(@jakarta.annotation.Nullable Object subData) { + this.subData = subData; + return this; + } + + /** + * Get subData + * + * @return subData + */ + @jakarta.annotation.Nullable + public Object getSubData() { + return subData; + } + + public void setSubData(@jakarta.annotation.Nullable Object subData) { + this.subData = subData; + } + + public SettleB402PaymentV2Response1 params(@jakarta.annotation.Nullable Object params) { + this.params = params; + return this; + } + + /** + * Get params + * + * @return params + */ + @jakarta.annotation.Nullable + public Object getParams() { + return params; + } + + public void setParams(@jakarta.annotation.Nullable Object params) { + this.params = params; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SettleB402PaymentV2Response1 settleB402PaymentV2Response1 = + (SettleB402PaymentV2Response1) o; + return Objects.equals(this.status, settleB402PaymentV2Response1.status) + && Objects.equals(this.type, settleB402PaymentV2Response1.type) + && Objects.equals(this.code, settleB402PaymentV2Response1.code) + && Objects.equals(this.errorData, settleB402PaymentV2Response1.errorData) + && Objects.equals(this.data, settleB402PaymentV2Response1.data) + && Objects.equals(this.subData, settleB402PaymentV2Response1.subData) + && Objects.equals(this.params, settleB402PaymentV2Response1.params); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(status, type, code, errorData, data, subData, params); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SettleB402PaymentV2Response1 {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" errorData: ").append(toIndentedString(errorData)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" subData: ").append(toIndentedString(subData)).append("\n"); + sb.append(" params: ").append(toIndentedString(params)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object statusValue = getStatus(); + String statusValueAsString = ""; + statusValueAsString = statusValue.toString(); + sb.append("status=").append(urlEncode(statusValueAsString)).append(""); + Object typeValue = getType(); + String typeValueAsString = ""; + typeValueAsString = typeValue.toString(); + sb.append("type=").append(urlEncode(typeValueAsString)).append(""); + Object codeValue = getCode(); + String codeValueAsString = ""; + codeValueAsString = codeValue.toString(); + sb.append("code=").append(urlEncode(codeValueAsString)).append(""); + Object errorDataValue = getErrorData(); + String errorDataValueAsString = ""; + errorDataValueAsString = errorDataValue.toString(); + sb.append("errorData=").append(urlEncode(errorDataValueAsString)).append(""); + Object dataValue = getData(); + String dataValueAsString = ""; + dataValueAsString = dataValue.toString(); + sb.append("data=").append(urlEncode(dataValueAsString)).append(""); + Object subDataValue = getSubData(); + String subDataValueAsString = ""; + subDataValueAsString = subDataValue.toString(); + sb.append("subData=").append(urlEncode(subDataValueAsString)).append(""); + Object paramsValue = getParams(); + String paramsValueAsString = ""; + paramsValueAsString = paramsValue.toString(); + sb.append("params=").append(urlEncode(paramsValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("status"); + openapiFields.add("type"); + openapiFields.add("code"); + openapiFields.add("errorData"); + openapiFields.add("data"); + openapiFields.add("subData"); + openapiFields.add("params"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * SettleB402PaymentV2Response1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SettleB402PaymentV2Response1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in SettleB402PaymentV2Response1 is not" + + " found in the empty JSON string", + SettleB402PaymentV2Response1.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) + && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `status` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("status").toString())); + } + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) + && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `type` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("type").toString())); + } + if ((jsonObj.get("code") != null && !jsonObj.get("code").isJsonNull()) + && !jsonObj.get("code").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `code` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("code").toString())); + } + if ((jsonObj.get("errorData") != null && !jsonObj.get("errorData").isJsonNull()) + && !jsonObj.get("errorData").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `errorData` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("errorData").toString())); + } + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + SettleB402PaymentV2Response1Data.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SettleB402PaymentV2Response1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SettleB402PaymentV2Response1' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(SettleB402PaymentV2Response1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, SettleB402PaymentV2Response1 value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SettleB402PaymentV2Response1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of SettleB402PaymentV2Response1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of SettleB402PaymentV2Response1 + * @throws IOException if the JSON string is invalid with respect to + * SettleB402PaymentV2Response1 + */ + public static SettleB402PaymentV2Response1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SettleB402PaymentV2Response1.class); + } + + /** + * Convert an instance of SettleB402PaymentV2Response1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SettleB402PaymentV2Response1Data.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SettleB402PaymentV2Response1Data.java new file mode 100644 index 0000000..b04d931 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SettleB402PaymentV2Response1Data.java @@ -0,0 +1,534 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** SettleB402PaymentV2Response1Data */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class SettleB402PaymentV2Response1Data { + public static final String SERIALIZED_NAME_SUCCESS = "success"; + + @SerializedName(SERIALIZED_NAME_SUCCESS) + @jakarta.annotation.Nonnull + private Boolean success; + + public static final String SERIALIZED_NAME_TRANSACTION = "transaction"; + + @SerializedName(SERIALIZED_NAME_TRANSACTION) + @jakarta.annotation.Nonnull + private String transaction; + + public static final String SERIALIZED_NAME_PAYER = "payer"; + + @SerializedName(SERIALIZED_NAME_PAYER) + @jakarta.annotation.Nullable + private String payer; + + public static final String SERIALIZED_NAME_NETWORK = "network"; + + @SerializedName(SERIALIZED_NAME_NETWORK) + @jakarta.annotation.Nonnull + private String network; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + + @SerializedName(SERIALIZED_NAME_AMOUNT) + @jakarta.annotation.Nullable + private String amount; + + public static final String SERIALIZED_NAME_ERROR_REASON = "errorReason"; + + @SerializedName(SERIALIZED_NAME_ERROR_REASON) + @jakarta.annotation.Nullable + private String errorReason; + + public static final String SERIALIZED_NAME_ERROR_MESSAGE = "errorMessage"; + + @SerializedName(SERIALIZED_NAME_ERROR_MESSAGE) + @jakarta.annotation.Nullable + private String errorMessage; + + public static final String SERIALIZED_NAME_EXTENSIONS = "extensions"; + + @SerializedName(SERIALIZED_NAME_EXTENSIONS) + @jakarta.annotation.Nullable + private Map extensions; + + public SettleB402PaymentV2Response1Data() {} + + public SettleB402PaymentV2Response1Data success(@jakarta.annotation.Nonnull Boolean success) { + this.success = success; + return this; + } + + /** + * Get success + * + * @return success + */ + @jakarta.annotation.Nonnull + @NotNull + public Boolean getSuccess() { + return success; + } + + public void setSuccess(@jakarta.annotation.Nonnull Boolean success) { + this.success = success; + } + + public SettleB402PaymentV2Response1Data transaction( + @jakarta.annotation.Nonnull String transaction) { + this.transaction = transaction; + return this; + } + + /** + * Get transaction + * + * @return transaction + */ + @jakarta.annotation.Nonnull + @NotNull + public String getTransaction() { + return transaction; + } + + public void setTransaction(@jakarta.annotation.Nonnull String transaction) { + this.transaction = transaction; + } + + public SettleB402PaymentV2Response1Data payer(@jakarta.annotation.Nullable String payer) { + this.payer = payer; + return this; + } + + /** + * Get payer + * + * @return payer + */ + @jakarta.annotation.Nullable + public String getPayer() { + return payer; + } + + public void setPayer(@jakarta.annotation.Nullable String payer) { + this.payer = payer; + } + + public SettleB402PaymentV2Response1Data network(@jakarta.annotation.Nonnull String network) { + this.network = network; + return this; + } + + /** + * Get network + * + * @return network + */ + @jakarta.annotation.Nonnull + @NotNull + public String getNetwork() { + return network; + } + + public void setNetwork(@jakarta.annotation.Nonnull String network) { + this.network = network; + } + + public SettleB402PaymentV2Response1Data amount(@jakarta.annotation.Nullable String amount) { + this.amount = amount; + return this; + } + + /** + * Get amount + * + * @return amount + */ + @jakarta.annotation.Nullable + public String getAmount() { + return amount; + } + + public void setAmount(@jakarta.annotation.Nullable String amount) { + this.amount = amount; + } + + public SettleB402PaymentV2Response1Data errorReason( + @jakarta.annotation.Nullable String errorReason) { + this.errorReason = errorReason; + return this; + } + + /** + * Get errorReason + * + * @return errorReason + */ + @jakarta.annotation.Nullable + public String getErrorReason() { + return errorReason; + } + + public void setErrorReason(@jakarta.annotation.Nullable String errorReason) { + this.errorReason = errorReason; + } + + public SettleB402PaymentV2Response1Data errorMessage( + @jakarta.annotation.Nullable String errorMessage) { + this.errorMessage = errorMessage; + return this; + } + + /** + * Get errorMessage + * + * @return errorMessage + */ + @jakarta.annotation.Nullable + public String getErrorMessage() { + return errorMessage; + } + + public void setErrorMessage(@jakarta.annotation.Nullable String errorMessage) { + this.errorMessage = errorMessage; + } + + public SettleB402PaymentV2Response1Data extensions( + @jakarta.annotation.Nullable Map extensions) { + this.extensions = extensions; + return this; + } + + public SettleB402PaymentV2Response1Data putExtensionsItem(String key, Object extensionsItem) { + if (this.extensions == null) { + this.extensions = new HashMap<>(); + } + this.extensions.put(key, extensionsItem); + return this; + } + + /** + * Get extensions + * + * @return extensions + */ + @jakarta.annotation.Nullable + public Map getExtensions() { + return extensions; + } + + public void setExtensions(@jakarta.annotation.Nullable Map extensions) { + this.extensions = extensions; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SettleB402PaymentV2Response1Data settleB402PaymentV2Response1Data = + (SettleB402PaymentV2Response1Data) o; + return Objects.equals(this.success, settleB402PaymentV2Response1Data.success) + && Objects.equals(this.transaction, settleB402PaymentV2Response1Data.transaction) + && Objects.equals(this.payer, settleB402PaymentV2Response1Data.payer) + && Objects.equals(this.network, settleB402PaymentV2Response1Data.network) + && Objects.equals(this.amount, settleB402PaymentV2Response1Data.amount) + && Objects.equals(this.errorReason, settleB402PaymentV2Response1Data.errorReason) + && Objects.equals(this.errorMessage, settleB402PaymentV2Response1Data.errorMessage) + && Objects.equals(this.extensions, settleB402PaymentV2Response1Data.extensions); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash( + success, + transaction, + payer, + network, + amount, + errorReason, + errorMessage, + extensions); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SettleB402PaymentV2Response1Data {\n"); + sb.append(" success: ").append(toIndentedString(success)).append("\n"); + sb.append(" transaction: ").append(toIndentedString(transaction)).append("\n"); + sb.append(" payer: ").append(toIndentedString(payer)).append("\n"); + sb.append(" network: ").append(toIndentedString(network)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" errorReason: ").append(toIndentedString(errorReason)).append("\n"); + sb.append(" errorMessage: ").append(toIndentedString(errorMessage)).append("\n"); + sb.append(" extensions: ").append(toIndentedString(extensions)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object successValue = getSuccess(); + String successValueAsString = ""; + successValueAsString = successValue.toString(); + sb.append("success=").append(urlEncode(successValueAsString)).append(""); + Object transactionValue = getTransaction(); + String transactionValueAsString = ""; + transactionValueAsString = transactionValue.toString(); + sb.append("transaction=").append(urlEncode(transactionValueAsString)).append(""); + Object payerValue = getPayer(); + String payerValueAsString = ""; + payerValueAsString = payerValue.toString(); + sb.append("payer=").append(urlEncode(payerValueAsString)).append(""); + Object networkValue = getNetwork(); + String networkValueAsString = ""; + networkValueAsString = networkValue.toString(); + sb.append("network=").append(urlEncode(networkValueAsString)).append(""); + Object amountValue = getAmount(); + String amountValueAsString = ""; + amountValueAsString = amountValue.toString(); + sb.append("amount=").append(urlEncode(amountValueAsString)).append(""); + Object errorReasonValue = getErrorReason(); + String errorReasonValueAsString = ""; + errorReasonValueAsString = errorReasonValue.toString(); + sb.append("errorReason=").append(urlEncode(errorReasonValueAsString)).append(""); + Object errorMessageValue = getErrorMessage(); + String errorMessageValueAsString = ""; + errorMessageValueAsString = errorMessageValue.toString(); + sb.append("errorMessage=").append(urlEncode(errorMessageValueAsString)).append(""); + Object extensionsValue = getExtensions(); + String extensionsValueAsString = ""; + extensionsValueAsString = extensionsValue.toString(); + sb.append("extensions=").append(urlEncode(extensionsValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("success"); + openapiFields.add("transaction"); + openapiFields.add("payer"); + openapiFields.add("network"); + openapiFields.add("amount"); + openapiFields.add("errorReason"); + openapiFields.add("errorMessage"); + openapiFields.add("extensions"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("success"); + openapiRequiredFields.add("transaction"); + openapiRequiredFields.add("network"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * SettleB402PaymentV2Response1Data + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SettleB402PaymentV2Response1Data.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in SettleB402PaymentV2Response1Data is" + + " not found in the empty JSON string", + SettleB402PaymentV2Response1Data.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SettleB402PaymentV2Response1Data.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("transaction").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `transaction` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("transaction").toString())); + } + if ((jsonObj.get("payer") != null && !jsonObj.get("payer").isJsonNull()) + && !jsonObj.get("payer").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `payer` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("payer").toString())); + } + if (!jsonObj.get("network").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `network` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("network").toString())); + } + if ((jsonObj.get("amount") != null && !jsonObj.get("amount").isJsonNull()) + && !jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `amount` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("amount").toString())); + } + if ((jsonObj.get("errorReason") != null && !jsonObj.get("errorReason").isJsonNull()) + && !jsonObj.get("errorReason").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `errorReason` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("errorReason").toString())); + } + if ((jsonObj.get("errorMessage") != null && !jsonObj.get("errorMessage").isJsonNull()) + && !jsonObj.get("errorMessage").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `errorMessage` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("errorMessage").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SettleB402PaymentV2Response1Data.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SettleB402PaymentV2Response1Data' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(SettleB402PaymentV2Response1Data.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, SettleB402PaymentV2Response1Data value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SettleB402PaymentV2Response1Data read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of SettleB402PaymentV2Response1Data given an JSON string + * + * @param jsonString JSON string + * @return An instance of SettleB402PaymentV2Response1Data + * @throws IOException if the JSON string is invalid with respect to + * SettleB402PaymentV2Response1Data + */ + public static SettleB402PaymentV2Response1Data fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SettleB402PaymentV2Response1Data.class); + } + + /** + * Convert an instance of SettleB402PaymentV2Response1Data to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SettleB402PaymentV2Response2.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SettleB402PaymentV2Response2.java new file mode 100644 index 0000000..4b88b87 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SettleB402PaymentV2Response2.java @@ -0,0 +1,449 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** SettleB402PaymentV2Response2 */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class SettleB402PaymentV2Response2 { + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + @jakarta.annotation.Nullable + private String status; + + public static final String SERIALIZED_NAME_TYPE = "type"; + + @SerializedName(SERIALIZED_NAME_TYPE) + @jakarta.annotation.Nullable + private String type; + + public static final String SERIALIZED_NAME_CODE = "code"; + + @SerializedName(SERIALIZED_NAME_CODE) + @jakarta.annotation.Nullable + private String code; + + public static final String SERIALIZED_NAME_ERROR_DATA = "errorData"; + + @SerializedName(SERIALIZED_NAME_ERROR_DATA) + @jakarta.annotation.Nullable + private String errorData; + + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + @jakarta.annotation.Nullable + private Object data; + + public static final String SERIALIZED_NAME_SUB_DATA = "subData"; + + @SerializedName(SERIALIZED_NAME_SUB_DATA) + @jakarta.annotation.Nullable + private Object subData; + + public static final String SERIALIZED_NAME_PARAMS = "params"; + + @SerializedName(SERIALIZED_NAME_PARAMS) + @jakarta.annotation.Nullable + private Object params; + + public SettleB402PaymentV2Response2() {} + + public SettleB402PaymentV2Response2 status(@jakarta.annotation.Nullable String status) { + this.status = status; + return this; + } + + /** + * Get status + * + * @return status + */ + @jakarta.annotation.Nullable + public String getStatus() { + return status; + } + + public void setStatus(@jakarta.annotation.Nullable String status) { + this.status = status; + } + + public SettleB402PaymentV2Response2 type(@jakarta.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * + * @return type + */ + @jakarta.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@jakarta.annotation.Nullable String type) { + this.type = type; + } + + public SettleB402PaymentV2Response2 code(@jakarta.annotation.Nullable String code) { + this.code = code; + return this; + } + + /** + * Get code + * + * @return code + */ + @jakarta.annotation.Nullable + public String getCode() { + return code; + } + + public void setCode(@jakarta.annotation.Nullable String code) { + this.code = code; + } + + public SettleB402PaymentV2Response2 errorData(@jakarta.annotation.Nullable String errorData) { + this.errorData = errorData; + return this; + } + + /** + * Get errorData + * + * @return errorData + */ + @jakarta.annotation.Nullable + public String getErrorData() { + return errorData; + } + + public void setErrorData(@jakarta.annotation.Nullable String errorData) { + this.errorData = errorData; + } + + public SettleB402PaymentV2Response2 data(@jakarta.annotation.Nullable Object data) { + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @jakarta.annotation.Nullable + public Object getData() { + return data; + } + + public void setData(@jakarta.annotation.Nullable Object data) { + this.data = data; + } + + public SettleB402PaymentV2Response2 subData(@jakarta.annotation.Nullable Object subData) { + this.subData = subData; + return this; + } + + /** + * Get subData + * + * @return subData + */ + @jakarta.annotation.Nullable + public Object getSubData() { + return subData; + } + + public void setSubData(@jakarta.annotation.Nullable Object subData) { + this.subData = subData; + } + + public SettleB402PaymentV2Response2 params(@jakarta.annotation.Nullable Object params) { + this.params = params; + return this; + } + + /** + * Get params + * + * @return params + */ + @jakarta.annotation.Nullable + public Object getParams() { + return params; + } + + public void setParams(@jakarta.annotation.Nullable Object params) { + this.params = params; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SettleB402PaymentV2Response2 settleB402PaymentV2Response2 = + (SettleB402PaymentV2Response2) o; + return Objects.equals(this.status, settleB402PaymentV2Response2.status) + && Objects.equals(this.type, settleB402PaymentV2Response2.type) + && Objects.equals(this.code, settleB402PaymentV2Response2.code) + && Objects.equals(this.errorData, settleB402PaymentV2Response2.errorData) + && Objects.equals(this.data, settleB402PaymentV2Response2.data) + && Objects.equals(this.subData, settleB402PaymentV2Response2.subData) + && Objects.equals(this.params, settleB402PaymentV2Response2.params); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(status, type, code, errorData, data, subData, params); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SettleB402PaymentV2Response2 {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" errorData: ").append(toIndentedString(errorData)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" subData: ").append(toIndentedString(subData)).append("\n"); + sb.append(" params: ").append(toIndentedString(params)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object statusValue = getStatus(); + String statusValueAsString = ""; + statusValueAsString = statusValue.toString(); + sb.append("status=").append(urlEncode(statusValueAsString)).append(""); + Object typeValue = getType(); + String typeValueAsString = ""; + typeValueAsString = typeValue.toString(); + sb.append("type=").append(urlEncode(typeValueAsString)).append(""); + Object codeValue = getCode(); + String codeValueAsString = ""; + codeValueAsString = codeValue.toString(); + sb.append("code=").append(urlEncode(codeValueAsString)).append(""); + Object errorDataValue = getErrorData(); + String errorDataValueAsString = ""; + errorDataValueAsString = errorDataValue.toString(); + sb.append("errorData=").append(urlEncode(errorDataValueAsString)).append(""); + Object dataValue = getData(); + String dataValueAsString = ""; + dataValueAsString = dataValue.toString(); + sb.append("data=").append(urlEncode(dataValueAsString)).append(""); + Object subDataValue = getSubData(); + String subDataValueAsString = ""; + subDataValueAsString = subDataValue.toString(); + sb.append("subData=").append(urlEncode(subDataValueAsString)).append(""); + Object paramsValue = getParams(); + String paramsValueAsString = ""; + paramsValueAsString = paramsValue.toString(); + sb.append("params=").append(urlEncode(paramsValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("status"); + openapiFields.add("type"); + openapiFields.add("code"); + openapiFields.add("errorData"); + openapiFields.add("data"); + openapiFields.add("subData"); + openapiFields.add("params"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * SettleB402PaymentV2Response2 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SettleB402PaymentV2Response2.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in SettleB402PaymentV2Response2 is not" + + " found in the empty JSON string", + SettleB402PaymentV2Response2.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) + && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `status` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("status").toString())); + } + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) + && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `type` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("type").toString())); + } + if ((jsonObj.get("code") != null && !jsonObj.get("code").isJsonNull()) + && !jsonObj.get("code").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `code` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("code").toString())); + } + if ((jsonObj.get("errorData") != null && !jsonObj.get("errorData").isJsonNull()) + && !jsonObj.get("errorData").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `errorData` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("errorData").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SettleB402PaymentV2Response2.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SettleB402PaymentV2Response2' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(SettleB402PaymentV2Response2.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, SettleB402PaymentV2Response2 value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SettleB402PaymentV2Response2 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of SettleB402PaymentV2Response2 given an JSON string + * + * @param jsonString JSON string + * @return An instance of SettleB402PaymentV2Response2 + * @throws IOException if the JSON string is invalid with respect to + * SettleB402PaymentV2Response2 + */ + public static SettleB402PaymentV2Response2 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SettleB402PaymentV2Response2.class); + } + + /** + * Convert an instance of SettleB402PaymentV2Response2 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SimulateTransactionsRequest.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SimulateTransactionsRequest.java index 4745e5b..8ea3e09 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SimulateTransactionsRequest.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SimulateTransactionsRequest.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SimulateTransactionsRequestEvmTx.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SimulateTransactionsRequestEvmTx.java index 4f5b380..17d9f5f 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SimulateTransactionsRequestEvmTx.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SimulateTransactionsRequestEvmTx.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SimulateTransactionsRequestSolTx.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SimulateTransactionsRequestSolTx.java index 2dd14a6..ab2f635 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SimulateTransactionsRequestSolTx.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SimulateTransactionsRequestSolTx.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SimulateTransactionsRequestTronTx.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SimulateTransactionsRequestTronTx.java index 425221b..475a89e 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SimulateTransactionsRequestTronTx.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SimulateTransactionsRequestTronTx.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SimulateTransactionsResponse.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SimulateTransactionsResponse.java index 13881f1..86867cb 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SimulateTransactionsResponse.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SimulateTransactionsResponse.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SimulateTransactionsResponseData.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SimulateTransactionsResponseData.java index 41d8905..4e9d2f2 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SimulateTransactionsResponseData.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SimulateTransactionsResponseData.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SimulateTransactionsResponseDataAllowanceChangesInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SimulateTransactionsResponseDataAllowanceChangesInner.java index 65f3fc8..3c95a5a 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SimulateTransactionsResponseDataAllowanceChangesInner.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SimulateTransactionsResponseDataAllowanceChangesInner.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SimulateTransactionsResponseDataBalanceChangesInner.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SimulateTransactionsResponseDataBalanceChangesInner.java index 538a66e..cfa4c85 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SimulateTransactionsResponseDataBalanceChangesInner.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SimulateTransactionsResponseDataBalanceChangesInner.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SortBy.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SortBy.java index 5f65663..dc77dae 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SortBy.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SortBy.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SubmitRfqOrderRequest.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SubmitRfqOrderRequest.java index b96430a..3bdd7e6 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SubmitRfqOrderRequest.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SubmitRfqOrderRequest.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SubmitRfqOrderResponse.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SubmitRfqOrderResponse.java index 0590739..a99719b 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SubmitRfqOrderResponse.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SubmitRfqOrderResponse.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SubmitRfqOrderResponseData.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SubmitRfqOrderResponseData.java index 3b0bdb5..fb7426f 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SubmitRfqOrderResponseData.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/SubmitRfqOrderResponseData.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/TagFilter.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/TagFilter.java index 4171f65..63ccfc7 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/TagFilter.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/TagFilter.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/TagInfo.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/TagInfo.java index 895a81c..967d4ee 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/TagInfo.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/TagInfo.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/TimeFrame.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/TimeFrame.java index 0263be3..4e70360 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/TimeFrame.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/TimeFrame.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/TokenBasicInfo.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/TokenBasicInfo.java index 00a8470..4af248d 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/TokenBasicInfo.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/TokenBasicInfo.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/TokenResp.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/TokenResp.java new file mode 100644 index 0000000..3b71bdc --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/TokenResp.java @@ -0,0 +1,457 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** Token balance information within a position. */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class TokenResp { + public static final String SERIALIZED_NAME_TOKEN_ADDRESS = "tokenAddress"; + + @SerializedName(SERIALIZED_NAME_TOKEN_ADDRESS) + @jakarta.annotation.Nullable + private String tokenAddress; + + public static final String SERIALIZED_NAME_TOKEN_NAME = "tokenName"; + + @SerializedName(SERIALIZED_NAME_TOKEN_NAME) + @jakarta.annotation.Nullable + private String tokenName; + + public static final String SERIALIZED_NAME_TOKEN_SYMBOL = "tokenSymbol"; + + @SerializedName(SERIALIZED_NAME_TOKEN_SYMBOL) + @jakarta.annotation.Nullable + private String tokenSymbol; + + public static final String SERIALIZED_NAME_TOKEN_AMOUNT = "tokenAmount"; + + @SerializedName(SERIALIZED_NAME_TOKEN_AMOUNT) + @jakarta.annotation.Nullable + private String tokenAmount; + + public static final String SERIALIZED_NAME_TOKEN_PRICE = "tokenPrice"; + + @SerializedName(SERIALIZED_NAME_TOKEN_PRICE) + @jakarta.annotation.Nullable + private String tokenPrice; + + public static final String SERIALIZED_NAME_TOKEN_VALUE = "tokenValue"; + + @SerializedName(SERIALIZED_NAME_TOKEN_VALUE) + @jakarta.annotation.Nullable + private String tokenValue; + + public static final String SERIALIZED_NAME_TOKEN_DECIMALS = "tokenDecimals"; + + @SerializedName(SERIALIZED_NAME_TOKEN_DECIMALS) + @jakarta.annotation.Nullable + private String tokenDecimals; + + public TokenResp() {} + + public TokenResp tokenAddress(@jakarta.annotation.Nullable String tokenAddress) { + this.tokenAddress = tokenAddress; + return this; + } + + /** + * Token contract address. The native-asset sentinel + * `0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee` (40 `e`s) for native coins. + * + * @return tokenAddress + */ + @jakarta.annotation.Nullable + public String getTokenAddress() { + return tokenAddress; + } + + public void setTokenAddress(@jakarta.annotation.Nullable String tokenAddress) { + this.tokenAddress = tokenAddress; + } + + public TokenResp tokenName(@jakarta.annotation.Nullable String tokenName) { + this.tokenName = tokenName; + return this; + } + + /** + * Token name. + * + * @return tokenName + */ + @jakarta.annotation.Nullable + public String getTokenName() { + return tokenName; + } + + public void setTokenName(@jakarta.annotation.Nullable String tokenName) { + this.tokenName = tokenName; + } + + public TokenResp tokenSymbol(@jakarta.annotation.Nullable String tokenSymbol) { + this.tokenSymbol = tokenSymbol; + return this; + } + + /** + * Token symbol. + * + * @return tokenSymbol + */ + @jakarta.annotation.Nullable + public String getTokenSymbol() { + return tokenSymbol; + } + + public void setTokenSymbol(@jakarta.annotation.Nullable String tokenSymbol) { + this.tokenSymbol = tokenSymbol; + } + + public TokenResp tokenAmount(@jakarta.annotation.Nullable String tokenAmount) { + this.tokenAmount = tokenAmount; + return this; + } + + /** + * Human-readable token amount (NOT the smallest unit). + * + * @return tokenAmount + */ + @jakarta.annotation.Nullable + public String getTokenAmount() { + return tokenAmount; + } + + public void setTokenAmount(@jakarta.annotation.Nullable String tokenAmount) { + this.tokenAmount = tokenAmount; + } + + public TokenResp tokenPrice(@jakarta.annotation.Nullable String tokenPrice) { + this.tokenPrice = tokenPrice; + return this; + } + + /** + * Current token price in USD. + * + * @return tokenPrice + */ + @jakarta.annotation.Nullable + public String getTokenPrice() { + return tokenPrice; + } + + public void setTokenPrice(@jakarta.annotation.Nullable String tokenPrice) { + this.tokenPrice = tokenPrice; + } + + public TokenResp tokenValue(@jakarta.annotation.Nullable String tokenValue) { + this.tokenValue = tokenValue; + return this; + } + + /** + * Token value in USD (amount × price). + * + * @return tokenValue + */ + @jakarta.annotation.Nullable + public String getTokenValue() { + return tokenValue; + } + + public void setTokenValue(@jakarta.annotation.Nullable String tokenValue) { + this.tokenValue = tokenValue; + } + + public TokenResp tokenDecimals(@jakarta.annotation.Nullable String tokenDecimals) { + this.tokenDecimals = tokenDecimals; + return this; + } + + /** + * Token decimals (string). + * + * @return tokenDecimals + */ + @jakarta.annotation.Nullable + public String getTokenDecimals() { + return tokenDecimals; + } + + public void setTokenDecimals(@jakarta.annotation.Nullable String tokenDecimals) { + this.tokenDecimals = tokenDecimals; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TokenResp tokenResp = (TokenResp) o; + return Objects.equals(this.tokenAddress, tokenResp.tokenAddress) + && Objects.equals(this.tokenName, tokenResp.tokenName) + && Objects.equals(this.tokenSymbol, tokenResp.tokenSymbol) + && Objects.equals(this.tokenAmount, tokenResp.tokenAmount) + && Objects.equals(this.tokenPrice, tokenResp.tokenPrice) + && Objects.equals(this.tokenValue, tokenResp.tokenValue) + && Objects.equals(this.tokenDecimals, tokenResp.tokenDecimals); + } + + @Override + public int hashCode() { + return Objects.hash( + tokenAddress, + tokenName, + tokenSymbol, + tokenAmount, + tokenPrice, + tokenValue, + tokenDecimals); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TokenResp {\n"); + sb.append(" tokenAddress: ").append(toIndentedString(tokenAddress)).append("\n"); + sb.append(" tokenName: ").append(toIndentedString(tokenName)).append("\n"); + sb.append(" tokenSymbol: ").append(toIndentedString(tokenSymbol)).append("\n"); + sb.append(" tokenAmount: ").append(toIndentedString(tokenAmount)).append("\n"); + sb.append(" tokenPrice: ").append(toIndentedString(tokenPrice)).append("\n"); + sb.append(" tokenValue: ").append(toIndentedString(tokenValue)).append("\n"); + sb.append(" tokenDecimals: ").append(toIndentedString(tokenDecimals)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object tokenAddressValue = getTokenAddress(); + String tokenAddressValueAsString = ""; + tokenAddressValueAsString = tokenAddressValue.toString(); + sb.append("tokenAddress=").append(urlEncode(tokenAddressValueAsString)).append(""); + Object tokenNameValue = getTokenName(); + String tokenNameValueAsString = ""; + tokenNameValueAsString = tokenNameValue.toString(); + sb.append("tokenName=").append(urlEncode(tokenNameValueAsString)).append(""); + Object tokenSymbolValue = getTokenSymbol(); + String tokenSymbolValueAsString = ""; + tokenSymbolValueAsString = tokenSymbolValue.toString(); + sb.append("tokenSymbol=").append(urlEncode(tokenSymbolValueAsString)).append(""); + Object tokenAmountValue = getTokenAmount(); + String tokenAmountValueAsString = ""; + tokenAmountValueAsString = tokenAmountValue.toString(); + sb.append("tokenAmount=").append(urlEncode(tokenAmountValueAsString)).append(""); + Object tokenPriceValue = getTokenPrice(); + String tokenPriceValueAsString = ""; + tokenPriceValueAsString = tokenPriceValue.toString(); + sb.append("tokenPrice=").append(urlEncode(tokenPriceValueAsString)).append(""); + Object tokenValueValue = getTokenValue(); + String tokenValueValueAsString = ""; + tokenValueValueAsString = tokenValueValue.toString(); + sb.append("tokenValue=").append(urlEncode(tokenValueValueAsString)).append(""); + Object tokenDecimalsValue = getTokenDecimals(); + String tokenDecimalsValueAsString = ""; + tokenDecimalsValueAsString = tokenDecimalsValue.toString(); + sb.append("tokenDecimals=").append(urlEncode(tokenDecimalsValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("tokenAddress"); + openapiFields.add("tokenName"); + openapiFields.add("tokenSymbol"); + openapiFields.add("tokenAmount"); + openapiFields.add("tokenPrice"); + openapiFields.add("tokenValue"); + openapiFields.add("tokenDecimals"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TokenResp + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TokenResp.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in TokenResp is not found in the empty" + + " JSON string", + TokenResp.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("tokenAddress") != null && !jsonObj.get("tokenAddress").isJsonNull()) + && !jsonObj.get("tokenAddress").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `tokenAddress` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("tokenAddress").toString())); + } + if ((jsonObj.get("tokenName") != null && !jsonObj.get("tokenName").isJsonNull()) + && !jsonObj.get("tokenName").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `tokenName` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("tokenName").toString())); + } + if ((jsonObj.get("tokenSymbol") != null && !jsonObj.get("tokenSymbol").isJsonNull()) + && !jsonObj.get("tokenSymbol").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `tokenSymbol` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("tokenSymbol").toString())); + } + if ((jsonObj.get("tokenAmount") != null && !jsonObj.get("tokenAmount").isJsonNull()) + && !jsonObj.get("tokenAmount").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `tokenAmount` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("tokenAmount").toString())); + } + if ((jsonObj.get("tokenPrice") != null && !jsonObj.get("tokenPrice").isJsonNull()) + && !jsonObj.get("tokenPrice").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `tokenPrice` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("tokenPrice").toString())); + } + if ((jsonObj.get("tokenValue") != null && !jsonObj.get("tokenValue").isJsonNull()) + && !jsonObj.get("tokenValue").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `tokenValue` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("tokenValue").toString())); + } + if ((jsonObj.get("tokenDecimals") != null && !jsonObj.get("tokenDecimals").isJsonNull()) + && !jsonObj.get("tokenDecimals").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `tokenDecimals` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("tokenDecimals").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TokenResp.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TokenResp' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(TokenResp.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, TokenResp value) throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public TokenResp read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of TokenResp given an JSON string + * + * @param jsonString JSON string + * @return An instance of TokenResp + * @throws IOException if the JSON string is invalid with respect to TokenResp + */ + public static TokenResp fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TokenResp.class); + } + + /** + * Convert an instance of TokenResp to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/TokenTagInformation.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/TokenTagInformation.java index 66a22fe..2a59805 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/TokenTagInformation.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/TokenTagInformation.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/TrackerType.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/TrackerType.java index acbc5e6..fbe08d1 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/TrackerType.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/TrackerType.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/Vendor.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/Vendor.java index 947ab90..42724b7 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/Vendor.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/Vendor.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/VerifyB402PaymentV1Request.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/VerifyB402PaymentV1Request.java new file mode 100644 index 0000000..c6b93fe --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/VerifyB402PaymentV1Request.java @@ -0,0 +1,220 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** VerifyB402PaymentV1Request */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class VerifyB402PaymentV1Request { + public static final String SERIALIZED_NAME_BODY = "body"; + + @SerializedName(SERIALIZED_NAME_BODY) + @jakarta.annotation.Nonnull + private VerifyB402PaymentV1RequestBody body; + + public VerifyB402PaymentV1Request() {} + + public VerifyB402PaymentV1Request body( + @jakarta.annotation.Nonnull VerifyB402PaymentV1RequestBody body) { + this.body = body; + return this; + } + + /** + * Get body + * + * @return body + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public VerifyB402PaymentV1RequestBody getBody() { + return body; + } + + public void setBody(@jakarta.annotation.Nonnull VerifyB402PaymentV1RequestBody body) { + this.body = body; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + VerifyB402PaymentV1Request verifyB402PaymentV1Request = (VerifyB402PaymentV1Request) o; + return Objects.equals(this.body, verifyB402PaymentV1Request.body); + } + + @Override + public int hashCode() { + return Objects.hash(body); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VerifyB402PaymentV1Request {\n"); + sb.append(" body: ").append(toIndentedString(body)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object bodyValue = getBody(); + String bodyValueAsString = ""; + bodyValueAsString = bodyValue.toString(); + sb.append("body=").append(urlEncode(bodyValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("body"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("body"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to VerifyB402PaymentV1Request + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!VerifyB402PaymentV1Request.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in VerifyB402PaymentV1Request is not" + + " found in the empty JSON string", + VerifyB402PaymentV1Request.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : VerifyB402PaymentV1Request.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `body` + VerifyB402PaymentV1RequestBody.validateJsonElement(jsonObj.get("body")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!VerifyB402PaymentV1Request.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'VerifyB402PaymentV1Request' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(VerifyB402PaymentV1Request.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, VerifyB402PaymentV1Request value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public VerifyB402PaymentV1Request read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of VerifyB402PaymentV1Request given an JSON string + * + * @param jsonString JSON string + * @return An instance of VerifyB402PaymentV1Request + * @throws IOException if the JSON string is invalid with respect to VerifyB402PaymentV1Request + */ + public static VerifyB402PaymentV1Request fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, VerifyB402PaymentV1Request.class); + } + + /** + * Convert an instance of VerifyB402PaymentV1Request to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/VerifyB402PaymentV1RequestBody.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/VerifyB402PaymentV1RequestBody.java new file mode 100644 index 0000000..5d7c0be --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/VerifyB402PaymentV1RequestBody.java @@ -0,0 +1,365 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** VerifyB402PaymentV1RequestBody */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class VerifyB402PaymentV1RequestBody { + /** Gets or Sets x402Version */ + @JsonAdapter(X402VersionEnum.Adapter.class) + public enum X402VersionEnum { + X402_VERSION_1(1); + + private Integer value; + + X402VersionEnum(Integer value) { + this.value = value; + } + + public Integer getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static X402VersionEnum fromValue(Integer value) { + for (X402VersionEnum b : X402VersionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final X402VersionEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public X402VersionEnum read(final JsonReader jsonReader) throws IOException { + Integer value = jsonReader.nextInt(); + return X402VersionEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + Integer value = jsonElement.getAsInt(); + X402VersionEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_X402_VERSION = "x402Version"; + + @SerializedName(SERIALIZED_NAME_X402_VERSION) + @jakarta.annotation.Nonnull + private X402VersionEnum x402Version; + + public static final String SERIALIZED_NAME_PAYMENT_PAYLOAD = "paymentPayload"; + + @SerializedName(SERIALIZED_NAME_PAYMENT_PAYLOAD) + @jakarta.annotation.Nonnull + private VerifyB402PaymentV1RequestBodyPaymentPayload paymentPayload; + + public static final String SERIALIZED_NAME_PAYMENT_REQUIREMENTS = "paymentRequirements"; + + @SerializedName(SERIALIZED_NAME_PAYMENT_REQUIREMENTS) + @jakarta.annotation.Nonnull + private VerifyB402PaymentV1RequestBodyPaymentRequirements paymentRequirements; + + public VerifyB402PaymentV1RequestBody() {} + + public VerifyB402PaymentV1RequestBody x402Version( + @jakarta.annotation.Nonnull X402VersionEnum x402Version) { + this.x402Version = x402Version; + return this; + } + + /** + * Get x402Version + * + * @return x402Version + */ + @jakarta.annotation.Nonnull + @NotNull + public X402VersionEnum getX402Version() { + return x402Version; + } + + public void setX402Version(@jakarta.annotation.Nonnull X402VersionEnum x402Version) { + this.x402Version = x402Version; + } + + public VerifyB402PaymentV1RequestBody paymentPayload( + @jakarta.annotation.Nonnull + VerifyB402PaymentV1RequestBodyPaymentPayload paymentPayload) { + this.paymentPayload = paymentPayload; + return this; + } + + /** + * Get paymentPayload + * + * @return paymentPayload + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public VerifyB402PaymentV1RequestBodyPaymentPayload getPaymentPayload() { + return paymentPayload; + } + + public void setPaymentPayload( + @jakarta.annotation.Nonnull + VerifyB402PaymentV1RequestBodyPaymentPayload paymentPayload) { + this.paymentPayload = paymentPayload; + } + + public VerifyB402PaymentV1RequestBody paymentRequirements( + @jakarta.annotation.Nonnull + VerifyB402PaymentV1RequestBodyPaymentRequirements paymentRequirements) { + this.paymentRequirements = paymentRequirements; + return this; + } + + /** + * Get paymentRequirements + * + * @return paymentRequirements + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public VerifyB402PaymentV1RequestBodyPaymentRequirements getPaymentRequirements() { + return paymentRequirements; + } + + public void setPaymentRequirements( + @jakarta.annotation.Nonnull + VerifyB402PaymentV1RequestBodyPaymentRequirements paymentRequirements) { + this.paymentRequirements = paymentRequirements; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + VerifyB402PaymentV1RequestBody verifyB402PaymentV1RequestBody = + (VerifyB402PaymentV1RequestBody) o; + return Objects.equals(this.x402Version, verifyB402PaymentV1RequestBody.x402Version) + && Objects.equals( + this.paymentPayload, verifyB402PaymentV1RequestBody.paymentPayload) + && Objects.equals( + this.paymentRequirements, + verifyB402PaymentV1RequestBody.paymentRequirements); + } + + @Override + public int hashCode() { + return Objects.hash(x402Version, paymentPayload, paymentRequirements); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VerifyB402PaymentV1RequestBody {\n"); + sb.append(" x402Version: ").append(toIndentedString(x402Version)).append("\n"); + sb.append(" paymentPayload: ").append(toIndentedString(paymentPayload)).append("\n"); + sb.append(" paymentRequirements: ") + .append(toIndentedString(paymentRequirements)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object x402VersionValue = getX402Version(); + String x402VersionValueAsString = ""; + x402VersionValueAsString = x402VersionValue.toString(); + sb.append("x402Version=").append(urlEncode(x402VersionValueAsString)).append(""); + Object paymentPayloadValue = getPaymentPayload(); + String paymentPayloadValueAsString = ""; + paymentPayloadValueAsString = paymentPayloadValue.toString(); + sb.append("paymentPayload=").append(urlEncode(paymentPayloadValueAsString)).append(""); + Object paymentRequirementsValue = getPaymentRequirements(); + String paymentRequirementsValueAsString = ""; + paymentRequirementsValueAsString = paymentRequirementsValue.toString(); + sb.append("paymentRequirements=") + .append(urlEncode(paymentRequirementsValueAsString)) + .append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("x402Version"); + openapiFields.add("paymentPayload"); + openapiFields.add("paymentRequirements"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("x402Version"); + openapiRequiredFields.add("paymentPayload"); + openapiRequiredFields.add("paymentRequirements"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * VerifyB402PaymentV1RequestBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!VerifyB402PaymentV1RequestBody.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in VerifyB402PaymentV1RequestBody is not" + + " found in the empty JSON string", + VerifyB402PaymentV1RequestBody.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : VerifyB402PaymentV1RequestBody.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `x402Version` + X402VersionEnum.validateJsonElement(jsonObj.get("x402Version")); + // validate the required field `paymentPayload` + VerifyB402PaymentV1RequestBodyPaymentPayload.validateJsonElement( + jsonObj.get("paymentPayload")); + // validate the required field `paymentRequirements` + VerifyB402PaymentV1RequestBodyPaymentRequirements.validateJsonElement( + jsonObj.get("paymentRequirements")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!VerifyB402PaymentV1RequestBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'VerifyB402PaymentV1RequestBody' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(VerifyB402PaymentV1RequestBody.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, VerifyB402PaymentV1RequestBody value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public VerifyB402PaymentV1RequestBody read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of VerifyB402PaymentV1RequestBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of VerifyB402PaymentV1RequestBody + * @throws IOException if the JSON string is invalid with respect to + * VerifyB402PaymentV1RequestBody + */ + public static VerifyB402PaymentV1RequestBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, VerifyB402PaymentV1RequestBody.class); + } + + /** + * Convert an instance of VerifyB402PaymentV1RequestBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/VerifyB402PaymentV1RequestBodyPaymentPayload.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/VerifyB402PaymentV1RequestBodyPaymentPayload.java new file mode 100644 index 0000000..5efce83 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/VerifyB402PaymentV1RequestBodyPaymentPayload.java @@ -0,0 +1,462 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** VerifyB402PaymentV1RequestBodyPaymentPayload */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class VerifyB402PaymentV1RequestBodyPaymentPayload { + /** Gets or Sets x402Version */ + @JsonAdapter(X402VersionEnum.Adapter.class) + public enum X402VersionEnum { + X402_VERSION_1(1); + + private Integer value; + + X402VersionEnum(Integer value) { + this.value = value; + } + + public Integer getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static X402VersionEnum fromValue(Integer value) { + for (X402VersionEnum b : X402VersionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final X402VersionEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public X402VersionEnum read(final JsonReader jsonReader) throws IOException { + Integer value = jsonReader.nextInt(); + return X402VersionEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + Integer value = jsonElement.getAsInt(); + X402VersionEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_X402_VERSION = "x402Version"; + + @SerializedName(SERIALIZED_NAME_X402_VERSION) + @jakarta.annotation.Nonnull + private X402VersionEnum x402Version; + + /** Gets or Sets scheme */ + @JsonAdapter(SchemeEnum.Adapter.class) + public enum SchemeEnum { + exact("exact"); + + private String value; + + SchemeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static SchemeEnum fromValue(String value) { + for (SchemeEnum b : SchemeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final SchemeEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public SchemeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return SchemeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + SchemeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_SCHEME = "scheme"; + + @SerializedName(SERIALIZED_NAME_SCHEME) + @jakarta.annotation.Nonnull + private SchemeEnum scheme; + + public static final String SERIALIZED_NAME_NETWORK = "network"; + + @SerializedName(SERIALIZED_NAME_NETWORK) + @jakarta.annotation.Nonnull + private String network; + + public static final String SERIALIZED_NAME_PAYLOAD = "payload"; + + @SerializedName(SERIALIZED_NAME_PAYLOAD) + @jakarta.annotation.Nonnull + private VerifyB402PaymentV2RequestBodyPaymentPayloadPayload payload; + + public VerifyB402PaymentV1RequestBodyPaymentPayload() {} + + public VerifyB402PaymentV1RequestBodyPaymentPayload x402Version( + @jakarta.annotation.Nonnull X402VersionEnum x402Version) { + this.x402Version = x402Version; + return this; + } + + /** + * Get x402Version + * + * @return x402Version + */ + @jakarta.annotation.Nonnull + @NotNull + public X402VersionEnum getX402Version() { + return x402Version; + } + + public void setX402Version(@jakarta.annotation.Nonnull X402VersionEnum x402Version) { + this.x402Version = x402Version; + } + + public VerifyB402PaymentV1RequestBodyPaymentPayload scheme( + @jakarta.annotation.Nonnull SchemeEnum scheme) { + this.scheme = scheme; + return this; + } + + /** + * Get scheme + * + * @return scheme + */ + @jakarta.annotation.Nonnull + @NotNull + public SchemeEnum getScheme() { + return scheme; + } + + public void setScheme(@jakarta.annotation.Nonnull SchemeEnum scheme) { + this.scheme = scheme; + } + + public VerifyB402PaymentV1RequestBodyPaymentPayload network( + @jakarta.annotation.Nonnull String network) { + this.network = network; + return this; + } + + /** + * Get network + * + * @return network + */ + @jakarta.annotation.Nonnull + @NotNull + public String getNetwork() { + return network; + } + + public void setNetwork(@jakarta.annotation.Nonnull String network) { + this.network = network; + } + + public VerifyB402PaymentV1RequestBodyPaymentPayload payload( + @jakarta.annotation.Nonnull + VerifyB402PaymentV2RequestBodyPaymentPayloadPayload payload) { + this.payload = payload; + return this; + } + + /** + * Get payload + * + * @return payload + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public VerifyB402PaymentV2RequestBodyPaymentPayloadPayload getPayload() { + return payload; + } + + public void setPayload( + @jakarta.annotation.Nonnull + VerifyB402PaymentV2RequestBodyPaymentPayloadPayload payload) { + this.payload = payload; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + VerifyB402PaymentV1RequestBodyPaymentPayload verifyB402PaymentV1RequestBodyPaymentPayload = + (VerifyB402PaymentV1RequestBodyPaymentPayload) o; + return Objects.equals( + this.x402Version, verifyB402PaymentV1RequestBodyPaymentPayload.x402Version) + && Objects.equals(this.scheme, verifyB402PaymentV1RequestBodyPaymentPayload.scheme) + && Objects.equals( + this.network, verifyB402PaymentV1RequestBodyPaymentPayload.network) + && Objects.equals( + this.payload, verifyB402PaymentV1RequestBodyPaymentPayload.payload); + } + + @Override + public int hashCode() { + return Objects.hash(x402Version, scheme, network, payload); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VerifyB402PaymentV1RequestBodyPaymentPayload {\n"); + sb.append(" x402Version: ").append(toIndentedString(x402Version)).append("\n"); + sb.append(" scheme: ").append(toIndentedString(scheme)).append("\n"); + sb.append(" network: ").append(toIndentedString(network)).append("\n"); + sb.append(" payload: ").append(toIndentedString(payload)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object x402VersionValue = getX402Version(); + String x402VersionValueAsString = ""; + x402VersionValueAsString = x402VersionValue.toString(); + sb.append("x402Version=").append(urlEncode(x402VersionValueAsString)).append(""); + Object schemeValue = getScheme(); + String schemeValueAsString = ""; + schemeValueAsString = schemeValue.toString(); + sb.append("scheme=").append(urlEncode(schemeValueAsString)).append(""); + Object networkValue = getNetwork(); + String networkValueAsString = ""; + networkValueAsString = networkValue.toString(); + sb.append("network=").append(urlEncode(networkValueAsString)).append(""); + Object payloadValue = getPayload(); + String payloadValueAsString = ""; + payloadValueAsString = payloadValue.toString(); + sb.append("payload=").append(urlEncode(payloadValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("x402Version"); + openapiFields.add("scheme"); + openapiFields.add("network"); + openapiFields.add("payload"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("x402Version"); + openapiRequiredFields.add("scheme"); + openapiRequiredFields.add("network"); + openapiRequiredFields.add("payload"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * VerifyB402PaymentV1RequestBodyPaymentPayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!VerifyB402PaymentV1RequestBodyPaymentPayload.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " VerifyB402PaymentV1RequestBodyPaymentPayload is not found" + + " in the empty JSON string", + VerifyB402PaymentV1RequestBodyPaymentPayload.openapiRequiredFields + .toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : + VerifyB402PaymentV1RequestBodyPaymentPayload.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `x402Version` + X402VersionEnum.validateJsonElement(jsonObj.get("x402Version")); + if (!jsonObj.get("scheme").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `scheme` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("scheme").toString())); + } + // validate the required field `scheme` + SchemeEnum.validateJsonElement(jsonObj.get("scheme")); + if (!jsonObj.get("network").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `network` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("network").toString())); + } + // validate the required field `payload` + VerifyB402PaymentV2RequestBodyPaymentPayloadPayload.validateJsonElement( + jsonObj.get("payload")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!VerifyB402PaymentV1RequestBodyPaymentPayload.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'VerifyB402PaymentV1RequestBodyPaymentPayload' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, + TypeToken.get(VerifyB402PaymentV1RequestBodyPaymentPayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, VerifyB402PaymentV1RequestBodyPaymentPayload value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public VerifyB402PaymentV1RequestBodyPaymentPayload read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of VerifyB402PaymentV1RequestBodyPaymentPayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of VerifyB402PaymentV1RequestBodyPaymentPayload + * @throws IOException if the JSON string is invalid with respect to + * VerifyB402PaymentV1RequestBodyPaymentPayload + */ + public static VerifyB402PaymentV1RequestBodyPaymentPayload fromJson(String jsonString) + throws IOException { + return JSON.getGson() + .fromJson(jsonString, VerifyB402PaymentV1RequestBodyPaymentPayload.class); + } + + /** + * Convert an instance of VerifyB402PaymentV1RequestBodyPaymentPayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/VerifyB402PaymentV1RequestBodyPaymentRequirements.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/VerifyB402PaymentV1RequestBodyPaymentRequirements.java new file mode 100644 index 0000000..32cb741 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/VerifyB402PaymentV1RequestBodyPaymentRequirements.java @@ -0,0 +1,732 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URI; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** VerifyB402PaymentV1RequestBodyPaymentRequirements */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class VerifyB402PaymentV1RequestBodyPaymentRequirements { + /** Gets or Sets scheme */ + @JsonAdapter(SchemeEnum.Adapter.class) + public enum SchemeEnum { + exact("exact"); + + private String value; + + SchemeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static SchemeEnum fromValue(String value) { + for (SchemeEnum b : SchemeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final SchemeEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public SchemeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return SchemeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + SchemeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_SCHEME = "scheme"; + + @SerializedName(SERIALIZED_NAME_SCHEME) + @jakarta.annotation.Nonnull + private SchemeEnum scheme; + + public static final String SERIALIZED_NAME_NETWORK = "network"; + + @SerializedName(SERIALIZED_NAME_NETWORK) + @jakarta.annotation.Nonnull + private String network; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + + @SerializedName(SERIALIZED_NAME_AMOUNT) + @jakarta.annotation.Nonnull + private String amount; + + public static final String SERIALIZED_NAME_RESOURCE = "resource"; + + @SerializedName(SERIALIZED_NAME_RESOURCE) + @jakarta.annotation.Nullable + private URI resource; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @jakarta.annotation.Nullable + private String description; + + public static final String SERIALIZED_NAME_PAY_TO = "payTo"; + + @SerializedName(SERIALIZED_NAME_PAY_TO) + @jakarta.annotation.Nonnull + private String payTo; + + public static final String SERIALIZED_NAME_ASSET = "asset"; + + @SerializedName(SERIALIZED_NAME_ASSET) + @jakarta.annotation.Nonnull + private String asset; + + public static final String SERIALIZED_NAME_MAX_TIMEOUT_SECONDS = "maxTimeoutSeconds"; + + @SerializedName(SERIALIZED_NAME_MAX_TIMEOUT_SECONDS) + @jakarta.annotation.Nonnull + private Integer maxTimeoutSeconds; + + public static final String SERIALIZED_NAME_MIME_TYPE = "mimeType"; + + @SerializedName(SERIALIZED_NAME_MIME_TYPE) + @jakarta.annotation.Nullable + private String mimeType; + + public static final String SERIALIZED_NAME_OUTPUT_SCHEMA = "outputSchema"; + + @SerializedName(SERIALIZED_NAME_OUTPUT_SCHEMA) + @jakarta.annotation.Nullable + private Map outputSchema; + + public static final String SERIALIZED_NAME_EXTRA = "extra"; + + @SerializedName(SERIALIZED_NAME_EXTRA) + @jakarta.annotation.Nullable + private VerifyB402PaymentV1RequestBodyPaymentRequirementsExtra extra; + + public VerifyB402PaymentV1RequestBodyPaymentRequirements() {} + + public VerifyB402PaymentV1RequestBodyPaymentRequirements scheme( + @jakarta.annotation.Nonnull SchemeEnum scheme) { + this.scheme = scheme; + return this; + } + + /** + * Get scheme + * + * @return scheme + */ + @jakarta.annotation.Nonnull + @NotNull + public SchemeEnum getScheme() { + return scheme; + } + + public void setScheme(@jakarta.annotation.Nonnull SchemeEnum scheme) { + this.scheme = scheme; + } + + public VerifyB402PaymentV1RequestBodyPaymentRequirements network( + @jakarta.annotation.Nonnull String network) { + this.network = network; + return this; + } + + /** + * Get network + * + * @return network + */ + @jakarta.annotation.Nonnull + @NotNull + public String getNetwork() { + return network; + } + + public void setNetwork(@jakarta.annotation.Nonnull String network) { + this.network = network; + } + + public VerifyB402PaymentV1RequestBodyPaymentRequirements amount( + @jakarta.annotation.Nonnull String amount) { + this.amount = amount; + return this; + } + + /** + * Get amount + * + * @return amount + */ + @jakarta.annotation.Nonnull + @NotNull + public String getAmount() { + return amount; + } + + public void setAmount(@jakarta.annotation.Nonnull String amount) { + this.amount = amount; + } + + public VerifyB402PaymentV1RequestBodyPaymentRequirements resource( + @jakarta.annotation.Nullable URI resource) { + this.resource = resource; + return this; + } + + /** + * Get resource + * + * @return resource + */ + @jakarta.annotation.Nullable + @Valid + public URI getResource() { + return resource; + } + + public void setResource(@jakarta.annotation.Nullable URI resource) { + this.resource = resource; + } + + public VerifyB402PaymentV1RequestBodyPaymentRequirements description( + @jakarta.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Get description + * + * @return description + */ + @jakarta.annotation.Nullable + public String getDescription() { + return description; + } + + public void setDescription(@jakarta.annotation.Nullable String description) { + this.description = description; + } + + public VerifyB402PaymentV1RequestBodyPaymentRequirements payTo( + @jakarta.annotation.Nonnull String payTo) { + this.payTo = payTo; + return this; + } + + /** + * Get payTo + * + * @return payTo + */ + @jakarta.annotation.Nonnull + @NotNull + public String getPayTo() { + return payTo; + } + + public void setPayTo(@jakarta.annotation.Nonnull String payTo) { + this.payTo = payTo; + } + + public VerifyB402PaymentV1RequestBodyPaymentRequirements asset( + @jakarta.annotation.Nonnull String asset) { + this.asset = asset; + return this; + } + + /** + * Get asset + * + * @return asset + */ + @jakarta.annotation.Nonnull + @NotNull + public String getAsset() { + return asset; + } + + public void setAsset(@jakarta.annotation.Nonnull String asset) { + this.asset = asset; + } + + public VerifyB402PaymentV1RequestBodyPaymentRequirements maxTimeoutSeconds( + @jakarta.annotation.Nonnull Integer maxTimeoutSeconds) { + this.maxTimeoutSeconds = maxTimeoutSeconds; + return this; + } + + /** + * Get maxTimeoutSeconds + * + * @return maxTimeoutSeconds + */ + @jakarta.annotation.Nonnull + @NotNull + public Integer getMaxTimeoutSeconds() { + return maxTimeoutSeconds; + } + + public void setMaxTimeoutSeconds(@jakarta.annotation.Nonnull Integer maxTimeoutSeconds) { + this.maxTimeoutSeconds = maxTimeoutSeconds; + } + + public VerifyB402PaymentV1RequestBodyPaymentRequirements mimeType( + @jakarta.annotation.Nullable String mimeType) { + this.mimeType = mimeType; + return this; + } + + /** + * Get mimeType + * + * @return mimeType + */ + @jakarta.annotation.Nullable + public String getMimeType() { + return mimeType; + } + + public void setMimeType(@jakarta.annotation.Nullable String mimeType) { + this.mimeType = mimeType; + } + + public VerifyB402PaymentV1RequestBodyPaymentRequirements outputSchema( + @jakarta.annotation.Nullable Map outputSchema) { + this.outputSchema = outputSchema; + return this; + } + + public VerifyB402PaymentV1RequestBodyPaymentRequirements putOutputSchemaItem( + String key, Object outputSchemaItem) { + if (this.outputSchema == null) { + this.outputSchema = new HashMap<>(); + } + this.outputSchema.put(key, outputSchemaItem); + return this; + } + + /** + * Get outputSchema + * + * @return outputSchema + */ + @jakarta.annotation.Nullable + public Map getOutputSchema() { + return outputSchema; + } + + public void setOutputSchema(@jakarta.annotation.Nullable Map outputSchema) { + this.outputSchema = outputSchema; + } + + public VerifyB402PaymentV1RequestBodyPaymentRequirements extra( + @jakarta.annotation.Nullable + VerifyB402PaymentV1RequestBodyPaymentRequirementsExtra extra) { + this.extra = extra; + return this; + } + + /** + * Get extra + * + * @return extra + */ + @jakarta.annotation.Nullable + @Valid + public VerifyB402PaymentV1RequestBodyPaymentRequirementsExtra getExtra() { + return extra; + } + + public void setExtra( + @jakarta.annotation.Nullable + VerifyB402PaymentV1RequestBodyPaymentRequirementsExtra extra) { + this.extra = extra; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + VerifyB402PaymentV1RequestBodyPaymentRequirements + verifyB402PaymentV1RequestBodyPaymentRequirements = + (VerifyB402PaymentV1RequestBodyPaymentRequirements) o; + return Objects.equals(this.scheme, verifyB402PaymentV1RequestBodyPaymentRequirements.scheme) + && Objects.equals( + this.network, verifyB402PaymentV1RequestBodyPaymentRequirements.network) + && Objects.equals( + this.amount, verifyB402PaymentV1RequestBodyPaymentRequirements.amount) + && Objects.equals( + this.resource, verifyB402PaymentV1RequestBodyPaymentRequirements.resource) + && Objects.equals( + this.description, + verifyB402PaymentV1RequestBodyPaymentRequirements.description) + && Objects.equals( + this.payTo, verifyB402PaymentV1RequestBodyPaymentRequirements.payTo) + && Objects.equals( + this.asset, verifyB402PaymentV1RequestBodyPaymentRequirements.asset) + && Objects.equals( + this.maxTimeoutSeconds, + verifyB402PaymentV1RequestBodyPaymentRequirements.maxTimeoutSeconds) + && Objects.equals( + this.mimeType, verifyB402PaymentV1RequestBodyPaymentRequirements.mimeType) + && Objects.equals( + this.outputSchema, + verifyB402PaymentV1RequestBodyPaymentRequirements.outputSchema) + && Objects.equals( + this.extra, verifyB402PaymentV1RequestBodyPaymentRequirements.extra); + } + + @Override + public int hashCode() { + return Objects.hash( + scheme, + network, + amount, + resource, + description, + payTo, + asset, + maxTimeoutSeconds, + mimeType, + outputSchema, + extra); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VerifyB402PaymentV1RequestBodyPaymentRequirements {\n"); + sb.append(" scheme: ").append(toIndentedString(scheme)).append("\n"); + sb.append(" network: ").append(toIndentedString(network)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" resource: ").append(toIndentedString(resource)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" payTo: ").append(toIndentedString(payTo)).append("\n"); + sb.append(" asset: ").append(toIndentedString(asset)).append("\n"); + sb.append(" maxTimeoutSeconds: ").append(toIndentedString(maxTimeoutSeconds)).append("\n"); + sb.append(" mimeType: ").append(toIndentedString(mimeType)).append("\n"); + sb.append(" outputSchema: ").append(toIndentedString(outputSchema)).append("\n"); + sb.append(" extra: ").append(toIndentedString(extra)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object schemeValue = getScheme(); + String schemeValueAsString = ""; + schemeValueAsString = schemeValue.toString(); + sb.append("scheme=").append(urlEncode(schemeValueAsString)).append(""); + Object networkValue = getNetwork(); + String networkValueAsString = ""; + networkValueAsString = networkValue.toString(); + sb.append("network=").append(urlEncode(networkValueAsString)).append(""); + Object amountValue = getAmount(); + String amountValueAsString = ""; + amountValueAsString = amountValue.toString(); + sb.append("amount=").append(urlEncode(amountValueAsString)).append(""); + Object resourceValue = getResource(); + String resourceValueAsString = ""; + resourceValueAsString = resourceValue.toString(); + sb.append("resource=").append(urlEncode(resourceValueAsString)).append(""); + Object descriptionValue = getDescription(); + String descriptionValueAsString = ""; + descriptionValueAsString = descriptionValue.toString(); + sb.append("description=").append(urlEncode(descriptionValueAsString)).append(""); + Object payToValue = getPayTo(); + String payToValueAsString = ""; + payToValueAsString = payToValue.toString(); + sb.append("payTo=").append(urlEncode(payToValueAsString)).append(""); + Object assetValue = getAsset(); + String assetValueAsString = ""; + assetValueAsString = assetValue.toString(); + sb.append("asset=").append(urlEncode(assetValueAsString)).append(""); + Object maxTimeoutSecondsValue = getMaxTimeoutSeconds(); + String maxTimeoutSecondsValueAsString = ""; + maxTimeoutSecondsValueAsString = maxTimeoutSecondsValue.toString(); + sb.append("maxTimeoutSeconds=") + .append(urlEncode(maxTimeoutSecondsValueAsString)) + .append(""); + Object mimeTypeValue = getMimeType(); + String mimeTypeValueAsString = ""; + mimeTypeValueAsString = mimeTypeValue.toString(); + sb.append("mimeType=").append(urlEncode(mimeTypeValueAsString)).append(""); + Object outputSchemaValue = getOutputSchema(); + String outputSchemaValueAsString = ""; + outputSchemaValueAsString = outputSchemaValue.toString(); + sb.append("outputSchema=").append(urlEncode(outputSchemaValueAsString)).append(""); + Object extraValue = getExtra(); + String extraValueAsString = ""; + extraValueAsString = extraValue.toString(); + sb.append("extra=").append(urlEncode(extraValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("scheme"); + openapiFields.add("network"); + openapiFields.add("amount"); + openapiFields.add("resource"); + openapiFields.add("description"); + openapiFields.add("payTo"); + openapiFields.add("asset"); + openapiFields.add("maxTimeoutSeconds"); + openapiFields.add("mimeType"); + openapiFields.add("outputSchema"); + openapiFields.add("extra"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("scheme"); + openapiRequiredFields.add("network"); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("payTo"); + openapiRequiredFields.add("asset"); + openapiRequiredFields.add("maxTimeoutSeconds"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * VerifyB402PaymentV1RequestBodyPaymentRequirements + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!VerifyB402PaymentV1RequestBodyPaymentRequirements.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " VerifyB402PaymentV1RequestBodyPaymentRequirements is not" + + " found in the empty JSON string", + VerifyB402PaymentV1RequestBodyPaymentRequirements + .openapiRequiredFields + .toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : + VerifyB402PaymentV1RequestBodyPaymentRequirements.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("scheme").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `scheme` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("scheme").toString())); + } + // validate the required field `scheme` + SchemeEnum.validateJsonElement(jsonObj.get("scheme")); + if (!jsonObj.get("network").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `network` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("network").toString())); + } + if (!jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `amount` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("amount").toString())); + } + if ((jsonObj.get("resource") != null && !jsonObj.get("resource").isJsonNull()) + && !jsonObj.get("resource").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `resource` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("resource").toString())); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) + && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `description` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("description").toString())); + } + if (!jsonObj.get("payTo").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `payTo` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("payTo").toString())); + } + if (!jsonObj.get("asset").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `asset` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("asset").toString())); + } + if ((jsonObj.get("mimeType") != null && !jsonObj.get("mimeType").isJsonNull()) + && !jsonObj.get("mimeType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `mimeType` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("mimeType").toString())); + } + // validate the optional field `extra` + if (jsonObj.get("extra") != null && !jsonObj.get("extra").isJsonNull()) { + VerifyB402PaymentV1RequestBodyPaymentRequirementsExtra.validateJsonElement( + jsonObj.get("extra")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!VerifyB402PaymentV1RequestBodyPaymentRequirements.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'VerifyB402PaymentV1RequestBodyPaymentRequirements' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, + TypeToken.get(VerifyB402PaymentV1RequestBodyPaymentRequirements.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, + VerifyB402PaymentV1RequestBodyPaymentRequirements value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public VerifyB402PaymentV1RequestBodyPaymentRequirements read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of VerifyB402PaymentV1RequestBodyPaymentRequirements given an JSON string + * + * @param jsonString JSON string + * @return An instance of VerifyB402PaymentV1RequestBodyPaymentRequirements + * @throws IOException if the JSON string is invalid with respect to + * VerifyB402PaymentV1RequestBodyPaymentRequirements + */ + public static VerifyB402PaymentV1RequestBodyPaymentRequirements fromJson(String jsonString) + throws IOException { + return JSON.getGson() + .fromJson(jsonString, VerifyB402PaymentV1RequestBodyPaymentRequirements.class); + } + + /** + * Convert an instance of VerifyB402PaymentV1RequestBodyPaymentRequirements to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/VerifyB402PaymentV1RequestBodyPaymentRequirementsExtra.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/VerifyB402PaymentV1RequestBodyPaymentRequirementsExtra.java new file mode 100644 index 0000000..3bd83ec --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/VerifyB402PaymentV1RequestBodyPaymentRequirementsExtra.java @@ -0,0 +1,432 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** VerifyB402PaymentV1RequestBodyPaymentRequirementsExtra */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class VerifyB402PaymentV1RequestBodyPaymentRequirementsExtra { + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @jakarta.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_VERSION = "version"; + + @SerializedName(SERIALIZED_NAME_VERSION) + @jakarta.annotation.Nullable + private String version; + + /** Gets or Sets assetTransferMethod */ + @JsonAdapter(AssetTransferMethodEnum.Adapter.class) + public enum AssetTransferMethodEnum { + EIP3009("eip3009"), + + PERMIT2_EXACT("permit2-exact"), + + PERMIT2_UPTO("permit2-upto"); + + private String value; + + AssetTransferMethodEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static AssetTransferMethodEnum fromValue(String value) { + for (AssetTransferMethodEnum b : AssetTransferMethodEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write( + final JsonWriter jsonWriter, final AssetTransferMethodEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public AssetTransferMethodEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return AssetTransferMethodEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + AssetTransferMethodEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_ASSET_TRANSFER_METHOD = "assetTransferMethod"; + + @SerializedName(SERIALIZED_NAME_ASSET_TRANSFER_METHOD) + @jakarta.annotation.Nullable + private AssetTransferMethodEnum assetTransferMethod; + + public static final String SERIALIZED_NAME_FACILITATOR_ADDRESS = "facilitatorAddress"; + + @SerializedName(SERIALIZED_NAME_FACILITATOR_ADDRESS) + @jakarta.annotation.Nullable + private String facilitatorAddress; + + public VerifyB402PaymentV1RequestBodyPaymentRequirementsExtra() {} + + public VerifyB402PaymentV1RequestBodyPaymentRequirementsExtra name( + @jakarta.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * + * @return name + */ + @jakarta.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@jakarta.annotation.Nullable String name) { + this.name = name; + } + + public VerifyB402PaymentV1RequestBodyPaymentRequirementsExtra version( + @jakarta.annotation.Nullable String version) { + this.version = version; + return this; + } + + /** + * Get version + * + * @return version + */ + @jakarta.annotation.Nullable + public String getVersion() { + return version; + } + + public void setVersion(@jakarta.annotation.Nullable String version) { + this.version = version; + } + + public VerifyB402PaymentV1RequestBodyPaymentRequirementsExtra assetTransferMethod( + @jakarta.annotation.Nullable AssetTransferMethodEnum assetTransferMethod) { + this.assetTransferMethod = assetTransferMethod; + return this; + } + + /** + * Get assetTransferMethod + * + * @return assetTransferMethod + */ + @jakarta.annotation.Nullable + public AssetTransferMethodEnum getAssetTransferMethod() { + return assetTransferMethod; + } + + public void setAssetTransferMethod( + @jakarta.annotation.Nullable AssetTransferMethodEnum assetTransferMethod) { + this.assetTransferMethod = assetTransferMethod; + } + + public VerifyB402PaymentV1RequestBodyPaymentRequirementsExtra facilitatorAddress( + @jakarta.annotation.Nullable String facilitatorAddress) { + this.facilitatorAddress = facilitatorAddress; + return this; + } + + /** + * Get facilitatorAddress + * + * @return facilitatorAddress + */ + @jakarta.annotation.Nullable + public String getFacilitatorAddress() { + return facilitatorAddress; + } + + public void setFacilitatorAddress(@jakarta.annotation.Nullable String facilitatorAddress) { + this.facilitatorAddress = facilitatorAddress; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + VerifyB402PaymentV1RequestBodyPaymentRequirementsExtra + verifyB402PaymentV1RequestBodyPaymentRequirementsExtra = + (VerifyB402PaymentV1RequestBodyPaymentRequirementsExtra) o; + return Objects.equals( + this.name, verifyB402PaymentV1RequestBodyPaymentRequirementsExtra.name) + && Objects.equals( + this.version, + verifyB402PaymentV1RequestBodyPaymentRequirementsExtra.version) + && Objects.equals( + this.assetTransferMethod, + verifyB402PaymentV1RequestBodyPaymentRequirementsExtra.assetTransferMethod) + && Objects.equals( + this.facilitatorAddress, + verifyB402PaymentV1RequestBodyPaymentRequirementsExtra.facilitatorAddress); + } + + @Override + public int hashCode() { + return Objects.hash(name, version, assetTransferMethod, facilitatorAddress); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VerifyB402PaymentV1RequestBodyPaymentRequirementsExtra {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).append("\n"); + sb.append(" assetTransferMethod: ") + .append(toIndentedString(assetTransferMethod)) + .append("\n"); + sb.append(" facilitatorAddress: ") + .append(toIndentedString(facilitatorAddress)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object nameValue = getName(); + String nameValueAsString = ""; + nameValueAsString = nameValue.toString(); + sb.append("name=").append(urlEncode(nameValueAsString)).append(""); + Object versionValue = getVersion(); + String versionValueAsString = ""; + versionValueAsString = versionValue.toString(); + sb.append("version=").append(urlEncode(versionValueAsString)).append(""); + Object assetTransferMethodValue = getAssetTransferMethod(); + String assetTransferMethodValueAsString = ""; + assetTransferMethodValueAsString = assetTransferMethodValue.toString(); + sb.append("assetTransferMethod=") + .append(urlEncode(assetTransferMethodValueAsString)) + .append(""); + Object facilitatorAddressValue = getFacilitatorAddress(); + String facilitatorAddressValueAsString = ""; + facilitatorAddressValueAsString = facilitatorAddressValue.toString(); + sb.append("facilitatorAddress=") + .append(urlEncode(facilitatorAddressValueAsString)) + .append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("version"); + openapiFields.add("assetTransferMethod"); + openapiFields.add("facilitatorAddress"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * VerifyB402PaymentV1RequestBodyPaymentRequirementsExtra + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!VerifyB402PaymentV1RequestBodyPaymentRequirementsExtra.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " VerifyB402PaymentV1RequestBodyPaymentRequirementsExtra is" + + " not found in the empty JSON string", + VerifyB402PaymentV1RequestBodyPaymentRequirementsExtra + .openapiRequiredFields + .toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) + && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `name` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("name").toString())); + } + if ((jsonObj.get("version") != null && !jsonObj.get("version").isJsonNull()) + && !jsonObj.get("version").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `version` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("version").toString())); + } + if ((jsonObj.get("assetTransferMethod") != null + && !jsonObj.get("assetTransferMethod").isJsonNull()) + && !jsonObj.get("assetTransferMethod").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `assetTransferMethod` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("assetTransferMethod").toString())); + } + // validate the optional field `assetTransferMethod` + if (jsonObj.get("assetTransferMethod") != null + && !jsonObj.get("assetTransferMethod").isJsonNull()) { + AssetTransferMethodEnum.validateJsonElement(jsonObj.get("assetTransferMethod")); + } + if ((jsonObj.get("facilitatorAddress") != null + && !jsonObj.get("facilitatorAddress").isJsonNull()) + && !jsonObj.get("facilitatorAddress").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `facilitatorAddress` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("facilitatorAddress").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!VerifyB402PaymentV1RequestBodyPaymentRequirementsExtra.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'VerifyB402PaymentV1RequestBodyPaymentRequirementsExtra' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, + TypeToken.get( + VerifyB402PaymentV1RequestBodyPaymentRequirementsExtra.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, + VerifyB402PaymentV1RequestBodyPaymentRequirementsExtra value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public VerifyB402PaymentV1RequestBodyPaymentRequirementsExtra read( + JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of VerifyB402PaymentV1RequestBodyPaymentRequirementsExtra given an JSON + * string + * + * @param jsonString JSON string + * @return An instance of VerifyB402PaymentV1RequestBodyPaymentRequirementsExtra + * @throws IOException if the JSON string is invalid with respect to + * VerifyB402PaymentV1RequestBodyPaymentRequirementsExtra + */ + public static VerifyB402PaymentV1RequestBodyPaymentRequirementsExtra fromJson(String jsonString) + throws IOException { + return JSON.getGson() + .fromJson(jsonString, VerifyB402PaymentV1RequestBodyPaymentRequirementsExtra.class); + } + + /** + * Convert an instance of VerifyB402PaymentV1RequestBodyPaymentRequirementsExtra to an JSON + * string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/VerifyB402PaymentV1Response.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/VerifyB402PaymentV1Response.java new file mode 100644 index 0000000..b78eb8a --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/VerifyB402PaymentV1Response.java @@ -0,0 +1,308 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.common.AbstractOpenApiSchema; +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; +import org.hibernate.validator.constraints.*; + +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class VerifyB402PaymentV1Response extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(VerifyB402PaymentV1Response.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!VerifyB402PaymentV1Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'VerifyB402PaymentV1Response' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterVerifyB402PaymentV1Response1 = + gson.getDelegateAdapter( + this, TypeToken.get(VerifyB402PaymentV1Response1.class)); + final TypeAdapter adapterVerifyB402PaymentV1Response2 = + gson.getDelegateAdapter( + this, TypeToken.get(VerifyB402PaymentV1Response2.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, VerifyB402PaymentV1Response value) + throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type + // `VerifyB402PaymentV1Response1` + if (value.getActualInstance() instanceof VerifyB402PaymentV1Response1) { + JsonElement element = + adapterVerifyB402PaymentV1Response1.toJsonTree( + (VerifyB402PaymentV1Response1) + value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type + // `VerifyB402PaymentV1Response2` + if (value.getActualInstance() instanceof VerifyB402PaymentV1Response2) { + JsonElement element = + adapterVerifyB402PaymentV1Response2.toJsonTree( + (VerifyB402PaymentV1Response2) + value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException( + "Failed to serialize as the type doesn't match oneOf schemas:" + + " VerifyB402PaymentV1Response1," + + " VerifyB402PaymentV1Response2"); + } + + @Override + public VerifyB402PaymentV1Response read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize VerifyB402PaymentV1Response1 + try { + // validate the JSON object to see if any exception is thrown + VerifyB402PaymentV1Response1.validateJsonElement(jsonElement); + actualAdapter = adapterVerifyB402PaymentV1Response1; + match++; + log.log( + Level.FINER, + "Input data matches schema 'VerifyB402PaymentV1Response1'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add( + String.format( + "Deserialization for VerifyB402PaymentV1Response1" + + " failed with `%s`.", + e.getMessage())); + log.log( + Level.FINER, + "Input data does not match schema" + + " 'VerifyB402PaymentV1Response1'", + e); + } + // deserialize VerifyB402PaymentV1Response2 + try { + // validate the JSON object to see if any exception is thrown + VerifyB402PaymentV1Response2.validateJsonElement(jsonElement); + actualAdapter = adapterVerifyB402PaymentV1Response2; + match++; + log.log( + Level.FINER, + "Input data matches schema 'VerifyB402PaymentV1Response2'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add( + String.format( + "Deserialization for VerifyB402PaymentV1Response2" + + " failed with `%s`.", + e.getMessage())); + log.log( + Level.FINER, + "Input data does not match schema" + + " 'VerifyB402PaymentV1Response2'", + e); + } + + if (match == 1) { + VerifyB402PaymentV1Response ret = new VerifyB402PaymentV1Response(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException( + String.format( + "Failed deserialization for" + + " VerifyB402PaymentV1Response: %d classes match" + + " result, expected 1. Detailed failure message" + + " for oneOf schemas: %s. JSON: %s", + match, errorMessages, jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap>(); + + public VerifyB402PaymentV1Response() { + super("oneOf", Boolean.FALSE); + } + + public VerifyB402PaymentV1Response(Object o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("VerifyB402PaymentV1Response1", VerifyB402PaymentV1Response1.class); + schemas.put("VerifyB402PaymentV1Response2", VerifyB402PaymentV1Response2.class); + } + + @Override + public Map> getSchemas() { + return VerifyB402PaymentV1Response.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: VerifyB402PaymentV1Response1, VerifyB402PaymentV1Response2 + * + *

It could be an instance of the 'oneOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof VerifyB402PaymentV1Response1) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof VerifyB402PaymentV1Response2) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException( + "Invalid instance type. Must be VerifyB402PaymentV1Response1," + + " VerifyB402PaymentV1Response2"); + } + + /** + * Get the actual instance, which can be the following: VerifyB402PaymentV1Response1, + * VerifyB402PaymentV1Response2 + * + * @return The actual instance (VerifyB402PaymentV1Response1, VerifyB402PaymentV1Response2) + */ + @SuppressWarnings("unchecked") + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `VerifyB402PaymentV1Response1`. If the actual instance is not + * `VerifyB402PaymentV1Response1`, the ClassCastException will be thrown. + * + * @return The actual instance of `VerifyB402PaymentV1Response1` + * @throws ClassCastException if the instance is not `VerifyB402PaymentV1Response1` + */ + public VerifyB402PaymentV1Response1 getVerifyB402PaymentV1Response1() + throws ClassCastException { + return (VerifyB402PaymentV1Response1) super.getActualInstance(); + } + + /** + * Get the actual instance of `VerifyB402PaymentV1Response2`. If the actual instance is not + * `VerifyB402PaymentV1Response2`, the ClassCastException will be thrown. + * + * @return The actual instance of `VerifyB402PaymentV1Response2` + * @throws ClassCastException if the instance is not `VerifyB402PaymentV1Response2` + */ + public VerifyB402PaymentV1Response2 getVerifyB402PaymentV1Response2() + throws ClassCastException { + return (VerifyB402PaymentV1Response2) super.getActualInstance(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * VerifyB402PaymentV1Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate oneOf schemas one by one + int validCount = 0; + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with VerifyB402PaymentV1Response1 + try { + VerifyB402PaymentV1Response1.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add( + String.format( + "Deserialization for VerifyB402PaymentV1Response1 failed with `%s`.", + e.getMessage())); + // continue to the next one + } + // validate the json string with VerifyB402PaymentV1Response2 + try { + VerifyB402PaymentV1Response2.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add( + String.format( + "Deserialization for VerifyB402PaymentV1Response2 failed with `%s`.", + e.getMessage())); + // continue to the next one + } + if (validCount != 1) { + throw new IOException( + String.format( + "The JSON string is invalid for VerifyB402PaymentV1Response with oneOf" + + " schemas: VerifyB402PaymentV1Response1," + + " VerifyB402PaymentV1Response2. %d class(es) match the result," + + " expected 1. Detailed failure message for oneOf schemas: %s." + + " JSON: %s", + validCount, errorMessages, jsonElement.toString())); + } + } + + /** + * Create an instance of VerifyB402PaymentV1Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of VerifyB402PaymentV1Response + * @throws IOException if the JSON string is invalid with respect to VerifyB402PaymentV1Response + */ + public static VerifyB402PaymentV1Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, VerifyB402PaymentV1Response.class); + } + + /** + * Convert an instance of VerifyB402PaymentV1Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/VerifyB402PaymentV1Response1.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/VerifyB402PaymentV1Response1.java new file mode 100644 index 0000000..40e2890 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/VerifyB402PaymentV1Response1.java @@ -0,0 +1,456 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** VerifyB402PaymentV1Response1 */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class VerifyB402PaymentV1Response1 { + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + @jakarta.annotation.Nullable + private String status; + + public static final String SERIALIZED_NAME_TYPE = "type"; + + @SerializedName(SERIALIZED_NAME_TYPE) + @jakarta.annotation.Nullable + private String type; + + public static final String SERIALIZED_NAME_CODE = "code"; + + @SerializedName(SERIALIZED_NAME_CODE) + @jakarta.annotation.Nullable + private String code; + + public static final String SERIALIZED_NAME_ERROR_DATA = "errorData"; + + @SerializedName(SERIALIZED_NAME_ERROR_DATA) + @jakarta.annotation.Nullable + private String errorData; + + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + @jakarta.annotation.Nullable + private B402VerifyResponseV2Data data; + + public static final String SERIALIZED_NAME_SUB_DATA = "subData"; + + @SerializedName(SERIALIZED_NAME_SUB_DATA) + @jakarta.annotation.Nullable + private Object subData; + + public static final String SERIALIZED_NAME_PARAMS = "params"; + + @SerializedName(SERIALIZED_NAME_PARAMS) + @jakarta.annotation.Nullable + private Object params; + + public VerifyB402PaymentV1Response1() {} + + public VerifyB402PaymentV1Response1 status(@jakarta.annotation.Nullable String status) { + this.status = status; + return this; + } + + /** + * Get status + * + * @return status + */ + @jakarta.annotation.Nullable + public String getStatus() { + return status; + } + + public void setStatus(@jakarta.annotation.Nullable String status) { + this.status = status; + } + + public VerifyB402PaymentV1Response1 type(@jakarta.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * + * @return type + */ + @jakarta.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@jakarta.annotation.Nullable String type) { + this.type = type; + } + + public VerifyB402PaymentV1Response1 code(@jakarta.annotation.Nullable String code) { + this.code = code; + return this; + } + + /** + * Get code + * + * @return code + */ + @jakarta.annotation.Nullable + public String getCode() { + return code; + } + + public void setCode(@jakarta.annotation.Nullable String code) { + this.code = code; + } + + public VerifyB402PaymentV1Response1 errorData(@jakarta.annotation.Nullable String errorData) { + this.errorData = errorData; + return this; + } + + /** + * Get errorData + * + * @return errorData + */ + @jakarta.annotation.Nullable + public String getErrorData() { + return errorData; + } + + public void setErrorData(@jakarta.annotation.Nullable String errorData) { + this.errorData = errorData; + } + + public VerifyB402PaymentV1Response1 data( + @jakarta.annotation.Nullable B402VerifyResponseV2Data data) { + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @jakarta.annotation.Nullable + @Valid + public B402VerifyResponseV2Data getData() { + return data; + } + + public void setData(@jakarta.annotation.Nullable B402VerifyResponseV2Data data) { + this.data = data; + } + + public VerifyB402PaymentV1Response1 subData(@jakarta.annotation.Nullable Object subData) { + this.subData = subData; + return this; + } + + /** + * Get subData + * + * @return subData + */ + @jakarta.annotation.Nullable + public Object getSubData() { + return subData; + } + + public void setSubData(@jakarta.annotation.Nullable Object subData) { + this.subData = subData; + } + + public VerifyB402PaymentV1Response1 params(@jakarta.annotation.Nullable Object params) { + this.params = params; + return this; + } + + /** + * Get params + * + * @return params + */ + @jakarta.annotation.Nullable + public Object getParams() { + return params; + } + + public void setParams(@jakarta.annotation.Nullable Object params) { + this.params = params; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + VerifyB402PaymentV1Response1 verifyB402PaymentV1Response1 = + (VerifyB402PaymentV1Response1) o; + return Objects.equals(this.status, verifyB402PaymentV1Response1.status) + && Objects.equals(this.type, verifyB402PaymentV1Response1.type) + && Objects.equals(this.code, verifyB402PaymentV1Response1.code) + && Objects.equals(this.errorData, verifyB402PaymentV1Response1.errorData) + && Objects.equals(this.data, verifyB402PaymentV1Response1.data) + && Objects.equals(this.subData, verifyB402PaymentV1Response1.subData) + && Objects.equals(this.params, verifyB402PaymentV1Response1.params); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(status, type, code, errorData, data, subData, params); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VerifyB402PaymentV1Response1 {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" errorData: ").append(toIndentedString(errorData)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" subData: ").append(toIndentedString(subData)).append("\n"); + sb.append(" params: ").append(toIndentedString(params)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object statusValue = getStatus(); + String statusValueAsString = ""; + statusValueAsString = statusValue.toString(); + sb.append("status=").append(urlEncode(statusValueAsString)).append(""); + Object typeValue = getType(); + String typeValueAsString = ""; + typeValueAsString = typeValue.toString(); + sb.append("type=").append(urlEncode(typeValueAsString)).append(""); + Object codeValue = getCode(); + String codeValueAsString = ""; + codeValueAsString = codeValue.toString(); + sb.append("code=").append(urlEncode(codeValueAsString)).append(""); + Object errorDataValue = getErrorData(); + String errorDataValueAsString = ""; + errorDataValueAsString = errorDataValue.toString(); + sb.append("errorData=").append(urlEncode(errorDataValueAsString)).append(""); + Object dataValue = getData(); + String dataValueAsString = ""; + dataValueAsString = dataValue.toString(); + sb.append("data=").append(urlEncode(dataValueAsString)).append(""); + Object subDataValue = getSubData(); + String subDataValueAsString = ""; + subDataValueAsString = subDataValue.toString(); + sb.append("subData=").append(urlEncode(subDataValueAsString)).append(""); + Object paramsValue = getParams(); + String paramsValueAsString = ""; + paramsValueAsString = paramsValue.toString(); + sb.append("params=").append(urlEncode(paramsValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("status"); + openapiFields.add("type"); + openapiFields.add("code"); + openapiFields.add("errorData"); + openapiFields.add("data"); + openapiFields.add("subData"); + openapiFields.add("params"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * VerifyB402PaymentV1Response1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!VerifyB402PaymentV1Response1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in VerifyB402PaymentV1Response1 is not" + + " found in the empty JSON string", + VerifyB402PaymentV1Response1.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) + && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `status` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("status").toString())); + } + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) + && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `type` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("type").toString())); + } + if ((jsonObj.get("code") != null && !jsonObj.get("code").isJsonNull()) + && !jsonObj.get("code").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `code` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("code").toString())); + } + if ((jsonObj.get("errorData") != null && !jsonObj.get("errorData").isJsonNull()) + && !jsonObj.get("errorData").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `errorData` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("errorData").toString())); + } + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + B402VerifyResponseV2Data.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!VerifyB402PaymentV1Response1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'VerifyB402PaymentV1Response1' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(VerifyB402PaymentV1Response1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, VerifyB402PaymentV1Response1 value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public VerifyB402PaymentV1Response1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of VerifyB402PaymentV1Response1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of VerifyB402PaymentV1Response1 + * @throws IOException if the JSON string is invalid with respect to + * VerifyB402PaymentV1Response1 + */ + public static VerifyB402PaymentV1Response1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, VerifyB402PaymentV1Response1.class); + } + + /** + * Convert an instance of VerifyB402PaymentV1Response1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/VerifyB402PaymentV1Response2.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/VerifyB402PaymentV1Response2.java new file mode 100644 index 0000000..2c46e5e --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/VerifyB402PaymentV1Response2.java @@ -0,0 +1,449 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** VerifyB402PaymentV1Response2 */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class VerifyB402PaymentV1Response2 { + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + @jakarta.annotation.Nullable + private String status; + + public static final String SERIALIZED_NAME_TYPE = "type"; + + @SerializedName(SERIALIZED_NAME_TYPE) + @jakarta.annotation.Nullable + private String type; + + public static final String SERIALIZED_NAME_CODE = "code"; + + @SerializedName(SERIALIZED_NAME_CODE) + @jakarta.annotation.Nullable + private String code; + + public static final String SERIALIZED_NAME_ERROR_DATA = "errorData"; + + @SerializedName(SERIALIZED_NAME_ERROR_DATA) + @jakarta.annotation.Nullable + private String errorData; + + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + @jakarta.annotation.Nullable + private Object data; + + public static final String SERIALIZED_NAME_SUB_DATA = "subData"; + + @SerializedName(SERIALIZED_NAME_SUB_DATA) + @jakarta.annotation.Nullable + private Object subData; + + public static final String SERIALIZED_NAME_PARAMS = "params"; + + @SerializedName(SERIALIZED_NAME_PARAMS) + @jakarta.annotation.Nullable + private Object params; + + public VerifyB402PaymentV1Response2() {} + + public VerifyB402PaymentV1Response2 status(@jakarta.annotation.Nullable String status) { + this.status = status; + return this; + } + + /** + * Get status + * + * @return status + */ + @jakarta.annotation.Nullable + public String getStatus() { + return status; + } + + public void setStatus(@jakarta.annotation.Nullable String status) { + this.status = status; + } + + public VerifyB402PaymentV1Response2 type(@jakarta.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * + * @return type + */ + @jakarta.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@jakarta.annotation.Nullable String type) { + this.type = type; + } + + public VerifyB402PaymentV1Response2 code(@jakarta.annotation.Nullable String code) { + this.code = code; + return this; + } + + /** + * Get code + * + * @return code + */ + @jakarta.annotation.Nullable + public String getCode() { + return code; + } + + public void setCode(@jakarta.annotation.Nullable String code) { + this.code = code; + } + + public VerifyB402PaymentV1Response2 errorData(@jakarta.annotation.Nullable String errorData) { + this.errorData = errorData; + return this; + } + + /** + * Get errorData + * + * @return errorData + */ + @jakarta.annotation.Nullable + public String getErrorData() { + return errorData; + } + + public void setErrorData(@jakarta.annotation.Nullable String errorData) { + this.errorData = errorData; + } + + public VerifyB402PaymentV1Response2 data(@jakarta.annotation.Nullable Object data) { + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @jakarta.annotation.Nullable + public Object getData() { + return data; + } + + public void setData(@jakarta.annotation.Nullable Object data) { + this.data = data; + } + + public VerifyB402PaymentV1Response2 subData(@jakarta.annotation.Nullable Object subData) { + this.subData = subData; + return this; + } + + /** + * Get subData + * + * @return subData + */ + @jakarta.annotation.Nullable + public Object getSubData() { + return subData; + } + + public void setSubData(@jakarta.annotation.Nullable Object subData) { + this.subData = subData; + } + + public VerifyB402PaymentV1Response2 params(@jakarta.annotation.Nullable Object params) { + this.params = params; + return this; + } + + /** + * Get params + * + * @return params + */ + @jakarta.annotation.Nullable + public Object getParams() { + return params; + } + + public void setParams(@jakarta.annotation.Nullable Object params) { + this.params = params; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + VerifyB402PaymentV1Response2 verifyB402PaymentV1Response2 = + (VerifyB402PaymentV1Response2) o; + return Objects.equals(this.status, verifyB402PaymentV1Response2.status) + && Objects.equals(this.type, verifyB402PaymentV1Response2.type) + && Objects.equals(this.code, verifyB402PaymentV1Response2.code) + && Objects.equals(this.errorData, verifyB402PaymentV1Response2.errorData) + && Objects.equals(this.data, verifyB402PaymentV1Response2.data) + && Objects.equals(this.subData, verifyB402PaymentV1Response2.subData) + && Objects.equals(this.params, verifyB402PaymentV1Response2.params); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(status, type, code, errorData, data, subData, params); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VerifyB402PaymentV1Response2 {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" errorData: ").append(toIndentedString(errorData)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" subData: ").append(toIndentedString(subData)).append("\n"); + sb.append(" params: ").append(toIndentedString(params)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object statusValue = getStatus(); + String statusValueAsString = ""; + statusValueAsString = statusValue.toString(); + sb.append("status=").append(urlEncode(statusValueAsString)).append(""); + Object typeValue = getType(); + String typeValueAsString = ""; + typeValueAsString = typeValue.toString(); + sb.append("type=").append(urlEncode(typeValueAsString)).append(""); + Object codeValue = getCode(); + String codeValueAsString = ""; + codeValueAsString = codeValue.toString(); + sb.append("code=").append(urlEncode(codeValueAsString)).append(""); + Object errorDataValue = getErrorData(); + String errorDataValueAsString = ""; + errorDataValueAsString = errorDataValue.toString(); + sb.append("errorData=").append(urlEncode(errorDataValueAsString)).append(""); + Object dataValue = getData(); + String dataValueAsString = ""; + dataValueAsString = dataValue.toString(); + sb.append("data=").append(urlEncode(dataValueAsString)).append(""); + Object subDataValue = getSubData(); + String subDataValueAsString = ""; + subDataValueAsString = subDataValue.toString(); + sb.append("subData=").append(urlEncode(subDataValueAsString)).append(""); + Object paramsValue = getParams(); + String paramsValueAsString = ""; + paramsValueAsString = paramsValue.toString(); + sb.append("params=").append(urlEncode(paramsValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("status"); + openapiFields.add("type"); + openapiFields.add("code"); + openapiFields.add("errorData"); + openapiFields.add("data"); + openapiFields.add("subData"); + openapiFields.add("params"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * VerifyB402PaymentV1Response2 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!VerifyB402PaymentV1Response2.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in VerifyB402PaymentV1Response2 is not" + + " found in the empty JSON string", + VerifyB402PaymentV1Response2.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) + && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `status` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("status").toString())); + } + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) + && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `type` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("type").toString())); + } + if ((jsonObj.get("code") != null && !jsonObj.get("code").isJsonNull()) + && !jsonObj.get("code").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `code` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("code").toString())); + } + if ((jsonObj.get("errorData") != null && !jsonObj.get("errorData").isJsonNull()) + && !jsonObj.get("errorData").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `errorData` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("errorData").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!VerifyB402PaymentV1Response2.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'VerifyB402PaymentV1Response2' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(VerifyB402PaymentV1Response2.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, VerifyB402PaymentV1Response2 value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public VerifyB402PaymentV1Response2 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of VerifyB402PaymentV1Response2 given an JSON string + * + * @param jsonString JSON string + * @return An instance of VerifyB402PaymentV1Response2 + * @throws IOException if the JSON string is invalid with respect to + * VerifyB402PaymentV1Response2 + */ + public static VerifyB402PaymentV1Response2 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, VerifyB402PaymentV1Response2.class); + } + + /** + * Convert an instance of VerifyB402PaymentV1Response2 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/VerifyB402PaymentV2Request.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/VerifyB402PaymentV2Request.java new file mode 100644 index 0000000..dc8860f --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/VerifyB402PaymentV2Request.java @@ -0,0 +1,220 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** VerifyB402PaymentV2Request */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class VerifyB402PaymentV2Request { + public static final String SERIALIZED_NAME_BODY = "body"; + + @SerializedName(SERIALIZED_NAME_BODY) + @jakarta.annotation.Nonnull + private VerifyB402PaymentV2RequestBody body; + + public VerifyB402PaymentV2Request() {} + + public VerifyB402PaymentV2Request body( + @jakarta.annotation.Nonnull VerifyB402PaymentV2RequestBody body) { + this.body = body; + return this; + } + + /** + * Get body + * + * @return body + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public VerifyB402PaymentV2RequestBody getBody() { + return body; + } + + public void setBody(@jakarta.annotation.Nonnull VerifyB402PaymentV2RequestBody body) { + this.body = body; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + VerifyB402PaymentV2Request verifyB402PaymentV2Request = (VerifyB402PaymentV2Request) o; + return Objects.equals(this.body, verifyB402PaymentV2Request.body); + } + + @Override + public int hashCode() { + return Objects.hash(body); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VerifyB402PaymentV2Request {\n"); + sb.append(" body: ").append(toIndentedString(body)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object bodyValue = getBody(); + String bodyValueAsString = ""; + bodyValueAsString = bodyValue.toString(); + sb.append("body=").append(urlEncode(bodyValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("body"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("body"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to VerifyB402PaymentV2Request + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!VerifyB402PaymentV2Request.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in VerifyB402PaymentV2Request is not" + + " found in the empty JSON string", + VerifyB402PaymentV2Request.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : VerifyB402PaymentV2Request.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `body` + VerifyB402PaymentV2RequestBody.validateJsonElement(jsonObj.get("body")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!VerifyB402PaymentV2Request.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'VerifyB402PaymentV2Request' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(VerifyB402PaymentV2Request.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, VerifyB402PaymentV2Request value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public VerifyB402PaymentV2Request read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of VerifyB402PaymentV2Request given an JSON string + * + * @param jsonString JSON string + * @return An instance of VerifyB402PaymentV2Request + * @throws IOException if the JSON string is invalid with respect to VerifyB402PaymentV2Request + */ + public static VerifyB402PaymentV2Request fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, VerifyB402PaymentV2Request.class); + } + + /** + * Convert an instance of VerifyB402PaymentV2Request to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/VerifyB402PaymentV2RequestBody.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/VerifyB402PaymentV2RequestBody.java new file mode 100644 index 0000000..04e934c --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/VerifyB402PaymentV2RequestBody.java @@ -0,0 +1,365 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** VerifyB402PaymentV2RequestBody */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class VerifyB402PaymentV2RequestBody { + /** Gets or Sets x402Version */ + @JsonAdapter(X402VersionEnum.Adapter.class) + public enum X402VersionEnum { + X402_VERSION_2(2); + + private Integer value; + + X402VersionEnum(Integer value) { + this.value = value; + } + + public Integer getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static X402VersionEnum fromValue(Integer value) { + for (X402VersionEnum b : X402VersionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final X402VersionEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public X402VersionEnum read(final JsonReader jsonReader) throws IOException { + Integer value = jsonReader.nextInt(); + return X402VersionEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + Integer value = jsonElement.getAsInt(); + X402VersionEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_X402_VERSION = "x402Version"; + + @SerializedName(SERIALIZED_NAME_X402_VERSION) + @jakarta.annotation.Nonnull + private X402VersionEnum x402Version; + + public static final String SERIALIZED_NAME_PAYMENT_PAYLOAD = "paymentPayload"; + + @SerializedName(SERIALIZED_NAME_PAYMENT_PAYLOAD) + @jakarta.annotation.Nonnull + private VerifyB402PaymentV2RequestBodyPaymentPayload paymentPayload; + + public static final String SERIALIZED_NAME_PAYMENT_REQUIREMENTS = "paymentRequirements"; + + @SerializedName(SERIALIZED_NAME_PAYMENT_REQUIREMENTS) + @jakarta.annotation.Nonnull + private VerifyB402PaymentV2RequestBodyPaymentPayloadAccepted paymentRequirements; + + public VerifyB402PaymentV2RequestBody() {} + + public VerifyB402PaymentV2RequestBody x402Version( + @jakarta.annotation.Nonnull X402VersionEnum x402Version) { + this.x402Version = x402Version; + return this; + } + + /** + * Get x402Version + * + * @return x402Version + */ + @jakarta.annotation.Nonnull + @NotNull + public X402VersionEnum getX402Version() { + return x402Version; + } + + public void setX402Version(@jakarta.annotation.Nonnull X402VersionEnum x402Version) { + this.x402Version = x402Version; + } + + public VerifyB402PaymentV2RequestBody paymentPayload( + @jakarta.annotation.Nonnull + VerifyB402PaymentV2RequestBodyPaymentPayload paymentPayload) { + this.paymentPayload = paymentPayload; + return this; + } + + /** + * Get paymentPayload + * + * @return paymentPayload + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public VerifyB402PaymentV2RequestBodyPaymentPayload getPaymentPayload() { + return paymentPayload; + } + + public void setPaymentPayload( + @jakarta.annotation.Nonnull + VerifyB402PaymentV2RequestBodyPaymentPayload paymentPayload) { + this.paymentPayload = paymentPayload; + } + + public VerifyB402PaymentV2RequestBody paymentRequirements( + @jakarta.annotation.Nonnull + VerifyB402PaymentV2RequestBodyPaymentPayloadAccepted paymentRequirements) { + this.paymentRequirements = paymentRequirements; + return this; + } + + /** + * Get paymentRequirements + * + * @return paymentRequirements + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public VerifyB402PaymentV2RequestBodyPaymentPayloadAccepted getPaymentRequirements() { + return paymentRequirements; + } + + public void setPaymentRequirements( + @jakarta.annotation.Nonnull + VerifyB402PaymentV2RequestBodyPaymentPayloadAccepted paymentRequirements) { + this.paymentRequirements = paymentRequirements; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + VerifyB402PaymentV2RequestBody verifyB402PaymentV2RequestBody = + (VerifyB402PaymentV2RequestBody) o; + return Objects.equals(this.x402Version, verifyB402PaymentV2RequestBody.x402Version) + && Objects.equals( + this.paymentPayload, verifyB402PaymentV2RequestBody.paymentPayload) + && Objects.equals( + this.paymentRequirements, + verifyB402PaymentV2RequestBody.paymentRequirements); + } + + @Override + public int hashCode() { + return Objects.hash(x402Version, paymentPayload, paymentRequirements); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VerifyB402PaymentV2RequestBody {\n"); + sb.append(" x402Version: ").append(toIndentedString(x402Version)).append("\n"); + sb.append(" paymentPayload: ").append(toIndentedString(paymentPayload)).append("\n"); + sb.append(" paymentRequirements: ") + .append(toIndentedString(paymentRequirements)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object x402VersionValue = getX402Version(); + String x402VersionValueAsString = ""; + x402VersionValueAsString = x402VersionValue.toString(); + sb.append("x402Version=").append(urlEncode(x402VersionValueAsString)).append(""); + Object paymentPayloadValue = getPaymentPayload(); + String paymentPayloadValueAsString = ""; + paymentPayloadValueAsString = paymentPayloadValue.toString(); + sb.append("paymentPayload=").append(urlEncode(paymentPayloadValueAsString)).append(""); + Object paymentRequirementsValue = getPaymentRequirements(); + String paymentRequirementsValueAsString = ""; + paymentRequirementsValueAsString = paymentRequirementsValue.toString(); + sb.append("paymentRequirements=") + .append(urlEncode(paymentRequirementsValueAsString)) + .append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("x402Version"); + openapiFields.add("paymentPayload"); + openapiFields.add("paymentRequirements"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("x402Version"); + openapiRequiredFields.add("paymentPayload"); + openapiRequiredFields.add("paymentRequirements"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * VerifyB402PaymentV2RequestBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!VerifyB402PaymentV2RequestBody.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in VerifyB402PaymentV2RequestBody is not" + + " found in the empty JSON string", + VerifyB402PaymentV2RequestBody.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : VerifyB402PaymentV2RequestBody.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `x402Version` + X402VersionEnum.validateJsonElement(jsonObj.get("x402Version")); + // validate the required field `paymentPayload` + VerifyB402PaymentV2RequestBodyPaymentPayload.validateJsonElement( + jsonObj.get("paymentPayload")); + // validate the required field `paymentRequirements` + VerifyB402PaymentV2RequestBodyPaymentPayloadAccepted.validateJsonElement( + jsonObj.get("paymentRequirements")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!VerifyB402PaymentV2RequestBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'VerifyB402PaymentV2RequestBody' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(VerifyB402PaymentV2RequestBody.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, VerifyB402PaymentV2RequestBody value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public VerifyB402PaymentV2RequestBody read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of VerifyB402PaymentV2RequestBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of VerifyB402PaymentV2RequestBody + * @throws IOException if the JSON string is invalid with respect to + * VerifyB402PaymentV2RequestBody + */ + public static VerifyB402PaymentV2RequestBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, VerifyB402PaymentV2RequestBody.class); + } + + /** + * Convert an instance of VerifyB402PaymentV2RequestBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/VerifyB402PaymentV2RequestBodyPaymentPayload.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/VerifyB402PaymentV2RequestBodyPaymentPayload.java new file mode 100644 index 0000000..0d11888 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/VerifyB402PaymentV2RequestBodyPaymentPayload.java @@ -0,0 +1,450 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** VerifyB402PaymentV2RequestBodyPaymentPayload */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class VerifyB402PaymentV2RequestBodyPaymentPayload { + /** Gets or Sets x402Version */ + @JsonAdapter(X402VersionEnum.Adapter.class) + public enum X402VersionEnum { + X402_VERSION_2(2); + + private Integer value; + + X402VersionEnum(Integer value) { + this.value = value; + } + + public Integer getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static X402VersionEnum fromValue(Integer value) { + for (X402VersionEnum b : X402VersionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final X402VersionEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public X402VersionEnum read(final JsonReader jsonReader) throws IOException { + Integer value = jsonReader.nextInt(); + return X402VersionEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + Integer value = jsonElement.getAsInt(); + X402VersionEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_X402_VERSION = "x402Version"; + + @SerializedName(SERIALIZED_NAME_X402_VERSION) + @jakarta.annotation.Nonnull + private X402VersionEnum x402Version; + + public static final String SERIALIZED_NAME_RESOURCE = "resource"; + + @SerializedName(SERIALIZED_NAME_RESOURCE) + @jakarta.annotation.Nonnull + private VerifyB402PaymentV2RequestBodyPaymentPayloadResource resource; + + public static final String SERIALIZED_NAME_ACCEPTED = "accepted"; + + @SerializedName(SERIALIZED_NAME_ACCEPTED) + @jakarta.annotation.Nonnull + private VerifyB402PaymentV2RequestBodyPaymentPayloadAccepted accepted; + + public static final String SERIALIZED_NAME_PAYLOAD = "payload"; + + @SerializedName(SERIALIZED_NAME_PAYLOAD) + @jakarta.annotation.Nonnull + private VerifyB402PaymentV2RequestBodyPaymentPayloadPayload payload; + + public static final String SERIALIZED_NAME_EXTENSIONS = "extensions"; + + @SerializedName(SERIALIZED_NAME_EXTENSIONS) + @jakarta.annotation.Nullable + private VerifyB402PaymentV2RequestBodyPaymentPayloadExtensions extensions; + + public VerifyB402PaymentV2RequestBodyPaymentPayload() {} + + public VerifyB402PaymentV2RequestBodyPaymentPayload x402Version( + @jakarta.annotation.Nonnull X402VersionEnum x402Version) { + this.x402Version = x402Version; + return this; + } + + /** + * Get x402Version + * + * @return x402Version + */ + @jakarta.annotation.Nonnull + @NotNull + public X402VersionEnum getX402Version() { + return x402Version; + } + + public void setX402Version(@jakarta.annotation.Nonnull X402VersionEnum x402Version) { + this.x402Version = x402Version; + } + + public VerifyB402PaymentV2RequestBodyPaymentPayload resource( + @jakarta.annotation.Nonnull + VerifyB402PaymentV2RequestBodyPaymentPayloadResource resource) { + this.resource = resource; + return this; + } + + /** + * Get resource + * + * @return resource + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public VerifyB402PaymentV2RequestBodyPaymentPayloadResource getResource() { + return resource; + } + + public void setResource( + @jakarta.annotation.Nonnull + VerifyB402PaymentV2RequestBodyPaymentPayloadResource resource) { + this.resource = resource; + } + + public VerifyB402PaymentV2RequestBodyPaymentPayload accepted( + @jakarta.annotation.Nonnull + VerifyB402PaymentV2RequestBodyPaymentPayloadAccepted accepted) { + this.accepted = accepted; + return this; + } + + /** + * Get accepted + * + * @return accepted + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public VerifyB402PaymentV2RequestBodyPaymentPayloadAccepted getAccepted() { + return accepted; + } + + public void setAccepted( + @jakarta.annotation.Nonnull + VerifyB402PaymentV2RequestBodyPaymentPayloadAccepted accepted) { + this.accepted = accepted; + } + + public VerifyB402PaymentV2RequestBodyPaymentPayload payload( + @jakarta.annotation.Nonnull + VerifyB402PaymentV2RequestBodyPaymentPayloadPayload payload) { + this.payload = payload; + return this; + } + + /** + * Get payload + * + * @return payload + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public VerifyB402PaymentV2RequestBodyPaymentPayloadPayload getPayload() { + return payload; + } + + public void setPayload( + @jakarta.annotation.Nonnull + VerifyB402PaymentV2RequestBodyPaymentPayloadPayload payload) { + this.payload = payload; + } + + public VerifyB402PaymentV2RequestBodyPaymentPayload extensions( + @jakarta.annotation.Nullable + VerifyB402PaymentV2RequestBodyPaymentPayloadExtensions extensions) { + this.extensions = extensions; + return this; + } + + /** + * Get extensions + * + * @return extensions + */ + @jakarta.annotation.Nullable + @Valid + public VerifyB402PaymentV2RequestBodyPaymentPayloadExtensions getExtensions() { + return extensions; + } + + public void setExtensions( + @jakarta.annotation.Nullable + VerifyB402PaymentV2RequestBodyPaymentPayloadExtensions extensions) { + this.extensions = extensions; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + VerifyB402PaymentV2RequestBodyPaymentPayload verifyB402PaymentV2RequestBodyPaymentPayload = + (VerifyB402PaymentV2RequestBodyPaymentPayload) o; + return Objects.equals( + this.x402Version, verifyB402PaymentV2RequestBodyPaymentPayload.x402Version) + && Objects.equals( + this.resource, verifyB402PaymentV2RequestBodyPaymentPayload.resource) + && Objects.equals( + this.accepted, verifyB402PaymentV2RequestBodyPaymentPayload.accepted) + && Objects.equals( + this.payload, verifyB402PaymentV2RequestBodyPaymentPayload.payload) + && Objects.equals( + this.extensions, verifyB402PaymentV2RequestBodyPaymentPayload.extensions); + } + + @Override + public int hashCode() { + return Objects.hash(x402Version, resource, accepted, payload, extensions); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VerifyB402PaymentV2RequestBodyPaymentPayload {\n"); + sb.append(" x402Version: ").append(toIndentedString(x402Version)).append("\n"); + sb.append(" resource: ").append(toIndentedString(resource)).append("\n"); + sb.append(" accepted: ").append(toIndentedString(accepted)).append("\n"); + sb.append(" payload: ").append(toIndentedString(payload)).append("\n"); + sb.append(" extensions: ").append(toIndentedString(extensions)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object x402VersionValue = getX402Version(); + String x402VersionValueAsString = ""; + x402VersionValueAsString = x402VersionValue.toString(); + sb.append("x402Version=").append(urlEncode(x402VersionValueAsString)).append(""); + Object resourceValue = getResource(); + String resourceValueAsString = ""; + resourceValueAsString = resourceValue.toString(); + sb.append("resource=").append(urlEncode(resourceValueAsString)).append(""); + Object acceptedValue = getAccepted(); + String acceptedValueAsString = ""; + acceptedValueAsString = acceptedValue.toString(); + sb.append("accepted=").append(urlEncode(acceptedValueAsString)).append(""); + Object payloadValue = getPayload(); + String payloadValueAsString = ""; + payloadValueAsString = payloadValue.toString(); + sb.append("payload=").append(urlEncode(payloadValueAsString)).append(""); + Object extensionsValue = getExtensions(); + String extensionsValueAsString = ""; + extensionsValueAsString = extensionsValue.toString(); + sb.append("extensions=").append(urlEncode(extensionsValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("x402Version"); + openapiFields.add("resource"); + openapiFields.add("accepted"); + openapiFields.add("payload"); + openapiFields.add("extensions"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("x402Version"); + openapiRequiredFields.add("resource"); + openapiRequiredFields.add("accepted"); + openapiRequiredFields.add("payload"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * VerifyB402PaymentV2RequestBodyPaymentPayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!VerifyB402PaymentV2RequestBodyPaymentPayload.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " VerifyB402PaymentV2RequestBodyPaymentPayload is not found" + + " in the empty JSON string", + VerifyB402PaymentV2RequestBodyPaymentPayload.openapiRequiredFields + .toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : + VerifyB402PaymentV2RequestBodyPaymentPayload.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `x402Version` + X402VersionEnum.validateJsonElement(jsonObj.get("x402Version")); + // validate the required field `resource` + VerifyB402PaymentV2RequestBodyPaymentPayloadResource.validateJsonElement( + jsonObj.get("resource")); + // validate the required field `accepted` + VerifyB402PaymentV2RequestBodyPaymentPayloadAccepted.validateJsonElement( + jsonObj.get("accepted")); + // validate the required field `payload` + VerifyB402PaymentV2RequestBodyPaymentPayloadPayload.validateJsonElement( + jsonObj.get("payload")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!VerifyB402PaymentV2RequestBodyPaymentPayload.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'VerifyB402PaymentV2RequestBodyPaymentPayload' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, + TypeToken.get(VerifyB402PaymentV2RequestBodyPaymentPayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, VerifyB402PaymentV2RequestBodyPaymentPayload value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public VerifyB402PaymentV2RequestBodyPaymentPayload read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of VerifyB402PaymentV2RequestBodyPaymentPayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of VerifyB402PaymentV2RequestBodyPaymentPayload + * @throws IOException if the JSON string is invalid with respect to + * VerifyB402PaymentV2RequestBodyPaymentPayload + */ + public static VerifyB402PaymentV2RequestBodyPaymentPayload fromJson(String jsonString) + throws IOException { + return JSON.getGson() + .fromJson(jsonString, VerifyB402PaymentV2RequestBodyPaymentPayload.class); + } + + /** + * Convert an instance of VerifyB402PaymentV2RequestBodyPaymentPayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/VerifyB402PaymentV2RequestBodyPaymentPayloadAccepted.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/VerifyB402PaymentV2RequestBodyPaymentPayloadAccepted.java new file mode 100644 index 0000000..77cfe17 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/VerifyB402PaymentV2RequestBodyPaymentPayloadAccepted.java @@ -0,0 +1,549 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** VerifyB402PaymentV2RequestBodyPaymentPayloadAccepted */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class VerifyB402PaymentV2RequestBodyPaymentPayloadAccepted { + /** Gets or Sets scheme */ + @JsonAdapter(SchemeEnum.Adapter.class) + public enum SchemeEnum { + exact("exact"), + + upto("upto"); + + private String value; + + SchemeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static SchemeEnum fromValue(String value) { + for (SchemeEnum b : SchemeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final SchemeEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public SchemeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return SchemeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + SchemeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_SCHEME = "scheme"; + + @SerializedName(SERIALIZED_NAME_SCHEME) + @jakarta.annotation.Nonnull + private SchemeEnum scheme; + + public static final String SERIALIZED_NAME_NETWORK = "network"; + + @SerializedName(SERIALIZED_NAME_NETWORK) + @jakarta.annotation.Nonnull + private String network; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + + @SerializedName(SERIALIZED_NAME_AMOUNT) + @jakarta.annotation.Nonnull + private String amount; + + public static final String SERIALIZED_NAME_ASSET = "asset"; + + @SerializedName(SERIALIZED_NAME_ASSET) + @jakarta.annotation.Nonnull + private String asset; + + public static final String SERIALIZED_NAME_PAY_TO = "payTo"; + + @SerializedName(SERIALIZED_NAME_PAY_TO) + @jakarta.annotation.Nonnull + private String payTo; + + public static final String SERIALIZED_NAME_MAX_TIMEOUT_SECONDS = "maxTimeoutSeconds"; + + @SerializedName(SERIALIZED_NAME_MAX_TIMEOUT_SECONDS) + @jakarta.annotation.Nonnull + private Integer maxTimeoutSeconds; + + public static final String SERIALIZED_NAME_EXTRA = "extra"; + + @SerializedName(SERIALIZED_NAME_EXTRA) + @jakarta.annotation.Nonnull + private B402PaymentRequirementsV2Extra extra; + + public VerifyB402PaymentV2RequestBodyPaymentPayloadAccepted() {} + + public VerifyB402PaymentV2RequestBodyPaymentPayloadAccepted scheme( + @jakarta.annotation.Nonnull SchemeEnum scheme) { + this.scheme = scheme; + return this; + } + + /** + * Get scheme + * + * @return scheme + */ + @jakarta.annotation.Nonnull + @NotNull + public SchemeEnum getScheme() { + return scheme; + } + + public void setScheme(@jakarta.annotation.Nonnull SchemeEnum scheme) { + this.scheme = scheme; + } + + public VerifyB402PaymentV2RequestBodyPaymentPayloadAccepted network( + @jakarta.annotation.Nonnull String network) { + this.network = network; + return this; + } + + /** + * Get network + * + * @return network + */ + @jakarta.annotation.Nonnull + @NotNull + public String getNetwork() { + return network; + } + + public void setNetwork(@jakarta.annotation.Nonnull String network) { + this.network = network; + } + + public VerifyB402PaymentV2RequestBodyPaymentPayloadAccepted amount( + @jakarta.annotation.Nonnull String amount) { + this.amount = amount; + return this; + } + + /** + * Get amount + * + * @return amount + */ + @jakarta.annotation.Nonnull + @NotNull + @Pattern(regexp = "^[0-9]+$") + public String getAmount() { + return amount; + } + + public void setAmount(@jakarta.annotation.Nonnull String amount) { + this.amount = amount; + } + + public VerifyB402PaymentV2RequestBodyPaymentPayloadAccepted asset( + @jakarta.annotation.Nonnull String asset) { + this.asset = asset; + return this; + } + + /** + * Get asset + * + * @return asset + */ + @jakarta.annotation.Nonnull + @NotNull + public String getAsset() { + return asset; + } + + public void setAsset(@jakarta.annotation.Nonnull String asset) { + this.asset = asset; + } + + public VerifyB402PaymentV2RequestBodyPaymentPayloadAccepted payTo( + @jakarta.annotation.Nonnull String payTo) { + this.payTo = payTo; + return this; + } + + /** + * Get payTo + * + * @return payTo + */ + @jakarta.annotation.Nonnull + @NotNull + public String getPayTo() { + return payTo; + } + + public void setPayTo(@jakarta.annotation.Nonnull String payTo) { + this.payTo = payTo; + } + + public VerifyB402PaymentV2RequestBodyPaymentPayloadAccepted maxTimeoutSeconds( + @jakarta.annotation.Nonnull Integer maxTimeoutSeconds) { + this.maxTimeoutSeconds = maxTimeoutSeconds; + return this; + } + + /** + * Get maxTimeoutSeconds + * + * @return maxTimeoutSeconds + */ + @jakarta.annotation.Nonnull + @NotNull + public Integer getMaxTimeoutSeconds() { + return maxTimeoutSeconds; + } + + public void setMaxTimeoutSeconds(@jakarta.annotation.Nonnull Integer maxTimeoutSeconds) { + this.maxTimeoutSeconds = maxTimeoutSeconds; + } + + public VerifyB402PaymentV2RequestBodyPaymentPayloadAccepted extra( + @jakarta.annotation.Nonnull B402PaymentRequirementsV2Extra extra) { + this.extra = extra; + return this; + } + + /** + * Get extra + * + * @return extra + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public B402PaymentRequirementsV2Extra getExtra() { + return extra; + } + + public void setExtra(@jakarta.annotation.Nonnull B402PaymentRequirementsV2Extra extra) { + this.extra = extra; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + VerifyB402PaymentV2RequestBodyPaymentPayloadAccepted + verifyB402PaymentV2RequestBodyPaymentPayloadAccepted = + (VerifyB402PaymentV2RequestBodyPaymentPayloadAccepted) o; + return Objects.equals( + this.scheme, verifyB402PaymentV2RequestBodyPaymentPayloadAccepted.scheme) + && Objects.equals( + this.network, verifyB402PaymentV2RequestBodyPaymentPayloadAccepted.network) + && Objects.equals( + this.amount, verifyB402PaymentV2RequestBodyPaymentPayloadAccepted.amount) + && Objects.equals( + this.asset, verifyB402PaymentV2RequestBodyPaymentPayloadAccepted.asset) + && Objects.equals( + this.payTo, verifyB402PaymentV2RequestBodyPaymentPayloadAccepted.payTo) + && Objects.equals( + this.maxTimeoutSeconds, + verifyB402PaymentV2RequestBodyPaymentPayloadAccepted.maxTimeoutSeconds) + && Objects.equals( + this.extra, verifyB402PaymentV2RequestBodyPaymentPayloadAccepted.extra); + } + + @Override + public int hashCode() { + return Objects.hash(scheme, network, amount, asset, payTo, maxTimeoutSeconds, extra); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VerifyB402PaymentV2RequestBodyPaymentPayloadAccepted {\n"); + sb.append(" scheme: ").append(toIndentedString(scheme)).append("\n"); + sb.append(" network: ").append(toIndentedString(network)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" asset: ").append(toIndentedString(asset)).append("\n"); + sb.append(" payTo: ").append(toIndentedString(payTo)).append("\n"); + sb.append(" maxTimeoutSeconds: ").append(toIndentedString(maxTimeoutSeconds)).append("\n"); + sb.append(" extra: ").append(toIndentedString(extra)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object schemeValue = getScheme(); + String schemeValueAsString = ""; + schemeValueAsString = schemeValue.toString(); + sb.append("scheme=").append(urlEncode(schemeValueAsString)).append(""); + Object networkValue = getNetwork(); + String networkValueAsString = ""; + networkValueAsString = networkValue.toString(); + sb.append("network=").append(urlEncode(networkValueAsString)).append(""); + Object amountValue = getAmount(); + String amountValueAsString = ""; + amountValueAsString = amountValue.toString(); + sb.append("amount=").append(urlEncode(amountValueAsString)).append(""); + Object assetValue = getAsset(); + String assetValueAsString = ""; + assetValueAsString = assetValue.toString(); + sb.append("asset=").append(urlEncode(assetValueAsString)).append(""); + Object payToValue = getPayTo(); + String payToValueAsString = ""; + payToValueAsString = payToValue.toString(); + sb.append("payTo=").append(urlEncode(payToValueAsString)).append(""); + Object maxTimeoutSecondsValue = getMaxTimeoutSeconds(); + String maxTimeoutSecondsValueAsString = ""; + maxTimeoutSecondsValueAsString = maxTimeoutSecondsValue.toString(); + sb.append("maxTimeoutSeconds=") + .append(urlEncode(maxTimeoutSecondsValueAsString)) + .append(""); + Object extraValue = getExtra(); + String extraValueAsString = ""; + extraValueAsString = extraValue.toString(); + sb.append("extra=").append(urlEncode(extraValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("scheme"); + openapiFields.add("network"); + openapiFields.add("amount"); + openapiFields.add("asset"); + openapiFields.add("payTo"); + openapiFields.add("maxTimeoutSeconds"); + openapiFields.add("extra"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("scheme"); + openapiRequiredFields.add("network"); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("asset"); + openapiRequiredFields.add("payTo"); + openapiRequiredFields.add("maxTimeoutSeconds"); + openapiRequiredFields.add("extra"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * VerifyB402PaymentV2RequestBodyPaymentPayloadAccepted + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!VerifyB402PaymentV2RequestBodyPaymentPayloadAccepted.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " VerifyB402PaymentV2RequestBodyPaymentPayloadAccepted is not" + + " found in the empty JSON string", + VerifyB402PaymentV2RequestBodyPaymentPayloadAccepted + .openapiRequiredFields + .toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : + VerifyB402PaymentV2RequestBodyPaymentPayloadAccepted.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("scheme").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `scheme` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("scheme").toString())); + } + // validate the required field `scheme` + SchemeEnum.validateJsonElement(jsonObj.get("scheme")); + if (!jsonObj.get("network").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `network` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("network").toString())); + } + if (!jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `amount` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("amount").toString())); + } + if (!jsonObj.get("asset").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `asset` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("asset").toString())); + } + if (!jsonObj.get("payTo").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `payTo` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("payTo").toString())); + } + // validate the required field `extra` + B402PaymentRequirementsV2Extra.validateJsonElement(jsonObj.get("extra")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!VerifyB402PaymentV2RequestBodyPaymentPayloadAccepted.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'VerifyB402PaymentV2RequestBodyPaymentPayloadAccepted' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, + TypeToken.get( + VerifyB402PaymentV2RequestBodyPaymentPayloadAccepted.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, + VerifyB402PaymentV2RequestBodyPaymentPayloadAccepted value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public VerifyB402PaymentV2RequestBodyPaymentPayloadAccepted read( + JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of VerifyB402PaymentV2RequestBodyPaymentPayloadAccepted given an JSON + * string + * + * @param jsonString JSON string + * @return An instance of VerifyB402PaymentV2RequestBodyPaymentPayloadAccepted + * @throws IOException if the JSON string is invalid with respect to + * VerifyB402PaymentV2RequestBodyPaymentPayloadAccepted + */ + public static VerifyB402PaymentV2RequestBodyPaymentPayloadAccepted fromJson(String jsonString) + throws IOException { + return JSON.getGson() + .fromJson(jsonString, VerifyB402PaymentV2RequestBodyPaymentPayloadAccepted.class); + } + + /** + * Convert an instance of VerifyB402PaymentV2RequestBodyPaymentPayloadAccepted to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/VerifyB402PaymentV2RequestBodyPaymentPayloadExtensions.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/VerifyB402PaymentV2RequestBodyPaymentPayloadExtensions.java new file mode 100644 index 0000000..db0723d --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/VerifyB402PaymentV2RequestBodyPaymentPayloadExtensions.java @@ -0,0 +1,335 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** VerifyB402PaymentV2RequestBodyPaymentPayloadExtensions */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class VerifyB402PaymentV2RequestBodyPaymentPayloadExtensions { + public static final String SERIALIZED_NAME_BAZAAR = "bazaar"; + + @SerializedName(SERIALIZED_NAME_BAZAAR) + @jakarta.annotation.Nullable + private VerifyB402PaymentV2RequestBodyPaymentPayloadExtensionsBazaar bazaar; + + public VerifyB402PaymentV2RequestBodyPaymentPayloadExtensions() {} + + public VerifyB402PaymentV2RequestBodyPaymentPayloadExtensions bazaar( + @jakarta.annotation.Nullable + VerifyB402PaymentV2RequestBodyPaymentPayloadExtensionsBazaar bazaar) { + this.bazaar = bazaar; + return this; + } + + /** + * Get bazaar + * + * @return bazaar + */ + @jakarta.annotation.Nullable + @Valid + public VerifyB402PaymentV2RequestBodyPaymentPayloadExtensionsBazaar getBazaar() { + return bazaar; + } + + public void setBazaar( + @jakarta.annotation.Nullable + VerifyB402PaymentV2RequestBodyPaymentPayloadExtensionsBazaar bazaar) { + this.bazaar = bazaar; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the VerifyB402PaymentV2RequestBodyPaymentPayloadExtensions instance itself + */ + public VerifyB402PaymentV2RequestBodyPaymentPayloadExtensions putAdditionalProperty( + String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + VerifyB402PaymentV2RequestBodyPaymentPayloadExtensions + verifyB402PaymentV2RequestBodyPaymentPayloadExtensions = + (VerifyB402PaymentV2RequestBodyPaymentPayloadExtensions) o; + return Objects.equals( + this.bazaar, verifyB402PaymentV2RequestBodyPaymentPayloadExtensions.bazaar) + && Objects.equals( + this.additionalProperties, + verifyB402PaymentV2RequestBodyPaymentPayloadExtensions + .additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(bazaar, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VerifyB402PaymentV2RequestBodyPaymentPayloadExtensions {\n"); + sb.append(" bazaar: ").append(toIndentedString(bazaar)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object bazaarValue = getBazaar(); + String bazaarValueAsString = ""; + bazaarValueAsString = bazaarValue.toString(); + sb.append("bazaar=").append(urlEncode(bazaarValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("bazaar"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * VerifyB402PaymentV2RequestBodyPaymentPayloadExtensions + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (!jsonElement.isJsonObject()) { + throw new IllegalArgumentException( + String.format( + "Expected json element to be a object type in the JSON string but got" + + " `%s`", + jsonElement.toString())); + } + + Map map = jsonElement.getAsJsonObject().asMap(); + // validate map items + for (JsonElement element : map.values()) {} + if (jsonElement == null) { + if (!VerifyB402PaymentV2RequestBodyPaymentPayloadExtensions.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " VerifyB402PaymentV2RequestBodyPaymentPayloadExtensions is" + + " not found in the empty JSON string", + VerifyB402PaymentV2RequestBodyPaymentPayloadExtensions + .openapiRequiredFields + .toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `bazaar` + if (jsonObj.get("bazaar") != null && !jsonObj.get("bazaar").isJsonNull()) { + VerifyB402PaymentV2RequestBodyPaymentPayloadExtensionsBazaar.validateJsonElement( + jsonObj.get("bazaar")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!VerifyB402PaymentV2RequestBodyPaymentPayloadExtensions.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'VerifyB402PaymentV2RequestBodyPaymentPayloadExtensions' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, + TypeToken.get( + VerifyB402PaymentV2RequestBodyPaymentPayloadExtensions.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, + VerifyB402PaymentV2RequestBodyPaymentPayloadExtensions value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public VerifyB402PaymentV2RequestBodyPaymentPayloadExtensions read( + JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + VerifyB402PaymentV2RequestBodyPaymentPayloadExtensions instance = + thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty( + entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty( + entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty( + entry.getKey(), + entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException( + String.format( + "The field `%s` has unknown primitive" + + " type. Value: %s", + entry.getKey(), + entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty( + entry.getKey(), + gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty( + entry.getKey(), + gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + }.nullSafe(); + } + } + + /** + * Create an instance of VerifyB402PaymentV2RequestBodyPaymentPayloadExtensions given an JSON + * string + * + * @param jsonString JSON string + * @return An instance of VerifyB402PaymentV2RequestBodyPaymentPayloadExtensions + * @throws IOException if the JSON string is invalid with respect to + * VerifyB402PaymentV2RequestBodyPaymentPayloadExtensions + */ + public static VerifyB402PaymentV2RequestBodyPaymentPayloadExtensions fromJson(String jsonString) + throws IOException { + return JSON.getGson() + .fromJson(jsonString, VerifyB402PaymentV2RequestBodyPaymentPayloadExtensions.class); + } + + /** + * Convert an instance of VerifyB402PaymentV2RequestBodyPaymentPayloadExtensions to an JSON + * string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/VerifyB402PaymentV2RequestBodyPaymentPayloadExtensionsBazaar.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/VerifyB402PaymentV2RequestBodyPaymentPayloadExtensionsBazaar.java new file mode 100644 index 0000000..a92ed9a --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/VerifyB402PaymentV2RequestBodyPaymentPayloadExtensionsBazaar.java @@ -0,0 +1,387 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** VerifyB402PaymentV2RequestBodyPaymentPayloadExtensionsBazaar */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class VerifyB402PaymentV2RequestBodyPaymentPayloadExtensionsBazaar { + public static final String SERIALIZED_NAME_INFO = "info"; + + @SerializedName(SERIALIZED_NAME_INFO) + @jakarta.annotation.Nonnull + private Map info; + + public static final String SERIALIZED_NAME_SCHEMA = "schema"; + + @SerializedName(SERIALIZED_NAME_SCHEMA) + @jakarta.annotation.Nonnull + private Map schema; + + public static final String SERIALIZED_NAME_ROUTE_TEMPLATE = "routeTemplate"; + + @SerializedName(SERIALIZED_NAME_ROUTE_TEMPLATE) + @jakarta.annotation.Nullable + private String routeTemplate; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @jakarta.annotation.Nullable + private String description; + + public VerifyB402PaymentV2RequestBodyPaymentPayloadExtensionsBazaar() {} + + public VerifyB402PaymentV2RequestBodyPaymentPayloadExtensionsBazaar info( + @jakarta.annotation.Nonnull Map info) { + this.info = info; + return this; + } + + public VerifyB402PaymentV2RequestBodyPaymentPayloadExtensionsBazaar putInfoItem( + String key, Object infoItem) { + if (this.info == null) { + this.info = new HashMap<>(); + } + this.info.put(key, infoItem); + return this; + } + + /** + * Get info + * + * @return info + */ + @jakarta.annotation.Nonnull + @NotNull + public Map getInfo() { + return info; + } + + public void setInfo(@jakarta.annotation.Nonnull Map info) { + this.info = info; + } + + public VerifyB402PaymentV2RequestBodyPaymentPayloadExtensionsBazaar schema( + @jakarta.annotation.Nonnull Map schema) { + this.schema = schema; + return this; + } + + public VerifyB402PaymentV2RequestBodyPaymentPayloadExtensionsBazaar putSchemaItem( + String key, Object schemaItem) { + if (this.schema == null) { + this.schema = new HashMap<>(); + } + this.schema.put(key, schemaItem); + return this; + } + + /** + * Get schema + * + * @return schema + */ + @jakarta.annotation.Nonnull + @NotNull + public Map getSchema() { + return schema; + } + + public void setSchema(@jakarta.annotation.Nonnull Map schema) { + this.schema = schema; + } + + public VerifyB402PaymentV2RequestBodyPaymentPayloadExtensionsBazaar routeTemplate( + @jakarta.annotation.Nullable String routeTemplate) { + this.routeTemplate = routeTemplate; + return this; + } + + /** + * Get routeTemplate + * + * @return routeTemplate + */ + @jakarta.annotation.Nullable + public String getRouteTemplate() { + return routeTemplate; + } + + public void setRouteTemplate(@jakarta.annotation.Nullable String routeTemplate) { + this.routeTemplate = routeTemplate; + } + + public VerifyB402PaymentV2RequestBodyPaymentPayloadExtensionsBazaar description( + @jakarta.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Get description + * + * @return description + */ + @jakarta.annotation.Nullable + public String getDescription() { + return description; + } + + public void setDescription(@jakarta.annotation.Nullable String description) { + this.description = description; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + VerifyB402PaymentV2RequestBodyPaymentPayloadExtensionsBazaar + verifyB402PaymentV2RequestBodyPaymentPayloadExtensionsBazaar = + (VerifyB402PaymentV2RequestBodyPaymentPayloadExtensionsBazaar) o; + return Objects.equals( + this.info, + verifyB402PaymentV2RequestBodyPaymentPayloadExtensionsBazaar.info) + && Objects.equals( + this.schema, + verifyB402PaymentV2RequestBodyPaymentPayloadExtensionsBazaar.schema) + && Objects.equals( + this.routeTemplate, + verifyB402PaymentV2RequestBodyPaymentPayloadExtensionsBazaar.routeTemplate) + && Objects.equals( + this.description, + verifyB402PaymentV2RequestBodyPaymentPayloadExtensionsBazaar.description); + } + + @Override + public int hashCode() { + return Objects.hash(info, schema, routeTemplate, description); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VerifyB402PaymentV2RequestBodyPaymentPayloadExtensionsBazaar {\n"); + sb.append(" info: ").append(toIndentedString(info)).append("\n"); + sb.append(" schema: ").append(toIndentedString(schema)).append("\n"); + sb.append(" routeTemplate: ").append(toIndentedString(routeTemplate)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object infoValue = getInfo(); + String infoValueAsString = ""; + infoValueAsString = infoValue.toString(); + sb.append("info=").append(urlEncode(infoValueAsString)).append(""); + Object schemaValue = getSchema(); + String schemaValueAsString = ""; + schemaValueAsString = schemaValue.toString(); + sb.append("schema=").append(urlEncode(schemaValueAsString)).append(""); + Object routeTemplateValue = getRouteTemplate(); + String routeTemplateValueAsString = ""; + routeTemplateValueAsString = routeTemplateValue.toString(); + sb.append("routeTemplate=").append(urlEncode(routeTemplateValueAsString)).append(""); + Object descriptionValue = getDescription(); + String descriptionValueAsString = ""; + descriptionValueAsString = descriptionValue.toString(); + sb.append("description=").append(urlEncode(descriptionValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("info"); + openapiFields.add("schema"); + openapiFields.add("routeTemplate"); + openapiFields.add("description"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("info"); + openapiRequiredFields.add("schema"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * VerifyB402PaymentV2RequestBodyPaymentPayloadExtensionsBazaar + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!VerifyB402PaymentV2RequestBodyPaymentPayloadExtensionsBazaar.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " VerifyB402PaymentV2RequestBodyPaymentPayloadExtensionsBazaar" + + " is not found in the empty JSON string", + VerifyB402PaymentV2RequestBodyPaymentPayloadExtensionsBazaar + .openapiRequiredFields + .toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : + VerifyB402PaymentV2RequestBodyPaymentPayloadExtensionsBazaar + .openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("routeTemplate") != null && !jsonObj.get("routeTemplate").isJsonNull()) + && !jsonObj.get("routeTemplate").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `routeTemplate` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("routeTemplate").toString())); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) + && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `description` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("description").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!VerifyB402PaymentV2RequestBodyPaymentPayloadExtensionsBazaar.class + .isAssignableFrom(type.getRawType())) { + return null; // this class only serializes + // 'VerifyB402PaymentV2RequestBodyPaymentPayloadExtensionsBazaar' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter + thisAdapter = + gson.getDelegateAdapter( + this, + TypeToken.get( + VerifyB402PaymentV2RequestBodyPaymentPayloadExtensionsBazaar + .class)); + + return (TypeAdapter) + new TypeAdapter< + VerifyB402PaymentV2RequestBodyPaymentPayloadExtensionsBazaar>() { + @Override + public void write( + JsonWriter out, + VerifyB402PaymentV2RequestBodyPaymentPayloadExtensionsBazaar value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public VerifyB402PaymentV2RequestBodyPaymentPayloadExtensionsBazaar read( + JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of VerifyB402PaymentV2RequestBodyPaymentPayloadExtensionsBazaar given an + * JSON string + * + * @param jsonString JSON string + * @return An instance of VerifyB402PaymentV2RequestBodyPaymentPayloadExtensionsBazaar + * @throws IOException if the JSON string is invalid with respect to + * VerifyB402PaymentV2RequestBodyPaymentPayloadExtensionsBazaar + */ + public static VerifyB402PaymentV2RequestBodyPaymentPayloadExtensionsBazaar fromJson( + String jsonString) throws IOException { + return JSON.getGson() + .fromJson( + jsonString, + VerifyB402PaymentV2RequestBodyPaymentPayloadExtensionsBazaar.class); + } + + /** + * Convert an instance of VerifyB402PaymentV2RequestBodyPaymentPayloadExtensionsBazaar to an + * JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/VerifyB402PaymentV2RequestBodyPaymentPayloadPayload.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/VerifyB402PaymentV2RequestBodyPaymentPayloadPayload.java new file mode 100644 index 0000000..a433c2d --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/VerifyB402PaymentV2RequestBodyPaymentPayloadPayload.java @@ -0,0 +1,344 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** VerifyB402PaymentV2RequestBodyPaymentPayloadPayload */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class VerifyB402PaymentV2RequestBodyPaymentPayloadPayload { + public static final String SERIALIZED_NAME_SIGNATURE = "signature"; + + @SerializedName(SERIALIZED_NAME_SIGNATURE) + @jakarta.annotation.Nonnull + private String signature; + + public static final String SERIALIZED_NAME_AUTHORIZATION = "authorization"; + + @SerializedName(SERIALIZED_NAME_AUTHORIZATION) + @jakarta.annotation.Nullable + private VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadAuthorization authorization; + + public static final String SERIALIZED_NAME_PERMIT2_AUTHORIZATION = "permit2Authorization"; + + @SerializedName(SERIALIZED_NAME_PERMIT2_AUTHORIZATION) + @jakarta.annotation.Nullable + private VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2Authorization + permit2Authorization; + + public VerifyB402PaymentV2RequestBodyPaymentPayloadPayload() {} + + public VerifyB402PaymentV2RequestBodyPaymentPayloadPayload signature( + @jakarta.annotation.Nonnull String signature) { + this.signature = signature; + return this; + } + + /** + * Get signature + * + * @return signature + */ + @jakarta.annotation.Nonnull + @NotNull + public String getSignature() { + return signature; + } + + public void setSignature(@jakarta.annotation.Nonnull String signature) { + this.signature = signature; + } + + public VerifyB402PaymentV2RequestBodyPaymentPayloadPayload authorization( + @jakarta.annotation.Nullable + VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadAuthorization + authorization) { + this.authorization = authorization; + return this; + } + + /** + * Get authorization + * + * @return authorization + */ + @jakarta.annotation.Nullable + @Valid + public VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadAuthorization getAuthorization() { + return authorization; + } + + public void setAuthorization( + @jakarta.annotation.Nullable + VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadAuthorization + authorization) { + this.authorization = authorization; + } + + public VerifyB402PaymentV2RequestBodyPaymentPayloadPayload permit2Authorization( + @jakarta.annotation.Nullable + VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2Authorization + permit2Authorization) { + this.permit2Authorization = permit2Authorization; + return this; + } + + /** + * Get permit2Authorization + * + * @return permit2Authorization + */ + @jakarta.annotation.Nullable + @Valid + public VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2Authorization + getPermit2Authorization() { + return permit2Authorization; + } + + public void setPermit2Authorization( + @jakarta.annotation.Nullable + VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2Authorization + permit2Authorization) { + this.permit2Authorization = permit2Authorization; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + VerifyB402PaymentV2RequestBodyPaymentPayloadPayload + verifyB402PaymentV2RequestBodyPaymentPayloadPayload = + (VerifyB402PaymentV2RequestBodyPaymentPayloadPayload) o; + return Objects.equals( + this.signature, + verifyB402PaymentV2RequestBodyPaymentPayloadPayload.signature) + && Objects.equals( + this.authorization, + verifyB402PaymentV2RequestBodyPaymentPayloadPayload.authorization) + && Objects.equals( + this.permit2Authorization, + verifyB402PaymentV2RequestBodyPaymentPayloadPayload.permit2Authorization); + } + + @Override + public int hashCode() { + return Objects.hash(signature, authorization, permit2Authorization); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VerifyB402PaymentV2RequestBodyPaymentPayloadPayload {\n"); + sb.append(" signature: ").append(toIndentedString(signature)).append("\n"); + sb.append(" authorization: ").append(toIndentedString(authorization)).append("\n"); + sb.append(" permit2Authorization: ") + .append(toIndentedString(permit2Authorization)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object signatureValue = getSignature(); + String signatureValueAsString = ""; + signatureValueAsString = signatureValue.toString(); + sb.append("signature=").append(urlEncode(signatureValueAsString)).append(""); + Object authorizationValue = getAuthorization(); + String authorizationValueAsString = ""; + authorizationValueAsString = authorizationValue.toString(); + sb.append("authorization=").append(urlEncode(authorizationValueAsString)).append(""); + Object permit2AuthorizationValue = getPermit2Authorization(); + String permit2AuthorizationValueAsString = ""; + permit2AuthorizationValueAsString = permit2AuthorizationValue.toString(); + sb.append("permit2Authorization=") + .append(urlEncode(permit2AuthorizationValueAsString)) + .append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("signature"); + openapiFields.add("authorization"); + openapiFields.add("permit2Authorization"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("signature"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * VerifyB402PaymentV2RequestBodyPaymentPayloadPayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!VerifyB402PaymentV2RequestBodyPaymentPayloadPayload.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " VerifyB402PaymentV2RequestBodyPaymentPayloadPayload is not" + + " found in the empty JSON string", + VerifyB402PaymentV2RequestBodyPaymentPayloadPayload + .openapiRequiredFields + .toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : + VerifyB402PaymentV2RequestBodyPaymentPayloadPayload.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("signature").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `signature` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("signature").toString())); + } + // validate the optional field `authorization` + if (jsonObj.get("authorization") != null && !jsonObj.get("authorization").isJsonNull()) { + VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadAuthorization.validateJsonElement( + jsonObj.get("authorization")); + } + // validate the optional field `permit2Authorization` + if (jsonObj.get("permit2Authorization") != null + && !jsonObj.get("permit2Authorization").isJsonNull()) { + VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2Authorization + .validateJsonElement(jsonObj.get("permit2Authorization")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!VerifyB402PaymentV2RequestBodyPaymentPayloadPayload.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'VerifyB402PaymentV2RequestBodyPaymentPayloadPayload' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, + TypeToken.get( + VerifyB402PaymentV2RequestBodyPaymentPayloadPayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, + VerifyB402PaymentV2RequestBodyPaymentPayloadPayload value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public VerifyB402PaymentV2RequestBodyPaymentPayloadPayload read( + JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of VerifyB402PaymentV2RequestBodyPaymentPayloadPayload given an JSON + * string + * + * @param jsonString JSON string + * @return An instance of VerifyB402PaymentV2RequestBodyPaymentPayloadPayload + * @throws IOException if the JSON string is invalid with respect to + * VerifyB402PaymentV2RequestBodyPaymentPayloadPayload + */ + public static VerifyB402PaymentV2RequestBodyPaymentPayloadPayload fromJson(String jsonString) + throws IOException { + return JSON.getGson() + .fromJson(jsonString, VerifyB402PaymentV2RequestBodyPaymentPayloadPayload.class); + } + + /** + * Convert an instance of VerifyB402PaymentV2RequestBodyPaymentPayloadPayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadAuthorization.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadAuthorization.java new file mode 100644 index 0000000..92e07c1 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadAuthorization.java @@ -0,0 +1,474 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadAuthorization */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadAuthorization { + public static final String SERIALIZED_NAME_FROM = "from"; + + @SerializedName(SERIALIZED_NAME_FROM) + @jakarta.annotation.Nonnull + private String from; + + public static final String SERIALIZED_NAME_TO = "to"; + + @SerializedName(SERIALIZED_NAME_TO) + @jakarta.annotation.Nonnull + private String to; + + public static final String SERIALIZED_NAME_VALUE = "value"; + + @SerializedName(SERIALIZED_NAME_VALUE) + @jakarta.annotation.Nonnull + private String value; + + public static final String SERIALIZED_NAME_VALID_AFTER = "validAfter"; + + @SerializedName(SERIALIZED_NAME_VALID_AFTER) + @jakarta.annotation.Nonnull + private String validAfter; + + public static final String SERIALIZED_NAME_VALID_BEFORE = "validBefore"; + + @SerializedName(SERIALIZED_NAME_VALID_BEFORE) + @jakarta.annotation.Nonnull + private String validBefore; + + public static final String SERIALIZED_NAME_NONCE = "nonce"; + + @SerializedName(SERIALIZED_NAME_NONCE) + @jakarta.annotation.Nonnull + private String nonce; + + public VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadAuthorization() {} + + public VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadAuthorization from( + @jakarta.annotation.Nonnull String from) { + this.from = from; + return this; + } + + /** + * Get from + * + * @return from + */ + @jakarta.annotation.Nonnull + @NotNull + public String getFrom() { + return from; + } + + public void setFrom(@jakarta.annotation.Nonnull String from) { + this.from = from; + } + + public VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadAuthorization to( + @jakarta.annotation.Nonnull String to) { + this.to = to; + return this; + } + + /** + * Get to + * + * @return to + */ + @jakarta.annotation.Nonnull + @NotNull + public String getTo() { + return to; + } + + public void setTo(@jakarta.annotation.Nonnull String to) { + this.to = to; + } + + public VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadAuthorization value( + @jakarta.annotation.Nonnull String value) { + this.value = value; + return this; + } + + /** + * Get value + * + * @return value + */ + @jakarta.annotation.Nonnull + @NotNull + public String getValue() { + return value; + } + + public void setValue(@jakarta.annotation.Nonnull String value) { + this.value = value; + } + + public VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadAuthorization validAfter( + @jakarta.annotation.Nonnull String validAfter) { + this.validAfter = validAfter; + return this; + } + + /** + * Get validAfter + * + * @return validAfter + */ + @jakarta.annotation.Nonnull + @NotNull + public String getValidAfter() { + return validAfter; + } + + public void setValidAfter(@jakarta.annotation.Nonnull String validAfter) { + this.validAfter = validAfter; + } + + public VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadAuthorization validBefore( + @jakarta.annotation.Nonnull String validBefore) { + this.validBefore = validBefore; + return this; + } + + /** + * Get validBefore + * + * @return validBefore + */ + @jakarta.annotation.Nonnull + @NotNull + public String getValidBefore() { + return validBefore; + } + + public void setValidBefore(@jakarta.annotation.Nonnull String validBefore) { + this.validBefore = validBefore; + } + + public VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadAuthorization nonce( + @jakarta.annotation.Nonnull String nonce) { + this.nonce = nonce; + return this; + } + + /** + * Get nonce + * + * @return nonce + */ + @jakarta.annotation.Nonnull + @NotNull + public String getNonce() { + return nonce; + } + + public void setNonce(@jakarta.annotation.Nonnull String nonce) { + this.nonce = nonce; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadAuthorization + verifyB402PaymentV2RequestBodyPaymentPayloadPayloadAuthorization = + (VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadAuthorization) o; + return Objects.equals( + this.from, + verifyB402PaymentV2RequestBodyPaymentPayloadPayloadAuthorization.from) + && Objects.equals( + this.to, + verifyB402PaymentV2RequestBodyPaymentPayloadPayloadAuthorization.to) + && Objects.equals( + this.value, + verifyB402PaymentV2RequestBodyPaymentPayloadPayloadAuthorization.value) + && Objects.equals( + this.validAfter, + verifyB402PaymentV2RequestBodyPaymentPayloadPayloadAuthorization.validAfter) + && Objects.equals( + this.validBefore, + verifyB402PaymentV2RequestBodyPaymentPayloadPayloadAuthorization + .validBefore) + && Objects.equals( + this.nonce, + verifyB402PaymentV2RequestBodyPaymentPayloadPayloadAuthorization.nonce); + } + + @Override + public int hashCode() { + return Objects.hash(from, to, value, validAfter, validBefore, nonce); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadAuthorization {\n"); + sb.append(" from: ").append(toIndentedString(from)).append("\n"); + sb.append(" to: ").append(toIndentedString(to)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" validAfter: ").append(toIndentedString(validAfter)).append("\n"); + sb.append(" validBefore: ").append(toIndentedString(validBefore)).append("\n"); + sb.append(" nonce: ").append(toIndentedString(nonce)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object fromValue = getFrom(); + String fromValueAsString = ""; + fromValueAsString = fromValue.toString(); + sb.append("from=").append(urlEncode(fromValueAsString)).append(""); + Object toValue = getTo(); + String toValueAsString = ""; + toValueAsString = toValue.toString(); + sb.append("to=").append(urlEncode(toValueAsString)).append(""); + Object valueValue = getValue(); + String valueValueAsString = ""; + valueValueAsString = valueValue.toString(); + sb.append("value=").append(urlEncode(valueValueAsString)).append(""); + Object validAfterValue = getValidAfter(); + String validAfterValueAsString = ""; + validAfterValueAsString = validAfterValue.toString(); + sb.append("validAfter=").append(urlEncode(validAfterValueAsString)).append(""); + Object validBeforeValue = getValidBefore(); + String validBeforeValueAsString = ""; + validBeforeValueAsString = validBeforeValue.toString(); + sb.append("validBefore=").append(urlEncode(validBeforeValueAsString)).append(""); + Object nonceValue = getNonce(); + String nonceValueAsString = ""; + nonceValueAsString = nonceValue.toString(); + sb.append("nonce=").append(urlEncode(nonceValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("from"); + openapiFields.add("to"); + openapiFields.add("value"); + openapiFields.add("validAfter"); + openapiFields.add("validBefore"); + openapiFields.add("nonce"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("from"); + openapiRequiredFields.add("to"); + openapiRequiredFields.add("value"); + openapiRequiredFields.add("validAfter"); + openapiRequiredFields.add("validBefore"); + openapiRequiredFields.add("nonce"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadAuthorization + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadAuthorization + .openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadAuthorization" + + " is not found in the empty JSON string", + VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadAuthorization + .openapiRequiredFields + .toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : + VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadAuthorization + .openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("from").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `from` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("from").toString())); + } + if (!jsonObj.get("to").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `to` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("to").toString())); + } + if (!jsonObj.get("value").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `value` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("value").toString())); + } + if (!jsonObj.get("validAfter").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `validAfter` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("validAfter").toString())); + } + if (!jsonObj.get("validBefore").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `validBefore` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("validBefore").toString())); + } + if (!jsonObj.get("nonce").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `nonce` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("nonce").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadAuthorization.class + .isAssignableFrom(type.getRawType())) { + return null; // this class only serializes + // 'VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadAuthorization' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter + thisAdapter = + gson.getDelegateAdapter( + this, + TypeToken.get( + VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadAuthorization + .class)); + + return (TypeAdapter) + new TypeAdapter< + VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadAuthorization>() { + @Override + public void write( + JsonWriter out, + VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadAuthorization + value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadAuthorization + read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadAuthorization given + * an JSON string + * + * @param jsonString JSON string + * @return An instance of VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadAuthorization + * @throws IOException if the JSON string is invalid with respect to + * VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadAuthorization + */ + public static VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadAuthorization fromJson( + String jsonString) throws IOException { + return JSON.getGson() + .fromJson( + jsonString, + VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadAuthorization.class); + } + + /** + * Convert an instance of VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadAuthorization to an + * JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2Authorization.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2Authorization.java new file mode 100644 index 0000000..2daef92 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2Authorization.java @@ -0,0 +1,493 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2Authorization */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2Authorization { + public static final String SERIALIZED_NAME_PERMITTED = "permitted"; + + @SerializedName(SERIALIZED_NAME_PERMITTED) + @jakarta.annotation.Nonnull + private VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationPermitted + permitted; + + public static final String SERIALIZED_NAME_FROM = "from"; + + @SerializedName(SERIALIZED_NAME_FROM) + @jakarta.annotation.Nonnull + private String from; + + public static final String SERIALIZED_NAME_SPENDER = "spender"; + + @SerializedName(SERIALIZED_NAME_SPENDER) + @jakarta.annotation.Nonnull + private String spender; + + public static final String SERIALIZED_NAME_NONCE = "nonce"; + + @SerializedName(SERIALIZED_NAME_NONCE) + @jakarta.annotation.Nonnull + private String nonce; + + public static final String SERIALIZED_NAME_DEADLINE = "deadline"; + + @SerializedName(SERIALIZED_NAME_DEADLINE) + @jakarta.annotation.Nonnull + private String deadline; + + public static final String SERIALIZED_NAME_WITNESS = "witness"; + + @SerializedName(SERIALIZED_NAME_WITNESS) + @jakarta.annotation.Nonnull + private VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationWitness witness; + + public VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2Authorization() {} + + public VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2Authorization permitted( + @jakarta.annotation.Nonnull + VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationPermitted + permitted) { + this.permitted = permitted; + return this; + } + + /** + * Get permitted + * + * @return permitted + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationPermitted + getPermitted() { + return permitted; + } + + public void setPermitted( + @jakarta.annotation.Nonnull + VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationPermitted + permitted) { + this.permitted = permitted; + } + + public VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2Authorization from( + @jakarta.annotation.Nonnull String from) { + this.from = from; + return this; + } + + /** + * Get from + * + * @return from + */ + @jakarta.annotation.Nonnull + @NotNull + public String getFrom() { + return from; + } + + public void setFrom(@jakarta.annotation.Nonnull String from) { + this.from = from; + } + + public VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2Authorization spender( + @jakarta.annotation.Nonnull String spender) { + this.spender = spender; + return this; + } + + /** + * Get spender + * + * @return spender + */ + @jakarta.annotation.Nonnull + @NotNull + public String getSpender() { + return spender; + } + + public void setSpender(@jakarta.annotation.Nonnull String spender) { + this.spender = spender; + } + + public VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2Authorization nonce( + @jakarta.annotation.Nonnull String nonce) { + this.nonce = nonce; + return this; + } + + /** + * Get nonce + * + * @return nonce + */ + @jakarta.annotation.Nonnull + @NotNull + public String getNonce() { + return nonce; + } + + public void setNonce(@jakarta.annotation.Nonnull String nonce) { + this.nonce = nonce; + } + + public VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2Authorization deadline( + @jakarta.annotation.Nonnull String deadline) { + this.deadline = deadline; + return this; + } + + /** + * Get deadline + * + * @return deadline + */ + @jakarta.annotation.Nonnull + @NotNull + public String getDeadline() { + return deadline; + } + + public void setDeadline(@jakarta.annotation.Nonnull String deadline) { + this.deadline = deadline; + } + + public VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2Authorization witness( + @jakarta.annotation.Nonnull + VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationWitness + witness) { + this.witness = witness; + return this; + } + + /** + * Get witness + * + * @return witness + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationWitness + getWitness() { + return witness; + } + + public void setWitness( + @jakarta.annotation.Nonnull + VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationWitness + witness) { + this.witness = witness; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2Authorization + verifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2Authorization = + (VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2Authorization) o; + return Objects.equals( + this.permitted, + verifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2Authorization + .permitted) + && Objects.equals( + this.from, + verifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2Authorization + .from) + && Objects.equals( + this.spender, + verifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2Authorization + .spender) + && Objects.equals( + this.nonce, + verifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2Authorization + .nonce) + && Objects.equals( + this.deadline, + verifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2Authorization + .deadline) + && Objects.equals( + this.witness, + verifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2Authorization + .witness); + } + + @Override + public int hashCode() { + return Objects.hash(permitted, from, spender, nonce, deadline, witness); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append( + "class VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2Authorization" + + " {\n"); + sb.append(" permitted: ").append(toIndentedString(permitted)).append("\n"); + sb.append(" from: ").append(toIndentedString(from)).append("\n"); + sb.append(" spender: ").append(toIndentedString(spender)).append("\n"); + sb.append(" nonce: ").append(toIndentedString(nonce)).append("\n"); + sb.append(" deadline: ").append(toIndentedString(deadline)).append("\n"); + sb.append(" witness: ").append(toIndentedString(witness)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object permittedValue = getPermitted(); + String permittedValueAsString = ""; + permittedValueAsString = permittedValue.toString(); + sb.append("permitted=").append(urlEncode(permittedValueAsString)).append(""); + Object fromValue = getFrom(); + String fromValueAsString = ""; + fromValueAsString = fromValue.toString(); + sb.append("from=").append(urlEncode(fromValueAsString)).append(""); + Object spenderValue = getSpender(); + String spenderValueAsString = ""; + spenderValueAsString = spenderValue.toString(); + sb.append("spender=").append(urlEncode(spenderValueAsString)).append(""); + Object nonceValue = getNonce(); + String nonceValueAsString = ""; + nonceValueAsString = nonceValue.toString(); + sb.append("nonce=").append(urlEncode(nonceValueAsString)).append(""); + Object deadlineValue = getDeadline(); + String deadlineValueAsString = ""; + deadlineValueAsString = deadlineValue.toString(); + sb.append("deadline=").append(urlEncode(deadlineValueAsString)).append(""); + Object witnessValue = getWitness(); + String witnessValueAsString = ""; + witnessValueAsString = witnessValue.toString(); + sb.append("witness=").append(urlEncode(witnessValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("permitted"); + openapiFields.add("from"); + openapiFields.add("spender"); + openapiFields.add("nonce"); + openapiFields.add("deadline"); + openapiFields.add("witness"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("permitted"); + openapiRequiredFields.add("from"); + openapiRequiredFields.add("spender"); + openapiRequiredFields.add("nonce"); + openapiRequiredFields.add("deadline"); + openapiRequiredFields.add("witness"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2Authorization + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2Authorization + .openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2Authorization" + + " is not found in the empty JSON string", + VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2Authorization + .openapiRequiredFields + .toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : + VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2Authorization + .openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `permitted` + VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationPermitted + .validateJsonElement(jsonObj.get("permitted")); + if (!jsonObj.get("from").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `from` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("from").toString())); + } + if (!jsonObj.get("spender").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `spender` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("spender").toString())); + } + if (!jsonObj.get("nonce").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `nonce` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("nonce").toString())); + } + if (!jsonObj.get("deadline").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `deadline` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("deadline").toString())); + } + // validate the required field `witness` + VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationWitness + .validateJsonElement(jsonObj.get("witness")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2Authorization.class + .isAssignableFrom(type.getRawType())) { + return null; // this class only serializes + // 'VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2Authorization' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter< + VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2Authorization> + thisAdapter = + gson.getDelegateAdapter( + this, + TypeToken.get( + VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2Authorization + .class)); + + return (TypeAdapter) + new TypeAdapter< + VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2Authorization>() { + @Override + public void write( + JsonWriter out, + VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2Authorization + value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public + VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2Authorization + read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2Authorization + * given an JSON string + * + * @param jsonString JSON string + * @return An instance of + * VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2Authorization + * @throws IOException if the JSON string is invalid with respect to + * VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2Authorization + */ + public static VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2Authorization fromJson( + String jsonString) throws IOException { + return JSON.getGson() + .fromJson( + jsonString, + VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2Authorization + .class); + } + + /** + * Convert an instance of + * VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2Authorization to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationPermitted.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationPermitted.java new file mode 100644 index 0000000..f446aa5 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationPermitted.java @@ -0,0 +1,309 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationPermitted */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationPermitted { + public static final String SERIALIZED_NAME_TOKEN = "token"; + + @SerializedName(SERIALIZED_NAME_TOKEN) + @jakarta.annotation.Nonnull + private String token; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + + @SerializedName(SERIALIZED_NAME_AMOUNT) + @jakarta.annotation.Nonnull + private String amount; + + public VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationPermitted() {} + + public VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationPermitted token( + @jakarta.annotation.Nonnull String token) { + this.token = token; + return this; + } + + /** + * Get token + * + * @return token + */ + @jakarta.annotation.Nonnull + @NotNull + public String getToken() { + return token; + } + + public void setToken(@jakarta.annotation.Nonnull String token) { + this.token = token; + } + + public VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationPermitted amount( + @jakarta.annotation.Nonnull String amount) { + this.amount = amount; + return this; + } + + /** + * Get amount + * + * @return amount + */ + @jakarta.annotation.Nonnull + @NotNull + public String getAmount() { + return amount; + } + + public void setAmount(@jakarta.annotation.Nonnull String amount) { + this.amount = amount; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationPermitted + verifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationPermitted = + (VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationPermitted) + o; + return Objects.equals( + this.token, + verifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationPermitted + .token) + && Objects.equals( + this.amount, + verifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationPermitted + .amount); + } + + @Override + public int hashCode() { + return Objects.hash(token, amount); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append( + "class" + + " VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationPermitted" + + " {\n"); + sb.append(" token: ").append(toIndentedString(token)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object tokenValue = getToken(); + String tokenValueAsString = ""; + tokenValueAsString = tokenValue.toString(); + sb.append("token=").append(urlEncode(tokenValueAsString)).append(""); + Object amountValue = getAmount(); + String amountValueAsString = ""; + amountValueAsString = amountValue.toString(); + sb.append("amount=").append(urlEncode(amountValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("token"); + openapiFields.add("amount"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("token"); + openapiRequiredFields.add("amount"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationPermitted + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationPermitted + .openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationPermitted" + + " is not found in the empty JSON string", + VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationPermitted + .openapiRequiredFields + .toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : + VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationPermitted + .openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("token").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `token` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("token").toString())); + } + if (!jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `amount` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("amount").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationPermitted + .class + .isAssignableFrom(type.getRawType())) { + return null; // this class only serializes + // 'VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationPermitted' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter< + VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationPermitted> + thisAdapter = + gson.getDelegateAdapter( + this, + TypeToken.get( + VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationPermitted + .class)); + + return (TypeAdapter) + new TypeAdapter< + VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationPermitted>() { + @Override + public void write( + JsonWriter out, + VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationPermitted + value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public + VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationPermitted + read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of + * VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationPermitted given an + * JSON string + * + * @param jsonString JSON string + * @return An instance of + * VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationPermitted + * @throws IOException if the JSON string is invalid with respect to + * VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationPermitted + */ + public static VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationPermitted + fromJson(String jsonString) throws IOException { + return JSON.getGson() + .fromJson( + jsonString, + VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationPermitted + .class); + } + + /** + * Convert an instance of + * VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationPermitted to an JSON + * string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationWitness.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationWitness.java new file mode 100644 index 0000000..7d59067 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationWitness.java @@ -0,0 +1,372 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationWitness */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationWitness { + public static final String SERIALIZED_NAME_TO = "to"; + + @SerializedName(SERIALIZED_NAME_TO) + @jakarta.annotation.Nonnull + private String to; + + public static final String SERIALIZED_NAME_FACILITATOR = "facilitator"; + + @SerializedName(SERIALIZED_NAME_FACILITATOR) + @jakarta.annotation.Nullable + private String facilitator; + + public static final String SERIALIZED_NAME_VALID_AFTER = "validAfter"; + + @SerializedName(SERIALIZED_NAME_VALID_AFTER) + @jakarta.annotation.Nonnull + private String validAfter; + + public VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationWitness() {} + + public VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationWitness to( + @jakarta.annotation.Nonnull String to) { + this.to = to; + return this; + } + + /** + * Get to + * + * @return to + */ + @jakarta.annotation.Nonnull + @NotNull + public String getTo() { + return to; + } + + public void setTo(@jakarta.annotation.Nonnull String to) { + this.to = to; + } + + public VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationWitness + facilitator(@jakarta.annotation.Nullable String facilitator) { + this.facilitator = facilitator; + return this; + } + + /** + * Get facilitator + * + * @return facilitator + */ + @jakarta.annotation.Nullable + public String getFacilitator() { + return facilitator; + } + + public void setFacilitator(@jakarta.annotation.Nullable String facilitator) { + this.facilitator = facilitator; + } + + public VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationWitness + validAfter(@jakarta.annotation.Nonnull String validAfter) { + this.validAfter = validAfter; + return this; + } + + /** + * Get validAfter + * + * @return validAfter + */ + @jakarta.annotation.Nonnull + @NotNull + public String getValidAfter() { + return validAfter; + } + + public void setValidAfter(@jakarta.annotation.Nonnull String validAfter) { + this.validAfter = validAfter; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationWitness + verifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationWitness = + (VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationWitness) + o; + return Objects.equals( + this.to, + verifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationWitness + .to) + && Objects.equals( + this.facilitator, + verifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationWitness + .facilitator) + && Objects.equals( + this.validAfter, + verifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationWitness + .validAfter); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(to, facilitator, validAfter); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append( + "class" + + " VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationWitness" + + " {\n"); + sb.append(" to: ").append(toIndentedString(to)).append("\n"); + sb.append(" facilitator: ").append(toIndentedString(facilitator)).append("\n"); + sb.append(" validAfter: ").append(toIndentedString(validAfter)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object toValue = getTo(); + String toValueAsString = ""; + toValueAsString = toValue.toString(); + sb.append("to=").append(urlEncode(toValueAsString)).append(""); + Object facilitatorValue = getFacilitator(); + String facilitatorValueAsString = ""; + facilitatorValueAsString = facilitatorValue.toString(); + sb.append("facilitator=").append(urlEncode(facilitatorValueAsString)).append(""); + Object validAfterValue = getValidAfter(); + String validAfterValueAsString = ""; + validAfterValueAsString = validAfterValue.toString(); + sb.append("validAfter=").append(urlEncode(validAfterValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("to"); + openapiFields.add("facilitator"); + openapiFields.add("validAfter"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("to"); + openapiRequiredFields.add("validAfter"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationWitness + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationWitness + .openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationWitness" + + " is not found in the empty JSON string", + VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationWitness + .openapiRequiredFields + .toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : + VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationWitness + .openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("to").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `to` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("to").toString())); + } + if ((jsonObj.get("facilitator") != null && !jsonObj.get("facilitator").isJsonNull()) + && !jsonObj.get("facilitator").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `facilitator` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("facilitator").toString())); + } + if (!jsonObj.get("validAfter").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `validAfter` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("validAfter").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationWitness + .class + .isAssignableFrom(type.getRawType())) { + return null; // this class only serializes + // 'VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationWitness' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter< + VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationWitness> + thisAdapter = + gson.getDelegateAdapter( + this, + TypeToken.get( + VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationWitness + .class)); + + return (TypeAdapter) + new TypeAdapter< + VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationWitness>() { + @Override + public void write( + JsonWriter out, + VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationWitness + value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public + VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationWitness + read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of + * VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationWitness given an JSON + * string + * + * @param jsonString JSON string + * @return An instance of + * VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationWitness + * @throws IOException if the JSON string is invalid with respect to + * VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationWitness + */ + public static VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationWitness + fromJson(String jsonString) throws IOException { + return JSON.getGson() + .fromJson( + jsonString, + VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationWitness + .class); + } + + /** + * Convert an instance of + * VerifyB402PaymentV2RequestBodyPaymentPayloadPayloadPermit2AuthorizationWitness to an JSON + * string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/VerifyB402PaymentV2RequestBodyPaymentPayloadResource.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/VerifyB402PaymentV2RequestBodyPaymentPayloadResource.java new file mode 100644 index 0000000..e2a15e6 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/VerifyB402PaymentV2RequestBodyPaymentPayloadResource.java @@ -0,0 +1,331 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URI; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** VerifyB402PaymentV2RequestBodyPaymentPayloadResource */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class VerifyB402PaymentV2RequestBodyPaymentPayloadResource { + public static final String SERIALIZED_NAME_URL = "url"; + + @SerializedName(SERIALIZED_NAME_URL) + @jakarta.annotation.Nonnull + private URI url; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @jakarta.annotation.Nullable + private String description; + + public static final String SERIALIZED_NAME_MIME_TYPE = "mimeType"; + + @SerializedName(SERIALIZED_NAME_MIME_TYPE) + @jakarta.annotation.Nullable + private String mimeType; + + public VerifyB402PaymentV2RequestBodyPaymentPayloadResource() {} + + public VerifyB402PaymentV2RequestBodyPaymentPayloadResource url( + @jakarta.annotation.Nonnull URI url) { + this.url = url; + return this; + } + + /** + * Get url + * + * @return url + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public URI getUrl() { + return url; + } + + public void setUrl(@jakarta.annotation.Nonnull URI url) { + this.url = url; + } + + public VerifyB402PaymentV2RequestBodyPaymentPayloadResource description( + @jakarta.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Get description + * + * @return description + */ + @jakarta.annotation.Nullable + public String getDescription() { + return description; + } + + public void setDescription(@jakarta.annotation.Nullable String description) { + this.description = description; + } + + public VerifyB402PaymentV2RequestBodyPaymentPayloadResource mimeType( + @jakarta.annotation.Nullable String mimeType) { + this.mimeType = mimeType; + return this; + } + + /** + * Get mimeType + * + * @return mimeType + */ + @jakarta.annotation.Nullable + public String getMimeType() { + return mimeType; + } + + public void setMimeType(@jakarta.annotation.Nullable String mimeType) { + this.mimeType = mimeType; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + VerifyB402PaymentV2RequestBodyPaymentPayloadResource + verifyB402PaymentV2RequestBodyPaymentPayloadResource = + (VerifyB402PaymentV2RequestBodyPaymentPayloadResource) o; + return Objects.equals(this.url, verifyB402PaymentV2RequestBodyPaymentPayloadResource.url) + && Objects.equals( + this.description, + verifyB402PaymentV2RequestBodyPaymentPayloadResource.description) + && Objects.equals( + this.mimeType, + verifyB402PaymentV2RequestBodyPaymentPayloadResource.mimeType); + } + + @Override + public int hashCode() { + return Objects.hash(url, description, mimeType); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VerifyB402PaymentV2RequestBodyPaymentPayloadResource {\n"); + sb.append(" url: ").append(toIndentedString(url)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" mimeType: ").append(toIndentedString(mimeType)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object urlValue = getUrl(); + String urlValueAsString = ""; + urlValueAsString = urlValue.toString(); + sb.append("url=").append(urlEncode(urlValueAsString)).append(""); + Object descriptionValue = getDescription(); + String descriptionValueAsString = ""; + descriptionValueAsString = descriptionValue.toString(); + sb.append("description=").append(urlEncode(descriptionValueAsString)).append(""); + Object mimeTypeValue = getMimeType(); + String mimeTypeValueAsString = ""; + mimeTypeValueAsString = mimeTypeValue.toString(); + sb.append("mimeType=").append(urlEncode(mimeTypeValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("url"); + openapiFields.add("description"); + openapiFields.add("mimeType"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("url"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * VerifyB402PaymentV2RequestBodyPaymentPayloadResource + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!VerifyB402PaymentV2RequestBodyPaymentPayloadResource.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " VerifyB402PaymentV2RequestBodyPaymentPayloadResource is not" + + " found in the empty JSON string", + VerifyB402PaymentV2RequestBodyPaymentPayloadResource + .openapiRequiredFields + .toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : + VerifyB402PaymentV2RequestBodyPaymentPayloadResource.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("url").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `url` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("url").toString())); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) + && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `description` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("description").toString())); + } + if ((jsonObj.get("mimeType") != null && !jsonObj.get("mimeType").isJsonNull()) + && !jsonObj.get("mimeType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `mimeType` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("mimeType").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!VerifyB402PaymentV2RequestBodyPaymentPayloadResource.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'VerifyB402PaymentV2RequestBodyPaymentPayloadResource' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, + TypeToken.get( + VerifyB402PaymentV2RequestBodyPaymentPayloadResource.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, + VerifyB402PaymentV2RequestBodyPaymentPayloadResource value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public VerifyB402PaymentV2RequestBodyPaymentPayloadResource read( + JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of VerifyB402PaymentV2RequestBodyPaymentPayloadResource given an JSON + * string + * + * @param jsonString JSON string + * @return An instance of VerifyB402PaymentV2RequestBodyPaymentPayloadResource + * @throws IOException if the JSON string is invalid with respect to + * VerifyB402PaymentV2RequestBodyPaymentPayloadResource + */ + public static VerifyB402PaymentV2RequestBodyPaymentPayloadResource fromJson(String jsonString) + throws IOException { + return JSON.getGson() + .fromJson(jsonString, VerifyB402PaymentV2RequestBodyPaymentPayloadResource.class); + } + + /** + * Convert an instance of VerifyB402PaymentV2RequestBodyPaymentPayloadResource to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/VerifyB402PaymentV2Response.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/VerifyB402PaymentV2Response.java new file mode 100644 index 0000000..c08424d --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/VerifyB402PaymentV2Response.java @@ -0,0 +1,308 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.common.AbstractOpenApiSchema; +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; +import org.hibernate.validator.constraints.*; + +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class VerifyB402PaymentV2Response extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(VerifyB402PaymentV2Response.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!VerifyB402PaymentV2Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'VerifyB402PaymentV2Response' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterVerifyB402PaymentV2Response1 = + gson.getDelegateAdapter( + this, TypeToken.get(VerifyB402PaymentV2Response1.class)); + final TypeAdapter adapterVerifyB402PaymentV2Response2 = + gson.getDelegateAdapter( + this, TypeToken.get(VerifyB402PaymentV2Response2.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, VerifyB402PaymentV2Response value) + throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type + // `VerifyB402PaymentV2Response1` + if (value.getActualInstance() instanceof VerifyB402PaymentV2Response1) { + JsonElement element = + adapterVerifyB402PaymentV2Response1.toJsonTree( + (VerifyB402PaymentV2Response1) + value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type + // `VerifyB402PaymentV2Response2` + if (value.getActualInstance() instanceof VerifyB402PaymentV2Response2) { + JsonElement element = + adapterVerifyB402PaymentV2Response2.toJsonTree( + (VerifyB402PaymentV2Response2) + value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException( + "Failed to serialize as the type doesn't match oneOf schemas:" + + " VerifyB402PaymentV2Response1," + + " VerifyB402PaymentV2Response2"); + } + + @Override + public VerifyB402PaymentV2Response read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize VerifyB402PaymentV2Response1 + try { + // validate the JSON object to see if any exception is thrown + VerifyB402PaymentV2Response1.validateJsonElement(jsonElement); + actualAdapter = adapterVerifyB402PaymentV2Response1; + match++; + log.log( + Level.FINER, + "Input data matches schema 'VerifyB402PaymentV2Response1'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add( + String.format( + "Deserialization for VerifyB402PaymentV2Response1" + + " failed with `%s`.", + e.getMessage())); + log.log( + Level.FINER, + "Input data does not match schema" + + " 'VerifyB402PaymentV2Response1'", + e); + } + // deserialize VerifyB402PaymentV2Response2 + try { + // validate the JSON object to see if any exception is thrown + VerifyB402PaymentV2Response2.validateJsonElement(jsonElement); + actualAdapter = adapterVerifyB402PaymentV2Response2; + match++; + log.log( + Level.FINER, + "Input data matches schema 'VerifyB402PaymentV2Response2'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add( + String.format( + "Deserialization for VerifyB402PaymentV2Response2" + + " failed with `%s`.", + e.getMessage())); + log.log( + Level.FINER, + "Input data does not match schema" + + " 'VerifyB402PaymentV2Response2'", + e); + } + + if (match == 1) { + VerifyB402PaymentV2Response ret = new VerifyB402PaymentV2Response(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException( + String.format( + "Failed deserialization for" + + " VerifyB402PaymentV2Response: %d classes match" + + " result, expected 1. Detailed failure message" + + " for oneOf schemas: %s. JSON: %s", + match, errorMessages, jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap>(); + + public VerifyB402PaymentV2Response() { + super("oneOf", Boolean.FALSE); + } + + public VerifyB402PaymentV2Response(Object o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("VerifyB402PaymentV2Response1", VerifyB402PaymentV2Response1.class); + schemas.put("VerifyB402PaymentV2Response2", VerifyB402PaymentV2Response2.class); + } + + @Override + public Map> getSchemas() { + return VerifyB402PaymentV2Response.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: VerifyB402PaymentV2Response1, VerifyB402PaymentV2Response2 + * + *

It could be an instance of the 'oneOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof VerifyB402PaymentV2Response1) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof VerifyB402PaymentV2Response2) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException( + "Invalid instance type. Must be VerifyB402PaymentV2Response1," + + " VerifyB402PaymentV2Response2"); + } + + /** + * Get the actual instance, which can be the following: VerifyB402PaymentV2Response1, + * VerifyB402PaymentV2Response2 + * + * @return The actual instance (VerifyB402PaymentV2Response1, VerifyB402PaymentV2Response2) + */ + @SuppressWarnings("unchecked") + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `VerifyB402PaymentV2Response1`. If the actual instance is not + * `VerifyB402PaymentV2Response1`, the ClassCastException will be thrown. + * + * @return The actual instance of `VerifyB402PaymentV2Response1` + * @throws ClassCastException if the instance is not `VerifyB402PaymentV2Response1` + */ + public VerifyB402PaymentV2Response1 getVerifyB402PaymentV2Response1() + throws ClassCastException { + return (VerifyB402PaymentV2Response1) super.getActualInstance(); + } + + /** + * Get the actual instance of `VerifyB402PaymentV2Response2`. If the actual instance is not + * `VerifyB402PaymentV2Response2`, the ClassCastException will be thrown. + * + * @return The actual instance of `VerifyB402PaymentV2Response2` + * @throws ClassCastException if the instance is not `VerifyB402PaymentV2Response2` + */ + public VerifyB402PaymentV2Response2 getVerifyB402PaymentV2Response2() + throws ClassCastException { + return (VerifyB402PaymentV2Response2) super.getActualInstance(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * VerifyB402PaymentV2Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate oneOf schemas one by one + int validCount = 0; + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with VerifyB402PaymentV2Response1 + try { + VerifyB402PaymentV2Response1.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add( + String.format( + "Deserialization for VerifyB402PaymentV2Response1 failed with `%s`.", + e.getMessage())); + // continue to the next one + } + // validate the json string with VerifyB402PaymentV2Response2 + try { + VerifyB402PaymentV2Response2.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add( + String.format( + "Deserialization for VerifyB402PaymentV2Response2 failed with `%s`.", + e.getMessage())); + // continue to the next one + } + if (validCount != 1) { + throw new IOException( + String.format( + "The JSON string is invalid for VerifyB402PaymentV2Response with oneOf" + + " schemas: VerifyB402PaymentV2Response1," + + " VerifyB402PaymentV2Response2. %d class(es) match the result," + + " expected 1. Detailed failure message for oneOf schemas: %s." + + " JSON: %s", + validCount, errorMessages, jsonElement.toString())); + } + } + + /** + * Create an instance of VerifyB402PaymentV2Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of VerifyB402PaymentV2Response + * @throws IOException if the JSON string is invalid with respect to VerifyB402PaymentV2Response + */ + public static VerifyB402PaymentV2Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, VerifyB402PaymentV2Response.class); + } + + /** + * Convert an instance of VerifyB402PaymentV2Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/VerifyB402PaymentV2Response1.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/VerifyB402PaymentV2Response1.java new file mode 100644 index 0000000..3c9ae60 --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/VerifyB402PaymentV2Response1.java @@ -0,0 +1,456 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** VerifyB402PaymentV2Response1 */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class VerifyB402PaymentV2Response1 { + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + @jakarta.annotation.Nullable + private String status; + + public static final String SERIALIZED_NAME_TYPE = "type"; + + @SerializedName(SERIALIZED_NAME_TYPE) + @jakarta.annotation.Nullable + private String type; + + public static final String SERIALIZED_NAME_CODE = "code"; + + @SerializedName(SERIALIZED_NAME_CODE) + @jakarta.annotation.Nullable + private String code; + + public static final String SERIALIZED_NAME_ERROR_DATA = "errorData"; + + @SerializedName(SERIALIZED_NAME_ERROR_DATA) + @jakarta.annotation.Nullable + private String errorData; + + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + @jakarta.annotation.Nullable + private VerifyB402PaymentV2Response1Data data; + + public static final String SERIALIZED_NAME_SUB_DATA = "subData"; + + @SerializedName(SERIALIZED_NAME_SUB_DATA) + @jakarta.annotation.Nullable + private Object subData; + + public static final String SERIALIZED_NAME_PARAMS = "params"; + + @SerializedName(SERIALIZED_NAME_PARAMS) + @jakarta.annotation.Nullable + private Object params; + + public VerifyB402PaymentV2Response1() {} + + public VerifyB402PaymentV2Response1 status(@jakarta.annotation.Nullable String status) { + this.status = status; + return this; + } + + /** + * Get status + * + * @return status + */ + @jakarta.annotation.Nullable + public String getStatus() { + return status; + } + + public void setStatus(@jakarta.annotation.Nullable String status) { + this.status = status; + } + + public VerifyB402PaymentV2Response1 type(@jakarta.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * + * @return type + */ + @jakarta.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@jakarta.annotation.Nullable String type) { + this.type = type; + } + + public VerifyB402PaymentV2Response1 code(@jakarta.annotation.Nullable String code) { + this.code = code; + return this; + } + + /** + * Get code + * + * @return code + */ + @jakarta.annotation.Nullable + public String getCode() { + return code; + } + + public void setCode(@jakarta.annotation.Nullable String code) { + this.code = code; + } + + public VerifyB402PaymentV2Response1 errorData(@jakarta.annotation.Nullable String errorData) { + this.errorData = errorData; + return this; + } + + /** + * Get errorData + * + * @return errorData + */ + @jakarta.annotation.Nullable + public String getErrorData() { + return errorData; + } + + public void setErrorData(@jakarta.annotation.Nullable String errorData) { + this.errorData = errorData; + } + + public VerifyB402PaymentV2Response1 data( + @jakarta.annotation.Nullable VerifyB402PaymentV2Response1Data data) { + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @jakarta.annotation.Nullable + @Valid + public VerifyB402PaymentV2Response1Data getData() { + return data; + } + + public void setData(@jakarta.annotation.Nullable VerifyB402PaymentV2Response1Data data) { + this.data = data; + } + + public VerifyB402PaymentV2Response1 subData(@jakarta.annotation.Nullable Object subData) { + this.subData = subData; + return this; + } + + /** + * Get subData + * + * @return subData + */ + @jakarta.annotation.Nullable + public Object getSubData() { + return subData; + } + + public void setSubData(@jakarta.annotation.Nullable Object subData) { + this.subData = subData; + } + + public VerifyB402PaymentV2Response1 params(@jakarta.annotation.Nullable Object params) { + this.params = params; + return this; + } + + /** + * Get params + * + * @return params + */ + @jakarta.annotation.Nullable + public Object getParams() { + return params; + } + + public void setParams(@jakarta.annotation.Nullable Object params) { + this.params = params; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + VerifyB402PaymentV2Response1 verifyB402PaymentV2Response1 = + (VerifyB402PaymentV2Response1) o; + return Objects.equals(this.status, verifyB402PaymentV2Response1.status) + && Objects.equals(this.type, verifyB402PaymentV2Response1.type) + && Objects.equals(this.code, verifyB402PaymentV2Response1.code) + && Objects.equals(this.errorData, verifyB402PaymentV2Response1.errorData) + && Objects.equals(this.data, verifyB402PaymentV2Response1.data) + && Objects.equals(this.subData, verifyB402PaymentV2Response1.subData) + && Objects.equals(this.params, verifyB402PaymentV2Response1.params); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(status, type, code, errorData, data, subData, params); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VerifyB402PaymentV2Response1 {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" errorData: ").append(toIndentedString(errorData)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" subData: ").append(toIndentedString(subData)).append("\n"); + sb.append(" params: ").append(toIndentedString(params)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object statusValue = getStatus(); + String statusValueAsString = ""; + statusValueAsString = statusValue.toString(); + sb.append("status=").append(urlEncode(statusValueAsString)).append(""); + Object typeValue = getType(); + String typeValueAsString = ""; + typeValueAsString = typeValue.toString(); + sb.append("type=").append(urlEncode(typeValueAsString)).append(""); + Object codeValue = getCode(); + String codeValueAsString = ""; + codeValueAsString = codeValue.toString(); + sb.append("code=").append(urlEncode(codeValueAsString)).append(""); + Object errorDataValue = getErrorData(); + String errorDataValueAsString = ""; + errorDataValueAsString = errorDataValue.toString(); + sb.append("errorData=").append(urlEncode(errorDataValueAsString)).append(""); + Object dataValue = getData(); + String dataValueAsString = ""; + dataValueAsString = dataValue.toString(); + sb.append("data=").append(urlEncode(dataValueAsString)).append(""); + Object subDataValue = getSubData(); + String subDataValueAsString = ""; + subDataValueAsString = subDataValue.toString(); + sb.append("subData=").append(urlEncode(subDataValueAsString)).append(""); + Object paramsValue = getParams(); + String paramsValueAsString = ""; + paramsValueAsString = paramsValue.toString(); + sb.append("params=").append(urlEncode(paramsValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("status"); + openapiFields.add("type"); + openapiFields.add("code"); + openapiFields.add("errorData"); + openapiFields.add("data"); + openapiFields.add("subData"); + openapiFields.add("params"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * VerifyB402PaymentV2Response1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!VerifyB402PaymentV2Response1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in VerifyB402PaymentV2Response1 is not" + + " found in the empty JSON string", + VerifyB402PaymentV2Response1.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) + && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `status` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("status").toString())); + } + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) + && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `type` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("type").toString())); + } + if ((jsonObj.get("code") != null && !jsonObj.get("code").isJsonNull()) + && !jsonObj.get("code").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `code` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("code").toString())); + } + if ((jsonObj.get("errorData") != null && !jsonObj.get("errorData").isJsonNull()) + && !jsonObj.get("errorData").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `errorData` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("errorData").toString())); + } + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + VerifyB402PaymentV2Response1Data.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!VerifyB402PaymentV2Response1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'VerifyB402PaymentV2Response1' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(VerifyB402PaymentV2Response1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, VerifyB402PaymentV2Response1 value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public VerifyB402PaymentV2Response1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of VerifyB402PaymentV2Response1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of VerifyB402PaymentV2Response1 + * @throws IOException if the JSON string is invalid with respect to + * VerifyB402PaymentV2Response1 + */ + public static VerifyB402PaymentV2Response1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, VerifyB402PaymentV2Response1.class); + } + + /** + * Convert an instance of VerifyB402PaymentV2Response1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/VerifyB402PaymentV2Response1Data.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/VerifyB402PaymentV2Response1Data.java new file mode 100644 index 0000000..05a8cff --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/VerifyB402PaymentV2Response1Data.java @@ -0,0 +1,362 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** VerifyB402PaymentV2Response1Data */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class VerifyB402PaymentV2Response1Data { + public static final String SERIALIZED_NAME_IS_VALID = "isValid"; + + @SerializedName(SERIALIZED_NAME_IS_VALID) + @jakarta.annotation.Nonnull + private Boolean isValid; + + public static final String SERIALIZED_NAME_PAYER = "payer"; + + @SerializedName(SERIALIZED_NAME_PAYER) + @jakarta.annotation.Nullable + private String payer; + + public static final String SERIALIZED_NAME_INVALID_REASON = "invalidReason"; + + @SerializedName(SERIALIZED_NAME_INVALID_REASON) + @jakarta.annotation.Nullable + private String invalidReason; + + public static final String SERIALIZED_NAME_INVALID_MESSAGE = "invalidMessage"; + + @SerializedName(SERIALIZED_NAME_INVALID_MESSAGE) + @jakarta.annotation.Nullable + private String invalidMessage; + + public VerifyB402PaymentV2Response1Data() {} + + public VerifyB402PaymentV2Response1Data isValid(@jakarta.annotation.Nonnull Boolean isValid) { + this.isValid = isValid; + return this; + } + + /** + * Get isValid + * + * @return isValid + */ + @jakarta.annotation.Nonnull + @NotNull + public Boolean getIsValid() { + return isValid; + } + + public void setIsValid(@jakarta.annotation.Nonnull Boolean isValid) { + this.isValid = isValid; + } + + public VerifyB402PaymentV2Response1Data payer(@jakarta.annotation.Nullable String payer) { + this.payer = payer; + return this; + } + + /** + * Get payer + * + * @return payer + */ + @jakarta.annotation.Nullable + public String getPayer() { + return payer; + } + + public void setPayer(@jakarta.annotation.Nullable String payer) { + this.payer = payer; + } + + public VerifyB402PaymentV2Response1Data invalidReason( + @jakarta.annotation.Nullable String invalidReason) { + this.invalidReason = invalidReason; + return this; + } + + /** + * Get invalidReason + * + * @return invalidReason + */ + @jakarta.annotation.Nullable + public String getInvalidReason() { + return invalidReason; + } + + public void setInvalidReason(@jakarta.annotation.Nullable String invalidReason) { + this.invalidReason = invalidReason; + } + + public VerifyB402PaymentV2Response1Data invalidMessage( + @jakarta.annotation.Nullable String invalidMessage) { + this.invalidMessage = invalidMessage; + return this; + } + + /** + * Get invalidMessage + * + * @return invalidMessage + */ + @jakarta.annotation.Nullable + public String getInvalidMessage() { + return invalidMessage; + } + + public void setInvalidMessage(@jakarta.annotation.Nullable String invalidMessage) { + this.invalidMessage = invalidMessage; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + VerifyB402PaymentV2Response1Data verifyB402PaymentV2Response1Data = + (VerifyB402PaymentV2Response1Data) o; + return Objects.equals(this.isValid, verifyB402PaymentV2Response1Data.isValid) + && Objects.equals(this.payer, verifyB402PaymentV2Response1Data.payer) + && Objects.equals( + this.invalidReason, verifyB402PaymentV2Response1Data.invalidReason) + && Objects.equals( + this.invalidMessage, verifyB402PaymentV2Response1Data.invalidMessage); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(isValid, payer, invalidReason, invalidMessage); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VerifyB402PaymentV2Response1Data {\n"); + sb.append(" isValid: ").append(toIndentedString(isValid)).append("\n"); + sb.append(" payer: ").append(toIndentedString(payer)).append("\n"); + sb.append(" invalidReason: ").append(toIndentedString(invalidReason)).append("\n"); + sb.append(" invalidMessage: ").append(toIndentedString(invalidMessage)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object isValidValue = getIsValid(); + String isValidValueAsString = ""; + isValidValueAsString = isValidValue.toString(); + sb.append("isValid=").append(urlEncode(isValidValueAsString)).append(""); + Object payerValue = getPayer(); + String payerValueAsString = ""; + payerValueAsString = payerValue.toString(); + sb.append("payer=").append(urlEncode(payerValueAsString)).append(""); + Object invalidReasonValue = getInvalidReason(); + String invalidReasonValueAsString = ""; + invalidReasonValueAsString = invalidReasonValue.toString(); + sb.append("invalidReason=").append(urlEncode(invalidReasonValueAsString)).append(""); + Object invalidMessageValue = getInvalidMessage(); + String invalidMessageValueAsString = ""; + invalidMessageValueAsString = invalidMessageValue.toString(); + sb.append("invalidMessage=").append(urlEncode(invalidMessageValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("isValid"); + openapiFields.add("payer"); + openapiFields.add("invalidReason"); + openapiFields.add("invalidMessage"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("isValid"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * VerifyB402PaymentV2Response1Data + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!VerifyB402PaymentV2Response1Data.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in VerifyB402PaymentV2Response1Data is" + + " not found in the empty JSON string", + VerifyB402PaymentV2Response1Data.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : VerifyB402PaymentV2Response1Data.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("payer") != null && !jsonObj.get("payer").isJsonNull()) + && !jsonObj.get("payer").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `payer` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("payer").toString())); + } + if ((jsonObj.get("invalidReason") != null && !jsonObj.get("invalidReason").isJsonNull()) + && !jsonObj.get("invalidReason").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `invalidReason` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("invalidReason").toString())); + } + if ((jsonObj.get("invalidMessage") != null && !jsonObj.get("invalidMessage").isJsonNull()) + && !jsonObj.get("invalidMessage").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `invalidMessage` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("invalidMessage").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!VerifyB402PaymentV2Response1Data.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'VerifyB402PaymentV2Response1Data' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(VerifyB402PaymentV2Response1Data.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, VerifyB402PaymentV2Response1Data value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public VerifyB402PaymentV2Response1Data read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of VerifyB402PaymentV2Response1Data given an JSON string + * + * @param jsonString JSON string + * @return An instance of VerifyB402PaymentV2Response1Data + * @throws IOException if the JSON string is invalid with respect to + * VerifyB402PaymentV2Response1Data + */ + public static VerifyB402PaymentV2Response1Data fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, VerifyB402PaymentV2Response1Data.class); + } + + /** + * Convert an instance of VerifyB402PaymentV2Response1Data to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/VerifyB402PaymentV2Response2.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/VerifyB402PaymentV2Response2.java new file mode 100644 index 0000000..6bd1d0c --- /dev/null +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/VerifyB402PaymentV2Response2.java @@ -0,0 +1,449 @@ +/* + * Binance Web3 API + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.web3_wallet.rest.model; + +import com.binance.connector.client.web3_wallet.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** VerifyB402PaymentV2Response2 */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class VerifyB402PaymentV2Response2 { + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + @jakarta.annotation.Nullable + private String status; + + public static final String SERIALIZED_NAME_TYPE = "type"; + + @SerializedName(SERIALIZED_NAME_TYPE) + @jakarta.annotation.Nullable + private String type; + + public static final String SERIALIZED_NAME_CODE = "code"; + + @SerializedName(SERIALIZED_NAME_CODE) + @jakarta.annotation.Nullable + private String code; + + public static final String SERIALIZED_NAME_ERROR_DATA = "errorData"; + + @SerializedName(SERIALIZED_NAME_ERROR_DATA) + @jakarta.annotation.Nullable + private String errorData; + + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + @jakarta.annotation.Nullable + private Object data; + + public static final String SERIALIZED_NAME_SUB_DATA = "subData"; + + @SerializedName(SERIALIZED_NAME_SUB_DATA) + @jakarta.annotation.Nullable + private Object subData; + + public static final String SERIALIZED_NAME_PARAMS = "params"; + + @SerializedName(SERIALIZED_NAME_PARAMS) + @jakarta.annotation.Nullable + private Object params; + + public VerifyB402PaymentV2Response2() {} + + public VerifyB402PaymentV2Response2 status(@jakarta.annotation.Nullable String status) { + this.status = status; + return this; + } + + /** + * Get status + * + * @return status + */ + @jakarta.annotation.Nullable + public String getStatus() { + return status; + } + + public void setStatus(@jakarta.annotation.Nullable String status) { + this.status = status; + } + + public VerifyB402PaymentV2Response2 type(@jakarta.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * + * @return type + */ + @jakarta.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@jakarta.annotation.Nullable String type) { + this.type = type; + } + + public VerifyB402PaymentV2Response2 code(@jakarta.annotation.Nullable String code) { + this.code = code; + return this; + } + + /** + * Get code + * + * @return code + */ + @jakarta.annotation.Nullable + public String getCode() { + return code; + } + + public void setCode(@jakarta.annotation.Nullable String code) { + this.code = code; + } + + public VerifyB402PaymentV2Response2 errorData(@jakarta.annotation.Nullable String errorData) { + this.errorData = errorData; + return this; + } + + /** + * Get errorData + * + * @return errorData + */ + @jakarta.annotation.Nullable + public String getErrorData() { + return errorData; + } + + public void setErrorData(@jakarta.annotation.Nullable String errorData) { + this.errorData = errorData; + } + + public VerifyB402PaymentV2Response2 data(@jakarta.annotation.Nullable Object data) { + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @jakarta.annotation.Nullable + public Object getData() { + return data; + } + + public void setData(@jakarta.annotation.Nullable Object data) { + this.data = data; + } + + public VerifyB402PaymentV2Response2 subData(@jakarta.annotation.Nullable Object subData) { + this.subData = subData; + return this; + } + + /** + * Get subData + * + * @return subData + */ + @jakarta.annotation.Nullable + public Object getSubData() { + return subData; + } + + public void setSubData(@jakarta.annotation.Nullable Object subData) { + this.subData = subData; + } + + public VerifyB402PaymentV2Response2 params(@jakarta.annotation.Nullable Object params) { + this.params = params; + return this; + } + + /** + * Get params + * + * @return params + */ + @jakarta.annotation.Nullable + public Object getParams() { + return params; + } + + public void setParams(@jakarta.annotation.Nullable Object params) { + this.params = params; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + VerifyB402PaymentV2Response2 verifyB402PaymentV2Response2 = + (VerifyB402PaymentV2Response2) o; + return Objects.equals(this.status, verifyB402PaymentV2Response2.status) + && Objects.equals(this.type, verifyB402PaymentV2Response2.type) + && Objects.equals(this.code, verifyB402PaymentV2Response2.code) + && Objects.equals(this.errorData, verifyB402PaymentV2Response2.errorData) + && Objects.equals(this.data, verifyB402PaymentV2Response2.data) + && Objects.equals(this.subData, verifyB402PaymentV2Response2.subData) + && Objects.equals(this.params, verifyB402PaymentV2Response2.params); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(status, type, code, errorData, data, subData, params); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VerifyB402PaymentV2Response2 {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" errorData: ").append(toIndentedString(errorData)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" subData: ").append(toIndentedString(subData)).append("\n"); + sb.append(" params: ").append(toIndentedString(params)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object statusValue = getStatus(); + String statusValueAsString = ""; + statusValueAsString = statusValue.toString(); + sb.append("status=").append(urlEncode(statusValueAsString)).append(""); + Object typeValue = getType(); + String typeValueAsString = ""; + typeValueAsString = typeValue.toString(); + sb.append("type=").append(urlEncode(typeValueAsString)).append(""); + Object codeValue = getCode(); + String codeValueAsString = ""; + codeValueAsString = codeValue.toString(); + sb.append("code=").append(urlEncode(codeValueAsString)).append(""); + Object errorDataValue = getErrorData(); + String errorDataValueAsString = ""; + errorDataValueAsString = errorDataValue.toString(); + sb.append("errorData=").append(urlEncode(errorDataValueAsString)).append(""); + Object dataValue = getData(); + String dataValueAsString = ""; + dataValueAsString = dataValue.toString(); + sb.append("data=").append(urlEncode(dataValueAsString)).append(""); + Object subDataValue = getSubData(); + String subDataValueAsString = ""; + subDataValueAsString = subDataValue.toString(); + sb.append("subData=").append(urlEncode(subDataValueAsString)).append(""); + Object paramsValue = getParams(); + String paramsValueAsString = ""; + paramsValueAsString = paramsValue.toString(); + sb.append("params=").append(urlEncode(paramsValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("status"); + openapiFields.add("type"); + openapiFields.add("code"); + openapiFields.add("errorData"); + openapiFields.add("data"); + openapiFields.add("subData"); + openapiFields.add("params"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * VerifyB402PaymentV2Response2 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!VerifyB402PaymentV2Response2.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in VerifyB402PaymentV2Response2 is not" + + " found in the empty JSON string", + VerifyB402PaymentV2Response2.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) + && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `status` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("status").toString())); + } + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) + && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `type` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("type").toString())); + } + if ((jsonObj.get("code") != null && !jsonObj.get("code").isJsonNull()) + && !jsonObj.get("code").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `code` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("code").toString())); + } + if ((jsonObj.get("errorData") != null && !jsonObj.get("errorData").isJsonNull()) + && !jsonObj.get("errorData").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `errorData` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("errorData").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!VerifyB402PaymentV2Response2.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'VerifyB402PaymentV2Response2' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(VerifyB402PaymentV2Response2.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, VerifyB402PaymentV2Response2 value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public VerifyB402PaymentV2Response2 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of VerifyB402PaymentV2Response2 given an JSON string + * + * @param jsonString JSON string + * @return An instance of VerifyB402PaymentV2Response2 + * @throws IOException if the JSON string is invalid with respect to + * VerifyB402PaymentV2Response2 + */ + public static VerifyB402PaymentV2Response2 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, VerifyB402PaymentV2Response2.class); + } + + /** + * Convert an instance of VerifyB402PaymentV2Response2 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/WalletType.java b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/WalletType.java index f1041b4..43c96a2 100644 --- a/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/WalletType.java +++ b/clients/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/model/WalletType.java @@ -1,6 +1,6 @@ /* * Binance Web3 API - * Cross-chain wallet, market, trading, and transaction APIs for the Binance Web3 API platform. + * Cross-chain wallet, market, trading, transaction, and B402 payment APIs for the Binance Web3 API platform. * * The version of the OpenAPI document: 1.0.0 * diff --git a/examples/web3-wallet/pom.xml b/examples/web3-wallet/pom.xml index 8cf5c4c..b011891 100644 --- a/examples/web3-wallet/pom.xml +++ b/examples/web3-wallet/pom.xml @@ -31,7 +31,7 @@ io.github.binance binance-web3-wallet - 4.1.0 + 4.2.0 \ No newline at end of file diff --git a/examples/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/b402payments/GetB402SupportedConfigurationsV1Example.java b/examples/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/b402payments/GetB402SupportedConfigurationsV1Example.java new file mode 100644 index 0000000..1720043 --- /dev/null +++ b/examples/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/b402payments/GetB402SupportedConfigurationsV1Example.java @@ -0,0 +1,49 @@ +package com.binance.connector.client.web3_wallet.rest.b402payments; + +import com.binance.connector.client.common.ApiException; +import com.binance.connector.client.common.ApiResponse; +import com.binance.connector.client.common.configuration.ClientConfiguration; +import com.binance.connector.client.common.configuration.SignatureConfiguration; +import com.binance.connector.client.web3_wallet.rest.Web3WalletRestApiUtil; +import com.binance.connector.client.web3_wallet.rest.api.Web3WalletRestApi; +import com.binance.connector.client.web3_wallet.rest.model.GetB402SupportedConfigurationsV1Request; +import com.binance.connector.client.web3_wallet.rest.model.GetB402SupportedConfigurationsV1Response; + +/** API examples for B402PaymentsApi */ +public class GetB402SupportedConfigurationsV1Example { + private Web3WalletRestApi api; + + public Web3WalletRestApi getApi() { + if (api == null) { + ClientConfiguration clientConfiguration = + Web3WalletRestApiUtil.getClientConfiguration(); + SignatureConfiguration signatureConfiguration = new SignatureConfiguration(); + signatureConfiguration.setApiKey("apiKey"); + signatureConfiguration.setSecretKey("secretKey"); + clientConfiguration.setSignatureConfiguration(signatureConfiguration); + api = new Web3WalletRestApi(clientConfiguration); + } + return api; + } + + /** + * Get B402 Supported Configurations V1 + * + *

Legacy V1 compatibility endpoint. New integrations should use V2. V1 returns + * `x402Version=1`, method-specific `facilitatorAddress`, and V1 + * signer-map semantics. + * + * @throws ApiException if the Api call fails + */ + public void getB402SupportedConfigurationsV1Example() throws ApiException { + GetB402SupportedConfigurationsV1Request getB402SupportedConfigurationsV1Request = + new GetB402SupportedConfigurationsV1Request(); + getB402SupportedConfigurationsV1Request.body(null); + Long recvWindow = 5000L; + String nonce = "unique-nonce-string"; + ApiResponse response = + getApi().getB402SupportedConfigurationsV1( + getB402SupportedConfigurationsV1Request, recvWindow, nonce); + System.out.println(response.getData()); + } +} diff --git a/examples/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/b402payments/GetB402SupportedConfigurationsV2Example.java b/examples/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/b402payments/GetB402SupportedConfigurationsV2Example.java new file mode 100644 index 0000000..6767d60 --- /dev/null +++ b/examples/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/b402payments/GetB402SupportedConfigurationsV2Example.java @@ -0,0 +1,49 @@ +package com.binance.connector.client.web3_wallet.rest.b402payments; + +import com.binance.connector.client.common.ApiException; +import com.binance.connector.client.common.ApiResponse; +import com.binance.connector.client.common.configuration.ClientConfiguration; +import com.binance.connector.client.common.configuration.SignatureConfiguration; +import com.binance.connector.client.web3_wallet.rest.Web3WalletRestApiUtil; +import com.binance.connector.client.web3_wallet.rest.api.Web3WalletRestApi; +import com.binance.connector.client.web3_wallet.rest.model.GetB402SupportedConfigurationsV2Request; +import com.binance.connector.client.web3_wallet.rest.model.GetB402SupportedConfigurationsV2Response; + +/** API examples for B402PaymentsApi */ +public class GetB402SupportedConfigurationsV2Example { + private Web3WalletRestApi api; + + public Web3WalletRestApi getApi() { + if (api == null) { + ClientConfiguration clientConfiguration = + Web3WalletRestApiUtil.getClientConfiguration(); + SignatureConfiguration signatureConfiguration = new SignatureConfiguration(); + signatureConfiguration.setApiKey("apiKey"); + signatureConfiguration.setSecretKey("secretKey"); + clientConfiguration.setSignatureConfiguration(signatureConfiguration); + api = new Web3WalletRestApi(clientConfiguration); + } + return api; + } + + /** + * Get B402 Supported Configurations V2 + * + *

Return the live x402 V2 payment kinds available to the authenticated Developer Portal + * project. Use the result to construct HTTP 402 payment requirements. Copy the selected + * `extra` object verbatim and refresh cached configuration periodically. + * + * @throws ApiException if the Api call fails + */ + public void getB402SupportedConfigurationsV2Example() throws ApiException { + GetB402SupportedConfigurationsV2Request getB402SupportedConfigurationsV2Request = + new GetB402SupportedConfigurationsV2Request(); + getB402SupportedConfigurationsV2Request.body(null); + Long recvWindow = 5000L; + String nonce = "unique-nonce-string"; + ApiResponse response = + getApi().getB402SupportedConfigurationsV2( + getB402SupportedConfigurationsV2Request, recvWindow, nonce); + System.out.println(response.getData()); + } +} diff --git a/examples/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/b402payments/SettleB402PaymentV1Example.java b/examples/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/b402payments/SettleB402PaymentV1Example.java new file mode 100644 index 0000000..48f92d6 --- /dev/null +++ b/examples/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/b402payments/SettleB402PaymentV1Example.java @@ -0,0 +1,47 @@ +package com.binance.connector.client.web3_wallet.rest.b402payments; + +import com.binance.connector.client.common.ApiException; +import com.binance.connector.client.common.ApiResponse; +import com.binance.connector.client.common.configuration.ClientConfiguration; +import com.binance.connector.client.common.configuration.SignatureConfiguration; +import com.binance.connector.client.web3_wallet.rest.Web3WalletRestApiUtil; +import com.binance.connector.client.web3_wallet.rest.api.Web3WalletRestApi; +import com.binance.connector.client.web3_wallet.rest.model.SettleB402PaymentV1Request; +import com.binance.connector.client.web3_wallet.rest.model.SettleB402PaymentV1Response; + +/** API examples for B402PaymentsApi */ +public class SettleB402PaymentV1Example { + private Web3WalletRestApi api; + + public Web3WalletRestApi getApi() { + if (api == null) { + ClientConfiguration clientConfiguration = + Web3WalletRestApiUtil.getClientConfiguration(); + SignatureConfiguration signatureConfiguration = new SignatureConfiguration(); + signatureConfiguration.setApiKey("apiKey"); + signatureConfiguration.setSecretKey("secretKey"); + clientConfiguration.setSignatureConfiguration(signatureConfiguration); + api = new Web3WalletRestApi(clientConfiguration); + } + return api; + } + + /** + * Settle B402 Payment V1 + * + *

Legacy V1 on-chain settlement endpoint. New integrations should use V2. This operation can + * move real funds and is irreversible. V1 additionally returns `confirmations` in the + * settlement result. + * + * @throws ApiException if the Api call fails + */ + public void settleB402PaymentV1Example() throws ApiException { + SettleB402PaymentV1Request settleB402PaymentV1Request = new SettleB402PaymentV1Request(); + settleB402PaymentV1Request.body(null); + Long recvWindow = 5000L; + String nonce = "unique-nonce-string"; + ApiResponse response = + getApi().settleB402PaymentV1(settleB402PaymentV1Request, recvWindow, nonce); + System.out.println(response.getData()); + } +} diff --git a/examples/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/b402payments/SettleB402PaymentV2Example.java b/examples/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/b402payments/SettleB402PaymentV2Example.java new file mode 100644 index 0000000..3fd174d --- /dev/null +++ b/examples/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/b402payments/SettleB402PaymentV2Example.java @@ -0,0 +1,48 @@ +package com.binance.connector.client.web3_wallet.rest.b402payments; + +import com.binance.connector.client.common.ApiException; +import com.binance.connector.client.common.ApiResponse; +import com.binance.connector.client.common.configuration.ClientConfiguration; +import com.binance.connector.client.common.configuration.SignatureConfiguration; +import com.binance.connector.client.web3_wallet.rest.Web3WalletRestApiUtil; +import com.binance.connector.client.web3_wallet.rest.api.Web3WalletRestApi; +import com.binance.connector.client.web3_wallet.rest.model.SettleB402PaymentV2Request; +import com.binance.connector.client.web3_wallet.rest.model.SettleB402PaymentV2Response; + +/** API examples for B402PaymentsApi */ +public class SettleB402PaymentV2Example { + private Web3WalletRestApi api; + + public Web3WalletRestApi getApi() { + if (api == null) { + ClientConfiguration clientConfiguration = + Web3WalletRestApiUtil.getClientConfiguration(); + SignatureConfiguration signatureConfiguration = new SignatureConfiguration(); + signatureConfiguration.setApiKey("apiKey"); + signatureConfiguration.setSecretKey("secretKey"); + clientConfiguration.setSignatureConfiguration(signatureConfiguration); + api = new Web3WalletRestApi(clientConfiguration); + } + return api; + } + + /** + * Settle B402 Payment V2 + * + *

Submit a verified x402 V2 authorization on-chain. This operation can move real funds and + * is irreversible. For `permit2-upto`, provide `settleAmount` in atomic + * units. Business failure is returned as HTTP 200 with `data.success=false`; + * reconcile any non-empty transaction hash before retrying. + * + * @throws ApiException if the Api call fails + */ + public void settleB402PaymentV2Example() throws ApiException { + SettleB402PaymentV2Request settleB402PaymentV2Request = new SettleB402PaymentV2Request(); + settleB402PaymentV2Request.body(null); + Long recvWindow = 5000L; + String nonce = "unique-nonce-string"; + ApiResponse response = + getApi().settleB402PaymentV2(settleB402PaymentV2Request, recvWindow, nonce); + System.out.println(response.getData()); + } +} diff --git a/examples/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/b402payments/VerifyB402PaymentV1Example.java b/examples/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/b402payments/VerifyB402PaymentV1Example.java new file mode 100644 index 0000000..dff6fd3 --- /dev/null +++ b/examples/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/b402payments/VerifyB402PaymentV1Example.java @@ -0,0 +1,47 @@ +package com.binance.connector.client.web3_wallet.rest.b402payments; + +import com.binance.connector.client.common.ApiException; +import com.binance.connector.client.common.ApiResponse; +import com.binance.connector.client.common.configuration.ClientConfiguration; +import com.binance.connector.client.common.configuration.SignatureConfiguration; +import com.binance.connector.client.web3_wallet.rest.Web3WalletRestApiUtil; +import com.binance.connector.client.web3_wallet.rest.api.Web3WalletRestApi; +import com.binance.connector.client.web3_wallet.rest.model.VerifyB402PaymentV1Request; +import com.binance.connector.client.web3_wallet.rest.model.VerifyB402PaymentV1Response; + +/** API examples for B402PaymentsApi */ +public class VerifyB402PaymentV1Example { + private Web3WalletRestApi api; + + public Web3WalletRestApi getApi() { + if (api == null) { + ClientConfiguration clientConfiguration = + Web3WalletRestApiUtil.getClientConfiguration(); + SignatureConfiguration signatureConfiguration = new SignatureConfiguration(); + signatureConfiguration.setApiKey("apiKey"); + signatureConfiguration.setSecretKey("secretKey"); + clientConfiguration.setSignatureConfiguration(signatureConfiguration); + api = new Web3WalletRestApi(clientConfiguration); + } + return api; + } + + /** + * Verify B402 Payment V1 + * + *

Legacy V1 off-chain verification endpoint. New integrations should use V2. Portal identity + * is resolved from the API Key project, so `merchantId` is omitted from the external + * request. + * + * @throws ApiException if the Api call fails + */ + public void verifyB402PaymentV1Example() throws ApiException { + VerifyB402PaymentV1Request verifyB402PaymentV1Request = new VerifyB402PaymentV1Request(); + verifyB402PaymentV1Request.body(null); + Long recvWindow = 5000L; + String nonce = "unique-nonce-string"; + ApiResponse response = + getApi().verifyB402PaymentV1(verifyB402PaymentV1Request, recvWindow, nonce); + System.out.println(response.getData()); + } +} diff --git a/examples/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/b402payments/VerifyB402PaymentV2Example.java b/examples/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/b402payments/VerifyB402PaymentV2Example.java new file mode 100644 index 0000000..fcd6873 --- /dev/null +++ b/examples/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/b402payments/VerifyB402PaymentV2Example.java @@ -0,0 +1,48 @@ +package com.binance.connector.client.web3_wallet.rest.b402payments; + +import com.binance.connector.client.common.ApiException; +import com.binance.connector.client.common.ApiResponse; +import com.binance.connector.client.common.configuration.ClientConfiguration; +import com.binance.connector.client.common.configuration.SignatureConfiguration; +import com.binance.connector.client.web3_wallet.rest.Web3WalletRestApiUtil; +import com.binance.connector.client.web3_wallet.rest.api.Web3WalletRestApi; +import com.binance.connector.client.web3_wallet.rest.model.VerifyB402PaymentV2Request; +import com.binance.connector.client.web3_wallet.rest.model.VerifyB402PaymentV2Response; + +/** API examples for B402PaymentsApi */ +public class VerifyB402PaymentV2Example { + private Web3WalletRestApi api; + + public Web3WalletRestApi getApi() { + if (api == null) { + ClientConfiguration clientConfiguration = + Web3WalletRestApiUtil.getClientConfiguration(); + SignatureConfiguration signatureConfiguration = new SignatureConfiguration(); + signatureConfiguration.setApiKey("apiKey"); + signatureConfiguration.setSecretKey("secretKey"); + clientConfiguration.setSignatureConfiguration(signatureConfiguration); + api = new Web3WalletRestApi(clientConfiguration); + } + return api; + } + + /** + * Verify B402 Payment V2 + * + *

Validate an x402 V2 payment authorization off-chain without spending funds or broadcasting + * a transaction. Portal identity is resolved from the authenticated API Key project; omit + * `merchantId`. A validation failure is returned as HTTP 200 with + * `data.isValid=false`. + * + * @throws ApiException if the Api call fails + */ + public void verifyB402PaymentV2Example() throws ApiException { + VerifyB402PaymentV2Request verifyB402PaymentV2Request = new VerifyB402PaymentV2Request(); + verifyB402PaymentV2Request.body(null); + Long recvWindow = 5000L; + String nonce = "unique-nonce-string"; + ApiResponse response = + getApi().verifyB402PaymentV2(verifyB402PaymentV2Request, recvWindow, nonce); + System.out.println(response.getData()); + } +} diff --git a/examples/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/websocket/GetWebSocketAuthTokenExample.java b/examples/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/websocket/GetWebSocketAuthTokenExample.java new file mode 100644 index 0000000..6a36675 --- /dev/null +++ b/examples/web3-wallet/src/main/java/com/binance/connector/client/web3_wallet/rest/websocket/GetWebSocketAuthTokenExample.java @@ -0,0 +1,45 @@ +package com.binance.connector.client.web3_wallet.rest.websocket; + +import com.binance.connector.client.common.ApiException; +import com.binance.connector.client.common.ApiResponse; +import com.binance.connector.client.common.configuration.ClientConfiguration; +import com.binance.connector.client.common.configuration.SignatureConfiguration; +import com.binance.connector.client.web3_wallet.rest.Web3WalletRestApiUtil; +import com.binance.connector.client.web3_wallet.rest.api.Web3WalletRestApi; +import com.binance.connector.client.web3_wallet.rest.api.WebSocketApi; +import com.binance.connector.client.web3_wallet.rest.model.GetWebSocketAuthTokenResponse; + +/** API examples for WebSocketApi */ +public class GetWebSocketAuthTokenExample { + private Web3WalletRestApi api; + + public Web3WalletRestApi getApi() { + if (api == null) { + ClientConfiguration clientConfiguration = + Web3WalletRestApiUtil.getClientConfiguration(); + SignatureConfiguration signatureConfiguration = new SignatureConfiguration(); + signatureConfiguration.setApiKey("apiKey"); + signatureConfiguration.setSecretKey("secretKey"); + clientConfiguration.setSignatureConfiguration(signatureConfiguration); + api = new Web3WalletRestApi(clientConfiguration); + } + return api; + } + + /** + * Get WebSocket Auth Token + * + *

Get a WebSocket auth token before connecting to the WebSocket stream service. + * + * @throws ApiException if the Api call fails + */ + public void getWebSocketAuthTokenExample() throws ApiException { + Long recvWindow = 5000L; + String nonce = "unique-nonce-string"; + WebSocketApi.GetWebSocketAuthTokenRequest request = + new WebSocketApi.GetWebSocketAuthTokenRequest(); + ApiResponse response = + getApi().getWebSocketAuthToken(request); + System.out.println(response.getData()); + } +}