From 9b780812bb3c625b27627f91411eab6219fefe86 Mon Sep 17 00:00:00 2001 From: theo-s68 <194042188+theo-s68@users.noreply.github.com> Date: Tue, 20 Jan 2026 16:37:32 +0700 Subject: [PATCH] alpha v1.0.0 --- README.md | 3 + clients/alpha/CHANGELOG.md | 5 + clients/alpha/README.md | 162 ++ .../alpha/docs/AggregatedTradesResponse.md | 16 + .../docs/AggregatedTradesResponseDataInner.md | 19 + clients/alpha/docs/GetExchangeInfoResponse.md | 17 + .../alpha/docs/GetExchangeInfoResponseData.md | 16 + .../GetExchangeInfoResponseDataAssetsInner.md | 13 + ...GetExchangeInfoResponseDataSymbolsInner.md | 22 + ...nfoResponseDataSymbolsInnerFiltersInner.md | 28 + clients/alpha/docs/KlinesResponse.md | 17 + clients/alpha/docs/KlinesResponseDataItem.md | 12 + .../alpha/docs/KlinesResponseDataItemInner.md | 12 + clients/alpha/docs/MarketDataApi.md | 331 ++++ clients/alpha/docs/TickerResponse.md | 17 + clients/alpha/docs/TickerResponseData.md | 28 + clients/alpha/docs/TokenListResponse.md | 17 + .../alpha/docs/TokenListResponseDataInner.md | 50 + .../docs/rest-api/certificate-pinning.md | 31 + clients/alpha/docs/rest-api/compression.md | 20 + clients/alpha/docs/rest-api/error-handling.md | 17 + .../docs/rest-api/key-pair-authentication.md | 20 + .../alpha/docs/rest-api/migration-guide.md | 144 ++ clients/alpha/docs/rest-api/proxy.md | 45 + clients/alpha/docs/rest-api/retries.md | 25 + clients/alpha/docs/rest-api/timeout.md | 25 + clients/alpha/example_rest.md | 12 + clients/alpha/pom.xml | 37 + .../client/alpha/rest/AlphaRestApiUtil.java | 25 + .../connector/client/alpha/rest/JSON.java | 453 +++++ .../client/alpha/rest/api/AlphaRestApi.java | 151 ++ .../client/alpha/rest/api/MarketDataApi.java | 809 +++++++++ .../rest/model/AggregatedTradesResponse.java | 363 ++++ .../AggregatedTradesResponseDataInner.java | 424 +++++ .../rest/model/GetExchangeInfoResponse.java | 363 ++++ .../model/GetExchangeInfoResponseData.java | 396 ++++ ...etExchangeInfoResponseDataAssetsInner.java | 219 +++ ...tExchangeInfoResponseDataSymbolsInner.java | 630 +++++++ ...oResponseDataSymbolsInnerFiltersInner.java | 884 +++++++++ .../alpha/rest/model/KlinesResponse.java | 380 ++++ .../rest/model/KlinesResponseDataItem.java | 182 ++ .../model/KlinesResponseDataItemInner.java | 306 ++++ .../alpha/rest/model/TickerResponse.java | 359 ++++ .../alpha/rest/model/TickerResponseData.java | 794 ++++++++ .../alpha/rest/model/TokenListResponse.java | 392 ++++ .../model/TokenListResponseDataInner.java | 1617 +++++++++++++++++ .../alpha/rest/api/MarketDataApiTest.java | 211 +++ clients/pom.xml | 1 + examples/alpha/pom.xml | 37 + .../marketdata/AggregatedTradesExample.java | 61 + .../marketdata/GetExchangeInfoExample.java | 51 + .../alpha/rest/marketdata/KlinesExample.java | 57 + .../alpha/rest/marketdata/TickerExample.java | 52 + .../rest/marketdata/TokenListExample.java | 51 + examples/pom.xml | 1 + 55 files changed, 10430 insertions(+) create mode 100644 clients/alpha/CHANGELOG.md create mode 100644 clients/alpha/README.md create mode 100644 clients/alpha/docs/AggregatedTradesResponse.md create mode 100644 clients/alpha/docs/AggregatedTradesResponseDataInner.md create mode 100644 clients/alpha/docs/GetExchangeInfoResponse.md create mode 100644 clients/alpha/docs/GetExchangeInfoResponseData.md create mode 100644 clients/alpha/docs/GetExchangeInfoResponseDataAssetsInner.md create mode 100644 clients/alpha/docs/GetExchangeInfoResponseDataSymbolsInner.md create mode 100644 clients/alpha/docs/GetExchangeInfoResponseDataSymbolsInnerFiltersInner.md create mode 100644 clients/alpha/docs/KlinesResponse.md create mode 100644 clients/alpha/docs/KlinesResponseDataItem.md create mode 100644 clients/alpha/docs/KlinesResponseDataItemInner.md create mode 100644 clients/alpha/docs/MarketDataApi.md create mode 100644 clients/alpha/docs/TickerResponse.md create mode 100644 clients/alpha/docs/TickerResponseData.md create mode 100644 clients/alpha/docs/TokenListResponse.md create mode 100644 clients/alpha/docs/TokenListResponseDataInner.md create mode 100644 clients/alpha/docs/rest-api/certificate-pinning.md create mode 100644 clients/alpha/docs/rest-api/compression.md create mode 100644 clients/alpha/docs/rest-api/error-handling.md create mode 100644 clients/alpha/docs/rest-api/key-pair-authentication.md create mode 100644 clients/alpha/docs/rest-api/migration-guide.md create mode 100644 clients/alpha/docs/rest-api/proxy.md create mode 100644 clients/alpha/docs/rest-api/retries.md create mode 100644 clients/alpha/docs/rest-api/timeout.md create mode 100644 clients/alpha/example_rest.md create mode 100644 clients/alpha/pom.xml create mode 100644 clients/alpha/src/main/java/com/binance/connector/client/alpha/rest/AlphaRestApiUtil.java create mode 100644 clients/alpha/src/main/java/com/binance/connector/client/alpha/rest/JSON.java create mode 100644 clients/alpha/src/main/java/com/binance/connector/client/alpha/rest/api/AlphaRestApi.java create mode 100644 clients/alpha/src/main/java/com/binance/connector/client/alpha/rest/api/MarketDataApi.java create mode 100644 clients/alpha/src/main/java/com/binance/connector/client/alpha/rest/model/AggregatedTradesResponse.java create mode 100644 clients/alpha/src/main/java/com/binance/connector/client/alpha/rest/model/AggregatedTradesResponseDataInner.java create mode 100644 clients/alpha/src/main/java/com/binance/connector/client/alpha/rest/model/GetExchangeInfoResponse.java create mode 100644 clients/alpha/src/main/java/com/binance/connector/client/alpha/rest/model/GetExchangeInfoResponseData.java create mode 100644 clients/alpha/src/main/java/com/binance/connector/client/alpha/rest/model/GetExchangeInfoResponseDataAssetsInner.java create mode 100644 clients/alpha/src/main/java/com/binance/connector/client/alpha/rest/model/GetExchangeInfoResponseDataSymbolsInner.java create mode 100644 clients/alpha/src/main/java/com/binance/connector/client/alpha/rest/model/GetExchangeInfoResponseDataSymbolsInnerFiltersInner.java create mode 100644 clients/alpha/src/main/java/com/binance/connector/client/alpha/rest/model/KlinesResponse.java create mode 100644 clients/alpha/src/main/java/com/binance/connector/client/alpha/rest/model/KlinesResponseDataItem.java create mode 100644 clients/alpha/src/main/java/com/binance/connector/client/alpha/rest/model/KlinesResponseDataItemInner.java create mode 100644 clients/alpha/src/main/java/com/binance/connector/client/alpha/rest/model/TickerResponse.java create mode 100644 clients/alpha/src/main/java/com/binance/connector/client/alpha/rest/model/TickerResponseData.java create mode 100644 clients/alpha/src/main/java/com/binance/connector/client/alpha/rest/model/TokenListResponse.java create mode 100644 clients/alpha/src/main/java/com/binance/connector/client/alpha/rest/model/TokenListResponseDataInner.java create mode 100644 clients/alpha/src/test/java/com/binance/connector/client/alpha/rest/api/MarketDataApiTest.java create mode 100644 examples/alpha/pom.xml create mode 100644 examples/alpha/src/main/java/com/binance/connector/client/alpha/rest/marketdata/AggregatedTradesExample.java create mode 100644 examples/alpha/src/main/java/com/binance/connector/client/alpha/rest/marketdata/GetExchangeInfoExample.java create mode 100644 examples/alpha/src/main/java/com/binance/connector/client/alpha/rest/marketdata/KlinesExample.java create mode 100644 examples/alpha/src/main/java/com/binance/connector/client/alpha/rest/marketdata/TickerExample.java create mode 100644 examples/alpha/src/main/java/com/binance/connector/client/alpha/rest/marketdata/TokenListExample.java diff --git a/README.md b/README.md index 5053f80cb..d46c43a31 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ Before using the connectors, ensure you have: ## Available Connectors - [binance-algo](clients/algo) - Algo Trading connector +- [binance-alpha](clients/alpha) - Alpha connector - [binance-c2c](clients/c2c) - C2C connector - [binance-convert](clients/convert) - Convert connector - [binance-copy-trading](clients/copy-trading) - Copy Trading connector @@ -208,6 +209,8 @@ When creating WebSocket API clients (such as SpotWebSocketApi), you can follow: ## Examples **Algo**: [Rest API](clients/algo/example_rest.md) +**Alpha**: [Rest API](clients/alpha/example_rest.md) + **C2c**: [Rest API](clients/c2c/example_rest.md) **Convert**: [Rest API](clients/convert/example_rest.md) diff --git a/clients/alpha/CHANGELOG.md b/clients/alpha/CHANGELOG.md new file mode 100644 index 000000000..7b6b27370 --- /dev/null +++ b/clients/alpha/CHANGELOG.md @@ -0,0 +1,5 @@ +# Changelog + +## 1.0.0 - 2026-01-20 + +- Initial release \ No newline at end of file diff --git a/clients/alpha/README.md b/clients/alpha/README.md new file mode 100644 index 000000000..698cd6102 --- /dev/null +++ b/clients/alpha/README.md @@ -0,0 +1,162 @@ +# Binance Java Alpha Connector + +[![Open Issues](https://img.shields.io/github/issues/binance/binance-connector-java)](https://github.com/binance/binance-connector-java/issues) +[![Code Style: Spotless](https://img.shields.io/badge/code%20style-spotless-ff69b4)](https://github.com/diffplug/spotless) +[![Maven Central Version](https://img.shields.io/maven-central/v/io.github.binance/binance-alpha)](https://central.sonatype.com/artifact/io.github.binance/binance-alpha) +![Java Version](https://img.shields.io/badge/Java-%3E=11-brightgreen) +[![Known Vulnerabilities](https://snyk.io/test/github/binance/binance-connector-java/badge.svg)](https://snyk.io/test/github/binance/binance-connector-java) +[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) + +This is a client library for the Binance Alpha API, enabling developers to interact programmatically with Binance Alpha. The library provides tools to access curated early-stage token data, track Alpha project metrics and integrate discovery-focused market information into applications through the REST API: + +- [REST API](./src/main/java/com/binance/connector/client/alpha/rest/api) + +## Table of Contents + +- [Supported Features](#supported-features) +- [Installation](#installation) +- [Documentation](#documentation) +- [REST APIs](#rest-apis) +- [Testing](#testing) +- [Migration Guide](#migration-guide) +- [Contributing](#contributing) +- [License](#license) + +## Supported Features + +- REST API Endpoints: + - `/bapi/defi/v1/*` +- Inclusion of test cases and examples for quick onboarding. + +## Installation + +To use this library, ensure your environment is running Java version **11** or newer. + +Then add dependency to pom.xml: + +```xml + + io.github.binance + binance-alpha + 1.1.0 + +``` + +## Documentation + +For detailed information, refer to the [Binance API Documentation](https://developers.binance.com/docs/alpha). + +### REST APIs + +All REST API endpoints are available through the [`rest`](./src/main/java/com/binance/connector/client/alpha/rest) module. Note that some endpoints require authentication using your Binance API credentials. + +```java +import com.binance.connector.client.alpha.rest.AlphaRestApiUtil; +import com.binance.connector.client.alpha.rest.api.AlphaRestApi; +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; + +public static void main(String[] args) { + ClientConfiguration clientConfiguration = AlphaRestApiUtil.getClientConfiguration(); + SignatureConfiguration signatureConfiguration = new SignatureConfiguration(); + signatureConfiguration.setApiKey("apiKey"); + signatureConfiguration.setPrivateKey("path/to/private.key"); + clientConfiguration.setSignatureConfiguration(signatureConfiguration); + AlphaRestApi api = new AlphaRestApi(clientConfiguration); +} +``` + +More examples can be found in the [`examples/rest`](./../../examples/alpha/src/main/java/com/binance/connector/client/alpha/rest) folder. + +#### Configuration Options + +The REST API supports the following advanced configuration options: + +- `proxy`: Proxy configuration for http client. +- `certificatePinner`: Certificate Pinner configuration for http client. +- `connectTimeout`: Timeout for requests in milliseconds (default: 1000 ms). +- `readTimeout`: Timeout for requests in milliseconds (default: 5000 ms). +- `compression`: Enable response compression (default: true). +- `retries`: Number of retry attempts for failed requests (default: 3). +- `backoff`: Delay in milliseconds between retries (default: 200 ms). +- `timeUnit`: TimeUnit to be returned by API (default MILLISECOND). +- `apiKey`: Binance API Key +- `secretKey`: Binance Secret Key, if using HMAC algorithm +- `privateKey`: RSA or ED25519 private key for authentication. +- `privateKeyPass`: Passphrase for the private key, if encrypted. + +##### Timeout + +You can configure a timeout for requests in milliseconds. If the request exceeds the specified timeout, it will be aborted. See the [Timeout example](./docs/rest-api/timeout.md) for detailed usage. + +##### Proxy + +The REST API supports HTTP/HTTPS proxy configurations. See the [Proxy example](./docs/rest-api/proxy.md) for detailed usage. + +##### Keep-Alive + +Enable HTTP keep-alive for persistent connections. See the [Keep-Alive example](./docs/rest-api/keepAlive.md) for detailed usage. + +##### Compression + +Enable or disable response compression. See the [Compression example](./docs/rest-api/compression.md) for detailed usage. + +##### Retries + +Configure the number of retry attempts and delay in milliseconds between retries for failed requests. See the [Retries example](./docs/rest-api/retries.md) for detailed usage. + +##### Key Pair Based Authentication + +The REST API supports key pair-based authentication for secure communication. You can use `RSA` or `ED25519` keys for signing requests. See the [Key Pair Based Authentication example](./docs/rest-api/key-pair-authentication.md) for detailed usage. + +##### Certificate Pinning + +To enhance security, you can use certificate pinning with the `httpsAgent` option in the configuration. This ensures the client only communicates with servers using specific certificates. See the [Certificate Pinning example](./docs/rest-api/certificate-pinning.md) for detailed usage. + +#### Error Handling + +The REST API provides detailed error types to help you handle issues effectively: + +- `ConnectorClientError`: General client error. + +See the [Error Handling example](./docs/rest-api/error-handling.md) for detailed usage. + +If `basePath` is not provided, it defaults to `https://api.binance.com`. + +## Testing + +To run the tests: + +```bash +mvn -f clients/pom.xml -pl alpha test +``` + +The tests cover: + +- REST API endpoints +- Signature generation + +## Migration Guide + +If you are upgrading to the new modularized structure, refer to the [Migration Guide](./docs/rest-api/migration-guide.md) for detailed steps. + +## Contributing + +Contributions are welcome! + +Since this repository contains auto-generated code, we encourage you to start by opening a GitHub issue to discuss your ideas or suggest improvements. This helps ensure that changes align with the project's goals and auto-generation processes. + +To contribute: + +1. Open a GitHub issue describing your suggestion or the bug you've identified. +2. If it's determined that changes are necessary, the maintainers will merge the changes into the main branch. + +Please ensure that all tests pass if you're making a direct contribution. Submit a pull request only after discussing and confirming the change. + +Thank you for your contributions! + +## License + +This project is licensed under the MIT License. See the [LICENSE](../../LICENSE) file for details. \ No newline at end of file diff --git a/clients/alpha/docs/AggregatedTradesResponse.md b/clients/alpha/docs/AggregatedTradesResponse.md new file mode 100644 index 000000000..00e952687 --- /dev/null +++ b/clients/alpha/docs/AggregatedTradesResponse.md @@ -0,0 +1,16 @@ + + +# AggregatedTradesResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**code** | **String** | | [optional] | +|**message** | **String** | | [optional] | +|**messageDetail** | **String** | | [optional] | +|**data** | [**List<AggregatedTradesResponseDataInner>**](AggregatedTradesResponseDataInner.md) | | [optional] | + + + diff --git a/clients/alpha/docs/AggregatedTradesResponseDataInner.md b/clients/alpha/docs/AggregatedTradesResponseDataInner.md new file mode 100644 index 000000000..bdc5696cd --- /dev/null +++ b/clients/alpha/docs/AggregatedTradesResponseDataInner.md @@ -0,0 +1,19 @@ + + +# AggregatedTradesResponseDataInner + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**aLowerCase** | **Long** | | [optional] | +|**pLowerCase** | **String** | | [optional] | +|**qLowerCase** | **String** | | [optional] | +|**fLowerCase** | **Long** | | [optional] | +|**lLowerCase** | **Long** | | [optional] | +|**T** | **Long** | | [optional] | +|**mLowerCase** | **Boolean** | | [optional] | + + + diff --git a/clients/alpha/docs/GetExchangeInfoResponse.md b/clients/alpha/docs/GetExchangeInfoResponse.md new file mode 100644 index 000000000..d57725410 --- /dev/null +++ b/clients/alpha/docs/GetExchangeInfoResponse.md @@ -0,0 +1,17 @@ + + +# GetExchangeInfoResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**code** | **String** | | [optional] | +|**message** | **String** | | [optional] | +|**messageDetail** | **String** | | [optional] | +|**success** | **Boolean** | | [optional] | +|**data** | [**GetExchangeInfoResponseData**](GetExchangeInfoResponseData.md) | | [optional] | + + + diff --git a/clients/alpha/docs/GetExchangeInfoResponseData.md b/clients/alpha/docs/GetExchangeInfoResponseData.md new file mode 100644 index 000000000..7685dee66 --- /dev/null +++ b/clients/alpha/docs/GetExchangeInfoResponseData.md @@ -0,0 +1,16 @@ + + +# GetExchangeInfoResponseData + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**timezone** | **String** | | [optional] | +|**assets** | [**List<GetExchangeInfoResponseDataAssetsInner>**](GetExchangeInfoResponseDataAssetsInner.md) | | [optional] | +|**symbols** | [**List<GetExchangeInfoResponseDataSymbolsInner>**](GetExchangeInfoResponseDataSymbolsInner.md) | | [optional] | +|**orderTypes** | **String** | | [optional] | + + + diff --git a/clients/alpha/docs/GetExchangeInfoResponseDataAssetsInner.md b/clients/alpha/docs/GetExchangeInfoResponseDataAssetsInner.md new file mode 100644 index 000000000..fa3f88eb9 --- /dev/null +++ b/clients/alpha/docs/GetExchangeInfoResponseDataAssetsInner.md @@ -0,0 +1,13 @@ + + +# GetExchangeInfoResponseDataAssetsInner + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**asset** | **String** | | [optional] | + + + diff --git a/clients/alpha/docs/GetExchangeInfoResponseDataSymbolsInner.md b/clients/alpha/docs/GetExchangeInfoResponseDataSymbolsInner.md new file mode 100644 index 000000000..ac3936c12 --- /dev/null +++ b/clients/alpha/docs/GetExchangeInfoResponseDataSymbolsInner.md @@ -0,0 +1,22 @@ + + +# GetExchangeInfoResponseDataSymbolsInner + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**symbol** | **String** | | [optional] | +|**status** | **String** | | [optional] | +|**baseAsset** | **String** | | [optional] | +|**quoteAsset** | **String** | | [optional] | +|**pricePrecision** | **Long** | | [optional] | +|**quantityPrecision** | **Long** | | [optional] | +|**baseAssetPrecision** | **Long** | | [optional] | +|**quotePrecision** | **Long** | | [optional] | +|**filters** | [**List<GetExchangeInfoResponseDataSymbolsInnerFiltersInner>**](GetExchangeInfoResponseDataSymbolsInnerFiltersInner.md) | | [optional] | +|**orderTypes** | **List<String>** | | [optional] | + + + diff --git a/clients/alpha/docs/GetExchangeInfoResponseDataSymbolsInnerFiltersInner.md b/clients/alpha/docs/GetExchangeInfoResponseDataSymbolsInnerFiltersInner.md new file mode 100644 index 000000000..368bf84ed --- /dev/null +++ b/clients/alpha/docs/GetExchangeInfoResponseDataSymbolsInnerFiltersInner.md @@ -0,0 +1,28 @@ + + +# GetExchangeInfoResponseDataSymbolsInnerFiltersInner + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**filterType** | **String** | | [optional] | +|**minPrice** | **String** | | [optional] | +|**maxPrice** | **String** | | [optional] | +|**tickSize** | **String** | | [optional] | +|**stepSize** | **String** | | [optional] | +|**maxQty** | **String** | | [optional] | +|**minQty** | **String** | | [optional] | +|**limit** | **Long** | | [optional] | +|**minNotional** | **String** | | [optional] | +|**maxNotional** | **String** | | [optional] | +|**multiplierDown** | **String** | | [optional] | +|**multiplierUp** | **String** | | [optional] | +|**bidMultiplierUp** | **String** | | [optional] | +|**askMultiplierUp** | **String** | | [optional] | +|**bidMultiplierDown** | **String** | | [optional] | +|**askMultiplierDown** | **String** | | [optional] | + + + diff --git a/clients/alpha/docs/KlinesResponse.md b/clients/alpha/docs/KlinesResponse.md new file mode 100644 index 000000000..9faabf9ee --- /dev/null +++ b/clients/alpha/docs/KlinesResponse.md @@ -0,0 +1,17 @@ + + +# KlinesResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**code** | **String** | | [optional] | +|**message** | **String** | | [optional] | +|**messageDetail** | **String** | | [optional] | +|**success** | **Boolean** | | [optional] | +|**data** | **List<KlinesResponseDataItem>** | | [optional] | + + + diff --git a/clients/alpha/docs/KlinesResponseDataItem.md b/clients/alpha/docs/KlinesResponseDataItem.md new file mode 100644 index 000000000..cf48027e9 --- /dev/null +++ b/clients/alpha/docs/KlinesResponseDataItem.md @@ -0,0 +1,12 @@ + + +# KlinesResponseDataItem + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| + + + diff --git a/clients/alpha/docs/KlinesResponseDataItemInner.md b/clients/alpha/docs/KlinesResponseDataItemInner.md new file mode 100644 index 000000000..05d30dde2 --- /dev/null +++ b/clients/alpha/docs/KlinesResponseDataItemInner.md @@ -0,0 +1,12 @@ + + +# KlinesResponseDataItemInner + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| + + + diff --git a/clients/alpha/docs/MarketDataApi.md b/clients/alpha/docs/MarketDataApi.md new file mode 100644 index 000000000..9a637b4f4 --- /dev/null +++ b/clients/alpha/docs/MarketDataApi.md @@ -0,0 +1,331 @@ +# MarketDataApi + +All URIs are relative to *https://www.binance.com* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**aggregatedTrades**](MarketDataApi.md#aggregatedTrades) | **GET** /bapi/defi/v1/public/alpha-trade/agg-trades | Aggregated Trades | +| [**getExchangeInfo**](MarketDataApi.md#getExchangeInfo) | **GET** /bapi/defi/v1/public/alpha-trade/get-exchange-info | Get Exchange Info | +| [**klines**](MarketDataApi.md#klines) | **GET** /bapi/defi/v1/public/alpha-trade/klines | Klines (Candlestick Data) | +| [**ticker**](MarketDataApi.md#ticker) | **GET** /bapi/defi/v1/public/alpha-trade/ticker | Ticker (24hr Price Statistics) | +| [**tokenList**](MarketDataApi.md#tokenList) | **GET** /bapi/defi/v1/public/wallet-direct/buw/wallet/cex/alpha/all/token/list | Token List | + + + +# **aggregatedTrades** +> AggregatedTradesResponse aggregatedTrades(symbol, fromId, startTime, endTime, limit) + +Aggregated Trades + +Retrieves compressed, aggregated historical trades for a specific symbol. Useful for recent trade history. Weight: 0 + +### Example +```java +// Import classes: +import com.binance.connector.client.alpha.ApiClient; +import com.binance.connector.client.alpha.ApiException; +import com.binance.connector.client.alpha.Configuration; +import com.binance.connector.client.alpha.models.*; +import com.binance.connector.client.alpha.rest.api.MarketDataApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://www.binance.com"); + + MarketDataApi apiInstance = new MarketDataApi(defaultClient); + String symbol = "symbol_example"; // String | e.g., \"ALPHA_175USDT\" – use token ID from Token List + Long fromId = 56L; // Long | starting trade ID to fetch from + Long startTime = 56L; // Long | start timestamp (milliseconds) + Long endTime = 56L; // Long | end timestamp (milliseconds) + Long limit = 56L; // Long | number of results to return (default 500, max 1000) + try { + AggregatedTradesResponse result = apiInstance.aggregatedTrades(symbol, fromId, startTime, endTime, limit); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling MarketDataApi#aggregatedTrades"); + 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 | +|------------- | ------------- | ------------- | -------------| +| **symbol** | **String**| e.g., \"ALPHA_175USDT\" – use token ID from Token List | | +| **fromId** | **Long**| starting trade ID to fetch from | [optional] | +| **startTime** | **Long**| start timestamp (milliseconds) | [optional] | +| **endTime** | **Long**| end timestamp (milliseconds) | [optional] | +| **limit** | **Long**| number of results to return (default 500, max 1000) | [optional] | + +### Return type + +[**AggregatedTradesResponse**](AggregatedTradesResponse.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** | Aggregated Trades | - | + + +# **getExchangeInfo** +> GetExchangeInfoResponse getExchangeInfo() + +Get Exchange Info + +Fetches general exchange information, such as supported symbols, rate limits, and server time. Weight: 0 + +### Example +```java +// Import classes: +import com.binance.connector.client.alpha.ApiClient; +import com.binance.connector.client.alpha.ApiException; +import com.binance.connector.client.alpha.Configuration; +import com.binance.connector.client.alpha.models.*; +import com.binance.connector.client.alpha.rest.api.MarketDataApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://www.binance.com"); + + MarketDataApi apiInstance = new MarketDataApi(defaultClient); + try { + GetExchangeInfoResponse result = apiInstance.getExchangeInfo(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling MarketDataApi#getExchangeInfo"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**GetExchangeInfoResponse**](GetExchangeInfoResponse.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** | Get Exchange Info | - | + + +# **klines** +> KlinesResponse klines(symbol, interval, limit, startTime, endTime) + +Klines (Candlestick Data) + +Fetches Kline/candlestick bars for a symbol, which include open/high/low/close prices and volume over intervals. Useful for charting and analysis. Weight: 0 + +### Example +```java +// Import classes: +import com.binance.connector.client.alpha.ApiClient; +import com.binance.connector.client.alpha.ApiException; +import com.binance.connector.client.alpha.Configuration; +import com.binance.connector.client.alpha.models.*; +import com.binance.connector.client.alpha.rest.api.MarketDataApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://www.binance.com"); + + MarketDataApi apiInstance = new MarketDataApi(defaultClient); + String symbol = "symbol_example"; // String | e.g., \"ALPHA_175USDT\" – use token ID from Token List + String interval = "interval_example"; // String | e.g., \"1h\" – supported intervals: 1s, 15s, 1m, 3m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 8h, 12h, 1d, 3d, 1w, 1M + Long limit = 56L; // Long | number of results to return (default 500, max 1000) + Long startTime = 56L; // Long | start timestamp (milliseconds) + Long endTime = 56L; // Long | end timestamp (milliseconds) + try { + KlinesResponse result = apiInstance.klines(symbol, interval, limit, startTime, endTime); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling MarketDataApi#klines"); + 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 | +|------------- | ------------- | ------------- | -------------| +| **symbol** | **String**| e.g., \"ALPHA_175USDT\" – use token ID from Token List | | +| **interval** | **String**| e.g., \"1h\" – supported intervals: 1s, 15s, 1m, 3m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 8h, 12h, 1d, 3d, 1w, 1M | | +| **limit** | **Long**| number of results to return (default 500, max 1000) | [optional] | +| **startTime** | **Long**| start timestamp (milliseconds) | [optional] | +| **endTime** | **Long**| end timestamp (milliseconds) | [optional] | + +### Return type + +[**KlinesResponse**](KlinesResponse.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** | Klines | - | + + +# **ticker** +> TickerResponse ticker(symbol) + +Ticker (24hr Price Statistics) + +Gets the 24-hour rolling window price change statistics for a symbol, including volume and price changes. Weight: 0 + +### Example +```java +// Import classes: +import com.binance.connector.client.alpha.ApiClient; +import com.binance.connector.client.alpha.ApiException; +import com.binance.connector.client.alpha.Configuration; +import com.binance.connector.client.alpha.models.*; +import com.binance.connector.client.alpha.rest.api.MarketDataApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://www.binance.com"); + + MarketDataApi apiInstance = new MarketDataApi(defaultClient); + String symbol = "symbol_example"; // String | e.g., \"ALPHA_175USDT\" – use token ID from Token List + try { + TickerResponse result = apiInstance.ticker(symbol); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling MarketDataApi#ticker"); + 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 | +|------------- | ------------- | ------------- | -------------| +| **symbol** | **String**| e.g., \"ALPHA_175USDT\" – use token ID from Token List | | + +### Return type + +[**TickerResponse**](TickerResponse.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** | Ticker | - | + + +# **tokenList** +> TokenListResponse tokenList() + +Token List + +Retrieves a list of all available ALPHA tokens, including their IDs and symbols. Use this to find the token ID for constructing symbols in other endpoints. Weight: 0 + +### Example +```java +// Import classes: +import com.binance.connector.client.alpha.ApiClient; +import com.binance.connector.client.alpha.ApiException; +import com.binance.connector.client.alpha.Configuration; +import com.binance.connector.client.alpha.models.*; +import com.binance.connector.client.alpha.rest.api.MarketDataApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://www.binance.com"); + + MarketDataApi apiInstance = new MarketDataApi(defaultClient); + try { + TokenListResponse result = apiInstance.tokenList(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling MarketDataApi#tokenList"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**TokenListResponse**](TokenListResponse.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** | Token List | - | + diff --git a/clients/alpha/docs/TickerResponse.md b/clients/alpha/docs/TickerResponse.md new file mode 100644 index 000000000..36647980a --- /dev/null +++ b/clients/alpha/docs/TickerResponse.md @@ -0,0 +1,17 @@ + + +# TickerResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**code** | **String** | | [optional] | +|**message** | **String** | | [optional] | +|**messageDetail** | **String** | | [optional] | +|**data** | [**TickerResponseData**](TickerResponseData.md) | | [optional] | +|**success** | **Boolean** | | [optional] | + + + diff --git a/clients/alpha/docs/TickerResponseData.md b/clients/alpha/docs/TickerResponseData.md new file mode 100644 index 000000000..3dc6688b3 --- /dev/null +++ b/clients/alpha/docs/TickerResponseData.md @@ -0,0 +1,28 @@ + + +# TickerResponseData + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**symbol** | **String** | | [optional] | +|**priceChange** | **String** | | [optional] | +|**priceChangePercent** | **String** | | [optional] | +|**weightedAvgPrice** | **String** | | [optional] | +|**lastPrice** | **String** | | [optional] | +|**lastQty** | **String** | | [optional] | +|**openPrice** | **String** | | [optional] | +|**highPrice** | **String** | | [optional] | +|**lowPrice** | **String** | | [optional] | +|**volume** | **String** | | [optional] | +|**quoteVolume** | **String** | | [optional] | +|**openTime** | **Long** | | [optional] | +|**closeTime** | **Long** | | [optional] | +|**firstId** | **Long** | | [optional] | +|**lastId** | **Long** | | [optional] | +|**count** | **Long** | | [optional] | + + + diff --git a/clients/alpha/docs/TokenListResponse.md b/clients/alpha/docs/TokenListResponse.md new file mode 100644 index 000000000..e79071c31 --- /dev/null +++ b/clients/alpha/docs/TokenListResponse.md @@ -0,0 +1,17 @@ + + +# TokenListResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**code** | **String** | | [optional] | +|**message** | **String** | | [optional] | +|**messageDetail** | **String** | | [optional] | +|**success** | **Boolean** | | [optional] | +|**data** | [**List<TokenListResponseDataInner>**](TokenListResponseDataInner.md) | | [optional] | + + + diff --git a/clients/alpha/docs/TokenListResponseDataInner.md b/clients/alpha/docs/TokenListResponseDataInner.md new file mode 100644 index 000000000..c19b44261 --- /dev/null +++ b/clients/alpha/docs/TokenListResponseDataInner.md @@ -0,0 +1,50 @@ + + +# TokenListResponseDataInner + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**tokenId** | **String** | | [optional] | +|**chainId** | **String** | | [optional] | +|**chainIconUrl** | **String** | | [optional] | +|**chainName** | **String** | | [optional] | +|**contractAddress** | **String** | | [optional] | +|**name** | **String** | | [optional] | +|**symbol** | **String** | | [optional] | +|**iconUrl** | **String** | | [optional] | +|**price** | **String** | | [optional] | +|**percentChange24h** | **String** | | [optional] | +|**volume24h** | **String** | | [optional] | +|**marketCap** | **String** | | [optional] | +|**fdv** | **String** | | [optional] | +|**liquidity** | **String** | | [optional] | +|**totalSupply** | **String** | | [optional] | +|**circulatingSupply** | **String** | | [optional] | +|**holders** | **String** | | [optional] | +|**decimals** | **Long** | | [optional] | +|**listingCex** | **Boolean** | | [optional] | +|**hotTag** | **Boolean** | | [optional] | +|**cexCoinName** | **String** | | [optional] | +|**canTransfer** | **Boolean** | | [optional] | +|**denomination** | **Long** | | [optional] | +|**offline** | **Boolean** | | [optional] | +|**tradeDecimal** | **Long** | | [optional] | +|**alphaId** | **String** | | [optional] | +|**offsell** | **Boolean** | | [optional] | +|**priceHigh24h** | **String** | | [optional] | +|**priceLow24h** | **String** | | [optional] | +|**count24h** | **String** | | [optional] | +|**onlineTge** | **Boolean** | | [optional] | +|**onlineAirdrop** | **Boolean** | | [optional] | +|**score** | **Long** | | [optional] | +|**cexOffDisplay** | **Boolean** | | [optional] | +|**stockState** | **Boolean** | | [optional] | +|**listingTime** | **Long** | | [optional] | +|**mulPoint** | **Long** | | [optional] | +|**bnExclusiveState** | **Boolean** | | [optional] | + + + diff --git a/clients/alpha/docs/rest-api/certificate-pinning.md b/clients/alpha/docs/rest-api/certificate-pinning.md new file mode 100644 index 000000000..ae6528fcd --- /dev/null +++ b/clients/alpha/docs/rest-api/certificate-pinning.md @@ -0,0 +1,31 @@ +# Certificate Pinning +```java + import com.binance.connector.client.alpha.rest.AlphaRestApiUtil; + import com.binance.connector.client.alpha.rest.api.AlphaRestApi; + 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; + + // Expected pinned public key (SPKI SHA-256 hash) + // You can extract it from the certificate using openssl: + // openssl s_client -connect your-api.com:443 /dev/null | openssl x509 -pubkey -noout | openssl pkey -pubin -outform der | openssl dgst -sha256 -binary | base64 + public static final String PINNED_PUBLIC_KEY = "YOUR-PINNED-PUBLIC-KEY"; + + + public static void main(String[] args) { + ClientConfiguration clientConfiguration = AlphaRestApiUtil.getClientConfiguration(); + SignatureConfiguration signatureConfiguration = new SignatureConfiguration(); + signatureConfiguration.setApiKey("apiKey"); + signatureConfiguration.setPrivateKey("path/to/private.key"); + clientConfiguration.setSignatureConfiguration(signatureConfiguration); + + CertificatePinner certificatePinner = new CertificatePinner.Builder() + .add("your-api.com", PINNED_PUBLIC_KEY) + .build(); + + clientConfiguration.setCertificatePinner(certificatePinner); + + AlphaRestApi api = new AlphaRestApi(clientConfiguration); + } +``` \ No newline at end of file diff --git a/clients/alpha/docs/rest-api/compression.md b/clients/alpha/docs/rest-api/compression.md new file mode 100644 index 000000000..eca69e278 --- /dev/null +++ b/clients/alpha/docs/rest-api/compression.md @@ -0,0 +1,20 @@ +# Compression Configuration + +```java + import com.binance.connector.client.alpha.rest.AlphaRestApiUtil; + import com.binance.connector.client.alpha.rest.api.AlphaRestApi; + 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; + + public static void main(String[] args) { + ClientConfiguration clientConfiguration = AlphaRestApiUtil.getClientConfiguration(); + SignatureConfiguration signatureConfiguration = new SignatureConfiguration(); + signatureConfiguration.setApiKey("apiKey"); + signatureConfiguration.setPrivateKey("path/to/private.key"); + clientConfiguration.setSignatureConfiguration(signatureConfiguration); + clientConfiguration.setCompression(false); //disable compression + AlphaRestApi api = new AlphaRestApi(clientConfiguration); + } +``` \ No newline at end of file diff --git a/clients/alpha/docs/rest-api/error-handling.md b/clients/alpha/docs/rest-api/error-handling.md new file mode 100644 index 000000000..5e157c5fd --- /dev/null +++ b/clients/alpha/docs/rest-api/error-handling.md @@ -0,0 +1,17 @@ +# Error Handling + +```java + String symbol = "BNBUSDT"; + try { + ApiResponse response = getApi().accountCommission(symbol); + System.out.println(response.getData()); + } catch (ApiException exception) { + // get http code + int httpCode = exception.getCode(); + // get error message + String message = exception.getMessage(); + // headers are in lowercase + List retryafter = exception.getResponseHeaders().get("retry-after"); + System.out.println(retryafter); + } +``` \ No newline at end of file diff --git a/clients/alpha/docs/rest-api/key-pair-authentication.md b/clients/alpha/docs/rest-api/key-pair-authentication.md new file mode 100644 index 000000000..9582a0c36 --- /dev/null +++ b/clients/alpha/docs/rest-api/key-pair-authentication.md @@ -0,0 +1,20 @@ +# Key Pair Based Authentication + +```java + import com.binance.connector.client.alpha.rest.AlphaRestApiUtil; + import com.binance.connector.client.alpha.rest.api.AlphaRestApi; + 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; + + public static void main(String[] args) { + ClientConfiguration clientConfiguration = AlphaRestApiUtil.getClientConfiguration(); + SignatureConfiguration signatureConfiguration = new SignatureConfiguration(); + signatureConfiguration.setApiKey("apiKey"); + signatureConfiguration.setPrivateKey("path/to/private.key"); // Provide the private key directly as a string or specify the path to a private key file (e.g., '/path/to/private_key.pem') + signatureConfiguration.setPrivateKeyPass("your_passphrase"); // Optional: Required if the private key is encrypted + clientConfiguration.setSignatureConfiguration(signatureConfiguration); + AlphaRestApi api = new AlphaRestApi(clientConfiguration); + } +``` \ No newline at end of file diff --git a/clients/alpha/docs/rest-api/migration-guide.md b/clients/alpha/docs/rest-api/migration-guide.md new file mode 100644 index 000000000..a6e01542e --- /dev/null +++ b/clients/alpha/docs/rest-api/migration-guide.md @@ -0,0 +1,144 @@ +# Migration Guide: Binance Alpha Connector Modularization + +With the transition to a modularized structure, the Binance Connector has been split into separate NPM libraries, each focusing on a distinct product (e.g., Auto Invest, Futures, etc.). + +--- + +## Key Changes + +1. **Package Name**: + The modularised Alpha Connector has been moved to a new package: + + **Old:** +```xml + + io.github.binance + binance-connector-java + 3.0.5 + +``` + **New:** +```xml + + io.github.binance + binance-alpha + 1.0.0 + +``` + +2**Imports**: + Update your import paths. + + **Old:** + +```java +import com.binance.connector.client.SpotClient; +``` + + **New:** + +```java +import com.binance.connector.client.alpha.rest.api.AlphaRestApi; +``` + +4. **Configuration and Client Initialization**: + The new structure keeps the existing configuration options but modularized clients into `AlphaRestApi`. + + **Old:** + +```java +SpotClient client = new SpotClientImpl(PrivateConfig.API_KEY, PrivateConfig.SECRET_KEY); +String result = client.(parameters); +System.out.println(result); +``` + + + **New:** + +```java + ClientConfiguration clientConfiguration = AlphaRestApiUtil.getClientConfiguration(); + SignatureConfiguration signatureConfiguration = new SignatureConfiguration(); + signatureConfiguration.setApiKey("apiKey"); + signatureConfiguration.setPrivateKey("path/to/private.key"); + clientConfiguration.setSignatureConfiguration(signatureConfiguration); + + AlphaRestApi api = new AlphaRestApi(clientConfiguration); +``` + +5. **Examples and Documentation**: + Updated examples can be found in the new repository folders: + - REST API: `examples/alpha/` + +--- + +## Migration Steps + +### 1. Replace the maven dependency + +Replace the maven dependency: + +```xml + + io.github.binance + binance-connector-java + 3.0.5 + +``` + +by: + +```xml + + io.github.binance + binance-alpha + 1.0.0 + +``` + +### 3. Update Import Paths + +Replace all occurrences of: + +```java +import com.binance.connector.client.SpotClient; +``` + +With: + +```java +import com.binance.connector.client.alpha.rest.api.AlphaRestApi; +``` + +### 4. Update Client Initialization + +Adjust your code to use the modularized structure. For example: + +**Old:** + +```java +SpotClient client = new SpotClientImpl(PrivateConfig.API_KEY, PrivateConfig.SECRET_KEY); +``` + +**New:** + +```java + ClientConfiguration clientConfiguration = AlphaRestApiUtil.getClientConfiguration(); + SignatureConfiguration signatureConfiguration = new SignatureConfiguration(); + signatureConfiguration.setApiKey("apiKey"); + signatureConfiguration.setPrivateKey("path/to/private.key"); + clientConfiguration.setSignatureConfiguration(signatureConfiguration); + clientConfiguration.setCompression(false); //disable compression + AlphaRestApi api = new AlphaRestApi(clientConfiguration); +``` + +### 5. Test and Verify + +Run your application to ensure everything works as expected. Refer to the new documentation for any advanced features or configuration options. + +--- + +## Additional Notes + +- **Future Modular Packages**: Similar packages for other products (e.g., Wallet, Staking) will follow this pattern. + +For more details, refer to the updated [README](../../README.md) and [Examples](../../../../examples/). \ No newline at end of file diff --git a/clients/alpha/docs/rest-api/proxy.md b/clients/alpha/docs/rest-api/proxy.md new file mode 100644 index 000000000..e7d35ce10 --- /dev/null +++ b/clients/alpha/docs/rest-api/proxy.md @@ -0,0 +1,45 @@ +# Proxy Configuration + +```java + import com.binance.connector.client.alpha.rest.AlphaRestApiUtil; + import com.binance.connector.client.alpha.rest.api.AlphaRestApi; + import com.binance.connector.client.common.configuration.ClientConfiguration; + import com.binance.connector.client.common.configuration.SignatureConfiguration; + import okhttp3.Authenticator; + import okhttp3.Credentials; + import okhttp3.Request; + import okhttp3.Response; + import okhttp3.Route; + + import java.io.IOException; + import java.net.InetSocketAddress; + import java.net.Proxy; + + public static void main(String[] args) { + ClientConfiguration clientConfiguration = AlphaRestApiUtil.getClientConfiguration(); + SignatureConfiguration signatureConfiguration = new SignatureConfiguration(); + signatureConfiguration.setApiKey("apiKey"); + signatureConfiguration.setPrivateKey("path/to/private.key"); + clientConfiguration.setSignatureConfiguration(signatureConfiguration); + + // Create the HTTP proxy + Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("host", 123)); + // Add the proxy to the configuration + clientConfiguration.setProxy(proxy); + + // Create the Proxy Authenticator + Authenticator proxyAuthenticator = new Authenticator() { + @Override public Request authenticate(Route route, Response response) throws IOException { + String credential = Credentials.basic("username", "password"); + return response.request().newBuilder() + .header("Proxy-Authorization", credential) + .build(); + } + }; + + // Add the proxy authenticator to the configuration + clientConfiguration.setProxyAuthenticator(proxyAuthenticator); + + AlphaRestApi api = new AlphaRestApi(clientConfiguration); + } +``` \ No newline at end of file diff --git a/clients/alpha/docs/rest-api/retries.md b/clients/alpha/docs/rest-api/retries.md new file mode 100644 index 000000000..1e81739c9 --- /dev/null +++ b/clients/alpha/docs/rest-api/retries.md @@ -0,0 +1,25 @@ +# Retries Configuration + +```java + import com.binance.connector.client.alpha.rest.AlphaRestApiUtil; + import com.binance.connector.client.alpha.rest.api.AlphaRestApi; + 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; + + public static void main(String[] args) { + ClientConfiguration clientConfiguration = AlphaRestApiUtil.getClientConfiguration(); + SignatureConfiguration signatureConfiguration = new SignatureConfiguration(); + signatureConfiguration.setApiKey("apiKey"); + signatureConfiguration.setPrivateKey("path/to/private.key"); + clientConfiguration.setSignatureConfiguration(signatureConfiguration); + + // Retry up to 5 times + clientConfiguration.setRetries(5); + // 500ms between retries + clientConfiguration.setBackOff(500); + + AlphaRestApi api = new AlphaRestApi(clientConfiguration); + } +``` \ No newline at end of file diff --git a/clients/alpha/docs/rest-api/timeout.md b/clients/alpha/docs/rest-api/timeout.md new file mode 100644 index 000000000..9437e72e8 --- /dev/null +++ b/clients/alpha/docs/rest-api/timeout.md @@ -0,0 +1,25 @@ +# Retries Configuration + +```java + import com.binance.connector.client.alpha.rest.AlphaRestApiUtil; + import com.binance.connector.client.alpha.rest.api.AlphaRestApi; + 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; + + public static void main(String[] args) { + ClientConfiguration clientConfiguration = AlphaRestApiUtil.getClientConfiguration(); + SignatureConfiguration signatureConfiguration = new SignatureConfiguration(); + signatureConfiguration.setApiKey("apiKey"); + signatureConfiguration.setPrivateKey("path/to/private.key"); + clientConfiguration.setSignatureConfiguration(signatureConfiguration); + + // Connect timeout of 500ms + clientConfiguration.setConnectTimeout(500); + // Read timeout of 1s + clientConfiguration.setReadTimeout(1000); + + AlphaRestApi api = new AlphaRestApi(clientConfiguration); + } +``` \ No newline at end of file diff --git a/clients/alpha/example_rest.md b/clients/alpha/example_rest.md new file mode 100644 index 000000000..9b33e4d80 --- /dev/null +++ b/clients/alpha/example_rest.md @@ -0,0 +1,12 @@ +## MarketData + +[GET /bapi/defi/v1/public/alpha-trade/agg-trades](https://developers.binance.com/docs/alpha/market-data/rest-api/Aggregated-Trades) - aggregatedTrades - [AggregatedTradesExample.java:47](/examples/alpha/src/main/java/com/binance/connector/client/alpha/rest/marketdata/AggregatedTradesExample.java#L47) + +[GET /bapi/defi/v1/public/alpha-trade/get-exchange-info](https://developers.binance.com/docs/alpha/market-data/rest-api/Get-Exchange-Info) - getExchangeInfo - [GetExchangeInfoExample.java:47](/examples/alpha/src/main/java/com/binance/connector/client/alpha/rest/marketdata/GetExchangeInfoExample.java#L47) + +[GET /bapi/defi/v1/public/alpha-trade/klines](https://developers.binance.com/docs/alpha/market-data/rest-api/Klines) - klines - [KlinesExample.java:47](/examples/alpha/src/main/java/com/binance/connector/client/alpha/rest/marketdata/KlinesExample.java#L47) + +[GET /bapi/defi/v1/public/alpha-trade/ticker](https://developers.binance.com/docs/alpha/market-data/rest-api/24hr-ticker-price-change) - ticker - [TickerExample.java:47](/examples/alpha/src/main/java/com/binance/connector/client/alpha/rest/marketdata/TickerExample.java#L47) + +[GET /bapi/defi/v1/public/wallet-direct/buw/wallet/cex/alpha/all/token/list](https://developers.binance.com/docs/alpha/market-data/rest-api/Token-List) - tokenList - [TokenListExample.java:47](/examples/alpha/src/main/java/com/binance/connector/client/alpha/rest/marketdata/TokenListExample.java#L47) + diff --git a/clients/alpha/pom.xml b/clients/alpha/pom.xml new file mode 100644 index 000000000..175066532 --- /dev/null +++ b/clients/alpha/pom.xml @@ -0,0 +1,37 @@ + + + + 4.0.0 + binance-alpha + alpha + 1.0.0 + jar + + + io.github.binance + binance-connector-java-clients + 1.1.1 + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + -parameters + + + + + + + + io.github.binance + binance-common + 2.3.1 + + + \ No newline at end of file diff --git a/clients/alpha/src/main/java/com/binance/connector/client/alpha/rest/AlphaRestApiUtil.java b/clients/alpha/src/main/java/com/binance/connector/client/alpha/rest/AlphaRestApiUtil.java new file mode 100644 index 000000000..485bcd28d --- /dev/null +++ b/clients/alpha/src/main/java/com/binance/connector/client/alpha/rest/AlphaRestApiUtil.java @@ -0,0 +1,25 @@ +package com.binance.connector.client.alpha.rest; + +import com.binance.connector.client.common.ApiClient; +import com.binance.connector.client.common.configuration.ClientConfiguration; + +public class AlphaRestApiUtil { + private static final String BASE_URL = "https://www.binance.com"; + private static final boolean HAS_TIME_UNIT = false; + + public static ClientConfiguration getClientConfiguration() { + ClientConfiguration clientConfiguration = new ClientConfiguration(); + if (!HAS_TIME_UNIT) { + clientConfiguration.setTimeUnit(null); + } + clientConfiguration.setUrl(BASE_URL); + return clientConfiguration; + } + + public static ApiClient getDefaultClient(ClientConfiguration configuration) { + ApiClient apiClient = new ApiClient(configuration); + apiClient.setJson(JSON.getGson()); + + return apiClient; + } +} diff --git a/clients/alpha/src/main/java/com/binance/connector/client/alpha/rest/JSON.java b/clients/alpha/src/main/java/com/binance/connector/client/alpha/rest/JSON.java new file mode 100644 index 000000000..dfb0750b9 --- /dev/null +++ b/clients/alpha/src/main/java/com/binance/connector/client/alpha/rest/JSON.java @@ -0,0 +1,453 @@ +/* + * Binance Alpha REST API + * OpenAPI Specification for the Binance Alpha REST API + * + * 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.alpha.rest; + +import com.binance.connector.client.common.DecimalFormatter; +import com.binance.connector.client.common.websocket.service.DeserializeExclusionStrategy; +import com.binance.connector.client.common.websocket.service.SerializeExclusionStrategy; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonElement; +import com.google.gson.JsonParseException; +import com.google.gson.JsonPrimitive; +import com.google.gson.JsonSerializer; +import com.google.gson.TypeAdapter; +import com.google.gson.internal.bind.util.ISO8601Utils; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.gsonfire.GsonFireBuilder; +import java.io.IOException; +import java.io.StringReader; +import java.lang.reflect.Type; +import java.text.DateFormat; +import java.text.DecimalFormat; +import java.text.ParseException; +import java.text.ParsePosition; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.Date; +import java.util.Map; +import okio.ByteString; + +/* + * A JSON utility class + * + * NOTE: in the future, this class may be converted to static, which may break + * backward-compatibility + */ +public class JSON { + private static Gson gson; + private static boolean isLenientOnJson = false; + private static DateTypeAdapter dateTypeAdapter = new DateTypeAdapter(); + private static SqlDateTypeAdapter sqlDateTypeAdapter = new SqlDateTypeAdapter(); + private static OffsetDateTimeTypeAdapter offsetDateTimeTypeAdapter = + new OffsetDateTimeTypeAdapter(); + private static LocalDateTypeAdapter localDateTypeAdapter = new LocalDateTypeAdapter(); + private static ByteArrayAdapter byteArrayAdapter = new ByteArrayAdapter(); + + @SuppressWarnings("unchecked") + public static GsonBuilder createGson() { + GsonFireBuilder fireBuilder = new GsonFireBuilder(); + GsonBuilder builder = fireBuilder.createGsonBuilder(); + return builder; + } + + private static String getDiscriminatorValue( + JsonElement readElement, String discriminatorField) { + JsonElement element = readElement.getAsJsonObject().get(discriminatorField); + if (null == element) { + throw new IllegalArgumentException( + "missing discriminator field: <" + discriminatorField + ">"); + } + return element.getAsString(); + } + + /** + * Returns the Java class that implements the OpenAPI schema for the specified discriminator + * value. + * + * @param classByDiscriminatorValue The map of discriminator values to Java classes. + * @param discriminatorValue The value of the OpenAPI discriminator in the input data. + * @return The Java class that implements the OpenAPI schema + */ + private static Class getClassByDiscriminator( + Map classByDiscriminatorValue, String discriminatorValue) { + Class clazz = (Class) classByDiscriminatorValue.get(discriminatorValue); + if (null == clazz) { + throw new IllegalArgumentException( + "cannot determine model class of name: <" + discriminatorValue + ">"); + } + return clazz; + } + + static { + GsonBuilder gsonBuilder = createGson(); + gsonBuilder + .registerTypeAdapter( + Double.class, + (JsonSerializer) + (src, typeOfSrc, context) -> { + DecimalFormat df = DecimalFormatter.getFormatter(); + return new JsonPrimitive(df.format(src)); + }) + .addSerializationExclusionStrategy(new SerializeExclusionStrategy()) + .addDeserializationExclusionStrategy(new DeserializeExclusionStrategy()); + gsonBuilder.registerTypeAdapter(Date.class, dateTypeAdapter); + gsonBuilder.registerTypeAdapter(java.sql.Date.class, sqlDateTypeAdapter); + gsonBuilder.registerTypeAdapter(OffsetDateTime.class, offsetDateTimeTypeAdapter); + gsonBuilder.registerTypeAdapter(LocalDate.class, localDateTypeAdapter); + gsonBuilder.registerTypeAdapter(byte[].class, byteArrayAdapter); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.alpha.rest.model.AggregatedTradesResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.alpha.rest.model.AggregatedTradesResponseDataInner + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.alpha.rest.model.GetExchangeInfoResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.alpha.rest.model.GetExchangeInfoResponseData + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.alpha.rest.model + .GetExchangeInfoResponseDataAssetsInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.alpha.rest.model + .GetExchangeInfoResponseDataSymbolsInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.alpha.rest.model + .GetExchangeInfoResponseDataSymbolsInnerFiltersInner + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.alpha.rest.model.KlinesResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.alpha.rest.model.KlinesResponseDataItem + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.alpha.rest.model.KlinesResponseDataItemInner + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.alpha.rest.model.TickerResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.alpha.rest.model.TickerResponseData + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.alpha.rest.model.TokenListResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.alpha.rest.model.TokenListResponseDataInner + .CustomTypeAdapterFactory()); + gson = gsonBuilder.create(); + } + + /** + * Get Gson. + * + * @return Gson + */ + public static Gson getGson() { + return gson; + } + + /** + * Set Gson. + * + * @param gson Gson + */ + public static void setGson(Gson gson) { + JSON.gson = gson; + } + + public static void setLenientOnJson(boolean lenientOnJson) { + isLenientOnJson = lenientOnJson; + } + + /** + * Serialize the given Java object into JSON string. + * + * @param obj Object + * @return String representation of the JSON + */ + public static String serialize(Object obj) { + return gson.toJson(obj); + } + + /** + * Deserialize the given JSON string to Java object. + * + * @param Type + * @param body The JSON string + * @param returnType The type to deserialize into + * @return The deserialized Java object + */ + @SuppressWarnings("unchecked") + public static T deserialize(String body, Type returnType) { + try { + if (isLenientOnJson) { + JsonReader jsonReader = new JsonReader(new StringReader(body)); + // see + // https://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/com/google/gson/stream/JsonReader.html#setLenient(boolean) + jsonReader.setLenient(true); + return gson.fromJson(jsonReader, returnType); + } else { + return gson.fromJson(body, returnType); + } + } catch (JsonParseException e) { + // Fallback processing when failed to parse JSON form response body: + // return the response body string directly for the String return type; + if (returnType.equals(String.class)) { + return (T) body; + } else { + throw (e); + } + } + } + + /** Gson TypeAdapter for Byte Array type */ + public static class ByteArrayAdapter extends TypeAdapter { + + @Override + public void write(JsonWriter out, byte[] value) throws IOException { + if (value == null) { + out.nullValue(); + } else { + out.value(ByteString.of(value).base64()); + } + } + + @Override + public byte[] read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String bytesAsBase64 = in.nextString(); + ByteString byteString = ByteString.decodeBase64(bytesAsBase64); + return byteString.toByteArray(); + } + } + } + + /** Gson TypeAdapter for JSR310 OffsetDateTime type */ + public static class OffsetDateTimeTypeAdapter extends TypeAdapter { + + private DateTimeFormatter formatter; + + public OffsetDateTimeTypeAdapter() { + this(DateTimeFormatter.ISO_OFFSET_DATE_TIME); + } + + public OffsetDateTimeTypeAdapter(DateTimeFormatter formatter) { + this.formatter = formatter; + } + + public void setFormat(DateTimeFormatter dateFormat) { + this.formatter = dateFormat; + } + + @Override + public void write(JsonWriter out, OffsetDateTime date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.format(date)); + } + } + + @Override + public OffsetDateTime read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + if (date.endsWith("+0000")) { + date = date.substring(0, date.length() - 5) + "Z"; + } + return OffsetDateTime.parse(date, formatter); + } + } + } + + /** Gson TypeAdapter for JSR310 LocalDate type */ + public static class LocalDateTypeAdapter extends TypeAdapter { + + private DateTimeFormatter formatter; + + public LocalDateTypeAdapter() { + this(DateTimeFormatter.ISO_LOCAL_DATE); + } + + public LocalDateTypeAdapter(DateTimeFormatter formatter) { + this.formatter = formatter; + } + + public void setFormat(DateTimeFormatter dateFormat) { + this.formatter = dateFormat; + } + + @Override + public void write(JsonWriter out, LocalDate date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.format(date)); + } + } + + @Override + public LocalDate read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + return LocalDate.parse(date, formatter); + } + } + } + + public static void setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { + offsetDateTimeTypeAdapter.setFormat(dateFormat); + } + + public static void setLocalDateFormat(DateTimeFormatter dateFormat) { + localDateTypeAdapter.setFormat(dateFormat); + } + + /** + * Gson TypeAdapter for java.sql.Date type If the dateFormat is null, a simple "yyyy-MM-dd" + * format will be used (more efficient than SimpleDateFormat). + */ + public static class SqlDateTypeAdapter extends TypeAdapter { + + private DateFormat dateFormat; + + public SqlDateTypeAdapter() {} + + public SqlDateTypeAdapter(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + public void setFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + @Override + public void write(JsonWriter out, java.sql.Date date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + String value; + if (dateFormat != null) { + value = dateFormat.format(date); + } else { + value = date.toString(); + } + out.value(value); + } + } + + @Override + public java.sql.Date read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + try { + if (dateFormat != null) { + return new java.sql.Date(dateFormat.parse(date).getTime()); + } + return new java.sql.Date( + ISO8601Utils.parse(date, new ParsePosition(0)).getTime()); + } catch (ParseException e) { + throw new JsonParseException(e); + } + } + } + } + + /** + * Gson TypeAdapter for java.util.Date type If the dateFormat is null, ISO8601Utils will be + * used. + */ + public static class DateTypeAdapter extends TypeAdapter { + + private DateFormat dateFormat; + + public DateTypeAdapter() {} + + public DateTypeAdapter(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + public void setFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + @Override + public void write(JsonWriter out, Date date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + String value; + if (dateFormat != null) { + value = dateFormat.format(date); + } else { + value = ISO8601Utils.format(date, true); + } + out.value(value); + } + } + + @Override + public Date read(JsonReader in) throws IOException { + try { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + try { + if (dateFormat != null) { + return dateFormat.parse(date); + } + return ISO8601Utils.parse(date, new ParsePosition(0)); + } catch (ParseException e) { + throw new JsonParseException(e); + } + } + } catch (IllegalArgumentException e) { + throw new JsonParseException(e); + } + } + } + + public static void setDateFormat(DateFormat dateFormat) { + dateTypeAdapter.setFormat(dateFormat); + } + + public static void setSqlDateFormat(DateFormat dateFormat) { + sqlDateTypeAdapter.setFormat(dateFormat); + } +} diff --git a/clients/alpha/src/main/java/com/binance/connector/client/alpha/rest/api/AlphaRestApi.java b/clients/alpha/src/main/java/com/binance/connector/client/alpha/rest/api/AlphaRestApi.java new file mode 100644 index 000000000..218e2c46d --- /dev/null +++ b/clients/alpha/src/main/java/com/binance/connector/client/alpha/rest/api/AlphaRestApi.java @@ -0,0 +1,151 @@ +package com.binance.connector.client.alpha.rest.api; + +import com.binance.connector.client.alpha.rest.AlphaRestApiUtil; +import com.binance.connector.client.alpha.rest.model.AggregatedTradesResponse; +import com.binance.connector.client.alpha.rest.model.GetExchangeInfoResponse; +import com.binance.connector.client.alpha.rest.model.KlinesResponse; +import com.binance.connector.client.alpha.rest.model.TickerResponse; +import com.binance.connector.client.alpha.rest.model.TokenListResponse; +import com.binance.connector.client.common.ApiClient; +import com.binance.connector.client.common.ApiException; +import com.binance.connector.client.common.ApiResponse; +import com.binance.connector.client.common.configuration.ClientConfiguration; + +public class AlphaRestApi { + + private final MarketDataApi marketDataApi; + + public AlphaRestApi(ClientConfiguration configuration) { + this(AlphaRestApiUtil.getDefaultClient(configuration)); + } + + public AlphaRestApi(ApiClient apiClient) { + this.marketDataApi = new MarketDataApi(apiClient); + } + + /** + * Aggregated Trades Retrieves compressed, aggregated historical trades for a specific symbol. + * Useful for recent trade history. Weight: 0 + * + * @param symbol e.g., \"ALPHA_175USDT\" – use token ID from Token List (required) + * @param fromId starting trade ID to fetch from (optional) + * @param startTime start timestamp (milliseconds) (optional) + * @param endTime end timestamp (milliseconds) (optional) + * @param limit number of results to return (default 500, max 1000) (optional) + * @return ApiResponse<AggregatedTradesResponse> + * @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 Aggregated Trades -
+ * + * @see Aggregated + * Trades Documentation + */ + public ApiResponse aggregatedTrades( + String symbol, Long fromId, Long startTime, Long endTime, Long limit) + throws ApiException { + return marketDataApi.aggregatedTrades(symbol, fromId, startTime, endTime, limit); + } + + /** + * Get Exchange Info Fetches general exchange information, such as supported symbols, rate + * limits, and server time. Weight: 0 + * + * @return ApiResponse<GetExchangeInfoResponse> + * @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 Get Exchange Info -
+ * + * @see Get + * Exchange Info Documentation + */ + public ApiResponse getExchangeInfo() throws ApiException { + return marketDataApi.getExchangeInfo(); + } + + /** + * Klines (Candlestick Data) Fetches Kline/candlestick bars for a symbol, which include + * open/high/low/close prices and volume over intervals. Useful for charting and analysis. + * Weight: 0 + * + * @param symbol e.g., \"ALPHA_175USDT\" – use token ID from Token List (required) + * @param interval e.g., \"1h\" – supported intervals: 1s, 15s, 1m, 3m, 5m, 15m, 30m, + * 1h, 2h, 4h, 6h, 8h, 12h, 1d, 3d, 1w, 1M (required) + * @param limit number of results to return (default 500, max 1000) (optional) + * @param startTime start timestamp (milliseconds) (optional) + * @param endTime end timestamp (milliseconds) (optional) + * @return ApiResponse<KlinesResponse> + * @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 Klines -
+ * + * @see Klines + * (Candlestick Data) Documentation + */ + public ApiResponse klines( + String symbol, String interval, Long limit, Long startTime, Long endTime) + throws ApiException { + return marketDataApi.klines(symbol, interval, limit, startTime, endTime); + } + + /** + * Ticker (24hr Price Statistics) Gets the 24-hour rolling window price change statistics for a + * symbol, including volume and price changes. Weight: 0 + * + * @param symbol e.g., \"ALPHA_175USDT\" – use token ID from Token List (required) + * @return ApiResponse<TickerResponse> + * @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 Ticker -
+ * + * @see Ticker + * (24hr Price Statistics) Documentation + */ + public ApiResponse ticker(String symbol) throws ApiException { + return marketDataApi.ticker(symbol); + } + + /** + * Token List Retrieves a list of all available ALPHA tokens, including their IDs and symbols. + * Use this to find the token ID for constructing symbols in other endpoints. Weight: 0 + * + * @return ApiResponse<TokenListResponse> + * @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 Token List -
+ * + * @see Token + * List Documentation + */ + public ApiResponse tokenList() throws ApiException { + return marketDataApi.tokenList(); + } +} diff --git a/clients/alpha/src/main/java/com/binance/connector/client/alpha/rest/api/MarketDataApi.java b/clients/alpha/src/main/java/com/binance/connector/client/alpha/rest/api/MarketDataApi.java new file mode 100644 index 000000000..2d65c8e74 --- /dev/null +++ b/clients/alpha/src/main/java/com/binance/connector/client/alpha/rest/api/MarketDataApi.java @@ -0,0 +1,809 @@ +/* + * Binance Alpha REST API + * OpenAPI Specification for the Binance Alpha REST API + * + * 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.alpha.rest.api; + +import com.binance.connector.client.alpha.rest.model.AggregatedTradesResponse; +import com.binance.connector.client.alpha.rest.model.GetExchangeInfoResponse; +import com.binance.connector.client.alpha.rest.model.KlinesResponse; +import com.binance.connector.client.alpha.rest.model.TickerResponse; +import com.binance.connector.client.alpha.rest.model.TokenListResponse; +import com.binance.connector.client.common.ApiClient; +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.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 MarketDataApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + private static final String USER_AGENT = + String.format( + "binance-alpha/1.0.0 (Java/%s; %s; %s)", + SystemUtil.getJavaVersion(), SystemUtil.getOs(), SystemUtil.getArch()); + private static final boolean HAS_TIME_UNIT = false; + + public MarketDataApi(ClientConfiguration clientConfiguration) { + this(new ApiClient(clientConfiguration)); + } + + public MarketDataApi(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; + } + + /** + * Build call for aggregatedTrades + * + * @param symbol e.g., \"ALPHA_175USDT\" – use token ID from Token List (required) + * @param fromId starting trade ID to fetch from (optional) + * @param startTime start timestamp (milliseconds) (optional) + * @param endTime end timestamp (milliseconds) (optional) + * @param limit number of results to return (default 500, max 1000) (optional) + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Aggregated Trades -
+ * + * @see Aggregated + * Trades Documentation + */ + private okhttp3.Call aggregatedTradesCall( + String symbol, Long fromId, Long startTime, Long endTime, Long limit) + 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 = "/bapi/defi/v1/public/alpha-trade/agg-trades"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (symbol != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("symbol", symbol)); + } + + if (fromId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("fromId", fromId)); + } + + if (startTime != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("startTime", startTime)); + } + + if (endTime != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("endTime", endTime)); + } + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + 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); + } + Set localVarAuthNames = new HashSet<>(); + 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 aggregatedTradesValidateBeforeCall( + String symbol, Long fromId, Long startTime, Long endTime, Long limit) + throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + ExecutableValidator executableValidator = validator.forExecutables(); + + Object[] parameterValues = {symbol, fromId, startTime, endTime, limit}; + Method method = + this.getClass() + .getMethod( + "aggregatedTrades", + String.class, + Long.class, + Long.class, + Long.class, + Long.class); + Set> violations = + executableValidator.validateParameters(this, method, parameterValues); + + if (violations.size() == 0) { + return aggregatedTradesCall(symbol, fromId, startTime, endTime, limit); + } 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()); + } + } + + /** + * Aggregated Trades Retrieves compressed, aggregated historical trades for a specific symbol. + * Useful for recent trade history. Weight: 0 + * + * @param symbol e.g., \"ALPHA_175USDT\" – use token ID from Token List (required) + * @param fromId starting trade ID to fetch from (optional) + * @param startTime start timestamp (milliseconds) (optional) + * @param endTime end timestamp (milliseconds) (optional) + * @param limit number of results to return (default 500, max 1000) (optional) + * @return ApiResponse<AggregatedTradesResponse> + * @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 Aggregated Trades -
+ * + * @see Aggregated + * Trades Documentation + */ + public ApiResponse aggregatedTrades( + @NotNull String symbol, Long fromId, Long startTime, Long endTime, Long limit) + throws ApiException { + okhttp3.Call localVarCall = + aggregatedTradesValidateBeforeCall(symbol, fromId, startTime, endTime, limit); + java.lang.reflect.Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Build call for getExchangeInfo + * + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Get Exchange Info -
+ * + * @see Get + * Exchange Info Documentation + */ + private okhttp3.Call getExchangeInfoCall() 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 = "/bapi/defi/v1/public/alpha-trade/get-exchange-info"; + + 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); + } + Set localVarAuthNames = new HashSet<>(); + 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 getExchangeInfoValidateBeforeCall() throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + ExecutableValidator executableValidator = validator.forExecutables(); + + Object[] parameterValues = {}; + Method method = this.getClass().getMethod("getExchangeInfo"); + Set> violations = + executableValidator.validateParameters(this, method, parameterValues); + + if (violations.size() == 0) { + return getExchangeInfoCall(); + } 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()); + } + } + + /** + * Get Exchange Info Fetches general exchange information, such as supported symbols, rate + * limits, and server time. Weight: 0 + * + * @return ApiResponse<GetExchangeInfoResponse> + * @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 Get Exchange Info -
+ * + * @see Get + * Exchange Info Documentation + */ + public ApiResponse getExchangeInfo() throws ApiException { + okhttp3.Call localVarCall = getExchangeInfoValidateBeforeCall(); + java.lang.reflect.Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Build call for klines + * + * @param symbol e.g., \"ALPHA_175USDT\" – use token ID from Token List (required) + * @param interval e.g., \"1h\" – supported intervals: 1s, 15s, 1m, 3m, 5m, 15m, 30m, + * 1h, 2h, 4h, 6h, 8h, 12h, 1d, 3d, 1w, 1M (required) + * @param limit number of results to return (default 500, max 1000) (optional) + * @param startTime start timestamp (milliseconds) (optional) + * @param endTime end timestamp (milliseconds) (optional) + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Klines -
+ * + * @see Klines + * (Candlestick Data) Documentation + */ + private okhttp3.Call klinesCall( + String symbol, String interval, Long limit, Long startTime, Long endTime) + 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 = "/bapi/defi/v1/public/alpha-trade/klines"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (symbol != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("symbol", symbol)); + } + + if (interval != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("interval", interval)); + } + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + if (startTime != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("startTime", startTime)); + } + + if (endTime != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("endTime", endTime)); + } + + 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); + } + Set localVarAuthNames = new HashSet<>(); + 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 klinesValidateBeforeCall( + String symbol, String interval, Long limit, Long startTime, Long endTime) + throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + ExecutableValidator executableValidator = validator.forExecutables(); + + Object[] parameterValues = {symbol, interval, limit, startTime, endTime}; + Method method = + this.getClass() + .getMethod( + "klines", + String.class, + String.class, + Long.class, + Long.class, + Long.class); + Set> violations = + executableValidator.validateParameters(this, method, parameterValues); + + if (violations.size() == 0) { + return klinesCall(symbol, interval, limit, startTime, endTime); + } 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()); + } + } + + /** + * Klines (Candlestick Data) Fetches Kline/candlestick bars for a symbol, which include + * open/high/low/close prices and volume over intervals. Useful for charting and analysis. + * Weight: 0 + * + * @param symbol e.g., \"ALPHA_175USDT\" – use token ID from Token List (required) + * @param interval e.g., \"1h\" – supported intervals: 1s, 15s, 1m, 3m, 5m, 15m, 30m, + * 1h, 2h, 4h, 6h, 8h, 12h, 1d, 3d, 1w, 1M (required) + * @param limit number of results to return (default 500, max 1000) (optional) + * @param startTime start timestamp (milliseconds) (optional) + * @param endTime end timestamp (milliseconds) (optional) + * @return ApiResponse<KlinesResponse> + * @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 Klines -
+ * + * @see Klines + * (Candlestick Data) Documentation + */ + public ApiResponse klines( + @NotNull String symbol, + @NotNull String interval, + Long limit, + Long startTime, + Long endTime) + throws ApiException { + okhttp3.Call localVarCall = + klinesValidateBeforeCall(symbol, interval, limit, startTime, endTime); + java.lang.reflect.Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Build call for ticker + * + * @param symbol e.g., \"ALPHA_175USDT\" – use token ID from Token List (required) + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Ticker -
+ * + * @see Ticker + * (24hr Price Statistics) Documentation + */ + private okhttp3.Call tickerCall(String symbol) 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 = "/bapi/defi/v1/public/alpha-trade/ticker"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (symbol != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("symbol", symbol)); + } + + 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); + } + Set localVarAuthNames = new HashSet<>(); + 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 tickerValidateBeforeCall(String symbol) throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + ExecutableValidator executableValidator = validator.forExecutables(); + + Object[] parameterValues = {symbol}; + Method method = this.getClass().getMethod("ticker", String.class); + Set> violations = + executableValidator.validateParameters(this, method, parameterValues); + + if (violations.size() == 0) { + return tickerCall(symbol); + } 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()); + } + } + + /** + * Ticker (24hr Price Statistics) Gets the 24-hour rolling window price change statistics for a + * symbol, including volume and price changes. Weight: 0 + * + * @param symbol e.g., \"ALPHA_175USDT\" – use token ID from Token List (required) + * @return ApiResponse<TickerResponse> + * @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 Ticker -
+ * + * @see Ticker + * (24hr Price Statistics) Documentation + */ + public ApiResponse ticker(@NotNull String symbol) throws ApiException { + okhttp3.Call localVarCall = tickerValidateBeforeCall(symbol); + java.lang.reflect.Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Build call for tokenList + * + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Token List -
+ * + * @see Token + * List Documentation + */ + private okhttp3.Call tokenListCall() 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 = + "/bapi/defi/v1/public/wallet-direct/buw/wallet/cex/alpha/all/token/list"; + + 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); + } + Set localVarAuthNames = new HashSet<>(); + 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 tokenListValidateBeforeCall() throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + ExecutableValidator executableValidator = validator.forExecutables(); + + Object[] parameterValues = {}; + Method method = this.getClass().getMethod("tokenList"); + Set> violations = + executableValidator.validateParameters(this, method, parameterValues); + + if (violations.size() == 0) { + return tokenListCall(); + } 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()); + } + } + + /** + * Token List Retrieves a list of all available ALPHA tokens, including their IDs and symbols. + * Use this to find the token ID for constructing symbols in other endpoints. Weight: 0 + * + * @return ApiResponse<TokenListResponse> + * @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 Token List -
+ * + * @see Token + * List Documentation + */ + public ApiResponse tokenList() throws ApiException { + okhttp3.Call localVarCall = tokenListValidateBeforeCall(); + java.lang.reflect.Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } +} diff --git a/clients/alpha/src/main/java/com/binance/connector/client/alpha/rest/model/AggregatedTradesResponse.java b/clients/alpha/src/main/java/com/binance/connector/client/alpha/rest/model/AggregatedTradesResponse.java new file mode 100644 index 000000000..f76fd530c --- /dev/null +++ b/clients/alpha/src/main/java/com/binance/connector/client/alpha/rest/model/AggregatedTradesResponse.java @@ -0,0 +1,363 @@ +/* + * Binance Alpha REST API + * OpenAPI Specification for the Binance Alpha REST API + * + * 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.alpha.rest.model; + +import com.binance.connector.client.alpha.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.*; + +/** AggregatedTradesResponse */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.12.0") +public class AggregatedTradesResponse { + public static final String SERIALIZED_NAME_CODE = "code"; + + @SerializedName(SERIALIZED_NAME_CODE) + @jakarta.annotation.Nullable + private String code; + + public static final String SERIALIZED_NAME_MESSAGE = "message"; + + @SerializedName(SERIALIZED_NAME_MESSAGE) + @jakarta.annotation.Nullable + private String message; + + public static final String SERIALIZED_NAME_MESSAGE_DETAIL = "messageDetail"; + + @SerializedName(SERIALIZED_NAME_MESSAGE_DETAIL) + @jakarta.annotation.Nullable + private String messageDetail; + + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + @jakarta.annotation.Nullable + private List<@Valid AggregatedTradesResponseDataInner> data; + + public AggregatedTradesResponse() {} + + public AggregatedTradesResponse 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 AggregatedTradesResponse message(@jakarta.annotation.Nullable String message) { + this.message = message; + return this; + } + + /** + * Get message + * + * @return message + */ + @jakarta.annotation.Nullable + public String getMessage() { + return message; + } + + public void setMessage(@jakarta.annotation.Nullable String message) { + this.message = message; + } + + public AggregatedTradesResponse messageDetail( + @jakarta.annotation.Nullable String messageDetail) { + this.messageDetail = messageDetail; + return this; + } + + /** + * Get messageDetail + * + * @return messageDetail + */ + @jakarta.annotation.Nullable + public String getMessageDetail() { + return messageDetail; + } + + public void setMessageDetail(@jakarta.annotation.Nullable String messageDetail) { + this.messageDetail = messageDetail; + } + + public AggregatedTradesResponse data( + @jakarta.annotation.Nullable List<@Valid AggregatedTradesResponseDataInner> data) { + this.data = data; + return this; + } + + public AggregatedTradesResponse addDataItem(AggregatedTradesResponseDataInner dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } + this.data.add(dataItem); + return this; + } + + /** + * Get data + * + * @return data + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid AggregatedTradesResponseDataInner> getData() { + return data; + } + + public void setData( + @jakarta.annotation.Nullable List<@Valid AggregatedTradesResponseDataInner> data) { + this.data = data; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AggregatedTradesResponse aggregatedTradesResponse = (AggregatedTradesResponse) o; + return Objects.equals(this.code, aggregatedTradesResponse.code) + && Objects.equals(this.message, aggregatedTradesResponse.message) + && Objects.equals(this.messageDetail, aggregatedTradesResponse.messageDetail) + && Objects.equals(this.data, aggregatedTradesResponse.data); + } + + @Override + public int hashCode() { + return Objects.hash(code, message, messageDetail, data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AggregatedTradesResponse {\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" messageDetail: ").append(toIndentedString(messageDetail)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).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 messageValue = getMessage(); + String messageValueAsString = ""; + messageValueAsString = messageValue.toString(); + sb.append("message=").append(urlEncode(messageValueAsString)).append(""); + Object messageDetailValue = getMessageDetail(); + String messageDetailValueAsString = ""; + messageDetailValueAsString = messageDetailValue.toString(); + sb.append("messageDetail=").append(urlEncode(messageDetailValueAsString)).append(""); + Object dataValue = getData(); + String dataValueAsString = ""; + dataValueAsString = + (String) + ((Collection) dataValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("data=").append(urlEncode(dataValueAsString)).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("message"); + openapiFields.add("messageDetail"); + openapiFields.add("data"); + + // 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 AggregatedTradesResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AggregatedTradesResponse.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in AggregatedTradesResponse is not found" + + " in the empty JSON string", + AggregatedTradesResponse.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("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())); + } + if ((jsonObj.get("messageDetail") != null && !jsonObj.get("messageDetail").isJsonNull()) + && !jsonObj.get("messageDetail").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `messageDetail` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("messageDetail").toString())); + } + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + JsonArray jsonArraydata = jsonObj.getAsJsonArray("data"); + if (jsonArraydata != null) { + // ensure the json data is an array + if (!jsonObj.get("data").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `data` to be an array in the JSON string" + + " but got `%s`", + jsonObj.get("data").toString())); + } + + // validate the optional field `data` (array) + for (int i = 0; i < jsonArraydata.size(); i++) { + AggregatedTradesResponseDataInner.validateJsonElement(jsonArraydata.get(i)); + } + ; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AggregatedTradesResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AggregatedTradesResponse' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(AggregatedTradesResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, AggregatedTradesResponse value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AggregatedTradesResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of AggregatedTradesResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of AggregatedTradesResponse + * @throws IOException if the JSON string is invalid with respect to AggregatedTradesResponse + */ + public static AggregatedTradesResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AggregatedTradesResponse.class); + } + + /** + * Convert an instance of AggregatedTradesResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/alpha/src/main/java/com/binance/connector/client/alpha/rest/model/AggregatedTradesResponseDataInner.java b/clients/alpha/src/main/java/com/binance/connector/client/alpha/rest/model/AggregatedTradesResponseDataInner.java new file mode 100644 index 000000000..37a133539 --- /dev/null +++ b/clients/alpha/src/main/java/com/binance/connector/client/alpha/rest/model/AggregatedTradesResponseDataInner.java @@ -0,0 +1,424 @@ +/* + * Binance Alpha REST API + * OpenAPI Specification for the Binance Alpha REST API + * + * 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.alpha.rest.model; + +import com.binance.connector.client.alpha.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.*; + +/** AggregatedTradesResponseDataInner */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.12.0") +public class AggregatedTradesResponseDataInner { + public static final String SERIALIZED_NAME_A_LOWER_CASE = "a"; + + @SerializedName(SERIALIZED_NAME_A_LOWER_CASE) + @jakarta.annotation.Nullable + private Long aLowerCase; + + public static final String SERIALIZED_NAME_P_LOWER_CASE = "p"; + + @SerializedName(SERIALIZED_NAME_P_LOWER_CASE) + @jakarta.annotation.Nullable + private String pLowerCase; + + public static final String SERIALIZED_NAME_Q_LOWER_CASE = "q"; + + @SerializedName(SERIALIZED_NAME_Q_LOWER_CASE) + @jakarta.annotation.Nullable + private String qLowerCase; + + public static final String SERIALIZED_NAME_F_LOWER_CASE = "f"; + + @SerializedName(SERIALIZED_NAME_F_LOWER_CASE) + @jakarta.annotation.Nullable + private Long fLowerCase; + + public static final String SERIALIZED_NAME_L_LOWER_CASE = "l"; + + @SerializedName(SERIALIZED_NAME_L_LOWER_CASE) + @jakarta.annotation.Nullable + private Long lLowerCase; + + public static final String SERIALIZED_NAME_T = "T"; + + @SerializedName(SERIALIZED_NAME_T) + @jakarta.annotation.Nullable + private Long T; + + public static final String SERIALIZED_NAME_M_LOWER_CASE = "m"; + + @SerializedName(SERIALIZED_NAME_M_LOWER_CASE) + @jakarta.annotation.Nullable + private Boolean mLowerCase; + + public AggregatedTradesResponseDataInner() {} + + public AggregatedTradesResponseDataInner aLowerCase( + @jakarta.annotation.Nullable Long aLowerCase) { + this.aLowerCase = aLowerCase; + return this; + } + + /** + * Get aLowerCase + * + * @return aLowerCase + */ + @jakarta.annotation.Nullable + public Long getaLowerCase() { + return aLowerCase; + } + + public void setaLowerCase(@jakarta.annotation.Nullable Long aLowerCase) { + this.aLowerCase = aLowerCase; + } + + public AggregatedTradesResponseDataInner pLowerCase( + @jakarta.annotation.Nullable String pLowerCase) { + this.pLowerCase = pLowerCase; + return this; + } + + /** + * Get pLowerCase + * + * @return pLowerCase + */ + @jakarta.annotation.Nullable + public String getpLowerCase() { + return pLowerCase; + } + + public void setpLowerCase(@jakarta.annotation.Nullable String pLowerCase) { + this.pLowerCase = pLowerCase; + } + + public AggregatedTradesResponseDataInner qLowerCase( + @jakarta.annotation.Nullable String qLowerCase) { + this.qLowerCase = qLowerCase; + return this; + } + + /** + * Get qLowerCase + * + * @return qLowerCase + */ + @jakarta.annotation.Nullable + public String getqLowerCase() { + return qLowerCase; + } + + public void setqLowerCase(@jakarta.annotation.Nullable String qLowerCase) { + this.qLowerCase = qLowerCase; + } + + public AggregatedTradesResponseDataInner fLowerCase( + @jakarta.annotation.Nullable Long fLowerCase) { + this.fLowerCase = fLowerCase; + return this; + } + + /** + * Get fLowerCase + * + * @return fLowerCase + */ + @jakarta.annotation.Nullable + public Long getfLowerCase() { + return fLowerCase; + } + + public void setfLowerCase(@jakarta.annotation.Nullable Long fLowerCase) { + this.fLowerCase = fLowerCase; + } + + public AggregatedTradesResponseDataInner lLowerCase( + @jakarta.annotation.Nullable Long lLowerCase) { + this.lLowerCase = lLowerCase; + return this; + } + + /** + * Get lLowerCase + * + * @return lLowerCase + */ + @jakarta.annotation.Nullable + public Long getlLowerCase() { + return lLowerCase; + } + + public void setlLowerCase(@jakarta.annotation.Nullable Long lLowerCase) { + this.lLowerCase = lLowerCase; + } + + public AggregatedTradesResponseDataInner T(@jakarta.annotation.Nullable Long T) { + this.T = T; + return this; + } + + /** + * Get T + * + * @return T + */ + @jakarta.annotation.Nullable + public Long getT() { + return T; + } + + public void setT(@jakarta.annotation.Nullable Long T) { + this.T = T; + } + + public AggregatedTradesResponseDataInner mLowerCase( + @jakarta.annotation.Nullable Boolean mLowerCase) { + this.mLowerCase = mLowerCase; + return this; + } + + /** + * Get mLowerCase + * + * @return mLowerCase + */ + @jakarta.annotation.Nullable + public Boolean getmLowerCase() { + return mLowerCase; + } + + public void setmLowerCase(@jakarta.annotation.Nullable Boolean mLowerCase) { + this.mLowerCase = mLowerCase; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AggregatedTradesResponseDataInner aggregatedTradesResponseDataInner = + (AggregatedTradesResponseDataInner) o; + return Objects.equals(this.aLowerCase, aggregatedTradesResponseDataInner.aLowerCase) + && Objects.equals(this.pLowerCase, aggregatedTradesResponseDataInner.pLowerCase) + && Objects.equals(this.qLowerCase, aggregatedTradesResponseDataInner.qLowerCase) + && Objects.equals(this.fLowerCase, aggregatedTradesResponseDataInner.fLowerCase) + && Objects.equals(this.lLowerCase, aggregatedTradesResponseDataInner.lLowerCase) + && Objects.equals(this.T, aggregatedTradesResponseDataInner.T) + && Objects.equals(this.mLowerCase, aggregatedTradesResponseDataInner.mLowerCase); + } + + @Override + public int hashCode() { + return Objects.hash( + aLowerCase, pLowerCase, qLowerCase, fLowerCase, lLowerCase, T, mLowerCase); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AggregatedTradesResponseDataInner {\n"); + sb.append(" aLowerCase: ").append(toIndentedString(aLowerCase)).append("\n"); + sb.append(" pLowerCase: ").append(toIndentedString(pLowerCase)).append("\n"); + sb.append(" qLowerCase: ").append(toIndentedString(qLowerCase)).append("\n"); + sb.append(" fLowerCase: ").append(toIndentedString(fLowerCase)).append("\n"); + sb.append(" lLowerCase: ").append(toIndentedString(lLowerCase)).append("\n"); + sb.append(" T: ").append(toIndentedString(T)).append("\n"); + sb.append(" mLowerCase: ").append(toIndentedString(mLowerCase)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object aLowerCaseValue = getaLowerCase(); + String aLowerCaseValueAsString = ""; + aLowerCaseValueAsString = aLowerCaseValue.toString(); + sb.append("aLowerCase=").append(urlEncode(aLowerCaseValueAsString)).append(""); + Object pLowerCaseValue = getpLowerCase(); + String pLowerCaseValueAsString = ""; + pLowerCaseValueAsString = pLowerCaseValue.toString(); + sb.append("pLowerCase=").append(urlEncode(pLowerCaseValueAsString)).append(""); + Object qLowerCaseValue = getqLowerCase(); + String qLowerCaseValueAsString = ""; + qLowerCaseValueAsString = qLowerCaseValue.toString(); + sb.append("qLowerCase=").append(urlEncode(qLowerCaseValueAsString)).append(""); + Object fLowerCaseValue = getfLowerCase(); + String fLowerCaseValueAsString = ""; + fLowerCaseValueAsString = fLowerCaseValue.toString(); + sb.append("fLowerCase=").append(urlEncode(fLowerCaseValueAsString)).append(""); + Object lLowerCaseValue = getlLowerCase(); + String lLowerCaseValueAsString = ""; + lLowerCaseValueAsString = lLowerCaseValue.toString(); + sb.append("lLowerCase=").append(urlEncode(lLowerCaseValueAsString)).append(""); + Object TValue = getT(); + String TValueAsString = ""; + TValueAsString = TValue.toString(); + sb.append("T=").append(urlEncode(TValueAsString)).append(""); + Object mLowerCaseValue = getmLowerCase(); + String mLowerCaseValueAsString = ""; + mLowerCaseValueAsString = mLowerCaseValue.toString(); + sb.append("mLowerCase=").append(urlEncode(mLowerCaseValueAsString)).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("a"); + openapiFields.add("p"); + openapiFields.add("q"); + openapiFields.add("f"); + openapiFields.add("l"); + openapiFields.add("T"); + openapiFields.add("m"); + + // 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 + * AggregatedTradesResponseDataInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AggregatedTradesResponseDataInner.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in AggregatedTradesResponseDataInner is" + + " not found in the empty JSON string", + AggregatedTradesResponseDataInner.openapiRequiredFields + .toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("p") != null && !jsonObj.get("p").isJsonNull()) + && !jsonObj.get("p").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `p` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("p").toString())); + } + if ((jsonObj.get("q") != null && !jsonObj.get("q").isJsonNull()) + && !jsonObj.get("q").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `q` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("q").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AggregatedTradesResponseDataInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AggregatedTradesResponseDataInner' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(AggregatedTradesResponseDataInner.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, AggregatedTradesResponseDataInner value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AggregatedTradesResponseDataInner read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of AggregatedTradesResponseDataInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of AggregatedTradesResponseDataInner + * @throws IOException if the JSON string is invalid with respect to + * AggregatedTradesResponseDataInner + */ + public static AggregatedTradesResponseDataInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AggregatedTradesResponseDataInner.class); + } + + /** + * Convert an instance of AggregatedTradesResponseDataInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/alpha/src/main/java/com/binance/connector/client/alpha/rest/model/GetExchangeInfoResponse.java b/clients/alpha/src/main/java/com/binance/connector/client/alpha/rest/model/GetExchangeInfoResponse.java new file mode 100644 index 000000000..36d5ac880 --- /dev/null +++ b/clients/alpha/src/main/java/com/binance/connector/client/alpha/rest/model/GetExchangeInfoResponse.java @@ -0,0 +1,363 @@ +/* + * Binance Alpha REST API + * OpenAPI Specification for the Binance Alpha REST API + * + * 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.alpha.rest.model; + +import com.binance.connector.client.alpha.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.*; + +/** GetExchangeInfoResponse */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.12.0") +public class GetExchangeInfoResponse { + public static final String SERIALIZED_NAME_CODE = "code"; + + @SerializedName(SERIALIZED_NAME_CODE) + @jakarta.annotation.Nullable + private String code; + + public static final String SERIALIZED_NAME_MESSAGE = "message"; + + @SerializedName(SERIALIZED_NAME_MESSAGE) + @jakarta.annotation.Nullable + private String message; + + public static final String SERIALIZED_NAME_MESSAGE_DETAIL = "messageDetail"; + + @SerializedName(SERIALIZED_NAME_MESSAGE_DETAIL) + @jakarta.annotation.Nullable + private String messageDetail; + + public static final String SERIALIZED_NAME_SUCCESS = "success"; + + @SerializedName(SERIALIZED_NAME_SUCCESS) + @jakarta.annotation.Nullable + private Boolean success; + + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + @jakarta.annotation.Nullable + private GetExchangeInfoResponseData data; + + public GetExchangeInfoResponse() {} + + public GetExchangeInfoResponse 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 GetExchangeInfoResponse message(@jakarta.annotation.Nullable String message) { + this.message = message; + return this; + } + + /** + * Get message + * + * @return message + */ + @jakarta.annotation.Nullable + public String getMessage() { + return message; + } + + public void setMessage(@jakarta.annotation.Nullable String message) { + this.message = message; + } + + public GetExchangeInfoResponse messageDetail( + @jakarta.annotation.Nullable String messageDetail) { + this.messageDetail = messageDetail; + return this; + } + + /** + * Get messageDetail + * + * @return messageDetail + */ + @jakarta.annotation.Nullable + public String getMessageDetail() { + return messageDetail; + } + + public void setMessageDetail(@jakarta.annotation.Nullable String messageDetail) { + this.messageDetail = messageDetail; + } + + public GetExchangeInfoResponse success(@jakarta.annotation.Nullable Boolean success) { + this.success = success; + return this; + } + + /** + * Get success + * + * @return success + */ + @jakarta.annotation.Nullable + public Boolean getSuccess() { + return success; + } + + public void setSuccess(@jakarta.annotation.Nullable Boolean success) { + this.success = success; + } + + public GetExchangeInfoResponse data( + @jakarta.annotation.Nullable GetExchangeInfoResponseData data) { + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @jakarta.annotation.Nullable + @Valid + public GetExchangeInfoResponseData getData() { + return data; + } + + public void setData(@jakarta.annotation.Nullable GetExchangeInfoResponseData data) { + this.data = data; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetExchangeInfoResponse getExchangeInfoResponse = (GetExchangeInfoResponse) o; + return Objects.equals(this.code, getExchangeInfoResponse.code) + && Objects.equals(this.message, getExchangeInfoResponse.message) + && Objects.equals(this.messageDetail, getExchangeInfoResponse.messageDetail) + && Objects.equals(this.success, getExchangeInfoResponse.success) + && Objects.equals(this.data, getExchangeInfoResponse.data); + } + + @Override + public int hashCode() { + return Objects.hash(code, message, messageDetail, success, data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetExchangeInfoResponse {\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" messageDetail: ").append(toIndentedString(messageDetail)).append("\n"); + sb.append(" success: ").append(toIndentedString(success)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).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 messageValue = getMessage(); + String messageValueAsString = ""; + messageValueAsString = messageValue.toString(); + sb.append("message=").append(urlEncode(messageValueAsString)).append(""); + Object messageDetailValue = getMessageDetail(); + String messageDetailValueAsString = ""; + messageDetailValueAsString = messageDetailValue.toString(); + sb.append("messageDetail=").append(urlEncode(messageDetailValueAsString)).append(""); + Object successValue = getSuccess(); + String successValueAsString = ""; + successValueAsString = successValue.toString(); + sb.append("success=").append(urlEncode(successValueAsString)).append(""); + Object dataValue = getData(); + String dataValueAsString = ""; + dataValueAsString = dataValue.toString(); + sb.append("data=").append(urlEncode(dataValueAsString)).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("message"); + openapiFields.add("messageDetail"); + openapiFields.add("success"); + openapiFields.add("data"); + + // 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 GetExchangeInfoResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetExchangeInfoResponse.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetExchangeInfoResponse is not found" + + " in the empty JSON string", + GetExchangeInfoResponse.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("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())); + } + if ((jsonObj.get("messageDetail") != null && !jsonObj.get("messageDetail").isJsonNull()) + && !jsonObj.get("messageDetail").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `messageDetail` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("messageDetail").toString())); + } + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + GetExchangeInfoResponseData.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetExchangeInfoResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetExchangeInfoResponse' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(GetExchangeInfoResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetExchangeInfoResponse value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetExchangeInfoResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetExchangeInfoResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetExchangeInfoResponse + * @throws IOException if the JSON string is invalid with respect to GetExchangeInfoResponse + */ + public static GetExchangeInfoResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetExchangeInfoResponse.class); + } + + /** + * Convert an instance of GetExchangeInfoResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/alpha/src/main/java/com/binance/connector/client/alpha/rest/model/GetExchangeInfoResponseData.java b/clients/alpha/src/main/java/com/binance/connector/client/alpha/rest/model/GetExchangeInfoResponseData.java new file mode 100644 index 000000000..f5e004914 --- /dev/null +++ b/clients/alpha/src/main/java/com/binance/connector/client/alpha/rest/model/GetExchangeInfoResponseData.java @@ -0,0 +1,396 @@ +/* + * Binance Alpha REST API + * OpenAPI Specification for the Binance Alpha REST API + * + * 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.alpha.rest.model; + +import com.binance.connector.client.alpha.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.*; + +/** GetExchangeInfoResponseData */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.12.0") +public class GetExchangeInfoResponseData { + public static final String SERIALIZED_NAME_TIMEZONE = "timezone"; + + @SerializedName(SERIALIZED_NAME_TIMEZONE) + @jakarta.annotation.Nullable + private String timezone; + + public static final String SERIALIZED_NAME_ASSETS = "assets"; + + @SerializedName(SERIALIZED_NAME_ASSETS) + @jakarta.annotation.Nullable + private List<@Valid GetExchangeInfoResponseDataAssetsInner> assets; + + public static final String SERIALIZED_NAME_SYMBOLS = "symbols"; + + @SerializedName(SERIALIZED_NAME_SYMBOLS) + @jakarta.annotation.Nullable + private List<@Valid GetExchangeInfoResponseDataSymbolsInner> symbols; + + public static final String SERIALIZED_NAME_ORDER_TYPES = "orderTypes"; + + @SerializedName(SERIALIZED_NAME_ORDER_TYPES) + @jakarta.annotation.Nullable + private String orderTypes; + + public GetExchangeInfoResponseData() {} + + public GetExchangeInfoResponseData timezone(@jakarta.annotation.Nullable String timezone) { + this.timezone = timezone; + return this; + } + + /** + * Get timezone + * + * @return timezone + */ + @jakarta.annotation.Nullable + public String getTimezone() { + return timezone; + } + + public void setTimezone(@jakarta.annotation.Nullable String timezone) { + this.timezone = timezone; + } + + public GetExchangeInfoResponseData assets( + @jakarta.annotation.Nullable + List<@Valid GetExchangeInfoResponseDataAssetsInner> assets) { + this.assets = assets; + return this; + } + + public GetExchangeInfoResponseData addAssetsItem( + GetExchangeInfoResponseDataAssetsInner assetsItem) { + if (this.assets == null) { + this.assets = new ArrayList<>(); + } + this.assets.add(assetsItem); + return this; + } + + /** + * Get assets + * + * @return assets + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid GetExchangeInfoResponseDataAssetsInner> getAssets() { + return assets; + } + + public void setAssets( + @jakarta.annotation.Nullable + List<@Valid GetExchangeInfoResponseDataAssetsInner> assets) { + this.assets = assets; + } + + public GetExchangeInfoResponseData symbols( + @jakarta.annotation.Nullable + List<@Valid GetExchangeInfoResponseDataSymbolsInner> symbols) { + this.symbols = symbols; + return this; + } + + public GetExchangeInfoResponseData addSymbolsItem( + GetExchangeInfoResponseDataSymbolsInner symbolsItem) { + if (this.symbols == null) { + this.symbols = new ArrayList<>(); + } + this.symbols.add(symbolsItem); + return this; + } + + /** + * Get symbols + * + * @return symbols + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid GetExchangeInfoResponseDataSymbolsInner> getSymbols() { + return symbols; + } + + public void setSymbols( + @jakarta.annotation.Nullable + List<@Valid GetExchangeInfoResponseDataSymbolsInner> symbols) { + this.symbols = symbols; + } + + public GetExchangeInfoResponseData orderTypes(@jakarta.annotation.Nullable String orderTypes) { + this.orderTypes = orderTypes; + return this; + } + + /** + * Get orderTypes + * + * @return orderTypes + */ + @jakarta.annotation.Nullable + public String getOrderTypes() { + return orderTypes; + } + + public void setOrderTypes(@jakarta.annotation.Nullable String orderTypes) { + this.orderTypes = orderTypes; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetExchangeInfoResponseData getExchangeInfoResponseData = (GetExchangeInfoResponseData) o; + return Objects.equals(this.timezone, getExchangeInfoResponseData.timezone) + && Objects.equals(this.assets, getExchangeInfoResponseData.assets) + && Objects.equals(this.symbols, getExchangeInfoResponseData.symbols) + && Objects.equals(this.orderTypes, getExchangeInfoResponseData.orderTypes); + } + + @Override + public int hashCode() { + return Objects.hash(timezone, assets, symbols, orderTypes); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetExchangeInfoResponseData {\n"); + sb.append(" timezone: ").append(toIndentedString(timezone)).append("\n"); + sb.append(" assets: ").append(toIndentedString(assets)).append("\n"); + sb.append(" symbols: ").append(toIndentedString(symbols)).append("\n"); + sb.append(" orderTypes: ").append(toIndentedString(orderTypes)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object timezoneValue = getTimezone(); + String timezoneValueAsString = ""; + timezoneValueAsString = timezoneValue.toString(); + sb.append("timezone=").append(urlEncode(timezoneValueAsString)).append(""); + Object assetsValue = getAssets(); + String assetsValueAsString = ""; + assetsValueAsString = + (String) + ((Collection) assetsValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("assets=").append(urlEncode(assetsValueAsString)).append(""); + Object symbolsValue = getSymbols(); + String symbolsValueAsString = ""; + symbolsValueAsString = + (String) + ((Collection) symbolsValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("symbols=").append(urlEncode(symbolsValueAsString)).append(""); + Object orderTypesValue = getOrderTypes(); + String orderTypesValueAsString = ""; + orderTypesValueAsString = orderTypesValue.toString(); + sb.append("orderTypes=").append(urlEncode(orderTypesValueAsString)).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("timezone"); + openapiFields.add("assets"); + openapiFields.add("symbols"); + openapiFields.add("orderTypes"); + + // 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 + * GetExchangeInfoResponseData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetExchangeInfoResponseData.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetExchangeInfoResponseData is not" + + " found in the empty JSON string", + GetExchangeInfoResponseData.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("timezone") != null && !jsonObj.get("timezone").isJsonNull()) + && !jsonObj.get("timezone").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `timezone` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("timezone").toString())); + } + if (jsonObj.get("assets") != null && !jsonObj.get("assets").isJsonNull()) { + JsonArray jsonArrayassets = jsonObj.getAsJsonArray("assets"); + if (jsonArrayassets != null) { + // ensure the json data is an array + if (!jsonObj.get("assets").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `assets` to be an array in the JSON string" + + " but got `%s`", + jsonObj.get("assets").toString())); + } + + // validate the optional field `assets` (array) + for (int i = 0; i < jsonArrayassets.size(); i++) { + GetExchangeInfoResponseDataAssetsInner.validateJsonElement( + jsonArrayassets.get(i)); + } + ; + } + } + if (jsonObj.get("symbols") != null && !jsonObj.get("symbols").isJsonNull()) { + JsonArray jsonArraysymbols = jsonObj.getAsJsonArray("symbols"); + if (jsonArraysymbols != null) { + // ensure the json data is an array + if (!jsonObj.get("symbols").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `symbols` to be an array in the JSON string" + + " but got `%s`", + jsonObj.get("symbols").toString())); + } + + // validate the optional field `symbols` (array) + for (int i = 0; i < jsonArraysymbols.size(); i++) { + GetExchangeInfoResponseDataSymbolsInner.validateJsonElement( + jsonArraysymbols.get(i)); + } + ; + } + } + if ((jsonObj.get("orderTypes") != null && !jsonObj.get("orderTypes").isJsonNull()) + && !jsonObj.get("orderTypes").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `orderTypes` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("orderTypes").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetExchangeInfoResponseData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetExchangeInfoResponseData' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(GetExchangeInfoResponseData.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetExchangeInfoResponseData value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetExchangeInfoResponseData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetExchangeInfoResponseData given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetExchangeInfoResponseData + * @throws IOException if the JSON string is invalid with respect to GetExchangeInfoResponseData + */ + public static GetExchangeInfoResponseData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetExchangeInfoResponseData.class); + } + + /** + * Convert an instance of GetExchangeInfoResponseData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/alpha/src/main/java/com/binance/connector/client/alpha/rest/model/GetExchangeInfoResponseDataAssetsInner.java b/clients/alpha/src/main/java/com/binance/connector/client/alpha/rest/model/GetExchangeInfoResponseDataAssetsInner.java new file mode 100644 index 000000000..b7dfe2e7e --- /dev/null +++ b/clients/alpha/src/main/java/com/binance/connector/client/alpha/rest/model/GetExchangeInfoResponseDataAssetsInner.java @@ -0,0 +1,219 @@ +/* + * Binance Alpha REST API + * OpenAPI Specification for the Binance Alpha REST API + * + * 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.alpha.rest.model; + +import com.binance.connector.client.alpha.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.*; + +/** GetExchangeInfoResponseDataAssetsInner */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.12.0") +public class GetExchangeInfoResponseDataAssetsInner { + public static final String SERIALIZED_NAME_ASSET = "asset"; + + @SerializedName(SERIALIZED_NAME_ASSET) + @jakarta.annotation.Nullable + private String asset; + + public GetExchangeInfoResponseDataAssetsInner() {} + + public GetExchangeInfoResponseDataAssetsInner asset(@jakarta.annotation.Nullable String asset) { + this.asset = asset; + return this; + } + + /** + * Get asset + * + * @return asset + */ + @jakarta.annotation.Nullable + public String getAsset() { + return asset; + } + + public void setAsset(@jakarta.annotation.Nullable String asset) { + this.asset = asset; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetExchangeInfoResponseDataAssetsInner getExchangeInfoResponseDataAssetsInner = + (GetExchangeInfoResponseDataAssetsInner) o; + return Objects.equals(this.asset, getExchangeInfoResponseDataAssetsInner.asset); + } + + @Override + public int hashCode() { + return Objects.hash(asset); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetExchangeInfoResponseDataAssetsInner {\n"); + sb.append(" asset: ").append(toIndentedString(asset)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object assetValue = getAsset(); + String assetValueAsString = ""; + assetValueAsString = assetValue.toString(); + sb.append("asset=").append(urlEncode(assetValueAsString)).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("asset"); + + // 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 + * GetExchangeInfoResponseDataAssetsInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetExchangeInfoResponseDataAssetsInner.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetExchangeInfoResponseDataAssetsInner" + + " is not found in the empty JSON string", + GetExchangeInfoResponseDataAssetsInner.openapiRequiredFields + .toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("asset") != null && !jsonObj.get("asset").isJsonNull()) + && !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())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetExchangeInfoResponseDataAssetsInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetExchangeInfoResponseDataAssetsInner' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(GetExchangeInfoResponseDataAssetsInner.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, GetExchangeInfoResponseDataAssetsInner value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetExchangeInfoResponseDataAssetsInner read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetExchangeInfoResponseDataAssetsInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetExchangeInfoResponseDataAssetsInner + * @throws IOException if the JSON string is invalid with respect to + * GetExchangeInfoResponseDataAssetsInner + */ + public static GetExchangeInfoResponseDataAssetsInner fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, GetExchangeInfoResponseDataAssetsInner.class); + } + + /** + * Convert an instance of GetExchangeInfoResponseDataAssetsInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/alpha/src/main/java/com/binance/connector/client/alpha/rest/model/GetExchangeInfoResponseDataSymbolsInner.java b/clients/alpha/src/main/java/com/binance/connector/client/alpha/rest/model/GetExchangeInfoResponseDataSymbolsInner.java new file mode 100644 index 000000000..6072304e9 --- /dev/null +++ b/clients/alpha/src/main/java/com/binance/connector/client/alpha/rest/model/GetExchangeInfoResponseDataSymbolsInner.java @@ -0,0 +1,630 @@ +/* + * Binance Alpha REST API + * OpenAPI Specification for the Binance Alpha REST API + * + * 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.alpha.rest.model; + +import com.binance.connector.client.alpha.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.*; + +/** GetExchangeInfoResponseDataSymbolsInner */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.12.0") +public class GetExchangeInfoResponseDataSymbolsInner { + public static final String SERIALIZED_NAME_SYMBOL = "symbol"; + + @SerializedName(SERIALIZED_NAME_SYMBOL) + @jakarta.annotation.Nullable + private String symbol; + + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + @jakarta.annotation.Nullable + private String status; + + public static final String SERIALIZED_NAME_BASE_ASSET = "baseAsset"; + + @SerializedName(SERIALIZED_NAME_BASE_ASSET) + @jakarta.annotation.Nullable + private String baseAsset; + + public static final String SERIALIZED_NAME_QUOTE_ASSET = "quoteAsset"; + + @SerializedName(SERIALIZED_NAME_QUOTE_ASSET) + @jakarta.annotation.Nullable + private String quoteAsset; + + public static final String SERIALIZED_NAME_PRICE_PRECISION = "pricePrecision"; + + @SerializedName(SERIALIZED_NAME_PRICE_PRECISION) + @jakarta.annotation.Nullable + private Long pricePrecision; + + public static final String SERIALIZED_NAME_QUANTITY_PRECISION = "quantityPrecision"; + + @SerializedName(SERIALIZED_NAME_QUANTITY_PRECISION) + @jakarta.annotation.Nullable + private Long quantityPrecision; + + public static final String SERIALIZED_NAME_BASE_ASSET_PRECISION = "baseAssetPrecision"; + + @SerializedName(SERIALIZED_NAME_BASE_ASSET_PRECISION) + @jakarta.annotation.Nullable + private Long baseAssetPrecision; + + public static final String SERIALIZED_NAME_QUOTE_PRECISION = "quotePrecision"; + + @SerializedName(SERIALIZED_NAME_QUOTE_PRECISION) + @jakarta.annotation.Nullable + private Long quotePrecision; + + public static final String SERIALIZED_NAME_FILTERS = "filters"; + + @SerializedName(SERIALIZED_NAME_FILTERS) + @jakarta.annotation.Nullable + private List<@Valid GetExchangeInfoResponseDataSymbolsInnerFiltersInner> filters; + + public static final String SERIALIZED_NAME_ORDER_TYPES = "orderTypes"; + + @SerializedName(SERIALIZED_NAME_ORDER_TYPES) + @jakarta.annotation.Nullable + private List orderTypes; + + public GetExchangeInfoResponseDataSymbolsInner() {} + + public GetExchangeInfoResponseDataSymbolsInner symbol( + @jakarta.annotation.Nullable String symbol) { + this.symbol = symbol; + return this; + } + + /** + * Get symbol + * + * @return symbol + */ + @jakarta.annotation.Nullable + public String getSymbol() { + return symbol; + } + + public void setSymbol(@jakarta.annotation.Nullable String symbol) { + this.symbol = symbol; + } + + public GetExchangeInfoResponseDataSymbolsInner 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 GetExchangeInfoResponseDataSymbolsInner baseAsset( + @jakarta.annotation.Nullable String baseAsset) { + this.baseAsset = baseAsset; + return this; + } + + /** + * Get baseAsset + * + * @return baseAsset + */ + @jakarta.annotation.Nullable + public String getBaseAsset() { + return baseAsset; + } + + public void setBaseAsset(@jakarta.annotation.Nullable String baseAsset) { + this.baseAsset = baseAsset; + } + + public GetExchangeInfoResponseDataSymbolsInner quoteAsset( + @jakarta.annotation.Nullable String quoteAsset) { + this.quoteAsset = quoteAsset; + return this; + } + + /** + * Get quoteAsset + * + * @return quoteAsset + */ + @jakarta.annotation.Nullable + public String getQuoteAsset() { + return quoteAsset; + } + + public void setQuoteAsset(@jakarta.annotation.Nullable String quoteAsset) { + this.quoteAsset = quoteAsset; + } + + public GetExchangeInfoResponseDataSymbolsInner pricePrecision( + @jakarta.annotation.Nullable Long pricePrecision) { + this.pricePrecision = pricePrecision; + return this; + } + + /** + * Get pricePrecision + * + * @return pricePrecision + */ + @jakarta.annotation.Nullable + public Long getPricePrecision() { + return pricePrecision; + } + + public void setPricePrecision(@jakarta.annotation.Nullable Long pricePrecision) { + this.pricePrecision = pricePrecision; + } + + public GetExchangeInfoResponseDataSymbolsInner quantityPrecision( + @jakarta.annotation.Nullable Long quantityPrecision) { + this.quantityPrecision = quantityPrecision; + return this; + } + + /** + * Get quantityPrecision + * + * @return quantityPrecision + */ + @jakarta.annotation.Nullable + public Long getQuantityPrecision() { + return quantityPrecision; + } + + public void setQuantityPrecision(@jakarta.annotation.Nullable Long quantityPrecision) { + this.quantityPrecision = quantityPrecision; + } + + public GetExchangeInfoResponseDataSymbolsInner baseAssetPrecision( + @jakarta.annotation.Nullable Long baseAssetPrecision) { + this.baseAssetPrecision = baseAssetPrecision; + return this; + } + + /** + * Get baseAssetPrecision + * + * @return baseAssetPrecision + */ + @jakarta.annotation.Nullable + public Long getBaseAssetPrecision() { + return baseAssetPrecision; + } + + public void setBaseAssetPrecision(@jakarta.annotation.Nullable Long baseAssetPrecision) { + this.baseAssetPrecision = baseAssetPrecision; + } + + public GetExchangeInfoResponseDataSymbolsInner quotePrecision( + @jakarta.annotation.Nullable Long quotePrecision) { + this.quotePrecision = quotePrecision; + return this; + } + + /** + * Get quotePrecision + * + * @return quotePrecision + */ + @jakarta.annotation.Nullable + public Long getQuotePrecision() { + return quotePrecision; + } + + public void setQuotePrecision(@jakarta.annotation.Nullable Long quotePrecision) { + this.quotePrecision = quotePrecision; + } + + public GetExchangeInfoResponseDataSymbolsInner filters( + @jakarta.annotation.Nullable + List<@Valid GetExchangeInfoResponseDataSymbolsInnerFiltersInner> filters) { + this.filters = filters; + return this; + } + + public GetExchangeInfoResponseDataSymbolsInner addFiltersItem( + GetExchangeInfoResponseDataSymbolsInnerFiltersInner filtersItem) { + if (this.filters == null) { + this.filters = new ArrayList<>(); + } + this.filters.add(filtersItem); + return this; + } + + /** + * Get filters + * + * @return filters + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid GetExchangeInfoResponseDataSymbolsInnerFiltersInner> getFilters() { + return filters; + } + + public void setFilters( + @jakarta.annotation.Nullable + List<@Valid GetExchangeInfoResponseDataSymbolsInnerFiltersInner> filters) { + this.filters = filters; + } + + public GetExchangeInfoResponseDataSymbolsInner orderTypes( + @jakarta.annotation.Nullable List orderTypes) { + this.orderTypes = orderTypes; + return this; + } + + public GetExchangeInfoResponseDataSymbolsInner addOrderTypesItem(String orderTypesItem) { + if (this.orderTypes == null) { + this.orderTypes = new ArrayList<>(); + } + this.orderTypes.add(orderTypesItem); + return this; + } + + /** + * Get orderTypes + * + * @return orderTypes + */ + @jakarta.annotation.Nullable + public List getOrderTypes() { + return orderTypes; + } + + public void setOrderTypes(@jakarta.annotation.Nullable List orderTypes) { + this.orderTypes = orderTypes; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetExchangeInfoResponseDataSymbolsInner getExchangeInfoResponseDataSymbolsInner = + (GetExchangeInfoResponseDataSymbolsInner) o; + return Objects.equals(this.symbol, getExchangeInfoResponseDataSymbolsInner.symbol) + && Objects.equals(this.status, getExchangeInfoResponseDataSymbolsInner.status) + && Objects.equals(this.baseAsset, getExchangeInfoResponseDataSymbolsInner.baseAsset) + && Objects.equals( + this.quoteAsset, getExchangeInfoResponseDataSymbolsInner.quoteAsset) + && Objects.equals( + this.pricePrecision, getExchangeInfoResponseDataSymbolsInner.pricePrecision) + && Objects.equals( + this.quantityPrecision, + getExchangeInfoResponseDataSymbolsInner.quantityPrecision) + && Objects.equals( + this.baseAssetPrecision, + getExchangeInfoResponseDataSymbolsInner.baseAssetPrecision) + && Objects.equals( + this.quotePrecision, getExchangeInfoResponseDataSymbolsInner.quotePrecision) + && Objects.equals(this.filters, getExchangeInfoResponseDataSymbolsInner.filters) + && Objects.equals( + this.orderTypes, getExchangeInfoResponseDataSymbolsInner.orderTypes); + } + + @Override + public int hashCode() { + return Objects.hash( + symbol, + status, + baseAsset, + quoteAsset, + pricePrecision, + quantityPrecision, + baseAssetPrecision, + quotePrecision, + filters, + orderTypes); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetExchangeInfoResponseDataSymbolsInner {\n"); + sb.append(" symbol: ").append(toIndentedString(symbol)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" baseAsset: ").append(toIndentedString(baseAsset)).append("\n"); + sb.append(" quoteAsset: ").append(toIndentedString(quoteAsset)).append("\n"); + sb.append(" pricePrecision: ").append(toIndentedString(pricePrecision)).append("\n"); + sb.append(" quantityPrecision: ").append(toIndentedString(quantityPrecision)).append("\n"); + sb.append(" baseAssetPrecision: ") + .append(toIndentedString(baseAssetPrecision)) + .append("\n"); + sb.append(" quotePrecision: ").append(toIndentedString(quotePrecision)).append("\n"); + sb.append(" filters: ").append(toIndentedString(filters)).append("\n"); + sb.append(" orderTypes: ").append(toIndentedString(orderTypes)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object symbolValue = getSymbol(); + String symbolValueAsString = ""; + symbolValueAsString = symbolValue.toString(); + sb.append("symbol=").append(urlEncode(symbolValueAsString)).append(""); + Object statusValue = getStatus(); + String statusValueAsString = ""; + statusValueAsString = statusValue.toString(); + sb.append("status=").append(urlEncode(statusValueAsString)).append(""); + Object baseAssetValue = getBaseAsset(); + String baseAssetValueAsString = ""; + baseAssetValueAsString = baseAssetValue.toString(); + sb.append("baseAsset=").append(urlEncode(baseAssetValueAsString)).append(""); + Object quoteAssetValue = getQuoteAsset(); + String quoteAssetValueAsString = ""; + quoteAssetValueAsString = quoteAssetValue.toString(); + sb.append("quoteAsset=").append(urlEncode(quoteAssetValueAsString)).append(""); + Object pricePrecisionValue = getPricePrecision(); + String pricePrecisionValueAsString = ""; + pricePrecisionValueAsString = pricePrecisionValue.toString(); + sb.append("pricePrecision=").append(urlEncode(pricePrecisionValueAsString)).append(""); + Object quantityPrecisionValue = getQuantityPrecision(); + String quantityPrecisionValueAsString = ""; + quantityPrecisionValueAsString = quantityPrecisionValue.toString(); + sb.append("quantityPrecision=") + .append(urlEncode(quantityPrecisionValueAsString)) + .append(""); + Object baseAssetPrecisionValue = getBaseAssetPrecision(); + String baseAssetPrecisionValueAsString = ""; + baseAssetPrecisionValueAsString = baseAssetPrecisionValue.toString(); + sb.append("baseAssetPrecision=") + .append(urlEncode(baseAssetPrecisionValueAsString)) + .append(""); + Object quotePrecisionValue = getQuotePrecision(); + String quotePrecisionValueAsString = ""; + quotePrecisionValueAsString = quotePrecisionValue.toString(); + sb.append("quotePrecision=").append(urlEncode(quotePrecisionValueAsString)).append(""); + Object filtersValue = getFilters(); + String filtersValueAsString = ""; + filtersValueAsString = + (String) + ((Collection) filtersValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("filters=").append(urlEncode(filtersValueAsString)).append(""); + Object orderTypesValue = getOrderTypes(); + String orderTypesValueAsString = ""; + orderTypesValueAsString = + (String) + ((Collection) orderTypesValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("orderTypes=").append(urlEncode(orderTypesValueAsString)).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("symbol"); + openapiFields.add("status"); + openapiFields.add("baseAsset"); + openapiFields.add("quoteAsset"); + openapiFields.add("pricePrecision"); + openapiFields.add("quantityPrecision"); + openapiFields.add("baseAssetPrecision"); + openapiFields.add("quotePrecision"); + openapiFields.add("filters"); + openapiFields.add("orderTypes"); + + // 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 + * GetExchangeInfoResponseDataSymbolsInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetExchangeInfoResponseDataSymbolsInner.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " GetExchangeInfoResponseDataSymbolsInner is not found in the" + + " empty JSON string", + GetExchangeInfoResponseDataSymbolsInner.openapiRequiredFields + .toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("symbol") != null && !jsonObj.get("symbol").isJsonNull()) + && !jsonObj.get("symbol").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `symbol` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("symbol").toString())); + } + 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("baseAsset") != null && !jsonObj.get("baseAsset").isJsonNull()) + && !jsonObj.get("baseAsset").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `baseAsset` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("baseAsset").toString())); + } + if ((jsonObj.get("quoteAsset") != null && !jsonObj.get("quoteAsset").isJsonNull()) + && !jsonObj.get("quoteAsset").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `quoteAsset` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("quoteAsset").toString())); + } + if (jsonObj.get("filters") != null && !jsonObj.get("filters").isJsonNull()) { + JsonArray jsonArrayfilters = jsonObj.getAsJsonArray("filters"); + if (jsonArrayfilters != null) { + // ensure the json data is an array + if (!jsonObj.get("filters").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `filters` to be an array in the JSON string" + + " but got `%s`", + jsonObj.get("filters").toString())); + } + + // validate the optional field `filters` (array) + for (int i = 0; i < jsonArrayfilters.size(); i++) { + GetExchangeInfoResponseDataSymbolsInnerFiltersInner.validateJsonElement( + jsonArrayfilters.get(i)); + } + ; + } + } + // ensure the optional json data is an array if present + if (jsonObj.get("orderTypes") != null + && !jsonObj.get("orderTypes").isJsonNull() + && !jsonObj.get("orderTypes").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `orderTypes` to be an array in the JSON string but" + + " got `%s`", + jsonObj.get("orderTypes").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetExchangeInfoResponseDataSymbolsInner.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes 'GetExchangeInfoResponseDataSymbolsInner' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(GetExchangeInfoResponseDataSymbolsInner.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, GetExchangeInfoResponseDataSymbolsInner value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetExchangeInfoResponseDataSymbolsInner read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetExchangeInfoResponseDataSymbolsInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetExchangeInfoResponseDataSymbolsInner + * @throws IOException if the JSON string is invalid with respect to + * GetExchangeInfoResponseDataSymbolsInner + */ + public static GetExchangeInfoResponseDataSymbolsInner fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, GetExchangeInfoResponseDataSymbolsInner.class); + } + + /** + * Convert an instance of GetExchangeInfoResponseDataSymbolsInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/alpha/src/main/java/com/binance/connector/client/alpha/rest/model/GetExchangeInfoResponseDataSymbolsInnerFiltersInner.java b/clients/alpha/src/main/java/com/binance/connector/client/alpha/rest/model/GetExchangeInfoResponseDataSymbolsInnerFiltersInner.java new file mode 100644 index 000000000..06fef0ce7 --- /dev/null +++ b/clients/alpha/src/main/java/com/binance/connector/client/alpha/rest/model/GetExchangeInfoResponseDataSymbolsInnerFiltersInner.java @@ -0,0 +1,884 @@ +/* + * Binance Alpha REST API + * OpenAPI Specification for the Binance Alpha REST API + * + * 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.alpha.rest.model; + +import com.binance.connector.client.alpha.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.*; + +/** GetExchangeInfoResponseDataSymbolsInnerFiltersInner */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.12.0") +public class GetExchangeInfoResponseDataSymbolsInnerFiltersInner { + public static final String SERIALIZED_NAME_FILTER_TYPE = "filterType"; + + @SerializedName(SERIALIZED_NAME_FILTER_TYPE) + @jakarta.annotation.Nullable + private String filterType; + + public static final String SERIALIZED_NAME_MIN_PRICE = "minPrice"; + + @SerializedName(SERIALIZED_NAME_MIN_PRICE) + @jakarta.annotation.Nullable + private String minPrice; + + public static final String SERIALIZED_NAME_MAX_PRICE = "maxPrice"; + + @SerializedName(SERIALIZED_NAME_MAX_PRICE) + @jakarta.annotation.Nullable + private String maxPrice; + + public static final String SERIALIZED_NAME_TICK_SIZE = "tickSize"; + + @SerializedName(SERIALIZED_NAME_TICK_SIZE) + @jakarta.annotation.Nullable + private String tickSize; + + public static final String SERIALIZED_NAME_STEP_SIZE = "stepSize"; + + @SerializedName(SERIALIZED_NAME_STEP_SIZE) + @jakarta.annotation.Nullable + private String stepSize; + + public static final String SERIALIZED_NAME_MAX_QTY = "maxQty"; + + @SerializedName(SERIALIZED_NAME_MAX_QTY) + @jakarta.annotation.Nullable + private String maxQty; + + public static final String SERIALIZED_NAME_MIN_QTY = "minQty"; + + @SerializedName(SERIALIZED_NAME_MIN_QTY) + @jakarta.annotation.Nullable + private String minQty; + + public static final String SERIALIZED_NAME_LIMIT = "limit"; + + @SerializedName(SERIALIZED_NAME_LIMIT) + @jakarta.annotation.Nullable + private Long limit; + + public static final String SERIALIZED_NAME_MIN_NOTIONAL = "minNotional"; + + @SerializedName(SERIALIZED_NAME_MIN_NOTIONAL) + @jakarta.annotation.Nullable + private String minNotional; + + public static final String SERIALIZED_NAME_MAX_NOTIONAL = "maxNotional"; + + @SerializedName(SERIALIZED_NAME_MAX_NOTIONAL) + @jakarta.annotation.Nullable + private String maxNotional; + + public static final String SERIALIZED_NAME_MULTIPLIER_DOWN = "multiplierDown"; + + @SerializedName(SERIALIZED_NAME_MULTIPLIER_DOWN) + @jakarta.annotation.Nullable + private String multiplierDown; + + public static final String SERIALIZED_NAME_MULTIPLIER_UP = "multiplierUp"; + + @SerializedName(SERIALIZED_NAME_MULTIPLIER_UP) + @jakarta.annotation.Nullable + private String multiplierUp; + + public static final String SERIALIZED_NAME_BID_MULTIPLIER_UP = "bidMultiplierUp"; + + @SerializedName(SERIALIZED_NAME_BID_MULTIPLIER_UP) + @jakarta.annotation.Nullable + private String bidMultiplierUp; + + public static final String SERIALIZED_NAME_ASK_MULTIPLIER_UP = "askMultiplierUp"; + + @SerializedName(SERIALIZED_NAME_ASK_MULTIPLIER_UP) + @jakarta.annotation.Nullable + private String askMultiplierUp; + + public static final String SERIALIZED_NAME_BID_MULTIPLIER_DOWN = "bidMultiplierDown"; + + @SerializedName(SERIALIZED_NAME_BID_MULTIPLIER_DOWN) + @jakarta.annotation.Nullable + private String bidMultiplierDown; + + public static final String SERIALIZED_NAME_ASK_MULTIPLIER_DOWN = "askMultiplierDown"; + + @SerializedName(SERIALIZED_NAME_ASK_MULTIPLIER_DOWN) + @jakarta.annotation.Nullable + private String askMultiplierDown; + + public GetExchangeInfoResponseDataSymbolsInnerFiltersInner() {} + + public GetExchangeInfoResponseDataSymbolsInnerFiltersInner filterType( + @jakarta.annotation.Nullable String filterType) { + this.filterType = filterType; + return this; + } + + /** + * Get filterType + * + * @return filterType + */ + @jakarta.annotation.Nullable + public String getFilterType() { + return filterType; + } + + public void setFilterType(@jakarta.annotation.Nullable String filterType) { + this.filterType = filterType; + } + + public GetExchangeInfoResponseDataSymbolsInnerFiltersInner minPrice( + @jakarta.annotation.Nullable String minPrice) { + this.minPrice = minPrice; + return this; + } + + /** + * Get minPrice + * + * @return minPrice + */ + @jakarta.annotation.Nullable + public String getMinPrice() { + return minPrice; + } + + public void setMinPrice(@jakarta.annotation.Nullable String minPrice) { + this.minPrice = minPrice; + } + + public GetExchangeInfoResponseDataSymbolsInnerFiltersInner maxPrice( + @jakarta.annotation.Nullable String maxPrice) { + this.maxPrice = maxPrice; + return this; + } + + /** + * Get maxPrice + * + * @return maxPrice + */ + @jakarta.annotation.Nullable + public String getMaxPrice() { + return maxPrice; + } + + public void setMaxPrice(@jakarta.annotation.Nullable String maxPrice) { + this.maxPrice = maxPrice; + } + + public GetExchangeInfoResponseDataSymbolsInnerFiltersInner tickSize( + @jakarta.annotation.Nullable String tickSize) { + this.tickSize = tickSize; + return this; + } + + /** + * Get tickSize + * + * @return tickSize + */ + @jakarta.annotation.Nullable + public String getTickSize() { + return tickSize; + } + + public void setTickSize(@jakarta.annotation.Nullable String tickSize) { + this.tickSize = tickSize; + } + + public GetExchangeInfoResponseDataSymbolsInnerFiltersInner stepSize( + @jakarta.annotation.Nullable String stepSize) { + this.stepSize = stepSize; + return this; + } + + /** + * Get stepSize + * + * @return stepSize + */ + @jakarta.annotation.Nullable + public String getStepSize() { + return stepSize; + } + + public void setStepSize(@jakarta.annotation.Nullable String stepSize) { + this.stepSize = stepSize; + } + + public GetExchangeInfoResponseDataSymbolsInnerFiltersInner maxQty( + @jakarta.annotation.Nullable String maxQty) { + this.maxQty = maxQty; + return this; + } + + /** + * Get maxQty + * + * @return maxQty + */ + @jakarta.annotation.Nullable + public String getMaxQty() { + return maxQty; + } + + public void setMaxQty(@jakarta.annotation.Nullable String maxQty) { + this.maxQty = maxQty; + } + + public GetExchangeInfoResponseDataSymbolsInnerFiltersInner minQty( + @jakarta.annotation.Nullable String minQty) { + this.minQty = minQty; + return this; + } + + /** + * Get minQty + * + * @return minQty + */ + @jakarta.annotation.Nullable + public String getMinQty() { + return minQty; + } + + public void setMinQty(@jakarta.annotation.Nullable String minQty) { + this.minQty = minQty; + } + + public GetExchangeInfoResponseDataSymbolsInnerFiltersInner limit( + @jakarta.annotation.Nullable Long limit) { + this.limit = limit; + return this; + } + + /** + * Get limit + * + * @return limit + */ + @jakarta.annotation.Nullable + public Long getLimit() { + return limit; + } + + public void setLimit(@jakarta.annotation.Nullable Long limit) { + this.limit = limit; + } + + public GetExchangeInfoResponseDataSymbolsInnerFiltersInner minNotional( + @jakarta.annotation.Nullable String minNotional) { + this.minNotional = minNotional; + return this; + } + + /** + * Get minNotional + * + * @return minNotional + */ + @jakarta.annotation.Nullable + public String getMinNotional() { + return minNotional; + } + + public void setMinNotional(@jakarta.annotation.Nullable String minNotional) { + this.minNotional = minNotional; + } + + public GetExchangeInfoResponseDataSymbolsInnerFiltersInner maxNotional( + @jakarta.annotation.Nullable String maxNotional) { + this.maxNotional = maxNotional; + return this; + } + + /** + * Get maxNotional + * + * @return maxNotional + */ + @jakarta.annotation.Nullable + public String getMaxNotional() { + return maxNotional; + } + + public void setMaxNotional(@jakarta.annotation.Nullable String maxNotional) { + this.maxNotional = maxNotional; + } + + public GetExchangeInfoResponseDataSymbolsInnerFiltersInner multiplierDown( + @jakarta.annotation.Nullable String multiplierDown) { + this.multiplierDown = multiplierDown; + return this; + } + + /** + * Get multiplierDown + * + * @return multiplierDown + */ + @jakarta.annotation.Nullable + public String getMultiplierDown() { + return multiplierDown; + } + + public void setMultiplierDown(@jakarta.annotation.Nullable String multiplierDown) { + this.multiplierDown = multiplierDown; + } + + public GetExchangeInfoResponseDataSymbolsInnerFiltersInner multiplierUp( + @jakarta.annotation.Nullable String multiplierUp) { + this.multiplierUp = multiplierUp; + return this; + } + + /** + * Get multiplierUp + * + * @return multiplierUp + */ + @jakarta.annotation.Nullable + public String getMultiplierUp() { + return multiplierUp; + } + + public void setMultiplierUp(@jakarta.annotation.Nullable String multiplierUp) { + this.multiplierUp = multiplierUp; + } + + public GetExchangeInfoResponseDataSymbolsInnerFiltersInner bidMultiplierUp( + @jakarta.annotation.Nullable String bidMultiplierUp) { + this.bidMultiplierUp = bidMultiplierUp; + return this; + } + + /** + * Get bidMultiplierUp + * + * @return bidMultiplierUp + */ + @jakarta.annotation.Nullable + public String getBidMultiplierUp() { + return bidMultiplierUp; + } + + public void setBidMultiplierUp(@jakarta.annotation.Nullable String bidMultiplierUp) { + this.bidMultiplierUp = bidMultiplierUp; + } + + public GetExchangeInfoResponseDataSymbolsInnerFiltersInner askMultiplierUp( + @jakarta.annotation.Nullable String askMultiplierUp) { + this.askMultiplierUp = askMultiplierUp; + return this; + } + + /** + * Get askMultiplierUp + * + * @return askMultiplierUp + */ + @jakarta.annotation.Nullable + public String getAskMultiplierUp() { + return askMultiplierUp; + } + + public void setAskMultiplierUp(@jakarta.annotation.Nullable String askMultiplierUp) { + this.askMultiplierUp = askMultiplierUp; + } + + public GetExchangeInfoResponseDataSymbolsInnerFiltersInner bidMultiplierDown( + @jakarta.annotation.Nullable String bidMultiplierDown) { + this.bidMultiplierDown = bidMultiplierDown; + return this; + } + + /** + * Get bidMultiplierDown + * + * @return bidMultiplierDown + */ + @jakarta.annotation.Nullable + public String getBidMultiplierDown() { + return bidMultiplierDown; + } + + public void setBidMultiplierDown(@jakarta.annotation.Nullable String bidMultiplierDown) { + this.bidMultiplierDown = bidMultiplierDown; + } + + public GetExchangeInfoResponseDataSymbolsInnerFiltersInner askMultiplierDown( + @jakarta.annotation.Nullable String askMultiplierDown) { + this.askMultiplierDown = askMultiplierDown; + return this; + } + + /** + * Get askMultiplierDown + * + * @return askMultiplierDown + */ + @jakarta.annotation.Nullable + public String getAskMultiplierDown() { + return askMultiplierDown; + } + + public void setAskMultiplierDown(@jakarta.annotation.Nullable String askMultiplierDown) { + this.askMultiplierDown = askMultiplierDown; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetExchangeInfoResponseDataSymbolsInnerFiltersInner + getExchangeInfoResponseDataSymbolsInnerFiltersInner = + (GetExchangeInfoResponseDataSymbolsInnerFiltersInner) o; + return Objects.equals( + this.filterType, + getExchangeInfoResponseDataSymbolsInnerFiltersInner.filterType) + && Objects.equals( + this.minPrice, getExchangeInfoResponseDataSymbolsInnerFiltersInner.minPrice) + && Objects.equals( + this.maxPrice, getExchangeInfoResponseDataSymbolsInnerFiltersInner.maxPrice) + && Objects.equals( + this.tickSize, getExchangeInfoResponseDataSymbolsInnerFiltersInner.tickSize) + && Objects.equals( + this.stepSize, getExchangeInfoResponseDataSymbolsInnerFiltersInner.stepSize) + && Objects.equals( + this.maxQty, getExchangeInfoResponseDataSymbolsInnerFiltersInner.maxQty) + && Objects.equals( + this.minQty, getExchangeInfoResponseDataSymbolsInnerFiltersInner.minQty) + && Objects.equals( + this.limit, getExchangeInfoResponseDataSymbolsInnerFiltersInner.limit) + && Objects.equals( + this.minNotional, + getExchangeInfoResponseDataSymbolsInnerFiltersInner.minNotional) + && Objects.equals( + this.maxNotional, + getExchangeInfoResponseDataSymbolsInnerFiltersInner.maxNotional) + && Objects.equals( + this.multiplierDown, + getExchangeInfoResponseDataSymbolsInnerFiltersInner.multiplierDown) + && Objects.equals( + this.multiplierUp, + getExchangeInfoResponseDataSymbolsInnerFiltersInner.multiplierUp) + && Objects.equals( + this.bidMultiplierUp, + getExchangeInfoResponseDataSymbolsInnerFiltersInner.bidMultiplierUp) + && Objects.equals( + this.askMultiplierUp, + getExchangeInfoResponseDataSymbolsInnerFiltersInner.askMultiplierUp) + && Objects.equals( + this.bidMultiplierDown, + getExchangeInfoResponseDataSymbolsInnerFiltersInner.bidMultiplierDown) + && Objects.equals( + this.askMultiplierDown, + getExchangeInfoResponseDataSymbolsInnerFiltersInner.askMultiplierDown); + } + + @Override + public int hashCode() { + return Objects.hash( + filterType, + minPrice, + maxPrice, + tickSize, + stepSize, + maxQty, + minQty, + limit, + minNotional, + maxNotional, + multiplierDown, + multiplierUp, + bidMultiplierUp, + askMultiplierUp, + bidMultiplierDown, + askMultiplierDown); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetExchangeInfoResponseDataSymbolsInnerFiltersInner {\n"); + sb.append(" filterType: ").append(toIndentedString(filterType)).append("\n"); + sb.append(" minPrice: ").append(toIndentedString(minPrice)).append("\n"); + sb.append(" maxPrice: ").append(toIndentedString(maxPrice)).append("\n"); + sb.append(" tickSize: ").append(toIndentedString(tickSize)).append("\n"); + sb.append(" stepSize: ").append(toIndentedString(stepSize)).append("\n"); + sb.append(" maxQty: ").append(toIndentedString(maxQty)).append("\n"); + sb.append(" minQty: ").append(toIndentedString(minQty)).append("\n"); + sb.append(" limit: ").append(toIndentedString(limit)).append("\n"); + sb.append(" minNotional: ").append(toIndentedString(minNotional)).append("\n"); + sb.append(" maxNotional: ").append(toIndentedString(maxNotional)).append("\n"); + sb.append(" multiplierDown: ").append(toIndentedString(multiplierDown)).append("\n"); + sb.append(" multiplierUp: ").append(toIndentedString(multiplierUp)).append("\n"); + sb.append(" bidMultiplierUp: ").append(toIndentedString(bidMultiplierUp)).append("\n"); + sb.append(" askMultiplierUp: ").append(toIndentedString(askMultiplierUp)).append("\n"); + sb.append(" bidMultiplierDown: ").append(toIndentedString(bidMultiplierDown)).append("\n"); + sb.append(" askMultiplierDown: ").append(toIndentedString(askMultiplierDown)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object filterTypeValue = getFilterType(); + String filterTypeValueAsString = ""; + filterTypeValueAsString = filterTypeValue.toString(); + sb.append("filterType=").append(urlEncode(filterTypeValueAsString)).append(""); + Object minPriceValue = getMinPrice(); + String minPriceValueAsString = ""; + minPriceValueAsString = minPriceValue.toString(); + sb.append("minPrice=").append(urlEncode(minPriceValueAsString)).append(""); + Object maxPriceValue = getMaxPrice(); + String maxPriceValueAsString = ""; + maxPriceValueAsString = maxPriceValue.toString(); + sb.append("maxPrice=").append(urlEncode(maxPriceValueAsString)).append(""); + Object tickSizeValue = getTickSize(); + String tickSizeValueAsString = ""; + tickSizeValueAsString = tickSizeValue.toString(); + sb.append("tickSize=").append(urlEncode(tickSizeValueAsString)).append(""); + Object stepSizeValue = getStepSize(); + String stepSizeValueAsString = ""; + stepSizeValueAsString = stepSizeValue.toString(); + sb.append("stepSize=").append(urlEncode(stepSizeValueAsString)).append(""); + Object maxQtyValue = getMaxQty(); + String maxQtyValueAsString = ""; + maxQtyValueAsString = maxQtyValue.toString(); + sb.append("maxQty=").append(urlEncode(maxQtyValueAsString)).append(""); + Object minQtyValue = getMinQty(); + String minQtyValueAsString = ""; + minQtyValueAsString = minQtyValue.toString(); + sb.append("minQty=").append(urlEncode(minQtyValueAsString)).append(""); + Object limitValue = getLimit(); + String limitValueAsString = ""; + limitValueAsString = limitValue.toString(); + sb.append("limit=").append(urlEncode(limitValueAsString)).append(""); + Object minNotionalValue = getMinNotional(); + String minNotionalValueAsString = ""; + minNotionalValueAsString = minNotionalValue.toString(); + sb.append("minNotional=").append(urlEncode(minNotionalValueAsString)).append(""); + Object maxNotionalValue = getMaxNotional(); + String maxNotionalValueAsString = ""; + maxNotionalValueAsString = maxNotionalValue.toString(); + sb.append("maxNotional=").append(urlEncode(maxNotionalValueAsString)).append(""); + Object multiplierDownValue = getMultiplierDown(); + String multiplierDownValueAsString = ""; + multiplierDownValueAsString = multiplierDownValue.toString(); + sb.append("multiplierDown=").append(urlEncode(multiplierDownValueAsString)).append(""); + Object multiplierUpValue = getMultiplierUp(); + String multiplierUpValueAsString = ""; + multiplierUpValueAsString = multiplierUpValue.toString(); + sb.append("multiplierUp=").append(urlEncode(multiplierUpValueAsString)).append(""); + Object bidMultiplierUpValue = getBidMultiplierUp(); + String bidMultiplierUpValueAsString = ""; + bidMultiplierUpValueAsString = bidMultiplierUpValue.toString(); + sb.append("bidMultiplierUp=").append(urlEncode(bidMultiplierUpValueAsString)).append(""); + Object askMultiplierUpValue = getAskMultiplierUp(); + String askMultiplierUpValueAsString = ""; + askMultiplierUpValueAsString = askMultiplierUpValue.toString(); + sb.append("askMultiplierUp=").append(urlEncode(askMultiplierUpValueAsString)).append(""); + Object bidMultiplierDownValue = getBidMultiplierDown(); + String bidMultiplierDownValueAsString = ""; + bidMultiplierDownValueAsString = bidMultiplierDownValue.toString(); + sb.append("bidMultiplierDown=") + .append(urlEncode(bidMultiplierDownValueAsString)) + .append(""); + Object askMultiplierDownValue = getAskMultiplierDown(); + String askMultiplierDownValueAsString = ""; + askMultiplierDownValueAsString = askMultiplierDownValue.toString(); + sb.append("askMultiplierDown=") + .append(urlEncode(askMultiplierDownValueAsString)) + .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("filterType"); + openapiFields.add("minPrice"); + openapiFields.add("maxPrice"); + openapiFields.add("tickSize"); + openapiFields.add("stepSize"); + openapiFields.add("maxQty"); + openapiFields.add("minQty"); + openapiFields.add("limit"); + openapiFields.add("minNotional"); + openapiFields.add("maxNotional"); + openapiFields.add("multiplierDown"); + openapiFields.add("multiplierUp"); + openapiFields.add("bidMultiplierUp"); + openapiFields.add("askMultiplierUp"); + openapiFields.add("bidMultiplierDown"); + openapiFields.add("askMultiplierDown"); + + // 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 + * GetExchangeInfoResponseDataSymbolsInnerFiltersInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetExchangeInfoResponseDataSymbolsInnerFiltersInner.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " GetExchangeInfoResponseDataSymbolsInnerFiltersInner is not" + + " found in the empty JSON string", + GetExchangeInfoResponseDataSymbolsInnerFiltersInner + .openapiRequiredFields + .toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("filterType") != null && !jsonObj.get("filterType").isJsonNull()) + && !jsonObj.get("filterType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `filterType` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("filterType").toString())); + } + if ((jsonObj.get("minPrice") != null && !jsonObj.get("minPrice").isJsonNull()) + && !jsonObj.get("minPrice").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `minPrice` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("minPrice").toString())); + } + if ((jsonObj.get("maxPrice") != null && !jsonObj.get("maxPrice").isJsonNull()) + && !jsonObj.get("maxPrice").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `maxPrice` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("maxPrice").toString())); + } + if ((jsonObj.get("tickSize") != null && !jsonObj.get("tickSize").isJsonNull()) + && !jsonObj.get("tickSize").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `tickSize` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("tickSize").toString())); + } + if ((jsonObj.get("stepSize") != null && !jsonObj.get("stepSize").isJsonNull()) + && !jsonObj.get("stepSize").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `stepSize` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("stepSize").toString())); + } + if ((jsonObj.get("maxQty") != null && !jsonObj.get("maxQty").isJsonNull()) + && !jsonObj.get("maxQty").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `maxQty` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("maxQty").toString())); + } + if ((jsonObj.get("minQty") != null && !jsonObj.get("minQty").isJsonNull()) + && !jsonObj.get("minQty").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `minQty` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("minQty").toString())); + } + if ((jsonObj.get("minNotional") != null && !jsonObj.get("minNotional").isJsonNull()) + && !jsonObj.get("minNotional").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `minNotional` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("minNotional").toString())); + } + if ((jsonObj.get("maxNotional") != null && !jsonObj.get("maxNotional").isJsonNull()) + && !jsonObj.get("maxNotional").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `maxNotional` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("maxNotional").toString())); + } + if ((jsonObj.get("multiplierDown") != null && !jsonObj.get("multiplierDown").isJsonNull()) + && !jsonObj.get("multiplierDown").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `multiplierDown` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("multiplierDown").toString())); + } + if ((jsonObj.get("multiplierUp") != null && !jsonObj.get("multiplierUp").isJsonNull()) + && !jsonObj.get("multiplierUp").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `multiplierUp` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("multiplierUp").toString())); + } + if ((jsonObj.get("bidMultiplierUp") != null && !jsonObj.get("bidMultiplierUp").isJsonNull()) + && !jsonObj.get("bidMultiplierUp").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `bidMultiplierUp` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("bidMultiplierUp").toString())); + } + if ((jsonObj.get("askMultiplierUp") != null && !jsonObj.get("askMultiplierUp").isJsonNull()) + && !jsonObj.get("askMultiplierUp").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `askMultiplierUp` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("askMultiplierUp").toString())); + } + if ((jsonObj.get("bidMultiplierDown") != null + && !jsonObj.get("bidMultiplierDown").isJsonNull()) + && !jsonObj.get("bidMultiplierDown").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `bidMultiplierDown` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("bidMultiplierDown").toString())); + } + if ((jsonObj.get("askMultiplierDown") != null + && !jsonObj.get("askMultiplierDown").isJsonNull()) + && !jsonObj.get("askMultiplierDown").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `askMultiplierDown` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("askMultiplierDown").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetExchangeInfoResponseDataSymbolsInnerFiltersInner.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'GetExchangeInfoResponseDataSymbolsInnerFiltersInner' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, + TypeToken.get( + GetExchangeInfoResponseDataSymbolsInnerFiltersInner.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, + GetExchangeInfoResponseDataSymbolsInnerFiltersInner value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetExchangeInfoResponseDataSymbolsInnerFiltersInner read( + JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetExchangeInfoResponseDataSymbolsInnerFiltersInner given an JSON + * string + * + * @param jsonString JSON string + * @return An instance of GetExchangeInfoResponseDataSymbolsInnerFiltersInner + * @throws IOException if the JSON string is invalid with respect to + * GetExchangeInfoResponseDataSymbolsInnerFiltersInner + */ + public static GetExchangeInfoResponseDataSymbolsInnerFiltersInner fromJson(String jsonString) + throws IOException { + return JSON.getGson() + .fromJson(jsonString, GetExchangeInfoResponseDataSymbolsInnerFiltersInner.class); + } + + /** + * Convert an instance of GetExchangeInfoResponseDataSymbolsInnerFiltersInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/alpha/src/main/java/com/binance/connector/client/alpha/rest/model/KlinesResponse.java b/clients/alpha/src/main/java/com/binance/connector/client/alpha/rest/model/KlinesResponse.java new file mode 100644 index 000000000..a8e214543 --- /dev/null +++ b/clients/alpha/src/main/java/com/binance/connector/client/alpha/rest/model/KlinesResponse.java @@ -0,0 +1,380 @@ +/* + * Binance Alpha REST API + * OpenAPI Specification for the Binance Alpha REST API + * + * 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.alpha.rest.model; + +import com.binance.connector.client.alpha.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.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; +import org.hibernate.validator.constraints.*; + +/** KlinesResponse */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.12.0") +public class KlinesResponse { + public static final String SERIALIZED_NAME_CODE = "code"; + + @SerializedName(SERIALIZED_NAME_CODE) + @jakarta.annotation.Nullable + private String code; + + public static final String SERIALIZED_NAME_MESSAGE = "message"; + + @SerializedName(SERIALIZED_NAME_MESSAGE) + @jakarta.annotation.Nullable + private String message; + + public static final String SERIALIZED_NAME_MESSAGE_DETAIL = "messageDetail"; + + @SerializedName(SERIALIZED_NAME_MESSAGE_DETAIL) + @jakarta.annotation.Nullable + private String messageDetail; + + public static final String SERIALIZED_NAME_SUCCESS = "success"; + + @SerializedName(SERIALIZED_NAME_SUCCESS) + @jakarta.annotation.Nullable + private Boolean success; + + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + @jakarta.annotation.Nullable + private List data; + + public KlinesResponse() {} + + public KlinesResponse 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 KlinesResponse message(@jakarta.annotation.Nullable String message) { + this.message = message; + return this; + } + + /** + * Get message + * + * @return message + */ + @jakarta.annotation.Nullable + public String getMessage() { + return message; + } + + public void setMessage(@jakarta.annotation.Nullable String message) { + this.message = message; + } + + public KlinesResponse messageDetail(@jakarta.annotation.Nullable String messageDetail) { + this.messageDetail = messageDetail; + return this; + } + + /** + * Get messageDetail + * + * @return messageDetail + */ + @jakarta.annotation.Nullable + public String getMessageDetail() { + return messageDetail; + } + + public void setMessageDetail(@jakarta.annotation.Nullable String messageDetail) { + this.messageDetail = messageDetail; + } + + public KlinesResponse success(@jakarta.annotation.Nullable Boolean success) { + this.success = success; + return this; + } + + /** + * Get success + * + * @return success + */ + @jakarta.annotation.Nullable + public Boolean getSuccess() { + return success; + } + + public void setSuccess(@jakarta.annotation.Nullable Boolean success) { + this.success = success; + } + + public KlinesResponse data(@jakarta.annotation.Nullable List data) { + this.data = data; + return this; + } + + public KlinesResponse addDataItem(KlinesResponseDataItem dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } + this.data.add(dataItem); + return this; + } + + /** + * Get data + * + * @return data + */ + @jakarta.annotation.Nullable + @Valid + public List getData() { + return data; + } + + public void setData(@jakarta.annotation.Nullable List data) { + this.data = data; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + KlinesResponse klinesResponse = (KlinesResponse) o; + return Objects.equals(this.code, klinesResponse.code) + && Objects.equals(this.message, klinesResponse.message) + && Objects.equals(this.messageDetail, klinesResponse.messageDetail) + && Objects.equals(this.success, klinesResponse.success) + && Objects.equals(this.data, klinesResponse.data); + } + + @Override + public int hashCode() { + return Objects.hash(code, message, messageDetail, success, data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class KlinesResponse {\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" messageDetail: ").append(toIndentedString(messageDetail)).append("\n"); + sb.append(" success: ").append(toIndentedString(success)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).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 messageValue = getMessage(); + String messageValueAsString = ""; + messageValueAsString = messageValue.toString(); + sb.append("message=").append(urlEncode(messageValueAsString)).append(""); + Object messageDetailValue = getMessageDetail(); + String messageDetailValueAsString = ""; + messageDetailValueAsString = messageDetailValue.toString(); + sb.append("messageDetail=").append(urlEncode(messageDetailValueAsString)).append(""); + Object successValue = getSuccess(); + String successValueAsString = ""; + successValueAsString = successValue.toString(); + sb.append("success=").append(urlEncode(successValueAsString)).append(""); + Object dataValue = getData(); + String dataValueAsString = ""; + dataValueAsString = + (String) + ((Collection) dataValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("data=").append(urlEncode(dataValueAsString)).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("message"); + openapiFields.add("messageDetail"); + openapiFields.add("success"); + openapiFields.add("data"); + + // 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 KlinesResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!KlinesResponse.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in KlinesResponse is not found in the" + + " empty JSON string", + KlinesResponse.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("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())); + } + if ((jsonObj.get("messageDetail") != null && !jsonObj.get("messageDetail").isJsonNull()) + && !jsonObj.get("messageDetail").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `messageDetail` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("messageDetail").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("data") != null + && !jsonObj.get("data").isJsonNull() + && !jsonObj.get("data").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `data` to be an array in the JSON string but got" + + " `%s`", + jsonObj.get("data").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!KlinesResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'KlinesResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(KlinesResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, KlinesResponse value) throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public KlinesResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of KlinesResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of KlinesResponse + * @throws IOException if the JSON string is invalid with respect to KlinesResponse + */ + public static KlinesResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, KlinesResponse.class); + } + + /** + * Convert an instance of KlinesResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/alpha/src/main/java/com/binance/connector/client/alpha/rest/model/KlinesResponseDataItem.java b/clients/alpha/src/main/java/com/binance/connector/client/alpha/rest/model/KlinesResponseDataItem.java new file mode 100644 index 000000000..df24fb813 --- /dev/null +++ b/clients/alpha/src/main/java/com/binance/connector/client/alpha/rest/model/KlinesResponseDataItem.java @@ -0,0 +1,182 @@ +/* + * Binance Alpha REST API + * OpenAPI Specification for the Binance Alpha REST API + * + * 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.alpha.rest.model; + +import com.binance.connector.client.alpha.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +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.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** KlinesResponseDataItem */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.12.0") +public class KlinesResponseDataItem extends ArrayList { + public KlinesResponseDataItem() {} + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class KlinesResponseDataItem {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + 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(); + + // 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 KlinesResponseDataItem + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (!jsonElement.isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected json element to be a array type in the JSON string but got" + + " `%s`", + jsonElement.toString())); + } + JsonArray array = jsonElement.getAsJsonArray(); + // validate array items + for (JsonElement element : array) { + KlinesResponseDataItemInner.validateJsonElement(element); + } + if (jsonElement == null) { + if (!KlinesResponseDataItem.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in KlinesResponseDataItem is not found in" + + " the empty JSON string", + KlinesResponseDataItem.openapiRequiredFields.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!KlinesResponseDataItem.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'KlinesResponseDataItem' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(KlinesResponseDataItem.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, KlinesResponseDataItem value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonArray(); + elementAdapter.write(out, obj); + } + + @Override + public KlinesResponseDataItem read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of KlinesResponseDataItem given an JSON string + * + * @param jsonString JSON string + * @return An instance of KlinesResponseDataItem + * @throws IOException if the JSON string is invalid with respect to KlinesResponseDataItem + */ + public static KlinesResponseDataItem fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, KlinesResponseDataItem.class); + } + + /** + * Convert an instance of KlinesResponseDataItem to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/alpha/src/main/java/com/binance/connector/client/alpha/rest/model/KlinesResponseDataItemInner.java b/clients/alpha/src/main/java/com/binance/connector/client/alpha/rest/model/KlinesResponseDataItemInner.java new file mode 100644 index 000000000..0a6e60717 --- /dev/null +++ b/clients/alpha/src/main/java/com/binance/connector/client/alpha/rest/model/KlinesResponseDataItemInner.java @@ -0,0 +1,306 @@ +/* + * Binance Alpha REST API + * OpenAPI Specification for the Binance Alpha REST API + * + * 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.alpha.rest.model; + +import com.binance.connector.client.alpha.rest.JSON; +import com.binance.connector.client.common.AbstractOpenApiSchema; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonPrimitive; +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.12.0") +public class KlinesResponseDataItemInner extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(KlinesResponseDataItemInner.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!KlinesResponseDataItemInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'KlinesResponseDataItemInner' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterString = + gson.getDelegateAdapter(this, TypeToken.get(String.class)); + final TypeAdapter adapterLong = + gson.getDelegateAdapter(this, TypeToken.get(Long.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, KlinesResponseDataItemInner value) + throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `String` + if (value.getActualInstance() instanceof String) { + JsonPrimitive primitive = + adapterString + .toJsonTree((String) value.getActualInstance()) + .getAsJsonPrimitive(); + elementAdapter.write(out, primitive); + return; + } + // check if the actual instance is of the type `Long` + if (value.getActualInstance() instanceof Long) { + JsonPrimitive primitive = + adapterLong + .toJsonTree((Long) value.getActualInstance()) + .getAsJsonPrimitive(); + elementAdapter.write(out, primitive); + return; + } + throw new IOException( + "Failed to serialize as the type doesn't match oneOf schemas:" + + " Long, String"); + } + + @Override + public KlinesResponseDataItemInner read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize String + try { + // validate the JSON object to see if any exception is thrown + if (!jsonElement.getAsJsonPrimitive().isString()) { + throw new IllegalArgumentException( + String.format( + "Expected json element to be of type String in" + + " the JSON string but got `%s`", + jsonElement.toString())); + } + actualAdapter = adapterString; + match++; + log.log(Level.FINER, "Input data matches schema 'String'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add( + String.format( + "Deserialization for String failed with `%s`.", + e.getMessage())); + log.log( + Level.FINER, + "Input data does not match schema 'String'", + e); + } + // deserialize Long + try { + // validate the JSON object to see if any exception is thrown + if (!jsonElement.getAsJsonPrimitive().isNumber()) { + throw new IllegalArgumentException( + String.format( + "Expected json element to be of type Number in" + + " the JSON string but got `%s`", + jsonElement.toString())); + } + actualAdapter = adapterLong; + match++; + log.log(Level.FINER, "Input data matches schema 'Long'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add( + String.format( + "Deserialization for Long failed with `%s`.", + e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'Long'", e); + } + + if (match == 1) { + KlinesResponseDataItemInner ret = new KlinesResponseDataItemInner(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException( + String.format( + "Failed deserialization for" + + " KlinesResponseDataItemInner: %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 KlinesResponseDataItemInner() { + super("oneOf", Boolean.FALSE); + } + + public KlinesResponseDataItemInner(Object o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("String", String.class); + schemas.put("Long", Long.class); + } + + @Override + public Map> getSchemas() { + return KlinesResponseDataItemInner.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: Long, String + * + *

It could be an instance of the 'oneOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof String) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof Long) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Long, String"); + } + + /** + * Get the actual instance, which can be the following: Long, String + * + * @return The actual instance (Long, String) + */ + @SuppressWarnings("unchecked") + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `String`. If the actual instance is not `String`, the + * ClassCastException will be thrown. + * + * @return The actual instance of `String` + * @throws ClassCastException if the instance is not `String` + */ + public String getString() throws ClassCastException { + return (String) super.getActualInstance(); + } + + /** + * Get the actual instance of `Long`. If the actual instance is not `Long`, the + * ClassCastException will be thrown. + * + * @return The actual instance of `Long` + * @throws ClassCastException if the instance is not `Long` + */ + public Long getLong() throws ClassCastException { + return (Long) 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 + * KlinesResponseDataItemInner + */ + 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 String + try { + if (!jsonElement.getAsJsonPrimitive().isString()) { + throw new IllegalArgumentException( + String.format( + "Expected json element to be of type String in the JSON string but" + + " got `%s`", + jsonElement.toString())); + } + validCount++; + } catch (Exception e) { + errorMessages.add( + String.format("Deserialization for String failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with Long + try { + if (!jsonElement.getAsJsonPrimitive().isNumber()) { + throw new IllegalArgumentException( + String.format( + "Expected json element to be of type Number in the JSON string but" + + " got `%s`", + jsonElement.toString())); + } + validCount++; + } catch (Exception e) { + errorMessages.add( + String.format("Deserialization for Long failed with `%s`.", e.getMessage())); + // continue to the next one + } + if (validCount != 1) { + throw new IOException( + String.format( + "The JSON string is invalid for KlinesResponseDataItemInner with oneOf" + + " schemas: Long, String. %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 KlinesResponseDataItemInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of KlinesResponseDataItemInner + * @throws IOException if the JSON string is invalid with respect to KlinesResponseDataItemInner + */ + public static KlinesResponseDataItemInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, KlinesResponseDataItemInner.class); + } + + /** + * Convert an instance of KlinesResponseDataItemInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/alpha/src/main/java/com/binance/connector/client/alpha/rest/model/TickerResponse.java b/clients/alpha/src/main/java/com/binance/connector/client/alpha/rest/model/TickerResponse.java new file mode 100644 index 000000000..1b4c22b21 --- /dev/null +++ b/clients/alpha/src/main/java/com/binance/connector/client/alpha/rest/model/TickerResponse.java @@ -0,0 +1,359 @@ +/* + * Binance Alpha REST API + * OpenAPI Specification for the Binance Alpha REST API + * + * 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.alpha.rest.model; + +import com.binance.connector.client.alpha.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.*; + +/** TickerResponse */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.12.0") +public class TickerResponse { + public static final String SERIALIZED_NAME_CODE = "code"; + + @SerializedName(SERIALIZED_NAME_CODE) + @jakarta.annotation.Nullable + private String code; + + public static final String SERIALIZED_NAME_MESSAGE = "message"; + + @SerializedName(SERIALIZED_NAME_MESSAGE) + @jakarta.annotation.Nullable + private String message; + + public static final String SERIALIZED_NAME_MESSAGE_DETAIL = "messageDetail"; + + @SerializedName(SERIALIZED_NAME_MESSAGE_DETAIL) + @jakarta.annotation.Nullable + private String messageDetail; + + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + @jakarta.annotation.Nullable + private TickerResponseData data; + + public static final String SERIALIZED_NAME_SUCCESS = "success"; + + @SerializedName(SERIALIZED_NAME_SUCCESS) + @jakarta.annotation.Nullable + private Boolean success; + + public TickerResponse() {} + + public TickerResponse 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 TickerResponse message(@jakarta.annotation.Nullable String message) { + this.message = message; + return this; + } + + /** + * Get message + * + * @return message + */ + @jakarta.annotation.Nullable + public String getMessage() { + return message; + } + + public void setMessage(@jakarta.annotation.Nullable String message) { + this.message = message; + } + + public TickerResponse messageDetail(@jakarta.annotation.Nullable String messageDetail) { + this.messageDetail = messageDetail; + return this; + } + + /** + * Get messageDetail + * + * @return messageDetail + */ + @jakarta.annotation.Nullable + public String getMessageDetail() { + return messageDetail; + } + + public void setMessageDetail(@jakarta.annotation.Nullable String messageDetail) { + this.messageDetail = messageDetail; + } + + public TickerResponse data(@jakarta.annotation.Nullable TickerResponseData data) { + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @jakarta.annotation.Nullable + @Valid + public TickerResponseData getData() { + return data; + } + + public void setData(@jakarta.annotation.Nullable TickerResponseData data) { + this.data = data; + } + + public TickerResponse success(@jakarta.annotation.Nullable Boolean success) { + this.success = success; + return this; + } + + /** + * Get success + * + * @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; + } + TickerResponse tickerResponse = (TickerResponse) o; + return Objects.equals(this.code, tickerResponse.code) + && Objects.equals(this.message, tickerResponse.message) + && Objects.equals(this.messageDetail, tickerResponse.messageDetail) + && Objects.equals(this.data, tickerResponse.data) + && Objects.equals(this.success, tickerResponse.success); + } + + @Override + public int hashCode() { + return Objects.hash(code, message, messageDetail, data, success); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TickerResponse {\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" messageDetail: ").append(toIndentedString(messageDetail)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).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 messageValue = getMessage(); + String messageValueAsString = ""; + messageValueAsString = messageValue.toString(); + sb.append("message=").append(urlEncode(messageValueAsString)).append(""); + Object messageDetailValue = getMessageDetail(); + String messageDetailValueAsString = ""; + messageDetailValueAsString = messageDetailValue.toString(); + sb.append("messageDetail=").append(urlEncode(messageDetailValueAsString)).append(""); + Object dataValue = getData(); + String dataValueAsString = ""; + dataValueAsString = dataValue.toString(); + sb.append("data=").append(urlEncode(dataValueAsString)).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("message"); + openapiFields.add("messageDetail"); + openapiFields.add("data"); + 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 TickerResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TickerResponse.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in TickerResponse is not found in the" + + " empty JSON string", + TickerResponse.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("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())); + } + if ((jsonObj.get("messageDetail") != null && !jsonObj.get("messageDetail").isJsonNull()) + && !jsonObj.get("messageDetail").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `messageDetail` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("messageDetail").toString())); + } + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + TickerResponseData.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TickerResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TickerResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(TickerResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, TickerResponse value) throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public TickerResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of TickerResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of TickerResponse + * @throws IOException if the JSON string is invalid with respect to TickerResponse + */ + public static TickerResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TickerResponse.class); + } + + /** + * Convert an instance of TickerResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/alpha/src/main/java/com/binance/connector/client/alpha/rest/model/TickerResponseData.java b/clients/alpha/src/main/java/com/binance/connector/client/alpha/rest/model/TickerResponseData.java new file mode 100644 index 000000000..51263c06d --- /dev/null +++ b/clients/alpha/src/main/java/com/binance/connector/client/alpha/rest/model/TickerResponseData.java @@ -0,0 +1,794 @@ +/* + * Binance Alpha REST API + * OpenAPI Specification for the Binance Alpha REST API + * + * 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.alpha.rest.model; + +import com.binance.connector.client.alpha.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.*; + +/** TickerResponseData */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.12.0") +public class TickerResponseData { + public static final String SERIALIZED_NAME_SYMBOL = "symbol"; + + @SerializedName(SERIALIZED_NAME_SYMBOL) + @jakarta.annotation.Nullable + private String symbol; + + public static final String SERIALIZED_NAME_PRICE_CHANGE = "priceChange"; + + @SerializedName(SERIALIZED_NAME_PRICE_CHANGE) + @jakarta.annotation.Nullable + private String priceChange; + + public static final String SERIALIZED_NAME_PRICE_CHANGE_PERCENT = "priceChangePercent"; + + @SerializedName(SERIALIZED_NAME_PRICE_CHANGE_PERCENT) + @jakarta.annotation.Nullable + private String priceChangePercent; + + public static final String SERIALIZED_NAME_WEIGHTED_AVG_PRICE = "weightedAvgPrice"; + + @SerializedName(SERIALIZED_NAME_WEIGHTED_AVG_PRICE) + @jakarta.annotation.Nullable + private String weightedAvgPrice; + + public static final String SERIALIZED_NAME_LAST_PRICE = "lastPrice"; + + @SerializedName(SERIALIZED_NAME_LAST_PRICE) + @jakarta.annotation.Nullable + private String lastPrice; + + public static final String SERIALIZED_NAME_LAST_QTY = "lastQty"; + + @SerializedName(SERIALIZED_NAME_LAST_QTY) + @jakarta.annotation.Nullable + private String lastQty; + + public static final String SERIALIZED_NAME_OPEN_PRICE = "openPrice"; + + @SerializedName(SERIALIZED_NAME_OPEN_PRICE) + @jakarta.annotation.Nullable + private String openPrice; + + public static final String SERIALIZED_NAME_HIGH_PRICE = "highPrice"; + + @SerializedName(SERIALIZED_NAME_HIGH_PRICE) + @jakarta.annotation.Nullable + private String highPrice; + + public static final String SERIALIZED_NAME_LOW_PRICE = "lowPrice"; + + @SerializedName(SERIALIZED_NAME_LOW_PRICE) + @jakarta.annotation.Nullable + private String lowPrice; + + public static final String SERIALIZED_NAME_VOLUME = "volume"; + + @SerializedName(SERIALIZED_NAME_VOLUME) + @jakarta.annotation.Nullable + private String volume; + + public static final String SERIALIZED_NAME_QUOTE_VOLUME = "quoteVolume"; + + @SerializedName(SERIALIZED_NAME_QUOTE_VOLUME) + @jakarta.annotation.Nullable + private String quoteVolume; + + public static final String SERIALIZED_NAME_OPEN_TIME = "openTime"; + + @SerializedName(SERIALIZED_NAME_OPEN_TIME) + @jakarta.annotation.Nullable + private Long openTime; + + public static final String SERIALIZED_NAME_CLOSE_TIME = "closeTime"; + + @SerializedName(SERIALIZED_NAME_CLOSE_TIME) + @jakarta.annotation.Nullable + private Long closeTime; + + public static final String SERIALIZED_NAME_FIRST_ID = "firstId"; + + @SerializedName(SERIALIZED_NAME_FIRST_ID) + @jakarta.annotation.Nullable + private Long firstId; + + public static final String SERIALIZED_NAME_LAST_ID = "lastId"; + + @SerializedName(SERIALIZED_NAME_LAST_ID) + @jakarta.annotation.Nullable + private Long lastId; + + public static final String SERIALIZED_NAME_COUNT = "count"; + + @SerializedName(SERIALIZED_NAME_COUNT) + @jakarta.annotation.Nullable + private Long count; + + public TickerResponseData() {} + + public TickerResponseData symbol(@jakarta.annotation.Nullable String symbol) { + this.symbol = symbol; + return this; + } + + /** + * Get symbol + * + * @return symbol + */ + @jakarta.annotation.Nullable + public String getSymbol() { + return symbol; + } + + public void setSymbol(@jakarta.annotation.Nullable String symbol) { + this.symbol = symbol; + } + + public TickerResponseData priceChange(@jakarta.annotation.Nullable String priceChange) { + this.priceChange = priceChange; + return this; + } + + /** + * Get priceChange + * + * @return priceChange + */ + @jakarta.annotation.Nullable + public String getPriceChange() { + return priceChange; + } + + public void setPriceChange(@jakarta.annotation.Nullable String priceChange) { + this.priceChange = priceChange; + } + + public TickerResponseData priceChangePercent( + @jakarta.annotation.Nullable String priceChangePercent) { + this.priceChangePercent = priceChangePercent; + return this; + } + + /** + * Get priceChangePercent + * + * @return priceChangePercent + */ + @jakarta.annotation.Nullable + public String getPriceChangePercent() { + return priceChangePercent; + } + + public void setPriceChangePercent(@jakarta.annotation.Nullable String priceChangePercent) { + this.priceChangePercent = priceChangePercent; + } + + public TickerResponseData weightedAvgPrice( + @jakarta.annotation.Nullable String weightedAvgPrice) { + this.weightedAvgPrice = weightedAvgPrice; + return this; + } + + /** + * Get weightedAvgPrice + * + * @return weightedAvgPrice + */ + @jakarta.annotation.Nullable + public String getWeightedAvgPrice() { + return weightedAvgPrice; + } + + public void setWeightedAvgPrice(@jakarta.annotation.Nullable String weightedAvgPrice) { + this.weightedAvgPrice = weightedAvgPrice; + } + + public TickerResponseData lastPrice(@jakarta.annotation.Nullable String lastPrice) { + this.lastPrice = lastPrice; + return this; + } + + /** + * Get lastPrice + * + * @return lastPrice + */ + @jakarta.annotation.Nullable + public String getLastPrice() { + return lastPrice; + } + + public void setLastPrice(@jakarta.annotation.Nullable String lastPrice) { + this.lastPrice = lastPrice; + } + + public TickerResponseData lastQty(@jakarta.annotation.Nullable String lastQty) { + this.lastQty = lastQty; + return this; + } + + /** + * Get lastQty + * + * @return lastQty + */ + @jakarta.annotation.Nullable + public String getLastQty() { + return lastQty; + } + + public void setLastQty(@jakarta.annotation.Nullable String lastQty) { + this.lastQty = lastQty; + } + + public TickerResponseData openPrice(@jakarta.annotation.Nullable String openPrice) { + this.openPrice = openPrice; + return this; + } + + /** + * Get openPrice + * + * @return openPrice + */ + @jakarta.annotation.Nullable + public String getOpenPrice() { + return openPrice; + } + + public void setOpenPrice(@jakarta.annotation.Nullable String openPrice) { + this.openPrice = openPrice; + } + + public TickerResponseData highPrice(@jakarta.annotation.Nullable String highPrice) { + this.highPrice = highPrice; + return this; + } + + /** + * Get highPrice + * + * @return highPrice + */ + @jakarta.annotation.Nullable + public String getHighPrice() { + return highPrice; + } + + public void setHighPrice(@jakarta.annotation.Nullable String highPrice) { + this.highPrice = highPrice; + } + + public TickerResponseData lowPrice(@jakarta.annotation.Nullable String lowPrice) { + this.lowPrice = lowPrice; + return this; + } + + /** + * Get lowPrice + * + * @return lowPrice + */ + @jakarta.annotation.Nullable + public String getLowPrice() { + return lowPrice; + } + + public void setLowPrice(@jakarta.annotation.Nullable String lowPrice) { + this.lowPrice = lowPrice; + } + + public TickerResponseData volume(@jakarta.annotation.Nullable String volume) { + this.volume = volume; + return this; + } + + /** + * Get volume + * + * @return volume + */ + @jakarta.annotation.Nullable + public String getVolume() { + return volume; + } + + public void setVolume(@jakarta.annotation.Nullable String volume) { + this.volume = volume; + } + + public TickerResponseData quoteVolume(@jakarta.annotation.Nullable String quoteVolume) { + this.quoteVolume = quoteVolume; + return this; + } + + /** + * Get quoteVolume + * + * @return quoteVolume + */ + @jakarta.annotation.Nullable + public String getQuoteVolume() { + return quoteVolume; + } + + public void setQuoteVolume(@jakarta.annotation.Nullable String quoteVolume) { + this.quoteVolume = quoteVolume; + } + + public TickerResponseData openTime(@jakarta.annotation.Nullable Long openTime) { + this.openTime = openTime; + return this; + } + + /** + * Get openTime + * + * @return openTime + */ + @jakarta.annotation.Nullable + public Long getOpenTime() { + return openTime; + } + + public void setOpenTime(@jakarta.annotation.Nullable Long openTime) { + this.openTime = openTime; + } + + public TickerResponseData closeTime(@jakarta.annotation.Nullable Long closeTime) { + this.closeTime = closeTime; + return this; + } + + /** + * Get closeTime + * + * @return closeTime + */ + @jakarta.annotation.Nullable + public Long getCloseTime() { + return closeTime; + } + + public void setCloseTime(@jakarta.annotation.Nullable Long closeTime) { + this.closeTime = closeTime; + } + + public TickerResponseData firstId(@jakarta.annotation.Nullable Long firstId) { + this.firstId = firstId; + return this; + } + + /** + * Get firstId + * + * @return firstId + */ + @jakarta.annotation.Nullable + public Long getFirstId() { + return firstId; + } + + public void setFirstId(@jakarta.annotation.Nullable Long firstId) { + this.firstId = firstId; + } + + public TickerResponseData lastId(@jakarta.annotation.Nullable Long lastId) { + this.lastId = lastId; + return this; + } + + /** + * Get lastId + * + * @return lastId + */ + @jakarta.annotation.Nullable + public Long getLastId() { + return lastId; + } + + public void setLastId(@jakarta.annotation.Nullable Long lastId) { + this.lastId = lastId; + } + + public TickerResponseData count(@jakarta.annotation.Nullable Long count) { + this.count = count; + return this; + } + + /** + * Get count + * + * @return count + */ + @jakarta.annotation.Nullable + public Long getCount() { + return count; + } + + public void setCount(@jakarta.annotation.Nullable Long count) { + this.count = count; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TickerResponseData tickerResponseData = (TickerResponseData) o; + return Objects.equals(this.symbol, tickerResponseData.symbol) + && Objects.equals(this.priceChange, tickerResponseData.priceChange) + && Objects.equals(this.priceChangePercent, tickerResponseData.priceChangePercent) + && Objects.equals(this.weightedAvgPrice, tickerResponseData.weightedAvgPrice) + && Objects.equals(this.lastPrice, tickerResponseData.lastPrice) + && Objects.equals(this.lastQty, tickerResponseData.lastQty) + && Objects.equals(this.openPrice, tickerResponseData.openPrice) + && Objects.equals(this.highPrice, tickerResponseData.highPrice) + && Objects.equals(this.lowPrice, tickerResponseData.lowPrice) + && Objects.equals(this.volume, tickerResponseData.volume) + && Objects.equals(this.quoteVolume, tickerResponseData.quoteVolume) + && Objects.equals(this.openTime, tickerResponseData.openTime) + && Objects.equals(this.closeTime, tickerResponseData.closeTime) + && Objects.equals(this.firstId, tickerResponseData.firstId) + && Objects.equals(this.lastId, tickerResponseData.lastId) + && Objects.equals(this.count, tickerResponseData.count); + } + + @Override + public int hashCode() { + return Objects.hash( + symbol, + priceChange, + priceChangePercent, + weightedAvgPrice, + lastPrice, + lastQty, + openPrice, + highPrice, + lowPrice, + volume, + quoteVolume, + openTime, + closeTime, + firstId, + lastId, + count); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TickerResponseData {\n"); + sb.append(" symbol: ").append(toIndentedString(symbol)).append("\n"); + sb.append(" priceChange: ").append(toIndentedString(priceChange)).append("\n"); + sb.append(" priceChangePercent: ") + .append(toIndentedString(priceChangePercent)) + .append("\n"); + sb.append(" weightedAvgPrice: ").append(toIndentedString(weightedAvgPrice)).append("\n"); + sb.append(" lastPrice: ").append(toIndentedString(lastPrice)).append("\n"); + sb.append(" lastQty: ").append(toIndentedString(lastQty)).append("\n"); + sb.append(" openPrice: ").append(toIndentedString(openPrice)).append("\n"); + sb.append(" highPrice: ").append(toIndentedString(highPrice)).append("\n"); + sb.append(" lowPrice: ").append(toIndentedString(lowPrice)).append("\n"); + sb.append(" volume: ").append(toIndentedString(volume)).append("\n"); + sb.append(" quoteVolume: ").append(toIndentedString(quoteVolume)).append("\n"); + sb.append(" openTime: ").append(toIndentedString(openTime)).append("\n"); + sb.append(" closeTime: ").append(toIndentedString(closeTime)).append("\n"); + sb.append(" firstId: ").append(toIndentedString(firstId)).append("\n"); + sb.append(" lastId: ").append(toIndentedString(lastId)).append("\n"); + sb.append(" count: ").append(toIndentedString(count)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object symbolValue = getSymbol(); + String symbolValueAsString = ""; + symbolValueAsString = symbolValue.toString(); + sb.append("symbol=").append(urlEncode(symbolValueAsString)).append(""); + Object priceChangeValue = getPriceChange(); + String priceChangeValueAsString = ""; + priceChangeValueAsString = priceChangeValue.toString(); + sb.append("priceChange=").append(urlEncode(priceChangeValueAsString)).append(""); + Object priceChangePercentValue = getPriceChangePercent(); + String priceChangePercentValueAsString = ""; + priceChangePercentValueAsString = priceChangePercentValue.toString(); + sb.append("priceChangePercent=") + .append(urlEncode(priceChangePercentValueAsString)) + .append(""); + Object weightedAvgPriceValue = getWeightedAvgPrice(); + String weightedAvgPriceValueAsString = ""; + weightedAvgPriceValueAsString = weightedAvgPriceValue.toString(); + sb.append("weightedAvgPrice=").append(urlEncode(weightedAvgPriceValueAsString)).append(""); + Object lastPriceValue = getLastPrice(); + String lastPriceValueAsString = ""; + lastPriceValueAsString = lastPriceValue.toString(); + sb.append("lastPrice=").append(urlEncode(lastPriceValueAsString)).append(""); + Object lastQtyValue = getLastQty(); + String lastQtyValueAsString = ""; + lastQtyValueAsString = lastQtyValue.toString(); + sb.append("lastQty=").append(urlEncode(lastQtyValueAsString)).append(""); + Object openPriceValue = getOpenPrice(); + String openPriceValueAsString = ""; + openPriceValueAsString = openPriceValue.toString(); + sb.append("openPrice=").append(urlEncode(openPriceValueAsString)).append(""); + Object highPriceValue = getHighPrice(); + String highPriceValueAsString = ""; + highPriceValueAsString = highPriceValue.toString(); + sb.append("highPrice=").append(urlEncode(highPriceValueAsString)).append(""); + Object lowPriceValue = getLowPrice(); + String lowPriceValueAsString = ""; + lowPriceValueAsString = lowPriceValue.toString(); + sb.append("lowPrice=").append(urlEncode(lowPriceValueAsString)).append(""); + Object volumeValue = getVolume(); + String volumeValueAsString = ""; + volumeValueAsString = volumeValue.toString(); + sb.append("volume=").append(urlEncode(volumeValueAsString)).append(""); + Object quoteVolumeValue = getQuoteVolume(); + String quoteVolumeValueAsString = ""; + quoteVolumeValueAsString = quoteVolumeValue.toString(); + sb.append("quoteVolume=").append(urlEncode(quoteVolumeValueAsString)).append(""); + Object openTimeValue = getOpenTime(); + String openTimeValueAsString = ""; + openTimeValueAsString = openTimeValue.toString(); + sb.append("openTime=").append(urlEncode(openTimeValueAsString)).append(""); + Object closeTimeValue = getCloseTime(); + String closeTimeValueAsString = ""; + closeTimeValueAsString = closeTimeValue.toString(); + sb.append("closeTime=").append(urlEncode(closeTimeValueAsString)).append(""); + Object firstIdValue = getFirstId(); + String firstIdValueAsString = ""; + firstIdValueAsString = firstIdValue.toString(); + sb.append("firstId=").append(urlEncode(firstIdValueAsString)).append(""); + Object lastIdValue = getLastId(); + String lastIdValueAsString = ""; + lastIdValueAsString = lastIdValue.toString(); + sb.append("lastId=").append(urlEncode(lastIdValueAsString)).append(""); + Object countValue = getCount(); + String countValueAsString = ""; + countValueAsString = countValue.toString(); + sb.append("count=").append(urlEncode(countValueAsString)).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("symbol"); + openapiFields.add("priceChange"); + openapiFields.add("priceChangePercent"); + openapiFields.add("weightedAvgPrice"); + openapiFields.add("lastPrice"); + openapiFields.add("lastQty"); + openapiFields.add("openPrice"); + openapiFields.add("highPrice"); + openapiFields.add("lowPrice"); + openapiFields.add("volume"); + openapiFields.add("quoteVolume"); + openapiFields.add("openTime"); + openapiFields.add("closeTime"); + openapiFields.add("firstId"); + openapiFields.add("lastId"); + openapiFields.add("count"); + + // 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 TickerResponseData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TickerResponseData.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in TickerResponseData is not found in the" + + " empty JSON string", + TickerResponseData.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("symbol") != null && !jsonObj.get("symbol").isJsonNull()) + && !jsonObj.get("symbol").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `symbol` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("symbol").toString())); + } + if ((jsonObj.get("priceChange") != null && !jsonObj.get("priceChange").isJsonNull()) + && !jsonObj.get("priceChange").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `priceChange` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("priceChange").toString())); + } + if ((jsonObj.get("priceChangePercent") != null + && !jsonObj.get("priceChangePercent").isJsonNull()) + && !jsonObj.get("priceChangePercent").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `priceChangePercent` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("priceChangePercent").toString())); + } + if ((jsonObj.get("weightedAvgPrice") != null + && !jsonObj.get("weightedAvgPrice").isJsonNull()) + && !jsonObj.get("weightedAvgPrice").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `weightedAvgPrice` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("weightedAvgPrice").toString())); + } + if ((jsonObj.get("lastPrice") != null && !jsonObj.get("lastPrice").isJsonNull()) + && !jsonObj.get("lastPrice").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `lastPrice` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("lastPrice").toString())); + } + if ((jsonObj.get("lastQty") != null && !jsonObj.get("lastQty").isJsonNull()) + && !jsonObj.get("lastQty").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `lastQty` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("lastQty").toString())); + } + if ((jsonObj.get("openPrice") != null && !jsonObj.get("openPrice").isJsonNull()) + && !jsonObj.get("openPrice").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `openPrice` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("openPrice").toString())); + } + if ((jsonObj.get("highPrice") != null && !jsonObj.get("highPrice").isJsonNull()) + && !jsonObj.get("highPrice").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `highPrice` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("highPrice").toString())); + } + if ((jsonObj.get("lowPrice") != null && !jsonObj.get("lowPrice").isJsonNull()) + && !jsonObj.get("lowPrice").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `lowPrice` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("lowPrice").toString())); + } + if ((jsonObj.get("volume") != null && !jsonObj.get("volume").isJsonNull()) + && !jsonObj.get("volume").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `volume` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("volume").toString())); + } + if ((jsonObj.get("quoteVolume") != null && !jsonObj.get("quoteVolume").isJsonNull()) + && !jsonObj.get("quoteVolume").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `quoteVolume` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("quoteVolume").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TickerResponseData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TickerResponseData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(TickerResponseData.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, TickerResponseData value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public TickerResponseData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of TickerResponseData given an JSON string + * + * @param jsonString JSON string + * @return An instance of TickerResponseData + * @throws IOException if the JSON string is invalid with respect to TickerResponseData + */ + public static TickerResponseData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TickerResponseData.class); + } + + /** + * Convert an instance of TickerResponseData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/alpha/src/main/java/com/binance/connector/client/alpha/rest/model/TokenListResponse.java b/clients/alpha/src/main/java/com/binance/connector/client/alpha/rest/model/TokenListResponse.java new file mode 100644 index 000000000..5010a9ff3 --- /dev/null +++ b/clients/alpha/src/main/java/com/binance/connector/client/alpha/rest/model/TokenListResponse.java @@ -0,0 +1,392 @@ +/* + * Binance Alpha REST API + * OpenAPI Specification for the Binance Alpha REST API + * + * 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.alpha.rest.model; + +import com.binance.connector.client.alpha.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.*; + +/** TokenListResponse */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.12.0") +public class TokenListResponse { + public static final String SERIALIZED_NAME_CODE = "code"; + + @SerializedName(SERIALIZED_NAME_CODE) + @jakarta.annotation.Nullable + private String code; + + public static final String SERIALIZED_NAME_MESSAGE = "message"; + + @SerializedName(SERIALIZED_NAME_MESSAGE) + @jakarta.annotation.Nullable + private String message; + + public static final String SERIALIZED_NAME_MESSAGE_DETAIL = "messageDetail"; + + @SerializedName(SERIALIZED_NAME_MESSAGE_DETAIL) + @jakarta.annotation.Nullable + private String messageDetail; + + public static final String SERIALIZED_NAME_SUCCESS = "success"; + + @SerializedName(SERIALIZED_NAME_SUCCESS) + @jakarta.annotation.Nullable + private Boolean success; + + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + @jakarta.annotation.Nullable + private List<@Valid TokenListResponseDataInner> data; + + public TokenListResponse() {} + + public TokenListResponse 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 TokenListResponse message(@jakarta.annotation.Nullable String message) { + this.message = message; + return this; + } + + /** + * Get message + * + * @return message + */ + @jakarta.annotation.Nullable + public String getMessage() { + return message; + } + + public void setMessage(@jakarta.annotation.Nullable String message) { + this.message = message; + } + + public TokenListResponse messageDetail(@jakarta.annotation.Nullable String messageDetail) { + this.messageDetail = messageDetail; + return this; + } + + /** + * Get messageDetail + * + * @return messageDetail + */ + @jakarta.annotation.Nullable + public String getMessageDetail() { + return messageDetail; + } + + public void setMessageDetail(@jakarta.annotation.Nullable String messageDetail) { + this.messageDetail = messageDetail; + } + + public TokenListResponse success(@jakarta.annotation.Nullable Boolean success) { + this.success = success; + return this; + } + + /** + * Get success + * + * @return success + */ + @jakarta.annotation.Nullable + public Boolean getSuccess() { + return success; + } + + public void setSuccess(@jakarta.annotation.Nullable Boolean success) { + this.success = success; + } + + public TokenListResponse data( + @jakarta.annotation.Nullable List<@Valid TokenListResponseDataInner> data) { + this.data = data; + return this; + } + + public TokenListResponse addDataItem(TokenListResponseDataInner dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } + this.data.add(dataItem); + return this; + } + + /** + * Get data + * + * @return data + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid TokenListResponseDataInner> getData() { + return data; + } + + public void setData(@jakarta.annotation.Nullable List<@Valid TokenListResponseDataInner> data) { + this.data = data; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TokenListResponse tokenListResponse = (TokenListResponse) o; + return Objects.equals(this.code, tokenListResponse.code) + && Objects.equals(this.message, tokenListResponse.message) + && Objects.equals(this.messageDetail, tokenListResponse.messageDetail) + && Objects.equals(this.success, tokenListResponse.success) + && Objects.equals(this.data, tokenListResponse.data); + } + + @Override + public int hashCode() { + return Objects.hash(code, message, messageDetail, success, data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TokenListResponse {\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" messageDetail: ").append(toIndentedString(messageDetail)).append("\n"); + sb.append(" success: ").append(toIndentedString(success)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).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 messageValue = getMessage(); + String messageValueAsString = ""; + messageValueAsString = messageValue.toString(); + sb.append("message=").append(urlEncode(messageValueAsString)).append(""); + Object messageDetailValue = getMessageDetail(); + String messageDetailValueAsString = ""; + messageDetailValueAsString = messageDetailValue.toString(); + sb.append("messageDetail=").append(urlEncode(messageDetailValueAsString)).append(""); + Object successValue = getSuccess(); + String successValueAsString = ""; + successValueAsString = successValue.toString(); + sb.append("success=").append(urlEncode(successValueAsString)).append(""); + Object dataValue = getData(); + String dataValueAsString = ""; + dataValueAsString = + (String) + ((Collection) dataValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("data=").append(urlEncode(dataValueAsString)).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("message"); + openapiFields.add("messageDetail"); + openapiFields.add("success"); + openapiFields.add("data"); + + // 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 TokenListResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TokenListResponse.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in TokenListResponse is not found in the" + + " empty JSON string", + TokenListResponse.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("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())); + } + if ((jsonObj.get("messageDetail") != null && !jsonObj.get("messageDetail").isJsonNull()) + && !jsonObj.get("messageDetail").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `messageDetail` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("messageDetail").toString())); + } + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + JsonArray jsonArraydata = jsonObj.getAsJsonArray("data"); + if (jsonArraydata != null) { + // ensure the json data is an array + if (!jsonObj.get("data").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `data` to be an array in the JSON string" + + " but got `%s`", + jsonObj.get("data").toString())); + } + + // validate the optional field `data` (array) + for (int i = 0; i < jsonArraydata.size(); i++) { + TokenListResponseDataInner.validateJsonElement(jsonArraydata.get(i)); + } + ; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TokenListResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TokenListResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(TokenListResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, TokenListResponse value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public TokenListResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of TokenListResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of TokenListResponse + * @throws IOException if the JSON string is invalid with respect to TokenListResponse + */ + public static TokenListResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TokenListResponse.class); + } + + /** + * Convert an instance of TokenListResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/alpha/src/main/java/com/binance/connector/client/alpha/rest/model/TokenListResponseDataInner.java b/clients/alpha/src/main/java/com/binance/connector/client/alpha/rest/model/TokenListResponseDataInner.java new file mode 100644 index 000000000..89751c016 --- /dev/null +++ b/clients/alpha/src/main/java/com/binance/connector/client/alpha/rest/model/TokenListResponseDataInner.java @@ -0,0 +1,1617 @@ +/* + * Binance Alpha REST API + * OpenAPI Specification for the Binance Alpha REST API + * + * 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.alpha.rest.model; + +import com.binance.connector.client.alpha.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.*; + +/** TokenListResponseDataInner */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.12.0") +public class TokenListResponseDataInner { + public static final String SERIALIZED_NAME_TOKEN_ID = "tokenId"; + + @SerializedName(SERIALIZED_NAME_TOKEN_ID) + @jakarta.annotation.Nullable + private String tokenId; + + public static final String SERIALIZED_NAME_CHAIN_ID = "chainId"; + + @SerializedName(SERIALIZED_NAME_CHAIN_ID) + @jakarta.annotation.Nullable + private String chainId; + + public static final String SERIALIZED_NAME_CHAIN_ICON_URL = "chainIconUrl"; + + @SerializedName(SERIALIZED_NAME_CHAIN_ICON_URL) + @jakarta.annotation.Nullable + private String chainIconUrl; + + public static final String SERIALIZED_NAME_CHAIN_NAME = "chainName"; + + @SerializedName(SERIALIZED_NAME_CHAIN_NAME) + @jakarta.annotation.Nullable + private String chainName; + + public static final String SERIALIZED_NAME_CONTRACT_ADDRESS = "contractAddress"; + + @SerializedName(SERIALIZED_NAME_CONTRACT_ADDRESS) + @jakarta.annotation.Nullable + private String contractAddress; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @jakarta.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_SYMBOL = "symbol"; + + @SerializedName(SERIALIZED_NAME_SYMBOL) + @jakarta.annotation.Nullable + private String symbol; + + public static final String SERIALIZED_NAME_ICON_URL = "iconUrl"; + + @SerializedName(SERIALIZED_NAME_ICON_URL) + @jakarta.annotation.Nullable + private String iconUrl; + + public static final String SERIALIZED_NAME_PRICE = "price"; + + @SerializedName(SERIALIZED_NAME_PRICE) + @jakarta.annotation.Nullable + private String price; + + public static final String SERIALIZED_NAME_PERCENT_CHANGE24H = "percentChange24h"; + + @SerializedName(SERIALIZED_NAME_PERCENT_CHANGE24H) + @jakarta.annotation.Nullable + private String percentChange24h; + + public static final String SERIALIZED_NAME_VOLUME24H = "volume24h"; + + @SerializedName(SERIALIZED_NAME_VOLUME24H) + @jakarta.annotation.Nullable + private String volume24h; + + public static final String SERIALIZED_NAME_MARKET_CAP = "marketCap"; + + @SerializedName(SERIALIZED_NAME_MARKET_CAP) + @jakarta.annotation.Nullable + private String marketCap; + + public static final String SERIALIZED_NAME_FDV = "fdv"; + + @SerializedName(SERIALIZED_NAME_FDV) + @jakarta.annotation.Nullable + private String fdv; + + public static final String SERIALIZED_NAME_LIQUIDITY = "liquidity"; + + @SerializedName(SERIALIZED_NAME_LIQUIDITY) + @jakarta.annotation.Nullable + private String liquidity; + + public static final String SERIALIZED_NAME_TOTAL_SUPPLY = "totalSupply"; + + @SerializedName(SERIALIZED_NAME_TOTAL_SUPPLY) + @jakarta.annotation.Nullable + private String totalSupply; + + public static final String SERIALIZED_NAME_CIRCULATING_SUPPLY = "circulatingSupply"; + + @SerializedName(SERIALIZED_NAME_CIRCULATING_SUPPLY) + @jakarta.annotation.Nullable + private String circulatingSupply; + + public static final String SERIALIZED_NAME_HOLDERS = "holders"; + + @SerializedName(SERIALIZED_NAME_HOLDERS) + @jakarta.annotation.Nullable + private String holders; + + public static final String SERIALIZED_NAME_DECIMALS = "decimals"; + + @SerializedName(SERIALIZED_NAME_DECIMALS) + @jakarta.annotation.Nullable + private Long decimals; + + public static final String SERIALIZED_NAME_LISTING_CEX = "listingCex"; + + @SerializedName(SERIALIZED_NAME_LISTING_CEX) + @jakarta.annotation.Nullable + private Boolean listingCex; + + public static final String SERIALIZED_NAME_HOT_TAG = "hotTag"; + + @SerializedName(SERIALIZED_NAME_HOT_TAG) + @jakarta.annotation.Nullable + private Boolean hotTag; + + public static final String SERIALIZED_NAME_CEX_COIN_NAME = "cexCoinName"; + + @SerializedName(SERIALIZED_NAME_CEX_COIN_NAME) + @jakarta.annotation.Nullable + private String cexCoinName; + + public static final String SERIALIZED_NAME_CAN_TRANSFER = "canTransfer"; + + @SerializedName(SERIALIZED_NAME_CAN_TRANSFER) + @jakarta.annotation.Nullable + private Boolean canTransfer; + + public static final String SERIALIZED_NAME_DENOMINATION = "denomination"; + + @SerializedName(SERIALIZED_NAME_DENOMINATION) + @jakarta.annotation.Nullable + private Long denomination; + + public static final String SERIALIZED_NAME_OFFLINE = "offline"; + + @SerializedName(SERIALIZED_NAME_OFFLINE) + @jakarta.annotation.Nullable + private Boolean offline; + + public static final String SERIALIZED_NAME_TRADE_DECIMAL = "tradeDecimal"; + + @SerializedName(SERIALIZED_NAME_TRADE_DECIMAL) + @jakarta.annotation.Nullable + private Long tradeDecimal; + + public static final String SERIALIZED_NAME_ALPHA_ID = "alphaId"; + + @SerializedName(SERIALIZED_NAME_ALPHA_ID) + @jakarta.annotation.Nullable + private String alphaId; + + public static final String SERIALIZED_NAME_OFFSELL = "offsell"; + + @SerializedName(SERIALIZED_NAME_OFFSELL) + @jakarta.annotation.Nullable + private Boolean offsell; + + public static final String SERIALIZED_NAME_PRICE_HIGH24H = "priceHigh24h"; + + @SerializedName(SERIALIZED_NAME_PRICE_HIGH24H) + @jakarta.annotation.Nullable + private String priceHigh24h; + + public static final String SERIALIZED_NAME_PRICE_LOW24H = "priceLow24h"; + + @SerializedName(SERIALIZED_NAME_PRICE_LOW24H) + @jakarta.annotation.Nullable + private String priceLow24h; + + public static final String SERIALIZED_NAME_COUNT24H = "count24h"; + + @SerializedName(SERIALIZED_NAME_COUNT24H) + @jakarta.annotation.Nullable + private String count24h; + + public static final String SERIALIZED_NAME_ONLINE_TGE = "onlineTge"; + + @SerializedName(SERIALIZED_NAME_ONLINE_TGE) + @jakarta.annotation.Nullable + private Boolean onlineTge; + + public static final String SERIALIZED_NAME_ONLINE_AIRDROP = "onlineAirdrop"; + + @SerializedName(SERIALIZED_NAME_ONLINE_AIRDROP) + @jakarta.annotation.Nullable + private Boolean onlineAirdrop; + + public static final String SERIALIZED_NAME_SCORE = "score"; + + @SerializedName(SERIALIZED_NAME_SCORE) + @jakarta.annotation.Nullable + private Long score; + + public static final String SERIALIZED_NAME_CEX_OFF_DISPLAY = "cexOffDisplay"; + + @SerializedName(SERIALIZED_NAME_CEX_OFF_DISPLAY) + @jakarta.annotation.Nullable + private Boolean cexOffDisplay; + + public static final String SERIALIZED_NAME_STOCK_STATE = "stockState"; + + @SerializedName(SERIALIZED_NAME_STOCK_STATE) + @jakarta.annotation.Nullable + private Boolean stockState; + + public static final String SERIALIZED_NAME_LISTING_TIME = "listingTime"; + + @SerializedName(SERIALIZED_NAME_LISTING_TIME) + @jakarta.annotation.Nullable + private Long listingTime; + + public static final String SERIALIZED_NAME_MUL_POINT = "mulPoint"; + + @SerializedName(SERIALIZED_NAME_MUL_POINT) + @jakarta.annotation.Nullable + private Long mulPoint; + + public static final String SERIALIZED_NAME_BN_EXCLUSIVE_STATE = "bnExclusiveState"; + + @SerializedName(SERIALIZED_NAME_BN_EXCLUSIVE_STATE) + @jakarta.annotation.Nullable + private Boolean bnExclusiveState; + + public TokenListResponseDataInner() {} + + public TokenListResponseDataInner tokenId(@jakarta.annotation.Nullable String tokenId) { + this.tokenId = tokenId; + return this; + } + + /** + * Get tokenId + * + * @return tokenId + */ + @jakarta.annotation.Nullable + public String getTokenId() { + return tokenId; + } + + public void setTokenId(@jakarta.annotation.Nullable String tokenId) { + this.tokenId = tokenId; + } + + public TokenListResponseDataInner chainId(@jakarta.annotation.Nullable String chainId) { + this.chainId = chainId; + return this; + } + + /** + * Get chainId + * + * @return chainId + */ + @jakarta.annotation.Nullable + public String getChainId() { + return chainId; + } + + public void setChainId(@jakarta.annotation.Nullable String chainId) { + this.chainId = chainId; + } + + public TokenListResponseDataInner chainIconUrl( + @jakarta.annotation.Nullable String chainIconUrl) { + this.chainIconUrl = chainIconUrl; + return this; + } + + /** + * Get chainIconUrl + * + * @return chainIconUrl + */ + @jakarta.annotation.Nullable + public String getChainIconUrl() { + return chainIconUrl; + } + + public void setChainIconUrl(@jakarta.annotation.Nullable String chainIconUrl) { + this.chainIconUrl = chainIconUrl; + } + + public TokenListResponseDataInner chainName(@jakarta.annotation.Nullable String chainName) { + this.chainName = chainName; + return this; + } + + /** + * Get chainName + * + * @return chainName + */ + @jakarta.annotation.Nullable + public String getChainName() { + return chainName; + } + + public void setChainName(@jakarta.annotation.Nullable String chainName) { + this.chainName = chainName; + } + + public TokenListResponseDataInner contractAddress( + @jakarta.annotation.Nullable String contractAddress) { + this.contractAddress = contractAddress; + return this; + } + + /** + * Get contractAddress + * + * @return contractAddress + */ + @jakarta.annotation.Nullable + public String getContractAddress() { + return contractAddress; + } + + public void setContractAddress(@jakarta.annotation.Nullable String contractAddress) { + this.contractAddress = contractAddress; + } + + public TokenListResponseDataInner 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 TokenListResponseDataInner symbol(@jakarta.annotation.Nullable String symbol) { + this.symbol = symbol; + return this; + } + + /** + * Get symbol + * + * @return symbol + */ + @jakarta.annotation.Nullable + public String getSymbol() { + return symbol; + } + + public void setSymbol(@jakarta.annotation.Nullable String symbol) { + this.symbol = symbol; + } + + public TokenListResponseDataInner iconUrl(@jakarta.annotation.Nullable String iconUrl) { + this.iconUrl = iconUrl; + return this; + } + + /** + * Get iconUrl + * + * @return iconUrl + */ + @jakarta.annotation.Nullable + public String getIconUrl() { + return iconUrl; + } + + public void setIconUrl(@jakarta.annotation.Nullable String iconUrl) { + this.iconUrl = iconUrl; + } + + public TokenListResponseDataInner price(@jakarta.annotation.Nullable String price) { + this.price = price; + return this; + } + + /** + * Get price + * + * @return price + */ + @jakarta.annotation.Nullable + public String getPrice() { + return price; + } + + public void setPrice(@jakarta.annotation.Nullable String price) { + this.price = price; + } + + public TokenListResponseDataInner percentChange24h( + @jakarta.annotation.Nullable String percentChange24h) { + this.percentChange24h = percentChange24h; + return this; + } + + /** + * Get percentChange24h + * + * @return percentChange24h + */ + @jakarta.annotation.Nullable + public String getPercentChange24h() { + return percentChange24h; + } + + public void setPercentChange24h(@jakarta.annotation.Nullable String percentChange24h) { + this.percentChange24h = percentChange24h; + } + + public TokenListResponseDataInner volume24h(@jakarta.annotation.Nullable String volume24h) { + this.volume24h = volume24h; + return this; + } + + /** + * Get volume24h + * + * @return volume24h + */ + @jakarta.annotation.Nullable + public String getVolume24h() { + return volume24h; + } + + public void setVolume24h(@jakarta.annotation.Nullable String volume24h) { + this.volume24h = volume24h; + } + + public TokenListResponseDataInner marketCap(@jakarta.annotation.Nullable String marketCap) { + this.marketCap = marketCap; + return this; + } + + /** + * Get marketCap + * + * @return marketCap + */ + @jakarta.annotation.Nullable + public String getMarketCap() { + return marketCap; + } + + public void setMarketCap(@jakarta.annotation.Nullable String marketCap) { + this.marketCap = marketCap; + } + + public TokenListResponseDataInner fdv(@jakarta.annotation.Nullable String fdv) { + this.fdv = fdv; + return this; + } + + /** + * Get fdv + * + * @return fdv + */ + @jakarta.annotation.Nullable + public String getFdv() { + return fdv; + } + + public void setFdv(@jakarta.annotation.Nullable String fdv) { + this.fdv = fdv; + } + + public TokenListResponseDataInner liquidity(@jakarta.annotation.Nullable String liquidity) { + this.liquidity = liquidity; + return this; + } + + /** + * Get liquidity + * + * @return liquidity + */ + @jakarta.annotation.Nullable + public String getLiquidity() { + return liquidity; + } + + public void setLiquidity(@jakarta.annotation.Nullable String liquidity) { + this.liquidity = liquidity; + } + + public TokenListResponseDataInner totalSupply(@jakarta.annotation.Nullable String totalSupply) { + this.totalSupply = totalSupply; + return this; + } + + /** + * Get totalSupply + * + * @return totalSupply + */ + @jakarta.annotation.Nullable + public String getTotalSupply() { + return totalSupply; + } + + public void setTotalSupply(@jakarta.annotation.Nullable String totalSupply) { + this.totalSupply = totalSupply; + } + + public TokenListResponseDataInner circulatingSupply( + @jakarta.annotation.Nullable String circulatingSupply) { + this.circulatingSupply = circulatingSupply; + return this; + } + + /** + * Get circulatingSupply + * + * @return circulatingSupply + */ + @jakarta.annotation.Nullable + public String getCirculatingSupply() { + return circulatingSupply; + } + + public void setCirculatingSupply(@jakarta.annotation.Nullable String circulatingSupply) { + this.circulatingSupply = circulatingSupply; + } + + public TokenListResponseDataInner holders(@jakarta.annotation.Nullable String holders) { + this.holders = holders; + return this; + } + + /** + * Get holders + * + * @return holders + */ + @jakarta.annotation.Nullable + public String getHolders() { + return holders; + } + + public void setHolders(@jakarta.annotation.Nullable String holders) { + this.holders = holders; + } + + public TokenListResponseDataInner decimals(@jakarta.annotation.Nullable Long decimals) { + this.decimals = decimals; + return this; + } + + /** + * Get decimals + * + * @return decimals + */ + @jakarta.annotation.Nullable + public Long getDecimals() { + return decimals; + } + + public void setDecimals(@jakarta.annotation.Nullable Long decimals) { + this.decimals = decimals; + } + + public TokenListResponseDataInner listingCex(@jakarta.annotation.Nullable Boolean listingCex) { + this.listingCex = listingCex; + return this; + } + + /** + * Get listingCex + * + * @return listingCex + */ + @jakarta.annotation.Nullable + public Boolean getListingCex() { + return listingCex; + } + + public void setListingCex(@jakarta.annotation.Nullable Boolean listingCex) { + this.listingCex = listingCex; + } + + public TokenListResponseDataInner hotTag(@jakarta.annotation.Nullable Boolean hotTag) { + this.hotTag = hotTag; + return this; + } + + /** + * Get hotTag + * + * @return hotTag + */ + @jakarta.annotation.Nullable + public Boolean getHotTag() { + return hotTag; + } + + public void setHotTag(@jakarta.annotation.Nullable Boolean hotTag) { + this.hotTag = hotTag; + } + + public TokenListResponseDataInner cexCoinName(@jakarta.annotation.Nullable String cexCoinName) { + this.cexCoinName = cexCoinName; + return this; + } + + /** + * Get cexCoinName + * + * @return cexCoinName + */ + @jakarta.annotation.Nullable + public String getCexCoinName() { + return cexCoinName; + } + + public void setCexCoinName(@jakarta.annotation.Nullable String cexCoinName) { + this.cexCoinName = cexCoinName; + } + + public TokenListResponseDataInner canTransfer( + @jakarta.annotation.Nullable Boolean canTransfer) { + this.canTransfer = canTransfer; + return this; + } + + /** + * Get canTransfer + * + * @return canTransfer + */ + @jakarta.annotation.Nullable + public Boolean getCanTransfer() { + return canTransfer; + } + + public void setCanTransfer(@jakarta.annotation.Nullable Boolean canTransfer) { + this.canTransfer = canTransfer; + } + + public TokenListResponseDataInner denomination(@jakarta.annotation.Nullable Long denomination) { + this.denomination = denomination; + return this; + } + + /** + * Get denomination + * + * @return denomination + */ + @jakarta.annotation.Nullable + public Long getDenomination() { + return denomination; + } + + public void setDenomination(@jakarta.annotation.Nullable Long denomination) { + this.denomination = denomination; + } + + public TokenListResponseDataInner offline(@jakarta.annotation.Nullable Boolean offline) { + this.offline = offline; + return this; + } + + /** + * Get offline + * + * @return offline + */ + @jakarta.annotation.Nullable + public Boolean getOffline() { + return offline; + } + + public void setOffline(@jakarta.annotation.Nullable Boolean offline) { + this.offline = offline; + } + + public TokenListResponseDataInner tradeDecimal(@jakarta.annotation.Nullable Long tradeDecimal) { + this.tradeDecimal = tradeDecimal; + return this; + } + + /** + * Get tradeDecimal + * + * @return tradeDecimal + */ + @jakarta.annotation.Nullable + public Long getTradeDecimal() { + return tradeDecimal; + } + + public void setTradeDecimal(@jakarta.annotation.Nullable Long tradeDecimal) { + this.tradeDecimal = tradeDecimal; + } + + public TokenListResponseDataInner alphaId(@jakarta.annotation.Nullable String alphaId) { + this.alphaId = alphaId; + return this; + } + + /** + * Get alphaId + * + * @return alphaId + */ + @jakarta.annotation.Nullable + public String getAlphaId() { + return alphaId; + } + + public void setAlphaId(@jakarta.annotation.Nullable String alphaId) { + this.alphaId = alphaId; + } + + public TokenListResponseDataInner offsell(@jakarta.annotation.Nullable Boolean offsell) { + this.offsell = offsell; + return this; + } + + /** + * Get offsell + * + * @return offsell + */ + @jakarta.annotation.Nullable + public Boolean getOffsell() { + return offsell; + } + + public void setOffsell(@jakarta.annotation.Nullable Boolean offsell) { + this.offsell = offsell; + } + + public TokenListResponseDataInner priceHigh24h( + @jakarta.annotation.Nullable String priceHigh24h) { + this.priceHigh24h = priceHigh24h; + return this; + } + + /** + * Get priceHigh24h + * + * @return priceHigh24h + */ + @jakarta.annotation.Nullable + public String getPriceHigh24h() { + return priceHigh24h; + } + + public void setPriceHigh24h(@jakarta.annotation.Nullable String priceHigh24h) { + this.priceHigh24h = priceHigh24h; + } + + public TokenListResponseDataInner priceLow24h(@jakarta.annotation.Nullable String priceLow24h) { + this.priceLow24h = priceLow24h; + return this; + } + + /** + * Get priceLow24h + * + * @return priceLow24h + */ + @jakarta.annotation.Nullable + public String getPriceLow24h() { + return priceLow24h; + } + + public void setPriceLow24h(@jakarta.annotation.Nullable String priceLow24h) { + this.priceLow24h = priceLow24h; + } + + public TokenListResponseDataInner count24h(@jakarta.annotation.Nullable String count24h) { + this.count24h = count24h; + return this; + } + + /** + * Get count24h + * + * @return count24h + */ + @jakarta.annotation.Nullable + public String getCount24h() { + return count24h; + } + + public void setCount24h(@jakarta.annotation.Nullable String count24h) { + this.count24h = count24h; + } + + public TokenListResponseDataInner onlineTge(@jakarta.annotation.Nullable Boolean onlineTge) { + this.onlineTge = onlineTge; + return this; + } + + /** + * Get onlineTge + * + * @return onlineTge + */ + @jakarta.annotation.Nullable + public Boolean getOnlineTge() { + return onlineTge; + } + + public void setOnlineTge(@jakarta.annotation.Nullable Boolean onlineTge) { + this.onlineTge = onlineTge; + } + + public TokenListResponseDataInner onlineAirdrop( + @jakarta.annotation.Nullable Boolean onlineAirdrop) { + this.onlineAirdrop = onlineAirdrop; + return this; + } + + /** + * Get onlineAirdrop + * + * @return onlineAirdrop + */ + @jakarta.annotation.Nullable + public Boolean getOnlineAirdrop() { + return onlineAirdrop; + } + + public void setOnlineAirdrop(@jakarta.annotation.Nullable Boolean onlineAirdrop) { + this.onlineAirdrop = onlineAirdrop; + } + + public TokenListResponseDataInner score(@jakarta.annotation.Nullable Long score) { + this.score = score; + return this; + } + + /** + * Get score + * + * @return score + */ + @jakarta.annotation.Nullable + public Long getScore() { + return score; + } + + public void setScore(@jakarta.annotation.Nullable Long score) { + this.score = score; + } + + public TokenListResponseDataInner cexOffDisplay( + @jakarta.annotation.Nullable Boolean cexOffDisplay) { + this.cexOffDisplay = cexOffDisplay; + return this; + } + + /** + * Get cexOffDisplay + * + * @return cexOffDisplay + */ + @jakarta.annotation.Nullable + public Boolean getCexOffDisplay() { + return cexOffDisplay; + } + + public void setCexOffDisplay(@jakarta.annotation.Nullable Boolean cexOffDisplay) { + this.cexOffDisplay = cexOffDisplay; + } + + public TokenListResponseDataInner stockState(@jakarta.annotation.Nullable Boolean stockState) { + this.stockState = stockState; + return this; + } + + /** + * Get stockState + * + * @return stockState + */ + @jakarta.annotation.Nullable + public Boolean getStockState() { + return stockState; + } + + public void setStockState(@jakarta.annotation.Nullable Boolean stockState) { + this.stockState = stockState; + } + + public TokenListResponseDataInner listingTime(@jakarta.annotation.Nullable Long listingTime) { + this.listingTime = listingTime; + return this; + } + + /** + * Get listingTime + * + * @return listingTime + */ + @jakarta.annotation.Nullable + public Long getListingTime() { + return listingTime; + } + + public void setListingTime(@jakarta.annotation.Nullable Long listingTime) { + this.listingTime = listingTime; + } + + public TokenListResponseDataInner mulPoint(@jakarta.annotation.Nullable Long mulPoint) { + this.mulPoint = mulPoint; + return this; + } + + /** + * Get mulPoint + * + * @return mulPoint + */ + @jakarta.annotation.Nullable + public Long getMulPoint() { + return mulPoint; + } + + public void setMulPoint(@jakarta.annotation.Nullable Long mulPoint) { + this.mulPoint = mulPoint; + } + + public TokenListResponseDataInner bnExclusiveState( + @jakarta.annotation.Nullable Boolean bnExclusiveState) { + this.bnExclusiveState = bnExclusiveState; + return this; + } + + /** + * Get bnExclusiveState + * + * @return bnExclusiveState + */ + @jakarta.annotation.Nullable + public Boolean getBnExclusiveState() { + return bnExclusiveState; + } + + public void setBnExclusiveState(@jakarta.annotation.Nullable Boolean bnExclusiveState) { + this.bnExclusiveState = bnExclusiveState; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TokenListResponseDataInner tokenListResponseDataInner = (TokenListResponseDataInner) o; + return Objects.equals(this.tokenId, tokenListResponseDataInner.tokenId) + && Objects.equals(this.chainId, tokenListResponseDataInner.chainId) + && Objects.equals(this.chainIconUrl, tokenListResponseDataInner.chainIconUrl) + && Objects.equals(this.chainName, tokenListResponseDataInner.chainName) + && Objects.equals(this.contractAddress, tokenListResponseDataInner.contractAddress) + && Objects.equals(this.name, tokenListResponseDataInner.name) + && Objects.equals(this.symbol, tokenListResponseDataInner.symbol) + && Objects.equals(this.iconUrl, tokenListResponseDataInner.iconUrl) + && Objects.equals(this.price, tokenListResponseDataInner.price) + && Objects.equals( + this.percentChange24h, tokenListResponseDataInner.percentChange24h) + && Objects.equals(this.volume24h, tokenListResponseDataInner.volume24h) + && Objects.equals(this.marketCap, tokenListResponseDataInner.marketCap) + && Objects.equals(this.fdv, tokenListResponseDataInner.fdv) + && Objects.equals(this.liquidity, tokenListResponseDataInner.liquidity) + && Objects.equals(this.totalSupply, tokenListResponseDataInner.totalSupply) + && Objects.equals( + this.circulatingSupply, tokenListResponseDataInner.circulatingSupply) + && Objects.equals(this.holders, tokenListResponseDataInner.holders) + && Objects.equals(this.decimals, tokenListResponseDataInner.decimals) + && Objects.equals(this.listingCex, tokenListResponseDataInner.listingCex) + && Objects.equals(this.hotTag, tokenListResponseDataInner.hotTag) + && Objects.equals(this.cexCoinName, tokenListResponseDataInner.cexCoinName) + && Objects.equals(this.canTransfer, tokenListResponseDataInner.canTransfer) + && Objects.equals(this.denomination, tokenListResponseDataInner.denomination) + && Objects.equals(this.offline, tokenListResponseDataInner.offline) + && Objects.equals(this.tradeDecimal, tokenListResponseDataInner.tradeDecimal) + && Objects.equals(this.alphaId, tokenListResponseDataInner.alphaId) + && Objects.equals(this.offsell, tokenListResponseDataInner.offsell) + && Objects.equals(this.priceHigh24h, tokenListResponseDataInner.priceHigh24h) + && Objects.equals(this.priceLow24h, tokenListResponseDataInner.priceLow24h) + && Objects.equals(this.count24h, tokenListResponseDataInner.count24h) + && Objects.equals(this.onlineTge, tokenListResponseDataInner.onlineTge) + && Objects.equals(this.onlineAirdrop, tokenListResponseDataInner.onlineAirdrop) + && Objects.equals(this.score, tokenListResponseDataInner.score) + && Objects.equals(this.cexOffDisplay, tokenListResponseDataInner.cexOffDisplay) + && Objects.equals(this.stockState, tokenListResponseDataInner.stockState) + && Objects.equals(this.listingTime, tokenListResponseDataInner.listingTime) + && Objects.equals(this.mulPoint, tokenListResponseDataInner.mulPoint) + && Objects.equals( + this.bnExclusiveState, tokenListResponseDataInner.bnExclusiveState); + } + + @Override + public int hashCode() { + return Objects.hash( + tokenId, + chainId, + chainIconUrl, + chainName, + contractAddress, + name, + symbol, + iconUrl, + price, + percentChange24h, + volume24h, + marketCap, + fdv, + liquidity, + totalSupply, + circulatingSupply, + holders, + decimals, + listingCex, + hotTag, + cexCoinName, + canTransfer, + denomination, + offline, + tradeDecimal, + alphaId, + offsell, + priceHigh24h, + priceLow24h, + count24h, + onlineTge, + onlineAirdrop, + score, + cexOffDisplay, + stockState, + listingTime, + mulPoint, + bnExclusiveState); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TokenListResponseDataInner {\n"); + sb.append(" tokenId: ").append(toIndentedString(tokenId)).append("\n"); + sb.append(" chainId: ").append(toIndentedString(chainId)).append("\n"); + sb.append(" chainIconUrl: ").append(toIndentedString(chainIconUrl)).append("\n"); + sb.append(" chainName: ").append(toIndentedString(chainName)).append("\n"); + sb.append(" contractAddress: ").append(toIndentedString(contractAddress)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" symbol: ").append(toIndentedString(symbol)).append("\n"); + sb.append(" iconUrl: ").append(toIndentedString(iconUrl)).append("\n"); + sb.append(" price: ").append(toIndentedString(price)).append("\n"); + sb.append(" percentChange24h: ").append(toIndentedString(percentChange24h)).append("\n"); + sb.append(" volume24h: ").append(toIndentedString(volume24h)).append("\n"); + sb.append(" marketCap: ").append(toIndentedString(marketCap)).append("\n"); + sb.append(" fdv: ").append(toIndentedString(fdv)).append("\n"); + sb.append(" liquidity: ").append(toIndentedString(liquidity)).append("\n"); + sb.append(" totalSupply: ").append(toIndentedString(totalSupply)).append("\n"); + sb.append(" circulatingSupply: ").append(toIndentedString(circulatingSupply)).append("\n"); + sb.append(" holders: ").append(toIndentedString(holders)).append("\n"); + sb.append(" decimals: ").append(toIndentedString(decimals)).append("\n"); + sb.append(" listingCex: ").append(toIndentedString(listingCex)).append("\n"); + sb.append(" hotTag: ").append(toIndentedString(hotTag)).append("\n"); + sb.append(" cexCoinName: ").append(toIndentedString(cexCoinName)).append("\n"); + sb.append(" canTransfer: ").append(toIndentedString(canTransfer)).append("\n"); + sb.append(" denomination: ").append(toIndentedString(denomination)).append("\n"); + sb.append(" offline: ").append(toIndentedString(offline)).append("\n"); + sb.append(" tradeDecimal: ").append(toIndentedString(tradeDecimal)).append("\n"); + sb.append(" alphaId: ").append(toIndentedString(alphaId)).append("\n"); + sb.append(" offsell: ").append(toIndentedString(offsell)).append("\n"); + sb.append(" priceHigh24h: ").append(toIndentedString(priceHigh24h)).append("\n"); + sb.append(" priceLow24h: ").append(toIndentedString(priceLow24h)).append("\n"); + sb.append(" count24h: ").append(toIndentedString(count24h)).append("\n"); + sb.append(" onlineTge: ").append(toIndentedString(onlineTge)).append("\n"); + sb.append(" onlineAirdrop: ").append(toIndentedString(onlineAirdrop)).append("\n"); + sb.append(" score: ").append(toIndentedString(score)).append("\n"); + sb.append(" cexOffDisplay: ").append(toIndentedString(cexOffDisplay)).append("\n"); + sb.append(" stockState: ").append(toIndentedString(stockState)).append("\n"); + sb.append(" listingTime: ").append(toIndentedString(listingTime)).append("\n"); + sb.append(" mulPoint: ").append(toIndentedString(mulPoint)).append("\n"); + sb.append(" bnExclusiveState: ").append(toIndentedString(bnExclusiveState)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object tokenIdValue = getTokenId(); + String tokenIdValueAsString = ""; + tokenIdValueAsString = tokenIdValue.toString(); + sb.append("tokenId=").append(urlEncode(tokenIdValueAsString)).append(""); + Object chainIdValue = getChainId(); + String chainIdValueAsString = ""; + chainIdValueAsString = chainIdValue.toString(); + sb.append("chainId=").append(urlEncode(chainIdValueAsString)).append(""); + Object chainIconUrlValue = getChainIconUrl(); + String chainIconUrlValueAsString = ""; + chainIconUrlValueAsString = chainIconUrlValue.toString(); + sb.append("chainIconUrl=").append(urlEncode(chainIconUrlValueAsString)).append(""); + Object chainNameValue = getChainName(); + String chainNameValueAsString = ""; + chainNameValueAsString = chainNameValue.toString(); + sb.append("chainName=").append(urlEncode(chainNameValueAsString)).append(""); + Object contractAddressValue = getContractAddress(); + String contractAddressValueAsString = ""; + contractAddressValueAsString = contractAddressValue.toString(); + sb.append("contractAddress=").append(urlEncode(contractAddressValueAsString)).append(""); + Object nameValue = getName(); + String nameValueAsString = ""; + nameValueAsString = nameValue.toString(); + sb.append("name=").append(urlEncode(nameValueAsString)).append(""); + Object symbolValue = getSymbol(); + String symbolValueAsString = ""; + symbolValueAsString = symbolValue.toString(); + sb.append("symbol=").append(urlEncode(symbolValueAsString)).append(""); + Object iconUrlValue = getIconUrl(); + String iconUrlValueAsString = ""; + iconUrlValueAsString = iconUrlValue.toString(); + sb.append("iconUrl=").append(urlEncode(iconUrlValueAsString)).append(""); + Object priceValue = getPrice(); + String priceValueAsString = ""; + priceValueAsString = priceValue.toString(); + sb.append("price=").append(urlEncode(priceValueAsString)).append(""); + Object percentChange24hValue = getPercentChange24h(); + String percentChange24hValueAsString = ""; + percentChange24hValueAsString = percentChange24hValue.toString(); + sb.append("percentChange24h=").append(urlEncode(percentChange24hValueAsString)).append(""); + Object volume24hValue = getVolume24h(); + String volume24hValueAsString = ""; + volume24hValueAsString = volume24hValue.toString(); + sb.append("volume24h=").append(urlEncode(volume24hValueAsString)).append(""); + Object marketCapValue = getMarketCap(); + String marketCapValueAsString = ""; + marketCapValueAsString = marketCapValue.toString(); + sb.append("marketCap=").append(urlEncode(marketCapValueAsString)).append(""); + Object fdvValue = getFdv(); + String fdvValueAsString = ""; + fdvValueAsString = fdvValue.toString(); + sb.append("fdv=").append(urlEncode(fdvValueAsString)).append(""); + Object liquidityValue = getLiquidity(); + String liquidityValueAsString = ""; + liquidityValueAsString = liquidityValue.toString(); + sb.append("liquidity=").append(urlEncode(liquidityValueAsString)).append(""); + Object totalSupplyValue = getTotalSupply(); + String totalSupplyValueAsString = ""; + totalSupplyValueAsString = totalSupplyValue.toString(); + sb.append("totalSupply=").append(urlEncode(totalSupplyValueAsString)).append(""); + Object circulatingSupplyValue = getCirculatingSupply(); + String circulatingSupplyValueAsString = ""; + circulatingSupplyValueAsString = circulatingSupplyValue.toString(); + sb.append("circulatingSupply=") + .append(urlEncode(circulatingSupplyValueAsString)) + .append(""); + Object holdersValue = getHolders(); + String holdersValueAsString = ""; + holdersValueAsString = holdersValue.toString(); + sb.append("holders=").append(urlEncode(holdersValueAsString)).append(""); + Object decimalsValue = getDecimals(); + String decimalsValueAsString = ""; + decimalsValueAsString = decimalsValue.toString(); + sb.append("decimals=").append(urlEncode(decimalsValueAsString)).append(""); + Object listingCexValue = getListingCex(); + String listingCexValueAsString = ""; + listingCexValueAsString = listingCexValue.toString(); + sb.append("listingCex=").append(urlEncode(listingCexValueAsString)).append(""); + Object hotTagValue = getHotTag(); + String hotTagValueAsString = ""; + hotTagValueAsString = hotTagValue.toString(); + sb.append("hotTag=").append(urlEncode(hotTagValueAsString)).append(""); + Object cexCoinNameValue = getCexCoinName(); + String cexCoinNameValueAsString = ""; + cexCoinNameValueAsString = cexCoinNameValue.toString(); + sb.append("cexCoinName=").append(urlEncode(cexCoinNameValueAsString)).append(""); + Object canTransferValue = getCanTransfer(); + String canTransferValueAsString = ""; + canTransferValueAsString = canTransferValue.toString(); + sb.append("canTransfer=").append(urlEncode(canTransferValueAsString)).append(""); + Object denominationValue = getDenomination(); + String denominationValueAsString = ""; + denominationValueAsString = denominationValue.toString(); + sb.append("denomination=").append(urlEncode(denominationValueAsString)).append(""); + Object offlineValue = getOffline(); + String offlineValueAsString = ""; + offlineValueAsString = offlineValue.toString(); + sb.append("offline=").append(urlEncode(offlineValueAsString)).append(""); + Object tradeDecimalValue = getTradeDecimal(); + String tradeDecimalValueAsString = ""; + tradeDecimalValueAsString = tradeDecimalValue.toString(); + sb.append("tradeDecimal=").append(urlEncode(tradeDecimalValueAsString)).append(""); + Object alphaIdValue = getAlphaId(); + String alphaIdValueAsString = ""; + alphaIdValueAsString = alphaIdValue.toString(); + sb.append("alphaId=").append(urlEncode(alphaIdValueAsString)).append(""); + Object offsellValue = getOffsell(); + String offsellValueAsString = ""; + offsellValueAsString = offsellValue.toString(); + sb.append("offsell=").append(urlEncode(offsellValueAsString)).append(""); + Object priceHigh24hValue = getPriceHigh24h(); + String priceHigh24hValueAsString = ""; + priceHigh24hValueAsString = priceHigh24hValue.toString(); + sb.append("priceHigh24h=").append(urlEncode(priceHigh24hValueAsString)).append(""); + Object priceLow24hValue = getPriceLow24h(); + String priceLow24hValueAsString = ""; + priceLow24hValueAsString = priceLow24hValue.toString(); + sb.append("priceLow24h=").append(urlEncode(priceLow24hValueAsString)).append(""); + Object count24hValue = getCount24h(); + String count24hValueAsString = ""; + count24hValueAsString = count24hValue.toString(); + sb.append("count24h=").append(urlEncode(count24hValueAsString)).append(""); + Object onlineTgeValue = getOnlineTge(); + String onlineTgeValueAsString = ""; + onlineTgeValueAsString = onlineTgeValue.toString(); + sb.append("onlineTge=").append(urlEncode(onlineTgeValueAsString)).append(""); + Object onlineAirdropValue = getOnlineAirdrop(); + String onlineAirdropValueAsString = ""; + onlineAirdropValueAsString = onlineAirdropValue.toString(); + sb.append("onlineAirdrop=").append(urlEncode(onlineAirdropValueAsString)).append(""); + Object scoreValue = getScore(); + String scoreValueAsString = ""; + scoreValueAsString = scoreValue.toString(); + sb.append("score=").append(urlEncode(scoreValueAsString)).append(""); + Object cexOffDisplayValue = getCexOffDisplay(); + String cexOffDisplayValueAsString = ""; + cexOffDisplayValueAsString = cexOffDisplayValue.toString(); + sb.append("cexOffDisplay=").append(urlEncode(cexOffDisplayValueAsString)).append(""); + Object stockStateValue = getStockState(); + String stockStateValueAsString = ""; + stockStateValueAsString = stockStateValue.toString(); + sb.append("stockState=").append(urlEncode(stockStateValueAsString)).append(""); + Object listingTimeValue = getListingTime(); + String listingTimeValueAsString = ""; + listingTimeValueAsString = listingTimeValue.toString(); + sb.append("listingTime=").append(urlEncode(listingTimeValueAsString)).append(""); + Object mulPointValue = getMulPoint(); + String mulPointValueAsString = ""; + mulPointValueAsString = mulPointValue.toString(); + sb.append("mulPoint=").append(urlEncode(mulPointValueAsString)).append(""); + Object bnExclusiveStateValue = getBnExclusiveState(); + String bnExclusiveStateValueAsString = ""; + bnExclusiveStateValueAsString = bnExclusiveStateValue.toString(); + sb.append("bnExclusiveState=").append(urlEncode(bnExclusiveStateValueAsString)).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("tokenId"); + openapiFields.add("chainId"); + openapiFields.add("chainIconUrl"); + openapiFields.add("chainName"); + openapiFields.add("contractAddress"); + openapiFields.add("name"); + openapiFields.add("symbol"); + openapiFields.add("iconUrl"); + openapiFields.add("price"); + openapiFields.add("percentChange24h"); + openapiFields.add("volume24h"); + openapiFields.add("marketCap"); + openapiFields.add("fdv"); + openapiFields.add("liquidity"); + openapiFields.add("totalSupply"); + openapiFields.add("circulatingSupply"); + openapiFields.add("holders"); + openapiFields.add("decimals"); + openapiFields.add("listingCex"); + openapiFields.add("hotTag"); + openapiFields.add("cexCoinName"); + openapiFields.add("canTransfer"); + openapiFields.add("denomination"); + openapiFields.add("offline"); + openapiFields.add("tradeDecimal"); + openapiFields.add("alphaId"); + openapiFields.add("offsell"); + openapiFields.add("priceHigh24h"); + openapiFields.add("priceLow24h"); + openapiFields.add("count24h"); + openapiFields.add("onlineTge"); + openapiFields.add("onlineAirdrop"); + openapiFields.add("score"); + openapiFields.add("cexOffDisplay"); + openapiFields.add("stockState"); + openapiFields.add("listingTime"); + openapiFields.add("mulPoint"); + openapiFields.add("bnExclusiveState"); + + // 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 TokenListResponseDataInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TokenListResponseDataInner.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in TokenListResponseDataInner is not" + + " found in the empty JSON string", + TokenListResponseDataInner.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + 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())); + } + if ((jsonObj.get("chainId") != null && !jsonObj.get("chainId").isJsonNull()) + && !jsonObj.get("chainId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `chainId` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("chainId").toString())); + } + if ((jsonObj.get("chainIconUrl") != null && !jsonObj.get("chainIconUrl").isJsonNull()) + && !jsonObj.get("chainIconUrl").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `chainIconUrl` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("chainIconUrl").toString())); + } + if ((jsonObj.get("chainName") != null && !jsonObj.get("chainName").isJsonNull()) + && !jsonObj.get("chainName").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `chainName` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("chainName").toString())); + } + if ((jsonObj.get("contractAddress") != null && !jsonObj.get("contractAddress").isJsonNull()) + && !jsonObj.get("contractAddress").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `contractAddress` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("contractAddress").toString())); + } + 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("symbol") != null && !jsonObj.get("symbol").isJsonNull()) + && !jsonObj.get("symbol").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `symbol` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("symbol").toString())); + } + if ((jsonObj.get("iconUrl") != null && !jsonObj.get("iconUrl").isJsonNull()) + && !jsonObj.get("iconUrl").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `iconUrl` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("iconUrl").toString())); + } + if ((jsonObj.get("price") != null && !jsonObj.get("price").isJsonNull()) + && !jsonObj.get("price").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `price` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("price").toString())); + } + if ((jsonObj.get("percentChange24h") != null + && !jsonObj.get("percentChange24h").isJsonNull()) + && !jsonObj.get("percentChange24h").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `percentChange24h` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("percentChange24h").toString())); + } + if ((jsonObj.get("volume24h") != null && !jsonObj.get("volume24h").isJsonNull()) + && !jsonObj.get("volume24h").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `volume24h` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("volume24h").toString())); + } + if ((jsonObj.get("marketCap") != null && !jsonObj.get("marketCap").isJsonNull()) + && !jsonObj.get("marketCap").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `marketCap` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("marketCap").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("liquidity") != null && !jsonObj.get("liquidity").isJsonNull()) + && !jsonObj.get("liquidity").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `liquidity` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("liquidity").toString())); + } + if ((jsonObj.get("totalSupply") != null && !jsonObj.get("totalSupply").isJsonNull()) + && !jsonObj.get("totalSupply").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `totalSupply` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("totalSupply").toString())); + } + if ((jsonObj.get("circulatingSupply") != null + && !jsonObj.get("circulatingSupply").isJsonNull()) + && !jsonObj.get("circulatingSupply").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `circulatingSupply` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("circulatingSupply").toString())); + } + if ((jsonObj.get("holders") != null && !jsonObj.get("holders").isJsonNull()) + && !jsonObj.get("holders").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `holders` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("holders").toString())); + } + if ((jsonObj.get("cexCoinName") != null && !jsonObj.get("cexCoinName").isJsonNull()) + && !jsonObj.get("cexCoinName").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `cexCoinName` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("cexCoinName").toString())); + } + if ((jsonObj.get("alphaId") != null && !jsonObj.get("alphaId").isJsonNull()) + && !jsonObj.get("alphaId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `alphaId` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("alphaId").toString())); + } + if ((jsonObj.get("priceHigh24h") != null && !jsonObj.get("priceHigh24h").isJsonNull()) + && !jsonObj.get("priceHigh24h").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `priceHigh24h` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("priceHigh24h").toString())); + } + if ((jsonObj.get("priceLow24h") != null && !jsonObj.get("priceLow24h").isJsonNull()) + && !jsonObj.get("priceLow24h").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `priceLow24h` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("priceLow24h").toString())); + } + if ((jsonObj.get("count24h") != null && !jsonObj.get("count24h").isJsonNull()) + && !jsonObj.get("count24h").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `count24h` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("count24h").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TokenListResponseDataInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TokenListResponseDataInner' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(TokenListResponseDataInner.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, TokenListResponseDataInner value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public TokenListResponseDataInner read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of TokenListResponseDataInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of TokenListResponseDataInner + * @throws IOException if the JSON string is invalid with respect to TokenListResponseDataInner + */ + public static TokenListResponseDataInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TokenListResponseDataInner.class); + } + + /** + * Convert an instance of TokenListResponseDataInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/alpha/src/test/java/com/binance/connector/client/alpha/rest/api/MarketDataApiTest.java b/clients/alpha/src/test/java/com/binance/connector/client/alpha/rest/api/MarketDataApiTest.java new file mode 100644 index 000000000..020cc7745 --- /dev/null +++ b/clients/alpha/src/test/java/com/binance/connector/client/alpha/rest/api/MarketDataApiTest.java @@ -0,0 +1,211 @@ +/* + * Binance Alpha REST API + * OpenAPI Specification for the Binance Alpha REST API + * + * 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.alpha.rest.api; + +import static org.junit.Assert.assertEquals; + +import com.binance.connector.client.alpha.rest.model.AggregatedTradesResponse; +import com.binance.connector.client.alpha.rest.model.GetExchangeInfoResponse; +import com.binance.connector.client.alpha.rest.model.KlinesResponse; +import com.binance.connector.client.alpha.rest.model.TickerResponse; +import com.binance.connector.client.alpha.rest.model.TokenListResponse; +import com.binance.connector.client.common.ApiClient; +import com.binance.connector.client.common.ApiException; +import com.binance.connector.client.common.ApiResponse; +import com.binance.connector.client.common.auth.BinanceAuthenticationFactory; +import com.binance.connector.client.common.auth.SignatureAuthentication; +import com.binance.connector.client.common.configuration.ClientConfiguration; +import com.binance.connector.client.common.configuration.SignatureConfiguration; +import com.binance.connector.client.common.sign.HmacSignatureGenerator; +import com.binance.connector.client.common.sign.SignatureGenerator; +import jakarta.validation.constraints.*; +import okhttp3.Call; +import okhttp3.Request; +import org.bouncycastle.crypto.CryptoException; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; + +/** API tests for MarketDataApi */ +public class MarketDataApiTest { + + private MarketDataApi api; + private ApiClient apiClientSpy; + private SignatureGenerator signatureGeneratorSpy; + + @BeforeEach + public void initApiClient() throws ApiException { + ClientConfiguration clientConfiguration = new ClientConfiguration(); + clientConfiguration.setUrl("http://localhost:8080"); + SignatureConfiguration signatureConfiguration = new SignatureConfiguration(); + signatureConfiguration.setApiKey("apiKey"); + signatureConfiguration.setSecretKey("secretKey"); + clientConfiguration.setSignatureConfiguration(signatureConfiguration); + + HmacSignatureGenerator signatureGenerator = + new HmacSignatureGenerator(signatureConfiguration.getSecretKey()); + signatureGeneratorSpy = Mockito.spy(signatureGenerator); + SignatureAuthentication signatureAuthentication = + new SignatureAuthentication( + signatureConfiguration.getApiKey(), signatureGeneratorSpy); + SignatureAuthentication authenticationSpy = Mockito.spy(signatureAuthentication); + Mockito.doReturn("1736393892000").when(authenticationSpy).buildTimestamp(); + + BinanceAuthenticationFactory factoryMock = Mockito.mock(BinanceAuthenticationFactory.class); + Mockito.doReturn(authenticationSpy) + .when(factoryMock) + .getAuthentication(signatureConfiguration); + + ApiClient apiClient = new ApiClient(clientConfiguration, factoryMock); + + apiClientSpy = Mockito.spy(apiClient); + Mockito.doReturn(new ApiResponse<>(200, null)) + .when(apiClientSpy) + .execute(Mockito.any(), Mockito.any(java.lang.reflect.Type.class)); + Mockito.doReturn(new ApiResponse<>(200, null)).when(apiClientSpy).execute(Mockito.any()); + Mockito.doReturn("1736393892000").when(apiClientSpy).buildTimestamp(); + + api = new MarketDataApi(apiClientSpy); + } + + /** + * Aggregated Trades + * + *

Retrieves compressed, aggregated historical trades for a specific symbol. Useful for + * recent trade history. Weight: 0 + * + * @throws ApiException if the Api call fails + */ + @Test + public void aggregatedTradesTest() throws ApiException, CryptoException { + String symbol = ""; + Long fromId = 1L; + Long startTime = 1623319461670L; + Long endTime = 1641782889000L; + Long limit = 500L; + ApiResponse response = + api.aggregatedTrades(symbol, fromId, startTime, endTime, limit); + + ArgumentCaptor callArgumentCaptor = ArgumentCaptor.forClass(Call.class); + Mockito.verify(apiClientSpy) + .execute(callArgumentCaptor.capture(), Mockito.any(java.lang.reflect.Type.class)); + + Call captorValue = callArgumentCaptor.getValue(); + Request actualRequest = captorValue.request(); + + assertEquals( + null, actualRequest.url().queryParameter("signature")); + assertEquals("/bapi/defi/v1/public/alpha-trade/agg-trades", actualRequest.url().encodedPath()); + } + + /** + * Get Exchange Info + * + *

Fetches general exchange information, such as supported symbols, rate limits, and server + * time. Weight: 0 + * + * @throws ApiException if the Api call fails + */ + @Test + public void getExchangeInfoTest() throws ApiException, CryptoException { + ApiResponse response = api.getExchangeInfo(); + + ArgumentCaptor callArgumentCaptor = ArgumentCaptor.forClass(Call.class); + Mockito.verify(apiClientSpy) + .execute(callArgumentCaptor.capture(), Mockito.any(java.lang.reflect.Type.class)); + + Call captorValue = callArgumentCaptor.getValue(); + Request actualRequest = captorValue.request(); + + assertEquals( + null, actualRequest.url().queryParameter("signature")); + assertEquals("/bapi/defi/v1/public/alpha-trade/get-exchange-info", actualRequest.url().encodedPath()); + } + + /** + * Klines (Candlestick Data) + * + *

Fetches Kline/candlestick bars for a symbol, which include open/high/low/close prices and + * volume over intervals. Useful for charting and analysis. Weight: 0 + * + * @throws ApiException if the Api call fails + */ + @Test + public void klinesTest() throws ApiException, CryptoException { + String symbol = ""; + String interval = ""; + Long limit = 500L; + Long startTime = 1623319461670L; + Long endTime = 1641782889000L; + ApiResponse response = + api.klines(symbol, interval, limit, startTime, endTime); + + ArgumentCaptor callArgumentCaptor = ArgumentCaptor.forClass(Call.class); + Mockito.verify(apiClientSpy) + .execute(callArgumentCaptor.capture(), Mockito.any(java.lang.reflect.Type.class)); + + Call captorValue = callArgumentCaptor.getValue(); + Request actualRequest = captorValue.request(); + + assertEquals(null, actualRequest.url().queryParameter("signature")); + assertEquals("/bapi/defi/v1/public/alpha-trade/klines", actualRequest.url().encodedPath()); + } + + /** + * Ticker (24hr Price Statistics) + * + *

Gets the 24-hour rolling window price change statistics for a symbol, including volume and + * price changes. Weight: 0 + * + * @throws ApiException if the Api call fails + */ + @Test + public void tickerTest() throws ApiException, CryptoException { + String symbol = ""; + ApiResponse response = api.ticker(symbol); + + ArgumentCaptor callArgumentCaptor = ArgumentCaptor.forClass(Call.class); + Mockito.verify(apiClientSpy) + .execute(callArgumentCaptor.capture(), Mockito.any(java.lang.reflect.Type.class)); + + Call captorValue = callArgumentCaptor.getValue(); + Request actualRequest = captorValue.request(); + + assertEquals(null, actualRequest.url().queryParameter("signature")); + assertEquals("/bapi/defi/v1/public/alpha-trade/ticker", actualRequest.url().encodedPath()); + } + + /** + * Token List + * + *

Retrieves a list of all available ALPHA tokens, including their IDs and symbols. Use this + * to find the token ID for constructing symbols in other endpoints. Weight: 0 + * + * @throws ApiException if the Api call fails + */ + @Test + public void tokenListTest() throws ApiException, CryptoException { + ApiResponse response = api.tokenList(); + + ArgumentCaptor callArgumentCaptor = ArgumentCaptor.forClass(Call.class); + Mockito.verify(apiClientSpy) + .execute(callArgumentCaptor.capture(), Mockito.any(java.lang.reflect.Type.class)); + + Call captorValue = callArgumentCaptor.getValue(); + Request actualRequest = captorValue.request(); + + assertEquals(null, actualRequest.url().queryParameter("signature")); + assertEquals("/bapi/defi/v1/public/wallet-direct/buw/wallet/cex/alpha/all/token/list", actualRequest.url().encodedPath()); + } +} diff --git a/clients/pom.xml b/clients/pom.xml index fbef24eb3..5a5d9feb8 100644 --- a/clients/pom.xml +++ b/clients/pom.xml @@ -17,6 +17,7 @@ algo + alpha c2c convert common diff --git a/examples/alpha/pom.xml b/examples/alpha/pom.xml new file mode 100644 index 000000000..95581b08b --- /dev/null +++ b/examples/alpha/pom.xml @@ -0,0 +1,37 @@ + + + + 4.0.0 + binance-alpha-examples + alpha + 1.0.0 + jar + + + io.github.binance + binance-connector-java-examples + 1.0.0 + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + -parameters + + + + + + + + io.github.binance + binance-alpha + 1.0.0 + + + \ No newline at end of file diff --git a/examples/alpha/src/main/java/com/binance/connector/client/alpha/rest/marketdata/AggregatedTradesExample.java b/examples/alpha/src/main/java/com/binance/connector/client/alpha/rest/marketdata/AggregatedTradesExample.java new file mode 100644 index 000000000..5c3c25a99 --- /dev/null +++ b/examples/alpha/src/main/java/com/binance/connector/client/alpha/rest/marketdata/AggregatedTradesExample.java @@ -0,0 +1,61 @@ +/* + * Binance Spot REST API + * OpenAPI Specifications for the Binance Spot REST API API documents: - [Github rest-api documentation file](https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md) - [General API information for rest-api on website](https://developers.binance.com/docs/binance-spot-api-docs/rest-api/general-api-information) + * + * 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.alpha.rest.marketdata; + +import com.binance.connector.client.alpha.rest.AlphaRestApiUtil; +import com.binance.connector.client.alpha.rest.api.AlphaRestApi; +import com.binance.connector.client.alpha.rest.model.AggregatedTradesResponse; +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; + +/** API examples for MarketDataApi */ +public class AggregatedTradesExample { + private AlphaRestApi api; + + public AlphaRestApi getApi() { + if (api == null) { + ClientConfiguration clientConfiguration = AlphaRestApiUtil.getClientConfiguration(); +// SignatureConfiguration signatureConfiguration = new SignatureConfiguration(); +// signatureConfiguration.setApiKey("apiKey"); +// signatureConfiguration.setPrivateKey("path/to/private.key"); +// clientConfiguration.setSignatureConfiguration(signatureConfiguration); + api = new AlphaRestApi(clientConfiguration); + } + return api; + } + + /** + * Aggregated Trades + * + *

Retrieves compressed, aggregated historical trades for a specific symbol. Useful for + * recent trade history. Weight: 0 + * + * @throws ApiException if the Api call fails + */ + public void aggregatedTradesExample() throws ApiException { + String symbol = "ALPHA_118USDC"; + Long fromId = null; + Long startTime = null; + Long endTime = null; + Long limit = 500L; + ApiResponse response = + getApi().aggregatedTrades(symbol, fromId, startTime, endTime, limit); + System.out.println(response.getData()); + } + + public static void main(String[] args) { + new AggregatedTradesExample().aggregatedTradesExample(); + } +} diff --git a/examples/alpha/src/main/java/com/binance/connector/client/alpha/rest/marketdata/GetExchangeInfoExample.java b/examples/alpha/src/main/java/com/binance/connector/client/alpha/rest/marketdata/GetExchangeInfoExample.java new file mode 100644 index 000000000..ee3b50329 --- /dev/null +++ b/examples/alpha/src/main/java/com/binance/connector/client/alpha/rest/marketdata/GetExchangeInfoExample.java @@ -0,0 +1,51 @@ +/* + * Binance Spot REST API + * OpenAPI Specifications for the Binance Spot REST API API documents: - [Github rest-api documentation file](https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md) - [General API information for rest-api on website](https://developers.binance.com/docs/binance-spot-api-docs/rest-api/general-api-information) + * + * 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.alpha.rest.marketdata; + +import com.binance.connector.client.alpha.rest.AlphaRestApiUtil; +import com.binance.connector.client.alpha.rest.api.AlphaRestApi; +import com.binance.connector.client.alpha.rest.model.GetExchangeInfoResponse; +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; + +/** API examples for MarketDataApi */ +public class GetExchangeInfoExample { + private AlphaRestApi api; + + public AlphaRestApi getApi() { + if (api == null) { + ClientConfiguration clientConfiguration = AlphaRestApiUtil.getClientConfiguration(); + SignatureConfiguration signatureConfiguration = new SignatureConfiguration(); + signatureConfiguration.setApiKey("apiKey"); + signatureConfiguration.setPrivateKey("path/to/private.key"); + clientConfiguration.setSignatureConfiguration(signatureConfiguration); + api = new AlphaRestApi(clientConfiguration); + } + return api; + } + + /** + * Get Exchange Info + * + *

Fetches general exchange information, such as supported symbols, rate limits, and server + * time. Weight: 0 + * + * @throws ApiException if the Api call fails + */ + public void getExchangeInfoExample() throws ApiException { + ApiResponse response = getApi().getExchangeInfo(); + System.out.println(response.getData()); + } +} diff --git a/examples/alpha/src/main/java/com/binance/connector/client/alpha/rest/marketdata/KlinesExample.java b/examples/alpha/src/main/java/com/binance/connector/client/alpha/rest/marketdata/KlinesExample.java new file mode 100644 index 000000000..f8f451ab7 --- /dev/null +++ b/examples/alpha/src/main/java/com/binance/connector/client/alpha/rest/marketdata/KlinesExample.java @@ -0,0 +1,57 @@ +/* + * Binance Spot REST API + * OpenAPI Specifications for the Binance Spot REST API API documents: - [Github rest-api documentation file](https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md) - [General API information for rest-api on website](https://developers.binance.com/docs/binance-spot-api-docs/rest-api/general-api-information) + * + * 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.alpha.rest.marketdata; + +import com.binance.connector.client.alpha.rest.AlphaRestApiUtil; +import com.binance.connector.client.alpha.rest.api.AlphaRestApi; +import com.binance.connector.client.alpha.rest.model.KlinesResponse; +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; + +/** API examples for MarketDataApi */ +public class KlinesExample { + private AlphaRestApi api; + + public AlphaRestApi getApi() { + if (api == null) { + ClientConfiguration clientConfiguration = AlphaRestApiUtil.getClientConfiguration(); + SignatureConfiguration signatureConfiguration = new SignatureConfiguration(); + signatureConfiguration.setApiKey("apiKey"); + signatureConfiguration.setPrivateKey("path/to/private.key"); + clientConfiguration.setSignatureConfiguration(signatureConfiguration); + api = new AlphaRestApi(clientConfiguration); + } + return api; + } + + /** + * Klines (Candlestick Data) + * + *

Fetches Kline/candlestick bars for a symbol, which include open/high/low/close prices and + * volume over intervals. Useful for charting and analysis. Weight: 0 + * + * @throws ApiException if the Api call fails + */ + public void klinesExample() throws ApiException { + String symbol = ""; + String interval = ""; + Long limit = 500L; + Long startTime = 1623319461670L; + Long endTime = 1641782889000L; + ApiResponse response = + getApi().klines(symbol, interval, limit, startTime, endTime); + System.out.println(response.getData()); + } +} diff --git a/examples/alpha/src/main/java/com/binance/connector/client/alpha/rest/marketdata/TickerExample.java b/examples/alpha/src/main/java/com/binance/connector/client/alpha/rest/marketdata/TickerExample.java new file mode 100644 index 000000000..94ef6ccdd --- /dev/null +++ b/examples/alpha/src/main/java/com/binance/connector/client/alpha/rest/marketdata/TickerExample.java @@ -0,0 +1,52 @@ +/* + * Binance Spot REST API + * OpenAPI Specifications for the Binance Spot REST API API documents: - [Github rest-api documentation file](https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md) - [General API information for rest-api on website](https://developers.binance.com/docs/binance-spot-api-docs/rest-api/general-api-information) + * + * 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.alpha.rest.marketdata; + +import com.binance.connector.client.alpha.rest.AlphaRestApiUtil; +import com.binance.connector.client.alpha.rest.api.AlphaRestApi; +import com.binance.connector.client.alpha.rest.model.TickerResponse; +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; + +/** API examples for MarketDataApi */ +public class TickerExample { + private AlphaRestApi api; + + public AlphaRestApi getApi() { + if (api == null) { + ClientConfiguration clientConfiguration = AlphaRestApiUtil.getClientConfiguration(); + SignatureConfiguration signatureConfiguration = new SignatureConfiguration(); + signatureConfiguration.setApiKey("apiKey"); + signatureConfiguration.setPrivateKey("path/to/private.key"); + clientConfiguration.setSignatureConfiguration(signatureConfiguration); + api = new AlphaRestApi(clientConfiguration); + } + return api; + } + + /** + * Ticker (24hr Price Statistics) + * + *

Gets the 24-hour rolling window price change statistics for a symbol, including volume and + * price changes. Weight: 0 + * + * @throws ApiException if the Api call fails + */ + public void tickerExample() throws ApiException { + String symbol = ""; + ApiResponse response = getApi().ticker(symbol); + System.out.println(response.getData()); + } +} diff --git a/examples/alpha/src/main/java/com/binance/connector/client/alpha/rest/marketdata/TokenListExample.java b/examples/alpha/src/main/java/com/binance/connector/client/alpha/rest/marketdata/TokenListExample.java new file mode 100644 index 000000000..1e83999e4 --- /dev/null +++ b/examples/alpha/src/main/java/com/binance/connector/client/alpha/rest/marketdata/TokenListExample.java @@ -0,0 +1,51 @@ +/* + * Binance Spot REST API + * OpenAPI Specifications for the Binance Spot REST API API documents: - [Github rest-api documentation file](https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md) - [General API information for rest-api on website](https://developers.binance.com/docs/binance-spot-api-docs/rest-api/general-api-information) + * + * 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.alpha.rest.marketdata; + +import com.binance.connector.client.alpha.rest.AlphaRestApiUtil; +import com.binance.connector.client.alpha.rest.api.AlphaRestApi; +import com.binance.connector.client.alpha.rest.model.TokenListResponse; +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; + +/** API examples for MarketDataApi */ +public class TokenListExample { + private AlphaRestApi api; + + public AlphaRestApi getApi() { + if (api == null) { + ClientConfiguration clientConfiguration = AlphaRestApiUtil.getClientConfiguration(); + SignatureConfiguration signatureConfiguration = new SignatureConfiguration(); + signatureConfiguration.setApiKey("apiKey"); + signatureConfiguration.setPrivateKey("path/to/private.key"); + clientConfiguration.setSignatureConfiguration(signatureConfiguration); + api = new AlphaRestApi(clientConfiguration); + } + return api; + } + + /** + * Token List + * + *

Retrieves a list of all available ALPHA tokens, including their IDs and symbols. Use this + * to find the token ID for constructing symbols in other endpoints. Weight: 0 + * + * @throws ApiException if the Api call fails + */ + public void tokenListExample() throws ApiException { + ApiResponse response = getApi().tokenList(); + System.out.println(response.getData()); + } +} diff --git a/examples/pom.xml b/examples/pom.xml index 9c5ada716..3f7dc25fc 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -16,6 +16,7 @@ algo + alpha c2c convert copy-trading