From 9ba11f8db4cd5264faf9992dcb6c9193ad42a22d Mon Sep 17 00:00:00 2001 From: theo-s68 <194042188+theo-s68@users.noreply.github.com> Date: Fri, 26 Jun 2026 14:54:47 +0700 Subject: [PATCH] w3w-prediction v1.0.0 --- README.md | 3 + clients/pom.xml | 1 + clients/w3w-prediction/CHANGELOG.md | 5 + clients/w3w-prediction/README.md | 163 ++ clients/w3w-prediction/docs/AccountType.md | 13 + .../docs/BatchCancelOrdersRequest.md | 15 + .../docs/BatchCancelOrdersResponse.md | 14 + .../BatchCancelOrdersResponseFailedInner.md | 14 + .../w3w-prediction/docs/BatchRedeemRequest.md | 16 + .../docs/BatchRedeemResponse.md | 14 + .../docs/BatchRedeemResponseResultsInner.md | 16 + clients/w3w-prediction/docs/CancelInfoList.md | 13 + .../docs/CancelInfoListInner.md | 13 + .../docs/CreateInboundTransferRequest.md | 19 + .../docs/CreateInboundTransferResponse.md | 14 + .../docs/CreateOutboundTransferRequest.md | 20 + .../docs/CreateOutboundTransferResponse.md | 14 + clients/w3w-prediction/docs/Direction.md | 13 + clients/w3w-prediction/docs/FundingSource.md | 13 + .../docs/GetMarketDetailResponse.md | 37 + .../GetMarketDetailResponseMarketsInner.md | 24 + ...DetailResponseMarketsInnerOutcomesInner.md | 17 + .../GetMarketDetailResponseTimelineInner.md | 15 + .../GetMarketDetailResponseVariantData.md | 18 + .../docs/GetPortfolioResponse.md | 21 + .../GetPortfolioResponsePositionsInner.md | 26 + .../docs/GetPositionByTokenResponse.md | 13 + .../GetPositionByTokenResponsePosition.md | 36 + .../docs/GetQuotaStatusResponse.md | 14 + .../w3w-prediction/docs/GetQuoteRequest.md | 23 + .../w3w-prediction/docs/GetQuoteResponse.md | 37 + .../docs/GetRedeemStatusResponse.md | 14 + .../docs/ListPredictionCategoriesResponse.md | 13 + ...ictionCategoriesResponseCategoriesInner.md | 17 + ...sponseCategoriesInnerSubcategoriesInner.md | 16 + .../docs/ListPredictionMarketsResponse.md | 17 + ...dictionMarketsResponseMarketTopicsInner.md | 35 + .../docs/ListPredictionWalletsResponse.md | 13 + ...stPredictionWalletsResponseWalletsInner.md | 15 + clients/w3w-prediction/docs/MarketDataApi.md | 398 +++++ .../docs/MarketSearchResponse.md | 12 + .../docs/MarketSearchResponseInner.md | 30 + clients/w3w-prediction/docs/OrderBy.md | 13 + clients/w3w-prediction/docs/OrderType.md | 13 + .../w3w-prediction/docs/PlaceOrderRequest.md | 22 + .../w3w-prediction/docs/PlaceOrderResponse.md | 13 + clients/w3w-prediction/docs/PositionApi.md | 363 +++++ .../docs/QueryActiveOrdersResponse.md | 16 + .../QueryActiveOrdersResponseOrdersInner.md | 35 + .../docs/QueryLastTradePriceResponse.md | 14 + .../docs/QueryOrderBookResponse.md | 17 + .../docs/QueryOrderBookResponseAsksInner.md | 14 + .../docs/QueryOrderBookResponseBidsInner.md | 14 + .../docs/QueryOrderHistoryResponse.md | 16 + .../QueryOrderHistoryResponseOrdersInner.md | 36 + .../QueryPaymentOptionBalancesResponse.md | 13 + ...PaymentOptionBalancesResponseItemsInner.md | 15 + .../w3w-prediction/docs/QueryPnLResponse.md | 20 + .../docs/QueryPositionsByFilterResponse.md | 13 + ...PositionsByFilterResponsePositionsInner.md | 36 + .../docs/QueryPositionsResponse.md | 15 + .../docs/QueryPositionsResponseCounts.md | 15 + .../QueryPositionsResponsePositionsInner.md | 39 + .../docs/QueryPositionsResponseSummary.md | 19 + .../QuerySettledPositionHistoryResponse.md | 14 + ...edPositionHistoryResponsePositionsInner.md | 41 + .../docs/QueryTransferListResponse.md | 13 + ...QueryTransferListResponseTransfersInner.md | 25 + .../docs/QueryTransferStatusResponse.md | 23 + clients/w3w-prediction/docs/RedeemApi.md | 138 ++ clients/w3w-prediction/docs/Side.md | 13 + clients/w3w-prediction/docs/SortBy.md | 19 + clients/w3w-prediction/docs/SourceBiz.md | 13 + clients/w3w-prediction/docs/TokenIds.md | 13 + clients/w3w-prediction/docs/TradeApi.md | 351 +++++ clients/w3w-prediction/docs/TradeSide.md | 13 + clients/w3w-prediction/docs/TransferApi.md | 276 ++++ clients/w3w-prediction/docs/WalletApi.md | 270 ++++ .../docs/rest-api/certificate-pinning.md | 31 + .../docs/rest-api/compression.md | 20 + .../docs/rest-api/error-handling.md | 16 + .../docs/rest-api/key-pair-authentication.md | 20 + .../docs/rest-api/migration-guide.md | 144 ++ clients/w3w-prediction/docs/rest-api/proxy.md | 45 + .../w3w-prediction/docs/rest-api/retries.md | 25 + .../w3w-prediction/docs/rest-api/timeout.md | 25 + clients/w3w-prediction/example_rest.md | 64 + clients/w3w-prediction/pom.xml | 37 + .../client/w3w_prediction/rest/JSON.java | 591 +++++++ .../rest/W3WPredictionRestApiUtil.java | 25 + .../rest/api/MarketDataApi.java | 968 ++++++++++++ .../w3w_prediction/rest/api/PositionApi.java | 1005 ++++++++++++ .../w3w_prediction/rest/api/RedeemApi.java | 389 +++++ .../w3w_prediction/rest/api/TradeApi.java | 1070 +++++++++++++ .../w3w_prediction/rest/api/TransferApi.java | 811 ++++++++++ .../rest/api/W3WPredictionRestApi.java | 866 +++++++++++ .../w3w_prediction/rest/api/WalletApi.java | 685 ++++++++ .../rest/model/AccountType.java | 73 + .../rest/model/BatchCancelOrdersRequest.java | 299 ++++ .../rest/model/BatchCancelOrdersResponse.java | 297 ++++ .../BatchCancelOrdersResponseFailedInner.java | 260 ++++ .../rest/model/BatchRedeemRequest.java | 338 ++++ .../rest/model/BatchRedeemResponse.java | 281 ++++ .../BatchRedeemResponseResultsInner.java | 355 +++++ .../rest/model/CancelInfoList.java | 181 +++ .../rest/model/CancelInfoListInner.java | 221 +++ .../model/CreateInboundTransferRequest.java | 472 ++++++ .../model/CreateInboundTransferResponse.java | 257 +++ .../model/CreateOutboundTransferRequest.java | 518 +++++++ .../model/CreateOutboundTransferResponse.java | 257 +++ .../w3w_prediction/rest/model/Direction.java | 73 + .../rest/model/FundingSource.java | 73 + .../rest/model/GetMarketDetailResponse.java | 1194 ++++++++++++++ .../GetMarketDetailResponseMarketsInner.java | 700 +++++++++ ...tailResponseMarketsInnerOutcomesInner.java | 387 +++++ .../GetMarketDetailResponseTimelineInner.java | 278 ++++ .../GetMarketDetailResponseVariantData.java | 448 ++++++ .../rest/model/GetPortfolioResponse.java | 583 +++++++ .../GetPortfolioResponsePositionsInner.java | 736 +++++++++ .../model/GetPositionByTokenResponse.java | 211 +++ .../GetPositionByTokenResponsePosition.java | 1131 ++++++++++++++ .../rest/model/GetQuotaStatusResponse.java | 257 +++ .../rest/model/GetQuoteRequest.java | 624 ++++++++ .../rest/model/GetQuoteResponse.java | 1146 ++++++++++++++ .../rest/model/GetRedeemStatusResponse.java | 251 +++ .../ListPredictionCategoriesResponse.java | 251 +++ ...tionCategoriesResponseCategoriesInner.java | 423 +++++ ...onseCategoriesInnerSubcategoriesInner.java | 361 +++++ .../model/ListPredictionMarketsResponse.java | 379 +++++ ...ctionMarketsResponseMarketTopicsInner.java | 1132 ++++++++++++++ .../model/ListPredictionWalletsResponse.java | 251 +++ ...PredictionWalletsResponseWalletsInner.java | 299 ++++ .../rest/model/MarketSearchResponse.java | 182 +++ .../rest/model/MarketSearchResponseInner.java | 896 +++++++++++ .../w3w_prediction/rest/model/OrderBy.java | 73 + .../w3w_prediction/rest/model/OrderType.java | 73 + .../rest/model/PlaceOrderRequest.java | 590 +++++++ .../rest/model/PlaceOrderResponse.java | 210 +++ .../rest/model/QueryActiveOrdersResponse.java | 340 ++++ .../QueryActiveOrdersResponseOrdersInner.java | 1119 +++++++++++++ .../model/QueryLastTradePriceResponse.java | 245 +++ .../rest/model/QueryOrderBookResponse.java | 418 +++++ .../QueryOrderBookResponseAsksInner.java | 256 +++ .../QueryOrderBookResponseBidsInner.java | 256 +++ .../rest/model/QueryOrderHistoryResponse.java | 340 ++++ .../QueryOrderHistoryResponseOrdersInner.java | 1154 ++++++++++++++ .../QueryPaymentOptionBalancesResponse.java | 253 +++ ...ymentOptionBalancesResponseItemsInner.java | 309 ++++ .../rest/model/QueryPnLResponse.java | 538 +++++++ .../model/QueryPositionsByFilterResponse.java | 251 +++ ...sitionsByFilterResponsePositionsInner.java | 1164 ++++++++++++++ .../rest/model/QueryPositionsResponse.java | 321 ++++ .../model/QueryPositionsResponseCounts.java | 277 ++++ .../QueryPositionsResponsePositionsInner.java | 1266 +++++++++++++++ .../model/QueryPositionsResponseSummary.java | 489 ++++++ .../QuerySettledPositionHistoryResponse.java | 286 ++++ ...PositionHistoryResponsePositionsInner.java | 1378 +++++++++++++++++ .../rest/model/QueryTransferListResponse.java | 246 +++ ...eryTransferListResponseTransfersInner.java | 753 +++++++++ .../model/QueryTransferStatusResponse.java | 644 ++++++++ .../w3w_prediction/rest/model/Side.java | 72 + .../w3w_prediction/rest/model/SortBy.java | 79 + .../w3w_prediction/rest/model/SourceBiz.java | 73 + .../w3w_prediction/rest/model/TokenIds.java | 190 +++ .../w3w_prediction/rest/model/TradeSide.java | 73 + .../rest/api/MarketDataApiTest.java | 270 ++++ .../rest/api/PositionApiTest.java | 266 ++++ .../rest/api/RedeemApiTest.java | 150 ++ .../w3w_prediction/rest/api/TradeApiTest.java | 306 ++++ .../rest/api/TransferApiTest.java | 246 +++ .../rest/api/WalletApiTest.java | 208 +++ examples/pom.xml | 1 + examples/w3w-prediction/pom.xml | 37 + .../marketdata/GetMarketDetailExample.java | 41 + .../ListPredictionCategoriesExample.java | 40 + .../ListPredictionMarketsExample.java | 50 + .../rest/marketdata/MarketSearchExample.java | 41 + .../QueryLastTradePriceExample.java | 40 + .../marketdata/QueryOrderBookExample.java | 44 + .../position/GetPositionByTokenExample.java | 44 + .../rest/position/QueryPnLExample.java | 54 + .../QueryPositionsByFilterExample.java | 44 + .../rest/position/QueryPositionsExample.java | 46 + .../QuerySettledPositionHistoryExample.java | 57 + .../rest/redeem/BatchRedeemExample.java | 46 + .../rest/redeem/GetRedeemStatusExample.java | 48 + .../rest/trade/BatchCancelOrdersExample.java | 60 + .../rest/trade/GetQuoteExample.java | 58 + .../rest/trade/PlaceOrderExample.java | 54 + .../rest/trade/QueryActiveOrdersExample.java | 56 + .../rest/trade/QueryOrderHistoryExample.java | 60 + .../CreateInboundTransferExample.java | 52 + .../CreateOutboundTransferExample.java | 51 + .../transfer/QueryTransferListExample.java | 58 + .../transfer/QueryTransferStatusExample.java | 46 + .../rest/wallet/GetPortfolioExample.java | 53 + .../rest/wallet/GetQuotaStatusExample.java | 41 + .../wallet/ListPredictionWalletsExample.java | 42 + .../QueryPaymentOptionBalancesExample.java | 42 + 199 files changed, 42647 insertions(+) create mode 100644 clients/w3w-prediction/CHANGELOG.md create mode 100644 clients/w3w-prediction/README.md create mode 100644 clients/w3w-prediction/docs/AccountType.md create mode 100644 clients/w3w-prediction/docs/BatchCancelOrdersRequest.md create mode 100644 clients/w3w-prediction/docs/BatchCancelOrdersResponse.md create mode 100644 clients/w3w-prediction/docs/BatchCancelOrdersResponseFailedInner.md create mode 100644 clients/w3w-prediction/docs/BatchRedeemRequest.md create mode 100644 clients/w3w-prediction/docs/BatchRedeemResponse.md create mode 100644 clients/w3w-prediction/docs/BatchRedeemResponseResultsInner.md create mode 100644 clients/w3w-prediction/docs/CancelInfoList.md create mode 100644 clients/w3w-prediction/docs/CancelInfoListInner.md create mode 100644 clients/w3w-prediction/docs/CreateInboundTransferRequest.md create mode 100644 clients/w3w-prediction/docs/CreateInboundTransferResponse.md create mode 100644 clients/w3w-prediction/docs/CreateOutboundTransferRequest.md create mode 100644 clients/w3w-prediction/docs/CreateOutboundTransferResponse.md create mode 100644 clients/w3w-prediction/docs/Direction.md create mode 100644 clients/w3w-prediction/docs/FundingSource.md create mode 100644 clients/w3w-prediction/docs/GetMarketDetailResponse.md create mode 100644 clients/w3w-prediction/docs/GetMarketDetailResponseMarketsInner.md create mode 100644 clients/w3w-prediction/docs/GetMarketDetailResponseMarketsInnerOutcomesInner.md create mode 100644 clients/w3w-prediction/docs/GetMarketDetailResponseTimelineInner.md create mode 100644 clients/w3w-prediction/docs/GetMarketDetailResponseVariantData.md create mode 100644 clients/w3w-prediction/docs/GetPortfolioResponse.md create mode 100644 clients/w3w-prediction/docs/GetPortfolioResponsePositionsInner.md create mode 100644 clients/w3w-prediction/docs/GetPositionByTokenResponse.md create mode 100644 clients/w3w-prediction/docs/GetPositionByTokenResponsePosition.md create mode 100644 clients/w3w-prediction/docs/GetQuotaStatusResponse.md create mode 100644 clients/w3w-prediction/docs/GetQuoteRequest.md create mode 100644 clients/w3w-prediction/docs/GetQuoteResponse.md create mode 100644 clients/w3w-prediction/docs/GetRedeemStatusResponse.md create mode 100644 clients/w3w-prediction/docs/ListPredictionCategoriesResponse.md create mode 100644 clients/w3w-prediction/docs/ListPredictionCategoriesResponseCategoriesInner.md create mode 100644 clients/w3w-prediction/docs/ListPredictionCategoriesResponseCategoriesInnerSubcategoriesInner.md create mode 100644 clients/w3w-prediction/docs/ListPredictionMarketsResponse.md create mode 100644 clients/w3w-prediction/docs/ListPredictionMarketsResponseMarketTopicsInner.md create mode 100644 clients/w3w-prediction/docs/ListPredictionWalletsResponse.md create mode 100644 clients/w3w-prediction/docs/ListPredictionWalletsResponseWalletsInner.md create mode 100644 clients/w3w-prediction/docs/MarketDataApi.md create mode 100644 clients/w3w-prediction/docs/MarketSearchResponse.md create mode 100644 clients/w3w-prediction/docs/MarketSearchResponseInner.md create mode 100644 clients/w3w-prediction/docs/OrderBy.md create mode 100644 clients/w3w-prediction/docs/OrderType.md create mode 100644 clients/w3w-prediction/docs/PlaceOrderRequest.md create mode 100644 clients/w3w-prediction/docs/PlaceOrderResponse.md create mode 100644 clients/w3w-prediction/docs/PositionApi.md create mode 100644 clients/w3w-prediction/docs/QueryActiveOrdersResponse.md create mode 100644 clients/w3w-prediction/docs/QueryActiveOrdersResponseOrdersInner.md create mode 100644 clients/w3w-prediction/docs/QueryLastTradePriceResponse.md create mode 100644 clients/w3w-prediction/docs/QueryOrderBookResponse.md create mode 100644 clients/w3w-prediction/docs/QueryOrderBookResponseAsksInner.md create mode 100644 clients/w3w-prediction/docs/QueryOrderBookResponseBidsInner.md create mode 100644 clients/w3w-prediction/docs/QueryOrderHistoryResponse.md create mode 100644 clients/w3w-prediction/docs/QueryOrderHistoryResponseOrdersInner.md create mode 100644 clients/w3w-prediction/docs/QueryPaymentOptionBalancesResponse.md create mode 100644 clients/w3w-prediction/docs/QueryPaymentOptionBalancesResponseItemsInner.md create mode 100644 clients/w3w-prediction/docs/QueryPnLResponse.md create mode 100644 clients/w3w-prediction/docs/QueryPositionsByFilterResponse.md create mode 100644 clients/w3w-prediction/docs/QueryPositionsByFilterResponsePositionsInner.md create mode 100644 clients/w3w-prediction/docs/QueryPositionsResponse.md create mode 100644 clients/w3w-prediction/docs/QueryPositionsResponseCounts.md create mode 100644 clients/w3w-prediction/docs/QueryPositionsResponsePositionsInner.md create mode 100644 clients/w3w-prediction/docs/QueryPositionsResponseSummary.md create mode 100644 clients/w3w-prediction/docs/QuerySettledPositionHistoryResponse.md create mode 100644 clients/w3w-prediction/docs/QuerySettledPositionHistoryResponsePositionsInner.md create mode 100644 clients/w3w-prediction/docs/QueryTransferListResponse.md create mode 100644 clients/w3w-prediction/docs/QueryTransferListResponseTransfersInner.md create mode 100644 clients/w3w-prediction/docs/QueryTransferStatusResponse.md create mode 100644 clients/w3w-prediction/docs/RedeemApi.md create mode 100644 clients/w3w-prediction/docs/Side.md create mode 100644 clients/w3w-prediction/docs/SortBy.md create mode 100644 clients/w3w-prediction/docs/SourceBiz.md create mode 100644 clients/w3w-prediction/docs/TokenIds.md create mode 100644 clients/w3w-prediction/docs/TradeApi.md create mode 100644 clients/w3w-prediction/docs/TradeSide.md create mode 100644 clients/w3w-prediction/docs/TransferApi.md create mode 100644 clients/w3w-prediction/docs/WalletApi.md create mode 100644 clients/w3w-prediction/docs/rest-api/certificate-pinning.md create mode 100644 clients/w3w-prediction/docs/rest-api/compression.md create mode 100644 clients/w3w-prediction/docs/rest-api/error-handling.md create mode 100644 clients/w3w-prediction/docs/rest-api/key-pair-authentication.md create mode 100644 clients/w3w-prediction/docs/rest-api/migration-guide.md create mode 100644 clients/w3w-prediction/docs/rest-api/proxy.md create mode 100644 clients/w3w-prediction/docs/rest-api/retries.md create mode 100644 clients/w3w-prediction/docs/rest-api/timeout.md create mode 100644 clients/w3w-prediction/example_rest.md create mode 100644 clients/w3w-prediction/pom.xml create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/JSON.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/W3WPredictionRestApiUtil.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/api/MarketDataApi.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/api/PositionApi.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/api/RedeemApi.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/api/TradeApi.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/api/TransferApi.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/api/W3WPredictionRestApi.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/api/WalletApi.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/AccountType.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/BatchCancelOrdersRequest.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/BatchCancelOrdersResponse.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/BatchCancelOrdersResponseFailedInner.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/BatchRedeemRequest.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/BatchRedeemResponse.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/BatchRedeemResponseResultsInner.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/CancelInfoList.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/CancelInfoListInner.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/CreateInboundTransferRequest.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/CreateInboundTransferResponse.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/CreateOutboundTransferRequest.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/CreateOutboundTransferResponse.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/Direction.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/FundingSource.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/GetMarketDetailResponse.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/GetMarketDetailResponseMarketsInner.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/GetMarketDetailResponseMarketsInnerOutcomesInner.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/GetMarketDetailResponseTimelineInner.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/GetMarketDetailResponseVariantData.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/GetPortfolioResponse.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/GetPortfolioResponsePositionsInner.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/GetPositionByTokenResponse.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/GetPositionByTokenResponsePosition.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/GetQuotaStatusResponse.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/GetQuoteRequest.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/GetQuoteResponse.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/GetRedeemStatusResponse.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/ListPredictionCategoriesResponse.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/ListPredictionCategoriesResponseCategoriesInner.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/ListPredictionCategoriesResponseCategoriesInnerSubcategoriesInner.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/ListPredictionMarketsResponse.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/ListPredictionMarketsResponseMarketTopicsInner.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/ListPredictionWalletsResponse.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/ListPredictionWalletsResponseWalletsInner.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/MarketSearchResponse.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/MarketSearchResponseInner.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/OrderBy.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/OrderType.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/PlaceOrderRequest.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/PlaceOrderResponse.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryActiveOrdersResponse.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryActiveOrdersResponseOrdersInner.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryLastTradePriceResponse.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryOrderBookResponse.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryOrderBookResponseAsksInner.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryOrderBookResponseBidsInner.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryOrderHistoryResponse.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryOrderHistoryResponseOrdersInner.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryPaymentOptionBalancesResponse.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryPaymentOptionBalancesResponseItemsInner.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryPnLResponse.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryPositionsByFilterResponse.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryPositionsByFilterResponsePositionsInner.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryPositionsResponse.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryPositionsResponseCounts.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryPositionsResponsePositionsInner.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryPositionsResponseSummary.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QuerySettledPositionHistoryResponse.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QuerySettledPositionHistoryResponsePositionsInner.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryTransferListResponse.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryTransferListResponseTransfersInner.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryTransferStatusResponse.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/Side.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/SortBy.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/SourceBiz.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/TokenIds.java create mode 100644 clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/TradeSide.java create mode 100644 clients/w3w-prediction/src/test/java/com/binance/connector/client/w3w_prediction/rest/api/MarketDataApiTest.java create mode 100644 clients/w3w-prediction/src/test/java/com/binance/connector/client/w3w_prediction/rest/api/PositionApiTest.java create mode 100644 clients/w3w-prediction/src/test/java/com/binance/connector/client/w3w_prediction/rest/api/RedeemApiTest.java create mode 100644 clients/w3w-prediction/src/test/java/com/binance/connector/client/w3w_prediction/rest/api/TradeApiTest.java create mode 100644 clients/w3w-prediction/src/test/java/com/binance/connector/client/w3w_prediction/rest/api/TransferApiTest.java create mode 100644 clients/w3w-prediction/src/test/java/com/binance/connector/client/w3w_prediction/rest/api/WalletApiTest.java create mode 100644 examples/w3w-prediction/pom.xml create mode 100644 examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/marketdata/GetMarketDetailExample.java create mode 100644 examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/marketdata/ListPredictionCategoriesExample.java create mode 100644 examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/marketdata/ListPredictionMarketsExample.java create mode 100644 examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/marketdata/MarketSearchExample.java create mode 100644 examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/marketdata/QueryLastTradePriceExample.java create mode 100644 examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/marketdata/QueryOrderBookExample.java create mode 100644 examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/position/GetPositionByTokenExample.java create mode 100644 examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/position/QueryPnLExample.java create mode 100644 examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/position/QueryPositionsByFilterExample.java create mode 100644 examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/position/QueryPositionsExample.java create mode 100644 examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/position/QuerySettledPositionHistoryExample.java create mode 100644 examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/redeem/BatchRedeemExample.java create mode 100644 examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/redeem/GetRedeemStatusExample.java create mode 100644 examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/trade/BatchCancelOrdersExample.java create mode 100644 examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/trade/GetQuoteExample.java create mode 100644 examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/trade/PlaceOrderExample.java create mode 100644 examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/trade/QueryActiveOrdersExample.java create mode 100644 examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/trade/QueryOrderHistoryExample.java create mode 100644 examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/transfer/CreateInboundTransferExample.java create mode 100644 examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/transfer/CreateOutboundTransferExample.java create mode 100644 examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/transfer/QueryTransferListExample.java create mode 100644 examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/transfer/QueryTransferStatusExample.java create mode 100644 examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/wallet/GetPortfolioExample.java create mode 100644 examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/wallet/GetQuotaStatusExample.java create mode 100644 examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/wallet/ListPredictionWalletsExample.java create mode 100644 examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/wallet/QueryPaymentOptionBalancesExample.java diff --git a/README.md b/README.md index 6c1fe7a69..8644c651f 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,7 @@ Before using the connectors, ensure you have: - [binance-staking](clients/staking) - Staking connector - [binance-sub-account](clients/sub-account) - Sub Account connector - [binance-vip-loan](clients/vip-loan) - VIP Loan connector +- [binance-w3w-prediction](clients/w3w-prediction) - W3W Prediction - [binance-wallet](clients/wallet) - Wallet connector ## Documentation @@ -255,6 +256,8 @@ When creating WebSocket API clients (such as SpotWebSocketApi), you can follow: **Vip Loan**: [Rest API](clients/vip-loan/example_rest.md) +**W3W Prediction**: [Rest API](clients/w3w-prediction/example_rest.md) + **Wallet**: [Rest API](clients/wallet/example_rest.md) ## License diff --git a/clients/pom.xml b/clients/pom.xml index 83404e479..219d1bcc0 100644 --- a/clients/pom.xml +++ b/clients/pom.xml @@ -41,6 +41,7 @@ staking sub-account vip-loan + w3w-prediction wallet diff --git a/clients/w3w-prediction/CHANGELOG.md b/clients/w3w-prediction/CHANGELOG.md new file mode 100644 index 000000000..dade2b628 --- /dev/null +++ b/clients/w3w-prediction/CHANGELOG.md @@ -0,0 +1,5 @@ +# Changelog + +## 1.0.0 - 2026-06-29 + +- Initial release \ No newline at end of file diff --git a/clients/w3w-prediction/README.md b/clients/w3w-prediction/README.md new file mode 100644 index 000000000..3f33c3a3e --- /dev/null +++ b/clients/w3w-prediction/README.md @@ -0,0 +1,163 @@ +# Binance Java W3W Prediction 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-w3w-prediction)](https://central.sonatype.com/artifact/io.github.binance/binance-w3w-prediction) +![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 W3W Prediction API, enabling developers to interact programmatically with Binance's W3W Prediction trading platform. The library provides tools to place and manage prediction market orders, query positions and transfer funds through the REST API: + +- [REST API](./src/main/java/com/binance/connector/client/w3w-prediction/rest/api) +- WebSocket API: Currently under development + +## 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: + - `/sapi/v1/w3w/wallet/prediction/*` +- 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-w3w-prediction + 1.0.0 + +``` + +## Documentation + +For detailed information, refer to the [Binance API Documentation](https://developers.binance.com/docs/w3w_prediction). + +### REST APIs + +All REST API endpoints are available through the [`rest`](./src/main/java/com/binance/connector/client/w3w_prediction/rest) module. Note that some endpoints require authentication using your Binance API credentials. + +```java +import com.binance.connector.client.w3w_prediction.rest.W3WPredictionRestApiUtil; +import com.binance.connector.client.w3w_prediction.rest.api.W3WPredictionRestApi; +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 = W3WPredictionRestApiUtil.getClientConfiguration(); + SignatureConfiguration signatureConfiguration = new SignatureConfiguration(); + signatureConfiguration.setApiKey("apiKey"); + signatureConfiguration.setPrivateKey("path/to/private.key"); + clientConfiguration.setSignatureConfiguration(signatureConfiguration); + W3WPredictionRestApi api = new W3WPredictionRestApi(clientConfiguration); +} +``` + +More examples can be found in the [`examples/rest`](./../../examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/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 w3w-predictionrithm +- `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 w3w-prediction 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/w3w-prediction/docs/AccountType.md b/clients/w3w-prediction/docs/AccountType.md new file mode 100644 index 000000000..3682523ce --- /dev/null +++ b/clients/w3w-prediction/docs/AccountType.md @@ -0,0 +1,13 @@ + + +# AccountType + +## Enum + + +* `SPOT` (value: `"SPOT"`) + +* `FUNDING` (value: `"FUNDING"`) + + + diff --git a/clients/w3w-prediction/docs/BatchCancelOrdersRequest.md b/clients/w3w-prediction/docs/BatchCancelOrdersRequest.md new file mode 100644 index 000000000..ba6677bfa --- /dev/null +++ b/clients/w3w-prediction/docs/BatchCancelOrdersRequest.md @@ -0,0 +1,15 @@ + + +# BatchCancelOrdersRequest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**walletAddress** | **String** | User's prediction wallet address | | +|**walletId** | **String** | Wallet ID | | +|**cancelInfoList** | **CancelInfoList** | | [optional] | + + + diff --git a/clients/w3w-prediction/docs/BatchCancelOrdersResponse.md b/clients/w3w-prediction/docs/BatchCancelOrdersResponse.md new file mode 100644 index 000000000..ce122201d --- /dev/null +++ b/clients/w3w-prediction/docs/BatchCancelOrdersResponse.md @@ -0,0 +1,14 @@ + + +# BatchCancelOrdersResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**canceled** | **List<String>** | | [optional] | +|**failed** | [**List<BatchCancelOrdersResponseFailedInner>**](BatchCancelOrdersResponseFailedInner.md) | | [optional] | + + + diff --git a/clients/w3w-prediction/docs/BatchCancelOrdersResponseFailedInner.md b/clients/w3w-prediction/docs/BatchCancelOrdersResponseFailedInner.md new file mode 100644 index 000000000..05b62b3c5 --- /dev/null +++ b/clients/w3w-prediction/docs/BatchCancelOrdersResponseFailedInner.md @@ -0,0 +1,14 @@ + + +# BatchCancelOrdersResponseFailedInner + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**orderId** | **String** | | [optional] | +|**reason** | **String** | | [optional] | + + + diff --git a/clients/w3w-prediction/docs/BatchRedeemRequest.md b/clients/w3w-prediction/docs/BatchRedeemRequest.md new file mode 100644 index 000000000..e746e0606 --- /dev/null +++ b/clients/w3w-prediction/docs/BatchRedeemRequest.md @@ -0,0 +1,16 @@ + + +# BatchRedeemRequest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**walletAddress** | **String** | User's prediction wallet address | | +|**walletId** | **String** | Wallet ID | | +|**tokenIds** | **TokenIds** | | | +|**chainId** | **String** | Chain ID. Default `56` (BSC) | [optional] | + + + diff --git a/clients/w3w-prediction/docs/BatchRedeemResponse.md b/clients/w3w-prediction/docs/BatchRedeemResponse.md new file mode 100644 index 000000000..a0c54fc4f --- /dev/null +++ b/clients/w3w-prediction/docs/BatchRedeemResponse.md @@ -0,0 +1,14 @@ + + +# BatchRedeemResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**batchId** | **String** | | [optional] | +|**results** | [**List<BatchRedeemResponseResultsInner>**](BatchRedeemResponseResultsInner.md) | | [optional] | + + + diff --git a/clients/w3w-prediction/docs/BatchRedeemResponseResultsInner.md b/clients/w3w-prediction/docs/BatchRedeemResponseResultsInner.md new file mode 100644 index 000000000..90a441650 --- /dev/null +++ b/clients/w3w-prediction/docs/BatchRedeemResponseResultsInner.md @@ -0,0 +1,16 @@ + + +# BatchRedeemResponseResultsInner + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**requestId** | **String** | | [optional] | +|**txHash** | **String** | | [optional] | +|**status** | **String** | | [optional] | +|**error** | **String** | | [optional] | + + + diff --git a/clients/w3w-prediction/docs/CancelInfoList.md b/clients/w3w-prediction/docs/CancelInfoList.md new file mode 100644 index 000000000..99c14b72d --- /dev/null +++ b/clients/w3w-prediction/docs/CancelInfoList.md @@ -0,0 +1,13 @@ + + +# CancelInfoList + +List of orders to cancel (index `i` starts from 0) + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| + + + diff --git a/clients/w3w-prediction/docs/CancelInfoListInner.md b/clients/w3w-prediction/docs/CancelInfoListInner.md new file mode 100644 index 000000000..65c4d621a --- /dev/null +++ b/clients/w3w-prediction/docs/CancelInfoListInner.md @@ -0,0 +1,13 @@ + + +# CancelInfoListInner + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**orderId** | **String** | Internal order ID to cancel | | + + + diff --git a/clients/w3w-prediction/docs/CreateInboundTransferRequest.md b/clients/w3w-prediction/docs/CreateInboundTransferRequest.md new file mode 100644 index 000000000..58a674ff9 --- /dev/null +++ b/clients/w3w-prediction/docs/CreateInboundTransferRequest.md @@ -0,0 +1,19 @@ + + +# CreateInboundTransferRequest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**walletId** | **String** | Wallet ID | | +|**walletAddress** | **String** | User's prediction wallet address | | +|**fromTokenAmount** | **String** | Transfer amount in wei (18 decimals). Must be > 0. Example: `1000000000000000000` = 1 USDT | | +|**accountType** | **AccountType** | | | +|**fromToken** | **String** | Source token symbol. Default `USDT` | [optional] | +|**toToken** | **String** | Destination token symbol. Default `USDT` | [optional] | +|**chainId** | **String** | Chain ID. Default `56` (BSC) | [optional] | + + + diff --git a/clients/w3w-prediction/docs/CreateInboundTransferResponse.md b/clients/w3w-prediction/docs/CreateInboundTransferResponse.md new file mode 100644 index 000000000..ded9623a7 --- /dev/null +++ b/clients/w3w-prediction/docs/CreateInboundTransferResponse.md @@ -0,0 +1,14 @@ + + +# CreateInboundTransferResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**transferId** | **String** | | [optional] | +|**status** | **String** | | [optional] | + + + diff --git a/clients/w3w-prediction/docs/CreateOutboundTransferRequest.md b/clients/w3w-prediction/docs/CreateOutboundTransferRequest.md new file mode 100644 index 000000000..1e92e436c --- /dev/null +++ b/clients/w3w-prediction/docs/CreateOutboundTransferRequest.md @@ -0,0 +1,20 @@ + + +# CreateOutboundTransferRequest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**walletId** | **String** | Wallet ID | | +|**walletAddress** | **String** | User's prediction wallet address | | +|**fromTokenAmount** | **String** | Transfer amount in wei (18 decimals). Must be > 0. Example: `1000000000000000000` = 1 USDT | | +|**accountType** | **AccountType** | | | +|**sourceBiz** | **SourceBiz** | | | +|**fromToken** | **String** | Source token symbol. Default `USDT` | [optional] | +|**toToken** | **String** | Destination token symbol. Default `USDT` | [optional] | +|**chainId** | **String** | Chain ID. Default `56` (BSC) | [optional] | + + + diff --git a/clients/w3w-prediction/docs/CreateOutboundTransferResponse.md b/clients/w3w-prediction/docs/CreateOutboundTransferResponse.md new file mode 100644 index 000000000..858e90c3c --- /dev/null +++ b/clients/w3w-prediction/docs/CreateOutboundTransferResponse.md @@ -0,0 +1,14 @@ + + +# CreateOutboundTransferResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**transferId** | **String** | | [optional] | +|**status** | **String** | | [optional] | + + + diff --git a/clients/w3w-prediction/docs/Direction.md b/clients/w3w-prediction/docs/Direction.md new file mode 100644 index 000000000..c954fa84c --- /dev/null +++ b/clients/w3w-prediction/docs/Direction.md @@ -0,0 +1,13 @@ + + +# Direction + +## Enum + + +* `INBOUND` (value: `"INBOUND"`) + +* `OUTBOUND` (value: `"OUTBOUND"`) + + + diff --git a/clients/w3w-prediction/docs/FundingSource.md b/clients/w3w-prediction/docs/FundingSource.md new file mode 100644 index 000000000..5578c1dd7 --- /dev/null +++ b/clients/w3w-prediction/docs/FundingSource.md @@ -0,0 +1,13 @@ + + +# FundingSource + +## Enum + + +* `MPC` (value: `"MPC"`) + +* `CEX` (value: `"CEX"`) + + + diff --git a/clients/w3w-prediction/docs/GetMarketDetailResponse.md b/clients/w3w-prediction/docs/GetMarketDetailResponse.md new file mode 100644 index 000000000..51110f390 --- /dev/null +++ b/clients/w3w-prediction/docs/GetMarketDetailResponse.md @@ -0,0 +1,37 @@ + + +# GetMarketDetailResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**marketTopicId** | **Long** | | [optional] | +|**vendor** | **String** | | [optional] | +|**chainId** | **String** | | [optional] | +|**slug** | **String** | | [optional] | +|**title** | **String** | | [optional] | +|**question** | **String** | | [optional] | +|**description** | **String** | | [optional] | +|**imageUrl** | **String** | | [optional] | +|**topicType** | **String** | | [optional] | +|**chartType** | **String** | | [optional] | +|**symbol** | **String** | | [optional] | +|**variantData** | [**GetMarketDetailResponseVariantData**](GetMarketDetailResponseVariantData.md) | | [optional] | +|**participantCount** | **Integer** | | [optional] | +|**collateral** | **String** | | [optional] | +|**feeRateBps** | **Integer** | | [optional] | +|**slippageBps** | **Integer** | | [optional] | +|**isYieldBearing** | **Boolean** | | [optional] | +|**tradeVolume** | **String** | | [optional] | +|**liquidity** | **String** | | [optional] | +|**publishedAt** | **Long** | | [optional] | +|**startDate** | **Long** | | [optional] | +|**endDate** | **Long** | | [optional] | +|**status** | **String** | | [optional] | +|**timeline** | [**List<GetMarketDetailResponseTimelineInner>**](GetMarketDetailResponseTimelineInner.md) | | [optional] | +|**markets** | [**List<GetMarketDetailResponseMarketsInner>**](GetMarketDetailResponseMarketsInner.md) | | [optional] | + + + diff --git a/clients/w3w-prediction/docs/GetMarketDetailResponseMarketsInner.md b/clients/w3w-prediction/docs/GetMarketDetailResponseMarketsInner.md new file mode 100644 index 000000000..46918fc0e --- /dev/null +++ b/clients/w3w-prediction/docs/GetMarketDetailResponseMarketsInner.md @@ -0,0 +1,24 @@ + + +# GetMarketDetailResponseMarketsInner + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**marketId** | **Long** | | [optional] | +|**externalId** | **String** | | [optional] | +|**title** | **String** | | [optional] | +|**question** | **String** | | [optional] | +|**description** | **String** | | [optional] | +|**conditionId** | **String** | | [optional] | +|**status** | **String** | | [optional] | +|**tradingStatus** | **String** | | [optional] | +|**tradeVolume** | **String** | | [optional] | +|**liquidity** | **String** | | [optional] | +|**decimalPrecision** | **Integer** | | [optional] | +|**outcomes** | [**List<GetMarketDetailResponseMarketsInnerOutcomesInner>**](GetMarketDetailResponseMarketsInnerOutcomesInner.md) | | [optional] | + + + diff --git a/clients/w3w-prediction/docs/GetMarketDetailResponseMarketsInnerOutcomesInner.md b/clients/w3w-prediction/docs/GetMarketDetailResponseMarketsInnerOutcomesInner.md new file mode 100644 index 000000000..a64989a37 --- /dev/null +++ b/clients/w3w-prediction/docs/GetMarketDetailResponseMarketsInnerOutcomesInner.md @@ -0,0 +1,17 @@ + + +# GetMarketDetailResponseMarketsInnerOutcomesInner + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **String** | | [optional] | +|**price** | **String** | | [optional] | +|**chance** | **String** | | [optional] | +|**index** | **Integer** | | [optional] | +|**tokenId** | **String** | | [optional] | + + + diff --git a/clients/w3w-prediction/docs/GetMarketDetailResponseTimelineInner.md b/clients/w3w-prediction/docs/GetMarketDetailResponseTimelineInner.md new file mode 100644 index 000000000..6424a32c2 --- /dev/null +++ b/clients/w3w-prediction/docs/GetMarketDetailResponseTimelineInner.md @@ -0,0 +1,15 @@ + + +# GetMarketDetailResponseTimelineInner + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**marketTopicId** | **Long** | | [optional] | +|**startDate** | **Long** | | [optional] | +|**endDate** | **Long** | | [optional] | + + + diff --git a/clients/w3w-prediction/docs/GetMarketDetailResponseVariantData.md b/clients/w3w-prediction/docs/GetMarketDetailResponseVariantData.md new file mode 100644 index 000000000..a72278fbf --- /dev/null +++ b/clients/w3w-prediction/docs/GetMarketDetailResponseVariantData.md @@ -0,0 +1,18 @@ + + +# GetMarketDetailResponseVariantData + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**type** | **String** | | [optional] | +|**startPrice** | **String** | | [optional] | +|**endPrice** | **String** | | [optional] | +|**priceFeedId** | **String** | | [optional] | +|**priceFeedProvider** | **String** | | [optional] | +|**priceFeedSymbol** | **String** | | [optional] | + + + diff --git a/clients/w3w-prediction/docs/GetPortfolioResponse.md b/clients/w3w-prediction/docs/GetPortfolioResponse.md new file mode 100644 index 000000000..27f7bf0aa --- /dev/null +++ b/clients/w3w-prediction/docs/GetPortfolioResponse.md @@ -0,0 +1,21 @@ + + +# GetPortfolioResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**chainId** | **String** | | [optional] | +|**walletAddress** | **String** | | [optional] | +|**activePositionsCount** | **Integer** | | [optional] | +|**totalRealizedPnl** | **String** | | [optional] | +|**totalUnrealizedPnl** | **String** | | [optional] | +|**totalPnl** | **String** | | [optional] | +|**totalCostBasis** | **String** | | [optional] | +|**totalCurrentValue** | **String** | | [optional] | +|**positions** | [**List<GetPortfolioResponsePositionsInner>**](GetPortfolioResponsePositionsInner.md) | | [optional] | + + + diff --git a/clients/w3w-prediction/docs/GetPortfolioResponsePositionsInner.md b/clients/w3w-prediction/docs/GetPortfolioResponsePositionsInner.md new file mode 100644 index 000000000..352785349 --- /dev/null +++ b/clients/w3w-prediction/docs/GetPortfolioResponsePositionsInner.md @@ -0,0 +1,26 @@ + + +# GetPortfolioResponsePositionsInner + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**walletAddress** | **String** | | [optional] | +|**marketTopicId** | **Long** | | [optional] | +|**marketId** | **Long** | | [optional] | +|**tokenId** | **String** | | [optional] | +|**vendor** | **String** | | [optional] | +|**currentShares** | **String** | | [optional] | +|**avgPrice** | **String** | | [optional] | +|**currentPrice** | **String** | | [optional] | +|**realizedPnl** | **String** | | [optional] | +|**unrealizedPnl** | **String** | | [optional] | +|**totalPnl** | **String** | | [optional] | +|**pnlPercentage** | **String** | | [optional] | +|**isResolved** | **Boolean** | | [optional] | + + + diff --git a/clients/w3w-prediction/docs/GetPositionByTokenResponse.md b/clients/w3w-prediction/docs/GetPositionByTokenResponse.md new file mode 100644 index 000000000..b710c338f --- /dev/null +++ b/clients/w3w-prediction/docs/GetPositionByTokenResponse.md @@ -0,0 +1,13 @@ + + +# GetPositionByTokenResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**position** | [**GetPositionByTokenResponsePosition**](GetPositionByTokenResponsePosition.md) | | [optional] | + + + diff --git a/clients/w3w-prediction/docs/GetPositionByTokenResponsePosition.md b/clients/w3w-prediction/docs/GetPositionByTokenResponsePosition.md new file mode 100644 index 000000000..135b59370 --- /dev/null +++ b/clients/w3w-prediction/docs/GetPositionByTokenResponsePosition.md @@ -0,0 +1,36 @@ + + +# GetPositionByTokenResponsePosition + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**positionId** | **Long** | | [optional] | +|**vendor** | **String** | | [optional] | +|**chainId** | **String** | | [optional] | +|**tokenId** | **String** | | [optional] | +|**collateralSymbol** | **String** | | [optional] | +|**topicType** | **String** | | [optional] | +|**marketTopicId** | **Long** | | [optional] | +|**marketId** | **Long** | | [optional] | +|**marketTopicTitle** | **String** | | [optional] | +|**marketTitle** | **String** | | [optional] | +|**outcomeName** | **String** | | [optional] | +|**outcomeIndex** | **Integer** | | [optional] | +|**shares** | **String** | | [optional] | +|**avgPrice** | **String** | | [optional] | +|**totalCost** | **String** | | [optional] | +|**value** | **String** | | [optional] | +|**currentPrice** | **String** | | [optional] | +|**positionStatus** | **String** | | [optional] | +|**endDate** | **Long** | | [optional] | +|**unrealizedPnl** | **String** | | [optional] | +|**realizedPnl** | **String** | | [optional] | +|**pnl** | **String** | | [optional] | +|**createdTime** | **Long** | | [optional] | +|**updatedTime** | **Long** | | [optional] | + + + diff --git a/clients/w3w-prediction/docs/GetQuotaStatusResponse.md b/clients/w3w-prediction/docs/GetQuotaStatusResponse.md new file mode 100644 index 000000000..9ea425b02 --- /dev/null +++ b/clients/w3w-prediction/docs/GetQuotaStatusResponse.md @@ -0,0 +1,14 @@ + + +# GetQuotaStatusResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**dailyLimit** | **String** | | [optional] | +|**remainingDailyLimit** | **String** | | [optional] | + + + diff --git a/clients/w3w-prediction/docs/GetQuoteRequest.md b/clients/w3w-prediction/docs/GetQuoteRequest.md new file mode 100644 index 000000000..167f26cab --- /dev/null +++ b/clients/w3w-prediction/docs/GetQuoteRequest.md @@ -0,0 +1,23 @@ + + +# GetQuoteRequest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**walletAddress** | **String** | User's prediction wallet address | | +|**tokenId** | **String** | Prediction outcome token ID | | +|**side** | **Side** | | | +|**amountIn** | **String** | Input amount in wei (18 decimals). Must be > 0. For `MARKET` orders, minimum is approximately 1.5 USDT (varies by market depth). Example: `1000000000000000000` = 1 USDT | | +|**orderType** | **OrderType** | | | +|**slippageBps** | **Integer** | Slippage tolerance in basis points. Range 1–10000 | | +|**priceLimit** | **String** | Limit price. Required when `orderType=LIMIT`. Must be > 0 | [optional] | +|**chainId** | **String** | Chain ID. Default `56` (BSC) | [optional] | +|**feeRateBps** | **Integer** | Fee rate in basis points. Default `200`, range 1–10000 | [optional] | +|**fundingSource** | **FundingSource** | | [optional] | +|**fundTransferAmount** | **String** | Auto-transfer amount before order (wei). Must be > 0 if provided | [optional] | + + + diff --git a/clients/w3w-prediction/docs/GetQuoteResponse.md b/clients/w3w-prediction/docs/GetQuoteResponse.md new file mode 100644 index 000000000..ca34a1249 --- /dev/null +++ b/clients/w3w-prediction/docs/GetQuoteResponse.md @@ -0,0 +1,37 @@ + + +# GetQuoteResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**quoteId** | **String** | | [optional] | +|**tokenId** | **String** | | [optional] | +|**chance** | **String** | | [optional] | +|**vendor** | **String** | | [optional] | +|**marketTitle** | **String** | | [optional] | +|**marketExtId** | **String** | | [optional] | +|**side** | **String** | | [optional] | +|**amountIn** | **String** | | [optional] | +|**amountOut** | **String** | | [optional] | +|**isMinAmountOut** | **Boolean** | | [optional] | +|**feeAmount** | **String** | | [optional] | +|**feeDiscountBps** | **String** | | [optional] | +|**averagePrice** | **BigDecimal** | | [optional] | +|**lastPrice** | **BigDecimal** | | [optional] | +|**priceImpact** | **BigDecimal** | | [optional] | +|**timestamp** | **Long** | | [optional] | +|**chainId** | **String** | | [optional] | +|**userId** | **Long** | | [optional] | +|**walletAddress** | **String** | | [optional] | +|**orderType** | **String** | | [optional] | +|**slippageBps** | **Integer** | | [optional] | +|**feeRateBps** | **Integer** | | [optional] | +|**minReceive** | **String** | | [optional] | +|**expireAt** | **Long** | | [optional] | +|**priceLimit** | **String** | | [optional] | + + + diff --git a/clients/w3w-prediction/docs/GetRedeemStatusResponse.md b/clients/w3w-prediction/docs/GetRedeemStatusResponse.md new file mode 100644 index 000000000..89bd370f8 --- /dev/null +++ b/clients/w3w-prediction/docs/GetRedeemStatusResponse.md @@ -0,0 +1,14 @@ + + +# GetRedeemStatusResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**txHash** | **String** | | [optional] | +|**status** | **String** | | [optional] | + + + diff --git a/clients/w3w-prediction/docs/ListPredictionCategoriesResponse.md b/clients/w3w-prediction/docs/ListPredictionCategoriesResponse.md new file mode 100644 index 000000000..3bd111c8f --- /dev/null +++ b/clients/w3w-prediction/docs/ListPredictionCategoriesResponse.md @@ -0,0 +1,13 @@ + + +# ListPredictionCategoriesResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**categories** | [**List<ListPredictionCategoriesResponseCategoriesInner>**](ListPredictionCategoriesResponseCategoriesInner.md) | | [optional] | + + + diff --git a/clients/w3w-prediction/docs/ListPredictionCategoriesResponseCategoriesInner.md b/clients/w3w-prediction/docs/ListPredictionCategoriesResponseCategoriesInner.md new file mode 100644 index 000000000..1d12a04b5 --- /dev/null +++ b/clients/w3w-prediction/docs/ListPredictionCategoriesResponseCategoriesInner.md @@ -0,0 +1,17 @@ + + +# ListPredictionCategoriesResponseCategoriesInner + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **String** | | [optional] | +|**name** | **String** | | [optional] | +|**icon** | **String** | | [optional] | +|**order** | **Integer** | | [optional] | +|**subcategories** | [**List<ListPredictionCategoriesResponseCategoriesInnerSubcategoriesInner>**](ListPredictionCategoriesResponseCategoriesInnerSubcategoriesInner.md) | | [optional] | + + + diff --git a/clients/w3w-prediction/docs/ListPredictionCategoriesResponseCategoriesInnerSubcategoriesInner.md b/clients/w3w-prediction/docs/ListPredictionCategoriesResponseCategoriesInnerSubcategoriesInner.md new file mode 100644 index 000000000..924a8ea44 --- /dev/null +++ b/clients/w3w-prediction/docs/ListPredictionCategoriesResponseCategoriesInnerSubcategoriesInner.md @@ -0,0 +1,16 @@ + + +# ListPredictionCategoriesResponseCategoriesInnerSubcategoriesInner + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **String** | | [optional] | +|**name** | **String** | | [optional] | +|**icon** | **String** | | [optional] | +|**order** | **Integer** | | [optional] | + + + diff --git a/clients/w3w-prediction/docs/ListPredictionMarketsResponse.md b/clients/w3w-prediction/docs/ListPredictionMarketsResponse.md new file mode 100644 index 000000000..da822b71a --- /dev/null +++ b/clients/w3w-prediction/docs/ListPredictionMarketsResponse.md @@ -0,0 +1,17 @@ + + +# ListPredictionMarketsResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**marketTopics** | [**List<ListPredictionMarketsResponseMarketTopicsInner>**](ListPredictionMarketsResponseMarketTopicsInner.md) | | [optional] | +|**total** | **Integer** | | [optional] | +|**offset** | **Integer** | | [optional] | +|**limit** | **Integer** | | [optional] | +|**hasMore** | **Boolean** | | [optional] | + + + diff --git a/clients/w3w-prediction/docs/ListPredictionMarketsResponseMarketTopicsInner.md b/clients/w3w-prediction/docs/ListPredictionMarketsResponseMarketTopicsInner.md new file mode 100644 index 000000000..b2d716717 --- /dev/null +++ b/clients/w3w-prediction/docs/ListPredictionMarketsResponseMarketTopicsInner.md @@ -0,0 +1,35 @@ + + +# ListPredictionMarketsResponseMarketTopicsInner + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**marketTopicId** | **Long** | | [optional] | +|**vendor** | **String** | | [optional] | +|**chainId** | **String** | | [optional] | +|**slug** | **String** | | [optional] | +|**title** | **String** | | [optional] | +|**question** | **String** | | [optional] | +|**description** | **String** | | [optional] | +|**imageUrl** | **String** | | [optional] | +|**topicType** | **String** | | [optional] | +|**chartType** | **String** | | [optional] | +|**symbol** | **String** | | [optional] | +|**participantCount** | **Integer** | | [optional] | +|**collateral** | **String** | | [optional] | +|**feeRateBps** | **Integer** | | [optional] | +|**slippageBps** | **Integer** | | [optional] | +|**isYieldBearing** | **Boolean** | | [optional] | +|**tradeVolume** | **String** | | [optional] | +|**liquidity** | **String** | | [optional] | +|**publishedAt** | **Long** | | [optional] | +|**startDate** | **Long** | | [optional] | +|**endDate** | **Long** | | [optional] | +|**status** | **String** | | [optional] | +|**markets** | **List<Object>** | | [optional] | + + + diff --git a/clients/w3w-prediction/docs/ListPredictionWalletsResponse.md b/clients/w3w-prediction/docs/ListPredictionWalletsResponse.md new file mode 100644 index 000000000..27bb95050 --- /dev/null +++ b/clients/w3w-prediction/docs/ListPredictionWalletsResponse.md @@ -0,0 +1,13 @@ + + +# ListPredictionWalletsResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**wallets** | [**List<ListPredictionWalletsResponseWalletsInner>**](ListPredictionWalletsResponseWalletsInner.md) | | [optional] | + + + diff --git a/clients/w3w-prediction/docs/ListPredictionWalletsResponseWalletsInner.md b/clients/w3w-prediction/docs/ListPredictionWalletsResponseWalletsInner.md new file mode 100644 index 000000000..5d2639a07 --- /dev/null +++ b/clients/w3w-prediction/docs/ListPredictionWalletsResponseWalletsInner.md @@ -0,0 +1,15 @@ + + +# ListPredictionWalletsResponseWalletsInner + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**walletAddress** | **String** | | [optional] | +|**walletId** | **String** | | [optional] | +|**registeredTime** | **Long** | | [optional] | + + + diff --git a/clients/w3w-prediction/docs/MarketDataApi.md b/clients/w3w-prediction/docs/MarketDataApi.md new file mode 100644 index 000000000..1c9d8bd18 --- /dev/null +++ b/clients/w3w-prediction/docs/MarketDataApi.md @@ -0,0 +1,398 @@ +# MarketDataApi + +All URIs are relative to *https://api.binance.com* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**getMarketDetail**](MarketDataApi.md#getMarketDetail) | **GET** /sapi/v1/w3w/wallet/prediction/market/detail | Get Market Detail | +| [**listPredictionCategories**](MarketDataApi.md#listPredictionCategories) | **GET** /sapi/v1/w3w/wallet/prediction/category/list | List Prediction Categories | +| [**listPredictionMarkets**](MarketDataApi.md#listPredictionMarkets) | **GET** /sapi/v1/w3w/wallet/prediction/market/list | List Prediction Markets | +| [**marketSearch**](MarketDataApi.md#marketSearch) | **GET** /sapi/v1/w3w/wallet/prediction/market/search | Market Search | +| [**queryLastTradePrice**](MarketDataApi.md#queryLastTradePrice) | **GET** /sapi/v1/w3w/wallet/prediction/order-book/last-trade-price | Query Last Trade Price | +| [**queryOrderBook**](MarketDataApi.md#queryOrderBook) | **GET** /sapi/v1/w3w/wallet/prediction/order-book | Query Order Book | + + + +# **getMarketDetail** +> GetMarketDetailResponse getMarketDetail(marketTopicId) + +Get Market Detail + +Get full details for a specific prediction market topic, including variant data and timeline. Weight(IP): 200 + +### Example +```java +// Import classes: +import com.binance.connector.client.w3w_prediction.ApiClient; +import com.binance.connector.client.w3w_prediction.ApiException; +import com.binance.connector.client.w3w_prediction.Configuration; +import com.binance.connector.client.w3w_prediction.models.*; +import com.binance.connector.client.w3w_prediction.rest.api.MarketDataApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.binance.com"); + + MarketDataApi apiInstance = new MarketDataApi(defaultClient); + Long marketTopicId = 4229564L; // Long | Market topic ID. Must be > 0 + try { + GetMarketDetailResponse result = apiInstance.getMarketDetail(marketTopicId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling MarketDataApi#getMarketDetail"); + 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 | +|------------- | ------------- | ------------- | -------------| +| **marketTopicId** | **Long**| Market topic ID. Must be > 0 | | + +### Return type + +[**GetMarketDetailResponse**](GetMarketDetailResponse.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 Market Detail | - | + + +# **listPredictionCategories** +> ListPredictionCategoriesResponse listPredictionCategories() + +List Prediction Categories + +Get all available prediction market categories (L1 and L2). Weight(IP): 200 + +### Example +```java +// Import classes: +import com.binance.connector.client.w3w_prediction.ApiClient; +import com.binance.connector.client.w3w_prediction.ApiException; +import com.binance.connector.client.w3w_prediction.Configuration; +import com.binance.connector.client.w3w_prediction.models.*; +import com.binance.connector.client.w3w_prediction.rest.api.MarketDataApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.binance.com"); + + MarketDataApi apiInstance = new MarketDataApi(defaultClient); + try { + ListPredictionCategoriesResponse result = apiInstance.listPredictionCategories(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling MarketDataApi#listPredictionCategories"); + 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 + +[**ListPredictionCategoriesResponse**](ListPredictionCategoriesResponse.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** | List Prediction Categories | - | + + +# **listPredictionMarkets** +> ListPredictionMarketsResponse listPredictionMarkets(l1Category, l2Category, sortBy, orderBy, offset, limit) + +List Prediction Markets + +Get a paginated list of prediction market topics, with optional category and sort filters. Weight(IP): 200 + +### Example +```java +// Import classes: +import com.binance.connector.client.w3w_prediction.ApiClient; +import com.binance.connector.client.w3w_prediction.ApiException; +import com.binance.connector.client.w3w_prediction.Configuration; +import com.binance.connector.client.w3w_prediction.models.*; +import com.binance.connector.client.w3w_prediction.rest.api.MarketDataApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.binance.com"); + + MarketDataApi apiInstance = new MarketDataApi(defaultClient); + String l1Category = "crypto"; // String | Level-1 category filter + String l2Category = "up-down"; // String | Level-2 category filter + SortBy sortBy = SortBy.fromValue("RECOMMENDED"); // SortBy | Sort field. Enum: `RECOMMENDED`, `VOLUME`, `PARTICIPANTS`, `CREATED_TIME`, `END_DATE` + OrderBy orderBy = OrderBy.fromValue("ASC"); // OrderBy | Sort direction. Enum: `ASC`, `DESC` + Integer offset = 0; // Integer | Pagination offset. Default `0` + Integer limit = 20; // Integer | Page size. Default `20`, range 1–100 + try { + ListPredictionMarketsResponse result = apiInstance.listPredictionMarkets(l1Category, l2Category, sortBy, orderBy, offset, limit); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling MarketDataApi#listPredictionMarkets"); + 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 | +|------------- | ------------- | ------------- | -------------| +| **l1Category** | **String**| Level-1 category filter | [optional] | +| **l2Category** | **String**| Level-2 category filter | [optional] | +| **sortBy** | [**SortBy**](.md)| Sort field. Enum: `RECOMMENDED`, `VOLUME`, `PARTICIPANTS`, `CREATED_TIME`, `END_DATE` | [optional] [enum: RECOMMENDED, VOLUME, PARTICIPANTS, CREATED_TIME, END_DATE] | +| **orderBy** | [**OrderBy**](.md)| Sort direction. Enum: `ASC`, `DESC` | [optional] [enum: ASC, DESC] | +| **offset** | **Integer**| Pagination offset. Default `0` | [optional] | +| **limit** | **Integer**| Page size. Default `20`, range 1–100 | [optional] | + +### Return type + +[**ListPredictionMarketsResponse**](ListPredictionMarketsResponse.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** | List Prediction Markets | - | + + +# **marketSearch** +> MarketSearchResponse marketSearch(query, topK) + +Market Search + +Semantic search for prediction market topics by keyword. Weight(IP): 200 + +### Example +```java +// Import classes: +import com.binance.connector.client.w3w_prediction.ApiClient; +import com.binance.connector.client.w3w_prediction.ApiException; +import com.binance.connector.client.w3w_prediction.Configuration; +import com.binance.connector.client.w3w_prediction.models.*; +import com.binance.connector.client.w3w_prediction.rest.api.MarketDataApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.binance.com"); + + MarketDataApi apiInstance = new MarketDataApi(defaultClient); + String query = "BTC price"; // String | Search keyword. Not blank + Integer topK = 20; // Integer | Max number of results to return. Default `20`, range 1–50 + try { + MarketSearchResponse result = apiInstance.marketSearch(query, topK); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling MarketDataApi#marketSearch"); + 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 | +|------------- | ------------- | ------------- | -------------| +| **query** | **String**| Search keyword. Not blank | | +| **topK** | **Integer**| Max number of results to return. Default `20`, range 1–50 | [optional] | + +### Return type + +[**MarketSearchResponse**](MarketSearchResponse.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** | Market Search | - | + + +# **queryLastTradePrice** +> QueryLastTradePriceResponse queryLastTradePrice(marketId) + +Query Last Trade Price + +Get the most recent trade price for a prediction market. Weight(IP): 200 + +### Example +```java +// Import classes: +import com.binance.connector.client.w3w_prediction.ApiClient; +import com.binance.connector.client.w3w_prediction.ApiException; +import com.binance.connector.client.w3w_prediction.Configuration; +import com.binance.connector.client.w3w_prediction.models.*; +import com.binance.connector.client.w3w_prediction.rest.api.MarketDataApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.binance.com"); + + MarketDataApi apiInstance = new MarketDataApi(defaultClient); + Long marketId = 5567895L; // Long | Market ID. Must be > 0 + try { + QueryLastTradePriceResponse result = apiInstance.queryLastTradePrice(marketId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling MarketDataApi#queryLastTradePrice"); + 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 | +|------------- | ------------- | ------------- | -------------| +| **marketId** | **Long**| Market ID. Must be > 0 | | + +### Return type + +[**QueryLastTradePriceResponse**](QueryLastTradePriceResponse.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** | Query Last Trade Price | - | + + +# **queryOrderBook** +> QueryOrderBookResponse queryOrderBook(vendor, marketId, tokenId) + +Query Order Book + +Get the current order book (bids and asks) for a specific prediction market outcome token. Weight(IP): 200 + +### Example +```java +// Import classes: +import com.binance.connector.client.w3w_prediction.ApiClient; +import com.binance.connector.client.w3w_prediction.ApiException; +import com.binance.connector.client.w3w_prediction.Configuration; +import com.binance.connector.client.w3w_prediction.models.*; +import com.binance.connector.client.w3w_prediction.rest.api.MarketDataApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.binance.com"); + + MarketDataApi apiInstance = new MarketDataApi(defaultClient); + String vendor = "predict_fun"; // String | Vendor identifier (e.g. `predict_fun`) + Long marketId = 5567895L; // Long | Market ID. Must be > 0 + String tokenId = "112233"; // String | Prediction outcome token ID + try { + QueryOrderBookResponse result = apiInstance.queryOrderBook(vendor, marketId, tokenId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling MarketDataApi#queryOrderBook"); + 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 | +|------------- | ------------- | ------------- | -------------| +| **vendor** | **String**| Vendor identifier (e.g. `predict_fun`) | | +| **marketId** | **Long**| Market ID. Must be > 0 | | +| **tokenId** | **String**| Prediction outcome token ID | | + +### Return type + +[**QueryOrderBookResponse**](QueryOrderBookResponse.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** | Query Order Book | - | + diff --git a/clients/w3w-prediction/docs/MarketSearchResponse.md b/clients/w3w-prediction/docs/MarketSearchResponse.md new file mode 100644 index 000000000..c5f06713a --- /dev/null +++ b/clients/w3w-prediction/docs/MarketSearchResponse.md @@ -0,0 +1,12 @@ + + +# MarketSearchResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| + + + diff --git a/clients/w3w-prediction/docs/MarketSearchResponseInner.md b/clients/w3w-prediction/docs/MarketSearchResponseInner.md new file mode 100644 index 000000000..059d1d6b8 --- /dev/null +++ b/clients/w3w-prediction/docs/MarketSearchResponseInner.md @@ -0,0 +1,30 @@ + + +# MarketSearchResponseInner + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**marketTopicId** | **Long** | | [optional] | +|**vendor** | **String** | | [optional] | +|**chainId** | **String** | | [optional] | +|**slug** | **String** | | [optional] | +|**title** | **String** | | [optional] | +|**question** | **String** | | [optional] | +|**description** | **String** | | [optional] | +|**topicType** | **String** | | [optional] | +|**chartType** | **String** | | [optional] | +|**symbol** | **String** | | [optional] | +|**participantCount** | **Integer** | | [optional] | +|**collateral** | **String** | | [optional] | +|**tradeVolume** | **String** | | [optional] | +|**liquidity** | **String** | | [optional] | +|**startDate** | **Long** | | [optional] | +|**endDate** | **Long** | | [optional] | +|**status** | **String** | | [optional] | +|**markets** | **List<Object>** | | [optional] | + + + diff --git a/clients/w3w-prediction/docs/OrderBy.md b/clients/w3w-prediction/docs/OrderBy.md new file mode 100644 index 000000000..32153887d --- /dev/null +++ b/clients/w3w-prediction/docs/OrderBy.md @@ -0,0 +1,13 @@ + + +# OrderBy + +## Enum + + +* `ASC` (value: `"ASC"`) + +* `DESC` (value: `"DESC"`) + + + diff --git a/clients/w3w-prediction/docs/OrderType.md b/clients/w3w-prediction/docs/OrderType.md new file mode 100644 index 000000000..966b64a12 --- /dev/null +++ b/clients/w3w-prediction/docs/OrderType.md @@ -0,0 +1,13 @@ + + +# OrderType + +## Enum + + +* `MARKET` (value: `"MARKET"`) + +* `LIMIT` (value: `"LIMIT"`) + + + diff --git a/clients/w3w-prediction/docs/PlaceOrderRequest.md b/clients/w3w-prediction/docs/PlaceOrderRequest.md new file mode 100644 index 000000000..537fe1ca2 --- /dev/null +++ b/clients/w3w-prediction/docs/PlaceOrderRequest.md @@ -0,0 +1,22 @@ + + +# PlaceOrderRequest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**walletAddress** | **String** | User's prediction wallet address | | +|**walletId** | **String** | Wallet ID | | +|**quoteId** | **String** | Quote ID obtained from `Get Quote` | | +|**timeInForce** | **String** | Must match `orderType`: `FOK` for `MARKET`, `GTC` for `LIMIT` | | +|**accountType** | **AccountType** | | | +|**orderType** | **OrderType** | | | +|**slippageBps** | **Integer** | Slippage tolerance in basis points. Range 1–10000 | | +|**priceLimit** | **String** | Limit price. Required when `orderType=LIMIT`. Must be > 0 | [optional] | +|**fundingSource** | **FundingSource** | | [optional] | +|**fundTransferAmount** | **String** | Auto-transfer amount before order (wei). Must be > 0 if provided | [optional] | + + + diff --git a/clients/w3w-prediction/docs/PlaceOrderResponse.md b/clients/w3w-prediction/docs/PlaceOrderResponse.md new file mode 100644 index 000000000..9ac1e8684 --- /dev/null +++ b/clients/w3w-prediction/docs/PlaceOrderResponse.md @@ -0,0 +1,13 @@ + + +# PlaceOrderResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**orderId** | **String** | | [optional] | + + + diff --git a/clients/w3w-prediction/docs/PositionApi.md b/clients/w3w-prediction/docs/PositionApi.md new file mode 100644 index 000000000..c740111f8 --- /dev/null +++ b/clients/w3w-prediction/docs/PositionApi.md @@ -0,0 +1,363 @@ +# PositionApi + +All URIs are relative to *https://api.binance.com* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**getPositionByToken**](PositionApi.md#getPositionByToken) | **GET** /sapi/v1/w3w/wallet/prediction/position/token | Get Position by Token | +| [**queryPnL**](PositionApi.md#queryPnL) | **GET** /sapi/v1/w3w/wallet/prediction/pnl/query | Query PnL | +| [**queryPositions**](PositionApi.md#queryPositions) | **GET** /sapi/v1/w3w/wallet/prediction/position/list | Query Positions | +| [**queryPositionsByFilter**](PositionApi.md#queryPositionsByFilter) | **GET** /sapi/v1/w3w/wallet/prediction/position/filter | Query Positions by Filter | +| [**querySettledPositionHistory**](PositionApi.md#querySettledPositionHistory) | **GET** /sapi/v1/w3w/wallet/prediction/position/settled-history | Query Settled Position History | + + + +# **getPositionByToken** +> GetPositionByTokenResponse getPositionByToken(walletAddress, tokenId, recvWindow) + +Get Position by Token + +Get the authenticated user's position detail for a specific prediction token. Weight(IP): 200 Security Type: USER_DATA + +### Example +```java +// Import classes: +import com.binance.connector.client.w3w_prediction.ApiClient; +import com.binance.connector.client.w3w_prediction.ApiException; +import com.binance.connector.client.w3w_prediction.Configuration; +import com.binance.connector.client.w3w_prediction.models.*; +import com.binance.connector.client.w3w_prediction.rest.api.PositionApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.binance.com"); + + PositionApi apiInstance = new PositionApi(defaultClient); + String walletAddress = "0x12e32db8817e292508c34111cbc4b23340df542c"; // String | User's prediction wallet address + String tokenId = "112233"; // String | Prediction outcome token ID + Long recvWindow = 5000L; // Long | Request validity window in milliseconds + try { + GetPositionByTokenResponse result = apiInstance.getPositionByToken(walletAddress, tokenId, recvWindow); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PositionApi#getPositionByToken"); + 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 | +|------------- | ------------- | ------------- | -------------| +| **walletAddress** | **String**| User's prediction wallet address | | +| **tokenId** | **String**| Prediction outcome token ID | | +| **recvWindow** | **Long**| Request validity window in milliseconds | [optional] | + +### Return type + +[**GetPositionByTokenResponse**](GetPositionByTokenResponse.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 Position by Token | - | + + +# **queryPnL** +> QueryPnLResponse queryPnL(walletAddress, tokenId, marketId, marketTopicId, activeOnly, recvWindow) + +Query PnL + +Query profit and loss records for the authenticated user's prediction positions. When `tokenId` is provided, returns a single record in `pnl`; otherwise returns a list in `pnlList`. Weight(IP): 200 Security Type: USER_DATA + +### Example +```java +// Import classes: +import com.binance.connector.client.w3w_prediction.ApiClient; +import com.binance.connector.client.w3w_prediction.ApiException; +import com.binance.connector.client.w3w_prediction.Configuration; +import com.binance.connector.client.w3w_prediction.models.*; +import com.binance.connector.client.w3w_prediction.rest.api.PositionApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.binance.com"); + + PositionApi apiInstance = new PositionApi(defaultClient); + String walletAddress = "0x12e32db8817e292508c34111cbc4b23340df542c"; // String | User's prediction wallet address + String tokenId = "112233"; // String | Filter by prediction token ID + Long marketId = 5567895L; // Long | Filter by market ID. Must be > 0 + Long marketTopicId = 4229564L; // Long | Filter by market topic ID. Must be > 0 + Boolean activeOnly = false; // Boolean | If `true`, return only active (unresolved) positions + Long recvWindow = 5000L; // Long | Request validity window in milliseconds + try { + QueryPnLResponse result = apiInstance.queryPnL(walletAddress, tokenId, marketId, marketTopicId, activeOnly, recvWindow); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PositionApi#queryPnL"); + 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 | +|------------- | ------------- | ------------- | -------------| +| **walletAddress** | **String**| User's prediction wallet address | | +| **tokenId** | **String**| Filter by prediction token ID | [optional] | +| **marketId** | **Long**| Filter by market ID. Must be > 0 | [optional] | +| **marketTopicId** | **Long**| Filter by market topic ID. Must be > 0 | [optional] | +| **activeOnly** | **Boolean**| If `true`, return only active (unresolved) positions | [optional] | +| **recvWindow** | **Long**| Request validity window in milliseconds | [optional] | + +### Return type + +[**QueryPnLResponse**](QueryPnLResponse.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** | Query PnL | - | + + +# **queryPositions** +> QueryPositionsResponse queryPositions(walletAddress, tab, offset, limit, recvWindow) + +Query Positions + +Get the authenticated user's prediction token positions with portfolio summary and tab-based filtering. Weight(IP): 200 Security Type: USER_DATA + +### Example +```java +// Import classes: +import com.binance.connector.client.w3w_prediction.ApiClient; +import com.binance.connector.client.w3w_prediction.ApiException; +import com.binance.connector.client.w3w_prediction.Configuration; +import com.binance.connector.client.w3w_prediction.models.*; +import com.binance.connector.client.w3w_prediction.rest.api.PositionApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.binance.com"); + + PositionApi apiInstance = new PositionApi(defaultClient); + String walletAddress = "0x12e32db8817e292508c34111cbc4b23340df542c"; // String | User's prediction wallet address + String tab = "ONGOING"; // String | Position status tab. Values from `PositionQueryType`. Default `ONGOING` + Integer offset = 0; // Integer | Pagination offset. Default `0` + Integer limit = 20; // Integer | Page size. Default `20`, range 1–100 + Long recvWindow = 5000L; // Long | Request validity window in milliseconds + try { + QueryPositionsResponse result = apiInstance.queryPositions(walletAddress, tab, offset, limit, recvWindow); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PositionApi#queryPositions"); + 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 | +|------------- | ------------- | ------------- | -------------| +| **walletAddress** | **String**| User's prediction wallet address | | +| **tab** | **String**| Position status tab. Values from `PositionQueryType`. Default `ONGOING` | [optional] | +| **offset** | **Integer**| Pagination offset. Default `0` | [optional] | +| **limit** | **Integer**| Page size. Default `20`, range 1–100 | [optional] | +| **recvWindow** | **Long**| Request validity window in milliseconds | [optional] | + +### Return type + +[**QueryPositionsResponse**](QueryPositionsResponse.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** | Query Positions | - | + + +# **queryPositionsByFilter** +> QueryPositionsByFilterResponse queryPositionsByFilter(walletAddress, marketTopicId, recvWindow) + +Query Positions by Filter + +Get prediction positions filtered by wallet address and/or market topic ID. Both parameters are optional. Weight(IP): 200 Security Type: USER_DATA + +### Example +```java +// Import classes: +import com.binance.connector.client.w3w_prediction.ApiClient; +import com.binance.connector.client.w3w_prediction.ApiException; +import com.binance.connector.client.w3w_prediction.Configuration; +import com.binance.connector.client.w3w_prediction.models.*; +import com.binance.connector.client.w3w_prediction.rest.api.PositionApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.binance.com"); + + PositionApi apiInstance = new PositionApi(defaultClient); + String walletAddress = "0x12e32db8817e292508c34111cbc4b23340df542c"; // String | User's prediction wallet address + Long marketTopicId = 4229564L; // Long | Filter by market topic ID + Long recvWindow = 5000L; // Long | Request validity window in milliseconds + try { + QueryPositionsByFilterResponse result = apiInstance.queryPositionsByFilter(walletAddress, marketTopicId, recvWindow); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PositionApi#queryPositionsByFilter"); + 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 | +|------------- | ------------- | ------------- | -------------| +| **walletAddress** | **String**| User's prediction wallet address | [optional] | +| **marketTopicId** | **Long**| Filter by market topic ID | [optional] | +| **recvWindow** | **Long**| Request validity window in milliseconds | [optional] | + +### Return type + +[**QueryPositionsByFilterResponse**](QueryPositionsByFilterResponse.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** | Query Positions by Filter | - | + + +# **querySettledPositionHistory** +> QuerySettledPositionHistoryResponse querySettledPositionHistory(walletAddress, l1Category, result, startDate, endDate, offset, limit, recvWindow) + +Query Settled Position History + +Get the authenticated user's settled (resolved) prediction position history with optional filters. Weight(IP): 200 Security Type: USER_DATA + +### Example +```java +// Import classes: +import com.binance.connector.client.w3w_prediction.ApiClient; +import com.binance.connector.client.w3w_prediction.ApiException; +import com.binance.connector.client.w3w_prediction.Configuration; +import com.binance.connector.client.w3w_prediction.models.*; +import com.binance.connector.client.w3w_prediction.rest.api.PositionApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.binance.com"); + + PositionApi apiInstance = new PositionApi(defaultClient); + String walletAddress = "0x12e32db8817e292508c34111cbc4b23340df542c"; // String | User's prediction wallet address + String l1Category = "crypto"; // String | Filter by level-1 category + Integer result = 1; // Integer | Settlement result filter + String startDate = "2026-05-01"; // String | Start date. Format: `yyyy-MM-dd`. Must be ≤ `endDate` + String endDate = "2026-05-25"; // String | End date. Format: `yyyy-MM-dd`. Must be ≥ `startDate` + Integer offset = 0; // Integer | Pagination offset. Default `0` + Integer limit = 20; // Integer | Page size. Default `20`, range 1–100 + Long recvWindow = 5000L; // Long | Request validity window in milliseconds + try { + QuerySettledPositionHistoryResponse result = apiInstance.querySettledPositionHistory(walletAddress, l1Category, result, startDate, endDate, offset, limit, recvWindow); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PositionApi#querySettledPositionHistory"); + 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 | +|------------- | ------------- | ------------- | -------------| +| **walletAddress** | **String**| User's prediction wallet address | | +| **l1Category** | **String**| Filter by level-1 category | [optional] | +| **result** | **Integer**| Settlement result filter | [optional] | +| **startDate** | **String**| Start date. Format: `yyyy-MM-dd`. Must be ≤ `endDate` | [optional] | +| **endDate** | **String**| End date. Format: `yyyy-MM-dd`. Must be ≥ `startDate` | [optional] | +| **offset** | **Integer**| Pagination offset. Default `0` | [optional] | +| **limit** | **Integer**| Page size. Default `20`, range 1–100 | [optional] | +| **recvWindow** | **Long**| Request validity window in milliseconds | [optional] | + +### Return type + +[**QuerySettledPositionHistoryResponse**](QuerySettledPositionHistoryResponse.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** | Query Settled Position History | - | + diff --git a/clients/w3w-prediction/docs/QueryActiveOrdersResponse.md b/clients/w3w-prediction/docs/QueryActiveOrdersResponse.md new file mode 100644 index 000000000..8f75fe250 --- /dev/null +++ b/clients/w3w-prediction/docs/QueryActiveOrdersResponse.md @@ -0,0 +1,16 @@ + + +# QueryActiveOrdersResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**total** | **Integer** | | [optional] | +|**offset** | **Integer** | | [optional] | +|**limit** | **Integer** | | [optional] | +|**orders** | [**List<QueryActiveOrdersResponseOrdersInner>**](QueryActiveOrdersResponseOrdersInner.md) | | [optional] | + + + diff --git a/clients/w3w-prediction/docs/QueryActiveOrdersResponseOrdersInner.md b/clients/w3w-prediction/docs/QueryActiveOrdersResponseOrdersInner.md new file mode 100644 index 000000000..09f09dd05 --- /dev/null +++ b/clients/w3w-prediction/docs/QueryActiveOrdersResponseOrdersInner.md @@ -0,0 +1,35 @@ + + +# QueryActiveOrdersResponseOrdersInner + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**orderId** | **String** | | [optional] | +|**vendorOrderId** | **String** | | [optional] | +|**vendor** | **String** | | [optional] | +|**marketTopicId** | **Long** | | [optional] | +|**slug** | **String** | | [optional] | +|**marketTopicTitle** | **String** | | [optional] | +|**marketId** | **Long** | | [optional] | +|**marketTitle** | **String** | | [optional] | +|**outcome** | **String** | | [optional] | +|**outcomeIndex** | **Integer** | | [optional] | +|**status** | **String** | | [optional] | +|**side** | **String** | | [optional] | +|**orderType** | **String** | | [optional] | +|**createTime** | **Long** | | [optional] | +|**modifyTime** | **Long** | | [optional] | +|**makerUsdtAmount** | **String** | | [optional] | +|**makerShareQty** | **String** | | [optional] | +|**filledUsdtAmount** | **String** | | [optional] | +|**filledShareQty** | **String** | | [optional] | +|**fillPercentage** | **String** | | [optional] | +|**price** | **String** | | [optional] | +|**marketProviderFee** | **String** | | [optional] | +|**networkFee** | **String** | | [optional] | + + + diff --git a/clients/w3w-prediction/docs/QueryLastTradePriceResponse.md b/clients/w3w-prediction/docs/QueryLastTradePriceResponse.md new file mode 100644 index 000000000..d80938ad7 --- /dev/null +++ b/clients/w3w-prediction/docs/QueryLastTradePriceResponse.md @@ -0,0 +1,14 @@ + + +# QueryLastTradePriceResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**marketId** | **Long** | | [optional] | +|**lastTradePrice** | **String** | | [optional] | + + + diff --git a/clients/w3w-prediction/docs/QueryOrderBookResponse.md b/clients/w3w-prediction/docs/QueryOrderBookResponse.md new file mode 100644 index 000000000..a66fbc583 --- /dev/null +++ b/clients/w3w-prediction/docs/QueryOrderBookResponse.md @@ -0,0 +1,17 @@ + + +# QueryOrderBookResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**outcome** | **String** | | [optional] | +|**tokenId** | **String** | | [optional] | +|**timestamp** | **Long** | | [optional] | +|**bids** | [**List<QueryOrderBookResponseBidsInner>**](QueryOrderBookResponseBidsInner.md) | | [optional] | +|**asks** | [**List<QueryOrderBookResponseAsksInner>**](QueryOrderBookResponseAsksInner.md) | | [optional] | + + + diff --git a/clients/w3w-prediction/docs/QueryOrderBookResponseAsksInner.md b/clients/w3w-prediction/docs/QueryOrderBookResponseAsksInner.md new file mode 100644 index 000000000..f54708ab0 --- /dev/null +++ b/clients/w3w-prediction/docs/QueryOrderBookResponseAsksInner.md @@ -0,0 +1,14 @@ + + +# QueryOrderBookResponseAsksInner + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**price** | **String** | | [optional] | +|**size** | **String** | | [optional] | + + + diff --git a/clients/w3w-prediction/docs/QueryOrderBookResponseBidsInner.md b/clients/w3w-prediction/docs/QueryOrderBookResponseBidsInner.md new file mode 100644 index 000000000..b0cee55c5 --- /dev/null +++ b/clients/w3w-prediction/docs/QueryOrderBookResponseBidsInner.md @@ -0,0 +1,14 @@ + + +# QueryOrderBookResponseBidsInner + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**price** | **String** | | [optional] | +|**size** | **String** | | [optional] | + + + diff --git a/clients/w3w-prediction/docs/QueryOrderHistoryResponse.md b/clients/w3w-prediction/docs/QueryOrderHistoryResponse.md new file mode 100644 index 000000000..1662abd29 --- /dev/null +++ b/clients/w3w-prediction/docs/QueryOrderHistoryResponse.md @@ -0,0 +1,16 @@ + + +# QueryOrderHistoryResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**total** | **Integer** | | [optional] | +|**offset** | **Integer** | | [optional] | +|**limit** | **Integer** | | [optional] | +|**orders** | [**List<QueryOrderHistoryResponseOrdersInner>**](QueryOrderHistoryResponseOrdersInner.md) | | [optional] | + + + diff --git a/clients/w3w-prediction/docs/QueryOrderHistoryResponseOrdersInner.md b/clients/w3w-prediction/docs/QueryOrderHistoryResponseOrdersInner.md new file mode 100644 index 000000000..4cbf60b13 --- /dev/null +++ b/clients/w3w-prediction/docs/QueryOrderHistoryResponseOrdersInner.md @@ -0,0 +1,36 @@ + + +# QueryOrderHistoryResponseOrdersInner + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**orderId** | **String** | | [optional] | +|**vendorOrderId** | **String** | | [optional] | +|**vendor** | **String** | | [optional] | +|**marketTopicId** | **Long** | | [optional] | +|**slug** | **String** | | [optional] | +|**marketTopicTitle** | **String** | | [optional] | +|**marketId** | **Long** | | [optional] | +|**marketTitle** | **String** | | [optional] | +|**outcome** | **String** | | [optional] | +|**outcomeIndex** | **Integer** | | [optional] | +|**status** | **String** | | [optional] | +|**side** | **String** | | [optional] | +|**orderType** | **String** | | [optional] | +|**createTime** | **Long** | | [optional] | +|**modifyTime** | **Long** | | [optional] | +|**terminalTime** | **Long** | | [optional] | +|**makerUsdtAmount** | **String** | | [optional] | +|**makerShareQty** | **String** | | [optional] | +|**filledUsdtAmount** | **String** | | [optional] | +|**filledShareQty** | **String** | | [optional] | +|**fillPercentage** | **String** | | [optional] | +|**price** | **String** | | [optional] | +|**marketProviderFee** | **String** | | [optional] | +|**networkFee** | **String** | | [optional] | + + + diff --git a/clients/w3w-prediction/docs/QueryPaymentOptionBalancesResponse.md b/clients/w3w-prediction/docs/QueryPaymentOptionBalancesResponse.md new file mode 100644 index 000000000..fbb2e65a6 --- /dev/null +++ b/clients/w3w-prediction/docs/QueryPaymentOptionBalancesResponse.md @@ -0,0 +1,13 @@ + + +# QueryPaymentOptionBalancesResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**items** | [**List<QueryPaymentOptionBalancesResponseItemsInner>**](QueryPaymentOptionBalancesResponseItemsInner.md) | | [optional] | + + + diff --git a/clients/w3w-prediction/docs/QueryPaymentOptionBalancesResponseItemsInner.md b/clients/w3w-prediction/docs/QueryPaymentOptionBalancesResponseItemsInner.md new file mode 100644 index 000000000..ccf6c3561 --- /dev/null +++ b/clients/w3w-prediction/docs/QueryPaymentOptionBalancesResponseItemsInner.md @@ -0,0 +1,15 @@ + + +# QueryPaymentOptionBalancesResponseItemsInner + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**accountType** | **String** | | [optional] | +|**availableBalanceDisplay** | **String** | | [optional] | +|**enabled** | **Boolean** | | [optional] | + + + diff --git a/clients/w3w-prediction/docs/QueryPnLResponse.md b/clients/w3w-prediction/docs/QueryPnLResponse.md new file mode 100644 index 000000000..3fc8c4968 --- /dev/null +++ b/clients/w3w-prediction/docs/QueryPnLResponse.md @@ -0,0 +1,20 @@ + + +# QueryPnLResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**chainId** | **String** | | [optional] | +|**walletAddress** | **String** | | [optional] | +|**pnl** | **Object** | | [optional] | +|**pnlList** | [**List<GetPortfolioResponsePositionsInner>**](GetPortfolioResponsePositionsInner.md) | | [optional] | +|**totalCount** | **Integer** | | [optional] | +|**totalRealizedPnl** | **String** | | [optional] | +|**totalUnrealizedPnl** | **String** | | [optional] | +|**totalPnl** | **String** | | [optional] | + + + diff --git a/clients/w3w-prediction/docs/QueryPositionsByFilterResponse.md b/clients/w3w-prediction/docs/QueryPositionsByFilterResponse.md new file mode 100644 index 000000000..62eb13f11 --- /dev/null +++ b/clients/w3w-prediction/docs/QueryPositionsByFilterResponse.md @@ -0,0 +1,13 @@ + + +# QueryPositionsByFilterResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**positions** | [**List<QueryPositionsByFilterResponsePositionsInner>**](QueryPositionsByFilterResponsePositionsInner.md) | | [optional] | + + + diff --git a/clients/w3w-prediction/docs/QueryPositionsByFilterResponsePositionsInner.md b/clients/w3w-prediction/docs/QueryPositionsByFilterResponsePositionsInner.md new file mode 100644 index 000000000..ec78cc2b6 --- /dev/null +++ b/clients/w3w-prediction/docs/QueryPositionsByFilterResponsePositionsInner.md @@ -0,0 +1,36 @@ + + +# QueryPositionsByFilterResponsePositionsInner + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**positionId** | **Long** | | [optional] | +|**vendor** | **String** | | [optional] | +|**chainId** | **String** | | [optional] | +|**tokenId** | **String** | | [optional] | +|**collateralSymbol** | **String** | | [optional] | +|**topicType** | **String** | | [optional] | +|**marketTopicId** | **Long** | | [optional] | +|**marketId** | **Long** | | [optional] | +|**marketTopicTitle** | **String** | | [optional] | +|**marketTitle** | **String** | | [optional] | +|**outcomeName** | **String** | | [optional] | +|**outcomeIndex** | **Integer** | | [optional] | +|**shares** | **String** | | [optional] | +|**avgPrice** | **String** | | [optional] | +|**totalCost** | **String** | | [optional] | +|**value** | **String** | | [optional] | +|**currentPrice** | **String** | | [optional] | +|**positionStatus** | **String** | | [optional] | +|**endDate** | **Long** | | [optional] | +|**unrealizedPnl** | **String** | | [optional] | +|**realizedPnl** | **String** | | [optional] | +|**pnl** | **String** | | [optional] | +|**createdTime** | **Long** | | [optional] | +|**updatedTime** | **Long** | | [optional] | + + + diff --git a/clients/w3w-prediction/docs/QueryPositionsResponse.md b/clients/w3w-prediction/docs/QueryPositionsResponse.md new file mode 100644 index 000000000..6f4f6eaf4 --- /dev/null +++ b/clients/w3w-prediction/docs/QueryPositionsResponse.md @@ -0,0 +1,15 @@ + + +# QueryPositionsResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**summary** | [**QueryPositionsResponseSummary**](QueryPositionsResponseSummary.md) | | [optional] | +|**counts** | [**QueryPositionsResponseCounts**](QueryPositionsResponseCounts.md) | | [optional] | +|**positions** | [**List<QueryPositionsResponsePositionsInner>**](QueryPositionsResponsePositionsInner.md) | | [optional] | + + + diff --git a/clients/w3w-prediction/docs/QueryPositionsResponseCounts.md b/clients/w3w-prediction/docs/QueryPositionsResponseCounts.md new file mode 100644 index 000000000..35a254f5d --- /dev/null +++ b/clients/w3w-prediction/docs/QueryPositionsResponseCounts.md @@ -0,0 +1,15 @@ + + +# QueryPositionsResponseCounts + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**ongoingCount** | **Integer** | | [optional] | +|**endedCount** | **Integer** | | [optional] | +|**pendingClaimCount** | **Integer** | | [optional] | + + + diff --git a/clients/w3w-prediction/docs/QueryPositionsResponsePositionsInner.md b/clients/w3w-prediction/docs/QueryPositionsResponsePositionsInner.md new file mode 100644 index 000000000..29d4745e8 --- /dev/null +++ b/clients/w3w-prediction/docs/QueryPositionsResponsePositionsInner.md @@ -0,0 +1,39 @@ + + +# QueryPositionsResponsePositionsInner + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**positionId** | **Long** | | [optional] | +|**vendor** | **String** | | [optional] | +|**chainId** | **String** | | [optional] | +|**tokenId** | **String** | | [optional] | +|**collateralSymbol** | **String** | | [optional] | +|**topicType** | **String** | | [optional] | +|**marketTopicId** | **Long** | | [optional] | +|**marketId** | **Long** | | [optional] | +|**marketTopicTitle** | **String** | | [optional] | +|**marketTitle** | **String** | | [optional] | +|**outcomeName** | **String** | | [optional] | +|**outcomeIndex** | **Integer** | | [optional] | +|**shares** | **String** | | [optional] | +|**avgPrice** | **String** | | [optional] | +|**totalCost** | **String** | | [optional] | +|**value** | **String** | | [optional] | +|**currentPrice** | **String** | | [optional] | +|**toWin** | **String** | | [optional] | +|**positionStatus** | **String** | | [optional] | +|**canClaim** | **Boolean** | | [optional] | +|**endDate** | **Long** | | [optional] | +|**unrealizedPnl** | **String** | | [optional] | +|**unrealizedPnlPercent** | **String** | | [optional] | +|**realizedPnl** | **String** | | [optional] | +|**pnl** | **String** | | [optional] | +|**createdTime** | **Long** | | [optional] | +|**updatedTime** | **Long** | | [optional] | + + + diff --git a/clients/w3w-prediction/docs/QueryPositionsResponseSummary.md b/clients/w3w-prediction/docs/QueryPositionsResponseSummary.md new file mode 100644 index 000000000..d55cf4f28 --- /dev/null +++ b/clients/w3w-prediction/docs/QueryPositionsResponseSummary.md @@ -0,0 +1,19 @@ + + +# QueryPositionsResponseSummary + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**totalValue** | **String** | | [optional] | +|**positionValue** | **String** | | [optional] | +|**walletBalance** | **String** | | [optional] | +|**totalClaimableAmount** | **String** | | [optional] | +|**todayRealizedPnl** | **String** | | [optional] | +|**todayRealizedPnlPercent** | **String** | | [optional] | +|**todayTotalCost** | **String** | | [optional] | + + + diff --git a/clients/w3w-prediction/docs/QuerySettledPositionHistoryResponse.md b/clients/w3w-prediction/docs/QuerySettledPositionHistoryResponse.md new file mode 100644 index 000000000..de43b7378 --- /dev/null +++ b/clients/w3w-prediction/docs/QuerySettledPositionHistoryResponse.md @@ -0,0 +1,14 @@ + + +# QuerySettledPositionHistoryResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**totalCount** | **Integer** | | [optional] | +|**positions** | [**List<QuerySettledPositionHistoryResponsePositionsInner>**](QuerySettledPositionHistoryResponsePositionsInner.md) | | [optional] | + + + diff --git a/clients/w3w-prediction/docs/QuerySettledPositionHistoryResponsePositionsInner.md b/clients/w3w-prediction/docs/QuerySettledPositionHistoryResponsePositionsInner.md new file mode 100644 index 000000000..5af6f52d3 --- /dev/null +++ b/clients/w3w-prediction/docs/QuerySettledPositionHistoryResponsePositionsInner.md @@ -0,0 +1,41 @@ + + +# QuerySettledPositionHistoryResponsePositionsInner + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**positionId** | **Long** | | [optional] | +|**vendor** | **String** | | [optional] | +|**chainId** | **String** | | [optional] | +|**tokenId** | **String** | | [optional] | +|**collateralSymbol** | **String** | | [optional] | +|**topicType** | **String** | | [optional] | +|**marketTopicId** | **Long** | | [optional] | +|**marketId** | **Long** | | [optional] | +|**marketTopicTitle** | **String** | | [optional] | +|**marketTitle** | **String** | | [optional] | +|**outcomeName** | **String** | | [optional] | +|**outcomeIndex** | **Integer** | | [optional] | +|**shares** | **String** | | [optional] | +|**avgPrice** | **String** | | [optional] | +|**totalCost** | **String** | | [optional] | +|**value** | **String** | | [optional] | +|**currentPrice** | **String** | | [optional] | +|**toWin** | **String** | | [optional] | +|**positionStatus** | **String** | | [optional] | +|**isWinner** | **Boolean** | | [optional] | +|**redeemStatus** | **String** | | [optional] | +|**endDate** | **Long** | | [optional] | +|**finalOutcome** | **String** | | [optional] | +|**realizedPnl** | **String** | | [optional] | +|**pnl** | **String** | | [optional] | +|**claimAmount** | **String** | | [optional] | +|**settledDate** | **Long** | | [optional] | +|**createdTime** | **Long** | | [optional] | +|**updatedTime** | **Long** | | [optional] | + + + diff --git a/clients/w3w-prediction/docs/QueryTransferListResponse.md b/clients/w3w-prediction/docs/QueryTransferListResponse.md new file mode 100644 index 000000000..685516e93 --- /dev/null +++ b/clients/w3w-prediction/docs/QueryTransferListResponse.md @@ -0,0 +1,13 @@ + + +# QueryTransferListResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**transfers** | [**List<QueryTransferListResponseTransfersInner>**](QueryTransferListResponseTransfersInner.md) | | [optional] | + + + diff --git a/clients/w3w-prediction/docs/QueryTransferListResponseTransfersInner.md b/clients/w3w-prediction/docs/QueryTransferListResponseTransfersInner.md new file mode 100644 index 000000000..ad0e8690f --- /dev/null +++ b/clients/w3w-prediction/docs/QueryTransferListResponseTransfersInner.md @@ -0,0 +1,25 @@ + + +# QueryTransferListResponseTransfersInner + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**transferId** | **String** | | [optional] | +|**direction** | **String** | | [optional] | +|**status** | **String** | | [optional] | +|**walletAddress** | **String** | | [optional] | +|**fromToken** | **String** | | [optional] | +|**fromTokenAmount** | **String** | | [optional] | +|**toToken** | **String** | | [optional] | +|**toTokenAmount** | **String** | | [optional] | +|**errorCode** | **String** | | [optional] | +|**errorMessage** | **String** | | [optional] | +|**createTime** | **String** | | [optional] | +|**updateTime** | **String** | | [optional] | +|**completeAt** | **String** | | [optional] | + + + diff --git a/clients/w3w-prediction/docs/QueryTransferStatusResponse.md b/clients/w3w-prediction/docs/QueryTransferStatusResponse.md new file mode 100644 index 000000000..a0d1343d1 --- /dev/null +++ b/clients/w3w-prediction/docs/QueryTransferStatusResponse.md @@ -0,0 +1,23 @@ + + +# QueryTransferStatusResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**transferId** | **String** | | [optional] | +|**direction** | **String** | | [optional] | +|**status** | **String** | | [optional] | +|**fromToken** | **String** | | [optional] | +|**fromTokenAmount** | **String** | | [optional] | +|**toToken** | **String** | | [optional] | +|**toTokenAmount** | **String** | | [optional] | +|**errorCode** | **String** | | [optional] | +|**errorMessage** | **String** | | [optional] | +|**createTime** | **String** | | [optional] | +|**updateTime** | **String** | | [optional] | + + + diff --git a/clients/w3w-prediction/docs/RedeemApi.md b/clients/w3w-prediction/docs/RedeemApi.md new file mode 100644 index 000000000..203e8d6ab --- /dev/null +++ b/clients/w3w-prediction/docs/RedeemApi.md @@ -0,0 +1,138 @@ +# RedeemApi + +All URIs are relative to *https://api.binance.com* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**batchRedeem**](RedeemApi.md#batchRedeem) | **POST** /sapi/v1/w3w/wallet/prediction/batch-redeem | Batch Redeem | +| [**getRedeemStatus**](RedeemApi.md#getRedeemStatus) | **GET** /sapi/v1/w3w/wallet/prediction/redeem/status | Get Redeem Status | + + + +# **batchRedeem** +> BatchRedeemResponse batchRedeem(batchRedeemRequest) + +Batch Redeem + +Redeem one or more settled prediction tokens on-chain to claim winnings. Requires SAS authorization. Weight(IP): 200 Security Type: TRADE + +### Example +```java +// Import classes: +import com.binance.connector.client.w3w_prediction.ApiClient; +import com.binance.connector.client.w3w_prediction.ApiException; +import com.binance.connector.client.w3w_prediction.Configuration; +import com.binance.connector.client.w3w_prediction.models.*; +import com.binance.connector.client.w3w_prediction.rest.api.RedeemApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.binance.com"); + + RedeemApi apiInstance = new RedeemApi(defaultClient); + BatchRedeemRequest batchRedeemRequest = new BatchRedeemRequest(); // BatchRedeemRequest | + try { + BatchRedeemResponse result = apiInstance.batchRedeem(batchRedeemRequest); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling RedeemApi#batchRedeem"); + 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 | +|------------- | ------------- | ------------- | -------------| +| **batchRedeemRequest** | [**BatchRedeemRequest**](BatchRedeemRequest.md)| | | + +### Return type + +[**BatchRedeemResponse**](BatchRedeemResponse.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** | Batch Redeem | - | + + +# **getRedeemStatus** +> GetRedeemStatusResponse getRedeemStatus(walletAddress, txHash, recvWindow) + +Get Redeem Status + +Query the on-chain transaction status of a previously submitted redeem request. Weight(IP): 200 Security Type: USER_DATA Response Notes: - Status values: | Value | Description | | ----------- | -------------------------------------------- | | `PENDING` | Transaction submitted, awaiting confirmation | | `CONFIRMED` | Transaction confirmed on-chain | | `FAILED` | Transaction failed | | `NOT_FOUND` | Transaction hash not found | + +### Example +```java +// Import classes: +import com.binance.connector.client.w3w_prediction.ApiClient; +import com.binance.connector.client.w3w_prediction.ApiException; +import com.binance.connector.client.w3w_prediction.Configuration; +import com.binance.connector.client.w3w_prediction.models.*; +import com.binance.connector.client.w3w_prediction.rest.api.RedeemApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.binance.com"); + + RedeemApi apiInstance = new RedeemApi(defaultClient); + String walletAddress = "0x12e32db8817e292508c34111cbc4b23340df542c"; // String | User's prediction wallet address + String txHash = "0xabc123def456789abcdef123456789abcdef123456789abcdef123456789abcd"; // String | Redeem transaction hash + Long recvWindow = 5000L; // Long | Request validity window in milliseconds + try { + GetRedeemStatusResponse result = apiInstance.getRedeemStatus(walletAddress, txHash, recvWindow); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling RedeemApi#getRedeemStatus"); + 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 | +|------------- | ------------- | ------------- | -------------| +| **walletAddress** | **String**| User's prediction wallet address | | +| **txHash** | **String**| Redeem transaction hash | | +| **recvWindow** | **Long**| Request validity window in milliseconds | [optional] | + +### Return type + +[**GetRedeemStatusResponse**](GetRedeemStatusResponse.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 Redeem Status | - | + diff --git a/clients/w3w-prediction/docs/Side.md b/clients/w3w-prediction/docs/Side.md new file mode 100644 index 000000000..689c903df --- /dev/null +++ b/clients/w3w-prediction/docs/Side.md @@ -0,0 +1,13 @@ + + +# Side + +## Enum + + +* `BUY` (value: `"BUY"`) + +* `SELL` (value: `"SELL"`) + + + diff --git a/clients/w3w-prediction/docs/SortBy.md b/clients/w3w-prediction/docs/SortBy.md new file mode 100644 index 000000000..dbb186d02 --- /dev/null +++ b/clients/w3w-prediction/docs/SortBy.md @@ -0,0 +1,19 @@ + + +# SortBy + +## Enum + + +* `RECOMMENDED` (value: `"RECOMMENDED"`) + +* `VOLUME` (value: `"VOLUME"`) + +* `PARTICIPANTS` (value: `"PARTICIPANTS"`) + +* `CREATED_TIME` (value: `"CREATED_TIME"`) + +* `END_DATE` (value: `"END_DATE"`) + + + diff --git a/clients/w3w-prediction/docs/SourceBiz.md b/clients/w3w-prediction/docs/SourceBiz.md new file mode 100644 index 000000000..44b4a6de1 --- /dev/null +++ b/clients/w3w-prediction/docs/SourceBiz.md @@ -0,0 +1,13 @@ + + +# SourceBiz + +## Enum + + +* `USER_TRANSFER` (value: `"USER_TRANSFER"`) + +* `PREDICTION_BUY` (value: `"PREDICTION_BUY"`) + + + diff --git a/clients/w3w-prediction/docs/TokenIds.md b/clients/w3w-prediction/docs/TokenIds.md new file mode 100644 index 000000000..15bf637f2 --- /dev/null +++ b/clients/w3w-prediction/docs/TokenIds.md @@ -0,0 +1,13 @@ + + +# TokenIds + +List of prediction token IDs to redeem. Not empty. Example: `tokenIds=112233&tokenIds=112234` + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| + + + diff --git a/clients/w3w-prediction/docs/TradeApi.md b/clients/w3w-prediction/docs/TradeApi.md new file mode 100644 index 000000000..116b1e4ba --- /dev/null +++ b/clients/w3w-prediction/docs/TradeApi.md @@ -0,0 +1,351 @@ +# TradeApi + +All URIs are relative to *https://api.binance.com* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**batchCancelOrders**](TradeApi.md#batchCancelOrders) | **POST** /sapi/v1/w3w/wallet/prediction/trade/batch-cancel | Batch Cancel Orders | +| [**getQuote**](TradeApi.md#getQuote) | **POST** /sapi/v1/w3w/wallet/prediction/trade/get-quote | Get Quote | +| [**placeOrder**](TradeApi.md#placeOrder) | **POST** /sapi/v1/w3w/wallet/prediction/trade/place-order-bundle | Place Order | +| [**queryActiveOrders**](TradeApi.md#queryActiveOrders) | **GET** /sapi/v1/w3w/wallet/prediction/order/list | Query Active Orders | +| [**queryOrderHistory**](TradeApi.md#queryOrderHistory) | **GET** /sapi/v1/w3w/wallet/prediction/order/history | Query Order History | + + + +# **batchCancelOrders** +> BatchCancelOrdersResponse batchCancelOrders(batchCancelOrdersRequest) + +Batch Cancel Orders + +Cancel one or more active prediction orders in a single request. Requires SAS authorization. **Known Issue — Bracket Encoding Incompatibility:** This endpoint uses indexed bracket notation (`cancelInfoList[0].orderId`). Binance SAPI signature verification runs over the **raw, unencoded** canonical string. However, mainstream HTTP libraries (Python `requests`, Java `HttpURLConnection`/`URI`, Go `net/url`, Node.js `url`) automatically percent-encode `[` → `%5B` and `]` → `%5D`, producing a signature mismatch with error `-1022 Signature for this request is not valid`. Postman is unaffected because it does not encode keys. **Workarounds** (use low-level HTTP APIs that do not normalize URLs): - **Python:** use `http.client` (stdlib) and hand-build the body string. - **Java:** use `HttpURLConnection` and write the raw body bytes directly. - **Go:** use `strings.NewReader` with a hand-built body instead of `url.Values.Encode()`. Weight(IP): 200 Security Type: TRADE Notes: - Use dot notation for nested list fields: `cancelInfoList[0].orderId`, `cancelInfoList[1].orderId`, etc. - `vendor` does not need to be supplied. The server automatically sets the correct vendor (`predict_fun`) for every item in the batch. + +### Example +```java +// Import classes: +import com.binance.connector.client.w3w_prediction.ApiClient; +import com.binance.connector.client.w3w_prediction.ApiException; +import com.binance.connector.client.w3w_prediction.Configuration; +import com.binance.connector.client.w3w_prediction.models.*; +import com.binance.connector.client.w3w_prediction.rest.api.TradeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.binance.com"); + + TradeApi apiInstance = new TradeApi(defaultClient); + BatchCancelOrdersRequest batchCancelOrdersRequest = new BatchCancelOrdersRequest(); // BatchCancelOrdersRequest | + try { + BatchCancelOrdersResponse result = apiInstance.batchCancelOrders(batchCancelOrdersRequest); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling TradeApi#batchCancelOrders"); + 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 | +|------------- | ------------- | ------------- | -------------| +| **batchCancelOrdersRequest** | [**BatchCancelOrdersRequest**](BatchCancelOrdersRequest.md)| | | + +### Return type + +[**BatchCancelOrdersResponse**](BatchCancelOrdersResponse.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** | Batch Cancel Orders | - | + + +# **getQuote** +> GetQuoteResponse getQuote(getQuoteRequest) + +Get Quote + +Get a price quote for a prediction order. The returned `quoteId` must be used in the subsequent Place Order request. Weight(IP): 200 Security Type: TRADE Response Notes: - `feeAmount` is a string because it is denominated in wei (18 decimals) and may exceed JavaScript's safe integer range. `feeDiscountBps` is also a string to allow fractional basis-point values in the future. `feeRateBps` and `slippageBps` are integers and will never exceed safe integer bounds. - **MARKET order minimum amount:** For `MARKET` orders, `amountIn` must be at least approximately **1.5 USDT** (in wei: `1500000000000000000`). The exact minimum varies by market liquidity. If the amount is too small, the server returns `-9000 Your order amount is too small`. This limit does **not** apply to `LIMIT` orders. + +### Example +```java +// Import classes: +import com.binance.connector.client.w3w_prediction.ApiClient; +import com.binance.connector.client.w3w_prediction.ApiException; +import com.binance.connector.client.w3w_prediction.Configuration; +import com.binance.connector.client.w3w_prediction.models.*; +import com.binance.connector.client.w3w_prediction.rest.api.TradeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.binance.com"); + + TradeApi apiInstance = new TradeApi(defaultClient); + GetQuoteRequest getQuoteRequest = new GetQuoteRequest(); // GetQuoteRequest | + try { + GetQuoteResponse result = apiInstance.getQuote(getQuoteRequest); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling TradeApi#getQuote"); + 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 | +|------------- | ------------- | ------------- | -------------| +| **getQuoteRequest** | [**GetQuoteRequest**](GetQuoteRequest.md)| | | + +### Return type + +[**GetQuoteResponse**](GetQuoteResponse.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 Quote | - | + + +# **placeOrder** +> PlaceOrderResponse placeOrder(placeOrderRequest) + +Place Order + +Place a prediction order using a previously obtained quote. Requires SAS authorization. Weight(IP): 200 Security Type: TRADE Notes: - Validation rules: | orderType | timeInForce | priceLimit | | --------- | ------------- | --------------------- | | `MARKET` | Must be `FOK` | Not required | | `LIMIT` | Must be `GTC` | Required, must be > 0 | + +### Example +```java +// Import classes: +import com.binance.connector.client.w3w_prediction.ApiClient; +import com.binance.connector.client.w3w_prediction.ApiException; +import com.binance.connector.client.w3w_prediction.Configuration; +import com.binance.connector.client.w3w_prediction.models.*; +import com.binance.connector.client.w3w_prediction.rest.api.TradeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.binance.com"); + + TradeApi apiInstance = new TradeApi(defaultClient); + PlaceOrderRequest placeOrderRequest = new PlaceOrderRequest(); // PlaceOrderRequest | + try { + PlaceOrderResponse result = apiInstance.placeOrder(placeOrderRequest); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling TradeApi#placeOrder"); + 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 | +|------------- | ------------- | ------------- | -------------| +| **placeOrderRequest** | [**PlaceOrderRequest**](PlaceOrderRequest.md)| | | + +### Return type + +[**PlaceOrderResponse**](PlaceOrderResponse.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** | Place Order | - | + + +# **queryActiveOrders** +> QueryActiveOrdersResponse queryActiveOrders(walletAddress, tradeSide, l1Category, marketId, offset, limit, recvWindow) + +Query Active Orders + +Get active (open) prediction orders for the authenticated user. Weight(IP): 200 Security Type: USER_DATA + +### Example +```java +// Import classes: +import com.binance.connector.client.w3w_prediction.ApiClient; +import com.binance.connector.client.w3w_prediction.ApiException; +import com.binance.connector.client.w3w_prediction.Configuration; +import com.binance.connector.client.w3w_prediction.models.*; +import com.binance.connector.client.w3w_prediction.rest.api.TradeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.binance.com"); + + TradeApi apiInstance = new TradeApi(defaultClient); + String walletAddress = "0x12e32db8817e292508c34111cbc4b23340df542c"; // String | User's prediction wallet address + TradeSide tradeSide = TradeSide.fromValue("BUY"); // TradeSide | Filter by trade side. Enum: `BUY`, `SELL` + String l1Category = "crypto"; // String | Filter by level-1 category + Long marketId = 5567895L; // Long | Filter by market ID + Integer offset = 0; // Integer | Pagination offset. Default `0` + Integer limit = 20; // Integer | Page size. Default `20`, range 1–100 + Long recvWindow = 5000L; // Long | Request validity window in milliseconds + try { + QueryActiveOrdersResponse result = apiInstance.queryActiveOrders(walletAddress, tradeSide, l1Category, marketId, offset, limit, recvWindow); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling TradeApi#queryActiveOrders"); + 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 | +|------------- | ------------- | ------------- | -------------| +| **walletAddress** | **String**| User's prediction wallet address | | +| **tradeSide** | [**TradeSide**](.md)| Filter by trade side. Enum: `BUY`, `SELL` | [optional] [enum: BUY, SELL] | +| **l1Category** | **String**| Filter by level-1 category | [optional] | +| **marketId** | **Long**| Filter by market ID | [optional] | +| **offset** | **Integer**| Pagination offset. Default `0` | [optional] | +| **limit** | **Integer**| Page size. Default `20`, range 1–100 | [optional] | +| **recvWindow** | **Long**| Request validity window in milliseconds | [optional] | + +### Return type + +[**QueryActiveOrdersResponse**](QueryActiveOrdersResponse.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** | Query Active Orders | - | + + +# **queryOrderHistory** +> QueryOrderHistoryResponse queryOrderHistory(walletAddress, l1Category, orderType, status, startDate, endDate, offset, limit, recvWindow) + +Query Order History + +Get historical prediction orders (all statuses) for the authenticated user, with optional filters. Weight(IP): 200 Security Type: USER_DATA + +### Example +```java +// Import classes: +import com.binance.connector.client.w3w_prediction.ApiClient; +import com.binance.connector.client.w3w_prediction.ApiException; +import com.binance.connector.client.w3w_prediction.Configuration; +import com.binance.connector.client.w3w_prediction.models.*; +import com.binance.connector.client.w3w_prediction.rest.api.TradeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.binance.com"); + + TradeApi apiInstance = new TradeApi(defaultClient); + String walletAddress = "0x12e32db8817e292508c34111cbc4b23340df542c"; // String | User's prediction wallet address + String l1Category = "crypto"; // String | Filter by level-1 category + OrderType orderType = OrderType.fromValue("MARKET"); // OrderType | Filter by order type. Enum: `MARKET`, `LIMIT` + String status = "CLOSED"; // String | Filter by order status + String startDate = "2026-05-01"; // String | Start date. Format: `yyyy-MM-dd`. Must be ≤ `endDate` + String endDate = "2026-05-25"; // String | End date. Format: `yyyy-MM-dd`. Must be ≥ `startDate` + Integer offset = 0; // Integer | Pagination offset. Default `0` + Integer limit = 20; // Integer | Page size. Default `20`, range 1–100 + Long recvWindow = 5000L; // Long | Request validity window in milliseconds + try { + QueryOrderHistoryResponse result = apiInstance.queryOrderHistory(walletAddress, l1Category, orderType, status, startDate, endDate, offset, limit, recvWindow); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling TradeApi#queryOrderHistory"); + 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 | +|------------- | ------------- | ------------- | -------------| +| **walletAddress** | **String**| User's prediction wallet address | | +| **l1Category** | **String**| Filter by level-1 category | [optional] | +| **orderType** | [**OrderType**](.md)| Filter by order type. Enum: `MARKET`, `LIMIT` | [optional] [enum: MARKET, LIMIT] | +| **status** | **String**| Filter by order status | [optional] | +| **startDate** | **String**| Start date. Format: `yyyy-MM-dd`. Must be ≤ `endDate` | [optional] | +| **endDate** | **String**| End date. Format: `yyyy-MM-dd`. Must be ≥ `startDate` | [optional] | +| **offset** | **Integer**| Pagination offset. Default `0` | [optional] | +| **limit** | **Integer**| Page size. Default `20`, range 1–100 | [optional] | +| **recvWindow** | **Long**| Request validity window in milliseconds | [optional] | + +### Return type + +[**QueryOrderHistoryResponse**](QueryOrderHistoryResponse.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** | Query Order History | - | + diff --git a/clients/w3w-prediction/docs/TradeSide.md b/clients/w3w-prediction/docs/TradeSide.md new file mode 100644 index 000000000..3a4f4b4ff --- /dev/null +++ b/clients/w3w-prediction/docs/TradeSide.md @@ -0,0 +1,13 @@ + + +# TradeSide + +## Enum + + +* `BUY` (value: `"BUY"`) + +* `SELL` (value: `"SELL"`) + + + diff --git a/clients/w3w-prediction/docs/TransferApi.md b/clients/w3w-prediction/docs/TransferApi.md new file mode 100644 index 000000000..c43633043 --- /dev/null +++ b/clients/w3w-prediction/docs/TransferApi.md @@ -0,0 +1,276 @@ +# TransferApi + +All URIs are relative to *https://api.binance.com* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**createInboundTransfer**](TransferApi.md#createInboundTransfer) | **POST** /sapi/v1/w3w/wallet/prediction/transfer/inbound | Create Inbound Transfer | +| [**createOutboundTransfer**](TransferApi.md#createOutboundTransfer) | **POST** /sapi/v1/w3w/wallet/prediction/transfer/outbound | Create Outbound Transfer | +| [**queryTransferList**](TransferApi.md#queryTransferList) | **GET** /sapi/v1/w3w/wallet/prediction/transfer/list | Query Transfer List | +| [**queryTransferStatus**](TransferApi.md#queryTransferStatus) | **GET** /sapi/v1/w3w/wallet/prediction/transfer/status | Query Transfer Status | + + + +# **createInboundTransfer** +> CreateInboundTransferResponse createInboundTransfer(createInboundTransferRequest) + +Create Inbound Transfer + +Transfer funds from the prediction wallet back to the user's CEX account (SPOT or FUNDING). Requires SAS authorization. ⚠️ **SAS Authorization Required:** This endpoint enforces SAS (Self-Authorization Service) authorization. If SAS is not enabled for the wallet, the request will be rejected with `-31003 SAS authorization required`. Enable SAS for your wallet before calling this endpoint. Weight(IP): 200 Security Type: TRADE + +### Example +```java +// Import classes: +import com.binance.connector.client.w3w_prediction.ApiClient; +import com.binance.connector.client.w3w_prediction.ApiException; +import com.binance.connector.client.w3w_prediction.Configuration; +import com.binance.connector.client.w3w_prediction.models.*; +import com.binance.connector.client.w3w_prediction.rest.api.TransferApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.binance.com"); + + TransferApi apiInstance = new TransferApi(defaultClient); + CreateInboundTransferRequest createInboundTransferRequest = new CreateInboundTransferRequest(); // CreateInboundTransferRequest | + try { + CreateInboundTransferResponse result = apiInstance.createInboundTransfer(createInboundTransferRequest); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling TransferApi#createInboundTransfer"); + 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 | +|------------- | ------------- | ------------- | -------------| +| **createInboundTransferRequest** | [**CreateInboundTransferRequest**](CreateInboundTransferRequest.md)| | | + +### Return type + +[**CreateInboundTransferResponse**](CreateInboundTransferResponse.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** | Create Inbound Transfer | - | + + +# **createOutboundTransfer** +> CreateOutboundTransferResponse createOutboundTransfer(createOutboundTransferRequest) + +Create Outbound Transfer + +Transfer funds from the user's CEX account (SPOT or FUNDING) into the prediction wallet. Requires SAS authorization. Weight(IP): 200 Security Type: TRADE + +### Example +```java +// Import classes: +import com.binance.connector.client.w3w_prediction.ApiClient; +import com.binance.connector.client.w3w_prediction.ApiException; +import com.binance.connector.client.w3w_prediction.Configuration; +import com.binance.connector.client.w3w_prediction.models.*; +import com.binance.connector.client.w3w_prediction.rest.api.TransferApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.binance.com"); + + TransferApi apiInstance = new TransferApi(defaultClient); + CreateOutboundTransferRequest createOutboundTransferRequest = new CreateOutboundTransferRequest(); // CreateOutboundTransferRequest | + try { + CreateOutboundTransferResponse result = apiInstance.createOutboundTransfer(createOutboundTransferRequest); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling TransferApi#createOutboundTransfer"); + 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 | +|------------- | ------------- | ------------- | -------------| +| **createOutboundTransferRequest** | [**CreateOutboundTransferRequest**](CreateOutboundTransferRequest.md)| | | + +### Return type + +[**CreateOutboundTransferResponse**](CreateOutboundTransferResponse.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** | Create Outbound Transfer | - | + + +# **queryTransferList** +> QueryTransferListResponse queryTransferList(walletAddress, startDate, endDate, tokenSymbol, direction, offset, limit, recvWindow) + +Query Transfer List + +Get the authenticated user's prediction wallet transfer history within a date range. Weight(IP): 200 Security Type: USER_DATA + +### Example +```java +// Import classes: +import com.binance.connector.client.w3w_prediction.ApiClient; +import com.binance.connector.client.w3w_prediction.ApiException; +import com.binance.connector.client.w3w_prediction.Configuration; +import com.binance.connector.client.w3w_prediction.models.*; +import com.binance.connector.client.w3w_prediction.rest.api.TransferApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.binance.com"); + + TransferApi apiInstance = new TransferApi(defaultClient); + String walletAddress = "0x12e32db8817e292508c34111cbc4b23340df542c"; // String | User's prediction wallet address + String startDate = "2026-05-01"; // String | Start date. Format: `yyyy-MM-dd`. Must be ≤ `endDate` + String endDate = "2026-05-25"; // String | End date. Format: `yyyy-MM-dd`. Must be ≥ `startDate` + String tokenSymbol = "USDT"; // String | Filter by token symbol (e.g. `USDT`) + Direction direction = Direction.fromValue("INBOUND"); // Direction | Filter by direction. Enum: `INBOUND`, `OUTBOUND` + Integer offset = 0; // Integer | Pagination offset. Default `0` + Integer limit = 20; // Integer | Page size. Default `20`, range 1–100 + Long recvWindow = 5000L; // Long | Request validity window in milliseconds + try { + QueryTransferListResponse result = apiInstance.queryTransferList(walletAddress, startDate, endDate, tokenSymbol, direction, offset, limit, recvWindow); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling TransferApi#queryTransferList"); + 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 | +|------------- | ------------- | ------------- | -------------| +| **walletAddress** | **String**| User's prediction wallet address | | +| **startDate** | **String**| Start date. Format: `yyyy-MM-dd`. Must be ≤ `endDate` | | +| **endDate** | **String**| End date. Format: `yyyy-MM-dd`. Must be ≥ `startDate` | | +| **tokenSymbol** | **String**| Filter by token symbol (e.g. `USDT`) | [optional] | +| **direction** | [**Direction**](.md)| Filter by direction. Enum: `INBOUND`, `OUTBOUND` | [optional] [enum: INBOUND, OUTBOUND] | +| **offset** | **Integer**| Pagination offset. Default `0` | [optional] | +| **limit** | **Integer**| Page size. Default `20`, range 1–100 | [optional] | +| **recvWindow** | **Long**| Request validity window in milliseconds | [optional] | + +### Return type + +[**QueryTransferListResponse**](QueryTransferListResponse.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** | Query Transfer List | - | + + +# **queryTransferStatus** +> QueryTransferStatusResponse queryTransferStatus(transferId, recvWindow) + +Query Transfer Status + +Query the current status of a prediction wallet transfer by transfer ID. **`status` values:** Terminal states are `COMPLETED` and `FAILED`. Intermediate states are `PROCESSING` and `PENDING`. **Do not** poll for `SUCCESS` — it is not a valid terminal state. Weight(IP): 200 Security Type: USER_DATA + +### Example +```java +// Import classes: +import com.binance.connector.client.w3w_prediction.ApiClient; +import com.binance.connector.client.w3w_prediction.ApiException; +import com.binance.connector.client.w3w_prediction.Configuration; +import com.binance.connector.client.w3w_prediction.models.*; +import com.binance.connector.client.w3w_prediction.rest.api.TransferApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.binance.com"); + + TransferApi apiInstance = new TransferApi(defaultClient); + String transferId = "tf_20260525_out_001"; // String | Transfer ID returned from outbound/inbound transfer + Long recvWindow = 5000L; // Long | Request validity window in milliseconds + try { + QueryTransferStatusResponse result = apiInstance.queryTransferStatus(transferId, recvWindow); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling TransferApi#queryTransferStatus"); + 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 | +|------------- | ------------- | ------------- | -------------| +| **transferId** | **String**| Transfer ID returned from outbound/inbound transfer | | +| **recvWindow** | **Long**| Request validity window in milliseconds | [optional] | + +### Return type + +[**QueryTransferStatusResponse**](QueryTransferStatusResponse.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** | Query Transfer Status | - | + diff --git a/clients/w3w-prediction/docs/WalletApi.md b/clients/w3w-prediction/docs/WalletApi.md new file mode 100644 index 000000000..dc471be28 --- /dev/null +++ b/clients/w3w-prediction/docs/WalletApi.md @@ -0,0 +1,270 @@ +# WalletApi + +All URIs are relative to *https://api.binance.com* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**getPortfolio**](WalletApi.md#getPortfolio) | **GET** /sapi/v1/w3w/wallet/prediction/pnl/portfolio | Get Portfolio | +| [**getQuotaStatus**](WalletApi.md#getQuotaStatus) | **GET** /sapi/v1/w3w/wallet/prediction/quota/limit/status | Get Quota Status | +| [**listPredictionWallets**](WalletApi.md#listPredictionWallets) | **GET** /sapi/v1/w3w/wallet/prediction/wallet/list | List Prediction Wallets | +| [**queryPaymentOptionBalances**](WalletApi.md#queryPaymentOptionBalances) | **GET** /sapi/v1/w3w/wallet/prediction/balance/payment-options | Query Payment Option Balances | + + + +# **getPortfolio** +> GetPortfolioResponse getPortfolio(walletAddress, tokenId, marketId, marketTopicId, activeOnly, recvWindow) + +Get Portfolio + +Get the authenticated user's prediction portfolio overview including active positions count, aggregated PnL, and full position list. Weight(IP): 200 Security Type: USER_DATA + +### Example +```java +// Import classes: +import com.binance.connector.client.w3w_prediction.ApiClient; +import com.binance.connector.client.w3w_prediction.ApiException; +import com.binance.connector.client.w3w_prediction.Configuration; +import com.binance.connector.client.w3w_prediction.models.*; +import com.binance.connector.client.w3w_prediction.rest.api.WalletApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.binance.com"); + + WalletApi apiInstance = new WalletApi(defaultClient); + String walletAddress = "0x12e32db8817e292508c34111cbc4b23340df542c"; // String | User's prediction wallet address + String tokenId = "112233"; // String | Filter by prediction token ID + Long marketId = 5567895L; // Long | Filter by market ID. Must be > 0 + Long marketTopicId = 4229564L; // Long | Filter by market topic ID. Must be > 0 + Boolean activeOnly = false; // Boolean | If `true`, return only active (unresolved) positions + Long recvWindow = 5000L; // Long | Request validity window in milliseconds + try { + GetPortfolioResponse result = apiInstance.getPortfolio(walletAddress, tokenId, marketId, marketTopicId, activeOnly, recvWindow); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling WalletApi#getPortfolio"); + 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 | +|------------- | ------------- | ------------- | -------------| +| **walletAddress** | **String**| User's prediction wallet address | | +| **tokenId** | **String**| Filter by prediction token ID | [optional] | +| **marketId** | **Long**| Filter by market ID. Must be > 0 | [optional] | +| **marketTopicId** | **Long**| Filter by market topic ID. Must be > 0 | [optional] | +| **activeOnly** | **Boolean**| If `true`, return only active (unresolved) positions | [optional] | +| **recvWindow** | **Long**| Request validity window in milliseconds | [optional] | + +### Return type + +[**GetPortfolioResponse**](GetPortfolioResponse.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 Portfolio | - | + + +# **getQuotaStatus** +> GetQuotaStatusResponse getQuotaStatus(recvWindow) + +Get Quota Status + +Query the current user's daily trading quota limit and remaining allowance for prediction markets. Weight(IP): 200 Security Type: USER_DATA + +### Example +```java +// Import classes: +import com.binance.connector.client.w3w_prediction.ApiClient; +import com.binance.connector.client.w3w_prediction.ApiException; +import com.binance.connector.client.w3w_prediction.Configuration; +import com.binance.connector.client.w3w_prediction.models.*; +import com.binance.connector.client.w3w_prediction.rest.api.WalletApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.binance.com"); + + WalletApi apiInstance = new WalletApi(defaultClient); + Long recvWindow = 5000L; // Long | Request validity window in milliseconds + try { + GetQuotaStatusResponse result = apiInstance.getQuotaStatus(recvWindow); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling WalletApi#getQuotaStatus"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **recvWindow** | **Long**| Request validity window in milliseconds | [optional] | + +### Return type + +[**GetQuotaStatusResponse**](GetQuotaStatusResponse.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 Quota Status | - | + + +# **listPredictionWallets** +> ListPredictionWalletsResponse listPredictionWallets(recvWindow) + +List Prediction Wallets + +Get all prediction wallets registered for the authenticated user. Weight(IP): 200 Security Type: USER_DATA + +### Example +```java +// Import classes: +import com.binance.connector.client.w3w_prediction.ApiClient; +import com.binance.connector.client.w3w_prediction.ApiException; +import com.binance.connector.client.w3w_prediction.Configuration; +import com.binance.connector.client.w3w_prediction.models.*; +import com.binance.connector.client.w3w_prediction.rest.api.WalletApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.binance.com"); + + WalletApi apiInstance = new WalletApi(defaultClient); + Long recvWindow = 5000L; // Long | Request validity window in milliseconds + try { + ListPredictionWalletsResponse result = apiInstance.listPredictionWallets(recvWindow); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling WalletApi#listPredictionWallets"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **recvWindow** | **Long**| Request validity window in milliseconds | [optional] | + +### Return type + +[**ListPredictionWalletsResponse**](ListPredictionWalletsResponse.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** | List Prediction Wallets | - | + + +# **queryPaymentOptionBalances** +> QueryPaymentOptionBalancesResponse queryPaymentOptionBalances(recvWindow) + +Query Payment Option Balances + +Get available balances for each payment option that can be used for prediction trading. Weight(IP): 200 Security Type: USER_DATA + +### Example +```java +// Import classes: +import com.binance.connector.client.w3w_prediction.ApiClient; +import com.binance.connector.client.w3w_prediction.ApiException; +import com.binance.connector.client.w3w_prediction.Configuration; +import com.binance.connector.client.w3w_prediction.models.*; +import com.binance.connector.client.w3w_prediction.rest.api.WalletApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.binance.com"); + + WalletApi apiInstance = new WalletApi(defaultClient); + Long recvWindow = 5000L; // Long | Request validity window in milliseconds + try { + QueryPaymentOptionBalancesResponse result = apiInstance.queryPaymentOptionBalances(recvWindow); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling WalletApi#queryPaymentOptionBalances"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **recvWindow** | **Long**| Request validity window in milliseconds | [optional] | + +### Return type + +[**QueryPaymentOptionBalancesResponse**](QueryPaymentOptionBalancesResponse.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** | Query Payment Option Balances | - | + diff --git a/clients/w3w-prediction/docs/rest-api/certificate-pinning.md b/clients/w3w-prediction/docs/rest-api/certificate-pinning.md new file mode 100644 index 000000000..0695756a0 --- /dev/null +++ b/clients/w3w-prediction/docs/rest-api/certificate-pinning.md @@ -0,0 +1,31 @@ +# Certificate Pinning +```java + import com.binance.connector.client.w3w_prediction.rest.W3WPredictionRestApiUtil; + import com.binance.connector.client.w3w_prediction.rest.api.W3WPredictionRestApi; + 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 = W3WPredictionRestApiUtil.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); + + W3WPredictionRestApi api = new W3WPredictionRestApi(clientConfiguration); + } +``` \ No newline at end of file diff --git a/clients/w3w-prediction/docs/rest-api/compression.md b/clients/w3w-prediction/docs/rest-api/compression.md new file mode 100644 index 000000000..2d51064e6 --- /dev/null +++ b/clients/w3w-prediction/docs/rest-api/compression.md @@ -0,0 +1,20 @@ +# Compression Configuration + +```java + import com.binance.connector.client.w3w_prediction.rest.W3WPredictionRestApiUtil; + import com.binance.connector.client.w3w_prediction.rest.api.W3WPredictionRestApi; + 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 = W3WPredictionRestApiUtil.getClientConfiguration(); + SignatureConfiguration signatureConfiguration = new SignatureConfiguration(); + signatureConfiguration.setApiKey("apiKey"); + signatureConfiguration.setPrivateKey("path/to/private.key"); + clientConfiguration.setSignatureConfiguration(signatureConfiguration); + clientConfiguration.setCompression(false); //disable compression + W3WPredictionRestApi api = new W3WPredictionRestApi(clientConfiguration); + } +``` \ No newline at end of file diff --git a/clients/w3w-prediction/docs/rest-api/error-handling.md b/clients/w3w-prediction/docs/rest-api/error-handling.md new file mode 100644 index 000000000..fee30992d --- /dev/null +++ b/clients/w3w-prediction/docs/rest-api/error-handling.md @@ -0,0 +1,16 @@ +# Error Handling + +```java + try { + ApiResponse response = getApi().listPredictionCategories(); + 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/w3w-prediction/docs/rest-api/key-pair-authentication.md b/clients/w3w-prediction/docs/rest-api/key-pair-authentication.md new file mode 100644 index 000000000..305a2bf26 --- /dev/null +++ b/clients/w3w-prediction/docs/rest-api/key-pair-authentication.md @@ -0,0 +1,20 @@ +# Key Pair Based Authentication + +```java + import com.binance.connector.client.w3w_prediction.rest.W3WPredictionRestApiUtil; + import com.binance.connector.client.w3w_prediction.rest.api.W3WPredictionRestApi; + 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 = W3WPredictionRestApiUtil.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); + W3WPredictionRestApi api = new W3WPredictionRestApi(clientConfiguration); + } +``` \ No newline at end of file diff --git a/clients/w3w-prediction/docs/rest-api/migration-guide.md b/clients/w3w-prediction/docs/rest-api/migration-guide.md new file mode 100644 index 000000000..24e890c81 --- /dev/null +++ b/clients/w3w-prediction/docs/rest-api/migration-guide.md @@ -0,0 +1,144 @@ +# Migration Guide: Binance Algo 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 Algo 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-algo + 1.2.1 + +``` + +2**Imports**: + Update your import paths. + + **Old:** + +```java +import com.binance.connector.client.SpotClient; +``` + + **New:** + +```java +import com.binance.connector.client.w3w_prediction.rest.api.W3WPredictionRestApi; +``` + +4. **Configuration and Client Initialization**: + The new structure keeps the existing configuration options but modularized clients into `W3WPredictionRestApi`. + + **Old:** + +```java +SpotClient client = new SpotClientImpl(PrivateConfig.API_KEY, PrivateConfig.SECRET_KEY); +String result = client.(parameters); +System.out.println(result); +``` + + + **New:** + +```java + ClientConfiguration clientConfiguration = W3WPredictionRestApiUtil.getClientConfiguration(); + SignatureConfiguration signatureConfiguration = new SignatureConfiguration(); + signatureConfiguration.setApiKey("apiKey"); + signatureConfiguration.setPrivateKey("path/to/private.key"); + clientConfiguration.setSignatureConfiguration(signatureConfiguration); + + W3WPredictionRestApi api = new W3WPredictionRestApi(clientConfiguration); +``` + +5. **Examples and Documentation**: + Updated examples can be found in the new repository folders: + - REST API: `examples/algo/` + +--- + +## 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-algo + 1.2.1 + +``` + +### 3. Update Import Paths + +Replace all occurrences of: + +```java +import com.binance.connector.client.SpotClient; +``` + +With: + +```java +import com.binance.connector.client.w3w_prediction.rest.api.W3WPredictionRestApi; +``` + +### 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 = W3WPredictionRestApiUtil.getClientConfiguration(); + SignatureConfiguration signatureConfiguration = new SignatureConfiguration(); + signatureConfiguration.setApiKey("apiKey"); + signatureConfiguration.setPrivateKey("path/to/private.key"); + clientConfiguration.setSignatureConfiguration(signatureConfiguration); + clientConfiguration.setCompression(false); //disable compression + W3WPredictionRestApi api = new W3WPredictionRestApi(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/w3w-prediction/docs/rest-api/proxy.md b/clients/w3w-prediction/docs/rest-api/proxy.md new file mode 100644 index 000000000..e1f22cfdf --- /dev/null +++ b/clients/w3w-prediction/docs/rest-api/proxy.md @@ -0,0 +1,45 @@ +# Proxy Configuration + +```java + import com.binance.connector.client.w3w_prediction.rest.W3WPredictionRestApiUtil; + import com.binance.connector.client.w3w_prediction.rest.api.W3WPredictionRestApi; + 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 = W3WPredictionRestApiUtil.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); + + W3WPredictionRestApi api = new W3WPredictionRestApi(clientConfiguration); + } +``` \ No newline at end of file diff --git a/clients/w3w-prediction/docs/rest-api/retries.md b/clients/w3w-prediction/docs/rest-api/retries.md new file mode 100644 index 000000000..382dc95e6 --- /dev/null +++ b/clients/w3w-prediction/docs/rest-api/retries.md @@ -0,0 +1,25 @@ +# Retries Configuration + +```java + import com.binance.connector.client.w3w_prediction.rest.W3WPredictionRestApiUtil; + import com.binance.connector.client.w3w_prediction.rest.api.W3WPredictionRestApi; + 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 = W3WPredictionRestApiUtil.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); + + W3WPredictionRestApi api = new W3WPredictionRestApi(clientConfiguration); + } +``` \ No newline at end of file diff --git a/clients/w3w-prediction/docs/rest-api/timeout.md b/clients/w3w-prediction/docs/rest-api/timeout.md new file mode 100644 index 000000000..3a293893b --- /dev/null +++ b/clients/w3w-prediction/docs/rest-api/timeout.md @@ -0,0 +1,25 @@ +# Retries Configuration + +```java + import com.binance.connector.client.w3w_prediction.rest.W3WPredictionRestApiUtil; + import com.binance.connector.client.w3w_prediction.rest.api.W3WPredictionRestApi; + 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 = W3WPredictionRestApiUtil.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); + + W3WPredictionRestApi api = new W3WPredictionRestApi(clientConfiguration); + } +``` \ No newline at end of file diff --git a/clients/w3w-prediction/example_rest.md b/clients/w3w-prediction/example_rest.md new file mode 100644 index 000000000..e18a9e003 --- /dev/null +++ b/clients/w3w-prediction/example_rest.md @@ -0,0 +1,64 @@ +## MarketData + +[GET /sapi/v1/w3w/wallet/prediction/market/detail](https://developers.binance.com/en/dev-docs/catalog/web3-wallet-prediction-trading/api/rest-api/market-data#get-market-detail) - getMarketDetail - [GetMarketDetailExample.java:36](/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/marketdata/GetMarketDetailExample.java#L36) + +[GET /sapi/v1/w3w/wallet/prediction/category/list](https://developers.binance.com/en/dev-docs/catalog/web3-wallet-prediction-trading/api/rest-api/market-data#list-prediction-categories) - listPredictionCategories - [ListPredictionCategoriesExample.java:35](/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/marketdata/ListPredictionCategoriesExample.java#L35) + +[GET /sapi/v1/w3w/wallet/prediction/market/list](https://developers.binance.com/en/dev-docs/catalog/web3-wallet-prediction-trading/api/rest-api/market-data#list-prediction-markets) - listPredictionMarkets - [ListPredictionMarketsExample.java:38](/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/marketdata/ListPredictionMarketsExample.java#L38) + +[GET /sapi/v1/w3w/wallet/prediction/market/search](https://developers.binance.com/en/dev-docs/catalog/web3-wallet-prediction-trading/api/rest-api/market-data#market-search) - marketSearch - [MarketSearchExample.java:35](/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/marketdata/MarketSearchExample.java#L35) + +[GET /sapi/v1/w3w/wallet/prediction/order-book/last-trade-price](https://developers.binance.com/en/dev-docs/catalog/web3-wallet-prediction-trading/api/rest-api/market-data#query-last-trade-price) - queryLastTradePrice - [QueryLastTradePriceExample.java:35](/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/marketdata/QueryLastTradePriceExample.java#L35) + +[GET /sapi/v1/w3w/wallet/prediction/order-book](https://developers.binance.com/en/dev-docs/catalog/web3-wallet-prediction-trading/api/rest-api/market-data#query-order-book) - queryOrderBook - [QueryOrderBookExample.java:36](/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/marketdata/QueryOrderBookExample.java#L36) + +## Position + +[GET /sapi/v1/w3w/wallet/prediction/position/token](https://developers.binance.com/en/dev-docs/catalog/web3-wallet-prediction-trading/api/rest-api/position#get-position-by-token) - getPositionByToken - [GetPositionByTokenExample.java:36](/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/position/GetPositionByTokenExample.java#L36) + +[GET /sapi/v1/w3w/wallet/prediction/pnl/query](https://developers.binance.com/en/dev-docs/catalog/web3-wallet-prediction-trading/api/rest-api/position#query-pn-l) - queryPnL - [QueryPnLExample.java:37](/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/position/QueryPnLExample.java#L37) + +[GET /sapi/v1/w3w/wallet/prediction/position/list](https://developers.binance.com/en/dev-docs/catalog/web3-wallet-prediction-trading/api/rest-api/position#query-positions) - queryPositions - [QueryPositionsExample.java:36](/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/position/QueryPositionsExample.java#L36) + +[GET /sapi/v1/w3w/wallet/prediction/position/filter](https://developers.binance.com/en/dev-docs/catalog/web3-wallet-prediction-trading/api/rest-api/position#query-positions-by-filter) - queryPositionsByFilter - [QueryPositionsByFilterExample.java:36](/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/position/QueryPositionsByFilterExample.java#L36) + +[GET /sapi/v1/w3w/wallet/prediction/position/settled-history](https://developers.binance.com/en/dev-docs/catalog/web3-wallet-prediction-trading/api/rest-api/position#query-settled-position-history) - querySettledPositionHistory - [QuerySettledPositionHistoryExample.java:36](/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/position/QuerySettledPositionHistoryExample.java#L36) + +## Redeem + +[POST /sapi/v1/w3w/wallet/prediction/batch-redeem](https://developers.binance.com/en/dev-docs/catalog/web3-wallet-prediction-trading/api/rest-api/redeem#batch-redeem) - batchRedeem - [BatchRedeemExample.java:38](/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/redeem/BatchRedeemExample.java#L38) + +[GET /sapi/v1/w3w/wallet/prediction/redeem/status](https://developers.binance.com/en/dev-docs/catalog/web3-wallet-prediction-trading/api/rest-api/redeem#get-redeem-status) - getRedeemStatus - [GetRedeemStatusExample.java:40](/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/redeem/GetRedeemStatusExample.java#L40) + +## Trade + +[POST /sapi/v1/w3w/wallet/prediction/trade/batch-cancel](https://developers.binance.com/en/dev-docs/catalog/web3-wallet-prediction-trading/api/rest-api/trade#batch-cancel-orders) - batchCancelOrders - [BatchCancelOrdersExample.java:52](/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/trade/BatchCancelOrdersExample.java#L52) + +[POST /sapi/v1/w3w/wallet/prediction/trade/get-quote](https://developers.binance.com/en/dev-docs/catalog/web3-wallet-prediction-trading/api/rest-api/trade#get-quote) - getQuote - [GetQuoteExample.java:47](/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/trade/GetQuoteExample.java#L47) + +[POST /sapi/v1/w3w/wallet/prediction/trade/place-order-bundle](https://developers.binance.com/en/dev-docs/catalog/web3-wallet-prediction-trading/api/rest-api/trade#place-order) - placeOrder - [PlaceOrderExample.java:42](/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/trade/PlaceOrderExample.java#L42) + +[GET /sapi/v1/w3w/wallet/prediction/order/list](https://developers.binance.com/en/dev-docs/catalog/web3-wallet-prediction-trading/api/rest-api/trade#query-active-orders) - queryActiveOrders - [QueryActiveOrdersExample.java:37](/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/trade/QueryActiveOrdersExample.java#L37) + +[GET /sapi/v1/w3w/wallet/prediction/order/history](https://developers.binance.com/en/dev-docs/catalog/web3-wallet-prediction-trading/api/rest-api/trade#query-order-history) - queryOrderHistory - [QueryOrderHistoryExample.java:37](/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/trade/QueryOrderHistoryExample.java#L37) + +## Transfer + +[POST /sapi/v1/w3w/wallet/prediction/transfer/inbound](https://developers.binance.com/en/dev-docs/catalog/web3-wallet-prediction-trading/api/rest-api/transfer#create-inbound-transfer) - createInboundTransfer - [CreateInboundTransferExample.java:41](/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/transfer/CreateInboundTransferExample.java#L41) + +[POST /sapi/v1/w3w/wallet/prediction/transfer/outbound](https://developers.binance.com/en/dev-docs/catalog/web3-wallet-prediction-trading/api/rest-api/transfer#create-outbound-transfer) - createOutboundTransfer - [CreateOutboundTransferExample.java:39](/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/transfer/CreateOutboundTransferExample.java#L39) + +[GET /sapi/v1/w3w/wallet/prediction/transfer/list](https://developers.binance.com/en/dev-docs/catalog/web3-wallet-prediction-trading/api/rest-api/transfer#query-transfer-list) - queryTransferList - [QueryTransferListExample.java:37](/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/transfer/QueryTransferListExample.java#L37) + +[GET /sapi/v1/w3w/wallet/prediction/transfer/status](https://developers.binance.com/en/dev-docs/catalog/web3-wallet-prediction-trading/api/rest-api/transfer#query-transfer-status) - queryTransferStatus - [QueryTransferStatusExample.java:39](/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/transfer/QueryTransferStatusExample.java#L39) + +## Wallet + +[GET /sapi/v1/w3w/wallet/prediction/pnl/portfolio](https://developers.binance.com/en/dev-docs/catalog/web3-wallet-prediction-trading/api/rest-api/wallet#get-portfolio) - getPortfolio - [GetPortfolioExample.java:36](/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/wallet/GetPortfolioExample.java#L36) + +[GET /sapi/v1/w3w/wallet/prediction/quota/limit/status](https://developers.binance.com/en/dev-docs/catalog/web3-wallet-prediction-trading/api/rest-api/wallet#get-quota-status) - getQuotaStatus - [GetQuotaStatusExample.java:36](/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/wallet/GetQuotaStatusExample.java#L36) + +[GET /sapi/v1/w3w/wallet/prediction/wallet/list](https://developers.binance.com/en/dev-docs/catalog/web3-wallet-prediction-trading/api/rest-api/wallet#list-prediction-wallets) - listPredictionWallets - [ListPredictionWalletsExample.java:36](/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/wallet/ListPredictionWalletsExample.java#L36) + +[GET /sapi/v1/w3w/wallet/prediction/balance/payment-options](https://developers.binance.com/en/dev-docs/catalog/web3-wallet-prediction-trading/api/rest-api/wallet#query-payment-option-balances) - queryPaymentOptionBalances - [QueryPaymentOptionBalancesExample.java:36](/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/wallet/QueryPaymentOptionBalancesExample.java#L36) + diff --git a/clients/w3w-prediction/pom.xml b/clients/w3w-prediction/pom.xml new file mode 100644 index 000000000..df80a7b8b --- /dev/null +++ b/clients/w3w-prediction/pom.xml @@ -0,0 +1,37 @@ + + + + 4.0.0 + binance-w3w-prediction + w3w-prediction + 1.0.0 + jar + + + io.github.binance + binance-connector-java-clients + 1.1.2 + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + -parameters + + + + + + + + io.github.binance + binance-common + 2.4.2 + + + \ No newline at end of file diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/JSON.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/JSON.java new file mode 100644 index 000000000..f7e2c532d --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/JSON.java @@ -0,0 +1,591 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.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.w3w_prediction.rest.model.BatchCancelOrdersRequest + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.w3w_prediction.rest.model.BatchCancelOrdersResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.w3w_prediction.rest.model + .BatchCancelOrdersResponseFailedInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.w3w_prediction.rest.model.BatchRedeemRequest + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.w3w_prediction.rest.model.BatchRedeemResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.w3w_prediction.rest.model + .BatchRedeemResponseResultsInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.w3w_prediction.rest.model.CancelInfoList + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.w3w_prediction.rest.model.CancelInfoListInner + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.w3w_prediction.rest.model + .CreateInboundTransferRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.w3w_prediction.rest.model + .CreateInboundTransferResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.w3w_prediction.rest.model + .CreateOutboundTransferRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.w3w_prediction.rest.model + .CreateOutboundTransferResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.w3w_prediction.rest.model.GetMarketDetailResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.w3w_prediction.rest.model + .GetMarketDetailResponseMarketsInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.w3w_prediction.rest.model + .GetMarketDetailResponseMarketsInnerOutcomesInner + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.w3w_prediction.rest.model + .GetMarketDetailResponseTimelineInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.w3w_prediction.rest.model + .GetMarketDetailResponseVariantData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.w3w_prediction.rest.model.GetPortfolioResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.w3w_prediction.rest.model + .GetPortfolioResponsePositionsInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.w3w_prediction.rest.model + .GetPositionByTokenResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.w3w_prediction.rest.model + .GetPositionByTokenResponsePosition.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.w3w_prediction.rest.model.GetQuotaStatusResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.w3w_prediction.rest.model.GetQuoteRequest + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.w3w_prediction.rest.model.GetQuoteResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.w3w_prediction.rest.model.GetRedeemStatusResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.w3w_prediction.rest.model + .ListPredictionCategoriesResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.w3w_prediction.rest.model + .ListPredictionCategoriesResponseCategoriesInner + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.w3w_prediction.rest.model + .ListPredictionCategoriesResponseCategoriesInnerSubcategoriesInner + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.w3w_prediction.rest.model + .ListPredictionMarketsResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.w3w_prediction.rest.model + .ListPredictionMarketsResponseMarketTopicsInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.w3w_prediction.rest.model + .ListPredictionWalletsResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.w3w_prediction.rest.model + .ListPredictionWalletsResponseWalletsInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.w3w_prediction.rest.model.MarketSearchResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.w3w_prediction.rest.model.MarketSearchResponseInner + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.w3w_prediction.rest.model.PlaceOrderRequest + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.w3w_prediction.rest.model.PlaceOrderResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.w3w_prediction.rest.model.QueryActiveOrdersResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.w3w_prediction.rest.model + .QueryActiveOrdersResponseOrdersInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.w3w_prediction.rest.model + .QueryLastTradePriceResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.w3w_prediction.rest.model.QueryOrderBookResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.w3w_prediction.rest.model + .QueryOrderBookResponseAsksInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.w3w_prediction.rest.model + .QueryOrderBookResponseBidsInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.w3w_prediction.rest.model.QueryOrderHistoryResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.w3w_prediction.rest.model + .QueryOrderHistoryResponseOrdersInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.w3w_prediction.rest.model + .QueryPaymentOptionBalancesResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.w3w_prediction.rest.model + .QueryPaymentOptionBalancesResponseItemsInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.w3w_prediction.rest.model.QueryPnLResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.w3w_prediction.rest.model + .QueryPositionsByFilterResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.w3w_prediction.rest.model + .QueryPositionsByFilterResponsePositionsInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.w3w_prediction.rest.model.QueryPositionsResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.w3w_prediction.rest.model + .QueryPositionsResponseCounts.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.w3w_prediction.rest.model + .QueryPositionsResponsePositionsInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.w3w_prediction.rest.model + .QueryPositionsResponseSummary.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.w3w_prediction.rest.model + .QuerySettledPositionHistoryResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.w3w_prediction.rest.model + .QuerySettledPositionHistoryResponsePositionsInner + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.w3w_prediction.rest.model.QueryTransferListResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.w3w_prediction.rest.model + .QueryTransferListResponseTransfersInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.w3w_prediction.rest.model + .QueryTransferStatusResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.w3w_prediction.rest.model.TokenIds + .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/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/W3WPredictionRestApiUtil.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/W3WPredictionRestApiUtil.java new file mode 100644 index 000000000..156a58206 --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/W3WPredictionRestApiUtil.java @@ -0,0 +1,25 @@ +package com.binance.connector.client.w3w_prediction.rest; + +import com.binance.connector.client.common.ApiClient; +import com.binance.connector.client.common.configuration.ClientConfiguration; + +public class W3WPredictionRestApiUtil { + private static final String BASE_URL = "https://api.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/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/api/MarketDataApi.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/api/MarketDataApi.java new file mode 100644 index 000000000..617297b97 --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/api/MarketDataApi.java @@ -0,0 +1,968 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.api; + +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.binance.connector.client.w3w_prediction.rest.model.GetMarketDetailResponse; +import com.binance.connector.client.w3w_prediction.rest.model.ListPredictionCategoriesResponse; +import com.binance.connector.client.w3w_prediction.rest.model.ListPredictionMarketsResponse; +import com.binance.connector.client.w3w_prediction.rest.model.MarketSearchResponse; +import com.binance.connector.client.w3w_prediction.rest.model.OrderBy; +import com.binance.connector.client.w3w_prediction.rest.model.QueryLastTradePriceResponse; +import com.binance.connector.client.w3w_prediction.rest.model.QueryOrderBookResponse; +import com.binance.connector.client.w3w_prediction.rest.model.SortBy; +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-w3w-prediction/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 getMarketDetail + * + * @param marketTopicId Market topic ID. Must be > 0 (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 Get Market Detail -
+ * + * @see Get + * Market Detail Documentation + */ + private okhttp3.Call getMarketDetailCall(Long marketTopicId) 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 = "/sapi/v1/w3w/wallet/prediction/market/detail"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (marketTopicId != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("marketTopicId", marketTopicId)); + } + + 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<>(); + localVarAuthNames.add("binanceSignature"); + 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 getMarketDetailValidateBeforeCall(Long marketTopicId) throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + ExecutableValidator executableValidator = validator.forExecutables(); + + Object[] parameterValues = {marketTopicId}; + Method method = this.getClass().getMethod("getMarketDetail", Long.class); + Set> violations = + executableValidator.validateParameters(this, method, parameterValues); + + if (violations.size() == 0) { + return getMarketDetailCall(marketTopicId); + } 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 Market Detail Get full details for a specific prediction market topic, including variant + * data and timeline. Weight(IP): 200 + * + * @param marketTopicId Market topic ID. Must be > 0 (required) + * @return ApiResponse<GetMarketDetailResponse> + * @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 Market Detail -
+ * + * @see Get + * Market Detail Documentation + */ + public ApiResponse getMarketDetail( + @NotNull @Min(1L) Long marketTopicId) throws ApiException { + okhttp3.Call localVarCall = getMarketDetailValidateBeforeCall(marketTopicId); + java.lang.reflect.Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Build call for listPredictionCategories + * + * @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 List Prediction Categories -
+ * + * @see List + * Prediction Categories Documentation + */ + private okhttp3.Call listPredictionCategoriesCall() 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 = "/sapi/v1/w3w/wallet/prediction/category/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<>(); + localVarAuthNames.add("binanceSignature"); + 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 listPredictionCategoriesValidateBeforeCall() throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + ExecutableValidator executableValidator = validator.forExecutables(); + + Object[] parameterValues = {}; + Method method = this.getClass().getMethod("listPredictionCategories"); + Set> violations = + executableValidator.validateParameters(this, method, parameterValues); + + if (violations.size() == 0) { + return listPredictionCategoriesCall(); + } 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()); + } + } + + /** + * List Prediction Categories Get all available prediction market categories (L1 and L2). + * Weight(IP): 200 + * + * @return ApiResponse<ListPredictionCategoriesResponse> + * @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 List Prediction Categories -
+ * + * @see List + * Prediction Categories Documentation + */ + public ApiResponse listPredictionCategories() + throws ApiException { + okhttp3.Call localVarCall = listPredictionCategoriesValidateBeforeCall(); + java.lang.reflect.Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Build call for listPredictionMarkets + * + * @param l1Category Level-1 category filter (optional) + * @param l2Category Level-2 category filter (optional) + * @param sortBy Sort field. Enum: `RECOMMENDED`, `VOLUME`, + * `PARTICIPANTS`, `CREATED_TIME`, `END_DATE` (optional) + * @param orderBy Sort direction. Enum: `ASC`, `DESC` (optional) + * @param offset Pagination offset. Default `0` (optional) + * @param limit Page size. Default `20`, range 1–100 (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 List Prediction Markets -
+ * + * @see List + * Prediction Markets Documentation + */ + private okhttp3.Call listPredictionMarketsCall( + String l1Category, + String l2Category, + SortBy sortBy, + OrderBy orderBy, + Integer offset, + Integer 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 = "/sapi/v1/w3w/wallet/prediction/market/list"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (l1Category != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("l1Category", l1Category)); + } + + if (l2Category != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("l2Category", l2Category)); + } + + if (sortBy != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("sortBy", sortBy)); + } + + if (orderBy != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("orderBy", orderBy)); + } + + if (offset != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("offset", offset)); + } + + 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<>(); + localVarAuthNames.add("binanceSignature"); + 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 listPredictionMarketsValidateBeforeCall( + String l1Category, + String l2Category, + SortBy sortBy, + OrderBy orderBy, + Integer offset, + Integer limit) + throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + ExecutableValidator executableValidator = validator.forExecutables(); + + Object[] parameterValues = {l1Category, l2Category, sortBy, orderBy, offset, limit}; + Method method = + this.getClass() + .getMethod( + "listPredictionMarkets", + String.class, + String.class, + SortBy.class, + OrderBy.class, + Integer.class, + Integer.class); + Set> violations = + executableValidator.validateParameters(this, method, parameterValues); + + if (violations.size() == 0) { + return listPredictionMarketsCall( + l1Category, l2Category, sortBy, orderBy, offset, 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()); + } + } + + /** + * List Prediction Markets Get a paginated list of prediction market topics, with optional + * category and sort filters. Weight(IP): 200 + * + * @param l1Category Level-1 category filter (optional) + * @param l2Category Level-2 category filter (optional) + * @param sortBy Sort field. Enum: `RECOMMENDED`, `VOLUME`, + * `PARTICIPANTS`, `CREATED_TIME`, `END_DATE` (optional) + * @param orderBy Sort direction. Enum: `ASC`, `DESC` (optional) + * @param offset Pagination offset. Default `0` (optional) + * @param limit Page size. Default `20`, range 1–100 (optional) + * @return ApiResponse<ListPredictionMarketsResponse> + * @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 List Prediction Markets -
+ * + * @see List + * Prediction Markets Documentation + */ + public ApiResponse listPredictionMarkets( + String l1Category, + String l2Category, + SortBy sortBy, + OrderBy orderBy, + @Min(0) Integer offset, + @Min(1) @Max(100) Integer limit) + throws ApiException { + okhttp3.Call localVarCall = + listPredictionMarketsValidateBeforeCall( + l1Category, l2Category, sortBy, orderBy, offset, limit); + java.lang.reflect.Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Build call for marketSearch + * + * @param query Search keyword. Not blank (required) + * @param topK Max number of results to return. Default `20`, range 1–50 (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 Market Search -
+ * + * @see Market + * Search Documentation + */ + private okhttp3.Call marketSearchCall(String query, Integer topK) 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 = "/sapi/v1/w3w/wallet/prediction/market/search"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (query != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("query", query)); + } + + if (topK != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("topK", topK)); + } + + 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<>(); + localVarAuthNames.add("binanceSignature"); + 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 marketSearchValidateBeforeCall(String query, Integer topK) + throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + ExecutableValidator executableValidator = validator.forExecutables(); + + Object[] parameterValues = {query, topK}; + Method method = this.getClass().getMethod("marketSearch", String.class, Integer.class); + Set> violations = + executableValidator.validateParameters(this, method, parameterValues); + + if (violations.size() == 0) { + return marketSearchCall(query, topK); + } 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()); + } + } + + /** + * Market Search Semantic search for prediction market topics by keyword. Weight(IP): 200 + * + * @param query Search keyword. Not blank (required) + * @param topK Max number of results to return. Default `20`, range 1–50 (optional) + * @return ApiResponse<MarketSearchResponse> + * @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 Market Search -
+ * + * @see Market + * Search Documentation + */ + public ApiResponse marketSearch( + @NotNull String query, @Min(1) @Max(50) Integer topK) throws ApiException { + okhttp3.Call localVarCall = marketSearchValidateBeforeCall(query, topK); + java.lang.reflect.Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Build call for queryLastTradePrice + * + * @param marketId Market ID. Must be > 0 (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 Query Last Trade Price -
+ * + * @see Query + * Last Trade Price Documentation + */ + private okhttp3.Call queryLastTradePriceCall(Long marketId) 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 = "/sapi/v1/w3w/wallet/prediction/order-book/last-trade-price"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (marketId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("marketId", marketId)); + } + + 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<>(); + localVarAuthNames.add("binanceSignature"); + 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 queryLastTradePriceValidateBeforeCall(Long marketId) throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + ExecutableValidator executableValidator = validator.forExecutables(); + + Object[] parameterValues = {marketId}; + Method method = this.getClass().getMethod("queryLastTradePrice", Long.class); + Set> violations = + executableValidator.validateParameters(this, method, parameterValues); + + if (violations.size() == 0) { + return queryLastTradePriceCall(marketId); + } 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()); + } + } + + /** + * Query Last Trade Price Get the most recent trade price for a prediction market. Weight(IP): + * 200 + * + * @param marketId Market ID. Must be > 0 (required) + * @return ApiResponse<QueryLastTradePriceResponse> + * @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 Query Last Trade Price -
+ * + * @see Query + * Last Trade Price Documentation + */ + public ApiResponse queryLastTradePrice( + @NotNull @Min(1L) Long marketId) throws ApiException { + okhttp3.Call localVarCall = queryLastTradePriceValidateBeforeCall(marketId); + java.lang.reflect.Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Build call for queryOrderBook + * + * @param vendor Vendor identifier (e.g. `predict_fun`) (required) + * @param marketId Market ID. Must be > 0 (required) + * @param tokenId Prediction outcome token ID (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 Query Order Book -
+ * + * @see Query + * Order Book Documentation + */ + private okhttp3.Call queryOrderBookCall(String vendor, Long marketId, String tokenId) + 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 = "/sapi/v1/w3w/wallet/prediction/order-book"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (vendor != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("vendor", vendor)); + } + + if (marketId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("marketId", marketId)); + } + + if (tokenId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("tokenId", tokenId)); + } + + 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<>(); + localVarAuthNames.add("binanceSignature"); + 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 queryOrderBookValidateBeforeCall( + String vendor, Long marketId, String tokenId) throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + ExecutableValidator executableValidator = validator.forExecutables(); + + Object[] parameterValues = {vendor, marketId, tokenId}; + Method method = + this.getClass() + .getMethod("queryOrderBook", String.class, Long.class, String.class); + Set> violations = + executableValidator.validateParameters(this, method, parameterValues); + + if (violations.size() == 0) { + return queryOrderBookCall(vendor, marketId, tokenId); + } 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()); + } + } + + /** + * Query Order Book Get the current order book (bids and asks) for a specific prediction market + * outcome token. Weight(IP): 200 + * + * @param vendor Vendor identifier (e.g. `predict_fun`) (required) + * @param marketId Market ID. Must be > 0 (required) + * @param tokenId Prediction outcome token ID (required) + * @return ApiResponse<QueryOrderBookResponse> + * @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 Query Order Book -
+ * + * @see Query + * Order Book Documentation + */ + public ApiResponse queryOrderBook( + @NotNull String vendor, @NotNull @Min(1L) Long marketId, @NotNull String tokenId) + throws ApiException { + okhttp3.Call localVarCall = queryOrderBookValidateBeforeCall(vendor, marketId, tokenId); + java.lang.reflect.Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/api/PositionApi.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/api/PositionApi.java new file mode 100644 index 000000000..dc1b3be85 --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/api/PositionApi.java @@ -0,0 +1,1005 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.api; + +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.binance.connector.client.w3w_prediction.rest.model.GetPositionByTokenResponse; +import com.binance.connector.client.w3w_prediction.rest.model.QueryPnLResponse; +import com.binance.connector.client.w3w_prediction.rest.model.QueryPositionsByFilterResponse; +import com.binance.connector.client.w3w_prediction.rest.model.QueryPositionsResponse; +import com.binance.connector.client.w3w_prediction.rest.model.QuerySettledPositionHistoryResponse; +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 PositionApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + private static final String USER_AGENT = + String.format( + "binance-w3w-prediction/1.0.0 (Java/%s; %s; %s)", + SystemUtil.getJavaVersion(), SystemUtil.getOs(), SystemUtil.getArch()); + private static final boolean HAS_TIME_UNIT = false; + + public PositionApi(ClientConfiguration clientConfiguration) { + this(new ApiClient(clientConfiguration)); + } + + public PositionApi(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 getPositionByToken + * + * @param walletAddress User's prediction wallet address (required) + * @param tokenId Prediction outcome token ID (required) + * @param recvWindow Request validity window in 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 Get Position by Token -
+ * + * @see Get + * Position by Token Documentation + */ + private okhttp3.Call getPositionByTokenCall( + String walletAddress, String tokenId, Long recvWindow) 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 = "/sapi/v1/w3w/wallet/prediction/position/token"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (walletAddress != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("walletAddress", walletAddress)); + } + + if (tokenId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("tokenId", tokenId)); + } + + if (recvWindow != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("recvWindow", recvWindow)); + } + + 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<>(); + localVarAuthNames.add("binanceSignature"); + 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 getPositionByTokenValidateBeforeCall( + String walletAddress, String tokenId, Long recvWindow) throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + ExecutableValidator executableValidator = validator.forExecutables(); + + Object[] parameterValues = {walletAddress, tokenId, recvWindow}; + Method method = + this.getClass() + .getMethod( + "getPositionByToken", String.class, String.class, Long.class); + Set> violations = + executableValidator.validateParameters(this, method, parameterValues); + + if (violations.size() == 0) { + return getPositionByTokenCall(walletAddress, tokenId, recvWindow); + } 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 Position by Token Get the authenticated user's position detail for a specific + * prediction token. Weight(IP): 200 Security Type: USER_DATA + * + * @param walletAddress User's prediction wallet address (required) + * @param tokenId Prediction outcome token ID (required) + * @param recvWindow Request validity window in milliseconds (optional) + * @return ApiResponse<GetPositionByTokenResponse> + * @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 Position by Token -
+ * + * @see Get + * Position by Token Documentation + */ + public ApiResponse getPositionByToken( + @NotNull String walletAddress, @NotNull String tokenId, @Max(60000L) Long recvWindow) + throws ApiException { + okhttp3.Call localVarCall = + getPositionByTokenValidateBeforeCall(walletAddress, tokenId, recvWindow); + java.lang.reflect.Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Build call for queryPnL + * + * @param walletAddress User's prediction wallet address (required) + * @param tokenId Filter by prediction token ID (optional) + * @param marketId Filter by market ID. Must be > 0 (optional) + * @param marketTopicId Filter by market topic ID. Must be > 0 (optional) + * @param activeOnly If `true`, return only active (unresolved) positions (optional) + * @param recvWindow Request validity window in 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 Query PnL -
+ * + * @see Query + * PnL Documentation + */ + private okhttp3.Call queryPnLCall( + String walletAddress, + String tokenId, + Long marketId, + Long marketTopicId, + Boolean activeOnly, + Long recvWindow) + 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 = "/sapi/v1/w3w/wallet/prediction/pnl/query"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (walletAddress != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("walletAddress", walletAddress)); + } + + if (tokenId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("tokenId", tokenId)); + } + + if (marketId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("marketId", marketId)); + } + + if (marketTopicId != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("marketTopicId", marketTopicId)); + } + + if (activeOnly != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("activeOnly", activeOnly)); + } + + if (recvWindow != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("recvWindow", recvWindow)); + } + + 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<>(); + localVarAuthNames.add("binanceSignature"); + 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 queryPnLValidateBeforeCall( + String walletAddress, + String tokenId, + Long marketId, + Long marketTopicId, + Boolean activeOnly, + Long recvWindow) + throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + ExecutableValidator executableValidator = validator.forExecutables(); + + Object[] parameterValues = { + walletAddress, tokenId, marketId, marketTopicId, activeOnly, recvWindow + }; + Method method = + this.getClass() + .getMethod( + "queryPnL", + String.class, + String.class, + Long.class, + Long.class, + Boolean.class, + Long.class); + Set> violations = + executableValidator.validateParameters(this, method, parameterValues); + + if (violations.size() == 0) { + return queryPnLCall( + walletAddress, tokenId, marketId, marketTopicId, activeOnly, recvWindow); + } 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()); + } + } + + /** + * Query PnL Query profit and loss records for the authenticated user's prediction + * positions. When `tokenId` is provided, returns a single record in `pnl`; + * otherwise returns a list in `pnlList`. Weight(IP): 200 Security Type: USER_DATA + * + * @param walletAddress User's prediction wallet address (required) + * @param tokenId Filter by prediction token ID (optional) + * @param marketId Filter by market ID. Must be > 0 (optional) + * @param marketTopicId Filter by market topic ID. Must be > 0 (optional) + * @param activeOnly If `true`, return only active (unresolved) positions (optional) + * @param recvWindow Request validity window in milliseconds (optional) + * @return ApiResponse<QueryPnLResponse> + * @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 Query PnL -
+ * + * @see Query + * PnL Documentation + */ + public ApiResponse queryPnL( + @NotNull String walletAddress, + String tokenId, + @Min(1L) Long marketId, + @Min(1L) Long marketTopicId, + Boolean activeOnly, + @Max(60000L) Long recvWindow) + throws ApiException { + okhttp3.Call localVarCall = + queryPnLValidateBeforeCall( + walletAddress, tokenId, marketId, marketTopicId, activeOnly, recvWindow); + java.lang.reflect.Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Build call for queryPositions + * + * @param walletAddress User's prediction wallet address (required) + * @param tab Position status tab. Values from `PositionQueryType`. Default + * `ONGOING` (optional) + * @param offset Pagination offset. Default `0` (optional) + * @param limit Page size. Default `20`, range 1–100 (optional) + * @param recvWindow Request validity window in 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 Query Positions -
+ * + * @see Query + * Positions Documentation + */ + private okhttp3.Call queryPositionsCall( + String walletAddress, String tab, Integer offset, Integer limit, Long recvWindow) + 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 = "/sapi/v1/w3w/wallet/prediction/position/list"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (walletAddress != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("walletAddress", walletAddress)); + } + + if (tab != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("tab", tab)); + } + + if (offset != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("offset", offset)); + } + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + if (recvWindow != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("recvWindow", recvWindow)); + } + + 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<>(); + localVarAuthNames.add("binanceSignature"); + 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 queryPositionsValidateBeforeCall( + String walletAddress, String tab, Integer offset, Integer limit, Long recvWindow) + throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + ExecutableValidator executableValidator = validator.forExecutables(); + + Object[] parameterValues = {walletAddress, tab, offset, limit, recvWindow}; + Method method = + this.getClass() + .getMethod( + "queryPositions", + String.class, + String.class, + Integer.class, + Integer.class, + Long.class); + Set> violations = + executableValidator.validateParameters(this, method, parameterValues); + + if (violations.size() == 0) { + return queryPositionsCall(walletAddress, tab, offset, limit, recvWindow); + } 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()); + } + } + + /** + * Query Positions Get the authenticated user's prediction token positions with portfolio + * summary and tab-based filtering. Weight(IP): 200 Security Type: USER_DATA + * + * @param walletAddress User's prediction wallet address (required) + * @param tab Position status tab. Values from `PositionQueryType`. Default + * `ONGOING` (optional) + * @param offset Pagination offset. Default `0` (optional) + * @param limit Page size. Default `20`, range 1–100 (optional) + * @param recvWindow Request validity window in milliseconds (optional) + * @return ApiResponse<QueryPositionsResponse> + * @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 Query Positions -
+ * + * @see Query + * Positions Documentation + */ + public ApiResponse queryPositions( + @NotNull String walletAddress, + String tab, + @Min(0) Integer offset, + @Min(1) @Max(100) Integer limit, + @Max(60000L) Long recvWindow) + throws ApiException { + okhttp3.Call localVarCall = + queryPositionsValidateBeforeCall(walletAddress, tab, offset, limit, recvWindow); + java.lang.reflect.Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Build call for queryPositionsByFilter + * + * @param walletAddress User's prediction wallet address (optional) + * @param marketTopicId Filter by market topic ID (optional) + * @param recvWindow Request validity window in 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 Query Positions by Filter -
+ * + * @see Query + * Positions by Filter Documentation + */ + private okhttp3.Call queryPositionsByFilterCall( + String walletAddress, Long marketTopicId, Long recvWindow) 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 = "/sapi/v1/w3w/wallet/prediction/position/filter"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (walletAddress != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("walletAddress", walletAddress)); + } + + if (marketTopicId != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("marketTopicId", marketTopicId)); + } + + if (recvWindow != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("recvWindow", recvWindow)); + } + + 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<>(); + localVarAuthNames.add("binanceSignature"); + 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 queryPositionsByFilterValidateBeforeCall( + String walletAddress, Long marketTopicId, Long recvWindow) throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + ExecutableValidator executableValidator = validator.forExecutables(); + + Object[] parameterValues = {walletAddress, marketTopicId, recvWindow}; + Method method = + this.getClass() + .getMethod( + "queryPositionsByFilter", String.class, Long.class, Long.class); + Set> violations = + executableValidator.validateParameters(this, method, parameterValues); + + if (violations.size() == 0) { + return queryPositionsByFilterCall(walletAddress, marketTopicId, recvWindow); + } 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()); + } + } + + /** + * Query Positions by Filter Get prediction positions filtered by wallet address and/or market + * topic ID. Both parameters are optional. Weight(IP): 200 Security Type: USER_DATA + * + * @param walletAddress User's prediction wallet address (optional) + * @param marketTopicId Filter by market topic ID (optional) + * @param recvWindow Request validity window in milliseconds (optional) + * @return ApiResponse<QueryPositionsByFilterResponse> + * @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 Query Positions by Filter -
+ * + * @see Query + * Positions by Filter Documentation + */ + public ApiResponse queryPositionsByFilter( + String walletAddress, Long marketTopicId, @Max(60000L) Long recvWindow) + throws ApiException { + okhttp3.Call localVarCall = + queryPositionsByFilterValidateBeforeCall(walletAddress, marketTopicId, recvWindow); + java.lang.reflect.Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Build call for querySettledPositionHistory + * + * @param walletAddress User's prediction wallet address (required) + * @param l1Category Filter by level-1 category (optional) + * @param result Settlement result filter (optional) + * @param startDate Start date. Format: `yyyy-MM-dd`. Must be ≤ `endDate` + * (optional) + * @param endDate End date. Format: `yyyy-MM-dd`. Must be ≥ `startDate` + * (optional) + * @param offset Pagination offset. Default `0` (optional) + * @param limit Page size. Default `20`, range 1–100 (optional) + * @param recvWindow Request validity window in 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 Query Settled Position History -
+ * + * @see Query + * Settled Position History Documentation + */ + private okhttp3.Call querySettledPositionHistoryCall( + String walletAddress, + String l1Category, + Integer result, + String startDate, + String endDate, + Integer offset, + Integer limit, + Long recvWindow) + 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 = "/sapi/v1/w3w/wallet/prediction/position/settled-history"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (walletAddress != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("walletAddress", walletAddress)); + } + + if (l1Category != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("l1Category", l1Category)); + } + + if (result != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("result", result)); + } + + if (startDate != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("startDate", startDate)); + } + + if (endDate != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("endDate", endDate)); + } + + if (offset != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("offset", offset)); + } + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + if (recvWindow != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("recvWindow", recvWindow)); + } + + 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<>(); + localVarAuthNames.add("binanceSignature"); + 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 querySettledPositionHistoryValidateBeforeCall( + String walletAddress, + String l1Category, + Integer result, + String startDate, + String endDate, + Integer offset, + Integer limit, + Long recvWindow) + throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + ExecutableValidator executableValidator = validator.forExecutables(); + + Object[] parameterValues = { + walletAddress, l1Category, result, startDate, endDate, offset, limit, recvWindow + }; + Method method = + this.getClass() + .getMethod( + "querySettledPositionHistory", + String.class, + String.class, + Integer.class, + String.class, + String.class, + Integer.class, + Integer.class, + Long.class); + Set> violations = + executableValidator.validateParameters(this, method, parameterValues); + + if (violations.size() == 0) { + return querySettledPositionHistoryCall( + walletAddress, + l1Category, + result, + startDate, + endDate, + offset, + limit, + recvWindow); + } 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()); + } + } + + /** + * Query Settled Position History Get the authenticated user's settled (resolved) prediction + * position history with optional filters. Weight(IP): 200 Security Type: USER_DATA + * + * @param walletAddress User's prediction wallet address (required) + * @param l1Category Filter by level-1 category (optional) + * @param result Settlement result filter (optional) + * @param startDate Start date. Format: `yyyy-MM-dd`. Must be ≤ `endDate` + * (optional) + * @param endDate End date. Format: `yyyy-MM-dd`. Must be ≥ `startDate` + * (optional) + * @param offset Pagination offset. Default `0` (optional) + * @param limit Page size. Default `20`, range 1–100 (optional) + * @param recvWindow Request validity window in milliseconds (optional) + * @return ApiResponse<QuerySettledPositionHistoryResponse> + * @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 Query Settled Position History -
+ * + * @see Query + * Settled Position History Documentation + */ + public ApiResponse querySettledPositionHistory( + @NotNull String walletAddress, + String l1Category, + Integer result, + String startDate, + String endDate, + @Min(0) Integer offset, + @Min(1) @Max(100) Integer limit, + @Max(60000L) Long recvWindow) + throws ApiException { + okhttp3.Call localVarCall = + querySettledPositionHistoryValidateBeforeCall( + walletAddress, + l1Category, + result, + startDate, + endDate, + offset, + limit, + recvWindow); + java.lang.reflect.Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/api/RedeemApi.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/api/RedeemApi.java new file mode 100644 index 000000000..dd32ae8f5 --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/api/RedeemApi.java @@ -0,0 +1,389 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.api; + +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.JSON; +import com.binance.connector.client.common.Pair; +import com.binance.connector.client.common.SystemUtil; +import com.binance.connector.client.common.configuration.ClientConfiguration; +import com.binance.connector.client.common.exception.ConstraintViolationException; +import com.binance.connector.client.w3w_prediction.rest.model.BatchRedeemRequest; +import com.binance.connector.client.w3w_prediction.rest.model.BatchRedeemResponse; +import com.binance.connector.client.w3w_prediction.rest.model.GetRedeemStatusResponse; +import com.google.gson.reflect.TypeToken; +import jakarta.validation.ConstraintViolation; +import jakarta.validation.Valid; +import jakarta.validation.Validation; +import jakarta.validation.Validator; +import jakarta.validation.constraints.*; +import jakarta.validation.executable.ExecutableValidator; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator; + +public class RedeemApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + private static final String USER_AGENT = + String.format( + "binance-w3w-prediction/1.0.0 (Java/%s; %s; %s)", + SystemUtil.getJavaVersion(), SystemUtil.getOs(), SystemUtil.getArch()); + private static final boolean HAS_TIME_UNIT = false; + + public RedeemApi(ClientConfiguration clientConfiguration) { + this(new ApiClient(clientConfiguration)); + } + + public RedeemApi(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 batchRedeem + * + * @param batchRedeemRequest (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 Batch Redeem -
+ * + * @see Batch + * Redeem Documentation + */ + private okhttp3.Call batchRedeemCall(BatchRedeemRequest batchRedeemRequest) + 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 = "/sapi/v1/w3w/wallet/prediction/batch-redeem"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (batchRedeemRequest.getWalletAddress() != null) { + localVarFormParams.put("walletAddress", batchRedeemRequest.getWalletAddress()); + } + + if (batchRedeemRequest.getWalletId() != null) { + localVarFormParams.put("walletId", batchRedeemRequest.getWalletId()); + } + + if (batchRedeemRequest.getTokenIds() != null) { + String json = JSON.getGson().toJson(batchRedeemRequest.getTokenIds()); + localVarFormParams.put("tokenIds", json); + } + + if (batchRedeemRequest.getChainId() != null) { + localVarFormParams.put("chainId", batchRedeemRequest.getChainId()); + } + + 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<>(); + localVarAuthNames.add("binanceSignature"); + if (HAS_TIME_UNIT) { + localVarAuthNames.add("timeUnit"); + } + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call batchRedeemValidateBeforeCall(BatchRedeemRequest batchRedeemRequest) + throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + ExecutableValidator executableValidator = validator.forExecutables(); + + Object[] parameterValues = {batchRedeemRequest}; + Method method = this.getClass().getMethod("batchRedeem", BatchRedeemRequest.class); + Set> violations = + executableValidator.validateParameters(this, method, parameterValues); + + if (violations.size() == 0) { + return batchRedeemCall(batchRedeemRequest); + } 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()); + } + } + + /** + * Batch Redeem Redeem one or more settled prediction tokens on-chain to claim winnings. + * Requires SAS authorization. Weight(IP): 200 Security Type: TRADE + * + * @param batchRedeemRequest (required) + * @return ApiResponse<BatchRedeemResponse> + * @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 Batch Redeem -
+ * + * @see Batch + * Redeem Documentation + */ + public ApiResponse batchRedeem( + @Valid @NotNull BatchRedeemRequest batchRedeemRequest) throws ApiException { + okhttp3.Call localVarCall = batchRedeemValidateBeforeCall(batchRedeemRequest); + java.lang.reflect.Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Build call for getRedeemStatus + * + * @param walletAddress User's prediction wallet address (required) + * @param txHash Redeem transaction hash (required) + * @param recvWindow Request validity window in 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 Get Redeem Status -
+ * + * @see Get + * Redeem Status Documentation + */ + private okhttp3.Call getRedeemStatusCall(String walletAddress, String txHash, Long recvWindow) + 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 = "/sapi/v1/w3w/wallet/prediction/redeem/status"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (walletAddress != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("walletAddress", walletAddress)); + } + + if (txHash != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("txHash", txHash)); + } + + if (recvWindow != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("recvWindow", recvWindow)); + } + + 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<>(); + localVarAuthNames.add("binanceSignature"); + 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 getRedeemStatusValidateBeforeCall( + String walletAddress, String txHash, Long recvWindow) throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + ExecutableValidator executableValidator = validator.forExecutables(); + + Object[] parameterValues = {walletAddress, txHash, recvWindow}; + Method method = + this.getClass() + .getMethod("getRedeemStatus", String.class, String.class, Long.class); + Set> violations = + executableValidator.validateParameters(this, method, parameterValues); + + if (violations.size() == 0) { + return getRedeemStatusCall(walletAddress, txHash, recvWindow); + } 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 Redeem Status Query the on-chain transaction status of a previously submitted redeem + * request. Weight(IP): 200 Security Type: USER_DATA Response Notes: - Status values: | Value | + * Description | | ----------- | -------------------------------------------- | | + * `PENDING` | Transaction submitted, awaiting confirmation | | `CONFIRMED` + * | Transaction confirmed on-chain | | `FAILED` | Transaction failed | | + * `NOT_FOUND` | Transaction hash not found | + * + * @param walletAddress User's prediction wallet address (required) + * @param txHash Redeem transaction hash (required) + * @param recvWindow Request validity window in milliseconds (optional) + * @return ApiResponse<GetRedeemStatusResponse> + * @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 Redeem Status -
+ * + * @see Get + * Redeem Status Documentation + */ + public ApiResponse getRedeemStatus( + @NotNull String walletAddress, @NotNull String txHash, @Max(60000L) Long recvWindow) + throws ApiException { + okhttp3.Call localVarCall = + getRedeemStatusValidateBeforeCall(walletAddress, txHash, recvWindow); + java.lang.reflect.Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/api/TradeApi.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/api/TradeApi.java new file mode 100644 index 000000000..dc5a88400 --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/api/TradeApi.java @@ -0,0 +1,1070 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.api; + +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.JSON; +import com.binance.connector.client.common.Pair; +import com.binance.connector.client.common.SystemUtil; +import com.binance.connector.client.common.configuration.ClientConfiguration; +import com.binance.connector.client.common.exception.ConstraintViolationException; +import com.binance.connector.client.w3w_prediction.rest.model.BatchCancelOrdersRequest; +import com.binance.connector.client.w3w_prediction.rest.model.BatchCancelOrdersResponse; +import com.binance.connector.client.w3w_prediction.rest.model.GetQuoteRequest; +import com.binance.connector.client.w3w_prediction.rest.model.GetQuoteResponse; +import com.binance.connector.client.w3w_prediction.rest.model.OrderType; +import com.binance.connector.client.w3w_prediction.rest.model.PlaceOrderRequest; +import com.binance.connector.client.w3w_prediction.rest.model.PlaceOrderResponse; +import com.binance.connector.client.w3w_prediction.rest.model.QueryActiveOrdersResponse; +import com.binance.connector.client.w3w_prediction.rest.model.QueryOrderHistoryResponse; +import com.binance.connector.client.w3w_prediction.rest.model.TradeSide; +import com.google.gson.reflect.TypeToken; +import jakarta.validation.ConstraintViolation; +import jakarta.validation.Valid; +import jakarta.validation.Validation; +import jakarta.validation.Validator; +import jakarta.validation.constraints.*; +import jakarta.validation.executable.ExecutableValidator; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator; + +public class TradeApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + private static final String USER_AGENT = + String.format( + "binance-w3w-prediction/1.0.0 (Java/%s; %s; %s)", + SystemUtil.getJavaVersion(), SystemUtil.getOs(), SystemUtil.getArch()); + private static final boolean HAS_TIME_UNIT = false; + + public TradeApi(ClientConfiguration clientConfiguration) { + this(new ApiClient(clientConfiguration)); + } + + public TradeApi(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 batchCancelOrders + * + * @param batchCancelOrdersRequest (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 Batch Cancel Orders -
+ * + * @see Batch + * Cancel Orders Documentation + */ + private okhttp3.Call batchCancelOrdersCall(BatchCancelOrdersRequest batchCancelOrdersRequest) + 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 = "/sapi/v1/w3w/wallet/prediction/trade/batch-cancel"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (batchCancelOrdersRequest.getWalletAddress() != null) { + localVarFormParams.put("walletAddress", batchCancelOrdersRequest.getWalletAddress()); + } + + if (batchCancelOrdersRequest.getWalletId() != null) { + localVarFormParams.put("walletId", batchCancelOrdersRequest.getWalletId()); + } + + if (batchCancelOrdersRequest.getCancelInfoList() != null) { + String json = JSON.getGson().toJson(batchCancelOrdersRequest.getCancelInfoList()); + localVarFormParams.put("cancelInfoList", json); + } + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {"application/x-www-form-urlencoded"}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (!localVarFormParams.isEmpty() && localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + Set localVarAuthNames = new HashSet<>(); + localVarAuthNames.add("binanceSignature"); + if (HAS_TIME_UNIT) { + localVarAuthNames.add("timeUnit"); + } + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call batchCancelOrdersValidateBeforeCall( + BatchCancelOrdersRequest batchCancelOrdersRequest) throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + ExecutableValidator executableValidator = validator.forExecutables(); + + Object[] parameterValues = {batchCancelOrdersRequest}; + Method method = + this.getClass().getMethod("batchCancelOrders", BatchCancelOrdersRequest.class); + Set> violations = + executableValidator.validateParameters(this, method, parameterValues); + + if (violations.size() == 0) { + return batchCancelOrdersCall(batchCancelOrdersRequest); + } 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()); + } + } + + /** + * Batch Cancel Orders Cancel one or more active prediction orders in a single request. Requires + * SAS authorization. **Known Issue — Bracket Encoding Incompatibility:** This endpoint uses + * indexed bracket notation (`cancelInfoList[0].orderId`). Binance SAPI signature + * verification runs over the **raw, unencoded** canonical string. However, mainstream HTTP + * libraries (Python `requests`, Java `HttpURLConnection`/`URI`, + * Go `net/url`, Node.js `url`) automatically percent-encode `[` → + * `%5B` and `]` → `%5D`, producing a signature mismatch with + * error `-1022 Signature for this request is not valid`. Postman is unaffected + * because it does not encode keys. **Workarounds** (use low-level HTTP APIs that do not + * normalize URLs): - **Python:** use `http.client` (stdlib) and hand-build the body + * string. - **Java:** use `HttpURLConnection` and write the raw body bytes directly. + * - **Go:** use `strings.NewReader` with a hand-built body instead of + * `url.Values.Encode()`. Weight(IP): 200 Security Type: TRADE Notes: - Use dot + * notation for nested list fields: `cancelInfoList[0].orderId`, + * `cancelInfoList[1].orderId`, etc. - `vendor` does not need to be + * supplied. The server automatically sets the correct vendor (`predict_fun`) for + * every item in the batch. + * + * @param batchCancelOrdersRequest (required) + * @return ApiResponse<BatchCancelOrdersResponse> + * @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 Batch Cancel Orders -
+ * + * @see Batch + * Cancel Orders Documentation + */ + public ApiResponse batchCancelOrders( + @Valid @NotNull BatchCancelOrdersRequest batchCancelOrdersRequest) throws ApiException { + okhttp3.Call localVarCall = batchCancelOrdersValidateBeforeCall(batchCancelOrdersRequest); + java.lang.reflect.Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Build call for getQuote + * + * @param getQuoteRequest (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 Get Quote -
+ * + * @see Get + * Quote Documentation + */ + private okhttp3.Call getQuoteCall(GetQuoteRequest getQuoteRequest) 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 = "/sapi/v1/w3w/wallet/prediction/trade/get-quote"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (getQuoteRequest.getWalletAddress() != null) { + localVarFormParams.put("walletAddress", getQuoteRequest.getWalletAddress()); + } + + if (getQuoteRequest.getTokenId() != null) { + localVarFormParams.put("tokenId", getQuoteRequest.getTokenId()); + } + + if (getQuoteRequest.getSide() != null) { + localVarFormParams.put("side", getQuoteRequest.getSide()); + } + + if (getQuoteRequest.getAmountIn() != null) { + localVarFormParams.put("amountIn", getQuoteRequest.getAmountIn()); + } + + if (getQuoteRequest.getOrderType() != null) { + localVarFormParams.put("orderType", getQuoteRequest.getOrderType()); + } + + if (getQuoteRequest.getSlippageBps() != null) { + localVarFormParams.put("slippageBps", getQuoteRequest.getSlippageBps()); + } + + if (getQuoteRequest.getPriceLimit() != null) { + localVarFormParams.put("priceLimit", getQuoteRequest.getPriceLimit()); + } + + if (getQuoteRequest.getChainId() != null) { + localVarFormParams.put("chainId", getQuoteRequest.getChainId()); + } + + if (getQuoteRequest.getFeeRateBps() != null) { + localVarFormParams.put("feeRateBps", getQuoteRequest.getFeeRateBps()); + } + + if (getQuoteRequest.getFundingSource() != null) { + localVarFormParams.put("fundingSource", getQuoteRequest.getFundingSource()); + } + + if (getQuoteRequest.getFundTransferAmount() != null) { + localVarFormParams.put("fundTransferAmount", getQuoteRequest.getFundTransferAmount()); + } + + 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<>(); + localVarAuthNames.add("binanceSignature"); + if (HAS_TIME_UNIT) { + localVarAuthNames.add("timeUnit"); + } + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getQuoteValidateBeforeCall(GetQuoteRequest getQuoteRequest) + throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + ExecutableValidator executableValidator = validator.forExecutables(); + + Object[] parameterValues = {getQuoteRequest}; + Method method = this.getClass().getMethod("getQuote", GetQuoteRequest.class); + Set> violations = + executableValidator.validateParameters(this, method, parameterValues); + + if (violations.size() == 0) { + return getQuoteCall(getQuoteRequest); + } 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 Quote Get a price quote for a prediction order. The returned `quoteId` must be + * used in the subsequent Place Order request. Weight(IP): 200 Security Type: TRADE Response + * Notes: - `feeAmount` is a string because it is denominated in wei (18 decimals) and + * may exceed JavaScript's safe integer range. `feeDiscountBps` is also a string + * to allow fractional basis-point values in the future. `feeRateBps` and + * `slippageBps` are integers and will never exceed safe integer bounds. - **MARKET + * order minimum amount:** For `MARKET` orders, `amountIn` must be at least + * approximately **1.5 USDT** (in wei: `1500000000000000000`). The exact minimum + * varies by market liquidity. If the amount is too small, the server returns `-9000 Your + * order amount is too small`. This limit does **not** apply to `LIMIT` orders. + * + * @param getQuoteRequest (required) + * @return ApiResponse<GetQuoteResponse> + * @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 Quote -
+ * + * @see Get + * Quote Documentation + */ + public ApiResponse getQuote(@Valid @NotNull GetQuoteRequest getQuoteRequest) + throws ApiException { + okhttp3.Call localVarCall = getQuoteValidateBeforeCall(getQuoteRequest); + java.lang.reflect.Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Build call for placeOrder + * + * @param placeOrderRequest (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 Place Order -
+ * + * @see Place + * Order Documentation + */ + private okhttp3.Call placeOrderCall(PlaceOrderRequest placeOrderRequest) 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 = "/sapi/v1/w3w/wallet/prediction/trade/place-order-bundle"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (placeOrderRequest.getWalletAddress() != null) { + localVarFormParams.put("walletAddress", placeOrderRequest.getWalletAddress()); + } + + if (placeOrderRequest.getWalletId() != null) { + localVarFormParams.put("walletId", placeOrderRequest.getWalletId()); + } + + if (placeOrderRequest.getQuoteId() != null) { + localVarFormParams.put("quoteId", placeOrderRequest.getQuoteId()); + } + + if (placeOrderRequest.getTimeInForce() != null) { + localVarFormParams.put("timeInForce", placeOrderRequest.getTimeInForce()); + } + + if (placeOrderRequest.getAccountType() != null) { + localVarFormParams.put("accountType", placeOrderRequest.getAccountType()); + } + + if (placeOrderRequest.getOrderType() != null) { + localVarFormParams.put("orderType", placeOrderRequest.getOrderType()); + } + + if (placeOrderRequest.getSlippageBps() != null) { + localVarFormParams.put("slippageBps", placeOrderRequest.getSlippageBps()); + } + + if (placeOrderRequest.getPriceLimit() != null) { + localVarFormParams.put("priceLimit", placeOrderRequest.getPriceLimit()); + } + + if (placeOrderRequest.getFundingSource() != null) { + localVarFormParams.put("fundingSource", placeOrderRequest.getFundingSource()); + } + + if (placeOrderRequest.getFundTransferAmount() != null) { + localVarFormParams.put("fundTransferAmount", placeOrderRequest.getFundTransferAmount()); + } + + 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<>(); + localVarAuthNames.add("binanceSignature"); + if (HAS_TIME_UNIT) { + localVarAuthNames.add("timeUnit"); + } + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call placeOrderValidateBeforeCall(PlaceOrderRequest placeOrderRequest) + throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + ExecutableValidator executableValidator = validator.forExecutables(); + + Object[] parameterValues = {placeOrderRequest}; + Method method = this.getClass().getMethod("placeOrder", PlaceOrderRequest.class); + Set> violations = + executableValidator.validateParameters(this, method, parameterValues); + + if (violations.size() == 0) { + return placeOrderCall(placeOrderRequest); + } 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()); + } + } + + /** + * Place Order Place a prediction order using a previously obtained quote. Requires SAS + * authorization. Weight(IP): 200 Security Type: TRADE Notes: - Validation rules: | orderType | + * timeInForce | priceLimit | | --------- | ------------- | --------------------- | | + * `MARKET` | Must be `FOK` | Not required | | `LIMIT` | Must be + * `GTC` | Required, must be > 0 | + * + * @param placeOrderRequest (required) + * @return ApiResponse<PlaceOrderResponse> + * @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 Place Order -
+ * + * @see Place + * Order Documentation + */ + public ApiResponse placeOrder( + @Valid @NotNull PlaceOrderRequest placeOrderRequest) throws ApiException { + okhttp3.Call localVarCall = placeOrderValidateBeforeCall(placeOrderRequest); + java.lang.reflect.Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Build call for queryActiveOrders + * + * @param walletAddress User's prediction wallet address (required) + * @param tradeSide Filter by trade side. Enum: `BUY`, `SELL` (optional) + * @param l1Category Filter by level-1 category (optional) + * @param marketId Filter by market ID (optional) + * @param offset Pagination offset. Default `0` (optional) + * @param limit Page size. Default `20`, range 1–100 (optional) + * @param recvWindow Request validity window in 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 Query Active Orders -
+ * + * @see Query + * Active Orders Documentation + */ + private okhttp3.Call queryActiveOrdersCall( + String walletAddress, + TradeSide tradeSide, + String l1Category, + Long marketId, + Integer offset, + Integer limit, + Long recvWindow) + 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 = "/sapi/v1/w3w/wallet/prediction/order/list"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (walletAddress != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("walletAddress", walletAddress)); + } + + if (tradeSide != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("tradeSide", tradeSide)); + } + + if (l1Category != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("l1Category", l1Category)); + } + + if (marketId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("marketId", marketId)); + } + + if (offset != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("offset", offset)); + } + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + if (recvWindow != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("recvWindow", recvWindow)); + } + + 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<>(); + localVarAuthNames.add("binanceSignature"); + 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 queryActiveOrdersValidateBeforeCall( + String walletAddress, + TradeSide tradeSide, + String l1Category, + Long marketId, + Integer offset, + Integer limit, + Long recvWindow) + throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + ExecutableValidator executableValidator = validator.forExecutables(); + + Object[] parameterValues = { + walletAddress, tradeSide, l1Category, marketId, offset, limit, recvWindow + }; + Method method = + this.getClass() + .getMethod( + "queryActiveOrders", + String.class, + TradeSide.class, + String.class, + Long.class, + Integer.class, + Integer.class, + Long.class); + Set> violations = + executableValidator.validateParameters(this, method, parameterValues); + + if (violations.size() == 0) { + return queryActiveOrdersCall( + walletAddress, tradeSide, l1Category, marketId, offset, limit, recvWindow); + } 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()); + } + } + + /** + * Query Active Orders Get active (open) prediction orders for the authenticated user. + * Weight(IP): 200 Security Type: USER_DATA + * + * @param walletAddress User's prediction wallet address (required) + * @param tradeSide Filter by trade side. Enum: `BUY`, `SELL` (optional) + * @param l1Category Filter by level-1 category (optional) + * @param marketId Filter by market ID (optional) + * @param offset Pagination offset. Default `0` (optional) + * @param limit Page size. Default `20`, range 1–100 (optional) + * @param recvWindow Request validity window in milliseconds (optional) + * @return ApiResponse<QueryActiveOrdersResponse> + * @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 Query Active Orders -
+ * + * @see Query + * Active Orders Documentation + */ + public ApiResponse queryActiveOrders( + @NotNull String walletAddress, + TradeSide tradeSide, + String l1Category, + Long marketId, + @Min(0) Integer offset, + @Min(1) @Max(100) Integer limit, + @Max(60000L) Long recvWindow) + throws ApiException { + okhttp3.Call localVarCall = + queryActiveOrdersValidateBeforeCall( + walletAddress, tradeSide, l1Category, marketId, offset, limit, recvWindow); + java.lang.reflect.Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Build call for queryOrderHistory + * + * @param walletAddress User's prediction wallet address (required) + * @param l1Category Filter by level-1 category (optional) + * @param orderType Filter by order type. Enum: `MARKET`, `LIMIT` (optional) + * @param status Filter by order status (optional) + * @param startDate Start date. Format: `yyyy-MM-dd`. Must be ≤ `endDate` + * (optional) + * @param endDate End date. Format: `yyyy-MM-dd`. Must be ≥ `startDate` + * (optional) + * @param offset Pagination offset. Default `0` (optional) + * @param limit Page size. Default `20`, range 1–100 (optional) + * @param recvWindow Request validity window in 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 Query Order History -
+ * + * @see Query + * Order History Documentation + */ + private okhttp3.Call queryOrderHistoryCall( + String walletAddress, + String l1Category, + OrderType orderType, + String status, + String startDate, + String endDate, + Integer offset, + Integer limit, + Long recvWindow) + 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 = "/sapi/v1/w3w/wallet/prediction/order/history"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (walletAddress != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("walletAddress", walletAddress)); + } + + if (l1Category != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("l1Category", l1Category)); + } + + if (orderType != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("orderType", orderType)); + } + + if (status != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("status", status)); + } + + if (startDate != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("startDate", startDate)); + } + + if (endDate != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("endDate", endDate)); + } + + if (offset != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("offset", offset)); + } + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + if (recvWindow != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("recvWindow", recvWindow)); + } + + 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<>(); + localVarAuthNames.add("binanceSignature"); + 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 queryOrderHistoryValidateBeforeCall( + String walletAddress, + String l1Category, + OrderType orderType, + String status, + String startDate, + String endDate, + Integer offset, + Integer limit, + Long recvWindow) + throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + ExecutableValidator executableValidator = validator.forExecutables(); + + Object[] parameterValues = { + walletAddress, + l1Category, + orderType, + status, + startDate, + endDate, + offset, + limit, + recvWindow + }; + Method method = + this.getClass() + .getMethod( + "queryOrderHistory", + String.class, + String.class, + OrderType.class, + String.class, + String.class, + String.class, + Integer.class, + Integer.class, + Long.class); + Set> violations = + executableValidator.validateParameters(this, method, parameterValues); + + if (violations.size() == 0) { + return queryOrderHistoryCall( + walletAddress, + l1Category, + orderType, + status, + startDate, + endDate, + offset, + limit, + recvWindow); + } 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()); + } + } + + /** + * Query Order History Get historical prediction orders (all statuses) for the authenticated + * user, with optional filters. Weight(IP): 200 Security Type: USER_DATA + * + * @param walletAddress User's prediction wallet address (required) + * @param l1Category Filter by level-1 category (optional) + * @param orderType Filter by order type. Enum: `MARKET`, `LIMIT` (optional) + * @param status Filter by order status (optional) + * @param startDate Start date. Format: `yyyy-MM-dd`. Must be ≤ `endDate` + * (optional) + * @param endDate End date. Format: `yyyy-MM-dd`. Must be ≥ `startDate` + * (optional) + * @param offset Pagination offset. Default `0` (optional) + * @param limit Page size. Default `20`, range 1–100 (optional) + * @param recvWindow Request validity window in milliseconds (optional) + * @return ApiResponse<QueryOrderHistoryResponse> + * @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 Query Order History -
+ * + * @see Query + * Order History Documentation + */ + public ApiResponse queryOrderHistory( + @NotNull String walletAddress, + String l1Category, + OrderType orderType, + String status, + String startDate, + String endDate, + @Min(0) Integer offset, + @Min(1) @Max(100) Integer limit, + @Max(60000L) Long recvWindow) + throws ApiException { + okhttp3.Call localVarCall = + queryOrderHistoryValidateBeforeCall( + walletAddress, + l1Category, + orderType, + status, + startDate, + endDate, + offset, + limit, + recvWindow); + java.lang.reflect.Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/api/TransferApi.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/api/TransferApi.java new file mode 100644 index 000000000..6b66ea921 --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/api/TransferApi.java @@ -0,0 +1,811 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.api; + +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.binance.connector.client.w3w_prediction.rest.model.CreateInboundTransferRequest; +import com.binance.connector.client.w3w_prediction.rest.model.CreateInboundTransferResponse; +import com.binance.connector.client.w3w_prediction.rest.model.CreateOutboundTransferRequest; +import com.binance.connector.client.w3w_prediction.rest.model.CreateOutboundTransferResponse; +import com.binance.connector.client.w3w_prediction.rest.model.Direction; +import com.binance.connector.client.w3w_prediction.rest.model.QueryTransferListResponse; +import com.binance.connector.client.w3w_prediction.rest.model.QueryTransferStatusResponse; +import com.google.gson.reflect.TypeToken; +import jakarta.validation.ConstraintViolation; +import jakarta.validation.Valid; +import jakarta.validation.Validation; +import jakarta.validation.Validator; +import jakarta.validation.constraints.*; +import jakarta.validation.executable.ExecutableValidator; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator; + +public class TransferApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + private static final String USER_AGENT = + String.format( + "binance-w3w-prediction/1.0.0 (Java/%s; %s; %s)", + SystemUtil.getJavaVersion(), SystemUtil.getOs(), SystemUtil.getArch()); + private static final boolean HAS_TIME_UNIT = false; + + public TransferApi(ClientConfiguration clientConfiguration) { + this(new ApiClient(clientConfiguration)); + } + + public TransferApi(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 createInboundTransfer + * + * @param createInboundTransferRequest (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 Create Inbound Transfer -
+ * + * @see Create + * Inbound Transfer Documentation + */ + private okhttp3.Call createInboundTransferCall( + CreateInboundTransferRequest createInboundTransferRequest) 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 = "/sapi/v1/w3w/wallet/prediction/transfer/inbound"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (createInboundTransferRequest.getWalletId() != null) { + localVarFormParams.put("walletId", createInboundTransferRequest.getWalletId()); + } + + if (createInboundTransferRequest.getWalletAddress() != null) { + localVarFormParams.put( + "walletAddress", createInboundTransferRequest.getWalletAddress()); + } + + if (createInboundTransferRequest.getFromTokenAmount() != null) { + localVarFormParams.put( + "fromTokenAmount", createInboundTransferRequest.getFromTokenAmount()); + } + + if (createInboundTransferRequest.getAccountType() != null) { + localVarFormParams.put("accountType", createInboundTransferRequest.getAccountType()); + } + + if (createInboundTransferRequest.getFromToken() != null) { + localVarFormParams.put("fromToken", createInboundTransferRequest.getFromToken()); + } + + if (createInboundTransferRequest.getToToken() != null) { + localVarFormParams.put("toToken", createInboundTransferRequest.getToToken()); + } + + if (createInboundTransferRequest.getChainId() != null) { + localVarFormParams.put("chainId", createInboundTransferRequest.getChainId()); + } + + 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<>(); + localVarAuthNames.add("binanceSignature"); + if (HAS_TIME_UNIT) { + localVarAuthNames.add("timeUnit"); + } + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createInboundTransferValidateBeforeCall( + CreateInboundTransferRequest createInboundTransferRequest) throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + ExecutableValidator executableValidator = validator.forExecutables(); + + Object[] parameterValues = {createInboundTransferRequest}; + Method method = + this.getClass() + .getMethod("createInboundTransfer", CreateInboundTransferRequest.class); + Set> violations = + executableValidator.validateParameters(this, method, parameterValues); + + if (violations.size() == 0) { + return createInboundTransferCall(createInboundTransferRequest); + } 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()); + } + } + + /** + * Create Inbound Transfer Transfer funds from the prediction wallet back to the user's CEX + * account (SPOT or FUNDING). Requires SAS authorization. ⚠️ **SAS Authorization Required:** + * This endpoint enforces SAS (Self-Authorization Service) authorization. If SAS is not enabled + * for the wallet, the request will be rejected with `-31003 SAS authorization + * required`. Enable SAS for your wallet before calling this endpoint. Weight(IP): 200 + * Security Type: TRADE + * + * @param createInboundTransferRequest (required) + * @return ApiResponse<CreateInboundTransferResponse> + * @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 Create Inbound Transfer -
+ * + * @see Create + * Inbound Transfer Documentation + */ + public ApiResponse createInboundTransfer( + @Valid @NotNull CreateInboundTransferRequest createInboundTransferRequest) + throws ApiException { + okhttp3.Call localVarCall = + createInboundTransferValidateBeforeCall(createInboundTransferRequest); + java.lang.reflect.Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Build call for createOutboundTransfer + * + * @param createOutboundTransferRequest (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 Create Outbound Transfer -
+ * + * @see Create + * Outbound Transfer Documentation + */ + private okhttp3.Call createOutboundTransferCall( + CreateOutboundTransferRequest createOutboundTransferRequest) 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 = "/sapi/v1/w3w/wallet/prediction/transfer/outbound"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (createOutboundTransferRequest.getWalletId() != null) { + localVarFormParams.put("walletId", createOutboundTransferRequest.getWalletId()); + } + + if (createOutboundTransferRequest.getWalletAddress() != null) { + localVarFormParams.put( + "walletAddress", createOutboundTransferRequest.getWalletAddress()); + } + + if (createOutboundTransferRequest.getFromTokenAmount() != null) { + localVarFormParams.put( + "fromTokenAmount", createOutboundTransferRequest.getFromTokenAmount()); + } + + if (createOutboundTransferRequest.getAccountType() != null) { + localVarFormParams.put("accountType", createOutboundTransferRequest.getAccountType()); + } + + if (createOutboundTransferRequest.getSourceBiz() != null) { + localVarFormParams.put("sourceBiz", createOutboundTransferRequest.getSourceBiz()); + } + + if (createOutboundTransferRequest.getFromToken() != null) { + localVarFormParams.put("fromToken", createOutboundTransferRequest.getFromToken()); + } + + if (createOutboundTransferRequest.getToToken() != null) { + localVarFormParams.put("toToken", createOutboundTransferRequest.getToToken()); + } + + if (createOutboundTransferRequest.getChainId() != null) { + localVarFormParams.put("chainId", createOutboundTransferRequest.getChainId()); + } + + 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<>(); + localVarAuthNames.add("binanceSignature"); + if (HAS_TIME_UNIT) { + localVarAuthNames.add("timeUnit"); + } + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createOutboundTransferValidateBeforeCall( + CreateOutboundTransferRequest createOutboundTransferRequest) throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + ExecutableValidator executableValidator = validator.forExecutables(); + + Object[] parameterValues = {createOutboundTransferRequest}; + Method method = + this.getClass() + .getMethod( + "createOutboundTransfer", CreateOutboundTransferRequest.class); + Set> violations = + executableValidator.validateParameters(this, method, parameterValues); + + if (violations.size() == 0) { + return createOutboundTransferCall(createOutboundTransferRequest); + } 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()); + } + } + + /** + * Create Outbound Transfer Transfer funds from the user's CEX account (SPOT or FUNDING) + * into the prediction wallet. Requires SAS authorization. Weight(IP): 200 Security Type: TRADE + * + * @param createOutboundTransferRequest (required) + * @return ApiResponse<CreateOutboundTransferResponse> + * @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 Create Outbound Transfer -
+ * + * @see Create + * Outbound Transfer Documentation + */ + public ApiResponse createOutboundTransfer( + @Valid @NotNull CreateOutboundTransferRequest createOutboundTransferRequest) + throws ApiException { + okhttp3.Call localVarCall = + createOutboundTransferValidateBeforeCall(createOutboundTransferRequest); + java.lang.reflect.Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Build call for queryTransferList + * + * @param walletAddress User's prediction wallet address (required) + * @param startDate Start date. Format: `yyyy-MM-dd`. Must be ≤ `endDate` + * (required) + * @param endDate End date. Format: `yyyy-MM-dd`. Must be ≥ `startDate` + * (required) + * @param tokenSymbol Filter by token symbol (e.g. `USDT`) (optional) + * @param direction Filter by direction. Enum: `INBOUND`, `OUTBOUND` + * (optional) + * @param offset Pagination offset. Default `0` (optional) + * @param limit Page size. Default `20`, range 1–100 (optional) + * @param recvWindow Request validity window in 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 Query Transfer List -
+ * + * @see Query + * Transfer List Documentation + */ + private okhttp3.Call queryTransferListCall( + String walletAddress, + String startDate, + String endDate, + String tokenSymbol, + Direction direction, + Integer offset, + Integer limit, + Long recvWindow) + 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 = "/sapi/v1/w3w/wallet/prediction/transfer/list"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (walletAddress != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("walletAddress", walletAddress)); + } + + if (startDate != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("startDate", startDate)); + } + + if (endDate != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("endDate", endDate)); + } + + if (tokenSymbol != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("tokenSymbol", tokenSymbol)); + } + + if (direction != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("direction", direction)); + } + + if (offset != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("offset", offset)); + } + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + if (recvWindow != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("recvWindow", recvWindow)); + } + + 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<>(); + localVarAuthNames.add("binanceSignature"); + 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 queryTransferListValidateBeforeCall( + String walletAddress, + String startDate, + String endDate, + String tokenSymbol, + Direction direction, + Integer offset, + Integer limit, + Long recvWindow) + throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + ExecutableValidator executableValidator = validator.forExecutables(); + + Object[] parameterValues = { + walletAddress, startDate, endDate, tokenSymbol, direction, offset, limit, recvWindow + }; + Method method = + this.getClass() + .getMethod( + "queryTransferList", + String.class, + String.class, + String.class, + String.class, + Direction.class, + Integer.class, + Integer.class, + Long.class); + Set> violations = + executableValidator.validateParameters(this, method, parameterValues); + + if (violations.size() == 0) { + return queryTransferListCall( + walletAddress, + startDate, + endDate, + tokenSymbol, + direction, + offset, + limit, + recvWindow); + } 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()); + } + } + + /** + * Query Transfer List Get the authenticated user's prediction wallet transfer history + * within a date range. Weight(IP): 200 Security Type: USER_DATA + * + * @param walletAddress User's prediction wallet address (required) + * @param startDate Start date. Format: `yyyy-MM-dd`. Must be ≤ `endDate` + * (required) + * @param endDate End date. Format: `yyyy-MM-dd`. Must be ≥ `startDate` + * (required) + * @param tokenSymbol Filter by token symbol (e.g. `USDT`) (optional) + * @param direction Filter by direction. Enum: `INBOUND`, `OUTBOUND` + * (optional) + * @param offset Pagination offset. Default `0` (optional) + * @param limit Page size. Default `20`, range 1–100 (optional) + * @param recvWindow Request validity window in milliseconds (optional) + * @return ApiResponse<QueryTransferListResponse> + * @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 Query Transfer List -
+ * + * @see Query + * Transfer List Documentation + */ + public ApiResponse queryTransferList( + @NotNull String walletAddress, + @NotNull String startDate, + @NotNull String endDate, + String tokenSymbol, + Direction direction, + @Min(0) Integer offset, + @Min(1) @Max(100) Integer limit, + @Max(60000L) Long recvWindow) + throws ApiException { + okhttp3.Call localVarCall = + queryTransferListValidateBeforeCall( + walletAddress, + startDate, + endDate, + tokenSymbol, + direction, + offset, + limit, + recvWindow); + java.lang.reflect.Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Build call for queryTransferStatus + * + * @param transferId Transfer ID returned from outbound/inbound transfer (required) + * @param recvWindow Request validity window in 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 Query Transfer Status -
+ * + * @see Query + * Transfer Status Documentation + */ + private okhttp3.Call queryTransferStatusCall(String transferId, Long recvWindow) + 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 = "/sapi/v1/w3w/wallet/prediction/transfer/status"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (transferId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("transferId", transferId)); + } + + if (recvWindow != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("recvWindow", recvWindow)); + } + + 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<>(); + localVarAuthNames.add("binanceSignature"); + 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 queryTransferStatusValidateBeforeCall(String transferId, Long recvWindow) + throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + ExecutableValidator executableValidator = validator.forExecutables(); + + Object[] parameterValues = {transferId, recvWindow}; + Method method = + this.getClass().getMethod("queryTransferStatus", String.class, Long.class); + Set> violations = + executableValidator.validateParameters(this, method, parameterValues); + + if (violations.size() == 0) { + return queryTransferStatusCall(transferId, recvWindow); + } 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()); + } + } + + /** + * Query Transfer Status Query the current status of a prediction wallet transfer by transfer + * ID. **`status` values:** Terminal states are `COMPLETED` and + * `FAILED`. Intermediate states are `PROCESSING` and `PENDING`. + * **Do not** poll for `SUCCESS` — it is not a valid terminal state. Weight(IP): 200 + * Security Type: USER_DATA + * + * @param transferId Transfer ID returned from outbound/inbound transfer (required) + * @param recvWindow Request validity window in milliseconds (optional) + * @return ApiResponse<QueryTransferStatusResponse> + * @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 Query Transfer Status -
+ * + * @see Query + * Transfer Status Documentation + */ + public ApiResponse queryTransferStatus( + @NotNull String transferId, @Max(60000L) Long recvWindow) throws ApiException { + okhttp3.Call localVarCall = queryTransferStatusValidateBeforeCall(transferId, recvWindow); + java.lang.reflect.Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/api/W3WPredictionRestApi.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/api/W3WPredictionRestApi.java new file mode 100644 index 000000000..e08517d71 --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/api/W3WPredictionRestApi.java @@ -0,0 +1,866 @@ +package com.binance.connector.client.w3w_prediction.rest.api; + +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; +import com.binance.connector.client.w3w_prediction.rest.W3WPredictionRestApiUtil; +import com.binance.connector.client.w3w_prediction.rest.model.BatchCancelOrdersRequest; +import com.binance.connector.client.w3w_prediction.rest.model.BatchCancelOrdersResponse; +import com.binance.connector.client.w3w_prediction.rest.model.BatchRedeemRequest; +import com.binance.connector.client.w3w_prediction.rest.model.BatchRedeemResponse; +import com.binance.connector.client.w3w_prediction.rest.model.CreateInboundTransferRequest; +import com.binance.connector.client.w3w_prediction.rest.model.CreateInboundTransferResponse; +import com.binance.connector.client.w3w_prediction.rest.model.CreateOutboundTransferRequest; +import com.binance.connector.client.w3w_prediction.rest.model.CreateOutboundTransferResponse; +import com.binance.connector.client.w3w_prediction.rest.model.Direction; +import com.binance.connector.client.w3w_prediction.rest.model.GetMarketDetailResponse; +import com.binance.connector.client.w3w_prediction.rest.model.GetPortfolioResponse; +import com.binance.connector.client.w3w_prediction.rest.model.GetPositionByTokenResponse; +import com.binance.connector.client.w3w_prediction.rest.model.GetQuotaStatusResponse; +import com.binance.connector.client.w3w_prediction.rest.model.GetQuoteRequest; +import com.binance.connector.client.w3w_prediction.rest.model.GetQuoteResponse; +import com.binance.connector.client.w3w_prediction.rest.model.GetRedeemStatusResponse; +import com.binance.connector.client.w3w_prediction.rest.model.ListPredictionCategoriesResponse; +import com.binance.connector.client.w3w_prediction.rest.model.ListPredictionMarketsResponse; +import com.binance.connector.client.w3w_prediction.rest.model.ListPredictionWalletsResponse; +import com.binance.connector.client.w3w_prediction.rest.model.MarketSearchResponse; +import com.binance.connector.client.w3w_prediction.rest.model.OrderBy; +import com.binance.connector.client.w3w_prediction.rest.model.OrderType; +import com.binance.connector.client.w3w_prediction.rest.model.PlaceOrderRequest; +import com.binance.connector.client.w3w_prediction.rest.model.PlaceOrderResponse; +import com.binance.connector.client.w3w_prediction.rest.model.QueryActiveOrdersResponse; +import com.binance.connector.client.w3w_prediction.rest.model.QueryLastTradePriceResponse; +import com.binance.connector.client.w3w_prediction.rest.model.QueryOrderBookResponse; +import com.binance.connector.client.w3w_prediction.rest.model.QueryOrderHistoryResponse; +import com.binance.connector.client.w3w_prediction.rest.model.QueryPaymentOptionBalancesResponse; +import com.binance.connector.client.w3w_prediction.rest.model.QueryPnLResponse; +import com.binance.connector.client.w3w_prediction.rest.model.QueryPositionsByFilterResponse; +import com.binance.connector.client.w3w_prediction.rest.model.QueryPositionsResponse; +import com.binance.connector.client.w3w_prediction.rest.model.QuerySettledPositionHistoryResponse; +import com.binance.connector.client.w3w_prediction.rest.model.QueryTransferListResponse; +import com.binance.connector.client.w3w_prediction.rest.model.QueryTransferStatusResponse; +import com.binance.connector.client.w3w_prediction.rest.model.SortBy; +import com.binance.connector.client.w3w_prediction.rest.model.TradeSide; + +public class W3WPredictionRestApi { + + private final MarketDataApi marketDataApi; + private final PositionApi positionApi; + private final RedeemApi redeemApi; + private final TradeApi tradeApi; + private final TransferApi transferApi; + private final WalletApi walletApi; + + public W3WPredictionRestApi(ClientConfiguration configuration) { + this(W3WPredictionRestApiUtil.getDefaultClient(configuration)); + } + + public W3WPredictionRestApi(ApiClient apiClient) { + this.marketDataApi = new MarketDataApi(apiClient); + this.positionApi = new PositionApi(apiClient); + this.redeemApi = new RedeemApi(apiClient); + this.tradeApi = new TradeApi(apiClient); + this.transferApi = new TransferApi(apiClient); + this.walletApi = new WalletApi(apiClient); + } + + /** + * Get Market Detail Get full details for a specific prediction market topic, including variant + * data and timeline. Weight(IP): 200 + * + * @param marketTopicId Market topic ID. Must be > 0 (required) + * @return ApiResponse<GetMarketDetailResponse> + * @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 Market Detail -
+ * + * @see Get + * Market Detail Documentation + */ + public ApiResponse getMarketDetail(Long marketTopicId) + throws ApiException { + return marketDataApi.getMarketDetail(marketTopicId); + } + + /** + * List Prediction Categories Get all available prediction market categories (L1 and L2). + * Weight(IP): 200 + * + * @return ApiResponse<ListPredictionCategoriesResponse> + * @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 List Prediction Categories -
+ * + * @see List + * Prediction Categories Documentation + */ + public ApiResponse listPredictionCategories() + throws ApiException { + return marketDataApi.listPredictionCategories(); + } + + /** + * List Prediction Markets Get a paginated list of prediction market topics, with optional + * category and sort filters. Weight(IP): 200 + * + * @param l1Category Level-1 category filter (optional) + * @param l2Category Level-2 category filter (optional) + * @param sortBy Sort field. Enum: `RECOMMENDED`, `VOLUME`, + * `PARTICIPANTS`, `CREATED_TIME`, `END_DATE` (optional) + * @param orderBy Sort direction. Enum: `ASC`, `DESC` (optional) + * @param offset Pagination offset. Default `0` (optional) + * @param limit Page size. Default `20`, range 1–100 (optional) + * @return ApiResponse<ListPredictionMarketsResponse> + * @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 List Prediction Markets -
+ * + * @see List + * Prediction Markets Documentation + */ + public ApiResponse listPredictionMarkets( + String l1Category, + String l2Category, + SortBy sortBy, + OrderBy orderBy, + Integer offset, + Integer limit) + throws ApiException { + return marketDataApi.listPredictionMarkets( + l1Category, l2Category, sortBy, orderBy, offset, limit); + } + + /** + * Market Search Semantic search for prediction market topics by keyword. Weight(IP): 200 + * + * @param query Search keyword. Not blank (required) + * @param topK Max number of results to return. Default `20`, range 1–50 (optional) + * @return ApiResponse<MarketSearchResponse> + * @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 Market Search -
+ * + * @see Market + * Search Documentation + */ + public ApiResponse marketSearch(String query, Integer topK) + throws ApiException { + return marketDataApi.marketSearch(query, topK); + } + + /** + * Query Last Trade Price Get the most recent trade price for a prediction market. Weight(IP): + * 200 + * + * @param marketId Market ID. Must be > 0 (required) + * @return ApiResponse<QueryLastTradePriceResponse> + * @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 Query Last Trade Price -
+ * + * @see Query + * Last Trade Price Documentation + */ + public ApiResponse queryLastTradePrice(Long marketId) + throws ApiException { + return marketDataApi.queryLastTradePrice(marketId); + } + + /** + * Query Order Book Get the current order book (bids and asks) for a specific prediction market + * outcome token. Weight(IP): 200 + * + * @param vendor Vendor identifier (e.g. `predict_fun`) (required) + * @param marketId Market ID. Must be > 0 (required) + * @param tokenId Prediction outcome token ID (required) + * @return ApiResponse<QueryOrderBookResponse> + * @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 Query Order Book -
+ * + * @see Query + * Order Book Documentation + */ + public ApiResponse queryOrderBook( + String vendor, Long marketId, String tokenId) throws ApiException { + return marketDataApi.queryOrderBook(vendor, marketId, tokenId); + } + + /** + * Get Position by Token Get the authenticated user's position detail for a specific + * prediction token. Weight(IP): 200 Security Type: USER_DATA + * + * @param walletAddress User's prediction wallet address (required) + * @param tokenId Prediction outcome token ID (required) + * @param recvWindow Request validity window in milliseconds (optional) + * @return ApiResponse<GetPositionByTokenResponse> + * @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 Position by Token -
+ * + * @see Get + * Position by Token Documentation + */ + public ApiResponse getPositionByToken( + String walletAddress, String tokenId, Long recvWindow) throws ApiException { + return positionApi.getPositionByToken(walletAddress, tokenId, recvWindow); + } + + /** + * Query PnL Query profit and loss records for the authenticated user's prediction + * positions. When `tokenId` is provided, returns a single record in `pnl`; + * otherwise returns a list in `pnlList`. Weight(IP): 200 Security Type: USER_DATA + * + * @param walletAddress User's prediction wallet address (required) + * @param tokenId Filter by prediction token ID (optional) + * @param marketId Filter by market ID. Must be > 0 (optional) + * @param marketTopicId Filter by market topic ID. Must be > 0 (optional) + * @param activeOnly If `true`, return only active (unresolved) positions (optional) + * @param recvWindow Request validity window in milliseconds (optional) + * @return ApiResponse<QueryPnLResponse> + * @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 Query PnL -
+ * + * @see Query + * PnL Documentation + */ + public ApiResponse queryPnL( + String walletAddress, + String tokenId, + Long marketId, + Long marketTopicId, + Boolean activeOnly, + Long recvWindow) + throws ApiException { + return positionApi.queryPnL( + walletAddress, tokenId, marketId, marketTopicId, activeOnly, recvWindow); + } + + /** + * Query Positions Get the authenticated user's prediction token positions with portfolio + * summary and tab-based filtering. Weight(IP): 200 Security Type: USER_DATA + * + * @param walletAddress User's prediction wallet address (required) + * @param tab Position status tab. Values from `PositionQueryType`. Default + * `ONGOING` (optional) + * @param offset Pagination offset. Default `0` (optional) + * @param limit Page size. Default `20`, range 1–100 (optional) + * @param recvWindow Request validity window in milliseconds (optional) + * @return ApiResponse<QueryPositionsResponse> + * @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 Query Positions -
+ * + * @see Query + * Positions Documentation + */ + public ApiResponse queryPositions( + String walletAddress, String tab, Integer offset, Integer limit, Long recvWindow) + throws ApiException { + return positionApi.queryPositions(walletAddress, tab, offset, limit, recvWindow); + } + + /** + * Query Positions by Filter Get prediction positions filtered by wallet address and/or market + * topic ID. Both parameters are optional. Weight(IP): 200 Security Type: USER_DATA + * + * @param walletAddress User's prediction wallet address (optional) + * @param marketTopicId Filter by market topic ID (optional) + * @param recvWindow Request validity window in milliseconds (optional) + * @return ApiResponse<QueryPositionsByFilterResponse> + * @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 Query Positions by Filter -
+ * + * @see Query + * Positions by Filter Documentation + */ + public ApiResponse queryPositionsByFilter( + String walletAddress, Long marketTopicId, Long recvWindow) throws ApiException { + return positionApi.queryPositionsByFilter(walletAddress, marketTopicId, recvWindow); + } + + /** + * Query Settled Position History Get the authenticated user's settled (resolved) prediction + * position history with optional filters. Weight(IP): 200 Security Type: USER_DATA + * + * @param walletAddress User's prediction wallet address (required) + * @param l1Category Filter by level-1 category (optional) + * @param result Settlement result filter (optional) + * @param startDate Start date. Format: `yyyy-MM-dd`. Must be ≤ `endDate` + * (optional) + * @param endDate End date. Format: `yyyy-MM-dd`. Must be ≥ `startDate` + * (optional) + * @param offset Pagination offset. Default `0` (optional) + * @param limit Page size. Default `20`, range 1–100 (optional) + * @param recvWindow Request validity window in milliseconds (optional) + * @return ApiResponse<QuerySettledPositionHistoryResponse> + * @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 Query Settled Position History -
+ * + * @see Query + * Settled Position History Documentation + */ + public ApiResponse querySettledPositionHistory( + String walletAddress, + String l1Category, + Integer result, + String startDate, + String endDate, + Integer offset, + Integer limit, + Long recvWindow) + throws ApiException { + return positionApi.querySettledPositionHistory( + walletAddress, l1Category, result, startDate, endDate, offset, limit, recvWindow); + } + + /** + * Batch Redeem Redeem one or more settled prediction tokens on-chain to claim winnings. + * Requires SAS authorization. Weight(IP): 200 Security Type: TRADE + * + * @param batchRedeemRequest (required) + * @return ApiResponse<BatchRedeemResponse> + * @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 Batch Redeem -
+ * + * @see Batch + * Redeem Documentation + */ + public ApiResponse batchRedeem(BatchRedeemRequest batchRedeemRequest) + throws ApiException { + return redeemApi.batchRedeem(batchRedeemRequest); + } + + /** + * Get Redeem Status Query the on-chain transaction status of a previously submitted redeem + * request. Weight(IP): 200 Security Type: USER_DATA Response Notes: - Status values: | Value | + * Description | | ----------- | -------------------------------------------- | | + * `PENDING` | Transaction submitted, awaiting confirmation | | `CONFIRMED` + * | Transaction confirmed on-chain | | `FAILED` | Transaction failed | | + * `NOT_FOUND` | Transaction hash not found | + * + * @param walletAddress User's prediction wallet address (required) + * @param txHash Redeem transaction hash (required) + * @param recvWindow Request validity window in milliseconds (optional) + * @return ApiResponse<GetRedeemStatusResponse> + * @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 Redeem Status -
+ * + * @see Get + * Redeem Status Documentation + */ + public ApiResponse getRedeemStatus( + String walletAddress, String txHash, Long recvWindow) throws ApiException { + return redeemApi.getRedeemStatus(walletAddress, txHash, recvWindow); + } + + /** + * Batch Cancel Orders Cancel one or more active prediction orders in a single request. Requires + * SAS authorization. **Known Issue — Bracket Encoding Incompatibility:** This endpoint uses + * indexed bracket notation (`cancelInfoList[0].orderId`). Binance SAPI signature + * verification runs over the **raw, unencoded** canonical string. However, mainstream HTTP + * libraries (Python `requests`, Java `HttpURLConnection`/`URI`, + * Go `net/url`, Node.js `url`) automatically percent-encode `[` → + * `%5B` and `]` → `%5D`, producing a signature mismatch with + * error `-1022 Signature for this request is not valid`. Postman is unaffected + * because it does not encode keys. **Workarounds** (use low-level HTTP APIs that do not + * normalize URLs): - **Python:** use `http.client` (stdlib) and hand-build the body + * string. - **Java:** use `HttpURLConnection` and write the raw body bytes directly. + * - **Go:** use `strings.NewReader` with a hand-built body instead of + * `url.Values.Encode()`. Weight(IP): 200 Security Type: TRADE Notes: - Use dot + * notation for nested list fields: `cancelInfoList[0].orderId`, + * `cancelInfoList[1].orderId`, etc. - `vendor` does not need to be + * supplied. The server automatically sets the correct vendor (`predict_fun`) for + * every item in the batch. + * + * @param batchCancelOrdersRequest (required) + * @return ApiResponse<BatchCancelOrdersResponse> + * @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 Batch Cancel Orders -
+ * + * @see Batch + * Cancel Orders Documentation + */ + public ApiResponse batchCancelOrders( + BatchCancelOrdersRequest batchCancelOrdersRequest) throws ApiException { + return tradeApi.batchCancelOrders(batchCancelOrdersRequest); + } + + /** + * Get Quote Get a price quote for a prediction order. The returned `quoteId` must be + * used in the subsequent Place Order request. Weight(IP): 200 Security Type: TRADE Response + * Notes: - `feeAmount` is a string because it is denominated in wei (18 decimals) and + * may exceed JavaScript's safe integer range. `feeDiscountBps` is also a string + * to allow fractional basis-point values in the future. `feeRateBps` and + * `slippageBps` are integers and will never exceed safe integer bounds. - **MARKET + * order minimum amount:** For `MARKET` orders, `amountIn` must be at least + * approximately **1.5 USDT** (in wei: `1500000000000000000`). The exact minimum + * varies by market liquidity. If the amount is too small, the server returns `-9000 Your + * order amount is too small`. This limit does **not** apply to `LIMIT` orders. + * + * @param getQuoteRequest (required) + * @return ApiResponse<GetQuoteResponse> + * @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 Quote -
+ * + * @see Get + * Quote Documentation + */ + public ApiResponse getQuote(GetQuoteRequest getQuoteRequest) + throws ApiException { + return tradeApi.getQuote(getQuoteRequest); + } + + /** + * Place Order Place a prediction order using a previously obtained quote. Requires SAS + * authorization. Weight(IP): 200 Security Type: TRADE Notes: - Validation rules: | orderType | + * timeInForce | priceLimit | | --------- | ------------- | --------------------- | | + * `MARKET` | Must be `FOK` | Not required | | `LIMIT` | Must be + * `GTC` | Required, must be > 0 | + * + * @param placeOrderRequest (required) + * @return ApiResponse<PlaceOrderResponse> + * @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 Place Order -
+ * + * @see Place + * Order Documentation + */ + public ApiResponse placeOrder(PlaceOrderRequest placeOrderRequest) + throws ApiException { + return tradeApi.placeOrder(placeOrderRequest); + } + + /** + * Query Active Orders Get active (open) prediction orders for the authenticated user. + * Weight(IP): 200 Security Type: USER_DATA + * + * @param walletAddress User's prediction wallet address (required) + * @param tradeSide Filter by trade side. Enum: `BUY`, `SELL` (optional) + * @param l1Category Filter by level-1 category (optional) + * @param marketId Filter by market ID (optional) + * @param offset Pagination offset. Default `0` (optional) + * @param limit Page size. Default `20`, range 1–100 (optional) + * @param recvWindow Request validity window in milliseconds (optional) + * @return ApiResponse<QueryActiveOrdersResponse> + * @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 Query Active Orders -
+ * + * @see Query + * Active Orders Documentation + */ + public ApiResponse queryActiveOrders( + String walletAddress, + TradeSide tradeSide, + String l1Category, + Long marketId, + Integer offset, + Integer limit, + Long recvWindow) + throws ApiException { + return tradeApi.queryActiveOrders( + walletAddress, tradeSide, l1Category, marketId, offset, limit, recvWindow); + } + + /** + * Query Order History Get historical prediction orders (all statuses) for the authenticated + * user, with optional filters. Weight(IP): 200 Security Type: USER_DATA + * + * @param walletAddress User's prediction wallet address (required) + * @param l1Category Filter by level-1 category (optional) + * @param orderType Filter by order type. Enum: `MARKET`, `LIMIT` (optional) + * @param status Filter by order status (optional) + * @param startDate Start date. Format: `yyyy-MM-dd`. Must be ≤ `endDate` + * (optional) + * @param endDate End date. Format: `yyyy-MM-dd`. Must be ≥ `startDate` + * (optional) + * @param offset Pagination offset. Default `0` (optional) + * @param limit Page size. Default `20`, range 1–100 (optional) + * @param recvWindow Request validity window in milliseconds (optional) + * @return ApiResponse<QueryOrderHistoryResponse> + * @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 Query Order History -
+ * + * @see Query + * Order History Documentation + */ + public ApiResponse queryOrderHistory( + String walletAddress, + String l1Category, + OrderType orderType, + String status, + String startDate, + String endDate, + Integer offset, + Integer limit, + Long recvWindow) + throws ApiException { + return tradeApi.queryOrderHistory( + walletAddress, + l1Category, + orderType, + status, + startDate, + endDate, + offset, + limit, + recvWindow); + } + + /** + * Create Inbound Transfer Transfer funds from the prediction wallet back to the user's CEX + * account (SPOT or FUNDING). Requires SAS authorization. ⚠️ **SAS Authorization Required:** + * This endpoint enforces SAS (Self-Authorization Service) authorization. If SAS is not enabled + * for the wallet, the request will be rejected with `-31003 SAS authorization + * required`. Enable SAS for your wallet before calling this endpoint. Weight(IP): 200 + * Security Type: TRADE + * + * @param createInboundTransferRequest (required) + * @return ApiResponse<CreateInboundTransferResponse> + * @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 Create Inbound Transfer -
+ * + * @see Create + * Inbound Transfer Documentation + */ + public ApiResponse createInboundTransfer( + CreateInboundTransferRequest createInboundTransferRequest) throws ApiException { + return transferApi.createInboundTransfer(createInboundTransferRequest); + } + + /** + * Create Outbound Transfer Transfer funds from the user's CEX account (SPOT or FUNDING) + * into the prediction wallet. Requires SAS authorization. Weight(IP): 200 Security Type: TRADE + * + * @param createOutboundTransferRequest (required) + * @return ApiResponse<CreateOutboundTransferResponse> + * @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 Create Outbound Transfer -
+ * + * @see Create + * Outbound Transfer Documentation + */ + public ApiResponse createOutboundTransfer( + CreateOutboundTransferRequest createOutboundTransferRequest) throws ApiException { + return transferApi.createOutboundTransfer(createOutboundTransferRequest); + } + + /** + * Query Transfer List Get the authenticated user's prediction wallet transfer history + * within a date range. Weight(IP): 200 Security Type: USER_DATA + * + * @param walletAddress User's prediction wallet address (required) + * @param startDate Start date. Format: `yyyy-MM-dd`. Must be ≤ `endDate` + * (required) + * @param endDate End date. Format: `yyyy-MM-dd`. Must be ≥ `startDate` + * (required) + * @param tokenSymbol Filter by token symbol (e.g. `USDT`) (optional) + * @param direction Filter by direction. Enum: `INBOUND`, `OUTBOUND` + * (optional) + * @param offset Pagination offset. Default `0` (optional) + * @param limit Page size. Default `20`, range 1–100 (optional) + * @param recvWindow Request validity window in milliseconds (optional) + * @return ApiResponse<QueryTransferListResponse> + * @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 Query Transfer List -
+ * + * @see Query + * Transfer List Documentation + */ + public ApiResponse queryTransferList( + String walletAddress, + String startDate, + String endDate, + String tokenSymbol, + Direction direction, + Integer offset, + Integer limit, + Long recvWindow) + throws ApiException { + return transferApi.queryTransferList( + walletAddress, + startDate, + endDate, + tokenSymbol, + direction, + offset, + limit, + recvWindow); + } + + /** + * Query Transfer Status Query the current status of a prediction wallet transfer by transfer + * ID. **`status` values:** Terminal states are `COMPLETED` and + * `FAILED`. Intermediate states are `PROCESSING` and `PENDING`. + * **Do not** poll for `SUCCESS` — it is not a valid terminal state. Weight(IP): 200 + * Security Type: USER_DATA + * + * @param transferId Transfer ID returned from outbound/inbound transfer (required) + * @param recvWindow Request validity window in milliseconds (optional) + * @return ApiResponse<QueryTransferStatusResponse> + * @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 Query Transfer Status -
+ * + * @see Query + * Transfer Status Documentation + */ + public ApiResponse queryTransferStatus( + String transferId, Long recvWindow) throws ApiException { + return transferApi.queryTransferStatus(transferId, recvWindow); + } + + /** + * Get Portfolio Get the authenticated user's prediction portfolio overview including active + * positions count, aggregated PnL, and full position list. Weight(IP): 200 Security Type: + * USER_DATA + * + * @param walletAddress User's prediction wallet address (required) + * @param tokenId Filter by prediction token ID (optional) + * @param marketId Filter by market ID. Must be > 0 (optional) + * @param marketTopicId Filter by market topic ID. Must be > 0 (optional) + * @param activeOnly If `true`, return only active (unresolved) positions (optional) + * @param recvWindow Request validity window in milliseconds (optional) + * @return ApiResponse<GetPortfolioResponse> + * @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 Portfolio -
+ * + * @see Get + * Portfolio Documentation + */ + public ApiResponse getPortfolio( + String walletAddress, + String tokenId, + Long marketId, + Long marketTopicId, + Boolean activeOnly, + Long recvWindow) + throws ApiException { + return walletApi.getPortfolio( + walletAddress, tokenId, marketId, marketTopicId, activeOnly, recvWindow); + } + + /** + * Get Quota Status Query the current user's daily trading quota limit and remaining + * allowance for prediction markets. Weight(IP): 200 Security Type: USER_DATA + * + * @param recvWindow Request validity window in milliseconds (optional) + * @return ApiResponse<GetQuotaStatusResponse> + * @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 Quota Status -
+ * + * @see Get + * Quota Status Documentation + */ + public ApiResponse getQuotaStatus(Long recvWindow) throws ApiException { + return walletApi.getQuotaStatus(recvWindow); + } + + /** + * List Prediction Wallets Get all prediction wallets registered for the authenticated user. + * Weight(IP): 200 Security Type: USER_DATA + * + * @param recvWindow Request validity window in milliseconds (optional) + * @return ApiResponse<ListPredictionWalletsResponse> + * @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 List Prediction Wallets -
+ * + * @see List + * Prediction Wallets Documentation + */ + public ApiResponse listPredictionWallets(Long recvWindow) + throws ApiException { + return walletApi.listPredictionWallets(recvWindow); + } + + /** + * Query Payment Option Balances Get available balances for each payment option that can be used + * for prediction trading. Weight(IP): 200 Security Type: USER_DATA + * + * @param recvWindow Request validity window in milliseconds (optional) + * @return ApiResponse<QueryPaymentOptionBalancesResponse> + * @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 Query Payment Option Balances -
+ * + * @see Query + * Payment Option Balances Documentation + */ + public ApiResponse queryPaymentOptionBalances( + Long recvWindow) throws ApiException { + return walletApi.queryPaymentOptionBalances(recvWindow); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/api/WalletApi.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/api/WalletApi.java new file mode 100644 index 000000000..796f54aed --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/api/WalletApi.java @@ -0,0 +1,685 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.api; + +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.binance.connector.client.w3w_prediction.rest.model.GetPortfolioResponse; +import com.binance.connector.client.w3w_prediction.rest.model.GetQuotaStatusResponse; +import com.binance.connector.client.w3w_prediction.rest.model.ListPredictionWalletsResponse; +import com.binance.connector.client.w3w_prediction.rest.model.QueryPaymentOptionBalancesResponse; +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 WalletApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + private static final String USER_AGENT = + String.format( + "binance-w3w-prediction/1.0.0 (Java/%s; %s; %s)", + SystemUtil.getJavaVersion(), SystemUtil.getOs(), SystemUtil.getArch()); + private static final boolean HAS_TIME_UNIT = false; + + public WalletApi(ClientConfiguration clientConfiguration) { + this(new ApiClient(clientConfiguration)); + } + + public WalletApi(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 getPortfolio + * + * @param walletAddress User's prediction wallet address (required) + * @param tokenId Filter by prediction token ID (optional) + * @param marketId Filter by market ID. Must be > 0 (optional) + * @param marketTopicId Filter by market topic ID. Must be > 0 (optional) + * @param activeOnly If `true`, return only active (unresolved) positions (optional) + * @param recvWindow Request validity window in 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 Get Portfolio -
+ * + * @see Get + * Portfolio Documentation + */ + private okhttp3.Call getPortfolioCall( + String walletAddress, + String tokenId, + Long marketId, + Long marketTopicId, + Boolean activeOnly, + Long recvWindow) + 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 = "/sapi/v1/w3w/wallet/prediction/pnl/portfolio"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (walletAddress != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("walletAddress", walletAddress)); + } + + if (tokenId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("tokenId", tokenId)); + } + + if (marketId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("marketId", marketId)); + } + + if (marketTopicId != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("marketTopicId", marketTopicId)); + } + + if (activeOnly != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("activeOnly", activeOnly)); + } + + if (recvWindow != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("recvWindow", recvWindow)); + } + + 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<>(); + localVarAuthNames.add("binanceSignature"); + 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 getPortfolioValidateBeforeCall( + String walletAddress, + String tokenId, + Long marketId, + Long marketTopicId, + Boolean activeOnly, + Long recvWindow) + throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + ExecutableValidator executableValidator = validator.forExecutables(); + + Object[] parameterValues = { + walletAddress, tokenId, marketId, marketTopicId, activeOnly, recvWindow + }; + Method method = + this.getClass() + .getMethod( + "getPortfolio", + String.class, + String.class, + Long.class, + Long.class, + Boolean.class, + Long.class); + Set> violations = + executableValidator.validateParameters(this, method, parameterValues); + + if (violations.size() == 0) { + return getPortfolioCall( + walletAddress, tokenId, marketId, marketTopicId, activeOnly, recvWindow); + } 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 Portfolio Get the authenticated user's prediction portfolio overview including active + * positions count, aggregated PnL, and full position list. Weight(IP): 200 Security Type: + * USER_DATA + * + * @param walletAddress User's prediction wallet address (required) + * @param tokenId Filter by prediction token ID (optional) + * @param marketId Filter by market ID. Must be > 0 (optional) + * @param marketTopicId Filter by market topic ID. Must be > 0 (optional) + * @param activeOnly If `true`, return only active (unresolved) positions (optional) + * @param recvWindow Request validity window in milliseconds (optional) + * @return ApiResponse<GetPortfolioResponse> + * @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 Portfolio -
+ * + * @see Get + * Portfolio Documentation + */ + public ApiResponse getPortfolio( + @NotNull String walletAddress, + String tokenId, + @Min(1L) Long marketId, + @Min(1L) Long marketTopicId, + Boolean activeOnly, + @Max(60000L) Long recvWindow) + throws ApiException { + okhttp3.Call localVarCall = + getPortfolioValidateBeforeCall( + walletAddress, tokenId, marketId, marketTopicId, activeOnly, recvWindow); + java.lang.reflect.Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Build call for getQuotaStatus + * + * @param recvWindow Request validity window in 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 Get Quota Status -
+ * + * @see Get + * Quota Status Documentation + */ + private okhttp3.Call getQuotaStatusCall(Long recvWindow) 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 = "/sapi/v1/w3w/wallet/prediction/quota/limit/status"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (recvWindow != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("recvWindow", recvWindow)); + } + + 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<>(); + localVarAuthNames.add("binanceSignature"); + 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 getQuotaStatusValidateBeforeCall(Long recvWindow) throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + ExecutableValidator executableValidator = validator.forExecutables(); + + Object[] parameterValues = {recvWindow}; + Method method = this.getClass().getMethod("getQuotaStatus", Long.class); + Set> violations = + executableValidator.validateParameters(this, method, parameterValues); + + if (violations.size() == 0) { + return getQuotaStatusCall(recvWindow); + } 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 Quota Status Query the current user's daily trading quota limit and remaining + * allowance for prediction markets. Weight(IP): 200 Security Type: USER_DATA + * + * @param recvWindow Request validity window in milliseconds (optional) + * @return ApiResponse<GetQuotaStatusResponse> + * @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 Quota Status -
+ * + * @see Get + * Quota Status Documentation + */ + public ApiResponse getQuotaStatus(@Max(60000L) Long recvWindow) + throws ApiException { + okhttp3.Call localVarCall = getQuotaStatusValidateBeforeCall(recvWindow); + java.lang.reflect.Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Build call for listPredictionWallets + * + * @param recvWindow Request validity window in 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 List Prediction Wallets -
+ * + * @see List + * Prediction Wallets Documentation + */ + private okhttp3.Call listPredictionWalletsCall(Long recvWindow) 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 = "/sapi/v1/w3w/wallet/prediction/wallet/list"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (recvWindow != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("recvWindow", recvWindow)); + } + + 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<>(); + localVarAuthNames.add("binanceSignature"); + 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 listPredictionWalletsValidateBeforeCall(Long recvWindow) + throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + ExecutableValidator executableValidator = validator.forExecutables(); + + Object[] parameterValues = {recvWindow}; + Method method = this.getClass().getMethod("listPredictionWallets", Long.class); + Set> violations = + executableValidator.validateParameters(this, method, parameterValues); + + if (violations.size() == 0) { + return listPredictionWalletsCall(recvWindow); + } 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()); + } + } + + /** + * List Prediction Wallets Get all prediction wallets registered for the authenticated user. + * Weight(IP): 200 Security Type: USER_DATA + * + * @param recvWindow Request validity window in milliseconds (optional) + * @return ApiResponse<ListPredictionWalletsResponse> + * @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 List Prediction Wallets -
+ * + * @see List + * Prediction Wallets Documentation + */ + public ApiResponse listPredictionWallets( + @Max(60000L) Long recvWindow) throws ApiException { + okhttp3.Call localVarCall = listPredictionWalletsValidateBeforeCall(recvWindow); + java.lang.reflect.Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Build call for queryPaymentOptionBalances + * + * @param recvWindow Request validity window in 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 Query Payment Option Balances -
+ * + * @see Query + * Payment Option Balances Documentation + */ + private okhttp3.Call queryPaymentOptionBalancesCall(Long recvWindow) 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 = "/sapi/v1/w3w/wallet/prediction/balance/payment-options"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (recvWindow != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("recvWindow", recvWindow)); + } + + 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<>(); + localVarAuthNames.add("binanceSignature"); + 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 queryPaymentOptionBalancesValidateBeforeCall(Long recvWindow) + throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + ExecutableValidator executableValidator = validator.forExecutables(); + + Object[] parameterValues = {recvWindow}; + Method method = this.getClass().getMethod("queryPaymentOptionBalances", Long.class); + Set> violations = + executableValidator.validateParameters(this, method, parameterValues); + + if (violations.size() == 0) { + return queryPaymentOptionBalancesCall(recvWindow); + } 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()); + } + } + + /** + * Query Payment Option Balances Get available balances for each payment option that can be used + * for prediction trading. Weight(IP): 200 Security Type: USER_DATA + * + * @param recvWindow Request validity window in milliseconds (optional) + * @return ApiResponse<QueryPaymentOptionBalancesResponse> + * @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 Query Payment Option Balances -
+ * + * @see Query + * Payment Option Balances Documentation + */ + public ApiResponse queryPaymentOptionBalances( + @Max(60000L) Long recvWindow) throws ApiException { + okhttp3.Call localVarCall = queryPaymentOptionBalancesValidateBeforeCall(recvWindow); + java.lang.reflect.Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/AccountType.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/AccountType.java new file mode 100644 index 000000000..fd1ca0031 --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/AccountType.java @@ -0,0 +1,73 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.model; + +import com.google.gson.JsonElement; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import org.hibernate.validator.constraints.*; + +/** Source CEX account. Enum: `SPOT`, `FUNDING` */ +@JsonAdapter(AccountType.Adapter.class) +public enum AccountType { + SPOT("SPOT"), + + FUNDING("FUNDING"); + + private String value; + + AccountType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static AccountType fromValue(String value) { + for (AccountType b : AccountType.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final AccountType enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public AccountType read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return AccountType.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + AccountType.fromValue(value); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/BatchCancelOrdersRequest.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/BatchCancelOrdersRequest.java new file mode 100644 index 000000000..869a7c804 --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/BatchCancelOrdersRequest.java @@ -0,0 +1,299 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.model; + +import com.binance.connector.client.w3w_prediction.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.*; + +/** BatchCancelOrdersRequest */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class BatchCancelOrdersRequest { + public static final String SERIALIZED_NAME_WALLET_ADDRESS = "walletAddress"; + + @SerializedName(SERIALIZED_NAME_WALLET_ADDRESS) + @jakarta.annotation.Nonnull + private String walletAddress; + + public static final String SERIALIZED_NAME_WALLET_ID = "walletId"; + + @SerializedName(SERIALIZED_NAME_WALLET_ID) + @jakarta.annotation.Nonnull + private String walletId; + + public static final String SERIALIZED_NAME_CANCEL_INFO_LIST = "cancelInfoList"; + + @SerializedName(SERIALIZED_NAME_CANCEL_INFO_LIST) + @jakarta.annotation.Nullable + private CancelInfoList cancelInfoList; + + public BatchCancelOrdersRequest() {} + + public BatchCancelOrdersRequest walletAddress( + @jakarta.annotation.Nonnull String walletAddress) { + this.walletAddress = walletAddress; + return this; + } + + /** + * User's prediction wallet address + * + * @return walletAddress + */ + @jakarta.annotation.Nonnull + @NotNull + public String getWalletAddress() { + return walletAddress; + } + + public void setWalletAddress(@jakarta.annotation.Nonnull String walletAddress) { + this.walletAddress = walletAddress; + } + + public BatchCancelOrdersRequest walletId(@jakarta.annotation.Nonnull String walletId) { + this.walletId = walletId; + return this; + } + + /** + * Wallet ID + * + * @return walletId + */ + @jakarta.annotation.Nonnull + @NotNull + public String getWalletId() { + return walletId; + } + + public void setWalletId(@jakarta.annotation.Nonnull String walletId) { + this.walletId = walletId; + } + + public BatchCancelOrdersRequest cancelInfoList( + @jakarta.annotation.Nullable CancelInfoList cancelInfoList) { + this.cancelInfoList = cancelInfoList; + return this; + } + + /** + * Get cancelInfoList + * + * @return cancelInfoList + */ + @jakarta.annotation.Nullable + @Valid + public CancelInfoList getCancelInfoList() { + return cancelInfoList; + } + + public void setCancelInfoList(@jakarta.annotation.Nullable CancelInfoList cancelInfoList) { + this.cancelInfoList = cancelInfoList; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BatchCancelOrdersRequest batchCancelOrdersRequest = (BatchCancelOrdersRequest) o; + return Objects.equals(this.walletAddress, batchCancelOrdersRequest.walletAddress) + && Objects.equals(this.walletId, batchCancelOrdersRequest.walletId) + && Objects.equals(this.cancelInfoList, batchCancelOrdersRequest.cancelInfoList); + } + + @Override + public int hashCode() { + return Objects.hash(walletAddress, walletId, cancelInfoList); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BatchCancelOrdersRequest {\n"); + sb.append(" walletAddress: ").append(toIndentedString(walletAddress)).append("\n"); + sb.append(" walletId: ").append(toIndentedString(walletId)).append("\n"); + sb.append(" cancelInfoList: ").append(toIndentedString(cancelInfoList)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object walletAddressValue = getWalletAddress(); + String walletAddressValueAsString = ""; + walletAddressValueAsString = walletAddressValue.toString(); + sb.append("walletAddress=").append(urlEncode(walletAddressValueAsString)).append(""); + Object walletIdValue = getWalletId(); + String walletIdValueAsString = ""; + walletIdValueAsString = walletIdValue.toString(); + sb.append("walletId=").append(urlEncode(walletIdValueAsString)).append(""); + Object cancelInfoListValue = getCancelInfoList(); + String cancelInfoListValueAsString = ""; + cancelInfoListValueAsString = cancelInfoListValue.toString(); + sb.append("cancelInfoList=").append(urlEncode(cancelInfoListValueAsString)).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("walletAddress"); + openapiFields.add("walletId"); + openapiFields.add("cancelInfoList"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("walletAddress"); + openapiRequiredFields.add("walletId"); + } + + /** + * 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 BatchCancelOrdersRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BatchCancelOrdersRequest.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in BatchCancelOrdersRequest is not found" + + " in the empty JSON string", + BatchCancelOrdersRequest.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BatchCancelOrdersRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("walletAddress").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `walletAddress` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("walletAddress").toString())); + } + if (!jsonObj.get("walletId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `walletId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("walletId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BatchCancelOrdersRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BatchCancelOrdersRequest' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(BatchCancelOrdersRequest.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, BatchCancelOrdersRequest value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BatchCancelOrdersRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of BatchCancelOrdersRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of BatchCancelOrdersRequest + * @throws IOException if the JSON string is invalid with respect to BatchCancelOrdersRequest + */ + public static BatchCancelOrdersRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BatchCancelOrdersRequest.class); + } + + /** + * Convert an instance of BatchCancelOrdersRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/BatchCancelOrdersResponse.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/BatchCancelOrdersResponse.java new file mode 100644 index 000000000..44803caef --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/BatchCancelOrdersResponse.java @@ -0,0 +1,297 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.model; + +import com.binance.connector.client.w3w_prediction.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.*; + +/** BatchCancelOrdersResponse */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class BatchCancelOrdersResponse { + public static final String SERIALIZED_NAME_CANCELED = "canceled"; + + @SerializedName(SERIALIZED_NAME_CANCELED) + @jakarta.annotation.Nullable + private List canceled; + + public static final String SERIALIZED_NAME_FAILED = "failed"; + + @SerializedName(SERIALIZED_NAME_FAILED) + @jakarta.annotation.Nullable + private List<@Valid BatchCancelOrdersResponseFailedInner> failed; + + public BatchCancelOrdersResponse() {} + + public BatchCancelOrdersResponse canceled(@jakarta.annotation.Nullable List canceled) { + this.canceled = canceled; + return this; + } + + public BatchCancelOrdersResponse addCanceledItem(String canceledItem) { + if (this.canceled == null) { + this.canceled = new ArrayList<>(); + } + this.canceled.add(canceledItem); + return this; + } + + /** + * Get canceled + * + * @return canceled + */ + @jakarta.annotation.Nullable + public List getCanceled() { + return canceled; + } + + public void setCanceled(@jakarta.annotation.Nullable List canceled) { + this.canceled = canceled; + } + + public BatchCancelOrdersResponse failed( + @jakarta.annotation.Nullable List<@Valid BatchCancelOrdersResponseFailedInner> failed) { + this.failed = failed; + return this; + } + + public BatchCancelOrdersResponse addFailedItem( + BatchCancelOrdersResponseFailedInner failedItem) { + if (this.failed == null) { + this.failed = new ArrayList<>(); + } + this.failed.add(failedItem); + return this; + } + + /** + * Get failed + * + * @return failed + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid BatchCancelOrdersResponseFailedInner> getFailed() { + return failed; + } + + public void setFailed( + @jakarta.annotation.Nullable List<@Valid BatchCancelOrdersResponseFailedInner> failed) { + this.failed = failed; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BatchCancelOrdersResponse batchCancelOrdersResponse = (BatchCancelOrdersResponse) o; + return Objects.equals(this.canceled, batchCancelOrdersResponse.canceled) + && Objects.equals(this.failed, batchCancelOrdersResponse.failed); + } + + @Override + public int hashCode() { + return Objects.hash(canceled, failed); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BatchCancelOrdersResponse {\n"); + sb.append(" canceled: ").append(toIndentedString(canceled)).append("\n"); + sb.append(" failed: ").append(toIndentedString(failed)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object canceledValue = getCanceled(); + String canceledValueAsString = ""; + canceledValueAsString = + (String) + ((Collection) canceledValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("canceled=").append(urlEncode(canceledValueAsString)).append(""); + Object failedValue = getFailed(); + String failedValueAsString = ""; + failedValueAsString = + (String) + ((Collection) failedValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("failed=").append(urlEncode(failedValueAsString)).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("canceled"); + openapiFields.add("failed"); + + // 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 BatchCancelOrdersResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BatchCancelOrdersResponse.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in BatchCancelOrdersResponse is not found" + + " in the empty JSON string", + BatchCancelOrdersResponse.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the optional json data is an array if present + if (jsonObj.get("canceled") != null + && !jsonObj.get("canceled").isJsonNull() + && !jsonObj.get("canceled").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `canceled` to be an array in the JSON string but" + + " got `%s`", + jsonObj.get("canceled").toString())); + } + if (jsonObj.get("failed") != null && !jsonObj.get("failed").isJsonNull()) { + JsonArray jsonArrayfailed = jsonObj.getAsJsonArray("failed"); + if (jsonArrayfailed != null) { + // ensure the json data is an array + if (!jsonObj.get("failed").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `failed` to be an array in the JSON string" + + " but got `%s`", + jsonObj.get("failed").toString())); + } + + // validate the optional field `failed` (array) + for (int i = 0; i < jsonArrayfailed.size(); i++) { + BatchCancelOrdersResponseFailedInner.validateJsonElement( + jsonArrayfailed.get(i)); + } + ; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BatchCancelOrdersResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BatchCancelOrdersResponse' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(BatchCancelOrdersResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, BatchCancelOrdersResponse value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BatchCancelOrdersResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of BatchCancelOrdersResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of BatchCancelOrdersResponse + * @throws IOException if the JSON string is invalid with respect to BatchCancelOrdersResponse + */ + public static BatchCancelOrdersResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BatchCancelOrdersResponse.class); + } + + /** + * Convert an instance of BatchCancelOrdersResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/BatchCancelOrdersResponseFailedInner.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/BatchCancelOrdersResponseFailedInner.java new file mode 100644 index 000000000..89eaa0798 --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/BatchCancelOrdersResponseFailedInner.java @@ -0,0 +1,260 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.model; + +import com.binance.connector.client.w3w_prediction.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.*; + +/** BatchCancelOrdersResponseFailedInner */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class BatchCancelOrdersResponseFailedInner { + public static final String SERIALIZED_NAME_ORDER_ID = "orderId"; + + @SerializedName(SERIALIZED_NAME_ORDER_ID) + @jakarta.annotation.Nullable + private String orderId; + + public static final String SERIALIZED_NAME_REASON = "reason"; + + @SerializedName(SERIALIZED_NAME_REASON) + @jakarta.annotation.Nullable + private String reason; + + public BatchCancelOrdersResponseFailedInner() {} + + public BatchCancelOrdersResponseFailedInner orderId( + @jakarta.annotation.Nullable String orderId) { + this.orderId = orderId; + return this; + } + + /** + * Get orderId + * + * @return orderId + */ + @jakarta.annotation.Nullable + public String getOrderId() { + return orderId; + } + + public void setOrderId(@jakarta.annotation.Nullable String orderId) { + this.orderId = orderId; + } + + public BatchCancelOrdersResponseFailedInner reason(@jakarta.annotation.Nullable String reason) { + this.reason = reason; + return this; + } + + /** + * Get reason + * + * @return reason + */ + @jakarta.annotation.Nullable + public String getReason() { + return reason; + } + + public void setReason(@jakarta.annotation.Nullable String reason) { + this.reason = reason; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BatchCancelOrdersResponseFailedInner batchCancelOrdersResponseFailedInner = + (BatchCancelOrdersResponseFailedInner) o; + return Objects.equals(this.orderId, batchCancelOrdersResponseFailedInner.orderId) + && Objects.equals(this.reason, batchCancelOrdersResponseFailedInner.reason); + } + + @Override + public int hashCode() { + return Objects.hash(orderId, reason); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BatchCancelOrdersResponseFailedInner {\n"); + sb.append(" orderId: ").append(toIndentedString(orderId)).append("\n"); + sb.append(" reason: ").append(toIndentedString(reason)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object orderIdValue = getOrderId(); + String orderIdValueAsString = ""; + orderIdValueAsString = orderIdValue.toString(); + sb.append("orderId=").append(urlEncode(orderIdValueAsString)).append(""); + Object reasonValue = getReason(); + String reasonValueAsString = ""; + reasonValueAsString = reasonValue.toString(); + sb.append("reason=").append(urlEncode(reasonValueAsString)).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("orderId"); + openapiFields.add("reason"); + + // 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 + * BatchCancelOrdersResponseFailedInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BatchCancelOrdersResponseFailedInner.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in BatchCancelOrdersResponseFailedInner" + + " is not found in the empty JSON string", + BatchCancelOrdersResponseFailedInner.openapiRequiredFields + .toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("orderId") != null && !jsonObj.get("orderId").isJsonNull()) + && !jsonObj.get("orderId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `orderId` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("orderId").toString())); + } + if ((jsonObj.get("reason") != null && !jsonObj.get("reason").isJsonNull()) + && !jsonObj.get("reason").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `reason` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("reason").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BatchCancelOrdersResponseFailedInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BatchCancelOrdersResponseFailedInner' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(BatchCancelOrdersResponseFailedInner.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, BatchCancelOrdersResponseFailedInner value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BatchCancelOrdersResponseFailedInner read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of BatchCancelOrdersResponseFailedInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of BatchCancelOrdersResponseFailedInner + * @throws IOException if the JSON string is invalid with respect to + * BatchCancelOrdersResponseFailedInner + */ + public static BatchCancelOrdersResponseFailedInner fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, BatchCancelOrdersResponseFailedInner.class); + } + + /** + * Convert an instance of BatchCancelOrdersResponseFailedInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/BatchRedeemRequest.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/BatchRedeemRequest.java new file mode 100644 index 000000000..34615cc9d --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/BatchRedeemRequest.java @@ -0,0 +1,338 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.model; + +import com.binance.connector.client.w3w_prediction.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.*; + +/** BatchRedeemRequest */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class BatchRedeemRequest { + public static final String SERIALIZED_NAME_WALLET_ADDRESS = "walletAddress"; + + @SerializedName(SERIALIZED_NAME_WALLET_ADDRESS) + @jakarta.annotation.Nonnull + private String walletAddress; + + public static final String SERIALIZED_NAME_WALLET_ID = "walletId"; + + @SerializedName(SERIALIZED_NAME_WALLET_ID) + @jakarta.annotation.Nonnull + private String walletId; + + public static final String SERIALIZED_NAME_TOKEN_IDS = "tokenIds"; + + @SerializedName(SERIALIZED_NAME_TOKEN_IDS) + @jakarta.annotation.Nonnull + private TokenIds tokenIds; + + public static final String SERIALIZED_NAME_CHAIN_ID = "chainId"; + + @SerializedName(SERIALIZED_NAME_CHAIN_ID) + @jakarta.annotation.Nullable + private String chainId = "56"; + + public BatchRedeemRequest() {} + + public BatchRedeemRequest walletAddress(@jakarta.annotation.Nonnull String walletAddress) { + this.walletAddress = walletAddress; + return this; + } + + /** + * User's prediction wallet address + * + * @return walletAddress + */ + @jakarta.annotation.Nonnull + @NotNull + public String getWalletAddress() { + return walletAddress; + } + + public void setWalletAddress(@jakarta.annotation.Nonnull String walletAddress) { + this.walletAddress = walletAddress; + } + + public BatchRedeemRequest walletId(@jakarta.annotation.Nonnull String walletId) { + this.walletId = walletId; + return this; + } + + /** + * Wallet ID + * + * @return walletId + */ + @jakarta.annotation.Nonnull + @NotNull + public String getWalletId() { + return walletId; + } + + public void setWalletId(@jakarta.annotation.Nonnull String walletId) { + this.walletId = walletId; + } + + public BatchRedeemRequest tokenIds(@jakarta.annotation.Nonnull TokenIds tokenIds) { + this.tokenIds = tokenIds; + return this; + } + + /** + * Get tokenIds + * + * @return tokenIds + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public TokenIds getTokenIds() { + return tokenIds; + } + + public void setTokenIds(@jakarta.annotation.Nonnull TokenIds tokenIds) { + this.tokenIds = tokenIds; + } + + public BatchRedeemRequest chainId(@jakarta.annotation.Nullable String chainId) { + this.chainId = chainId; + return this; + } + + /** + * Chain ID. Default `56` (BSC) + * + * @return chainId + */ + @jakarta.annotation.Nullable + public String getChainId() { + return chainId; + } + + public void setChainId(@jakarta.annotation.Nullable String chainId) { + this.chainId = chainId; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BatchRedeemRequest batchRedeemRequest = (BatchRedeemRequest) o; + return Objects.equals(this.walletAddress, batchRedeemRequest.walletAddress) + && Objects.equals(this.walletId, batchRedeemRequest.walletId) + && Objects.equals(this.tokenIds, batchRedeemRequest.tokenIds) + && Objects.equals(this.chainId, batchRedeemRequest.chainId); + } + + @Override + public int hashCode() { + return Objects.hash(walletAddress, walletId, tokenIds, chainId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BatchRedeemRequest {\n"); + sb.append(" walletAddress: ").append(toIndentedString(walletAddress)).append("\n"); + sb.append(" walletId: ").append(toIndentedString(walletId)).append("\n"); + sb.append(" tokenIds: ").append(toIndentedString(tokenIds)).append("\n"); + sb.append(" chainId: ").append(toIndentedString(chainId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object walletAddressValue = getWalletAddress(); + String walletAddressValueAsString = ""; + walletAddressValueAsString = walletAddressValue.toString(); + sb.append("walletAddress=").append(urlEncode(walletAddressValueAsString)).append(""); + Object walletIdValue = getWalletId(); + String walletIdValueAsString = ""; + walletIdValueAsString = walletIdValue.toString(); + sb.append("walletId=").append(urlEncode(walletIdValueAsString)).append(""); + Object tokenIdsValue = getTokenIds(); + String tokenIdsValueAsString = ""; + tokenIdsValueAsString = tokenIdsValue.toString(); + sb.append("tokenIds=").append(urlEncode(tokenIdsValueAsString)).append(""); + Object chainIdValue = getChainId(); + String chainIdValueAsString = ""; + chainIdValueAsString = chainIdValue.toString(); + sb.append("chainId=").append(urlEncode(chainIdValueAsString)).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("walletAddress"); + openapiFields.add("walletId"); + openapiFields.add("tokenIds"); + openapiFields.add("chainId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("walletAddress"); + openapiRequiredFields.add("walletId"); + openapiRequiredFields.add("tokenIds"); + } + + /** + * 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 BatchRedeemRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BatchRedeemRequest.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in BatchRedeemRequest is not found in the" + + " empty JSON string", + BatchRedeemRequest.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BatchRedeemRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("walletAddress").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `walletAddress` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("walletAddress").toString())); + } + if (!jsonObj.get("walletId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `walletId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("walletId").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())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BatchRedeemRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BatchRedeemRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(BatchRedeemRequest.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, BatchRedeemRequest value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BatchRedeemRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of BatchRedeemRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of BatchRedeemRequest + * @throws IOException if the JSON string is invalid with respect to BatchRedeemRequest + */ + public static BatchRedeemRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BatchRedeemRequest.class); + } + + /** + * Convert an instance of BatchRedeemRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/BatchRedeemResponse.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/BatchRedeemResponse.java new file mode 100644 index 000000000..59a5ae98a --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/BatchRedeemResponse.java @@ -0,0 +1,281 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.model; + +import com.binance.connector.client.w3w_prediction.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.*; + +/** BatchRedeemResponse */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class BatchRedeemResponse { + public static final String SERIALIZED_NAME_BATCH_ID = "batchId"; + + @SerializedName(SERIALIZED_NAME_BATCH_ID) + @jakarta.annotation.Nullable + private String batchId; + + public static final String SERIALIZED_NAME_RESULTS = "results"; + + @SerializedName(SERIALIZED_NAME_RESULTS) + @jakarta.annotation.Nullable + private List<@Valid BatchRedeemResponseResultsInner> results; + + public BatchRedeemResponse() {} + + public BatchRedeemResponse batchId(@jakarta.annotation.Nullable String batchId) { + this.batchId = batchId; + return this; + } + + /** + * Get batchId + * + * @return batchId + */ + @jakarta.annotation.Nullable + public String getBatchId() { + return batchId; + } + + public void setBatchId(@jakarta.annotation.Nullable String batchId) { + this.batchId = batchId; + } + + public BatchRedeemResponse results( + @jakarta.annotation.Nullable List<@Valid BatchRedeemResponseResultsInner> results) { + this.results = results; + return this; + } + + public BatchRedeemResponse addResultsItem(BatchRedeemResponseResultsInner resultsItem) { + if (this.results == null) { + this.results = new ArrayList<>(); + } + this.results.add(resultsItem); + return this; + } + + /** + * Get results + * + * @return results + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid BatchRedeemResponseResultsInner> getResults() { + return results; + } + + public void setResults( + @jakarta.annotation.Nullable List<@Valid BatchRedeemResponseResultsInner> results) { + this.results = results; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BatchRedeemResponse batchRedeemResponse = (BatchRedeemResponse) o; + return Objects.equals(this.batchId, batchRedeemResponse.batchId) + && Objects.equals(this.results, batchRedeemResponse.results); + } + + @Override + public int hashCode() { + return Objects.hash(batchId, results); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BatchRedeemResponse {\n"); + sb.append(" batchId: ").append(toIndentedString(batchId)).append("\n"); + sb.append(" results: ").append(toIndentedString(results)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object batchIdValue = getBatchId(); + String batchIdValueAsString = ""; + batchIdValueAsString = batchIdValue.toString(); + sb.append("batchId=").append(urlEncode(batchIdValueAsString)).append(""); + Object resultsValue = getResults(); + String resultsValueAsString = ""; + resultsValueAsString = + (String) + ((Collection) resultsValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("results=").append(urlEncode(resultsValueAsString)).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("batchId"); + openapiFields.add("results"); + + // 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 BatchRedeemResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BatchRedeemResponse.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in BatchRedeemResponse is not found in" + + " the empty JSON string", + BatchRedeemResponse.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("batchId") != null && !jsonObj.get("batchId").isJsonNull()) + && !jsonObj.get("batchId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `batchId` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("batchId").toString())); + } + if (jsonObj.get("results") != null && !jsonObj.get("results").isJsonNull()) { + JsonArray jsonArrayresults = jsonObj.getAsJsonArray("results"); + if (jsonArrayresults != null) { + // ensure the json data is an array + if (!jsonObj.get("results").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `results` to be an array in the JSON string" + + " but got `%s`", + jsonObj.get("results").toString())); + } + + // validate the optional field `results` (array) + for (int i = 0; i < jsonArrayresults.size(); i++) { + BatchRedeemResponseResultsInner.validateJsonElement(jsonArrayresults.get(i)); + } + ; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BatchRedeemResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BatchRedeemResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(BatchRedeemResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, BatchRedeemResponse value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BatchRedeemResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of BatchRedeemResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of BatchRedeemResponse + * @throws IOException if the JSON string is invalid with respect to BatchRedeemResponse + */ + public static BatchRedeemResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BatchRedeemResponse.class); + } + + /** + * Convert an instance of BatchRedeemResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/BatchRedeemResponseResultsInner.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/BatchRedeemResponseResultsInner.java new file mode 100644 index 000000000..41e8c1b71 --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/BatchRedeemResponseResultsInner.java @@ -0,0 +1,355 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.model; + +import com.binance.connector.client.w3w_prediction.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** BatchRedeemResponseResultsInner */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class BatchRedeemResponseResultsInner { + public static final String SERIALIZED_NAME_REQUEST_ID = "requestId"; + + @SerializedName(SERIALIZED_NAME_REQUEST_ID) + @jakarta.annotation.Nullable + private String requestId; + + public static final String SERIALIZED_NAME_TX_HASH = "txHash"; + + @SerializedName(SERIALIZED_NAME_TX_HASH) + @jakarta.annotation.Nullable + private String txHash; + + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + @jakarta.annotation.Nullable + private String status; + + public static final String SERIALIZED_NAME_ERROR = "error"; + + @SerializedName(SERIALIZED_NAME_ERROR) + @jakarta.annotation.Nullable + private String error; + + public BatchRedeemResponseResultsInner() {} + + public BatchRedeemResponseResultsInner requestId( + @jakarta.annotation.Nullable String requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get requestId + * + * @return requestId + */ + @jakarta.annotation.Nullable + public String getRequestId() { + return requestId; + } + + public void setRequestId(@jakarta.annotation.Nullable String requestId) { + this.requestId = requestId; + } + + public BatchRedeemResponseResultsInner txHash(@jakarta.annotation.Nullable String txHash) { + this.txHash = txHash; + return this; + } + + /** + * Get txHash + * + * @return txHash + */ + @jakarta.annotation.Nullable + public String getTxHash() { + return txHash; + } + + public void setTxHash(@jakarta.annotation.Nullable String txHash) { + this.txHash = txHash; + } + + public BatchRedeemResponseResultsInner 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 BatchRedeemResponseResultsInner error(@jakarta.annotation.Nullable String error) { + this.error = error; + return this; + } + + /** + * Get error + * + * @return error + */ + @jakarta.annotation.Nullable + public String getError() { + return error; + } + + public void setError(@jakarta.annotation.Nullable String error) { + this.error = error; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BatchRedeemResponseResultsInner batchRedeemResponseResultsInner = + (BatchRedeemResponseResultsInner) o; + return Objects.equals(this.requestId, batchRedeemResponseResultsInner.requestId) + && Objects.equals(this.txHash, batchRedeemResponseResultsInner.txHash) + && Objects.equals(this.status, batchRedeemResponseResultsInner.status) + && Objects.equals(this.error, batchRedeemResponseResultsInner.error); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(requestId, txHash, status, error); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BatchRedeemResponseResultsInner {\n"); + sb.append(" requestId: ").append(toIndentedString(requestId)).append("\n"); + sb.append(" txHash: ").append(toIndentedString(txHash)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" error: ").append(toIndentedString(error)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object requestIdValue = getRequestId(); + String requestIdValueAsString = ""; + requestIdValueAsString = requestIdValue.toString(); + sb.append("requestId=").append(urlEncode(requestIdValueAsString)).append(""); + Object txHashValue = getTxHash(); + String txHashValueAsString = ""; + txHashValueAsString = txHashValue.toString(); + sb.append("txHash=").append(urlEncode(txHashValueAsString)).append(""); + Object statusValue = getStatus(); + String statusValueAsString = ""; + statusValueAsString = statusValue.toString(); + sb.append("status=").append(urlEncode(statusValueAsString)).append(""); + Object errorValue = getError(); + String errorValueAsString = ""; + errorValueAsString = errorValue.toString(); + sb.append("error=").append(urlEncode(errorValueAsString)).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("requestId"); + openapiFields.add("txHash"); + openapiFields.add("status"); + openapiFields.add("error"); + + // 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 + * BatchRedeemResponseResultsInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BatchRedeemResponseResultsInner.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in BatchRedeemResponseResultsInner is not" + + " found in the empty JSON string", + BatchRedeemResponseResultsInner.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("requestId") != null && !jsonObj.get("requestId").isJsonNull()) + && !jsonObj.get("requestId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `requestId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("requestId").toString())); + } + if ((jsonObj.get("txHash") != null && !jsonObj.get("txHash").isJsonNull()) + && !jsonObj.get("txHash").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `txHash` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("txHash").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("error") != null && !jsonObj.get("error").isJsonNull()) + && !jsonObj.get("error").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `error` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("error").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BatchRedeemResponseResultsInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BatchRedeemResponseResultsInner' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(BatchRedeemResponseResultsInner.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, BatchRedeemResponseResultsInner value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BatchRedeemResponseResultsInner read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of BatchRedeemResponseResultsInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of BatchRedeemResponseResultsInner + * @throws IOException if the JSON string is invalid with respect to + * BatchRedeemResponseResultsInner + */ + public static BatchRedeemResponseResultsInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BatchRedeemResponseResultsInner.class); + } + + /** + * Convert an instance of BatchRedeemResponseResultsInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/CancelInfoList.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/CancelInfoList.java new file mode 100644 index 000000000..9a5611837 --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/CancelInfoList.java @@ -0,0 +1,181 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.model; + +import com.binance.connector.client.w3w_prediction.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.*; + +/** List of orders to cancel (index `i` starts from 0) */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class CancelInfoList extends ArrayList { + public CancelInfoList() {} + + @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 CancelInfoList {\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 CancelInfoList + */ + 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) { + CancelInfoListInner.validateJsonElement(element); + } + if (jsonElement == null) { + if (!CancelInfoList.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CancelInfoList is not found in the" + + " empty JSON string", + CancelInfoList.openapiRequiredFields.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CancelInfoList.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CancelInfoList' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CancelInfoList.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CancelInfoList value) throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonArray(); + elementAdapter.write(out, obj); + } + + @Override + public CancelInfoList read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CancelInfoList given an JSON string + * + * @param jsonString JSON string + * @return An instance of CancelInfoList + * @throws IOException if the JSON string is invalid with respect to CancelInfoList + */ + public static CancelInfoList fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CancelInfoList.class); + } + + /** + * Convert an instance of CancelInfoList to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/CancelInfoListInner.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/CancelInfoListInner.java new file mode 100644 index 000000000..5ef5e8c18 --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/CancelInfoListInner.java @@ -0,0 +1,221 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.model; + +import com.binance.connector.client.w3w_prediction.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.*; + +/** CancelInfoListInner */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class CancelInfoListInner { + public static final String SERIALIZED_NAME_ORDER_ID = "orderId"; + + @SerializedName(SERIALIZED_NAME_ORDER_ID) + @jakarta.annotation.Nonnull + private String orderId; + + public CancelInfoListInner() {} + + public CancelInfoListInner orderId(@jakarta.annotation.Nonnull String orderId) { + this.orderId = orderId; + return this; + } + + /** + * Internal order ID to cancel + * + * @return orderId + */ + @jakarta.annotation.Nonnull + @NotNull + public String getOrderId() { + return orderId; + } + + public void setOrderId(@jakarta.annotation.Nonnull String orderId) { + this.orderId = orderId; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CancelInfoListInner cancelInfoListInner = (CancelInfoListInner) o; + return Objects.equals(this.orderId, cancelInfoListInner.orderId); + } + + @Override + public int hashCode() { + return Objects.hash(orderId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CancelInfoListInner {\n"); + sb.append(" orderId: ").append(toIndentedString(orderId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object orderIdValue = getOrderId(); + String orderIdValueAsString = ""; + orderIdValueAsString = orderIdValue.toString(); + sb.append("orderId=").append(urlEncode(orderIdValueAsString)).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("orderId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("orderId"); + } + + /** + * 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 CancelInfoListInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CancelInfoListInner.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CancelInfoListInner is not found in" + + " the empty JSON string", + CancelInfoListInner.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CancelInfoListInner.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("orderId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `orderId` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("orderId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CancelInfoListInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CancelInfoListInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CancelInfoListInner.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CancelInfoListInner value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CancelInfoListInner read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CancelInfoListInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of CancelInfoListInner + * @throws IOException if the JSON string is invalid with respect to CancelInfoListInner + */ + public static CancelInfoListInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CancelInfoListInner.class); + } + + /** + * Convert an instance of CancelInfoListInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/CreateInboundTransferRequest.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/CreateInboundTransferRequest.java new file mode 100644 index 000000000..e70e26318 --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/CreateInboundTransferRequest.java @@ -0,0 +1,472 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.model; + +import com.binance.connector.client.w3w_prediction.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.*; + +/** CreateInboundTransferRequest */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class CreateInboundTransferRequest { + public static final String SERIALIZED_NAME_WALLET_ID = "walletId"; + + @SerializedName(SERIALIZED_NAME_WALLET_ID) + @jakarta.annotation.Nonnull + private String walletId; + + public static final String SERIALIZED_NAME_WALLET_ADDRESS = "walletAddress"; + + @SerializedName(SERIALIZED_NAME_WALLET_ADDRESS) + @jakarta.annotation.Nonnull + private String walletAddress; + + public static final String SERIALIZED_NAME_FROM_TOKEN_AMOUNT = "fromTokenAmount"; + + @SerializedName(SERIALIZED_NAME_FROM_TOKEN_AMOUNT) + @jakarta.annotation.Nonnull + private String fromTokenAmount; + + public static final String SERIALIZED_NAME_ACCOUNT_TYPE = "accountType"; + + @SerializedName(SERIALIZED_NAME_ACCOUNT_TYPE) + @jakarta.annotation.Nonnull + private AccountType accountType; + + public static final String SERIALIZED_NAME_FROM_TOKEN = "fromToken"; + + @SerializedName(SERIALIZED_NAME_FROM_TOKEN) + @jakarta.annotation.Nullable + private String fromToken = "USDT"; + + public static final String SERIALIZED_NAME_TO_TOKEN = "toToken"; + + @SerializedName(SERIALIZED_NAME_TO_TOKEN) + @jakarta.annotation.Nullable + private String toToken = "USDT"; + + public static final String SERIALIZED_NAME_CHAIN_ID = "chainId"; + + @SerializedName(SERIALIZED_NAME_CHAIN_ID) + @jakarta.annotation.Nullable + private String chainId = "56"; + + public CreateInboundTransferRequest() {} + + public CreateInboundTransferRequest walletId(@jakarta.annotation.Nonnull String walletId) { + this.walletId = walletId; + return this; + } + + /** + * Wallet ID + * + * @return walletId + */ + @jakarta.annotation.Nonnull + @NotNull + public String getWalletId() { + return walletId; + } + + public void setWalletId(@jakarta.annotation.Nonnull String walletId) { + this.walletId = walletId; + } + + public CreateInboundTransferRequest walletAddress( + @jakarta.annotation.Nonnull String walletAddress) { + this.walletAddress = walletAddress; + return this; + } + + /** + * User's prediction wallet address + * + * @return walletAddress + */ + @jakarta.annotation.Nonnull + @NotNull + public String getWalletAddress() { + return walletAddress; + } + + public void setWalletAddress(@jakarta.annotation.Nonnull String walletAddress) { + this.walletAddress = walletAddress; + } + + public CreateInboundTransferRequest fromTokenAmount( + @jakarta.annotation.Nonnull String fromTokenAmount) { + this.fromTokenAmount = fromTokenAmount; + return this; + } + + /** + * Transfer amount in wei (18 decimals). Must be > 0. Example: + * `1000000000000000000` = 1 USDT + * + * @return fromTokenAmount + */ + @jakarta.annotation.Nonnull + @NotNull + public String getFromTokenAmount() { + return fromTokenAmount; + } + + public void setFromTokenAmount(@jakarta.annotation.Nonnull String fromTokenAmount) { + this.fromTokenAmount = fromTokenAmount; + } + + public CreateInboundTransferRequest accountType( + @jakarta.annotation.Nonnull AccountType accountType) { + this.accountType = accountType; + return this; + } + + /** + * Get accountType + * + * @return accountType + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public AccountType getAccountType() { + return accountType; + } + + public void setAccountType(@jakarta.annotation.Nonnull AccountType accountType) { + this.accountType = accountType; + } + + public CreateInboundTransferRequest fromToken(@jakarta.annotation.Nullable String fromToken) { + this.fromToken = fromToken; + return this; + } + + /** + * Source token symbol. Default `USDT` + * + * @return fromToken + */ + @jakarta.annotation.Nullable + public String getFromToken() { + return fromToken; + } + + public void setFromToken(@jakarta.annotation.Nullable String fromToken) { + this.fromToken = fromToken; + } + + public CreateInboundTransferRequest toToken(@jakarta.annotation.Nullable String toToken) { + this.toToken = toToken; + return this; + } + + /** + * Destination token symbol. Default `USDT` + * + * @return toToken + */ + @jakarta.annotation.Nullable + public String getToToken() { + return toToken; + } + + public void setToToken(@jakarta.annotation.Nullable String toToken) { + this.toToken = toToken; + } + + public CreateInboundTransferRequest chainId(@jakarta.annotation.Nullable String chainId) { + this.chainId = chainId; + return this; + } + + /** + * Chain ID. Default `56` (BSC) + * + * @return chainId + */ + @jakarta.annotation.Nullable + public String getChainId() { + return chainId; + } + + public void setChainId(@jakarta.annotation.Nullable String chainId) { + this.chainId = chainId; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateInboundTransferRequest createInboundTransferRequest = + (CreateInboundTransferRequest) o; + return Objects.equals(this.walletId, createInboundTransferRequest.walletId) + && Objects.equals(this.walletAddress, createInboundTransferRequest.walletAddress) + && Objects.equals( + this.fromTokenAmount, createInboundTransferRequest.fromTokenAmount) + && Objects.equals(this.accountType, createInboundTransferRequest.accountType) + && Objects.equals(this.fromToken, createInboundTransferRequest.fromToken) + && Objects.equals(this.toToken, createInboundTransferRequest.toToken) + && Objects.equals(this.chainId, createInboundTransferRequest.chainId); + } + + @Override + public int hashCode() { + return Objects.hash( + walletId, walletAddress, fromTokenAmount, accountType, fromToken, toToken, chainId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateInboundTransferRequest {\n"); + sb.append(" walletId: ").append(toIndentedString(walletId)).append("\n"); + sb.append(" walletAddress: ").append(toIndentedString(walletAddress)).append("\n"); + sb.append(" fromTokenAmount: ").append(toIndentedString(fromTokenAmount)).append("\n"); + sb.append(" accountType: ").append(toIndentedString(accountType)).append("\n"); + sb.append(" fromToken: ").append(toIndentedString(fromToken)).append("\n"); + sb.append(" toToken: ").append(toIndentedString(toToken)).append("\n"); + sb.append(" chainId: ").append(toIndentedString(chainId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object walletIdValue = getWalletId(); + String walletIdValueAsString = ""; + walletIdValueAsString = walletIdValue.toString(); + sb.append("walletId=").append(urlEncode(walletIdValueAsString)).append(""); + Object walletAddressValue = getWalletAddress(); + String walletAddressValueAsString = ""; + walletAddressValueAsString = walletAddressValue.toString(); + sb.append("walletAddress=").append(urlEncode(walletAddressValueAsString)).append(""); + Object fromTokenAmountValue = getFromTokenAmount(); + String fromTokenAmountValueAsString = ""; + fromTokenAmountValueAsString = fromTokenAmountValue.toString(); + sb.append("fromTokenAmount=").append(urlEncode(fromTokenAmountValueAsString)).append(""); + Object accountTypeValue = getAccountType(); + String accountTypeValueAsString = ""; + accountTypeValueAsString = accountTypeValue.toString(); + sb.append("accountType=").append(urlEncode(accountTypeValueAsString)).append(""); + Object fromTokenValue = getFromToken(); + String fromTokenValueAsString = ""; + fromTokenValueAsString = fromTokenValue.toString(); + sb.append("fromToken=").append(urlEncode(fromTokenValueAsString)).append(""); + Object toTokenValue = getToToken(); + String toTokenValueAsString = ""; + toTokenValueAsString = toTokenValue.toString(); + sb.append("toToken=").append(urlEncode(toTokenValueAsString)).append(""); + Object chainIdValue = getChainId(); + String chainIdValueAsString = ""; + chainIdValueAsString = chainIdValue.toString(); + sb.append("chainId=").append(urlEncode(chainIdValueAsString)).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("walletId"); + openapiFields.add("walletAddress"); + openapiFields.add("fromTokenAmount"); + openapiFields.add("accountType"); + openapiFields.add("fromToken"); + openapiFields.add("toToken"); + openapiFields.add("chainId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("walletId"); + openapiRequiredFields.add("walletAddress"); + openapiRequiredFields.add("fromTokenAmount"); + openapiRequiredFields.add("accountType"); + } + + /** + * 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 + * CreateInboundTransferRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateInboundTransferRequest.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateInboundTransferRequest is not" + + " found in the empty JSON string", + CreateInboundTransferRequest.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateInboundTransferRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("walletId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `walletId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("walletId").toString())); + } + if (!jsonObj.get("walletAddress").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `walletAddress` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("walletAddress").toString())); + } + if (!jsonObj.get("fromTokenAmount").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `fromTokenAmount` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("fromTokenAmount").toString())); + } + // validate the required field `accountType` + AccountType.validateJsonElement(jsonObj.get("accountType")); + if ((jsonObj.get("fromToken") != null && !jsonObj.get("fromToken").isJsonNull()) + && !jsonObj.get("fromToken").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `fromToken` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("fromToken").toString())); + } + if ((jsonObj.get("toToken") != null && !jsonObj.get("toToken").isJsonNull()) + && !jsonObj.get("toToken").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `toToken` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("toToken").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())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateInboundTransferRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateInboundTransferRequest' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateInboundTransferRequest.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateInboundTransferRequest value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateInboundTransferRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateInboundTransferRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateInboundTransferRequest + * @throws IOException if the JSON string is invalid with respect to + * CreateInboundTransferRequest + */ + public static CreateInboundTransferRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateInboundTransferRequest.class); + } + + /** + * Convert an instance of CreateInboundTransferRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/CreateInboundTransferResponse.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/CreateInboundTransferResponse.java new file mode 100644 index 000000000..2a5e5f9ca --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/CreateInboundTransferResponse.java @@ -0,0 +1,257 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.model; + +import com.binance.connector.client.w3w_prediction.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.*; + +/** CreateInboundTransferResponse */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class CreateInboundTransferResponse { + public static final String SERIALIZED_NAME_TRANSFER_ID = "transferId"; + + @SerializedName(SERIALIZED_NAME_TRANSFER_ID) + @jakarta.annotation.Nullable + private String transferId; + + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + @jakarta.annotation.Nullable + private String status; + + public CreateInboundTransferResponse() {} + + public CreateInboundTransferResponse transferId( + @jakarta.annotation.Nullable String transferId) { + this.transferId = transferId; + return this; + } + + /** + * Get transferId + * + * @return transferId + */ + @jakarta.annotation.Nullable + public String getTransferId() { + return transferId; + } + + public void setTransferId(@jakarta.annotation.Nullable String transferId) { + this.transferId = transferId; + } + + public CreateInboundTransferResponse 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; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateInboundTransferResponse createInboundTransferResponse = + (CreateInboundTransferResponse) o; + return Objects.equals(this.transferId, createInboundTransferResponse.transferId) + && Objects.equals(this.status, createInboundTransferResponse.status); + } + + @Override + public int hashCode() { + return Objects.hash(transferId, status); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateInboundTransferResponse {\n"); + sb.append(" transferId: ").append(toIndentedString(transferId)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object transferIdValue = getTransferId(); + String transferIdValueAsString = ""; + transferIdValueAsString = transferIdValue.toString(); + sb.append("transferId=").append(urlEncode(transferIdValueAsString)).append(""); + Object statusValue = getStatus(); + String statusValueAsString = ""; + statusValueAsString = statusValue.toString(); + sb.append("status=").append(urlEncode(statusValueAsString)).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("transferId"); + openapiFields.add("status"); + + // 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 + * CreateInboundTransferResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateInboundTransferResponse.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateInboundTransferResponse is not" + + " found in the empty JSON string", + CreateInboundTransferResponse.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("transferId") != null && !jsonObj.get("transferId").isJsonNull()) + && !jsonObj.get("transferId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `transferId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("transferId").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())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateInboundTransferResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateInboundTransferResponse' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateInboundTransferResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateInboundTransferResponse value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateInboundTransferResponse read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateInboundTransferResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateInboundTransferResponse + * @throws IOException if the JSON string is invalid with respect to + * CreateInboundTransferResponse + */ + public static CreateInboundTransferResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateInboundTransferResponse.class); + } + + /** + * Convert an instance of CreateInboundTransferResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/CreateOutboundTransferRequest.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/CreateOutboundTransferRequest.java new file mode 100644 index 000000000..ab396632b --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/CreateOutboundTransferRequest.java @@ -0,0 +1,518 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.model; + +import com.binance.connector.client.w3w_prediction.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.*; + +/** CreateOutboundTransferRequest */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class CreateOutboundTransferRequest { + public static final String SERIALIZED_NAME_WALLET_ID = "walletId"; + + @SerializedName(SERIALIZED_NAME_WALLET_ID) + @jakarta.annotation.Nonnull + private String walletId; + + public static final String SERIALIZED_NAME_WALLET_ADDRESS = "walletAddress"; + + @SerializedName(SERIALIZED_NAME_WALLET_ADDRESS) + @jakarta.annotation.Nonnull + private String walletAddress; + + public static final String SERIALIZED_NAME_FROM_TOKEN_AMOUNT = "fromTokenAmount"; + + @SerializedName(SERIALIZED_NAME_FROM_TOKEN_AMOUNT) + @jakarta.annotation.Nonnull + private String fromTokenAmount; + + public static final String SERIALIZED_NAME_ACCOUNT_TYPE = "accountType"; + + @SerializedName(SERIALIZED_NAME_ACCOUNT_TYPE) + @jakarta.annotation.Nonnull + private AccountType accountType; + + public static final String SERIALIZED_NAME_SOURCE_BIZ = "sourceBiz"; + + @SerializedName(SERIALIZED_NAME_SOURCE_BIZ) + @jakarta.annotation.Nonnull + private SourceBiz sourceBiz; + + public static final String SERIALIZED_NAME_FROM_TOKEN = "fromToken"; + + @SerializedName(SERIALIZED_NAME_FROM_TOKEN) + @jakarta.annotation.Nullable + private String fromToken = "USDT"; + + public static final String SERIALIZED_NAME_TO_TOKEN = "toToken"; + + @SerializedName(SERIALIZED_NAME_TO_TOKEN) + @jakarta.annotation.Nullable + private String toToken = "USDT"; + + public static final String SERIALIZED_NAME_CHAIN_ID = "chainId"; + + @SerializedName(SERIALIZED_NAME_CHAIN_ID) + @jakarta.annotation.Nullable + private String chainId = "56"; + + public CreateOutboundTransferRequest() {} + + public CreateOutboundTransferRequest walletId(@jakarta.annotation.Nonnull String walletId) { + this.walletId = walletId; + return this; + } + + /** + * Wallet ID + * + * @return walletId + */ + @jakarta.annotation.Nonnull + @NotNull + public String getWalletId() { + return walletId; + } + + public void setWalletId(@jakarta.annotation.Nonnull String walletId) { + this.walletId = walletId; + } + + public CreateOutboundTransferRequest walletAddress( + @jakarta.annotation.Nonnull String walletAddress) { + this.walletAddress = walletAddress; + return this; + } + + /** + * User's prediction wallet address + * + * @return walletAddress + */ + @jakarta.annotation.Nonnull + @NotNull + public String getWalletAddress() { + return walletAddress; + } + + public void setWalletAddress(@jakarta.annotation.Nonnull String walletAddress) { + this.walletAddress = walletAddress; + } + + public CreateOutboundTransferRequest fromTokenAmount( + @jakarta.annotation.Nonnull String fromTokenAmount) { + this.fromTokenAmount = fromTokenAmount; + return this; + } + + /** + * Transfer amount in wei (18 decimals). Must be > 0. Example: + * `1000000000000000000` = 1 USDT + * + * @return fromTokenAmount + */ + @jakarta.annotation.Nonnull + @NotNull + public String getFromTokenAmount() { + return fromTokenAmount; + } + + public void setFromTokenAmount(@jakarta.annotation.Nonnull String fromTokenAmount) { + this.fromTokenAmount = fromTokenAmount; + } + + public CreateOutboundTransferRequest accountType( + @jakarta.annotation.Nonnull AccountType accountType) { + this.accountType = accountType; + return this; + } + + /** + * Get accountType + * + * @return accountType + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public AccountType getAccountType() { + return accountType; + } + + public void setAccountType(@jakarta.annotation.Nonnull AccountType accountType) { + this.accountType = accountType; + } + + public CreateOutboundTransferRequest sourceBiz( + @jakarta.annotation.Nonnull SourceBiz sourceBiz) { + this.sourceBiz = sourceBiz; + return this; + } + + /** + * Get sourceBiz + * + * @return sourceBiz + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public SourceBiz getSourceBiz() { + return sourceBiz; + } + + public void setSourceBiz(@jakarta.annotation.Nonnull SourceBiz sourceBiz) { + this.sourceBiz = sourceBiz; + } + + public CreateOutboundTransferRequest fromToken(@jakarta.annotation.Nullable String fromToken) { + this.fromToken = fromToken; + return this; + } + + /** + * Source token symbol. Default `USDT` + * + * @return fromToken + */ + @jakarta.annotation.Nullable + public String getFromToken() { + return fromToken; + } + + public void setFromToken(@jakarta.annotation.Nullable String fromToken) { + this.fromToken = fromToken; + } + + public CreateOutboundTransferRequest toToken(@jakarta.annotation.Nullable String toToken) { + this.toToken = toToken; + return this; + } + + /** + * Destination token symbol. Default `USDT` + * + * @return toToken + */ + @jakarta.annotation.Nullable + public String getToToken() { + return toToken; + } + + public void setToToken(@jakarta.annotation.Nullable String toToken) { + this.toToken = toToken; + } + + public CreateOutboundTransferRequest chainId(@jakarta.annotation.Nullable String chainId) { + this.chainId = chainId; + return this; + } + + /** + * Chain ID. Default `56` (BSC) + * + * @return chainId + */ + @jakarta.annotation.Nullable + public String getChainId() { + return chainId; + } + + public void setChainId(@jakarta.annotation.Nullable String chainId) { + this.chainId = chainId; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateOutboundTransferRequest createOutboundTransferRequest = + (CreateOutboundTransferRequest) o; + return Objects.equals(this.walletId, createOutboundTransferRequest.walletId) + && Objects.equals(this.walletAddress, createOutboundTransferRequest.walletAddress) + && Objects.equals( + this.fromTokenAmount, createOutboundTransferRequest.fromTokenAmount) + && Objects.equals(this.accountType, createOutboundTransferRequest.accountType) + && Objects.equals(this.sourceBiz, createOutboundTransferRequest.sourceBiz) + && Objects.equals(this.fromToken, createOutboundTransferRequest.fromToken) + && Objects.equals(this.toToken, createOutboundTransferRequest.toToken) + && Objects.equals(this.chainId, createOutboundTransferRequest.chainId); + } + + @Override + public int hashCode() { + return Objects.hash( + walletId, + walletAddress, + fromTokenAmount, + accountType, + sourceBiz, + fromToken, + toToken, + chainId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateOutboundTransferRequest {\n"); + sb.append(" walletId: ").append(toIndentedString(walletId)).append("\n"); + sb.append(" walletAddress: ").append(toIndentedString(walletAddress)).append("\n"); + sb.append(" fromTokenAmount: ").append(toIndentedString(fromTokenAmount)).append("\n"); + sb.append(" accountType: ").append(toIndentedString(accountType)).append("\n"); + sb.append(" sourceBiz: ").append(toIndentedString(sourceBiz)).append("\n"); + sb.append(" fromToken: ").append(toIndentedString(fromToken)).append("\n"); + sb.append(" toToken: ").append(toIndentedString(toToken)).append("\n"); + sb.append(" chainId: ").append(toIndentedString(chainId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object walletIdValue = getWalletId(); + String walletIdValueAsString = ""; + walletIdValueAsString = walletIdValue.toString(); + sb.append("walletId=").append(urlEncode(walletIdValueAsString)).append(""); + Object walletAddressValue = getWalletAddress(); + String walletAddressValueAsString = ""; + walletAddressValueAsString = walletAddressValue.toString(); + sb.append("walletAddress=").append(urlEncode(walletAddressValueAsString)).append(""); + Object fromTokenAmountValue = getFromTokenAmount(); + String fromTokenAmountValueAsString = ""; + fromTokenAmountValueAsString = fromTokenAmountValue.toString(); + sb.append("fromTokenAmount=").append(urlEncode(fromTokenAmountValueAsString)).append(""); + Object accountTypeValue = getAccountType(); + String accountTypeValueAsString = ""; + accountTypeValueAsString = accountTypeValue.toString(); + sb.append("accountType=").append(urlEncode(accountTypeValueAsString)).append(""); + Object sourceBizValue = getSourceBiz(); + String sourceBizValueAsString = ""; + sourceBizValueAsString = sourceBizValue.toString(); + sb.append("sourceBiz=").append(urlEncode(sourceBizValueAsString)).append(""); + Object fromTokenValue = getFromToken(); + String fromTokenValueAsString = ""; + fromTokenValueAsString = fromTokenValue.toString(); + sb.append("fromToken=").append(urlEncode(fromTokenValueAsString)).append(""); + Object toTokenValue = getToToken(); + String toTokenValueAsString = ""; + toTokenValueAsString = toTokenValue.toString(); + sb.append("toToken=").append(urlEncode(toTokenValueAsString)).append(""); + Object chainIdValue = getChainId(); + String chainIdValueAsString = ""; + chainIdValueAsString = chainIdValue.toString(); + sb.append("chainId=").append(urlEncode(chainIdValueAsString)).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("walletId"); + openapiFields.add("walletAddress"); + openapiFields.add("fromTokenAmount"); + openapiFields.add("accountType"); + openapiFields.add("sourceBiz"); + openapiFields.add("fromToken"); + openapiFields.add("toToken"); + openapiFields.add("chainId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("walletId"); + openapiRequiredFields.add("walletAddress"); + openapiRequiredFields.add("fromTokenAmount"); + openapiRequiredFields.add("accountType"); + openapiRequiredFields.add("sourceBiz"); + } + + /** + * 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 + * CreateOutboundTransferRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateOutboundTransferRequest.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateOutboundTransferRequest is not" + + " found in the empty JSON string", + CreateOutboundTransferRequest.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateOutboundTransferRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("walletId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `walletId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("walletId").toString())); + } + if (!jsonObj.get("walletAddress").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `walletAddress` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("walletAddress").toString())); + } + if (!jsonObj.get("fromTokenAmount").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `fromTokenAmount` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("fromTokenAmount").toString())); + } + // validate the required field `accountType` + AccountType.validateJsonElement(jsonObj.get("accountType")); + // validate the required field `sourceBiz` + SourceBiz.validateJsonElement(jsonObj.get("sourceBiz")); + if ((jsonObj.get("fromToken") != null && !jsonObj.get("fromToken").isJsonNull()) + && !jsonObj.get("fromToken").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `fromToken` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("fromToken").toString())); + } + if ((jsonObj.get("toToken") != null && !jsonObj.get("toToken").isJsonNull()) + && !jsonObj.get("toToken").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `toToken` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("toToken").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())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateOutboundTransferRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateOutboundTransferRequest' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateOutboundTransferRequest.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateOutboundTransferRequest value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateOutboundTransferRequest read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateOutboundTransferRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateOutboundTransferRequest + * @throws IOException if the JSON string is invalid with respect to + * CreateOutboundTransferRequest + */ + public static CreateOutboundTransferRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateOutboundTransferRequest.class); + } + + /** + * Convert an instance of CreateOutboundTransferRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/CreateOutboundTransferResponse.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/CreateOutboundTransferResponse.java new file mode 100644 index 000000000..b5f8d2d44 --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/CreateOutboundTransferResponse.java @@ -0,0 +1,257 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.model; + +import com.binance.connector.client.w3w_prediction.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.*; + +/** CreateOutboundTransferResponse */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class CreateOutboundTransferResponse { + public static final String SERIALIZED_NAME_TRANSFER_ID = "transferId"; + + @SerializedName(SERIALIZED_NAME_TRANSFER_ID) + @jakarta.annotation.Nullable + private String transferId; + + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + @jakarta.annotation.Nullable + private String status; + + public CreateOutboundTransferResponse() {} + + public CreateOutboundTransferResponse transferId( + @jakarta.annotation.Nullable String transferId) { + this.transferId = transferId; + return this; + } + + /** + * Get transferId + * + * @return transferId + */ + @jakarta.annotation.Nullable + public String getTransferId() { + return transferId; + } + + public void setTransferId(@jakarta.annotation.Nullable String transferId) { + this.transferId = transferId; + } + + public CreateOutboundTransferResponse 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; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateOutboundTransferResponse createOutboundTransferResponse = + (CreateOutboundTransferResponse) o; + return Objects.equals(this.transferId, createOutboundTransferResponse.transferId) + && Objects.equals(this.status, createOutboundTransferResponse.status); + } + + @Override + public int hashCode() { + return Objects.hash(transferId, status); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateOutboundTransferResponse {\n"); + sb.append(" transferId: ").append(toIndentedString(transferId)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object transferIdValue = getTransferId(); + String transferIdValueAsString = ""; + transferIdValueAsString = transferIdValue.toString(); + sb.append("transferId=").append(urlEncode(transferIdValueAsString)).append(""); + Object statusValue = getStatus(); + String statusValueAsString = ""; + statusValueAsString = statusValue.toString(); + sb.append("status=").append(urlEncode(statusValueAsString)).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("transferId"); + openapiFields.add("status"); + + // 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 + * CreateOutboundTransferResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateOutboundTransferResponse.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateOutboundTransferResponse is not" + + " found in the empty JSON string", + CreateOutboundTransferResponse.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("transferId") != null && !jsonObj.get("transferId").isJsonNull()) + && !jsonObj.get("transferId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `transferId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("transferId").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())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateOutboundTransferResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateOutboundTransferResponse' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateOutboundTransferResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateOutboundTransferResponse value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateOutboundTransferResponse read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateOutboundTransferResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateOutboundTransferResponse + * @throws IOException if the JSON string is invalid with respect to + * CreateOutboundTransferResponse + */ + public static CreateOutboundTransferResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateOutboundTransferResponse.class); + } + + /** + * Convert an instance of CreateOutboundTransferResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/Direction.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/Direction.java new file mode 100644 index 000000000..6c375eea3 --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/Direction.java @@ -0,0 +1,73 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.model; + +import com.google.gson.JsonElement; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import org.hibernate.validator.constraints.*; + +/** Gets or Sets direction */ +@JsonAdapter(Direction.Adapter.class) +public enum Direction { + INBOUND("INBOUND"), + + OUTBOUND("OUTBOUND"); + + private String value; + + Direction(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static Direction fromValue(String value) { + for (Direction b : Direction.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final Direction enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public Direction read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return Direction.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + Direction.fromValue(value); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/FundingSource.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/FundingSource.java new file mode 100644 index 000000000..824df988b --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/FundingSource.java @@ -0,0 +1,73 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.model; + +import com.google.gson.JsonElement; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import org.hibernate.validator.constraints.*; + +/** Funding source. Enum: `MPC`, `CEX`. Default `MPC` */ +@JsonAdapter(FundingSource.Adapter.class) +public enum FundingSource { + MPC("MPC"), + + CEX("CEX"); + + private String value; + + FundingSource(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static FundingSource fromValue(String value) { + for (FundingSource b : FundingSource.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final FundingSource enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public FundingSource read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return FundingSource.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + FundingSource.fromValue(value); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/GetMarketDetailResponse.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/GetMarketDetailResponse.java new file mode 100644 index 000000000..0acbd2ec9 --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/GetMarketDetailResponse.java @@ -0,0 +1,1194 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.model; + +import com.binance.connector.client.w3w_prediction.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.*; + +/** GetMarketDetailResponse */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class GetMarketDetailResponse { + public static final String SERIALIZED_NAME_MARKET_TOPIC_ID = "marketTopicId"; + + @SerializedName(SERIALIZED_NAME_MARKET_TOPIC_ID) + @jakarta.annotation.Nullable + private Long marketTopicId; + + public static final String SERIALIZED_NAME_VENDOR = "vendor"; + + @SerializedName(SERIALIZED_NAME_VENDOR) + @jakarta.annotation.Nullable + private String vendor; + + 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_SLUG = "slug"; + + @SerializedName(SERIALIZED_NAME_SLUG) + @jakarta.annotation.Nullable + private String slug; + + public static final String SERIALIZED_NAME_TITLE = "title"; + + @SerializedName(SERIALIZED_NAME_TITLE) + @jakarta.annotation.Nullable + private String title; + + public static final String SERIALIZED_NAME_QUESTION = "question"; + + @SerializedName(SERIALIZED_NAME_QUESTION) + @jakarta.annotation.Nullable + private String question; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @jakarta.annotation.Nullable + private String description; + + public static final String SERIALIZED_NAME_IMAGE_URL = "imageUrl"; + + @SerializedName(SERIALIZED_NAME_IMAGE_URL) + @jakarta.annotation.Nullable + private String imageUrl; + + public static final String SERIALIZED_NAME_TOPIC_TYPE = "topicType"; + + @SerializedName(SERIALIZED_NAME_TOPIC_TYPE) + @jakarta.annotation.Nullable + private String topicType; + + public static final String SERIALIZED_NAME_CHART_TYPE = "chartType"; + + @SerializedName(SERIALIZED_NAME_CHART_TYPE) + @jakarta.annotation.Nullable + private String chartType; + + public static final String SERIALIZED_NAME_SYMBOL = "symbol"; + + @SerializedName(SERIALIZED_NAME_SYMBOL) + @jakarta.annotation.Nullable + private String symbol; + + public static final String SERIALIZED_NAME_VARIANT_DATA = "variantData"; + + @SerializedName(SERIALIZED_NAME_VARIANT_DATA) + @jakarta.annotation.Nullable + private GetMarketDetailResponseVariantData variantData; + + public static final String SERIALIZED_NAME_PARTICIPANT_COUNT = "participantCount"; + + @SerializedName(SERIALIZED_NAME_PARTICIPANT_COUNT) + @jakarta.annotation.Nullable + private Integer participantCount; + + public static final String SERIALIZED_NAME_COLLATERAL = "collateral"; + + @SerializedName(SERIALIZED_NAME_COLLATERAL) + @jakarta.annotation.Nullable + private String collateral; + + public static final String SERIALIZED_NAME_FEE_RATE_BPS = "feeRateBps"; + + @SerializedName(SERIALIZED_NAME_FEE_RATE_BPS) + @jakarta.annotation.Nullable + private Integer feeRateBps; + + public static final String SERIALIZED_NAME_SLIPPAGE_BPS = "slippageBps"; + + @SerializedName(SERIALIZED_NAME_SLIPPAGE_BPS) + @jakarta.annotation.Nullable + private Integer slippageBps; + + public static final String SERIALIZED_NAME_IS_YIELD_BEARING = "isYieldBearing"; + + @SerializedName(SERIALIZED_NAME_IS_YIELD_BEARING) + @jakarta.annotation.Nullable + private Boolean isYieldBearing; + + public static final String SERIALIZED_NAME_TRADE_VOLUME = "tradeVolume"; + + @SerializedName(SERIALIZED_NAME_TRADE_VOLUME) + @jakarta.annotation.Nullable + private String tradeVolume; + + public static final String SERIALIZED_NAME_LIQUIDITY = "liquidity"; + + @SerializedName(SERIALIZED_NAME_LIQUIDITY) + @jakarta.annotation.Nullable + private String liquidity; + + public static final String SERIALIZED_NAME_PUBLISHED_AT = "publishedAt"; + + @SerializedName(SERIALIZED_NAME_PUBLISHED_AT) + @jakarta.annotation.Nullable + private Long publishedAt; + + public static final String SERIALIZED_NAME_START_DATE = "startDate"; + + @SerializedName(SERIALIZED_NAME_START_DATE) + @jakarta.annotation.Nullable + private Long startDate; + + public static final String SERIALIZED_NAME_END_DATE = "endDate"; + + @SerializedName(SERIALIZED_NAME_END_DATE) + @jakarta.annotation.Nullable + private Long endDate; + + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + @jakarta.annotation.Nullable + private String status; + + public static final String SERIALIZED_NAME_TIMELINE = "timeline"; + + @SerializedName(SERIALIZED_NAME_TIMELINE) + @jakarta.annotation.Nullable + private List<@Valid GetMarketDetailResponseTimelineInner> timeline; + + public static final String SERIALIZED_NAME_MARKETS = "markets"; + + @SerializedName(SERIALIZED_NAME_MARKETS) + @jakarta.annotation.Nullable + private List<@Valid GetMarketDetailResponseMarketsInner> markets; + + public GetMarketDetailResponse() {} + + public GetMarketDetailResponse marketTopicId(@jakarta.annotation.Nullable Long marketTopicId) { + this.marketTopicId = marketTopicId; + return this; + } + + /** + * Get marketTopicId + * + * @return marketTopicId + */ + @jakarta.annotation.Nullable + public Long getMarketTopicId() { + return marketTopicId; + } + + public void setMarketTopicId(@jakarta.annotation.Nullable Long marketTopicId) { + this.marketTopicId = marketTopicId; + } + + public GetMarketDetailResponse vendor(@jakarta.annotation.Nullable String vendor) { + this.vendor = vendor; + return this; + } + + /** + * Get vendor + * + * @return vendor + */ + @jakarta.annotation.Nullable + public String getVendor() { + return vendor; + } + + public void setVendor(@jakarta.annotation.Nullable String vendor) { + this.vendor = vendor; + } + + public GetMarketDetailResponse 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 GetMarketDetailResponse slug(@jakarta.annotation.Nullable String slug) { + this.slug = slug; + return this; + } + + /** + * Get slug + * + * @return slug + */ + @jakarta.annotation.Nullable + public String getSlug() { + return slug; + } + + public void setSlug(@jakarta.annotation.Nullable String slug) { + this.slug = slug; + } + + public GetMarketDetailResponse title(@jakarta.annotation.Nullable String title) { + this.title = title; + return this; + } + + /** + * Get title + * + * @return title + */ + @jakarta.annotation.Nullable + public String getTitle() { + return title; + } + + public void setTitle(@jakarta.annotation.Nullable String title) { + this.title = title; + } + + public GetMarketDetailResponse question(@jakarta.annotation.Nullable String question) { + this.question = question; + return this; + } + + /** + * Get question + * + * @return question + */ + @jakarta.annotation.Nullable + public String getQuestion() { + return question; + } + + public void setQuestion(@jakarta.annotation.Nullable String question) { + this.question = question; + } + + public GetMarketDetailResponse description(@jakarta.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Get description + * + * @return description + */ + @jakarta.annotation.Nullable + public String getDescription() { + return description; + } + + public void setDescription(@jakarta.annotation.Nullable String description) { + this.description = description; + } + + public GetMarketDetailResponse imageUrl(@jakarta.annotation.Nullable String imageUrl) { + this.imageUrl = imageUrl; + return this; + } + + /** + * Get imageUrl + * + * @return imageUrl + */ + @jakarta.annotation.Nullable + public String getImageUrl() { + return imageUrl; + } + + public void setImageUrl(@jakarta.annotation.Nullable String imageUrl) { + this.imageUrl = imageUrl; + } + + public GetMarketDetailResponse topicType(@jakarta.annotation.Nullable String topicType) { + this.topicType = topicType; + return this; + } + + /** + * Get topicType + * + * @return topicType + */ + @jakarta.annotation.Nullable + public String getTopicType() { + return topicType; + } + + public void setTopicType(@jakarta.annotation.Nullable String topicType) { + this.topicType = topicType; + } + + public GetMarketDetailResponse chartType(@jakarta.annotation.Nullable String chartType) { + this.chartType = chartType; + return this; + } + + /** + * Get chartType + * + * @return chartType + */ + @jakarta.annotation.Nullable + public String getChartType() { + return chartType; + } + + public void setChartType(@jakarta.annotation.Nullable String chartType) { + this.chartType = chartType; + } + + public GetMarketDetailResponse 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 GetMarketDetailResponse variantData( + @jakarta.annotation.Nullable GetMarketDetailResponseVariantData variantData) { + this.variantData = variantData; + return this; + } + + /** + * Get variantData + * + * @return variantData + */ + @jakarta.annotation.Nullable + @Valid + public GetMarketDetailResponseVariantData getVariantData() { + return variantData; + } + + public void setVariantData( + @jakarta.annotation.Nullable GetMarketDetailResponseVariantData variantData) { + this.variantData = variantData; + } + + public GetMarketDetailResponse participantCount( + @jakarta.annotation.Nullable Integer participantCount) { + this.participantCount = participantCount; + return this; + } + + /** + * Get participantCount + * + * @return participantCount + */ + @jakarta.annotation.Nullable + public Integer getParticipantCount() { + return participantCount; + } + + public void setParticipantCount(@jakarta.annotation.Nullable Integer participantCount) { + this.participantCount = participantCount; + } + + public GetMarketDetailResponse collateral(@jakarta.annotation.Nullable String collateral) { + this.collateral = collateral; + return this; + } + + /** + * Get collateral + * + * @return collateral + */ + @jakarta.annotation.Nullable + public String getCollateral() { + return collateral; + } + + public void setCollateral(@jakarta.annotation.Nullable String collateral) { + this.collateral = collateral; + } + + public GetMarketDetailResponse feeRateBps(@jakarta.annotation.Nullable Integer feeRateBps) { + this.feeRateBps = feeRateBps; + return this; + } + + /** + * Get feeRateBps + * + * @return feeRateBps + */ + @jakarta.annotation.Nullable + public Integer getFeeRateBps() { + return feeRateBps; + } + + public void setFeeRateBps(@jakarta.annotation.Nullable Integer feeRateBps) { + this.feeRateBps = feeRateBps; + } + + public GetMarketDetailResponse slippageBps(@jakarta.annotation.Nullable Integer slippageBps) { + this.slippageBps = slippageBps; + return this; + } + + /** + * Get slippageBps + * + * @return slippageBps + */ + @jakarta.annotation.Nullable + public Integer getSlippageBps() { + return slippageBps; + } + + public void setSlippageBps(@jakarta.annotation.Nullable Integer slippageBps) { + this.slippageBps = slippageBps; + } + + public GetMarketDetailResponse isYieldBearing( + @jakarta.annotation.Nullable Boolean isYieldBearing) { + this.isYieldBearing = isYieldBearing; + return this; + } + + /** + * Get isYieldBearing + * + * @return isYieldBearing + */ + @jakarta.annotation.Nullable + public Boolean getIsYieldBearing() { + return isYieldBearing; + } + + public void setIsYieldBearing(@jakarta.annotation.Nullable Boolean isYieldBearing) { + this.isYieldBearing = isYieldBearing; + } + + public GetMarketDetailResponse tradeVolume(@jakarta.annotation.Nullable String tradeVolume) { + this.tradeVolume = tradeVolume; + return this; + } + + /** + * Get tradeVolume + * + * @return tradeVolume + */ + @jakarta.annotation.Nullable + public String getTradeVolume() { + return tradeVolume; + } + + public void setTradeVolume(@jakarta.annotation.Nullable String tradeVolume) { + this.tradeVolume = tradeVolume; + } + + public GetMarketDetailResponse 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 GetMarketDetailResponse publishedAt(@jakarta.annotation.Nullable Long publishedAt) { + this.publishedAt = publishedAt; + return this; + } + + /** + * Get publishedAt + * + * @return publishedAt + */ + @jakarta.annotation.Nullable + public Long getPublishedAt() { + return publishedAt; + } + + public void setPublishedAt(@jakarta.annotation.Nullable Long publishedAt) { + this.publishedAt = publishedAt; + } + + public GetMarketDetailResponse startDate(@jakarta.annotation.Nullable Long startDate) { + this.startDate = startDate; + return this; + } + + /** + * Get startDate + * + * @return startDate + */ + @jakarta.annotation.Nullable + public Long getStartDate() { + return startDate; + } + + public void setStartDate(@jakarta.annotation.Nullable Long startDate) { + this.startDate = startDate; + } + + public GetMarketDetailResponse endDate(@jakarta.annotation.Nullable Long endDate) { + this.endDate = endDate; + return this; + } + + /** + * Get endDate + * + * @return endDate + */ + @jakarta.annotation.Nullable + public Long getEndDate() { + return endDate; + } + + public void setEndDate(@jakarta.annotation.Nullable Long endDate) { + this.endDate = endDate; + } + + public GetMarketDetailResponse 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 GetMarketDetailResponse timeline( + @jakarta.annotation.Nullable + List<@Valid GetMarketDetailResponseTimelineInner> timeline) { + this.timeline = timeline; + return this; + } + + public GetMarketDetailResponse addTimelineItem( + GetMarketDetailResponseTimelineInner timelineItem) { + if (this.timeline == null) { + this.timeline = new ArrayList<>(); + } + this.timeline.add(timelineItem); + return this; + } + + /** + * Get timeline + * + * @return timeline + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid GetMarketDetailResponseTimelineInner> getTimeline() { + return timeline; + } + + public void setTimeline( + @jakarta.annotation.Nullable + List<@Valid GetMarketDetailResponseTimelineInner> timeline) { + this.timeline = timeline; + } + + public GetMarketDetailResponse markets( + @jakarta.annotation.Nullable List<@Valid GetMarketDetailResponseMarketsInner> markets) { + this.markets = markets; + return this; + } + + public GetMarketDetailResponse addMarketsItem(GetMarketDetailResponseMarketsInner marketsItem) { + if (this.markets == null) { + this.markets = new ArrayList<>(); + } + this.markets.add(marketsItem); + return this; + } + + /** + * Get markets + * + * @return markets + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid GetMarketDetailResponseMarketsInner> getMarkets() { + return markets; + } + + public void setMarkets( + @jakarta.annotation.Nullable List<@Valid GetMarketDetailResponseMarketsInner> markets) { + this.markets = markets; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetMarketDetailResponse getMarketDetailResponse = (GetMarketDetailResponse) o; + return Objects.equals(this.marketTopicId, getMarketDetailResponse.marketTopicId) + && Objects.equals(this.vendor, getMarketDetailResponse.vendor) + && Objects.equals(this.chainId, getMarketDetailResponse.chainId) + && Objects.equals(this.slug, getMarketDetailResponse.slug) + && Objects.equals(this.title, getMarketDetailResponse.title) + && Objects.equals(this.question, getMarketDetailResponse.question) + && Objects.equals(this.description, getMarketDetailResponse.description) + && Objects.equals(this.imageUrl, getMarketDetailResponse.imageUrl) + && Objects.equals(this.topicType, getMarketDetailResponse.topicType) + && Objects.equals(this.chartType, getMarketDetailResponse.chartType) + && Objects.equals(this.symbol, getMarketDetailResponse.symbol) + && Objects.equals(this.variantData, getMarketDetailResponse.variantData) + && Objects.equals(this.participantCount, getMarketDetailResponse.participantCount) + && Objects.equals(this.collateral, getMarketDetailResponse.collateral) + && Objects.equals(this.feeRateBps, getMarketDetailResponse.feeRateBps) + && Objects.equals(this.slippageBps, getMarketDetailResponse.slippageBps) + && Objects.equals(this.isYieldBearing, getMarketDetailResponse.isYieldBearing) + && Objects.equals(this.tradeVolume, getMarketDetailResponse.tradeVolume) + && Objects.equals(this.liquidity, getMarketDetailResponse.liquidity) + && Objects.equals(this.publishedAt, getMarketDetailResponse.publishedAt) + && Objects.equals(this.startDate, getMarketDetailResponse.startDate) + && Objects.equals(this.endDate, getMarketDetailResponse.endDate) + && Objects.equals(this.status, getMarketDetailResponse.status) + && Objects.equals(this.timeline, getMarketDetailResponse.timeline) + && Objects.equals(this.markets, getMarketDetailResponse.markets); + } + + @Override + public int hashCode() { + return Objects.hash( + marketTopicId, + vendor, + chainId, + slug, + title, + question, + description, + imageUrl, + topicType, + chartType, + symbol, + variantData, + participantCount, + collateral, + feeRateBps, + slippageBps, + isYieldBearing, + tradeVolume, + liquidity, + publishedAt, + startDate, + endDate, + status, + timeline, + markets); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetMarketDetailResponse {\n"); + sb.append(" marketTopicId: ").append(toIndentedString(marketTopicId)).append("\n"); + sb.append(" vendor: ").append(toIndentedString(vendor)).append("\n"); + sb.append(" chainId: ").append(toIndentedString(chainId)).append("\n"); + sb.append(" slug: ").append(toIndentedString(slug)).append("\n"); + sb.append(" title: ").append(toIndentedString(title)).append("\n"); + sb.append(" question: ").append(toIndentedString(question)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" imageUrl: ").append(toIndentedString(imageUrl)).append("\n"); + sb.append(" topicType: ").append(toIndentedString(topicType)).append("\n"); + sb.append(" chartType: ").append(toIndentedString(chartType)).append("\n"); + sb.append(" symbol: ").append(toIndentedString(symbol)).append("\n"); + sb.append(" variantData: ").append(toIndentedString(variantData)).append("\n"); + sb.append(" participantCount: ").append(toIndentedString(participantCount)).append("\n"); + sb.append(" collateral: ").append(toIndentedString(collateral)).append("\n"); + sb.append(" feeRateBps: ").append(toIndentedString(feeRateBps)).append("\n"); + sb.append(" slippageBps: ").append(toIndentedString(slippageBps)).append("\n"); + sb.append(" isYieldBearing: ").append(toIndentedString(isYieldBearing)).append("\n"); + sb.append(" tradeVolume: ").append(toIndentedString(tradeVolume)).append("\n"); + sb.append(" liquidity: ").append(toIndentedString(liquidity)).append("\n"); + sb.append(" publishedAt: ").append(toIndentedString(publishedAt)).append("\n"); + sb.append(" startDate: ").append(toIndentedString(startDate)).append("\n"); + sb.append(" endDate: ").append(toIndentedString(endDate)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" timeline: ").append(toIndentedString(timeline)).append("\n"); + sb.append(" markets: ").append(toIndentedString(markets)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object marketTopicIdValue = getMarketTopicId(); + String marketTopicIdValueAsString = ""; + marketTopicIdValueAsString = marketTopicIdValue.toString(); + sb.append("marketTopicId=").append(urlEncode(marketTopicIdValueAsString)).append(""); + Object vendorValue = getVendor(); + String vendorValueAsString = ""; + vendorValueAsString = vendorValue.toString(); + sb.append("vendor=").append(urlEncode(vendorValueAsString)).append(""); + Object chainIdValue = getChainId(); + String chainIdValueAsString = ""; + chainIdValueAsString = chainIdValue.toString(); + sb.append("chainId=").append(urlEncode(chainIdValueAsString)).append(""); + Object slugValue = getSlug(); + String slugValueAsString = ""; + slugValueAsString = slugValue.toString(); + sb.append("slug=").append(urlEncode(slugValueAsString)).append(""); + Object titleValue = getTitle(); + String titleValueAsString = ""; + titleValueAsString = titleValue.toString(); + sb.append("title=").append(urlEncode(titleValueAsString)).append(""); + Object questionValue = getQuestion(); + String questionValueAsString = ""; + questionValueAsString = questionValue.toString(); + sb.append("question=").append(urlEncode(questionValueAsString)).append(""); + Object descriptionValue = getDescription(); + String descriptionValueAsString = ""; + descriptionValueAsString = descriptionValue.toString(); + sb.append("description=").append(urlEncode(descriptionValueAsString)).append(""); + Object imageUrlValue = getImageUrl(); + String imageUrlValueAsString = ""; + imageUrlValueAsString = imageUrlValue.toString(); + sb.append("imageUrl=").append(urlEncode(imageUrlValueAsString)).append(""); + Object topicTypeValue = getTopicType(); + String topicTypeValueAsString = ""; + topicTypeValueAsString = topicTypeValue.toString(); + sb.append("topicType=").append(urlEncode(topicTypeValueAsString)).append(""); + Object chartTypeValue = getChartType(); + String chartTypeValueAsString = ""; + chartTypeValueAsString = chartTypeValue.toString(); + sb.append("chartType=").append(urlEncode(chartTypeValueAsString)).append(""); + Object symbolValue = getSymbol(); + String symbolValueAsString = ""; + symbolValueAsString = symbolValue.toString(); + sb.append("symbol=").append(urlEncode(symbolValueAsString)).append(""); + Object variantDataValue = getVariantData(); + String variantDataValueAsString = ""; + variantDataValueAsString = variantDataValue.toString(); + sb.append("variantData=").append(urlEncode(variantDataValueAsString)).append(""); + Object participantCountValue = getParticipantCount(); + String participantCountValueAsString = ""; + participantCountValueAsString = participantCountValue.toString(); + sb.append("participantCount=").append(urlEncode(participantCountValueAsString)).append(""); + Object collateralValue = getCollateral(); + String collateralValueAsString = ""; + collateralValueAsString = collateralValue.toString(); + sb.append("collateral=").append(urlEncode(collateralValueAsString)).append(""); + Object feeRateBpsValue = getFeeRateBps(); + String feeRateBpsValueAsString = ""; + feeRateBpsValueAsString = feeRateBpsValue.toString(); + sb.append("feeRateBps=").append(urlEncode(feeRateBpsValueAsString)).append(""); + Object slippageBpsValue = getSlippageBps(); + String slippageBpsValueAsString = ""; + slippageBpsValueAsString = slippageBpsValue.toString(); + sb.append("slippageBps=").append(urlEncode(slippageBpsValueAsString)).append(""); + Object isYieldBearingValue = getIsYieldBearing(); + String isYieldBearingValueAsString = ""; + isYieldBearingValueAsString = isYieldBearingValue.toString(); + sb.append("isYieldBearing=").append(urlEncode(isYieldBearingValueAsString)).append(""); + Object tradeVolumeValue = getTradeVolume(); + String tradeVolumeValueAsString = ""; + tradeVolumeValueAsString = tradeVolumeValue.toString(); + sb.append("tradeVolume=").append(urlEncode(tradeVolumeValueAsString)).append(""); + Object liquidityValue = getLiquidity(); + String liquidityValueAsString = ""; + liquidityValueAsString = liquidityValue.toString(); + sb.append("liquidity=").append(urlEncode(liquidityValueAsString)).append(""); + Object publishedAtValue = getPublishedAt(); + String publishedAtValueAsString = ""; + publishedAtValueAsString = publishedAtValue.toString(); + sb.append("publishedAt=").append(urlEncode(publishedAtValueAsString)).append(""); + Object startDateValue = getStartDate(); + String startDateValueAsString = ""; + startDateValueAsString = startDateValue.toString(); + sb.append("startDate=").append(urlEncode(startDateValueAsString)).append(""); + Object endDateValue = getEndDate(); + String endDateValueAsString = ""; + endDateValueAsString = endDateValue.toString(); + sb.append("endDate=").append(urlEncode(endDateValueAsString)).append(""); + Object statusValue = getStatus(); + String statusValueAsString = ""; + statusValueAsString = statusValue.toString(); + sb.append("status=").append(urlEncode(statusValueAsString)).append(""); + Object timelineValue = getTimeline(); + String timelineValueAsString = ""; + timelineValueAsString = + (String) + ((Collection) timelineValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("timeline=").append(urlEncode(timelineValueAsString)).append(""); + Object marketsValue = getMarkets(); + String marketsValueAsString = ""; + marketsValueAsString = + (String) + ((Collection) marketsValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("markets=").append(urlEncode(marketsValueAsString)).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("marketTopicId"); + openapiFields.add("vendor"); + openapiFields.add("chainId"); + openapiFields.add("slug"); + openapiFields.add("title"); + openapiFields.add("question"); + openapiFields.add("description"); + openapiFields.add("imageUrl"); + openapiFields.add("topicType"); + openapiFields.add("chartType"); + openapiFields.add("symbol"); + openapiFields.add("variantData"); + openapiFields.add("participantCount"); + openapiFields.add("collateral"); + openapiFields.add("feeRateBps"); + openapiFields.add("slippageBps"); + openapiFields.add("isYieldBearing"); + openapiFields.add("tradeVolume"); + openapiFields.add("liquidity"); + openapiFields.add("publishedAt"); + openapiFields.add("startDate"); + openapiFields.add("endDate"); + openapiFields.add("status"); + openapiFields.add("timeline"); + openapiFields.add("markets"); + + // 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 GetMarketDetailResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetMarketDetailResponse.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetMarketDetailResponse is not found" + + " in the empty JSON string", + GetMarketDetailResponse.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("vendor") != null && !jsonObj.get("vendor").isJsonNull()) + && !jsonObj.get("vendor").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `vendor` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("vendor").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("slug") != null && !jsonObj.get("slug").isJsonNull()) + && !jsonObj.get("slug").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `slug` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("slug").toString())); + } + if ((jsonObj.get("title") != null && !jsonObj.get("title").isJsonNull()) + && !jsonObj.get("title").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `title` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("title").toString())); + } + if ((jsonObj.get("question") != null && !jsonObj.get("question").isJsonNull()) + && !jsonObj.get("question").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `question` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("question").toString())); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) + && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `description` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("description").toString())); + } + if ((jsonObj.get("imageUrl") != null && !jsonObj.get("imageUrl").isJsonNull()) + && !jsonObj.get("imageUrl").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `imageUrl` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("imageUrl").toString())); + } + if ((jsonObj.get("topicType") != null && !jsonObj.get("topicType").isJsonNull()) + && !jsonObj.get("topicType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `topicType` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("topicType").toString())); + } + if ((jsonObj.get("chartType") != null && !jsonObj.get("chartType").isJsonNull()) + && !jsonObj.get("chartType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `chartType` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("chartType").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())); + } + // validate the optional field `variantData` + if (jsonObj.get("variantData") != null && !jsonObj.get("variantData").isJsonNull()) { + GetMarketDetailResponseVariantData.validateJsonElement(jsonObj.get("variantData")); + } + if ((jsonObj.get("collateral") != null && !jsonObj.get("collateral").isJsonNull()) + && !jsonObj.get("collateral").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `collateral` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("collateral").toString())); + } + if ((jsonObj.get("tradeVolume") != null && !jsonObj.get("tradeVolume").isJsonNull()) + && !jsonObj.get("tradeVolume").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `tradeVolume` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("tradeVolume").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("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("timeline") != null && !jsonObj.get("timeline").isJsonNull()) { + JsonArray jsonArraytimeline = jsonObj.getAsJsonArray("timeline"); + if (jsonArraytimeline != null) { + // ensure the json data is an array + if (!jsonObj.get("timeline").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `timeline` to be an array in the JSON" + + " string but got `%s`", + jsonObj.get("timeline").toString())); + } + + // validate the optional field `timeline` (array) + for (int i = 0; i < jsonArraytimeline.size(); i++) { + GetMarketDetailResponseTimelineInner.validateJsonElement( + jsonArraytimeline.get(i)); + } + ; + } + } + if (jsonObj.get("markets") != null && !jsonObj.get("markets").isJsonNull()) { + JsonArray jsonArraymarkets = jsonObj.getAsJsonArray("markets"); + if (jsonArraymarkets != null) { + // ensure the json data is an array + if (!jsonObj.get("markets").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `markets` to be an array in the JSON string" + + " but got `%s`", + jsonObj.get("markets").toString())); + } + + // validate the optional field `markets` (array) + for (int i = 0; i < jsonArraymarkets.size(); i++) { + GetMarketDetailResponseMarketsInner.validateJsonElement( + jsonArraymarkets.get(i)); + } + ; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetMarketDetailResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetMarketDetailResponse' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(GetMarketDetailResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetMarketDetailResponse value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetMarketDetailResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetMarketDetailResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetMarketDetailResponse + * @throws IOException if the JSON string is invalid with respect to GetMarketDetailResponse + */ + public static GetMarketDetailResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetMarketDetailResponse.class); + } + + /** + * Convert an instance of GetMarketDetailResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/GetMarketDetailResponseMarketsInner.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/GetMarketDetailResponseMarketsInner.java new file mode 100644 index 000000000..38dddc7fe --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/GetMarketDetailResponseMarketsInner.java @@ -0,0 +1,700 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.model; + +import com.binance.connector.client.w3w_prediction.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.*; + +/** GetMarketDetailResponseMarketsInner */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class GetMarketDetailResponseMarketsInner { + public static final String SERIALIZED_NAME_MARKET_ID = "marketId"; + + @SerializedName(SERIALIZED_NAME_MARKET_ID) + @jakarta.annotation.Nullable + private Long marketId; + + public static final String SERIALIZED_NAME_EXTERNAL_ID = "externalId"; + + @SerializedName(SERIALIZED_NAME_EXTERNAL_ID) + @jakarta.annotation.Nullable + private String externalId; + + public static final String SERIALIZED_NAME_TITLE = "title"; + + @SerializedName(SERIALIZED_NAME_TITLE) + @jakarta.annotation.Nullable + private String title; + + public static final String SERIALIZED_NAME_QUESTION = "question"; + + @SerializedName(SERIALIZED_NAME_QUESTION) + @jakarta.annotation.Nullable + private String question; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @jakarta.annotation.Nullable + private String description; + + public static final String SERIALIZED_NAME_CONDITION_ID = "conditionId"; + + @SerializedName(SERIALIZED_NAME_CONDITION_ID) + @jakarta.annotation.Nullable + private String conditionId; + + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + @jakarta.annotation.Nullable + private String status; + + public static final String SERIALIZED_NAME_TRADING_STATUS = "tradingStatus"; + + @SerializedName(SERIALIZED_NAME_TRADING_STATUS) + @jakarta.annotation.Nullable + private String tradingStatus; + + public static final String SERIALIZED_NAME_TRADE_VOLUME = "tradeVolume"; + + @SerializedName(SERIALIZED_NAME_TRADE_VOLUME) + @jakarta.annotation.Nullable + private String tradeVolume; + + public static final String SERIALIZED_NAME_LIQUIDITY = "liquidity"; + + @SerializedName(SERIALIZED_NAME_LIQUIDITY) + @jakarta.annotation.Nullable + private String liquidity; + + public static final String SERIALIZED_NAME_DECIMAL_PRECISION = "decimalPrecision"; + + @SerializedName(SERIALIZED_NAME_DECIMAL_PRECISION) + @jakarta.annotation.Nullable + private Integer decimalPrecision; + + public static final String SERIALIZED_NAME_OUTCOMES = "outcomes"; + + @SerializedName(SERIALIZED_NAME_OUTCOMES) + @jakarta.annotation.Nullable + private List<@Valid GetMarketDetailResponseMarketsInnerOutcomesInner> outcomes; + + public GetMarketDetailResponseMarketsInner() {} + + public GetMarketDetailResponseMarketsInner marketId( + @jakarta.annotation.Nullable Long marketId) { + this.marketId = marketId; + return this; + } + + /** + * Get marketId + * + * @return marketId + */ + @jakarta.annotation.Nullable + public Long getMarketId() { + return marketId; + } + + public void setMarketId(@jakarta.annotation.Nullable Long marketId) { + this.marketId = marketId; + } + + public GetMarketDetailResponseMarketsInner externalId( + @jakarta.annotation.Nullable String externalId) { + this.externalId = externalId; + return this; + } + + /** + * Get externalId + * + * @return externalId + */ + @jakarta.annotation.Nullable + public String getExternalId() { + return externalId; + } + + public void setExternalId(@jakarta.annotation.Nullable String externalId) { + this.externalId = externalId; + } + + public GetMarketDetailResponseMarketsInner title(@jakarta.annotation.Nullable String title) { + this.title = title; + return this; + } + + /** + * Get title + * + * @return title + */ + @jakarta.annotation.Nullable + public String getTitle() { + return title; + } + + public void setTitle(@jakarta.annotation.Nullable String title) { + this.title = title; + } + + public GetMarketDetailResponseMarketsInner question( + @jakarta.annotation.Nullable String question) { + this.question = question; + return this; + } + + /** + * Get question + * + * @return question + */ + @jakarta.annotation.Nullable + public String getQuestion() { + return question; + } + + public void setQuestion(@jakarta.annotation.Nullable String question) { + this.question = question; + } + + public GetMarketDetailResponseMarketsInner description( + @jakarta.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Get description + * + * @return description + */ + @jakarta.annotation.Nullable + public String getDescription() { + return description; + } + + public void setDescription(@jakarta.annotation.Nullable String description) { + this.description = description; + } + + public GetMarketDetailResponseMarketsInner conditionId( + @jakarta.annotation.Nullable String conditionId) { + this.conditionId = conditionId; + return this; + } + + /** + * Get conditionId + * + * @return conditionId + */ + @jakarta.annotation.Nullable + public String getConditionId() { + return conditionId; + } + + public void setConditionId(@jakarta.annotation.Nullable String conditionId) { + this.conditionId = conditionId; + } + + public GetMarketDetailResponseMarketsInner 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 GetMarketDetailResponseMarketsInner tradingStatus( + @jakarta.annotation.Nullable String tradingStatus) { + this.tradingStatus = tradingStatus; + return this; + } + + /** + * Get tradingStatus + * + * @return tradingStatus + */ + @jakarta.annotation.Nullable + public String getTradingStatus() { + return tradingStatus; + } + + public void setTradingStatus(@jakarta.annotation.Nullable String tradingStatus) { + this.tradingStatus = tradingStatus; + } + + public GetMarketDetailResponseMarketsInner tradeVolume( + @jakarta.annotation.Nullable String tradeVolume) { + this.tradeVolume = tradeVolume; + return this; + } + + /** + * Get tradeVolume + * + * @return tradeVolume + */ + @jakarta.annotation.Nullable + public String getTradeVolume() { + return tradeVolume; + } + + public void setTradeVolume(@jakarta.annotation.Nullable String tradeVolume) { + this.tradeVolume = tradeVolume; + } + + public GetMarketDetailResponseMarketsInner 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 GetMarketDetailResponseMarketsInner decimalPrecision( + @jakarta.annotation.Nullable Integer decimalPrecision) { + this.decimalPrecision = decimalPrecision; + return this; + } + + /** + * Get decimalPrecision + * + * @return decimalPrecision + */ + @jakarta.annotation.Nullable + public Integer getDecimalPrecision() { + return decimalPrecision; + } + + public void setDecimalPrecision(@jakarta.annotation.Nullable Integer decimalPrecision) { + this.decimalPrecision = decimalPrecision; + } + + public GetMarketDetailResponseMarketsInner outcomes( + @jakarta.annotation.Nullable + List<@Valid GetMarketDetailResponseMarketsInnerOutcomesInner> outcomes) { + this.outcomes = outcomes; + return this; + } + + public GetMarketDetailResponseMarketsInner addOutcomesItem( + GetMarketDetailResponseMarketsInnerOutcomesInner outcomesItem) { + if (this.outcomes == null) { + this.outcomes = new ArrayList<>(); + } + this.outcomes.add(outcomesItem); + return this; + } + + /** + * Get outcomes + * + * @return outcomes + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid GetMarketDetailResponseMarketsInnerOutcomesInner> getOutcomes() { + return outcomes; + } + + public void setOutcomes( + @jakarta.annotation.Nullable + List<@Valid GetMarketDetailResponseMarketsInnerOutcomesInner> outcomes) { + this.outcomes = outcomes; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetMarketDetailResponseMarketsInner getMarketDetailResponseMarketsInner = + (GetMarketDetailResponseMarketsInner) o; + return Objects.equals(this.marketId, getMarketDetailResponseMarketsInner.marketId) + && Objects.equals(this.externalId, getMarketDetailResponseMarketsInner.externalId) + && Objects.equals(this.title, getMarketDetailResponseMarketsInner.title) + && Objects.equals(this.question, getMarketDetailResponseMarketsInner.question) + && Objects.equals(this.description, getMarketDetailResponseMarketsInner.description) + && Objects.equals(this.conditionId, getMarketDetailResponseMarketsInner.conditionId) + && Objects.equals(this.status, getMarketDetailResponseMarketsInner.status) + && Objects.equals( + this.tradingStatus, getMarketDetailResponseMarketsInner.tradingStatus) + && Objects.equals(this.tradeVolume, getMarketDetailResponseMarketsInner.tradeVolume) + && Objects.equals(this.liquidity, getMarketDetailResponseMarketsInner.liquidity) + && Objects.equals( + this.decimalPrecision, getMarketDetailResponseMarketsInner.decimalPrecision) + && Objects.equals(this.outcomes, getMarketDetailResponseMarketsInner.outcomes); + } + + @Override + public int hashCode() { + return Objects.hash( + marketId, + externalId, + title, + question, + description, + conditionId, + status, + tradingStatus, + tradeVolume, + liquidity, + decimalPrecision, + outcomes); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetMarketDetailResponseMarketsInner {\n"); + sb.append(" marketId: ").append(toIndentedString(marketId)).append("\n"); + sb.append(" externalId: ").append(toIndentedString(externalId)).append("\n"); + sb.append(" title: ").append(toIndentedString(title)).append("\n"); + sb.append(" question: ").append(toIndentedString(question)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" conditionId: ").append(toIndentedString(conditionId)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" tradingStatus: ").append(toIndentedString(tradingStatus)).append("\n"); + sb.append(" tradeVolume: ").append(toIndentedString(tradeVolume)).append("\n"); + sb.append(" liquidity: ").append(toIndentedString(liquidity)).append("\n"); + sb.append(" decimalPrecision: ").append(toIndentedString(decimalPrecision)).append("\n"); + sb.append(" outcomes: ").append(toIndentedString(outcomes)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object marketIdValue = getMarketId(); + String marketIdValueAsString = ""; + marketIdValueAsString = marketIdValue.toString(); + sb.append("marketId=").append(urlEncode(marketIdValueAsString)).append(""); + Object externalIdValue = getExternalId(); + String externalIdValueAsString = ""; + externalIdValueAsString = externalIdValue.toString(); + sb.append("externalId=").append(urlEncode(externalIdValueAsString)).append(""); + Object titleValue = getTitle(); + String titleValueAsString = ""; + titleValueAsString = titleValue.toString(); + sb.append("title=").append(urlEncode(titleValueAsString)).append(""); + Object questionValue = getQuestion(); + String questionValueAsString = ""; + questionValueAsString = questionValue.toString(); + sb.append("question=").append(urlEncode(questionValueAsString)).append(""); + Object descriptionValue = getDescription(); + String descriptionValueAsString = ""; + descriptionValueAsString = descriptionValue.toString(); + sb.append("description=").append(urlEncode(descriptionValueAsString)).append(""); + Object conditionIdValue = getConditionId(); + String conditionIdValueAsString = ""; + conditionIdValueAsString = conditionIdValue.toString(); + sb.append("conditionId=").append(urlEncode(conditionIdValueAsString)).append(""); + Object statusValue = getStatus(); + String statusValueAsString = ""; + statusValueAsString = statusValue.toString(); + sb.append("status=").append(urlEncode(statusValueAsString)).append(""); + Object tradingStatusValue = getTradingStatus(); + String tradingStatusValueAsString = ""; + tradingStatusValueAsString = tradingStatusValue.toString(); + sb.append("tradingStatus=").append(urlEncode(tradingStatusValueAsString)).append(""); + Object tradeVolumeValue = getTradeVolume(); + String tradeVolumeValueAsString = ""; + tradeVolumeValueAsString = tradeVolumeValue.toString(); + sb.append("tradeVolume=").append(urlEncode(tradeVolumeValueAsString)).append(""); + Object liquidityValue = getLiquidity(); + String liquidityValueAsString = ""; + liquidityValueAsString = liquidityValue.toString(); + sb.append("liquidity=").append(urlEncode(liquidityValueAsString)).append(""); + Object decimalPrecisionValue = getDecimalPrecision(); + String decimalPrecisionValueAsString = ""; + decimalPrecisionValueAsString = decimalPrecisionValue.toString(); + sb.append("decimalPrecision=").append(urlEncode(decimalPrecisionValueAsString)).append(""); + Object outcomesValue = getOutcomes(); + String outcomesValueAsString = ""; + outcomesValueAsString = + (String) + ((Collection) outcomesValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("outcomes=").append(urlEncode(outcomesValueAsString)).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("marketId"); + openapiFields.add("externalId"); + openapiFields.add("title"); + openapiFields.add("question"); + openapiFields.add("description"); + openapiFields.add("conditionId"); + openapiFields.add("status"); + openapiFields.add("tradingStatus"); + openapiFields.add("tradeVolume"); + openapiFields.add("liquidity"); + openapiFields.add("decimalPrecision"); + openapiFields.add("outcomes"); + + // 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 + * GetMarketDetailResponseMarketsInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetMarketDetailResponseMarketsInner.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetMarketDetailResponseMarketsInner is" + + " not found in the empty JSON string", + GetMarketDetailResponseMarketsInner.openapiRequiredFields + .toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("externalId") != null && !jsonObj.get("externalId").isJsonNull()) + && !jsonObj.get("externalId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `externalId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("externalId").toString())); + } + if ((jsonObj.get("title") != null && !jsonObj.get("title").isJsonNull()) + && !jsonObj.get("title").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `title` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("title").toString())); + } + if ((jsonObj.get("question") != null && !jsonObj.get("question").isJsonNull()) + && !jsonObj.get("question").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `question` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("question").toString())); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) + && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `description` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("description").toString())); + } + if ((jsonObj.get("conditionId") != null && !jsonObj.get("conditionId").isJsonNull()) + && !jsonObj.get("conditionId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `conditionId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("conditionId").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("tradingStatus") != null && !jsonObj.get("tradingStatus").isJsonNull()) + && !jsonObj.get("tradingStatus").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `tradingStatus` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("tradingStatus").toString())); + } + if ((jsonObj.get("tradeVolume") != null && !jsonObj.get("tradeVolume").isJsonNull()) + && !jsonObj.get("tradeVolume").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `tradeVolume` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("tradeVolume").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("outcomes") != null && !jsonObj.get("outcomes").isJsonNull()) { + JsonArray jsonArrayoutcomes = jsonObj.getAsJsonArray("outcomes"); + if (jsonArrayoutcomes != null) { + // ensure the json data is an array + if (!jsonObj.get("outcomes").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `outcomes` to be an array in the JSON" + + " string but got `%s`", + jsonObj.get("outcomes").toString())); + } + + // validate the optional field `outcomes` (array) + for (int i = 0; i < jsonArrayoutcomes.size(); i++) { + GetMarketDetailResponseMarketsInnerOutcomesInner.validateJsonElement( + jsonArrayoutcomes.get(i)); + } + ; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetMarketDetailResponseMarketsInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetMarketDetailResponseMarketsInner' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(GetMarketDetailResponseMarketsInner.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetMarketDetailResponseMarketsInner value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetMarketDetailResponseMarketsInner read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetMarketDetailResponseMarketsInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetMarketDetailResponseMarketsInner + * @throws IOException if the JSON string is invalid with respect to + * GetMarketDetailResponseMarketsInner + */ + public static GetMarketDetailResponseMarketsInner fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, GetMarketDetailResponseMarketsInner.class); + } + + /** + * Convert an instance of GetMarketDetailResponseMarketsInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/GetMarketDetailResponseMarketsInnerOutcomesInner.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/GetMarketDetailResponseMarketsInnerOutcomesInner.java new file mode 100644 index 000000000..33cfef681 --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/GetMarketDetailResponseMarketsInnerOutcomesInner.java @@ -0,0 +1,387 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.model; + +import com.binance.connector.client.w3w_prediction.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.*; + +/** GetMarketDetailResponseMarketsInnerOutcomesInner */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class GetMarketDetailResponseMarketsInnerOutcomesInner { + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @jakarta.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_PRICE = "price"; + + @SerializedName(SERIALIZED_NAME_PRICE) + @jakarta.annotation.Nullable + private String price; + + public static final String SERIALIZED_NAME_CHANCE = "chance"; + + @SerializedName(SERIALIZED_NAME_CHANCE) + @jakarta.annotation.Nullable + private String chance; + + public static final String SERIALIZED_NAME_INDEX = "index"; + + @SerializedName(SERIALIZED_NAME_INDEX) + @jakarta.annotation.Nullable + private Integer index; + + public static final String SERIALIZED_NAME_TOKEN_ID = "tokenId"; + + @SerializedName(SERIALIZED_NAME_TOKEN_ID) + @jakarta.annotation.Nullable + private String tokenId; + + public GetMarketDetailResponseMarketsInnerOutcomesInner() {} + + public GetMarketDetailResponseMarketsInnerOutcomesInner 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 GetMarketDetailResponseMarketsInnerOutcomesInner 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 GetMarketDetailResponseMarketsInnerOutcomesInner chance( + @jakarta.annotation.Nullable String chance) { + this.chance = chance; + return this; + } + + /** + * Get chance + * + * @return chance + */ + @jakarta.annotation.Nullable + public String getChance() { + return chance; + } + + public void setChance(@jakarta.annotation.Nullable String chance) { + this.chance = chance; + } + + public GetMarketDetailResponseMarketsInnerOutcomesInner index( + @jakarta.annotation.Nullable Integer index) { + this.index = index; + return this; + } + + /** + * Get index + * + * @return index + */ + @jakarta.annotation.Nullable + public Integer getIndex() { + return index; + } + + public void setIndex(@jakarta.annotation.Nullable Integer index) { + this.index = index; + } + + public GetMarketDetailResponseMarketsInnerOutcomesInner 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; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetMarketDetailResponseMarketsInnerOutcomesInner + getMarketDetailResponseMarketsInnerOutcomesInner = + (GetMarketDetailResponseMarketsInnerOutcomesInner) o; + return Objects.equals(this.name, getMarketDetailResponseMarketsInnerOutcomesInner.name) + && Objects.equals( + this.price, getMarketDetailResponseMarketsInnerOutcomesInner.price) + && Objects.equals( + this.chance, getMarketDetailResponseMarketsInnerOutcomesInner.chance) + && Objects.equals( + this.index, getMarketDetailResponseMarketsInnerOutcomesInner.index) + && Objects.equals( + this.tokenId, getMarketDetailResponseMarketsInnerOutcomesInner.tokenId); + } + + @Override + public int hashCode() { + return Objects.hash(name, price, chance, index, tokenId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetMarketDetailResponseMarketsInnerOutcomesInner {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" price: ").append(toIndentedString(price)).append("\n"); + sb.append(" chance: ").append(toIndentedString(chance)).append("\n"); + sb.append(" index: ").append(toIndentedString(index)).append("\n"); + sb.append(" tokenId: ").append(toIndentedString(tokenId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object nameValue = getName(); + String nameValueAsString = ""; + nameValueAsString = nameValue.toString(); + sb.append("name=").append(urlEncode(nameValueAsString)).append(""); + Object priceValue = getPrice(); + String priceValueAsString = ""; + priceValueAsString = priceValue.toString(); + sb.append("price=").append(urlEncode(priceValueAsString)).append(""); + Object chanceValue = getChance(); + String chanceValueAsString = ""; + chanceValueAsString = chanceValue.toString(); + sb.append("chance=").append(urlEncode(chanceValueAsString)).append(""); + Object indexValue = getIndex(); + String indexValueAsString = ""; + indexValueAsString = indexValue.toString(); + sb.append("index=").append(urlEncode(indexValueAsString)).append(""); + Object tokenIdValue = getTokenId(); + String tokenIdValueAsString = ""; + tokenIdValueAsString = tokenIdValue.toString(); + sb.append("tokenId=").append(urlEncode(tokenIdValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("price"); + openapiFields.add("chance"); + openapiFields.add("index"); + openapiFields.add("tokenId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetMarketDetailResponseMarketsInnerOutcomesInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetMarketDetailResponseMarketsInnerOutcomesInner.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " GetMarketDetailResponseMarketsInnerOutcomesInner is not" + + " found in the empty JSON string", + GetMarketDetailResponseMarketsInnerOutcomesInner + .openapiRequiredFields + .toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) + && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `name` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("name").toString())); + } + if ((jsonObj.get("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("chance") != null && !jsonObj.get("chance").isJsonNull()) + && !jsonObj.get("chance").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `chance` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("chance").toString())); + } + if ((jsonObj.get("tokenId") != null && !jsonObj.get("tokenId").isJsonNull()) + && !jsonObj.get("tokenId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `tokenId` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("tokenId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetMarketDetailResponseMarketsInnerOutcomesInner.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'GetMarketDetailResponseMarketsInnerOutcomesInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, + TypeToken.get(GetMarketDetailResponseMarketsInnerOutcomesInner.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, + GetMarketDetailResponseMarketsInnerOutcomesInner value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetMarketDetailResponseMarketsInnerOutcomesInner read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetMarketDetailResponseMarketsInnerOutcomesInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetMarketDetailResponseMarketsInnerOutcomesInner + * @throws IOException if the JSON string is invalid with respect to + * GetMarketDetailResponseMarketsInnerOutcomesInner + */ + public static GetMarketDetailResponseMarketsInnerOutcomesInner fromJson(String jsonString) + throws IOException { + return JSON.getGson() + .fromJson(jsonString, GetMarketDetailResponseMarketsInnerOutcomesInner.class); + } + + /** + * Convert an instance of GetMarketDetailResponseMarketsInnerOutcomesInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/GetMarketDetailResponseTimelineInner.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/GetMarketDetailResponseTimelineInner.java new file mode 100644 index 000000000..a35b36dcc --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/GetMarketDetailResponseTimelineInner.java @@ -0,0 +1,278 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.model; + +import com.binance.connector.client.w3w_prediction.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.*; + +/** GetMarketDetailResponseTimelineInner */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class GetMarketDetailResponseTimelineInner { + public static final String SERIALIZED_NAME_MARKET_TOPIC_ID = "marketTopicId"; + + @SerializedName(SERIALIZED_NAME_MARKET_TOPIC_ID) + @jakarta.annotation.Nullable + private Long marketTopicId; + + public static final String SERIALIZED_NAME_START_DATE = "startDate"; + + @SerializedName(SERIALIZED_NAME_START_DATE) + @jakarta.annotation.Nullable + private Long startDate; + + public static final String SERIALIZED_NAME_END_DATE = "endDate"; + + @SerializedName(SERIALIZED_NAME_END_DATE) + @jakarta.annotation.Nullable + private Long endDate; + + public GetMarketDetailResponseTimelineInner() {} + + public GetMarketDetailResponseTimelineInner marketTopicId( + @jakarta.annotation.Nullable Long marketTopicId) { + this.marketTopicId = marketTopicId; + return this; + } + + /** + * Get marketTopicId + * + * @return marketTopicId + */ + @jakarta.annotation.Nullable + public Long getMarketTopicId() { + return marketTopicId; + } + + public void setMarketTopicId(@jakarta.annotation.Nullable Long marketTopicId) { + this.marketTopicId = marketTopicId; + } + + public GetMarketDetailResponseTimelineInner startDate( + @jakarta.annotation.Nullable Long startDate) { + this.startDate = startDate; + return this; + } + + /** + * Get startDate + * + * @return startDate + */ + @jakarta.annotation.Nullable + public Long getStartDate() { + return startDate; + } + + public void setStartDate(@jakarta.annotation.Nullable Long startDate) { + this.startDate = startDate; + } + + public GetMarketDetailResponseTimelineInner endDate(@jakarta.annotation.Nullable Long endDate) { + this.endDate = endDate; + return this; + } + + /** + * Get endDate + * + * @return endDate + */ + @jakarta.annotation.Nullable + public Long getEndDate() { + return endDate; + } + + public void setEndDate(@jakarta.annotation.Nullable Long endDate) { + this.endDate = endDate; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetMarketDetailResponseTimelineInner getMarketDetailResponseTimelineInner = + (GetMarketDetailResponseTimelineInner) o; + return Objects.equals( + this.marketTopicId, getMarketDetailResponseTimelineInner.marketTopicId) + && Objects.equals(this.startDate, getMarketDetailResponseTimelineInner.startDate) + && Objects.equals(this.endDate, getMarketDetailResponseTimelineInner.endDate); + } + + @Override + public int hashCode() { + return Objects.hash(marketTopicId, startDate, endDate); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetMarketDetailResponseTimelineInner {\n"); + sb.append(" marketTopicId: ").append(toIndentedString(marketTopicId)).append("\n"); + sb.append(" startDate: ").append(toIndentedString(startDate)).append("\n"); + sb.append(" endDate: ").append(toIndentedString(endDate)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object marketTopicIdValue = getMarketTopicId(); + String marketTopicIdValueAsString = ""; + marketTopicIdValueAsString = marketTopicIdValue.toString(); + sb.append("marketTopicId=").append(urlEncode(marketTopicIdValueAsString)).append(""); + Object startDateValue = getStartDate(); + String startDateValueAsString = ""; + startDateValueAsString = startDateValue.toString(); + sb.append("startDate=").append(urlEncode(startDateValueAsString)).append(""); + Object endDateValue = getEndDate(); + String endDateValueAsString = ""; + endDateValueAsString = endDateValue.toString(); + sb.append("endDate=").append(urlEncode(endDateValueAsString)).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("marketTopicId"); + openapiFields.add("startDate"); + openapiFields.add("endDate"); + + // 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 + * GetMarketDetailResponseTimelineInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetMarketDetailResponseTimelineInner.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetMarketDetailResponseTimelineInner" + + " is not found in the empty JSON string", + GetMarketDetailResponseTimelineInner.openapiRequiredFields + .toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetMarketDetailResponseTimelineInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetMarketDetailResponseTimelineInner' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(GetMarketDetailResponseTimelineInner.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, GetMarketDetailResponseTimelineInner value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetMarketDetailResponseTimelineInner read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetMarketDetailResponseTimelineInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetMarketDetailResponseTimelineInner + * @throws IOException if the JSON string is invalid with respect to + * GetMarketDetailResponseTimelineInner + */ + public static GetMarketDetailResponseTimelineInner fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, GetMarketDetailResponseTimelineInner.class); + } + + /** + * Convert an instance of GetMarketDetailResponseTimelineInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/GetMarketDetailResponseVariantData.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/GetMarketDetailResponseVariantData.java new file mode 100644 index 000000000..ba2787a47 --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/GetMarketDetailResponseVariantData.java @@ -0,0 +1,448 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.model; + +import com.binance.connector.client.w3w_prediction.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** GetMarketDetailResponseVariantData */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class GetMarketDetailResponseVariantData { + public static final String SERIALIZED_NAME_TYPE = "type"; + + @SerializedName(SERIALIZED_NAME_TYPE) + @jakarta.annotation.Nullable + private String type; + + public static final String SERIALIZED_NAME_START_PRICE = "startPrice"; + + @SerializedName(SERIALIZED_NAME_START_PRICE) + @jakarta.annotation.Nullable + private String startPrice; + + public static final String SERIALIZED_NAME_END_PRICE = "endPrice"; + + @SerializedName(SERIALIZED_NAME_END_PRICE) + @jakarta.annotation.Nullable + private String endPrice; + + public static final String SERIALIZED_NAME_PRICE_FEED_ID = "priceFeedId"; + + @SerializedName(SERIALIZED_NAME_PRICE_FEED_ID) + @jakarta.annotation.Nullable + private String priceFeedId; + + public static final String SERIALIZED_NAME_PRICE_FEED_PROVIDER = "priceFeedProvider"; + + @SerializedName(SERIALIZED_NAME_PRICE_FEED_PROVIDER) + @jakarta.annotation.Nullable + private String priceFeedProvider; + + public static final String SERIALIZED_NAME_PRICE_FEED_SYMBOL = "priceFeedSymbol"; + + @SerializedName(SERIALIZED_NAME_PRICE_FEED_SYMBOL) + @jakarta.annotation.Nullable + private String priceFeedSymbol; + + public GetMarketDetailResponseVariantData() {} + + public GetMarketDetailResponseVariantData type(@jakarta.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * + * @return type + */ + @jakarta.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@jakarta.annotation.Nullable String type) { + this.type = type; + } + + public GetMarketDetailResponseVariantData startPrice( + @jakarta.annotation.Nullable String startPrice) { + this.startPrice = startPrice; + return this; + } + + /** + * Get startPrice + * + * @return startPrice + */ + @jakarta.annotation.Nullable + public String getStartPrice() { + return startPrice; + } + + public void setStartPrice(@jakarta.annotation.Nullable String startPrice) { + this.startPrice = startPrice; + } + + public GetMarketDetailResponseVariantData endPrice( + @jakarta.annotation.Nullable String endPrice) { + this.endPrice = endPrice; + return this; + } + + /** + * Get endPrice + * + * @return endPrice + */ + @jakarta.annotation.Nullable + public String getEndPrice() { + return endPrice; + } + + public void setEndPrice(@jakarta.annotation.Nullable String endPrice) { + this.endPrice = endPrice; + } + + public GetMarketDetailResponseVariantData priceFeedId( + @jakarta.annotation.Nullable String priceFeedId) { + this.priceFeedId = priceFeedId; + return this; + } + + /** + * Get priceFeedId + * + * @return priceFeedId + */ + @jakarta.annotation.Nullable + public String getPriceFeedId() { + return priceFeedId; + } + + public void setPriceFeedId(@jakarta.annotation.Nullable String priceFeedId) { + this.priceFeedId = priceFeedId; + } + + public GetMarketDetailResponseVariantData priceFeedProvider( + @jakarta.annotation.Nullable String priceFeedProvider) { + this.priceFeedProvider = priceFeedProvider; + return this; + } + + /** + * Get priceFeedProvider + * + * @return priceFeedProvider + */ + @jakarta.annotation.Nullable + public String getPriceFeedProvider() { + return priceFeedProvider; + } + + public void setPriceFeedProvider(@jakarta.annotation.Nullable String priceFeedProvider) { + this.priceFeedProvider = priceFeedProvider; + } + + public GetMarketDetailResponseVariantData priceFeedSymbol( + @jakarta.annotation.Nullable String priceFeedSymbol) { + this.priceFeedSymbol = priceFeedSymbol; + return this; + } + + /** + * Get priceFeedSymbol + * + * @return priceFeedSymbol + */ + @jakarta.annotation.Nullable + public String getPriceFeedSymbol() { + return priceFeedSymbol; + } + + public void setPriceFeedSymbol(@jakarta.annotation.Nullable String priceFeedSymbol) { + this.priceFeedSymbol = priceFeedSymbol; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetMarketDetailResponseVariantData getMarketDetailResponseVariantData = + (GetMarketDetailResponseVariantData) o; + return Objects.equals(this.type, getMarketDetailResponseVariantData.type) + && Objects.equals(this.startPrice, getMarketDetailResponseVariantData.startPrice) + && Objects.equals(this.endPrice, getMarketDetailResponseVariantData.endPrice) + && Objects.equals(this.priceFeedId, getMarketDetailResponseVariantData.priceFeedId) + && Objects.equals( + this.priceFeedProvider, + getMarketDetailResponseVariantData.priceFeedProvider) + && Objects.equals( + this.priceFeedSymbol, getMarketDetailResponseVariantData.priceFeedSymbol); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash( + type, startPrice, endPrice, priceFeedId, priceFeedProvider, priceFeedSymbol); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetMarketDetailResponseVariantData {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" startPrice: ").append(toIndentedString(startPrice)).append("\n"); + sb.append(" endPrice: ").append(toIndentedString(endPrice)).append("\n"); + sb.append(" priceFeedId: ").append(toIndentedString(priceFeedId)).append("\n"); + sb.append(" priceFeedProvider: ").append(toIndentedString(priceFeedProvider)).append("\n"); + sb.append(" priceFeedSymbol: ").append(toIndentedString(priceFeedSymbol)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object typeValue = getType(); + String typeValueAsString = ""; + typeValueAsString = typeValue.toString(); + sb.append("type=").append(urlEncode(typeValueAsString)).append(""); + Object startPriceValue = getStartPrice(); + String startPriceValueAsString = ""; + startPriceValueAsString = startPriceValue.toString(); + sb.append("startPrice=").append(urlEncode(startPriceValueAsString)).append(""); + Object endPriceValue = getEndPrice(); + String endPriceValueAsString = ""; + endPriceValueAsString = endPriceValue.toString(); + sb.append("endPrice=").append(urlEncode(endPriceValueAsString)).append(""); + Object priceFeedIdValue = getPriceFeedId(); + String priceFeedIdValueAsString = ""; + priceFeedIdValueAsString = priceFeedIdValue.toString(); + sb.append("priceFeedId=").append(urlEncode(priceFeedIdValueAsString)).append(""); + Object priceFeedProviderValue = getPriceFeedProvider(); + String priceFeedProviderValueAsString = ""; + priceFeedProviderValueAsString = priceFeedProviderValue.toString(); + sb.append("priceFeedProvider=") + .append(urlEncode(priceFeedProviderValueAsString)) + .append(""); + Object priceFeedSymbolValue = getPriceFeedSymbol(); + String priceFeedSymbolValueAsString = ""; + priceFeedSymbolValueAsString = priceFeedSymbolValue.toString(); + sb.append("priceFeedSymbol=").append(urlEncode(priceFeedSymbolValueAsString)).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("type"); + openapiFields.add("startPrice"); + openapiFields.add("endPrice"); + openapiFields.add("priceFeedId"); + openapiFields.add("priceFeedProvider"); + openapiFields.add("priceFeedSymbol"); + + // 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 + * GetMarketDetailResponseVariantData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetMarketDetailResponseVariantData.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetMarketDetailResponseVariantData is" + + " not found in the empty JSON string", + GetMarketDetailResponseVariantData.openapiRequiredFields + .toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) + && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `type` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("type").toString())); + } + if ((jsonObj.get("startPrice") != null && !jsonObj.get("startPrice").isJsonNull()) + && !jsonObj.get("startPrice").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `startPrice` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("startPrice").toString())); + } + if ((jsonObj.get("endPrice") != null && !jsonObj.get("endPrice").isJsonNull()) + && !jsonObj.get("endPrice").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `endPrice` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("endPrice").toString())); + } + if ((jsonObj.get("priceFeedId") != null && !jsonObj.get("priceFeedId").isJsonNull()) + && !jsonObj.get("priceFeedId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `priceFeedId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("priceFeedId").toString())); + } + if ((jsonObj.get("priceFeedProvider") != null + && !jsonObj.get("priceFeedProvider").isJsonNull()) + && !jsonObj.get("priceFeedProvider").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `priceFeedProvider` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("priceFeedProvider").toString())); + } + if ((jsonObj.get("priceFeedSymbol") != null && !jsonObj.get("priceFeedSymbol").isJsonNull()) + && !jsonObj.get("priceFeedSymbol").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `priceFeedSymbol` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("priceFeedSymbol").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetMarketDetailResponseVariantData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetMarketDetailResponseVariantData' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(GetMarketDetailResponseVariantData.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetMarketDetailResponseVariantData value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetMarketDetailResponseVariantData read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetMarketDetailResponseVariantData given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetMarketDetailResponseVariantData + * @throws IOException if the JSON string is invalid with respect to + * GetMarketDetailResponseVariantData + */ + public static GetMarketDetailResponseVariantData fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, GetMarketDetailResponseVariantData.class); + } + + /** + * Convert an instance of GetMarketDetailResponseVariantData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/GetPortfolioResponse.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/GetPortfolioResponse.java new file mode 100644 index 000000000..6dd63e047 --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/GetPortfolioResponse.java @@ -0,0 +1,583 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.model; + +import com.binance.connector.client.w3w_prediction.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.*; + +/** GetPortfolioResponse */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class GetPortfolioResponse { + 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_WALLET_ADDRESS = "walletAddress"; + + @SerializedName(SERIALIZED_NAME_WALLET_ADDRESS) + @jakarta.annotation.Nullable + private String walletAddress; + + public static final String SERIALIZED_NAME_ACTIVE_POSITIONS_COUNT = "activePositionsCount"; + + @SerializedName(SERIALIZED_NAME_ACTIVE_POSITIONS_COUNT) + @jakarta.annotation.Nullable + private Integer activePositionsCount; + + public static final String SERIALIZED_NAME_TOTAL_REALIZED_PNL = "totalRealizedPnl"; + + @SerializedName(SERIALIZED_NAME_TOTAL_REALIZED_PNL) + @jakarta.annotation.Nullable + private String totalRealizedPnl; + + public static final String SERIALIZED_NAME_TOTAL_UNREALIZED_PNL = "totalUnrealizedPnl"; + + @SerializedName(SERIALIZED_NAME_TOTAL_UNREALIZED_PNL) + @jakarta.annotation.Nullable + private String totalUnrealizedPnl; + + public static final String SERIALIZED_NAME_TOTAL_PNL = "totalPnl"; + + @SerializedName(SERIALIZED_NAME_TOTAL_PNL) + @jakarta.annotation.Nullable + private String totalPnl; + + public static final String SERIALIZED_NAME_TOTAL_COST_BASIS = "totalCostBasis"; + + @SerializedName(SERIALIZED_NAME_TOTAL_COST_BASIS) + @jakarta.annotation.Nullable + private String totalCostBasis; + + public static final String SERIALIZED_NAME_TOTAL_CURRENT_VALUE = "totalCurrentValue"; + + @SerializedName(SERIALIZED_NAME_TOTAL_CURRENT_VALUE) + @jakarta.annotation.Nullable + private String totalCurrentValue; + + public static final String SERIALIZED_NAME_POSITIONS = "positions"; + + @SerializedName(SERIALIZED_NAME_POSITIONS) + @jakarta.annotation.Nullable + private List<@Valid GetPortfolioResponsePositionsInner> positions; + + public GetPortfolioResponse() {} + + public GetPortfolioResponse 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 GetPortfolioResponse walletAddress(@jakarta.annotation.Nullable String walletAddress) { + this.walletAddress = walletAddress; + return this; + } + + /** + * Get walletAddress + * + * @return walletAddress + */ + @jakarta.annotation.Nullable + public String getWalletAddress() { + return walletAddress; + } + + public void setWalletAddress(@jakarta.annotation.Nullable String walletAddress) { + this.walletAddress = walletAddress; + } + + public GetPortfolioResponse activePositionsCount( + @jakarta.annotation.Nullable Integer activePositionsCount) { + this.activePositionsCount = activePositionsCount; + return this; + } + + /** + * Get activePositionsCount + * + * @return activePositionsCount + */ + @jakarta.annotation.Nullable + public Integer getActivePositionsCount() { + return activePositionsCount; + } + + public void setActivePositionsCount(@jakarta.annotation.Nullable Integer activePositionsCount) { + this.activePositionsCount = activePositionsCount; + } + + public GetPortfolioResponse totalRealizedPnl( + @jakarta.annotation.Nullable String totalRealizedPnl) { + this.totalRealizedPnl = totalRealizedPnl; + return this; + } + + /** + * Get totalRealizedPnl + * + * @return totalRealizedPnl + */ + @jakarta.annotation.Nullable + public String getTotalRealizedPnl() { + return totalRealizedPnl; + } + + public void setTotalRealizedPnl(@jakarta.annotation.Nullable String totalRealizedPnl) { + this.totalRealizedPnl = totalRealizedPnl; + } + + public GetPortfolioResponse totalUnrealizedPnl( + @jakarta.annotation.Nullable String totalUnrealizedPnl) { + this.totalUnrealizedPnl = totalUnrealizedPnl; + return this; + } + + /** + * Get totalUnrealizedPnl + * + * @return totalUnrealizedPnl + */ + @jakarta.annotation.Nullable + public String getTotalUnrealizedPnl() { + return totalUnrealizedPnl; + } + + public void setTotalUnrealizedPnl(@jakarta.annotation.Nullable String totalUnrealizedPnl) { + this.totalUnrealizedPnl = totalUnrealizedPnl; + } + + public GetPortfolioResponse totalPnl(@jakarta.annotation.Nullable String totalPnl) { + this.totalPnl = totalPnl; + return this; + } + + /** + * Get totalPnl + * + * @return totalPnl + */ + @jakarta.annotation.Nullable + public String getTotalPnl() { + return totalPnl; + } + + public void setTotalPnl(@jakarta.annotation.Nullable String totalPnl) { + this.totalPnl = totalPnl; + } + + public GetPortfolioResponse totalCostBasis(@jakarta.annotation.Nullable String totalCostBasis) { + this.totalCostBasis = totalCostBasis; + return this; + } + + /** + * Get totalCostBasis + * + * @return totalCostBasis + */ + @jakarta.annotation.Nullable + public String getTotalCostBasis() { + return totalCostBasis; + } + + public void setTotalCostBasis(@jakarta.annotation.Nullable String totalCostBasis) { + this.totalCostBasis = totalCostBasis; + } + + public GetPortfolioResponse totalCurrentValue( + @jakarta.annotation.Nullable String totalCurrentValue) { + this.totalCurrentValue = totalCurrentValue; + return this; + } + + /** + * Get totalCurrentValue + * + * @return totalCurrentValue + */ + @jakarta.annotation.Nullable + public String getTotalCurrentValue() { + return totalCurrentValue; + } + + public void setTotalCurrentValue(@jakarta.annotation.Nullable String totalCurrentValue) { + this.totalCurrentValue = totalCurrentValue; + } + + public GetPortfolioResponse positions( + @jakarta.annotation.Nullable + List<@Valid GetPortfolioResponsePositionsInner> positions) { + this.positions = positions; + return this; + } + + public GetPortfolioResponse addPositionsItem(GetPortfolioResponsePositionsInner positionsItem) { + if (this.positions == null) { + this.positions = new ArrayList<>(); + } + this.positions.add(positionsItem); + return this; + } + + /** + * Get positions + * + * @return positions + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid GetPortfolioResponsePositionsInner> getPositions() { + return positions; + } + + public void setPositions( + @jakarta.annotation.Nullable + List<@Valid GetPortfolioResponsePositionsInner> positions) { + this.positions = positions; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetPortfolioResponse getPortfolioResponse = (GetPortfolioResponse) o; + return Objects.equals(this.chainId, getPortfolioResponse.chainId) + && Objects.equals(this.walletAddress, getPortfolioResponse.walletAddress) + && Objects.equals( + this.activePositionsCount, getPortfolioResponse.activePositionsCount) + && Objects.equals(this.totalRealizedPnl, getPortfolioResponse.totalRealizedPnl) + && Objects.equals(this.totalUnrealizedPnl, getPortfolioResponse.totalUnrealizedPnl) + && Objects.equals(this.totalPnl, getPortfolioResponse.totalPnl) + && Objects.equals(this.totalCostBasis, getPortfolioResponse.totalCostBasis) + && Objects.equals(this.totalCurrentValue, getPortfolioResponse.totalCurrentValue) + && Objects.equals(this.positions, getPortfolioResponse.positions); + } + + @Override + public int hashCode() { + return Objects.hash( + chainId, + walletAddress, + activePositionsCount, + totalRealizedPnl, + totalUnrealizedPnl, + totalPnl, + totalCostBasis, + totalCurrentValue, + positions); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetPortfolioResponse {\n"); + sb.append(" chainId: ").append(toIndentedString(chainId)).append("\n"); + sb.append(" walletAddress: ").append(toIndentedString(walletAddress)).append("\n"); + sb.append(" activePositionsCount: ") + .append(toIndentedString(activePositionsCount)) + .append("\n"); + sb.append(" totalRealizedPnl: ").append(toIndentedString(totalRealizedPnl)).append("\n"); + sb.append(" totalUnrealizedPnl: ") + .append(toIndentedString(totalUnrealizedPnl)) + .append("\n"); + sb.append(" totalPnl: ").append(toIndentedString(totalPnl)).append("\n"); + sb.append(" totalCostBasis: ").append(toIndentedString(totalCostBasis)).append("\n"); + sb.append(" totalCurrentValue: ").append(toIndentedString(totalCurrentValue)).append("\n"); + sb.append(" positions: ").append(toIndentedString(positions)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object chainIdValue = getChainId(); + String chainIdValueAsString = ""; + chainIdValueAsString = chainIdValue.toString(); + sb.append("chainId=").append(urlEncode(chainIdValueAsString)).append(""); + Object walletAddressValue = getWalletAddress(); + String walletAddressValueAsString = ""; + walletAddressValueAsString = walletAddressValue.toString(); + sb.append("walletAddress=").append(urlEncode(walletAddressValueAsString)).append(""); + Object activePositionsCountValue = getActivePositionsCount(); + String activePositionsCountValueAsString = ""; + activePositionsCountValueAsString = activePositionsCountValue.toString(); + sb.append("activePositionsCount=") + .append(urlEncode(activePositionsCountValueAsString)) + .append(""); + Object totalRealizedPnlValue = getTotalRealizedPnl(); + String totalRealizedPnlValueAsString = ""; + totalRealizedPnlValueAsString = totalRealizedPnlValue.toString(); + sb.append("totalRealizedPnl=").append(urlEncode(totalRealizedPnlValueAsString)).append(""); + Object totalUnrealizedPnlValue = getTotalUnrealizedPnl(); + String totalUnrealizedPnlValueAsString = ""; + totalUnrealizedPnlValueAsString = totalUnrealizedPnlValue.toString(); + sb.append("totalUnrealizedPnl=") + .append(urlEncode(totalUnrealizedPnlValueAsString)) + .append(""); + Object totalPnlValue = getTotalPnl(); + String totalPnlValueAsString = ""; + totalPnlValueAsString = totalPnlValue.toString(); + sb.append("totalPnl=").append(urlEncode(totalPnlValueAsString)).append(""); + Object totalCostBasisValue = getTotalCostBasis(); + String totalCostBasisValueAsString = ""; + totalCostBasisValueAsString = totalCostBasisValue.toString(); + sb.append("totalCostBasis=").append(urlEncode(totalCostBasisValueAsString)).append(""); + Object totalCurrentValueValue = getTotalCurrentValue(); + String totalCurrentValueValueAsString = ""; + totalCurrentValueValueAsString = totalCurrentValueValue.toString(); + sb.append("totalCurrentValue=") + .append(urlEncode(totalCurrentValueValueAsString)) + .append(""); + Object positionsValue = getPositions(); + String positionsValueAsString = ""; + positionsValueAsString = + (String) + ((Collection) positionsValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("positions=").append(urlEncode(positionsValueAsString)).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("chainId"); + openapiFields.add("walletAddress"); + openapiFields.add("activePositionsCount"); + openapiFields.add("totalRealizedPnl"); + openapiFields.add("totalUnrealizedPnl"); + openapiFields.add("totalPnl"); + openapiFields.add("totalCostBasis"); + openapiFields.add("totalCurrentValue"); + openapiFields.add("positions"); + + // 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 GetPortfolioResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetPortfolioResponse.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetPortfolioResponse is not found in" + + " the empty JSON string", + GetPortfolioResponse.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + 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("walletAddress") != null && !jsonObj.get("walletAddress").isJsonNull()) + && !jsonObj.get("walletAddress").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `walletAddress` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("walletAddress").toString())); + } + if ((jsonObj.get("totalRealizedPnl") != null + && !jsonObj.get("totalRealizedPnl").isJsonNull()) + && !jsonObj.get("totalRealizedPnl").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `totalRealizedPnl` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("totalRealizedPnl").toString())); + } + if ((jsonObj.get("totalUnrealizedPnl") != null + && !jsonObj.get("totalUnrealizedPnl").isJsonNull()) + && !jsonObj.get("totalUnrealizedPnl").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `totalUnrealizedPnl` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("totalUnrealizedPnl").toString())); + } + if ((jsonObj.get("totalPnl") != null && !jsonObj.get("totalPnl").isJsonNull()) + && !jsonObj.get("totalPnl").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `totalPnl` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("totalPnl").toString())); + } + if ((jsonObj.get("totalCostBasis") != null && !jsonObj.get("totalCostBasis").isJsonNull()) + && !jsonObj.get("totalCostBasis").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `totalCostBasis` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("totalCostBasis").toString())); + } + if ((jsonObj.get("totalCurrentValue") != null + && !jsonObj.get("totalCurrentValue").isJsonNull()) + && !jsonObj.get("totalCurrentValue").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `totalCurrentValue` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("totalCurrentValue").toString())); + } + if (jsonObj.get("positions") != null && !jsonObj.get("positions").isJsonNull()) { + JsonArray jsonArraypositions = jsonObj.getAsJsonArray("positions"); + if (jsonArraypositions != null) { + // ensure the json data is an array + if (!jsonObj.get("positions").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `positions` to be an array in the JSON" + + " string but got `%s`", + jsonObj.get("positions").toString())); + } + + // validate the optional field `positions` (array) + for (int i = 0; i < jsonArraypositions.size(); i++) { + GetPortfolioResponsePositionsInner.validateJsonElement( + jsonArraypositions.get(i)); + } + ; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetPortfolioResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetPortfolioResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(GetPortfolioResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetPortfolioResponse value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetPortfolioResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetPortfolioResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetPortfolioResponse + * @throws IOException if the JSON string is invalid with respect to GetPortfolioResponse + */ + public static GetPortfolioResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetPortfolioResponse.class); + } + + /** + * Convert an instance of GetPortfolioResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/GetPortfolioResponsePositionsInner.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/GetPortfolioResponsePositionsInner.java new file mode 100644 index 000000000..05ff55cff --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/GetPortfolioResponsePositionsInner.java @@ -0,0 +1,736 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.model; + +import com.binance.connector.client.w3w_prediction.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.*; + +/** GetPortfolioResponsePositionsInner */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class GetPortfolioResponsePositionsInner { + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @jakarta.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_WALLET_ADDRESS = "walletAddress"; + + @SerializedName(SERIALIZED_NAME_WALLET_ADDRESS) + @jakarta.annotation.Nullable + private String walletAddress; + + public static final String SERIALIZED_NAME_MARKET_TOPIC_ID = "marketTopicId"; + + @SerializedName(SERIALIZED_NAME_MARKET_TOPIC_ID) + @jakarta.annotation.Nullable + private Long marketTopicId; + + public static final String SERIALIZED_NAME_MARKET_ID = "marketId"; + + @SerializedName(SERIALIZED_NAME_MARKET_ID) + @jakarta.annotation.Nullable + private Long marketId; + + 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_VENDOR = "vendor"; + + @SerializedName(SERIALIZED_NAME_VENDOR) + @jakarta.annotation.Nullable + private String vendor; + + public static final String SERIALIZED_NAME_CURRENT_SHARES = "currentShares"; + + @SerializedName(SERIALIZED_NAME_CURRENT_SHARES) + @jakarta.annotation.Nullable + private String currentShares; + + public static final String SERIALIZED_NAME_AVG_PRICE = "avgPrice"; + + @SerializedName(SERIALIZED_NAME_AVG_PRICE) + @jakarta.annotation.Nullable + private String avgPrice; + + public static final String SERIALIZED_NAME_CURRENT_PRICE = "currentPrice"; + + @SerializedName(SERIALIZED_NAME_CURRENT_PRICE) + @jakarta.annotation.Nullable + private String currentPrice; + + public static final String SERIALIZED_NAME_REALIZED_PNL = "realizedPnl"; + + @SerializedName(SERIALIZED_NAME_REALIZED_PNL) + @jakarta.annotation.Nullable + private String realizedPnl; + + public static final String SERIALIZED_NAME_UNREALIZED_PNL = "unrealizedPnl"; + + @SerializedName(SERIALIZED_NAME_UNREALIZED_PNL) + @jakarta.annotation.Nullable + private String unrealizedPnl; + + public static final String SERIALIZED_NAME_TOTAL_PNL = "totalPnl"; + + @SerializedName(SERIALIZED_NAME_TOTAL_PNL) + @jakarta.annotation.Nullable + private String totalPnl; + + public static final String SERIALIZED_NAME_PNL_PERCENTAGE = "pnlPercentage"; + + @SerializedName(SERIALIZED_NAME_PNL_PERCENTAGE) + @jakarta.annotation.Nullable + private String pnlPercentage; + + public static final String SERIALIZED_NAME_IS_RESOLVED = "isResolved"; + + @SerializedName(SERIALIZED_NAME_IS_RESOLVED) + @jakarta.annotation.Nullable + private Boolean isResolved; + + public GetPortfolioResponsePositionsInner() {} + + public GetPortfolioResponsePositionsInner id(@jakarta.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * + * @return id + */ + @jakarta.annotation.Nullable + public Long getId() { + return id; + } + + public void setId(@jakarta.annotation.Nullable Long id) { + this.id = id; + } + + public GetPortfolioResponsePositionsInner walletAddress( + @jakarta.annotation.Nullable String walletAddress) { + this.walletAddress = walletAddress; + return this; + } + + /** + * Get walletAddress + * + * @return walletAddress + */ + @jakarta.annotation.Nullable + public String getWalletAddress() { + return walletAddress; + } + + public void setWalletAddress(@jakarta.annotation.Nullable String walletAddress) { + this.walletAddress = walletAddress; + } + + public GetPortfolioResponsePositionsInner marketTopicId( + @jakarta.annotation.Nullable Long marketTopicId) { + this.marketTopicId = marketTopicId; + return this; + } + + /** + * Get marketTopicId + * + * @return marketTopicId + */ + @jakarta.annotation.Nullable + public Long getMarketTopicId() { + return marketTopicId; + } + + public void setMarketTopicId(@jakarta.annotation.Nullable Long marketTopicId) { + this.marketTopicId = marketTopicId; + } + + public GetPortfolioResponsePositionsInner marketId(@jakarta.annotation.Nullable Long marketId) { + this.marketId = marketId; + return this; + } + + /** + * Get marketId + * + * @return marketId + */ + @jakarta.annotation.Nullable + public Long getMarketId() { + return marketId; + } + + public void setMarketId(@jakarta.annotation.Nullable Long marketId) { + this.marketId = marketId; + } + + public GetPortfolioResponsePositionsInner 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 GetPortfolioResponsePositionsInner vendor(@jakarta.annotation.Nullable String vendor) { + this.vendor = vendor; + return this; + } + + /** + * Get vendor + * + * @return vendor + */ + @jakarta.annotation.Nullable + public String getVendor() { + return vendor; + } + + public void setVendor(@jakarta.annotation.Nullable String vendor) { + this.vendor = vendor; + } + + public GetPortfolioResponsePositionsInner currentShares( + @jakarta.annotation.Nullable String currentShares) { + this.currentShares = currentShares; + return this; + } + + /** + * Get currentShares + * + * @return currentShares + */ + @jakarta.annotation.Nullable + public String getCurrentShares() { + return currentShares; + } + + public void setCurrentShares(@jakarta.annotation.Nullable String currentShares) { + this.currentShares = currentShares; + } + + public GetPortfolioResponsePositionsInner avgPrice( + @jakarta.annotation.Nullable String avgPrice) { + this.avgPrice = avgPrice; + return this; + } + + /** + * Get avgPrice + * + * @return avgPrice + */ + @jakarta.annotation.Nullable + public String getAvgPrice() { + return avgPrice; + } + + public void setAvgPrice(@jakarta.annotation.Nullable String avgPrice) { + this.avgPrice = avgPrice; + } + + public GetPortfolioResponsePositionsInner currentPrice( + @jakarta.annotation.Nullable String currentPrice) { + this.currentPrice = currentPrice; + return this; + } + + /** + * Get currentPrice + * + * @return currentPrice + */ + @jakarta.annotation.Nullable + public String getCurrentPrice() { + return currentPrice; + } + + public void setCurrentPrice(@jakarta.annotation.Nullable String currentPrice) { + this.currentPrice = currentPrice; + } + + public GetPortfolioResponsePositionsInner realizedPnl( + @jakarta.annotation.Nullable String realizedPnl) { + this.realizedPnl = realizedPnl; + return this; + } + + /** + * Get realizedPnl + * + * @return realizedPnl + */ + @jakarta.annotation.Nullable + public String getRealizedPnl() { + return realizedPnl; + } + + public void setRealizedPnl(@jakarta.annotation.Nullable String realizedPnl) { + this.realizedPnl = realizedPnl; + } + + public GetPortfolioResponsePositionsInner unrealizedPnl( + @jakarta.annotation.Nullable String unrealizedPnl) { + this.unrealizedPnl = unrealizedPnl; + return this; + } + + /** + * Get unrealizedPnl + * + * @return unrealizedPnl + */ + @jakarta.annotation.Nullable + public String getUnrealizedPnl() { + return unrealizedPnl; + } + + public void setUnrealizedPnl(@jakarta.annotation.Nullable String unrealizedPnl) { + this.unrealizedPnl = unrealizedPnl; + } + + public GetPortfolioResponsePositionsInner totalPnl( + @jakarta.annotation.Nullable String totalPnl) { + this.totalPnl = totalPnl; + return this; + } + + /** + * Get totalPnl + * + * @return totalPnl + */ + @jakarta.annotation.Nullable + public String getTotalPnl() { + return totalPnl; + } + + public void setTotalPnl(@jakarta.annotation.Nullable String totalPnl) { + this.totalPnl = totalPnl; + } + + public GetPortfolioResponsePositionsInner pnlPercentage( + @jakarta.annotation.Nullable String pnlPercentage) { + this.pnlPercentage = pnlPercentage; + return this; + } + + /** + * Get pnlPercentage + * + * @return pnlPercentage + */ + @jakarta.annotation.Nullable + public String getPnlPercentage() { + return pnlPercentage; + } + + public void setPnlPercentage(@jakarta.annotation.Nullable String pnlPercentage) { + this.pnlPercentage = pnlPercentage; + } + + public GetPortfolioResponsePositionsInner isResolved( + @jakarta.annotation.Nullable Boolean isResolved) { + this.isResolved = isResolved; + return this; + } + + /** + * Get isResolved + * + * @return isResolved + */ + @jakarta.annotation.Nullable + public Boolean getIsResolved() { + return isResolved; + } + + public void setIsResolved(@jakarta.annotation.Nullable Boolean isResolved) { + this.isResolved = isResolved; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetPortfolioResponsePositionsInner getPortfolioResponsePositionsInner = + (GetPortfolioResponsePositionsInner) o; + return Objects.equals(this.id, getPortfolioResponsePositionsInner.id) + && Objects.equals( + this.walletAddress, getPortfolioResponsePositionsInner.walletAddress) + && Objects.equals( + this.marketTopicId, getPortfolioResponsePositionsInner.marketTopicId) + && Objects.equals(this.marketId, getPortfolioResponsePositionsInner.marketId) + && Objects.equals(this.tokenId, getPortfolioResponsePositionsInner.tokenId) + && Objects.equals(this.vendor, getPortfolioResponsePositionsInner.vendor) + && Objects.equals( + this.currentShares, getPortfolioResponsePositionsInner.currentShares) + && Objects.equals(this.avgPrice, getPortfolioResponsePositionsInner.avgPrice) + && Objects.equals( + this.currentPrice, getPortfolioResponsePositionsInner.currentPrice) + && Objects.equals(this.realizedPnl, getPortfolioResponsePositionsInner.realizedPnl) + && Objects.equals( + this.unrealizedPnl, getPortfolioResponsePositionsInner.unrealizedPnl) + && Objects.equals(this.totalPnl, getPortfolioResponsePositionsInner.totalPnl) + && Objects.equals( + this.pnlPercentage, getPortfolioResponsePositionsInner.pnlPercentage) + && Objects.equals(this.isResolved, getPortfolioResponsePositionsInner.isResolved); + } + + @Override + public int hashCode() { + return Objects.hash( + id, + walletAddress, + marketTopicId, + marketId, + tokenId, + vendor, + currentShares, + avgPrice, + currentPrice, + realizedPnl, + unrealizedPnl, + totalPnl, + pnlPercentage, + isResolved); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetPortfolioResponsePositionsInner {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" walletAddress: ").append(toIndentedString(walletAddress)).append("\n"); + sb.append(" marketTopicId: ").append(toIndentedString(marketTopicId)).append("\n"); + sb.append(" marketId: ").append(toIndentedString(marketId)).append("\n"); + sb.append(" tokenId: ").append(toIndentedString(tokenId)).append("\n"); + sb.append(" vendor: ").append(toIndentedString(vendor)).append("\n"); + sb.append(" currentShares: ").append(toIndentedString(currentShares)).append("\n"); + sb.append(" avgPrice: ").append(toIndentedString(avgPrice)).append("\n"); + sb.append(" currentPrice: ").append(toIndentedString(currentPrice)).append("\n"); + sb.append(" realizedPnl: ").append(toIndentedString(realizedPnl)).append("\n"); + sb.append(" unrealizedPnl: ").append(toIndentedString(unrealizedPnl)).append("\n"); + sb.append(" totalPnl: ").append(toIndentedString(totalPnl)).append("\n"); + sb.append(" pnlPercentage: ").append(toIndentedString(pnlPercentage)).append("\n"); + sb.append(" isResolved: ").append(toIndentedString(isResolved)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object idValue = getId(); + String idValueAsString = ""; + idValueAsString = idValue.toString(); + sb.append("id=").append(urlEncode(idValueAsString)).append(""); + Object walletAddressValue = getWalletAddress(); + String walletAddressValueAsString = ""; + walletAddressValueAsString = walletAddressValue.toString(); + sb.append("walletAddress=").append(urlEncode(walletAddressValueAsString)).append(""); + Object marketTopicIdValue = getMarketTopicId(); + String marketTopicIdValueAsString = ""; + marketTopicIdValueAsString = marketTopicIdValue.toString(); + sb.append("marketTopicId=").append(urlEncode(marketTopicIdValueAsString)).append(""); + Object marketIdValue = getMarketId(); + String marketIdValueAsString = ""; + marketIdValueAsString = marketIdValue.toString(); + sb.append("marketId=").append(urlEncode(marketIdValueAsString)).append(""); + Object tokenIdValue = getTokenId(); + String tokenIdValueAsString = ""; + tokenIdValueAsString = tokenIdValue.toString(); + sb.append("tokenId=").append(urlEncode(tokenIdValueAsString)).append(""); + Object vendorValue = getVendor(); + String vendorValueAsString = ""; + vendorValueAsString = vendorValue.toString(); + sb.append("vendor=").append(urlEncode(vendorValueAsString)).append(""); + Object currentSharesValue = getCurrentShares(); + String currentSharesValueAsString = ""; + currentSharesValueAsString = currentSharesValue.toString(); + sb.append("currentShares=").append(urlEncode(currentSharesValueAsString)).append(""); + Object avgPriceValue = getAvgPrice(); + String avgPriceValueAsString = ""; + avgPriceValueAsString = avgPriceValue.toString(); + sb.append("avgPrice=").append(urlEncode(avgPriceValueAsString)).append(""); + Object currentPriceValue = getCurrentPrice(); + String currentPriceValueAsString = ""; + currentPriceValueAsString = currentPriceValue.toString(); + sb.append("currentPrice=").append(urlEncode(currentPriceValueAsString)).append(""); + Object realizedPnlValue = getRealizedPnl(); + String realizedPnlValueAsString = ""; + realizedPnlValueAsString = realizedPnlValue.toString(); + sb.append("realizedPnl=").append(urlEncode(realizedPnlValueAsString)).append(""); + Object unrealizedPnlValue = getUnrealizedPnl(); + String unrealizedPnlValueAsString = ""; + unrealizedPnlValueAsString = unrealizedPnlValue.toString(); + sb.append("unrealizedPnl=").append(urlEncode(unrealizedPnlValueAsString)).append(""); + Object totalPnlValue = getTotalPnl(); + String totalPnlValueAsString = ""; + totalPnlValueAsString = totalPnlValue.toString(); + sb.append("totalPnl=").append(urlEncode(totalPnlValueAsString)).append(""); + Object pnlPercentageValue = getPnlPercentage(); + String pnlPercentageValueAsString = ""; + pnlPercentageValueAsString = pnlPercentageValue.toString(); + sb.append("pnlPercentage=").append(urlEncode(pnlPercentageValueAsString)).append(""); + Object isResolvedValue = getIsResolved(); + String isResolvedValueAsString = ""; + isResolvedValueAsString = isResolvedValue.toString(); + sb.append("isResolved=").append(urlEncode(isResolvedValueAsString)).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("id"); + openapiFields.add("walletAddress"); + openapiFields.add("marketTopicId"); + openapiFields.add("marketId"); + openapiFields.add("tokenId"); + openapiFields.add("vendor"); + openapiFields.add("currentShares"); + openapiFields.add("avgPrice"); + openapiFields.add("currentPrice"); + openapiFields.add("realizedPnl"); + openapiFields.add("unrealizedPnl"); + openapiFields.add("totalPnl"); + openapiFields.add("pnlPercentage"); + openapiFields.add("isResolved"); + + // 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 + * GetPortfolioResponsePositionsInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetPortfolioResponsePositionsInner.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetPortfolioResponsePositionsInner is" + + " not found in the empty JSON string", + GetPortfolioResponsePositionsInner.openapiRequiredFields + .toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("walletAddress") != null && !jsonObj.get("walletAddress").isJsonNull()) + && !jsonObj.get("walletAddress").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `walletAddress` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("walletAddress").toString())); + } + if ((jsonObj.get("tokenId") != null && !jsonObj.get("tokenId").isJsonNull()) + && !jsonObj.get("tokenId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `tokenId` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("tokenId").toString())); + } + if ((jsonObj.get("vendor") != null && !jsonObj.get("vendor").isJsonNull()) + && !jsonObj.get("vendor").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `vendor` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("vendor").toString())); + } + if ((jsonObj.get("currentShares") != null && !jsonObj.get("currentShares").isJsonNull()) + && !jsonObj.get("currentShares").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `currentShares` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("currentShares").toString())); + } + if ((jsonObj.get("avgPrice") != null && !jsonObj.get("avgPrice").isJsonNull()) + && !jsonObj.get("avgPrice").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `avgPrice` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("avgPrice").toString())); + } + if ((jsonObj.get("currentPrice") != null && !jsonObj.get("currentPrice").isJsonNull()) + && !jsonObj.get("currentPrice").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `currentPrice` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("currentPrice").toString())); + } + if ((jsonObj.get("realizedPnl") != null && !jsonObj.get("realizedPnl").isJsonNull()) + && !jsonObj.get("realizedPnl").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `realizedPnl` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("realizedPnl").toString())); + } + if ((jsonObj.get("unrealizedPnl") != null && !jsonObj.get("unrealizedPnl").isJsonNull()) + && !jsonObj.get("unrealizedPnl").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `unrealizedPnl` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("unrealizedPnl").toString())); + } + if ((jsonObj.get("totalPnl") != null && !jsonObj.get("totalPnl").isJsonNull()) + && !jsonObj.get("totalPnl").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `totalPnl` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("totalPnl").toString())); + } + if ((jsonObj.get("pnlPercentage") != null && !jsonObj.get("pnlPercentage").isJsonNull()) + && !jsonObj.get("pnlPercentage").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `pnlPercentage` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("pnlPercentage").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetPortfolioResponsePositionsInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetPortfolioResponsePositionsInner' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(GetPortfolioResponsePositionsInner.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetPortfolioResponsePositionsInner value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetPortfolioResponsePositionsInner read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetPortfolioResponsePositionsInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetPortfolioResponsePositionsInner + * @throws IOException if the JSON string is invalid with respect to + * GetPortfolioResponsePositionsInner + */ + public static GetPortfolioResponsePositionsInner fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, GetPortfolioResponsePositionsInner.class); + } + + /** + * Convert an instance of GetPortfolioResponsePositionsInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/GetPositionByTokenResponse.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/GetPositionByTokenResponse.java new file mode 100644 index 000000000..eb9c6c521 --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/GetPositionByTokenResponse.java @@ -0,0 +1,211 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.model; + +import com.binance.connector.client.w3w_prediction.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.*; + +/** GetPositionByTokenResponse */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class GetPositionByTokenResponse { + public static final String SERIALIZED_NAME_POSITION = "position"; + + @SerializedName(SERIALIZED_NAME_POSITION) + @jakarta.annotation.Nullable + private GetPositionByTokenResponsePosition position; + + public GetPositionByTokenResponse() {} + + public GetPositionByTokenResponse position( + @jakarta.annotation.Nullable GetPositionByTokenResponsePosition position) { + this.position = position; + return this; + } + + /** + * Get position + * + * @return position + */ + @jakarta.annotation.Nullable + @Valid + public GetPositionByTokenResponsePosition getPosition() { + return position; + } + + public void setPosition( + @jakarta.annotation.Nullable GetPositionByTokenResponsePosition position) { + this.position = position; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetPositionByTokenResponse getPositionByTokenResponse = (GetPositionByTokenResponse) o; + return Objects.equals(this.position, getPositionByTokenResponse.position); + } + + @Override + public int hashCode() { + return Objects.hash(position); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetPositionByTokenResponse {\n"); + sb.append(" position: ").append(toIndentedString(position)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object positionValue = getPosition(); + String positionValueAsString = ""; + positionValueAsString = positionValue.toString(); + sb.append("position=").append(urlEncode(positionValueAsString)).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("position"); + + // 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 GetPositionByTokenResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetPositionByTokenResponse.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetPositionByTokenResponse is not" + + " found in the empty JSON string", + GetPositionByTokenResponse.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `position` + if (jsonObj.get("position") != null && !jsonObj.get("position").isJsonNull()) { + GetPositionByTokenResponsePosition.validateJsonElement(jsonObj.get("position")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetPositionByTokenResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetPositionByTokenResponse' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(GetPositionByTokenResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetPositionByTokenResponse value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetPositionByTokenResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetPositionByTokenResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetPositionByTokenResponse + * @throws IOException if the JSON string is invalid with respect to GetPositionByTokenResponse + */ + public static GetPositionByTokenResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetPositionByTokenResponse.class); + } + + /** + * Convert an instance of GetPositionByTokenResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/GetPositionByTokenResponsePosition.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/GetPositionByTokenResponsePosition.java new file mode 100644 index 000000000..71e064bf3 --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/GetPositionByTokenResponsePosition.java @@ -0,0 +1,1131 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.model; + +import com.binance.connector.client.w3w_prediction.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.*; + +/** GetPositionByTokenResponsePosition */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class GetPositionByTokenResponsePosition { + public static final String SERIALIZED_NAME_POSITION_ID = "positionId"; + + @SerializedName(SERIALIZED_NAME_POSITION_ID) + @jakarta.annotation.Nullable + private Long positionId; + + public static final String SERIALIZED_NAME_VENDOR = "vendor"; + + @SerializedName(SERIALIZED_NAME_VENDOR) + @jakarta.annotation.Nullable + private String vendor; + + 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_TOKEN_ID = "tokenId"; + + @SerializedName(SERIALIZED_NAME_TOKEN_ID) + @jakarta.annotation.Nullable + private String tokenId; + + public static final String SERIALIZED_NAME_COLLATERAL_SYMBOL = "collateralSymbol"; + + @SerializedName(SERIALIZED_NAME_COLLATERAL_SYMBOL) + @jakarta.annotation.Nullable + private String collateralSymbol; + + public static final String SERIALIZED_NAME_TOPIC_TYPE = "topicType"; + + @SerializedName(SERIALIZED_NAME_TOPIC_TYPE) + @jakarta.annotation.Nullable + private String topicType; + + public static final String SERIALIZED_NAME_MARKET_TOPIC_ID = "marketTopicId"; + + @SerializedName(SERIALIZED_NAME_MARKET_TOPIC_ID) + @jakarta.annotation.Nullable + private Long marketTopicId; + + public static final String SERIALIZED_NAME_MARKET_ID = "marketId"; + + @SerializedName(SERIALIZED_NAME_MARKET_ID) + @jakarta.annotation.Nullable + private Long marketId; + + public static final String SERIALIZED_NAME_MARKET_TOPIC_TITLE = "marketTopicTitle"; + + @SerializedName(SERIALIZED_NAME_MARKET_TOPIC_TITLE) + @jakarta.annotation.Nullable + private String marketTopicTitle; + + public static final String SERIALIZED_NAME_MARKET_TITLE = "marketTitle"; + + @SerializedName(SERIALIZED_NAME_MARKET_TITLE) + @jakarta.annotation.Nullable + private String marketTitle; + + public static final String SERIALIZED_NAME_OUTCOME_NAME = "outcomeName"; + + @SerializedName(SERIALIZED_NAME_OUTCOME_NAME) + @jakarta.annotation.Nullable + private String outcomeName; + + public static final String SERIALIZED_NAME_OUTCOME_INDEX = "outcomeIndex"; + + @SerializedName(SERIALIZED_NAME_OUTCOME_INDEX) + @jakarta.annotation.Nullable + private Integer outcomeIndex; + + public static final String SERIALIZED_NAME_SHARES = "shares"; + + @SerializedName(SERIALIZED_NAME_SHARES) + @jakarta.annotation.Nullable + private String shares; + + public static final String SERIALIZED_NAME_AVG_PRICE = "avgPrice"; + + @SerializedName(SERIALIZED_NAME_AVG_PRICE) + @jakarta.annotation.Nullable + private String avgPrice; + + public static final String SERIALIZED_NAME_TOTAL_COST = "totalCost"; + + @SerializedName(SERIALIZED_NAME_TOTAL_COST) + @jakarta.annotation.Nullable + private String totalCost; + + public static final String SERIALIZED_NAME_VALUE = "value"; + + @SerializedName(SERIALIZED_NAME_VALUE) + @jakarta.annotation.Nullable + private String value; + + public static final String SERIALIZED_NAME_CURRENT_PRICE = "currentPrice"; + + @SerializedName(SERIALIZED_NAME_CURRENT_PRICE) + @jakarta.annotation.Nullable + private String currentPrice; + + public static final String SERIALIZED_NAME_POSITION_STATUS = "positionStatus"; + + @SerializedName(SERIALIZED_NAME_POSITION_STATUS) + @jakarta.annotation.Nullable + private String positionStatus; + + public static final String SERIALIZED_NAME_END_DATE = "endDate"; + + @SerializedName(SERIALIZED_NAME_END_DATE) + @jakarta.annotation.Nullable + private Long endDate; + + public static final String SERIALIZED_NAME_UNREALIZED_PNL = "unrealizedPnl"; + + @SerializedName(SERIALIZED_NAME_UNREALIZED_PNL) + @jakarta.annotation.Nullable + private String unrealizedPnl; + + public static final String SERIALIZED_NAME_REALIZED_PNL = "realizedPnl"; + + @SerializedName(SERIALIZED_NAME_REALIZED_PNL) + @jakarta.annotation.Nullable + private String realizedPnl; + + public static final String SERIALIZED_NAME_PNL = "pnl"; + + @SerializedName(SERIALIZED_NAME_PNL) + @jakarta.annotation.Nullable + private String pnl; + + public static final String SERIALIZED_NAME_CREATED_TIME = "createdTime"; + + @SerializedName(SERIALIZED_NAME_CREATED_TIME) + @jakarta.annotation.Nullable + private Long createdTime; + + public static final String SERIALIZED_NAME_UPDATED_TIME = "updatedTime"; + + @SerializedName(SERIALIZED_NAME_UPDATED_TIME) + @jakarta.annotation.Nullable + private Long updatedTime; + + public GetPositionByTokenResponsePosition() {} + + public GetPositionByTokenResponsePosition positionId( + @jakarta.annotation.Nullable Long positionId) { + this.positionId = positionId; + return this; + } + + /** + * Get positionId + * + * @return positionId + */ + @jakarta.annotation.Nullable + public Long getPositionId() { + return positionId; + } + + public void setPositionId(@jakarta.annotation.Nullable Long positionId) { + this.positionId = positionId; + } + + public GetPositionByTokenResponsePosition vendor(@jakarta.annotation.Nullable String vendor) { + this.vendor = vendor; + return this; + } + + /** + * Get vendor + * + * @return vendor + */ + @jakarta.annotation.Nullable + public String getVendor() { + return vendor; + } + + public void setVendor(@jakarta.annotation.Nullable String vendor) { + this.vendor = vendor; + } + + public GetPositionByTokenResponsePosition 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 GetPositionByTokenResponsePosition 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 GetPositionByTokenResponsePosition collateralSymbol( + @jakarta.annotation.Nullable String collateralSymbol) { + this.collateralSymbol = collateralSymbol; + return this; + } + + /** + * Get collateralSymbol + * + * @return collateralSymbol + */ + @jakarta.annotation.Nullable + public String getCollateralSymbol() { + return collateralSymbol; + } + + public void setCollateralSymbol(@jakarta.annotation.Nullable String collateralSymbol) { + this.collateralSymbol = collateralSymbol; + } + + public GetPositionByTokenResponsePosition topicType( + @jakarta.annotation.Nullable String topicType) { + this.topicType = topicType; + return this; + } + + /** + * Get topicType + * + * @return topicType + */ + @jakarta.annotation.Nullable + public String getTopicType() { + return topicType; + } + + public void setTopicType(@jakarta.annotation.Nullable String topicType) { + this.topicType = topicType; + } + + public GetPositionByTokenResponsePosition marketTopicId( + @jakarta.annotation.Nullable Long marketTopicId) { + this.marketTopicId = marketTopicId; + return this; + } + + /** + * Get marketTopicId + * + * @return marketTopicId + */ + @jakarta.annotation.Nullable + public Long getMarketTopicId() { + return marketTopicId; + } + + public void setMarketTopicId(@jakarta.annotation.Nullable Long marketTopicId) { + this.marketTopicId = marketTopicId; + } + + public GetPositionByTokenResponsePosition marketId(@jakarta.annotation.Nullable Long marketId) { + this.marketId = marketId; + return this; + } + + /** + * Get marketId + * + * @return marketId + */ + @jakarta.annotation.Nullable + public Long getMarketId() { + return marketId; + } + + public void setMarketId(@jakarta.annotation.Nullable Long marketId) { + this.marketId = marketId; + } + + public GetPositionByTokenResponsePosition marketTopicTitle( + @jakarta.annotation.Nullable String marketTopicTitle) { + this.marketTopicTitle = marketTopicTitle; + return this; + } + + /** + * Get marketTopicTitle + * + * @return marketTopicTitle + */ + @jakarta.annotation.Nullable + public String getMarketTopicTitle() { + return marketTopicTitle; + } + + public void setMarketTopicTitle(@jakarta.annotation.Nullable String marketTopicTitle) { + this.marketTopicTitle = marketTopicTitle; + } + + public GetPositionByTokenResponsePosition marketTitle( + @jakarta.annotation.Nullable String marketTitle) { + this.marketTitle = marketTitle; + return this; + } + + /** + * Get marketTitle + * + * @return marketTitle + */ + @jakarta.annotation.Nullable + public String getMarketTitle() { + return marketTitle; + } + + public void setMarketTitle(@jakarta.annotation.Nullable String marketTitle) { + this.marketTitle = marketTitle; + } + + public GetPositionByTokenResponsePosition outcomeName( + @jakarta.annotation.Nullable String outcomeName) { + this.outcomeName = outcomeName; + return this; + } + + /** + * Get outcomeName + * + * @return outcomeName + */ + @jakarta.annotation.Nullable + public String getOutcomeName() { + return outcomeName; + } + + public void setOutcomeName(@jakarta.annotation.Nullable String outcomeName) { + this.outcomeName = outcomeName; + } + + public GetPositionByTokenResponsePosition outcomeIndex( + @jakarta.annotation.Nullable Integer outcomeIndex) { + this.outcomeIndex = outcomeIndex; + return this; + } + + /** + * Get outcomeIndex + * + * @return outcomeIndex + */ + @jakarta.annotation.Nullable + public Integer getOutcomeIndex() { + return outcomeIndex; + } + + public void setOutcomeIndex(@jakarta.annotation.Nullable Integer outcomeIndex) { + this.outcomeIndex = outcomeIndex; + } + + public GetPositionByTokenResponsePosition shares(@jakarta.annotation.Nullable String shares) { + this.shares = shares; + return this; + } + + /** + * Get shares + * + * @return shares + */ + @jakarta.annotation.Nullable + public String getShares() { + return shares; + } + + public void setShares(@jakarta.annotation.Nullable String shares) { + this.shares = shares; + } + + public GetPositionByTokenResponsePosition avgPrice( + @jakarta.annotation.Nullable String avgPrice) { + this.avgPrice = avgPrice; + return this; + } + + /** + * Get avgPrice + * + * @return avgPrice + */ + @jakarta.annotation.Nullable + public String getAvgPrice() { + return avgPrice; + } + + public void setAvgPrice(@jakarta.annotation.Nullable String avgPrice) { + this.avgPrice = avgPrice; + } + + public GetPositionByTokenResponsePosition totalCost( + @jakarta.annotation.Nullable String totalCost) { + this.totalCost = totalCost; + return this; + } + + /** + * Get totalCost + * + * @return totalCost + */ + @jakarta.annotation.Nullable + public String getTotalCost() { + return totalCost; + } + + public void setTotalCost(@jakarta.annotation.Nullable String totalCost) { + this.totalCost = totalCost; + } + + public GetPositionByTokenResponsePosition value(@jakarta.annotation.Nullable String value) { + this.value = value; + return this; + } + + /** + * Get value + * + * @return value + */ + @jakarta.annotation.Nullable + public String getValue() { + return value; + } + + public void setValue(@jakarta.annotation.Nullable String value) { + this.value = value; + } + + public GetPositionByTokenResponsePosition currentPrice( + @jakarta.annotation.Nullable String currentPrice) { + this.currentPrice = currentPrice; + return this; + } + + /** + * Get currentPrice + * + * @return currentPrice + */ + @jakarta.annotation.Nullable + public String getCurrentPrice() { + return currentPrice; + } + + public void setCurrentPrice(@jakarta.annotation.Nullable String currentPrice) { + this.currentPrice = currentPrice; + } + + public GetPositionByTokenResponsePosition positionStatus( + @jakarta.annotation.Nullable String positionStatus) { + this.positionStatus = positionStatus; + return this; + } + + /** + * Get positionStatus + * + * @return positionStatus + */ + @jakarta.annotation.Nullable + public String getPositionStatus() { + return positionStatus; + } + + public void setPositionStatus(@jakarta.annotation.Nullable String positionStatus) { + this.positionStatus = positionStatus; + } + + public GetPositionByTokenResponsePosition endDate(@jakarta.annotation.Nullable Long endDate) { + this.endDate = endDate; + return this; + } + + /** + * Get endDate + * + * @return endDate + */ + @jakarta.annotation.Nullable + public Long getEndDate() { + return endDate; + } + + public void setEndDate(@jakarta.annotation.Nullable Long endDate) { + this.endDate = endDate; + } + + public GetPositionByTokenResponsePosition unrealizedPnl( + @jakarta.annotation.Nullable String unrealizedPnl) { + this.unrealizedPnl = unrealizedPnl; + return this; + } + + /** + * Get unrealizedPnl + * + * @return unrealizedPnl + */ + @jakarta.annotation.Nullable + public String getUnrealizedPnl() { + return unrealizedPnl; + } + + public void setUnrealizedPnl(@jakarta.annotation.Nullable String unrealizedPnl) { + this.unrealizedPnl = unrealizedPnl; + } + + public GetPositionByTokenResponsePosition realizedPnl( + @jakarta.annotation.Nullable String realizedPnl) { + this.realizedPnl = realizedPnl; + return this; + } + + /** + * Get realizedPnl + * + * @return realizedPnl + */ + @jakarta.annotation.Nullable + public String getRealizedPnl() { + return realizedPnl; + } + + public void setRealizedPnl(@jakarta.annotation.Nullable String realizedPnl) { + this.realizedPnl = realizedPnl; + } + + public GetPositionByTokenResponsePosition pnl(@jakarta.annotation.Nullable String pnl) { + this.pnl = pnl; + return this; + } + + /** + * Get pnl + * + * @return pnl + */ + @jakarta.annotation.Nullable + public String getPnl() { + return pnl; + } + + public void setPnl(@jakarta.annotation.Nullable String pnl) { + this.pnl = pnl; + } + + public GetPositionByTokenResponsePosition createdTime( + @jakarta.annotation.Nullable Long createdTime) { + this.createdTime = createdTime; + return this; + } + + /** + * Get createdTime + * + * @return createdTime + */ + @jakarta.annotation.Nullable + public Long getCreatedTime() { + return createdTime; + } + + public void setCreatedTime(@jakarta.annotation.Nullable Long createdTime) { + this.createdTime = createdTime; + } + + public GetPositionByTokenResponsePosition updatedTime( + @jakarta.annotation.Nullable Long updatedTime) { + this.updatedTime = updatedTime; + return this; + } + + /** + * Get updatedTime + * + * @return updatedTime + */ + @jakarta.annotation.Nullable + public Long getUpdatedTime() { + return updatedTime; + } + + public void setUpdatedTime(@jakarta.annotation.Nullable Long updatedTime) { + this.updatedTime = updatedTime; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetPositionByTokenResponsePosition getPositionByTokenResponsePosition = + (GetPositionByTokenResponsePosition) o; + return Objects.equals(this.positionId, getPositionByTokenResponsePosition.positionId) + && Objects.equals(this.vendor, getPositionByTokenResponsePosition.vendor) + && Objects.equals(this.chainId, getPositionByTokenResponsePosition.chainId) + && Objects.equals(this.tokenId, getPositionByTokenResponsePosition.tokenId) + && Objects.equals( + this.collateralSymbol, getPositionByTokenResponsePosition.collateralSymbol) + && Objects.equals(this.topicType, getPositionByTokenResponsePosition.topicType) + && Objects.equals( + this.marketTopicId, getPositionByTokenResponsePosition.marketTopicId) + && Objects.equals(this.marketId, getPositionByTokenResponsePosition.marketId) + && Objects.equals( + this.marketTopicTitle, getPositionByTokenResponsePosition.marketTopicTitle) + && Objects.equals(this.marketTitle, getPositionByTokenResponsePosition.marketTitle) + && Objects.equals(this.outcomeName, getPositionByTokenResponsePosition.outcomeName) + && Objects.equals( + this.outcomeIndex, getPositionByTokenResponsePosition.outcomeIndex) + && Objects.equals(this.shares, getPositionByTokenResponsePosition.shares) + && Objects.equals(this.avgPrice, getPositionByTokenResponsePosition.avgPrice) + && Objects.equals(this.totalCost, getPositionByTokenResponsePosition.totalCost) + && Objects.equals(this.value, getPositionByTokenResponsePosition.value) + && Objects.equals( + this.currentPrice, getPositionByTokenResponsePosition.currentPrice) + && Objects.equals( + this.positionStatus, getPositionByTokenResponsePosition.positionStatus) + && Objects.equals(this.endDate, getPositionByTokenResponsePosition.endDate) + && Objects.equals( + this.unrealizedPnl, getPositionByTokenResponsePosition.unrealizedPnl) + && Objects.equals(this.realizedPnl, getPositionByTokenResponsePosition.realizedPnl) + && Objects.equals(this.pnl, getPositionByTokenResponsePosition.pnl) + && Objects.equals(this.createdTime, getPositionByTokenResponsePosition.createdTime) + && Objects.equals(this.updatedTime, getPositionByTokenResponsePosition.updatedTime); + } + + @Override + public int hashCode() { + return Objects.hash( + positionId, + vendor, + chainId, + tokenId, + collateralSymbol, + topicType, + marketTopicId, + marketId, + marketTopicTitle, + marketTitle, + outcomeName, + outcomeIndex, + shares, + avgPrice, + totalCost, + value, + currentPrice, + positionStatus, + endDate, + unrealizedPnl, + realizedPnl, + pnl, + createdTime, + updatedTime); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetPositionByTokenResponsePosition {\n"); + sb.append(" positionId: ").append(toIndentedString(positionId)).append("\n"); + sb.append(" vendor: ").append(toIndentedString(vendor)).append("\n"); + sb.append(" chainId: ").append(toIndentedString(chainId)).append("\n"); + sb.append(" tokenId: ").append(toIndentedString(tokenId)).append("\n"); + sb.append(" collateralSymbol: ").append(toIndentedString(collateralSymbol)).append("\n"); + sb.append(" topicType: ").append(toIndentedString(topicType)).append("\n"); + sb.append(" marketTopicId: ").append(toIndentedString(marketTopicId)).append("\n"); + sb.append(" marketId: ").append(toIndentedString(marketId)).append("\n"); + sb.append(" marketTopicTitle: ").append(toIndentedString(marketTopicTitle)).append("\n"); + sb.append(" marketTitle: ").append(toIndentedString(marketTitle)).append("\n"); + sb.append(" outcomeName: ").append(toIndentedString(outcomeName)).append("\n"); + sb.append(" outcomeIndex: ").append(toIndentedString(outcomeIndex)).append("\n"); + sb.append(" shares: ").append(toIndentedString(shares)).append("\n"); + sb.append(" avgPrice: ").append(toIndentedString(avgPrice)).append("\n"); + sb.append(" totalCost: ").append(toIndentedString(totalCost)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" currentPrice: ").append(toIndentedString(currentPrice)).append("\n"); + sb.append(" positionStatus: ").append(toIndentedString(positionStatus)).append("\n"); + sb.append(" endDate: ").append(toIndentedString(endDate)).append("\n"); + sb.append(" unrealizedPnl: ").append(toIndentedString(unrealizedPnl)).append("\n"); + sb.append(" realizedPnl: ").append(toIndentedString(realizedPnl)).append("\n"); + sb.append(" pnl: ").append(toIndentedString(pnl)).append("\n"); + sb.append(" createdTime: ").append(toIndentedString(createdTime)).append("\n"); + sb.append(" updatedTime: ").append(toIndentedString(updatedTime)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object positionIdValue = getPositionId(); + String positionIdValueAsString = ""; + positionIdValueAsString = positionIdValue.toString(); + sb.append("positionId=").append(urlEncode(positionIdValueAsString)).append(""); + Object vendorValue = getVendor(); + String vendorValueAsString = ""; + vendorValueAsString = vendorValue.toString(); + sb.append("vendor=").append(urlEncode(vendorValueAsString)).append(""); + Object chainIdValue = getChainId(); + String chainIdValueAsString = ""; + chainIdValueAsString = chainIdValue.toString(); + sb.append("chainId=").append(urlEncode(chainIdValueAsString)).append(""); + Object tokenIdValue = getTokenId(); + String tokenIdValueAsString = ""; + tokenIdValueAsString = tokenIdValue.toString(); + sb.append("tokenId=").append(urlEncode(tokenIdValueAsString)).append(""); + Object collateralSymbolValue = getCollateralSymbol(); + String collateralSymbolValueAsString = ""; + collateralSymbolValueAsString = collateralSymbolValue.toString(); + sb.append("collateralSymbol=").append(urlEncode(collateralSymbolValueAsString)).append(""); + Object topicTypeValue = getTopicType(); + String topicTypeValueAsString = ""; + topicTypeValueAsString = topicTypeValue.toString(); + sb.append("topicType=").append(urlEncode(topicTypeValueAsString)).append(""); + Object marketTopicIdValue = getMarketTopicId(); + String marketTopicIdValueAsString = ""; + marketTopicIdValueAsString = marketTopicIdValue.toString(); + sb.append("marketTopicId=").append(urlEncode(marketTopicIdValueAsString)).append(""); + Object marketIdValue = getMarketId(); + String marketIdValueAsString = ""; + marketIdValueAsString = marketIdValue.toString(); + sb.append("marketId=").append(urlEncode(marketIdValueAsString)).append(""); + Object marketTopicTitleValue = getMarketTopicTitle(); + String marketTopicTitleValueAsString = ""; + marketTopicTitleValueAsString = marketTopicTitleValue.toString(); + sb.append("marketTopicTitle=").append(urlEncode(marketTopicTitleValueAsString)).append(""); + Object marketTitleValue = getMarketTitle(); + String marketTitleValueAsString = ""; + marketTitleValueAsString = marketTitleValue.toString(); + sb.append("marketTitle=").append(urlEncode(marketTitleValueAsString)).append(""); + Object outcomeNameValue = getOutcomeName(); + String outcomeNameValueAsString = ""; + outcomeNameValueAsString = outcomeNameValue.toString(); + sb.append("outcomeName=").append(urlEncode(outcomeNameValueAsString)).append(""); + Object outcomeIndexValue = getOutcomeIndex(); + String outcomeIndexValueAsString = ""; + outcomeIndexValueAsString = outcomeIndexValue.toString(); + sb.append("outcomeIndex=").append(urlEncode(outcomeIndexValueAsString)).append(""); + Object sharesValue = getShares(); + String sharesValueAsString = ""; + sharesValueAsString = sharesValue.toString(); + sb.append("shares=").append(urlEncode(sharesValueAsString)).append(""); + Object avgPriceValue = getAvgPrice(); + String avgPriceValueAsString = ""; + avgPriceValueAsString = avgPriceValue.toString(); + sb.append("avgPrice=").append(urlEncode(avgPriceValueAsString)).append(""); + Object totalCostValue = getTotalCost(); + String totalCostValueAsString = ""; + totalCostValueAsString = totalCostValue.toString(); + sb.append("totalCost=").append(urlEncode(totalCostValueAsString)).append(""); + Object valueValue = getValue(); + String valueValueAsString = ""; + valueValueAsString = valueValue.toString(); + sb.append("value=").append(urlEncode(valueValueAsString)).append(""); + Object currentPriceValue = getCurrentPrice(); + String currentPriceValueAsString = ""; + currentPriceValueAsString = currentPriceValue.toString(); + sb.append("currentPrice=").append(urlEncode(currentPriceValueAsString)).append(""); + Object positionStatusValue = getPositionStatus(); + String positionStatusValueAsString = ""; + positionStatusValueAsString = positionStatusValue.toString(); + sb.append("positionStatus=").append(urlEncode(positionStatusValueAsString)).append(""); + Object endDateValue = getEndDate(); + String endDateValueAsString = ""; + endDateValueAsString = endDateValue.toString(); + sb.append("endDate=").append(urlEncode(endDateValueAsString)).append(""); + Object unrealizedPnlValue = getUnrealizedPnl(); + String unrealizedPnlValueAsString = ""; + unrealizedPnlValueAsString = unrealizedPnlValue.toString(); + sb.append("unrealizedPnl=").append(urlEncode(unrealizedPnlValueAsString)).append(""); + Object realizedPnlValue = getRealizedPnl(); + String realizedPnlValueAsString = ""; + realizedPnlValueAsString = realizedPnlValue.toString(); + sb.append("realizedPnl=").append(urlEncode(realizedPnlValueAsString)).append(""); + Object pnlValue = getPnl(); + String pnlValueAsString = ""; + pnlValueAsString = pnlValue.toString(); + sb.append("pnl=").append(urlEncode(pnlValueAsString)).append(""); + Object createdTimeValue = getCreatedTime(); + String createdTimeValueAsString = ""; + createdTimeValueAsString = createdTimeValue.toString(); + sb.append("createdTime=").append(urlEncode(createdTimeValueAsString)).append(""); + Object updatedTimeValue = getUpdatedTime(); + String updatedTimeValueAsString = ""; + updatedTimeValueAsString = updatedTimeValue.toString(); + sb.append("updatedTime=").append(urlEncode(updatedTimeValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("positionId"); + openapiFields.add("vendor"); + openapiFields.add("chainId"); + openapiFields.add("tokenId"); + openapiFields.add("collateralSymbol"); + openapiFields.add("topicType"); + openapiFields.add("marketTopicId"); + openapiFields.add("marketId"); + openapiFields.add("marketTopicTitle"); + openapiFields.add("marketTitle"); + openapiFields.add("outcomeName"); + openapiFields.add("outcomeIndex"); + openapiFields.add("shares"); + openapiFields.add("avgPrice"); + openapiFields.add("totalCost"); + openapiFields.add("value"); + openapiFields.add("currentPrice"); + openapiFields.add("positionStatus"); + openapiFields.add("endDate"); + openapiFields.add("unrealizedPnl"); + openapiFields.add("realizedPnl"); + openapiFields.add("pnl"); + openapiFields.add("createdTime"); + openapiFields.add("updatedTime"); + + // 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 + * GetPositionByTokenResponsePosition + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetPositionByTokenResponsePosition.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetPositionByTokenResponsePosition is" + + " not found in the empty JSON string", + GetPositionByTokenResponsePosition.openapiRequiredFields + .toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("vendor") != null && !jsonObj.get("vendor").isJsonNull()) + && !jsonObj.get("vendor").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `vendor` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("vendor").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("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("collateralSymbol") != null + && !jsonObj.get("collateralSymbol").isJsonNull()) + && !jsonObj.get("collateralSymbol").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `collateralSymbol` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("collateralSymbol").toString())); + } + if ((jsonObj.get("topicType") != null && !jsonObj.get("topicType").isJsonNull()) + && !jsonObj.get("topicType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `topicType` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("topicType").toString())); + } + if ((jsonObj.get("marketTopicTitle") != null + && !jsonObj.get("marketTopicTitle").isJsonNull()) + && !jsonObj.get("marketTopicTitle").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `marketTopicTitle` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("marketTopicTitle").toString())); + } + if ((jsonObj.get("marketTitle") != null && !jsonObj.get("marketTitle").isJsonNull()) + && !jsonObj.get("marketTitle").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `marketTitle` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("marketTitle").toString())); + } + if ((jsonObj.get("outcomeName") != null && !jsonObj.get("outcomeName").isJsonNull()) + && !jsonObj.get("outcomeName").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `outcomeName` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("outcomeName").toString())); + } + if ((jsonObj.get("shares") != null && !jsonObj.get("shares").isJsonNull()) + && !jsonObj.get("shares").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `shares` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("shares").toString())); + } + if ((jsonObj.get("avgPrice") != null && !jsonObj.get("avgPrice").isJsonNull()) + && !jsonObj.get("avgPrice").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `avgPrice` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("avgPrice").toString())); + } + if ((jsonObj.get("totalCost") != null && !jsonObj.get("totalCost").isJsonNull()) + && !jsonObj.get("totalCost").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `totalCost` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("totalCost").toString())); + } + if ((jsonObj.get("value") != null && !jsonObj.get("value").isJsonNull()) + && !jsonObj.get("value").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `value` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("value").toString())); + } + if ((jsonObj.get("currentPrice") != null && !jsonObj.get("currentPrice").isJsonNull()) + && !jsonObj.get("currentPrice").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `currentPrice` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("currentPrice").toString())); + } + if ((jsonObj.get("positionStatus") != null && !jsonObj.get("positionStatus").isJsonNull()) + && !jsonObj.get("positionStatus").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `positionStatus` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("positionStatus").toString())); + } + if ((jsonObj.get("unrealizedPnl") != null && !jsonObj.get("unrealizedPnl").isJsonNull()) + && !jsonObj.get("unrealizedPnl").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `unrealizedPnl` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("unrealizedPnl").toString())); + } + if ((jsonObj.get("realizedPnl") != null && !jsonObj.get("realizedPnl").isJsonNull()) + && !jsonObj.get("realizedPnl").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `realizedPnl` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("realizedPnl").toString())); + } + if ((jsonObj.get("pnl") != null && !jsonObj.get("pnl").isJsonNull()) + && !jsonObj.get("pnl").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `pnl` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("pnl").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetPositionByTokenResponsePosition.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetPositionByTokenResponsePosition' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(GetPositionByTokenResponsePosition.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetPositionByTokenResponsePosition value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetPositionByTokenResponsePosition read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetPositionByTokenResponsePosition given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetPositionByTokenResponsePosition + * @throws IOException if the JSON string is invalid with respect to + * GetPositionByTokenResponsePosition + */ + public static GetPositionByTokenResponsePosition fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, GetPositionByTokenResponsePosition.class); + } + + /** + * Convert an instance of GetPositionByTokenResponsePosition to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/GetQuotaStatusResponse.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/GetQuotaStatusResponse.java new file mode 100644 index 000000000..5d29cc4fb --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/GetQuotaStatusResponse.java @@ -0,0 +1,257 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.model; + +import com.binance.connector.client.w3w_prediction.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.*; + +/** GetQuotaStatusResponse */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class GetQuotaStatusResponse { + public static final String SERIALIZED_NAME_DAILY_LIMIT = "dailyLimit"; + + @SerializedName(SERIALIZED_NAME_DAILY_LIMIT) + @jakarta.annotation.Nullable + private String dailyLimit; + + public static final String SERIALIZED_NAME_REMAINING_DAILY_LIMIT = "remainingDailyLimit"; + + @SerializedName(SERIALIZED_NAME_REMAINING_DAILY_LIMIT) + @jakarta.annotation.Nullable + private String remainingDailyLimit; + + public GetQuotaStatusResponse() {} + + public GetQuotaStatusResponse dailyLimit(@jakarta.annotation.Nullable String dailyLimit) { + this.dailyLimit = dailyLimit; + return this; + } + + /** + * Get dailyLimit + * + * @return dailyLimit + */ + @jakarta.annotation.Nullable + public String getDailyLimit() { + return dailyLimit; + } + + public void setDailyLimit(@jakarta.annotation.Nullable String dailyLimit) { + this.dailyLimit = dailyLimit; + } + + public GetQuotaStatusResponse remainingDailyLimit( + @jakarta.annotation.Nullable String remainingDailyLimit) { + this.remainingDailyLimit = remainingDailyLimit; + return this; + } + + /** + * Get remainingDailyLimit + * + * @return remainingDailyLimit + */ + @jakarta.annotation.Nullable + public String getRemainingDailyLimit() { + return remainingDailyLimit; + } + + public void setRemainingDailyLimit(@jakarta.annotation.Nullable String remainingDailyLimit) { + this.remainingDailyLimit = remainingDailyLimit; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetQuotaStatusResponse getQuotaStatusResponse = (GetQuotaStatusResponse) o; + return Objects.equals(this.dailyLimit, getQuotaStatusResponse.dailyLimit) + && Objects.equals( + this.remainingDailyLimit, getQuotaStatusResponse.remainingDailyLimit); + } + + @Override + public int hashCode() { + return Objects.hash(dailyLimit, remainingDailyLimit); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetQuotaStatusResponse {\n"); + sb.append(" dailyLimit: ").append(toIndentedString(dailyLimit)).append("\n"); + sb.append(" remainingDailyLimit: ") + .append(toIndentedString(remainingDailyLimit)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object dailyLimitValue = getDailyLimit(); + String dailyLimitValueAsString = ""; + dailyLimitValueAsString = dailyLimitValue.toString(); + sb.append("dailyLimit=").append(urlEncode(dailyLimitValueAsString)).append(""); + Object remainingDailyLimitValue = getRemainingDailyLimit(); + String remainingDailyLimitValueAsString = ""; + remainingDailyLimitValueAsString = remainingDailyLimitValue.toString(); + sb.append("remainingDailyLimit=") + .append(urlEncode(remainingDailyLimitValueAsString)) + .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("dailyLimit"); + openapiFields.add("remainingDailyLimit"); + + // 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 GetQuotaStatusResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetQuotaStatusResponse.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetQuotaStatusResponse is not found in" + + " the empty JSON string", + GetQuotaStatusResponse.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("dailyLimit") != null && !jsonObj.get("dailyLimit").isJsonNull()) + && !jsonObj.get("dailyLimit").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `dailyLimit` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("dailyLimit").toString())); + } + if ((jsonObj.get("remainingDailyLimit") != null + && !jsonObj.get("remainingDailyLimit").isJsonNull()) + && !jsonObj.get("remainingDailyLimit").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `remainingDailyLimit` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("remainingDailyLimit").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetQuotaStatusResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetQuotaStatusResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(GetQuotaStatusResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetQuotaStatusResponse value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetQuotaStatusResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetQuotaStatusResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetQuotaStatusResponse + * @throws IOException if the JSON string is invalid with respect to GetQuotaStatusResponse + */ + public static GetQuotaStatusResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetQuotaStatusResponse.class); + } + + /** + * Convert an instance of GetQuotaStatusResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/GetQuoteRequest.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/GetQuoteRequest.java new file mode 100644 index 000000000..ee4dda42e --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/GetQuoteRequest.java @@ -0,0 +1,624 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.model; + +import com.binance.connector.client.w3w_prediction.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.*; + +/** GetQuoteRequest */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class GetQuoteRequest { + public static final String SERIALIZED_NAME_WALLET_ADDRESS = "walletAddress"; + + @SerializedName(SERIALIZED_NAME_WALLET_ADDRESS) + @jakarta.annotation.Nonnull + private String walletAddress; + + public static final String SERIALIZED_NAME_TOKEN_ID = "tokenId"; + + @SerializedName(SERIALIZED_NAME_TOKEN_ID) + @jakarta.annotation.Nonnull + private String tokenId; + + public static final String SERIALIZED_NAME_SIDE = "side"; + + @SerializedName(SERIALIZED_NAME_SIDE) + @jakarta.annotation.Nonnull + private Side side; + + public static final String SERIALIZED_NAME_AMOUNT_IN = "amountIn"; + + @SerializedName(SERIALIZED_NAME_AMOUNT_IN) + @jakarta.annotation.Nonnull + private String amountIn; + + public static final String SERIALIZED_NAME_ORDER_TYPE = "orderType"; + + @SerializedName(SERIALIZED_NAME_ORDER_TYPE) + @jakarta.annotation.Nonnull + private OrderType orderType; + + public static final String SERIALIZED_NAME_SLIPPAGE_BPS = "slippageBps"; + + @SerializedName(SERIALIZED_NAME_SLIPPAGE_BPS) + @jakarta.annotation.Nonnull + private Integer slippageBps; + + public static final String SERIALIZED_NAME_PRICE_LIMIT = "priceLimit"; + + @SerializedName(SERIALIZED_NAME_PRICE_LIMIT) + @jakarta.annotation.Nullable + private String priceLimit; + + public static final String SERIALIZED_NAME_CHAIN_ID = "chainId"; + + @SerializedName(SERIALIZED_NAME_CHAIN_ID) + @jakarta.annotation.Nullable + private String chainId = "56"; + + public static final String SERIALIZED_NAME_FEE_RATE_BPS = "feeRateBps"; + + @SerializedName(SERIALIZED_NAME_FEE_RATE_BPS) + @jakarta.annotation.Nullable + private Integer feeRateBps = 200; + + public static final String SERIALIZED_NAME_FUNDING_SOURCE = "fundingSource"; + + @SerializedName(SERIALIZED_NAME_FUNDING_SOURCE) + @jakarta.annotation.Nullable + private FundingSource fundingSource = FundingSource.MPC; + + public static final String SERIALIZED_NAME_FUND_TRANSFER_AMOUNT = "fundTransferAmount"; + + @SerializedName(SERIALIZED_NAME_FUND_TRANSFER_AMOUNT) + @jakarta.annotation.Nullable + private String fundTransferAmount; + + public GetQuoteRequest() {} + + public GetQuoteRequest walletAddress(@jakarta.annotation.Nonnull String walletAddress) { + this.walletAddress = walletAddress; + return this; + } + + /** + * User's prediction wallet address + * + * @return walletAddress + */ + @jakarta.annotation.Nonnull + @NotNull + public String getWalletAddress() { + return walletAddress; + } + + public void setWalletAddress(@jakarta.annotation.Nonnull String walletAddress) { + this.walletAddress = walletAddress; + } + + public GetQuoteRequest tokenId(@jakarta.annotation.Nonnull String tokenId) { + this.tokenId = tokenId; + return this; + } + + /** + * Prediction outcome token ID + * + * @return tokenId + */ + @jakarta.annotation.Nonnull + @NotNull + public String getTokenId() { + return tokenId; + } + + public void setTokenId(@jakarta.annotation.Nonnull String tokenId) { + this.tokenId = tokenId; + } + + public GetQuoteRequest side(@jakarta.annotation.Nonnull Side side) { + this.side = side; + return this; + } + + /** + * Get side + * + * @return side + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public Side getSide() { + return side; + } + + public void setSide(@jakarta.annotation.Nonnull Side side) { + this.side = side; + } + + public GetQuoteRequest amountIn(@jakarta.annotation.Nonnull String amountIn) { + this.amountIn = amountIn; + return this; + } + + /** + * Input amount in wei (18 decimals). Must be > 0. For `MARKET` orders, minimum is + * approximately 1.5 USDT (varies by market depth). Example: `1000000000000000000` + * = 1 USDT + * + * @return amountIn + */ + @jakarta.annotation.Nonnull + @NotNull + public String getAmountIn() { + return amountIn; + } + + public void setAmountIn(@jakarta.annotation.Nonnull String amountIn) { + this.amountIn = amountIn; + } + + public GetQuoteRequest orderType(@jakarta.annotation.Nonnull OrderType orderType) { + this.orderType = orderType; + return this; + } + + /** + * Get orderType + * + * @return orderType + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public OrderType getOrderType() { + return orderType; + } + + public void setOrderType(@jakarta.annotation.Nonnull OrderType orderType) { + this.orderType = orderType; + } + + public GetQuoteRequest slippageBps(@jakarta.annotation.Nonnull Integer slippageBps) { + this.slippageBps = slippageBps; + return this; + } + + /** + * Slippage tolerance in basis points. Range 1–10000 minimum: 1 maximum: 10000 + * + * @return slippageBps + */ + @jakarta.annotation.Nonnull + @NotNull + @Min(1) + @Max(10000) + public Integer getSlippageBps() { + return slippageBps; + } + + public void setSlippageBps(@jakarta.annotation.Nonnull Integer slippageBps) { + this.slippageBps = slippageBps; + } + + public GetQuoteRequest priceLimit(@jakarta.annotation.Nullable String priceLimit) { + this.priceLimit = priceLimit; + return this; + } + + /** + * Limit price. Required when `orderType=LIMIT`. Must be > 0 + * + * @return priceLimit + */ + @jakarta.annotation.Nullable + public String getPriceLimit() { + return priceLimit; + } + + public void setPriceLimit(@jakarta.annotation.Nullable String priceLimit) { + this.priceLimit = priceLimit; + } + + public GetQuoteRequest chainId(@jakarta.annotation.Nullable String chainId) { + this.chainId = chainId; + return this; + } + + /** + * Chain ID. Default `56` (BSC) + * + * @return chainId + */ + @jakarta.annotation.Nullable + public String getChainId() { + return chainId; + } + + public void setChainId(@jakarta.annotation.Nullable String chainId) { + this.chainId = chainId; + } + + public GetQuoteRequest feeRateBps(@jakarta.annotation.Nullable Integer feeRateBps) { + this.feeRateBps = feeRateBps; + return this; + } + + /** + * Fee rate in basis points. Default `200`, range 1–10000 minimum: 1 maximum: 10000 + * + * @return feeRateBps + */ + @jakarta.annotation.Nullable + @Min(1) + @Max(10000) + public Integer getFeeRateBps() { + return feeRateBps; + } + + public void setFeeRateBps(@jakarta.annotation.Nullable Integer feeRateBps) { + this.feeRateBps = feeRateBps; + } + + public GetQuoteRequest fundingSource(@jakarta.annotation.Nullable FundingSource fundingSource) { + this.fundingSource = fundingSource; + return this; + } + + /** + * Get fundingSource + * + * @return fundingSource + */ + @jakarta.annotation.Nullable + @Valid + public FundingSource getFundingSource() { + return fundingSource; + } + + public void setFundingSource(@jakarta.annotation.Nullable FundingSource fundingSource) { + this.fundingSource = fundingSource; + } + + public GetQuoteRequest fundTransferAmount( + @jakarta.annotation.Nullable String fundTransferAmount) { + this.fundTransferAmount = fundTransferAmount; + return this; + } + + /** + * Auto-transfer amount before order (wei). Must be > 0 if provided + * + * @return fundTransferAmount + */ + @jakarta.annotation.Nullable + public String getFundTransferAmount() { + return fundTransferAmount; + } + + public void setFundTransferAmount(@jakarta.annotation.Nullable String fundTransferAmount) { + this.fundTransferAmount = fundTransferAmount; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetQuoteRequest getQuoteRequest = (GetQuoteRequest) o; + return Objects.equals(this.walletAddress, getQuoteRequest.walletAddress) + && Objects.equals(this.tokenId, getQuoteRequest.tokenId) + && Objects.equals(this.side, getQuoteRequest.side) + && Objects.equals(this.amountIn, getQuoteRequest.amountIn) + && Objects.equals(this.orderType, getQuoteRequest.orderType) + && Objects.equals(this.slippageBps, getQuoteRequest.slippageBps) + && Objects.equals(this.priceLimit, getQuoteRequest.priceLimit) + && Objects.equals(this.chainId, getQuoteRequest.chainId) + && Objects.equals(this.feeRateBps, getQuoteRequest.feeRateBps) + && Objects.equals(this.fundingSource, getQuoteRequest.fundingSource) + && Objects.equals(this.fundTransferAmount, getQuoteRequest.fundTransferAmount); + } + + @Override + public int hashCode() { + return Objects.hash( + walletAddress, + tokenId, + side, + amountIn, + orderType, + slippageBps, + priceLimit, + chainId, + feeRateBps, + fundingSource, + fundTransferAmount); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetQuoteRequest {\n"); + sb.append(" walletAddress: ").append(toIndentedString(walletAddress)).append("\n"); + sb.append(" tokenId: ").append(toIndentedString(tokenId)).append("\n"); + sb.append(" side: ").append(toIndentedString(side)).append("\n"); + sb.append(" amountIn: ").append(toIndentedString(amountIn)).append("\n"); + sb.append(" orderType: ").append(toIndentedString(orderType)).append("\n"); + sb.append(" slippageBps: ").append(toIndentedString(slippageBps)).append("\n"); + sb.append(" priceLimit: ").append(toIndentedString(priceLimit)).append("\n"); + sb.append(" chainId: ").append(toIndentedString(chainId)).append("\n"); + sb.append(" feeRateBps: ").append(toIndentedString(feeRateBps)).append("\n"); + sb.append(" fundingSource: ").append(toIndentedString(fundingSource)).append("\n"); + sb.append(" fundTransferAmount: ") + .append(toIndentedString(fundTransferAmount)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object walletAddressValue = getWalletAddress(); + String walletAddressValueAsString = ""; + walletAddressValueAsString = walletAddressValue.toString(); + sb.append("walletAddress=").append(urlEncode(walletAddressValueAsString)).append(""); + Object tokenIdValue = getTokenId(); + String tokenIdValueAsString = ""; + tokenIdValueAsString = tokenIdValue.toString(); + sb.append("tokenId=").append(urlEncode(tokenIdValueAsString)).append(""); + Object sideValue = getSide(); + String sideValueAsString = ""; + sideValueAsString = sideValue.toString(); + sb.append("side=").append(urlEncode(sideValueAsString)).append(""); + Object amountInValue = getAmountIn(); + String amountInValueAsString = ""; + amountInValueAsString = amountInValue.toString(); + sb.append("amountIn=").append(urlEncode(amountInValueAsString)).append(""); + Object orderTypeValue = getOrderType(); + String orderTypeValueAsString = ""; + orderTypeValueAsString = orderTypeValue.toString(); + sb.append("orderType=").append(urlEncode(orderTypeValueAsString)).append(""); + Object slippageBpsValue = getSlippageBps(); + String slippageBpsValueAsString = ""; + slippageBpsValueAsString = slippageBpsValue.toString(); + sb.append("slippageBps=").append(urlEncode(slippageBpsValueAsString)).append(""); + Object priceLimitValue = getPriceLimit(); + String priceLimitValueAsString = ""; + priceLimitValueAsString = priceLimitValue.toString(); + sb.append("priceLimit=").append(urlEncode(priceLimitValueAsString)).append(""); + Object chainIdValue = getChainId(); + String chainIdValueAsString = ""; + chainIdValueAsString = chainIdValue.toString(); + sb.append("chainId=").append(urlEncode(chainIdValueAsString)).append(""); + Object feeRateBpsValue = getFeeRateBps(); + String feeRateBpsValueAsString = ""; + feeRateBpsValueAsString = feeRateBpsValue.toString(); + sb.append("feeRateBps=").append(urlEncode(feeRateBpsValueAsString)).append(""); + Object fundingSourceValue = getFundingSource(); + String fundingSourceValueAsString = ""; + fundingSourceValueAsString = fundingSourceValue.toString(); + sb.append("fundingSource=").append(urlEncode(fundingSourceValueAsString)).append(""); + Object fundTransferAmountValue = getFundTransferAmount(); + String fundTransferAmountValueAsString = ""; + fundTransferAmountValueAsString = fundTransferAmountValue.toString(); + sb.append("fundTransferAmount=") + .append(urlEncode(fundTransferAmountValueAsString)) + .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("walletAddress"); + openapiFields.add("tokenId"); + openapiFields.add("side"); + openapiFields.add("amountIn"); + openapiFields.add("orderType"); + openapiFields.add("slippageBps"); + openapiFields.add("priceLimit"); + openapiFields.add("chainId"); + openapiFields.add("feeRateBps"); + openapiFields.add("fundingSource"); + openapiFields.add("fundTransferAmount"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("walletAddress"); + openapiRequiredFields.add("tokenId"); + openapiRequiredFields.add("side"); + openapiRequiredFields.add("amountIn"); + openapiRequiredFields.add("orderType"); + openapiRequiredFields.add("slippageBps"); + } + + /** + * 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 GetQuoteRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetQuoteRequest.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetQuoteRequest is not found in the" + + " empty JSON string", + GetQuoteRequest.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GetQuoteRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("walletAddress").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `walletAddress` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("walletAddress").toString())); + } + if (!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())); + } + // validate the required field `side` + Side.validateJsonElement(jsonObj.get("side")); + if (!jsonObj.get("amountIn").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `amountIn` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("amountIn").toString())); + } + // validate the required field `orderType` + OrderType.validateJsonElement(jsonObj.get("orderType")); + if ((jsonObj.get("priceLimit") != null && !jsonObj.get("priceLimit").isJsonNull()) + && !jsonObj.get("priceLimit").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `priceLimit` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("priceLimit").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())); + } + // validate the optional field `fundingSource` + if (jsonObj.get("fundingSource") != null && !jsonObj.get("fundingSource").isJsonNull()) { + FundingSource.validateJsonElement(jsonObj.get("fundingSource")); + } + if ((jsonObj.get("fundTransferAmount") != null + && !jsonObj.get("fundTransferAmount").isJsonNull()) + && !jsonObj.get("fundTransferAmount").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `fundTransferAmount` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("fundTransferAmount").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetQuoteRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetQuoteRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(GetQuoteRequest.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetQuoteRequest value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetQuoteRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetQuoteRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetQuoteRequest + * @throws IOException if the JSON string is invalid with respect to GetQuoteRequest + */ + public static GetQuoteRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetQuoteRequest.class); + } + + /** + * Convert an instance of GetQuoteRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/GetQuoteResponse.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/GetQuoteResponse.java new file mode 100644 index 000000000..3a13a5c02 --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/GetQuoteResponse.java @@ -0,0 +1,1146 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.model; + +import com.binance.connector.client.w3w_prediction.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.math.BigDecimal; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** GetQuoteResponse */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class GetQuoteResponse { + public static final String SERIALIZED_NAME_QUOTE_ID = "quoteId"; + + @SerializedName(SERIALIZED_NAME_QUOTE_ID) + @jakarta.annotation.Nullable + private String quoteId; + + 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_CHANCE = "chance"; + + @SerializedName(SERIALIZED_NAME_CHANCE) + @jakarta.annotation.Nullable + private String chance; + + public static final String SERIALIZED_NAME_VENDOR = "vendor"; + + @SerializedName(SERIALIZED_NAME_VENDOR) + @jakarta.annotation.Nullable + private String vendor; + + public static final String SERIALIZED_NAME_MARKET_TITLE = "marketTitle"; + + @SerializedName(SERIALIZED_NAME_MARKET_TITLE) + @jakarta.annotation.Nullable + private String marketTitle; + + public static final String SERIALIZED_NAME_MARKET_EXT_ID = "marketExtId"; + + @SerializedName(SERIALIZED_NAME_MARKET_EXT_ID) + @jakarta.annotation.Nullable + private String marketExtId; + + public static final String SERIALIZED_NAME_SIDE = "side"; + + @SerializedName(SERIALIZED_NAME_SIDE) + @jakarta.annotation.Nullable + private String side; + + public static final String SERIALIZED_NAME_AMOUNT_IN = "amountIn"; + + @SerializedName(SERIALIZED_NAME_AMOUNT_IN) + @jakarta.annotation.Nullable + private String amountIn; + + public static final String SERIALIZED_NAME_AMOUNT_OUT = "amountOut"; + + @SerializedName(SERIALIZED_NAME_AMOUNT_OUT) + @jakarta.annotation.Nullable + private String amountOut; + + public static final String SERIALIZED_NAME_IS_MIN_AMOUNT_OUT = "isMinAmountOut"; + + @SerializedName(SERIALIZED_NAME_IS_MIN_AMOUNT_OUT) + @jakarta.annotation.Nullable + private Boolean isMinAmountOut; + + public static final String SERIALIZED_NAME_FEE_AMOUNT = "feeAmount"; + + @SerializedName(SERIALIZED_NAME_FEE_AMOUNT) + @jakarta.annotation.Nullable + private String feeAmount; + + public static final String SERIALIZED_NAME_FEE_DISCOUNT_BPS = "feeDiscountBps"; + + @SerializedName(SERIALIZED_NAME_FEE_DISCOUNT_BPS) + @jakarta.annotation.Nullable + private String feeDiscountBps; + + public static final String SERIALIZED_NAME_AVERAGE_PRICE = "averagePrice"; + + @SerializedName(SERIALIZED_NAME_AVERAGE_PRICE) + @jakarta.annotation.Nullable + private BigDecimal averagePrice; + + public static final String SERIALIZED_NAME_LAST_PRICE = "lastPrice"; + + @SerializedName(SERIALIZED_NAME_LAST_PRICE) + @jakarta.annotation.Nullable + private BigDecimal lastPrice; + + public static final String SERIALIZED_NAME_PRICE_IMPACT = "priceImpact"; + + @SerializedName(SERIALIZED_NAME_PRICE_IMPACT) + @jakarta.annotation.Nullable + private BigDecimal priceImpact; + + public static final String SERIALIZED_NAME_TIMESTAMP = "timestamp"; + + @SerializedName(SERIALIZED_NAME_TIMESTAMP) + @jakarta.annotation.Nullable + private Long timestamp; + + 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_USER_ID = "userId"; + + @SerializedName(SERIALIZED_NAME_USER_ID) + @jakarta.annotation.Nullable + private Long userId; + + public static final String SERIALIZED_NAME_WALLET_ADDRESS = "walletAddress"; + + @SerializedName(SERIALIZED_NAME_WALLET_ADDRESS) + @jakarta.annotation.Nullable + private String walletAddress; + + public static final String SERIALIZED_NAME_ORDER_TYPE = "orderType"; + + @SerializedName(SERIALIZED_NAME_ORDER_TYPE) + @jakarta.annotation.Nullable + private String orderType; + + public static final String SERIALIZED_NAME_SLIPPAGE_BPS = "slippageBps"; + + @SerializedName(SERIALIZED_NAME_SLIPPAGE_BPS) + @jakarta.annotation.Nullable + private Integer slippageBps; + + public static final String SERIALIZED_NAME_FEE_RATE_BPS = "feeRateBps"; + + @SerializedName(SERIALIZED_NAME_FEE_RATE_BPS) + @jakarta.annotation.Nullable + private Integer feeRateBps; + + public static final String SERIALIZED_NAME_MIN_RECEIVE = "minReceive"; + + @SerializedName(SERIALIZED_NAME_MIN_RECEIVE) + @jakarta.annotation.Nullable + private String minReceive; + + public static final String SERIALIZED_NAME_EXPIRE_AT = "expireAt"; + + @SerializedName(SERIALIZED_NAME_EXPIRE_AT) + @jakarta.annotation.Nullable + private Long expireAt; + + public static final String SERIALIZED_NAME_PRICE_LIMIT = "priceLimit"; + + @SerializedName(SERIALIZED_NAME_PRICE_LIMIT) + @jakarta.annotation.Nullable + private String priceLimit; + + public GetQuoteResponse() {} + + public GetQuoteResponse quoteId(@jakarta.annotation.Nullable String quoteId) { + this.quoteId = quoteId; + return this; + } + + /** + * Get quoteId + * + * @return quoteId + */ + @jakarta.annotation.Nullable + public String getQuoteId() { + return quoteId; + } + + public void setQuoteId(@jakarta.annotation.Nullable String quoteId) { + this.quoteId = quoteId; + } + + public GetQuoteResponse 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 GetQuoteResponse chance(@jakarta.annotation.Nullable String chance) { + this.chance = chance; + return this; + } + + /** + * Get chance + * + * @return chance + */ + @jakarta.annotation.Nullable + public String getChance() { + return chance; + } + + public void setChance(@jakarta.annotation.Nullable String chance) { + this.chance = chance; + } + + public GetQuoteResponse vendor(@jakarta.annotation.Nullable String vendor) { + this.vendor = vendor; + return this; + } + + /** + * Get vendor + * + * @return vendor + */ + @jakarta.annotation.Nullable + public String getVendor() { + return vendor; + } + + public void setVendor(@jakarta.annotation.Nullable String vendor) { + this.vendor = vendor; + } + + public GetQuoteResponse marketTitle(@jakarta.annotation.Nullable String marketTitle) { + this.marketTitle = marketTitle; + return this; + } + + /** + * Get marketTitle + * + * @return marketTitle + */ + @jakarta.annotation.Nullable + public String getMarketTitle() { + return marketTitle; + } + + public void setMarketTitle(@jakarta.annotation.Nullable String marketTitle) { + this.marketTitle = marketTitle; + } + + public GetQuoteResponse marketExtId(@jakarta.annotation.Nullable String marketExtId) { + this.marketExtId = marketExtId; + return this; + } + + /** + * Get marketExtId + * + * @return marketExtId + */ + @jakarta.annotation.Nullable + public String getMarketExtId() { + return marketExtId; + } + + public void setMarketExtId(@jakarta.annotation.Nullable String marketExtId) { + this.marketExtId = marketExtId; + } + + public GetQuoteResponse side(@jakarta.annotation.Nullable String side) { + this.side = side; + return this; + } + + /** + * Get side + * + * @return side + */ + @jakarta.annotation.Nullable + public String getSide() { + return side; + } + + public void setSide(@jakarta.annotation.Nullable String side) { + this.side = side; + } + + public GetQuoteResponse amountIn(@jakarta.annotation.Nullable String amountIn) { + this.amountIn = amountIn; + return this; + } + + /** + * Get amountIn + * + * @return amountIn + */ + @jakarta.annotation.Nullable + public String getAmountIn() { + return amountIn; + } + + public void setAmountIn(@jakarta.annotation.Nullable String amountIn) { + this.amountIn = amountIn; + } + + public GetQuoteResponse amountOut(@jakarta.annotation.Nullable String amountOut) { + this.amountOut = amountOut; + return this; + } + + /** + * Get amountOut + * + * @return amountOut + */ + @jakarta.annotation.Nullable + public String getAmountOut() { + return amountOut; + } + + public void setAmountOut(@jakarta.annotation.Nullable String amountOut) { + this.amountOut = amountOut; + } + + public GetQuoteResponse isMinAmountOut(@jakarta.annotation.Nullable Boolean isMinAmountOut) { + this.isMinAmountOut = isMinAmountOut; + return this; + } + + /** + * Get isMinAmountOut + * + * @return isMinAmountOut + */ + @jakarta.annotation.Nullable + public Boolean getIsMinAmountOut() { + return isMinAmountOut; + } + + public void setIsMinAmountOut(@jakarta.annotation.Nullable Boolean isMinAmountOut) { + this.isMinAmountOut = isMinAmountOut; + } + + public GetQuoteResponse feeAmount(@jakarta.annotation.Nullable String feeAmount) { + this.feeAmount = feeAmount; + return this; + } + + /** + * Get feeAmount + * + * @return feeAmount + */ + @jakarta.annotation.Nullable + public String getFeeAmount() { + return feeAmount; + } + + public void setFeeAmount(@jakarta.annotation.Nullable String feeAmount) { + this.feeAmount = feeAmount; + } + + public GetQuoteResponse feeDiscountBps(@jakarta.annotation.Nullable String feeDiscountBps) { + this.feeDiscountBps = feeDiscountBps; + return this; + } + + /** + * Get feeDiscountBps + * + * @return feeDiscountBps + */ + @jakarta.annotation.Nullable + public String getFeeDiscountBps() { + return feeDiscountBps; + } + + public void setFeeDiscountBps(@jakarta.annotation.Nullable String feeDiscountBps) { + this.feeDiscountBps = feeDiscountBps; + } + + public GetQuoteResponse averagePrice(@jakarta.annotation.Nullable BigDecimal averagePrice) { + this.averagePrice = averagePrice; + return this; + } + + /** + * Get averagePrice + * + * @return averagePrice + */ + @jakarta.annotation.Nullable + @Valid + public BigDecimal getAveragePrice() { + return averagePrice; + } + + public void setAveragePrice(@jakarta.annotation.Nullable BigDecimal averagePrice) { + this.averagePrice = averagePrice; + } + + public GetQuoteResponse lastPrice(@jakarta.annotation.Nullable BigDecimal lastPrice) { + this.lastPrice = lastPrice; + return this; + } + + /** + * Get lastPrice + * + * @return lastPrice + */ + @jakarta.annotation.Nullable + @Valid + public BigDecimal getLastPrice() { + return lastPrice; + } + + public void setLastPrice(@jakarta.annotation.Nullable BigDecimal lastPrice) { + this.lastPrice = lastPrice; + } + + public GetQuoteResponse priceImpact(@jakarta.annotation.Nullable BigDecimal priceImpact) { + this.priceImpact = priceImpact; + return this; + } + + /** + * Get priceImpact + * + * @return priceImpact + */ + @jakarta.annotation.Nullable + @Valid + public BigDecimal getPriceImpact() { + return priceImpact; + } + + public void setPriceImpact(@jakarta.annotation.Nullable BigDecimal priceImpact) { + this.priceImpact = priceImpact; + } + + public GetQuoteResponse timestamp(@jakarta.annotation.Nullable Long timestamp) { + this.timestamp = timestamp; + return this; + } + + /** + * Get timestamp + * + * @return timestamp + */ + @jakarta.annotation.Nullable + public Long getTimestamp() { + return timestamp; + } + + public void setTimestamp(@jakarta.annotation.Nullable Long timestamp) { + this.timestamp = timestamp; + } + + public GetQuoteResponse 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 GetQuoteResponse userId(@jakarta.annotation.Nullable Long userId) { + this.userId = userId; + return this; + } + + /** + * Get userId + * + * @return userId + */ + @jakarta.annotation.Nullable + public Long getUserId() { + return userId; + } + + public void setUserId(@jakarta.annotation.Nullable Long userId) { + this.userId = userId; + } + + public GetQuoteResponse walletAddress(@jakarta.annotation.Nullable String walletAddress) { + this.walletAddress = walletAddress; + return this; + } + + /** + * Get walletAddress + * + * @return walletAddress + */ + @jakarta.annotation.Nullable + public String getWalletAddress() { + return walletAddress; + } + + public void setWalletAddress(@jakarta.annotation.Nullable String walletAddress) { + this.walletAddress = walletAddress; + } + + public GetQuoteResponse orderType(@jakarta.annotation.Nullable String orderType) { + this.orderType = orderType; + return this; + } + + /** + * Get orderType + * + * @return orderType + */ + @jakarta.annotation.Nullable + public String getOrderType() { + return orderType; + } + + public void setOrderType(@jakarta.annotation.Nullable String orderType) { + this.orderType = orderType; + } + + public GetQuoteResponse slippageBps(@jakarta.annotation.Nullable Integer slippageBps) { + this.slippageBps = slippageBps; + return this; + } + + /** + * Get slippageBps + * + * @return slippageBps + */ + @jakarta.annotation.Nullable + public Integer getSlippageBps() { + return slippageBps; + } + + public void setSlippageBps(@jakarta.annotation.Nullable Integer slippageBps) { + this.slippageBps = slippageBps; + } + + public GetQuoteResponse feeRateBps(@jakarta.annotation.Nullable Integer feeRateBps) { + this.feeRateBps = feeRateBps; + return this; + } + + /** + * Get feeRateBps + * + * @return feeRateBps + */ + @jakarta.annotation.Nullable + public Integer getFeeRateBps() { + return feeRateBps; + } + + public void setFeeRateBps(@jakarta.annotation.Nullable Integer feeRateBps) { + this.feeRateBps = feeRateBps; + } + + public GetQuoteResponse minReceive(@jakarta.annotation.Nullable String minReceive) { + this.minReceive = minReceive; + return this; + } + + /** + * Get minReceive + * + * @return minReceive + */ + @jakarta.annotation.Nullable + public String getMinReceive() { + return minReceive; + } + + public void setMinReceive(@jakarta.annotation.Nullable String minReceive) { + this.minReceive = minReceive; + } + + public GetQuoteResponse expireAt(@jakarta.annotation.Nullable Long expireAt) { + this.expireAt = expireAt; + return this; + } + + /** + * Get expireAt + * + * @return expireAt + */ + @jakarta.annotation.Nullable + public Long getExpireAt() { + return expireAt; + } + + public void setExpireAt(@jakarta.annotation.Nullable Long expireAt) { + this.expireAt = expireAt; + } + + public GetQuoteResponse priceLimit(@jakarta.annotation.Nullable String priceLimit) { + this.priceLimit = priceLimit; + return this; + } + + /** + * Get priceLimit + * + * @return priceLimit + */ + @jakarta.annotation.Nullable + public String getPriceLimit() { + return priceLimit; + } + + public void setPriceLimit(@jakarta.annotation.Nullable String priceLimit) { + this.priceLimit = priceLimit; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetQuoteResponse getQuoteResponse = (GetQuoteResponse) o; + return Objects.equals(this.quoteId, getQuoteResponse.quoteId) + && Objects.equals(this.tokenId, getQuoteResponse.tokenId) + && Objects.equals(this.chance, getQuoteResponse.chance) + && Objects.equals(this.vendor, getQuoteResponse.vendor) + && Objects.equals(this.marketTitle, getQuoteResponse.marketTitle) + && Objects.equals(this.marketExtId, getQuoteResponse.marketExtId) + && Objects.equals(this.side, getQuoteResponse.side) + && Objects.equals(this.amountIn, getQuoteResponse.amountIn) + && Objects.equals(this.amountOut, getQuoteResponse.amountOut) + && Objects.equals(this.isMinAmountOut, getQuoteResponse.isMinAmountOut) + && Objects.equals(this.feeAmount, getQuoteResponse.feeAmount) + && Objects.equals(this.feeDiscountBps, getQuoteResponse.feeDiscountBps) + && Objects.equals(this.averagePrice, getQuoteResponse.averagePrice) + && Objects.equals(this.lastPrice, getQuoteResponse.lastPrice) + && Objects.equals(this.priceImpact, getQuoteResponse.priceImpact) + && Objects.equals(this.timestamp, getQuoteResponse.timestamp) + && Objects.equals(this.chainId, getQuoteResponse.chainId) + && Objects.equals(this.userId, getQuoteResponse.userId) + && Objects.equals(this.walletAddress, getQuoteResponse.walletAddress) + && Objects.equals(this.orderType, getQuoteResponse.orderType) + && Objects.equals(this.slippageBps, getQuoteResponse.slippageBps) + && Objects.equals(this.feeRateBps, getQuoteResponse.feeRateBps) + && Objects.equals(this.minReceive, getQuoteResponse.minReceive) + && Objects.equals(this.expireAt, getQuoteResponse.expireAt) + && Objects.equals(this.priceLimit, getQuoteResponse.priceLimit); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash( + quoteId, + tokenId, + chance, + vendor, + marketTitle, + marketExtId, + side, + amountIn, + amountOut, + isMinAmountOut, + feeAmount, + feeDiscountBps, + averagePrice, + lastPrice, + priceImpact, + timestamp, + chainId, + userId, + walletAddress, + orderType, + slippageBps, + feeRateBps, + minReceive, + expireAt, + priceLimit); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetQuoteResponse {\n"); + sb.append(" quoteId: ").append(toIndentedString(quoteId)).append("\n"); + sb.append(" tokenId: ").append(toIndentedString(tokenId)).append("\n"); + sb.append(" chance: ").append(toIndentedString(chance)).append("\n"); + sb.append(" vendor: ").append(toIndentedString(vendor)).append("\n"); + sb.append(" marketTitle: ").append(toIndentedString(marketTitle)).append("\n"); + sb.append(" marketExtId: ").append(toIndentedString(marketExtId)).append("\n"); + sb.append(" side: ").append(toIndentedString(side)).append("\n"); + sb.append(" amountIn: ").append(toIndentedString(amountIn)).append("\n"); + sb.append(" amountOut: ").append(toIndentedString(amountOut)).append("\n"); + sb.append(" isMinAmountOut: ").append(toIndentedString(isMinAmountOut)).append("\n"); + sb.append(" feeAmount: ").append(toIndentedString(feeAmount)).append("\n"); + sb.append(" feeDiscountBps: ").append(toIndentedString(feeDiscountBps)).append("\n"); + sb.append(" averagePrice: ").append(toIndentedString(averagePrice)).append("\n"); + sb.append(" lastPrice: ").append(toIndentedString(lastPrice)).append("\n"); + sb.append(" priceImpact: ").append(toIndentedString(priceImpact)).append("\n"); + sb.append(" timestamp: ").append(toIndentedString(timestamp)).append("\n"); + sb.append(" chainId: ").append(toIndentedString(chainId)).append("\n"); + sb.append(" userId: ").append(toIndentedString(userId)).append("\n"); + sb.append(" walletAddress: ").append(toIndentedString(walletAddress)).append("\n"); + sb.append(" orderType: ").append(toIndentedString(orderType)).append("\n"); + sb.append(" slippageBps: ").append(toIndentedString(slippageBps)).append("\n"); + sb.append(" feeRateBps: ").append(toIndentedString(feeRateBps)).append("\n"); + sb.append(" minReceive: ").append(toIndentedString(minReceive)).append("\n"); + sb.append(" expireAt: ").append(toIndentedString(expireAt)).append("\n"); + sb.append(" priceLimit: ").append(toIndentedString(priceLimit)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object quoteIdValue = getQuoteId(); + String quoteIdValueAsString = ""; + quoteIdValueAsString = quoteIdValue.toString(); + sb.append("quoteId=").append(urlEncode(quoteIdValueAsString)).append(""); + Object tokenIdValue = getTokenId(); + String tokenIdValueAsString = ""; + tokenIdValueAsString = tokenIdValue.toString(); + sb.append("tokenId=").append(urlEncode(tokenIdValueAsString)).append(""); + Object chanceValue = getChance(); + String chanceValueAsString = ""; + chanceValueAsString = chanceValue.toString(); + sb.append("chance=").append(urlEncode(chanceValueAsString)).append(""); + Object vendorValue = getVendor(); + String vendorValueAsString = ""; + vendorValueAsString = vendorValue.toString(); + sb.append("vendor=").append(urlEncode(vendorValueAsString)).append(""); + Object marketTitleValue = getMarketTitle(); + String marketTitleValueAsString = ""; + marketTitleValueAsString = marketTitleValue.toString(); + sb.append("marketTitle=").append(urlEncode(marketTitleValueAsString)).append(""); + Object marketExtIdValue = getMarketExtId(); + String marketExtIdValueAsString = ""; + marketExtIdValueAsString = marketExtIdValue.toString(); + sb.append("marketExtId=").append(urlEncode(marketExtIdValueAsString)).append(""); + Object sideValue = getSide(); + String sideValueAsString = ""; + sideValueAsString = sideValue.toString(); + sb.append("side=").append(urlEncode(sideValueAsString)).append(""); + Object amountInValue = getAmountIn(); + String amountInValueAsString = ""; + amountInValueAsString = amountInValue.toString(); + sb.append("amountIn=").append(urlEncode(amountInValueAsString)).append(""); + Object amountOutValue = getAmountOut(); + String amountOutValueAsString = ""; + amountOutValueAsString = amountOutValue.toString(); + sb.append("amountOut=").append(urlEncode(amountOutValueAsString)).append(""); + Object isMinAmountOutValue = getIsMinAmountOut(); + String isMinAmountOutValueAsString = ""; + isMinAmountOutValueAsString = isMinAmountOutValue.toString(); + sb.append("isMinAmountOut=").append(urlEncode(isMinAmountOutValueAsString)).append(""); + Object feeAmountValue = getFeeAmount(); + String feeAmountValueAsString = ""; + feeAmountValueAsString = feeAmountValue.toString(); + sb.append("feeAmount=").append(urlEncode(feeAmountValueAsString)).append(""); + Object feeDiscountBpsValue = getFeeDiscountBps(); + String feeDiscountBpsValueAsString = ""; + feeDiscountBpsValueAsString = feeDiscountBpsValue.toString(); + sb.append("feeDiscountBps=").append(urlEncode(feeDiscountBpsValueAsString)).append(""); + Object averagePriceValue = getAveragePrice(); + String averagePriceValueAsString = ""; + averagePriceValueAsString = averagePriceValue.toString(); + sb.append("averagePrice=").append(urlEncode(averagePriceValueAsString)).append(""); + Object lastPriceValue = getLastPrice(); + String lastPriceValueAsString = ""; + lastPriceValueAsString = lastPriceValue.toString(); + sb.append("lastPrice=").append(urlEncode(lastPriceValueAsString)).append(""); + Object priceImpactValue = getPriceImpact(); + String priceImpactValueAsString = ""; + priceImpactValueAsString = priceImpactValue.toString(); + sb.append("priceImpact=").append(urlEncode(priceImpactValueAsString)).append(""); + Object timestampValue = getTimestamp(); + String timestampValueAsString = ""; + timestampValueAsString = timestampValue.toString(); + sb.append("timestamp=").append(urlEncode(timestampValueAsString)).append(""); + Object chainIdValue = getChainId(); + String chainIdValueAsString = ""; + chainIdValueAsString = chainIdValue.toString(); + sb.append("chainId=").append(urlEncode(chainIdValueAsString)).append(""); + Object userIdValue = getUserId(); + String userIdValueAsString = ""; + userIdValueAsString = userIdValue.toString(); + sb.append("userId=").append(urlEncode(userIdValueAsString)).append(""); + Object walletAddressValue = getWalletAddress(); + String walletAddressValueAsString = ""; + walletAddressValueAsString = walletAddressValue.toString(); + sb.append("walletAddress=").append(urlEncode(walletAddressValueAsString)).append(""); + Object orderTypeValue = getOrderType(); + String orderTypeValueAsString = ""; + orderTypeValueAsString = orderTypeValue.toString(); + sb.append("orderType=").append(urlEncode(orderTypeValueAsString)).append(""); + Object slippageBpsValue = getSlippageBps(); + String slippageBpsValueAsString = ""; + slippageBpsValueAsString = slippageBpsValue.toString(); + sb.append("slippageBps=").append(urlEncode(slippageBpsValueAsString)).append(""); + Object feeRateBpsValue = getFeeRateBps(); + String feeRateBpsValueAsString = ""; + feeRateBpsValueAsString = feeRateBpsValue.toString(); + sb.append("feeRateBps=").append(urlEncode(feeRateBpsValueAsString)).append(""); + Object minReceiveValue = getMinReceive(); + String minReceiveValueAsString = ""; + minReceiveValueAsString = minReceiveValue.toString(); + sb.append("minReceive=").append(urlEncode(minReceiveValueAsString)).append(""); + Object expireAtValue = getExpireAt(); + String expireAtValueAsString = ""; + expireAtValueAsString = expireAtValue.toString(); + sb.append("expireAt=").append(urlEncode(expireAtValueAsString)).append(""); + Object priceLimitValue = getPriceLimit(); + String priceLimitValueAsString = ""; + priceLimitValueAsString = priceLimitValue.toString(); + sb.append("priceLimit=").append(urlEncode(priceLimitValueAsString)).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("quoteId"); + openapiFields.add("tokenId"); + openapiFields.add("chance"); + openapiFields.add("vendor"); + openapiFields.add("marketTitle"); + openapiFields.add("marketExtId"); + openapiFields.add("side"); + openapiFields.add("amountIn"); + openapiFields.add("amountOut"); + openapiFields.add("isMinAmountOut"); + openapiFields.add("feeAmount"); + openapiFields.add("feeDiscountBps"); + openapiFields.add("averagePrice"); + openapiFields.add("lastPrice"); + openapiFields.add("priceImpact"); + openapiFields.add("timestamp"); + openapiFields.add("chainId"); + openapiFields.add("userId"); + openapiFields.add("walletAddress"); + openapiFields.add("orderType"); + openapiFields.add("slippageBps"); + openapiFields.add("feeRateBps"); + openapiFields.add("minReceive"); + openapiFields.add("expireAt"); + openapiFields.add("priceLimit"); + + // 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 GetQuoteResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetQuoteResponse.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetQuoteResponse is not found in the" + + " empty JSON string", + GetQuoteResponse.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("quoteId") != null && !jsonObj.get("quoteId").isJsonNull()) + && !jsonObj.get("quoteId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `quoteId` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("quoteId").toString())); + } + if ((jsonObj.get("tokenId") != null && !jsonObj.get("tokenId").isJsonNull()) + && !jsonObj.get("tokenId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `tokenId` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("tokenId").toString())); + } + if ((jsonObj.get("chance") != null && !jsonObj.get("chance").isJsonNull()) + && !jsonObj.get("chance").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `chance` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("chance").toString())); + } + if ((jsonObj.get("vendor") != null && !jsonObj.get("vendor").isJsonNull()) + && !jsonObj.get("vendor").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `vendor` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("vendor").toString())); + } + if ((jsonObj.get("marketTitle") != null && !jsonObj.get("marketTitle").isJsonNull()) + && !jsonObj.get("marketTitle").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `marketTitle` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("marketTitle").toString())); + } + if ((jsonObj.get("marketExtId") != null && !jsonObj.get("marketExtId").isJsonNull()) + && !jsonObj.get("marketExtId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `marketExtId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("marketExtId").toString())); + } + if ((jsonObj.get("side") != null && !jsonObj.get("side").isJsonNull()) + && !jsonObj.get("side").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `side` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("side").toString())); + } + if ((jsonObj.get("amountIn") != null && !jsonObj.get("amountIn").isJsonNull()) + && !jsonObj.get("amountIn").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `amountIn` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("amountIn").toString())); + } + if ((jsonObj.get("amountOut") != null && !jsonObj.get("amountOut").isJsonNull()) + && !jsonObj.get("amountOut").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `amountOut` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("amountOut").toString())); + } + if ((jsonObj.get("feeAmount") != null && !jsonObj.get("feeAmount").isJsonNull()) + && !jsonObj.get("feeAmount").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `feeAmount` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("feeAmount").toString())); + } + if ((jsonObj.get("feeDiscountBps") != null && !jsonObj.get("feeDiscountBps").isJsonNull()) + && !jsonObj.get("feeDiscountBps").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `feeDiscountBps` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("feeDiscountBps").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("walletAddress") != null && !jsonObj.get("walletAddress").isJsonNull()) + && !jsonObj.get("walletAddress").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `walletAddress` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("walletAddress").toString())); + } + if ((jsonObj.get("orderType") != null && !jsonObj.get("orderType").isJsonNull()) + && !jsonObj.get("orderType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `orderType` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("orderType").toString())); + } + if ((jsonObj.get("minReceive") != null && !jsonObj.get("minReceive").isJsonNull()) + && !jsonObj.get("minReceive").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `minReceive` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("minReceive").toString())); + } + if ((jsonObj.get("priceLimit") != null && !jsonObj.get("priceLimit").isJsonNull()) + && !jsonObj.get("priceLimit").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `priceLimit` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("priceLimit").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetQuoteResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetQuoteResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(GetQuoteResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetQuoteResponse value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetQuoteResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetQuoteResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetQuoteResponse + * @throws IOException if the JSON string is invalid with respect to GetQuoteResponse + */ + public static GetQuoteResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetQuoteResponse.class); + } + + /** + * Convert an instance of GetQuoteResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/GetRedeemStatusResponse.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/GetRedeemStatusResponse.java new file mode 100644 index 000000000..5cc5b2c5d --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/GetRedeemStatusResponse.java @@ -0,0 +1,251 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.model; + +import com.binance.connector.client.w3w_prediction.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.*; + +/** GetRedeemStatusResponse */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class GetRedeemStatusResponse { + public static final String SERIALIZED_NAME_TX_HASH = "txHash"; + + @SerializedName(SERIALIZED_NAME_TX_HASH) + @jakarta.annotation.Nullable + private String txHash; + + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + @jakarta.annotation.Nullable + private String status; + + public GetRedeemStatusResponse() {} + + public GetRedeemStatusResponse txHash(@jakarta.annotation.Nullable String txHash) { + this.txHash = txHash; + return this; + } + + /** + * Get txHash + * + * @return txHash + */ + @jakarta.annotation.Nullable + public String getTxHash() { + return txHash; + } + + public void setTxHash(@jakarta.annotation.Nullable String txHash) { + this.txHash = txHash; + } + + public GetRedeemStatusResponse 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; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetRedeemStatusResponse getRedeemStatusResponse = (GetRedeemStatusResponse) o; + return Objects.equals(this.txHash, getRedeemStatusResponse.txHash) + && Objects.equals(this.status, getRedeemStatusResponse.status); + } + + @Override + public int hashCode() { + return Objects.hash(txHash, status); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetRedeemStatusResponse {\n"); + sb.append(" txHash: ").append(toIndentedString(txHash)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object txHashValue = getTxHash(); + String txHashValueAsString = ""; + txHashValueAsString = txHashValue.toString(); + sb.append("txHash=").append(urlEncode(txHashValueAsString)).append(""); + Object statusValue = getStatus(); + String statusValueAsString = ""; + statusValueAsString = statusValue.toString(); + sb.append("status=").append(urlEncode(statusValueAsString)).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("txHash"); + openapiFields.add("status"); + + // 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 GetRedeemStatusResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetRedeemStatusResponse.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetRedeemStatusResponse is not found" + + " in the empty JSON string", + GetRedeemStatusResponse.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("txHash") != null && !jsonObj.get("txHash").isJsonNull()) + && !jsonObj.get("txHash").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `txHash` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("txHash").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())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetRedeemStatusResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetRedeemStatusResponse' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(GetRedeemStatusResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetRedeemStatusResponse value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetRedeemStatusResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetRedeemStatusResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetRedeemStatusResponse + * @throws IOException if the JSON string is invalid with respect to GetRedeemStatusResponse + */ + public static GetRedeemStatusResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetRedeemStatusResponse.class); + } + + /** + * Convert an instance of GetRedeemStatusResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/ListPredictionCategoriesResponse.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/ListPredictionCategoriesResponse.java new file mode 100644 index 000000000..fdacee5a8 --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/ListPredictionCategoriesResponse.java @@ -0,0 +1,251 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.model; + +import com.binance.connector.client.w3w_prediction.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.*; + +/** ListPredictionCategoriesResponse */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class ListPredictionCategoriesResponse { + public static final String SERIALIZED_NAME_CATEGORIES = "categories"; + + @SerializedName(SERIALIZED_NAME_CATEGORIES) + @jakarta.annotation.Nullable + private List<@Valid ListPredictionCategoriesResponseCategoriesInner> categories; + + public ListPredictionCategoriesResponse() {} + + public ListPredictionCategoriesResponse categories( + @jakarta.annotation.Nullable + List<@Valid ListPredictionCategoriesResponseCategoriesInner> categories) { + this.categories = categories; + return this; + } + + public ListPredictionCategoriesResponse addCategoriesItem( + ListPredictionCategoriesResponseCategoriesInner categoriesItem) { + if (this.categories == null) { + this.categories = new ArrayList<>(); + } + this.categories.add(categoriesItem); + return this; + } + + /** + * Get categories + * + * @return categories + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid ListPredictionCategoriesResponseCategoriesInner> getCategories() { + return categories; + } + + public void setCategories( + @jakarta.annotation.Nullable + List<@Valid ListPredictionCategoriesResponseCategoriesInner> categories) { + this.categories = categories; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ListPredictionCategoriesResponse listPredictionCategoriesResponse = + (ListPredictionCategoriesResponse) o; + return Objects.equals(this.categories, listPredictionCategoriesResponse.categories); + } + + @Override + public int hashCode() { + return Objects.hash(categories); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ListPredictionCategoriesResponse {\n"); + sb.append(" categories: ").append(toIndentedString(categories)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object categoriesValue = getCategories(); + String categoriesValueAsString = ""; + categoriesValueAsString = + (String) + ((Collection) categoriesValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("categories=").append(urlEncode(categoriesValueAsString)).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("categories"); + + // 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 + * ListPredictionCategoriesResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ListPredictionCategoriesResponse.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in ListPredictionCategoriesResponse is" + + " not found in the empty JSON string", + ListPredictionCategoriesResponse.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("categories") != null && !jsonObj.get("categories").isJsonNull()) { + JsonArray jsonArraycategories = jsonObj.getAsJsonArray("categories"); + if (jsonArraycategories != null) { + // ensure the json data is an array + if (!jsonObj.get("categories").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `categories` to be an array in the JSON" + + " string but got `%s`", + jsonObj.get("categories").toString())); + } + + // validate the optional field `categories` (array) + for (int i = 0; i < jsonArraycategories.size(); i++) { + ListPredictionCategoriesResponseCategoriesInner.validateJsonElement( + jsonArraycategories.get(i)); + } + ; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ListPredictionCategoriesResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ListPredictionCategoriesResponse' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(ListPredictionCategoriesResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ListPredictionCategoriesResponse value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ListPredictionCategoriesResponse read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of ListPredictionCategoriesResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of ListPredictionCategoriesResponse + * @throws IOException if the JSON string is invalid with respect to + * ListPredictionCategoriesResponse + */ + public static ListPredictionCategoriesResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ListPredictionCategoriesResponse.class); + } + + /** + * Convert an instance of ListPredictionCategoriesResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/ListPredictionCategoriesResponseCategoriesInner.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/ListPredictionCategoriesResponseCategoriesInner.java new file mode 100644 index 000000000..2d5474b27 --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/ListPredictionCategoriesResponseCategoriesInner.java @@ -0,0 +1,423 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.model; + +import com.binance.connector.client.w3w_prediction.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.*; + +/** ListPredictionCategoriesResponseCategoriesInner */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class ListPredictionCategoriesResponseCategoriesInner { + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @jakarta.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @jakarta.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_ICON = "icon"; + + @SerializedName(SERIALIZED_NAME_ICON) + @jakarta.annotation.Nullable + private String icon; + + public static final String SERIALIZED_NAME_ORDER = "order"; + + @SerializedName(SERIALIZED_NAME_ORDER) + @jakarta.annotation.Nullable + private Integer order; + + public static final String SERIALIZED_NAME_SUBCATEGORIES = "subcategories"; + + @SerializedName(SERIALIZED_NAME_SUBCATEGORIES) + @jakarta.annotation.Nullable + private List<@Valid ListPredictionCategoriesResponseCategoriesInnerSubcategoriesInner> + subcategories; + + public ListPredictionCategoriesResponseCategoriesInner() {} + + public ListPredictionCategoriesResponseCategoriesInner id( + @jakarta.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Get id + * + * @return id + */ + @jakarta.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@jakarta.annotation.Nullable String id) { + this.id = id; + } + + public ListPredictionCategoriesResponseCategoriesInner 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 ListPredictionCategoriesResponseCategoriesInner icon( + @jakarta.annotation.Nullable String icon) { + this.icon = icon; + return this; + } + + /** + * Get icon + * + * @return icon + */ + @jakarta.annotation.Nullable + public String getIcon() { + return icon; + } + + public void setIcon(@jakarta.annotation.Nullable String icon) { + this.icon = icon; + } + + public ListPredictionCategoriesResponseCategoriesInner order( + @jakarta.annotation.Nullable Integer order) { + this.order = order; + return this; + } + + /** + * Get order + * + * @return order + */ + @jakarta.annotation.Nullable + public Integer getOrder() { + return order; + } + + public void setOrder(@jakarta.annotation.Nullable Integer order) { + this.order = order; + } + + public ListPredictionCategoriesResponseCategoriesInner subcategories( + @jakarta.annotation.Nullable + List<@Valid ListPredictionCategoriesResponseCategoriesInnerSubcategoriesInner> + subcategories) { + this.subcategories = subcategories; + return this; + } + + public ListPredictionCategoriesResponseCategoriesInner addSubcategoriesItem( + ListPredictionCategoriesResponseCategoriesInnerSubcategoriesInner subcategoriesItem) { + if (this.subcategories == null) { + this.subcategories = new ArrayList<>(); + } + this.subcategories.add(subcategoriesItem); + return this; + } + + /** + * Get subcategories + * + * @return subcategories + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid ListPredictionCategoriesResponseCategoriesInnerSubcategoriesInner> + getSubcategories() { + return subcategories; + } + + public void setSubcategories( + @jakarta.annotation.Nullable + List<@Valid ListPredictionCategoriesResponseCategoriesInnerSubcategoriesInner> + subcategories) { + this.subcategories = subcategories; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ListPredictionCategoriesResponseCategoriesInner + listPredictionCategoriesResponseCategoriesInner = + (ListPredictionCategoriesResponseCategoriesInner) o; + return Objects.equals(this.id, listPredictionCategoriesResponseCategoriesInner.id) + && Objects.equals(this.name, listPredictionCategoriesResponseCategoriesInner.name) + && Objects.equals(this.icon, listPredictionCategoriesResponseCategoriesInner.icon) + && Objects.equals(this.order, listPredictionCategoriesResponseCategoriesInner.order) + && Objects.equals( + this.subcategories, + listPredictionCategoriesResponseCategoriesInner.subcategories); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, icon, order, subcategories); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ListPredictionCategoriesResponseCategoriesInner {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" icon: ").append(toIndentedString(icon)).append("\n"); + sb.append(" order: ").append(toIndentedString(order)).append("\n"); + sb.append(" subcategories: ").append(toIndentedString(subcategories)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object idValue = getId(); + String idValueAsString = ""; + idValueAsString = idValue.toString(); + sb.append("id=").append(urlEncode(idValueAsString)).append(""); + Object nameValue = getName(); + String nameValueAsString = ""; + nameValueAsString = nameValue.toString(); + sb.append("name=").append(urlEncode(nameValueAsString)).append(""); + Object iconValue = getIcon(); + String iconValueAsString = ""; + iconValueAsString = iconValue.toString(); + sb.append("icon=").append(urlEncode(iconValueAsString)).append(""); + Object orderValue = getOrder(); + String orderValueAsString = ""; + orderValueAsString = orderValue.toString(); + sb.append("order=").append(urlEncode(orderValueAsString)).append(""); + Object subcategoriesValue = getSubcategories(); + String subcategoriesValueAsString = ""; + subcategoriesValueAsString = + (String) + ((Collection) subcategoriesValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("subcategories=").append(urlEncode(subcategoriesValueAsString)).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("id"); + openapiFields.add("name"); + openapiFields.add("icon"); + openapiFields.add("order"); + openapiFields.add("subcategories"); + + // 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 + * ListPredictionCategoriesResponseCategoriesInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ListPredictionCategoriesResponseCategoriesInner.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " ListPredictionCategoriesResponseCategoriesInner is not" + + " found in the empty JSON string", + ListPredictionCategoriesResponseCategoriesInner + .openapiRequiredFields + .toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) + && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `id` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("id").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("icon") != null && !jsonObj.get("icon").isJsonNull()) + && !jsonObj.get("icon").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `icon` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("icon").toString())); + } + if (jsonObj.get("subcategories") != null && !jsonObj.get("subcategories").isJsonNull()) { + JsonArray jsonArraysubcategories = jsonObj.getAsJsonArray("subcategories"); + if (jsonArraysubcategories != null) { + // ensure the json data is an array + if (!jsonObj.get("subcategories").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `subcategories` to be an array in the JSON" + + " string but got `%s`", + jsonObj.get("subcategories").toString())); + } + + // validate the optional field `subcategories` (array) + for (int i = 0; i < jsonArraysubcategories.size(); i++) { + ListPredictionCategoriesResponseCategoriesInnerSubcategoriesInner + .validateJsonElement(jsonArraysubcategories.get(i)); + } + ; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ListPredictionCategoriesResponseCategoriesInner.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'ListPredictionCategoriesResponseCategoriesInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, + TypeToken.get(ListPredictionCategoriesResponseCategoriesInner.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, + ListPredictionCategoriesResponseCategoriesInner value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ListPredictionCategoriesResponseCategoriesInner read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of ListPredictionCategoriesResponseCategoriesInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of ListPredictionCategoriesResponseCategoriesInner + * @throws IOException if the JSON string is invalid with respect to + * ListPredictionCategoriesResponseCategoriesInner + */ + public static ListPredictionCategoriesResponseCategoriesInner fromJson(String jsonString) + throws IOException { + return JSON.getGson() + .fromJson(jsonString, ListPredictionCategoriesResponseCategoriesInner.class); + } + + /** + * Convert an instance of ListPredictionCategoriesResponseCategoriesInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/ListPredictionCategoriesResponseCategoriesInnerSubcategoriesInner.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/ListPredictionCategoriesResponseCategoriesInnerSubcategoriesInner.java new file mode 100644 index 000000000..8b088f2cd --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/ListPredictionCategoriesResponseCategoriesInnerSubcategoriesInner.java @@ -0,0 +1,361 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.model; + +import com.binance.connector.client.w3w_prediction.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.*; + +/** ListPredictionCategoriesResponseCategoriesInnerSubcategoriesInner */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class ListPredictionCategoriesResponseCategoriesInnerSubcategoriesInner { + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @jakarta.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @jakarta.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_ICON = "icon"; + + @SerializedName(SERIALIZED_NAME_ICON) + @jakarta.annotation.Nullable + private String icon; + + public static final String SERIALIZED_NAME_ORDER = "order"; + + @SerializedName(SERIALIZED_NAME_ORDER) + @jakarta.annotation.Nullable + private Integer order; + + public ListPredictionCategoriesResponseCategoriesInnerSubcategoriesInner() {} + + public ListPredictionCategoriesResponseCategoriesInnerSubcategoriesInner id( + @jakarta.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Get id + * + * @return id + */ + @jakarta.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@jakarta.annotation.Nullable String id) { + this.id = id; + } + + public ListPredictionCategoriesResponseCategoriesInnerSubcategoriesInner 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 ListPredictionCategoriesResponseCategoriesInnerSubcategoriesInner icon( + @jakarta.annotation.Nullable String icon) { + this.icon = icon; + return this; + } + + /** + * Get icon + * + * @return icon + */ + @jakarta.annotation.Nullable + public String getIcon() { + return icon; + } + + public void setIcon(@jakarta.annotation.Nullable String icon) { + this.icon = icon; + } + + public ListPredictionCategoriesResponseCategoriesInnerSubcategoriesInner order( + @jakarta.annotation.Nullable Integer order) { + this.order = order; + return this; + } + + /** + * Get order + * + * @return order + */ + @jakarta.annotation.Nullable + public Integer getOrder() { + return order; + } + + public void setOrder(@jakarta.annotation.Nullable Integer order) { + this.order = order; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ListPredictionCategoriesResponseCategoriesInnerSubcategoriesInner + listPredictionCategoriesResponseCategoriesInnerSubcategoriesInner = + (ListPredictionCategoriesResponseCategoriesInnerSubcategoriesInner) o; + return Objects.equals( + this.id, + listPredictionCategoriesResponseCategoriesInnerSubcategoriesInner.id) + && Objects.equals( + this.name, + listPredictionCategoriesResponseCategoriesInnerSubcategoriesInner.name) + && Objects.equals( + this.icon, + listPredictionCategoriesResponseCategoriesInnerSubcategoriesInner.icon) + && Objects.equals( + this.order, + listPredictionCategoriesResponseCategoriesInnerSubcategoriesInner.order); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, icon, order); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ListPredictionCategoriesResponseCategoriesInnerSubcategoriesInner {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" icon: ").append(toIndentedString(icon)).append("\n"); + sb.append(" order: ").append(toIndentedString(order)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object idValue = getId(); + String idValueAsString = ""; + idValueAsString = idValue.toString(); + sb.append("id=").append(urlEncode(idValueAsString)).append(""); + Object nameValue = getName(); + String nameValueAsString = ""; + nameValueAsString = nameValue.toString(); + sb.append("name=").append(urlEncode(nameValueAsString)).append(""); + Object iconValue = getIcon(); + String iconValueAsString = ""; + iconValueAsString = iconValue.toString(); + sb.append("icon=").append(urlEncode(iconValueAsString)).append(""); + Object orderValue = getOrder(); + String orderValueAsString = ""; + orderValueAsString = orderValue.toString(); + sb.append("order=").append(urlEncode(orderValueAsString)).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("id"); + openapiFields.add("name"); + openapiFields.add("icon"); + openapiFields.add("order"); + + // 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 + * ListPredictionCategoriesResponseCategoriesInnerSubcategoriesInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ListPredictionCategoriesResponseCategoriesInnerSubcategoriesInner + .openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " ListPredictionCategoriesResponseCategoriesInnerSubcategoriesInner" + + " is not found in the empty JSON string", + ListPredictionCategoriesResponseCategoriesInnerSubcategoriesInner + .openapiRequiredFields + .toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) + && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `id` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("id").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("icon") != null && !jsonObj.get("icon").isJsonNull()) + && !jsonObj.get("icon").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `icon` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("icon").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ListPredictionCategoriesResponseCategoriesInnerSubcategoriesInner.class + .isAssignableFrom(type.getRawType())) { + return null; // this class only serializes + // 'ListPredictionCategoriesResponseCategoriesInnerSubcategoriesInner' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter + thisAdapter = + gson.getDelegateAdapter( + this, + TypeToken.get( + ListPredictionCategoriesResponseCategoriesInnerSubcategoriesInner + .class)); + + return (TypeAdapter) + new TypeAdapter< + ListPredictionCategoriesResponseCategoriesInnerSubcategoriesInner>() { + @Override + public void write( + JsonWriter out, + ListPredictionCategoriesResponseCategoriesInnerSubcategoriesInner + value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ListPredictionCategoriesResponseCategoriesInnerSubcategoriesInner + read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of ListPredictionCategoriesResponseCategoriesInnerSubcategoriesInner given + * an JSON string + * + * @param jsonString JSON string + * @return An instance of ListPredictionCategoriesResponseCategoriesInnerSubcategoriesInner + * @throws IOException if the JSON string is invalid with respect to + * ListPredictionCategoriesResponseCategoriesInnerSubcategoriesInner + */ + public static ListPredictionCategoriesResponseCategoriesInnerSubcategoriesInner fromJson( + String jsonString) throws IOException { + return JSON.getGson() + .fromJson( + jsonString, + ListPredictionCategoriesResponseCategoriesInnerSubcategoriesInner.class); + } + + /** + * Convert an instance of ListPredictionCategoriesResponseCategoriesInnerSubcategoriesInner to + * an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/ListPredictionMarketsResponse.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/ListPredictionMarketsResponse.java new file mode 100644 index 000000000..6152ee3ef --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/ListPredictionMarketsResponse.java @@ -0,0 +1,379 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.model; + +import com.binance.connector.client.w3w_prediction.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.*; + +/** ListPredictionMarketsResponse */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class ListPredictionMarketsResponse { + public static final String SERIALIZED_NAME_MARKET_TOPICS = "marketTopics"; + + @SerializedName(SERIALIZED_NAME_MARKET_TOPICS) + @jakarta.annotation.Nullable + private List<@Valid ListPredictionMarketsResponseMarketTopicsInner> marketTopics; + + public static final String SERIALIZED_NAME_TOTAL = "total"; + + @SerializedName(SERIALIZED_NAME_TOTAL) + @jakarta.annotation.Nullable + private Integer total; + + public static final String SERIALIZED_NAME_OFFSET = "offset"; + + @SerializedName(SERIALIZED_NAME_OFFSET) + @jakarta.annotation.Nullable + private Integer offset; + + public static final String SERIALIZED_NAME_LIMIT = "limit"; + + @SerializedName(SERIALIZED_NAME_LIMIT) + @jakarta.annotation.Nullable + private Integer limit; + + public static final String SERIALIZED_NAME_HAS_MORE = "hasMore"; + + @SerializedName(SERIALIZED_NAME_HAS_MORE) + @jakarta.annotation.Nullable + private Boolean hasMore; + + public ListPredictionMarketsResponse() {} + + public ListPredictionMarketsResponse marketTopics( + @jakarta.annotation.Nullable + List<@Valid ListPredictionMarketsResponseMarketTopicsInner> marketTopics) { + this.marketTopics = marketTopics; + return this; + } + + public ListPredictionMarketsResponse addMarketTopicsItem( + ListPredictionMarketsResponseMarketTopicsInner marketTopicsItem) { + if (this.marketTopics == null) { + this.marketTopics = new ArrayList<>(); + } + this.marketTopics.add(marketTopicsItem); + return this; + } + + /** + * Get marketTopics + * + * @return marketTopics + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid ListPredictionMarketsResponseMarketTopicsInner> getMarketTopics() { + return marketTopics; + } + + public void setMarketTopics( + @jakarta.annotation.Nullable + List<@Valid ListPredictionMarketsResponseMarketTopicsInner> marketTopics) { + this.marketTopics = marketTopics; + } + + public ListPredictionMarketsResponse total(@jakarta.annotation.Nullable Integer total) { + this.total = total; + return this; + } + + /** + * Get total + * + * @return total + */ + @jakarta.annotation.Nullable + public Integer getTotal() { + return total; + } + + public void setTotal(@jakarta.annotation.Nullable Integer total) { + this.total = total; + } + + public ListPredictionMarketsResponse offset(@jakarta.annotation.Nullable Integer offset) { + this.offset = offset; + return this; + } + + /** + * Get offset + * + * @return offset + */ + @jakarta.annotation.Nullable + public Integer getOffset() { + return offset; + } + + public void setOffset(@jakarta.annotation.Nullable Integer offset) { + this.offset = offset; + } + + public ListPredictionMarketsResponse limit(@jakarta.annotation.Nullable Integer limit) { + this.limit = limit; + return this; + } + + /** + * Get limit + * + * @return limit + */ + @jakarta.annotation.Nullable + public Integer getLimit() { + return limit; + } + + public void setLimit(@jakarta.annotation.Nullable Integer limit) { + this.limit = limit; + } + + public ListPredictionMarketsResponse hasMore(@jakarta.annotation.Nullable Boolean hasMore) { + this.hasMore = hasMore; + return this; + } + + /** + * Get hasMore + * + * @return hasMore + */ + @jakarta.annotation.Nullable + public Boolean getHasMore() { + return hasMore; + } + + public void setHasMore(@jakarta.annotation.Nullable Boolean hasMore) { + this.hasMore = hasMore; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ListPredictionMarketsResponse listPredictionMarketsResponse = + (ListPredictionMarketsResponse) o; + return Objects.equals(this.marketTopics, listPredictionMarketsResponse.marketTopics) + && Objects.equals(this.total, listPredictionMarketsResponse.total) + && Objects.equals(this.offset, listPredictionMarketsResponse.offset) + && Objects.equals(this.limit, listPredictionMarketsResponse.limit) + && Objects.equals(this.hasMore, listPredictionMarketsResponse.hasMore); + } + + @Override + public int hashCode() { + return Objects.hash(marketTopics, total, offset, limit, hasMore); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ListPredictionMarketsResponse {\n"); + sb.append(" marketTopics: ").append(toIndentedString(marketTopics)).append("\n"); + sb.append(" total: ").append(toIndentedString(total)).append("\n"); + sb.append(" offset: ").append(toIndentedString(offset)).append("\n"); + sb.append(" limit: ").append(toIndentedString(limit)).append("\n"); + sb.append(" hasMore: ").append(toIndentedString(hasMore)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object marketTopicsValue = getMarketTopics(); + String marketTopicsValueAsString = ""; + marketTopicsValueAsString = + (String) + ((Collection) marketTopicsValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("marketTopics=").append(urlEncode(marketTopicsValueAsString)).append(""); + Object totalValue = getTotal(); + String totalValueAsString = ""; + totalValueAsString = totalValue.toString(); + sb.append("total=").append(urlEncode(totalValueAsString)).append(""); + Object offsetValue = getOffset(); + String offsetValueAsString = ""; + offsetValueAsString = offsetValue.toString(); + sb.append("offset=").append(urlEncode(offsetValueAsString)).append(""); + Object limitValue = getLimit(); + String limitValueAsString = ""; + limitValueAsString = limitValue.toString(); + sb.append("limit=").append(urlEncode(limitValueAsString)).append(""); + Object hasMoreValue = getHasMore(); + String hasMoreValueAsString = ""; + hasMoreValueAsString = hasMoreValue.toString(); + sb.append("hasMore=").append(urlEncode(hasMoreValueAsString)).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("marketTopics"); + openapiFields.add("total"); + openapiFields.add("offset"); + openapiFields.add("limit"); + openapiFields.add("hasMore"); + + // 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 + * ListPredictionMarketsResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ListPredictionMarketsResponse.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in ListPredictionMarketsResponse is not" + + " found in the empty JSON string", + ListPredictionMarketsResponse.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("marketTopics") != null && !jsonObj.get("marketTopics").isJsonNull()) { + JsonArray jsonArraymarketTopics = jsonObj.getAsJsonArray("marketTopics"); + if (jsonArraymarketTopics != null) { + // ensure the json data is an array + if (!jsonObj.get("marketTopics").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `marketTopics` to be an array in the JSON" + + " string but got `%s`", + jsonObj.get("marketTopics").toString())); + } + + // validate the optional field `marketTopics` (array) + for (int i = 0; i < jsonArraymarketTopics.size(); i++) { + ListPredictionMarketsResponseMarketTopicsInner.validateJsonElement( + jsonArraymarketTopics.get(i)); + } + ; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ListPredictionMarketsResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ListPredictionMarketsResponse' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(ListPredictionMarketsResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ListPredictionMarketsResponse value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ListPredictionMarketsResponse read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of ListPredictionMarketsResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of ListPredictionMarketsResponse + * @throws IOException if the JSON string is invalid with respect to + * ListPredictionMarketsResponse + */ + public static ListPredictionMarketsResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ListPredictionMarketsResponse.class); + } + + /** + * Convert an instance of ListPredictionMarketsResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/ListPredictionMarketsResponseMarketTopicsInner.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/ListPredictionMarketsResponseMarketTopicsInner.java new file mode 100644 index 000000000..f332855a1 --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/ListPredictionMarketsResponseMarketTopicsInner.java @@ -0,0 +1,1132 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.model; + +import com.binance.connector.client.w3w_prediction.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; +import org.hibernate.validator.constraints.*; + +/** ListPredictionMarketsResponseMarketTopicsInner */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class ListPredictionMarketsResponseMarketTopicsInner { + public static final String SERIALIZED_NAME_MARKET_TOPIC_ID = "marketTopicId"; + + @SerializedName(SERIALIZED_NAME_MARKET_TOPIC_ID) + @jakarta.annotation.Nullable + private Long marketTopicId; + + public static final String SERIALIZED_NAME_VENDOR = "vendor"; + + @SerializedName(SERIALIZED_NAME_VENDOR) + @jakarta.annotation.Nullable + private String vendor; + + 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_SLUG = "slug"; + + @SerializedName(SERIALIZED_NAME_SLUG) + @jakarta.annotation.Nullable + private String slug; + + public static final String SERIALIZED_NAME_TITLE = "title"; + + @SerializedName(SERIALIZED_NAME_TITLE) + @jakarta.annotation.Nullable + private String title; + + public static final String SERIALIZED_NAME_QUESTION = "question"; + + @SerializedName(SERIALIZED_NAME_QUESTION) + @jakarta.annotation.Nullable + private String question; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @jakarta.annotation.Nullable + private String description; + + public static final String SERIALIZED_NAME_IMAGE_URL = "imageUrl"; + + @SerializedName(SERIALIZED_NAME_IMAGE_URL) + @jakarta.annotation.Nullable + private String imageUrl; + + public static final String SERIALIZED_NAME_TOPIC_TYPE = "topicType"; + + @SerializedName(SERIALIZED_NAME_TOPIC_TYPE) + @jakarta.annotation.Nullable + private String topicType; + + public static final String SERIALIZED_NAME_CHART_TYPE = "chartType"; + + @SerializedName(SERIALIZED_NAME_CHART_TYPE) + @jakarta.annotation.Nullable + private String chartType; + + public static final String SERIALIZED_NAME_SYMBOL = "symbol"; + + @SerializedName(SERIALIZED_NAME_SYMBOL) + @jakarta.annotation.Nullable + private String symbol; + + public static final String SERIALIZED_NAME_PARTICIPANT_COUNT = "participantCount"; + + @SerializedName(SERIALIZED_NAME_PARTICIPANT_COUNT) + @jakarta.annotation.Nullable + private Integer participantCount; + + public static final String SERIALIZED_NAME_COLLATERAL = "collateral"; + + @SerializedName(SERIALIZED_NAME_COLLATERAL) + @jakarta.annotation.Nullable + private String collateral; + + public static final String SERIALIZED_NAME_FEE_RATE_BPS = "feeRateBps"; + + @SerializedName(SERIALIZED_NAME_FEE_RATE_BPS) + @jakarta.annotation.Nullable + private Integer feeRateBps; + + public static final String SERIALIZED_NAME_SLIPPAGE_BPS = "slippageBps"; + + @SerializedName(SERIALIZED_NAME_SLIPPAGE_BPS) + @jakarta.annotation.Nullable + private Integer slippageBps; + + public static final String SERIALIZED_NAME_IS_YIELD_BEARING = "isYieldBearing"; + + @SerializedName(SERIALIZED_NAME_IS_YIELD_BEARING) + @jakarta.annotation.Nullable + private Boolean isYieldBearing; + + public static final String SERIALIZED_NAME_TRADE_VOLUME = "tradeVolume"; + + @SerializedName(SERIALIZED_NAME_TRADE_VOLUME) + @jakarta.annotation.Nullable + private String tradeVolume; + + public static final String SERIALIZED_NAME_LIQUIDITY = "liquidity"; + + @SerializedName(SERIALIZED_NAME_LIQUIDITY) + @jakarta.annotation.Nullable + private String liquidity; + + public static final String SERIALIZED_NAME_PUBLISHED_AT = "publishedAt"; + + @SerializedName(SERIALIZED_NAME_PUBLISHED_AT) + @jakarta.annotation.Nullable + private Long publishedAt; + + public static final String SERIALIZED_NAME_START_DATE = "startDate"; + + @SerializedName(SERIALIZED_NAME_START_DATE) + @jakarta.annotation.Nullable + private Long startDate; + + public static final String SERIALIZED_NAME_END_DATE = "endDate"; + + @SerializedName(SERIALIZED_NAME_END_DATE) + @jakarta.annotation.Nullable + private Long endDate; + + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + @jakarta.annotation.Nullable + private String status; + + public static final String SERIALIZED_NAME_MARKETS = "markets"; + + @SerializedName(SERIALIZED_NAME_MARKETS) + @jakarta.annotation.Nullable + private List markets; + + public ListPredictionMarketsResponseMarketTopicsInner() {} + + public ListPredictionMarketsResponseMarketTopicsInner marketTopicId( + @jakarta.annotation.Nullable Long marketTopicId) { + this.marketTopicId = marketTopicId; + return this; + } + + /** + * Get marketTopicId + * + * @return marketTopicId + */ + @jakarta.annotation.Nullable + public Long getMarketTopicId() { + return marketTopicId; + } + + public void setMarketTopicId(@jakarta.annotation.Nullable Long marketTopicId) { + this.marketTopicId = marketTopicId; + } + + public ListPredictionMarketsResponseMarketTopicsInner vendor( + @jakarta.annotation.Nullable String vendor) { + this.vendor = vendor; + return this; + } + + /** + * Get vendor + * + * @return vendor + */ + @jakarta.annotation.Nullable + public String getVendor() { + return vendor; + } + + public void setVendor(@jakarta.annotation.Nullable String vendor) { + this.vendor = vendor; + } + + public ListPredictionMarketsResponseMarketTopicsInner 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 ListPredictionMarketsResponseMarketTopicsInner slug( + @jakarta.annotation.Nullable String slug) { + this.slug = slug; + return this; + } + + /** + * Get slug + * + * @return slug + */ + @jakarta.annotation.Nullable + public String getSlug() { + return slug; + } + + public void setSlug(@jakarta.annotation.Nullable String slug) { + this.slug = slug; + } + + public ListPredictionMarketsResponseMarketTopicsInner title( + @jakarta.annotation.Nullable String title) { + this.title = title; + return this; + } + + /** + * Get title + * + * @return title + */ + @jakarta.annotation.Nullable + public String getTitle() { + return title; + } + + public void setTitle(@jakarta.annotation.Nullable String title) { + this.title = title; + } + + public ListPredictionMarketsResponseMarketTopicsInner question( + @jakarta.annotation.Nullable String question) { + this.question = question; + return this; + } + + /** + * Get question + * + * @return question + */ + @jakarta.annotation.Nullable + public String getQuestion() { + return question; + } + + public void setQuestion(@jakarta.annotation.Nullable String question) { + this.question = question; + } + + public ListPredictionMarketsResponseMarketTopicsInner description( + @jakarta.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Get description + * + * @return description + */ + @jakarta.annotation.Nullable + public String getDescription() { + return description; + } + + public void setDescription(@jakarta.annotation.Nullable String description) { + this.description = description; + } + + public ListPredictionMarketsResponseMarketTopicsInner imageUrl( + @jakarta.annotation.Nullable String imageUrl) { + this.imageUrl = imageUrl; + return this; + } + + /** + * Get imageUrl + * + * @return imageUrl + */ + @jakarta.annotation.Nullable + public String getImageUrl() { + return imageUrl; + } + + public void setImageUrl(@jakarta.annotation.Nullable String imageUrl) { + this.imageUrl = imageUrl; + } + + public ListPredictionMarketsResponseMarketTopicsInner topicType( + @jakarta.annotation.Nullable String topicType) { + this.topicType = topicType; + return this; + } + + /** + * Get topicType + * + * @return topicType + */ + @jakarta.annotation.Nullable + public String getTopicType() { + return topicType; + } + + public void setTopicType(@jakarta.annotation.Nullable String topicType) { + this.topicType = topicType; + } + + public ListPredictionMarketsResponseMarketTopicsInner chartType( + @jakarta.annotation.Nullable String chartType) { + this.chartType = chartType; + return this; + } + + /** + * Get chartType + * + * @return chartType + */ + @jakarta.annotation.Nullable + public String getChartType() { + return chartType; + } + + public void setChartType(@jakarta.annotation.Nullable String chartType) { + this.chartType = chartType; + } + + public ListPredictionMarketsResponseMarketTopicsInner 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 ListPredictionMarketsResponseMarketTopicsInner participantCount( + @jakarta.annotation.Nullable Integer participantCount) { + this.participantCount = participantCount; + return this; + } + + /** + * Get participantCount + * + * @return participantCount + */ + @jakarta.annotation.Nullable + public Integer getParticipantCount() { + return participantCount; + } + + public void setParticipantCount(@jakarta.annotation.Nullable Integer participantCount) { + this.participantCount = participantCount; + } + + public ListPredictionMarketsResponseMarketTopicsInner collateral( + @jakarta.annotation.Nullable String collateral) { + this.collateral = collateral; + return this; + } + + /** + * Get collateral + * + * @return collateral + */ + @jakarta.annotation.Nullable + public String getCollateral() { + return collateral; + } + + public void setCollateral(@jakarta.annotation.Nullable String collateral) { + this.collateral = collateral; + } + + public ListPredictionMarketsResponseMarketTopicsInner feeRateBps( + @jakarta.annotation.Nullable Integer feeRateBps) { + this.feeRateBps = feeRateBps; + return this; + } + + /** + * Get feeRateBps + * + * @return feeRateBps + */ + @jakarta.annotation.Nullable + public Integer getFeeRateBps() { + return feeRateBps; + } + + public void setFeeRateBps(@jakarta.annotation.Nullable Integer feeRateBps) { + this.feeRateBps = feeRateBps; + } + + public ListPredictionMarketsResponseMarketTopicsInner slippageBps( + @jakarta.annotation.Nullable Integer slippageBps) { + this.slippageBps = slippageBps; + return this; + } + + /** + * Get slippageBps + * + * @return slippageBps + */ + @jakarta.annotation.Nullable + public Integer getSlippageBps() { + return slippageBps; + } + + public void setSlippageBps(@jakarta.annotation.Nullable Integer slippageBps) { + this.slippageBps = slippageBps; + } + + public ListPredictionMarketsResponseMarketTopicsInner isYieldBearing( + @jakarta.annotation.Nullable Boolean isYieldBearing) { + this.isYieldBearing = isYieldBearing; + return this; + } + + /** + * Get isYieldBearing + * + * @return isYieldBearing + */ + @jakarta.annotation.Nullable + public Boolean getIsYieldBearing() { + return isYieldBearing; + } + + public void setIsYieldBearing(@jakarta.annotation.Nullable Boolean isYieldBearing) { + this.isYieldBearing = isYieldBearing; + } + + public ListPredictionMarketsResponseMarketTopicsInner tradeVolume( + @jakarta.annotation.Nullable String tradeVolume) { + this.tradeVolume = tradeVolume; + return this; + } + + /** + * Get tradeVolume + * + * @return tradeVolume + */ + @jakarta.annotation.Nullable + public String getTradeVolume() { + return tradeVolume; + } + + public void setTradeVolume(@jakarta.annotation.Nullable String tradeVolume) { + this.tradeVolume = tradeVolume; + } + + public ListPredictionMarketsResponseMarketTopicsInner 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 ListPredictionMarketsResponseMarketTopicsInner publishedAt( + @jakarta.annotation.Nullable Long publishedAt) { + this.publishedAt = publishedAt; + return this; + } + + /** + * Get publishedAt + * + * @return publishedAt + */ + @jakarta.annotation.Nullable + public Long getPublishedAt() { + return publishedAt; + } + + public void setPublishedAt(@jakarta.annotation.Nullable Long publishedAt) { + this.publishedAt = publishedAt; + } + + public ListPredictionMarketsResponseMarketTopicsInner startDate( + @jakarta.annotation.Nullable Long startDate) { + this.startDate = startDate; + return this; + } + + /** + * Get startDate + * + * @return startDate + */ + @jakarta.annotation.Nullable + public Long getStartDate() { + return startDate; + } + + public void setStartDate(@jakarta.annotation.Nullable Long startDate) { + this.startDate = startDate; + } + + public ListPredictionMarketsResponseMarketTopicsInner endDate( + @jakarta.annotation.Nullable Long endDate) { + this.endDate = endDate; + return this; + } + + /** + * Get endDate + * + * @return endDate + */ + @jakarta.annotation.Nullable + public Long getEndDate() { + return endDate; + } + + public void setEndDate(@jakarta.annotation.Nullable Long endDate) { + this.endDate = endDate; + } + + public ListPredictionMarketsResponseMarketTopicsInner 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 ListPredictionMarketsResponseMarketTopicsInner markets( + @jakarta.annotation.Nullable List markets) { + this.markets = markets; + return this; + } + + public ListPredictionMarketsResponseMarketTopicsInner addMarketsItem(Object marketsItem) { + if (this.markets == null) { + this.markets = new ArrayList<>(); + } + this.markets.add(marketsItem); + return this; + } + + /** + * Get markets + * + * @return markets + */ + @jakarta.annotation.Nullable + public List getMarkets() { + return markets; + } + + public void setMarkets(@jakarta.annotation.Nullable List markets) { + this.markets = markets; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ListPredictionMarketsResponseMarketTopicsInner + listPredictionMarketsResponseMarketTopicsInner = + (ListPredictionMarketsResponseMarketTopicsInner) o; + return Objects.equals( + this.marketTopicId, + listPredictionMarketsResponseMarketTopicsInner.marketTopicId) + && Objects.equals( + this.vendor, listPredictionMarketsResponseMarketTopicsInner.vendor) + && Objects.equals( + this.chainId, listPredictionMarketsResponseMarketTopicsInner.chainId) + && Objects.equals(this.slug, listPredictionMarketsResponseMarketTopicsInner.slug) + && Objects.equals(this.title, listPredictionMarketsResponseMarketTopicsInner.title) + && Objects.equals( + this.question, listPredictionMarketsResponseMarketTopicsInner.question) + && Objects.equals( + this.description, + listPredictionMarketsResponseMarketTopicsInner.description) + && Objects.equals( + this.imageUrl, listPredictionMarketsResponseMarketTopicsInner.imageUrl) + && Objects.equals( + this.topicType, listPredictionMarketsResponseMarketTopicsInner.topicType) + && Objects.equals( + this.chartType, listPredictionMarketsResponseMarketTopicsInner.chartType) + && Objects.equals( + this.symbol, listPredictionMarketsResponseMarketTopicsInner.symbol) + && Objects.equals( + this.participantCount, + listPredictionMarketsResponseMarketTopicsInner.participantCount) + && Objects.equals( + this.collateral, listPredictionMarketsResponseMarketTopicsInner.collateral) + && Objects.equals( + this.feeRateBps, listPredictionMarketsResponseMarketTopicsInner.feeRateBps) + && Objects.equals( + this.slippageBps, + listPredictionMarketsResponseMarketTopicsInner.slippageBps) + && Objects.equals( + this.isYieldBearing, + listPredictionMarketsResponseMarketTopicsInner.isYieldBearing) + && Objects.equals( + this.tradeVolume, + listPredictionMarketsResponseMarketTopicsInner.tradeVolume) + && Objects.equals( + this.liquidity, listPredictionMarketsResponseMarketTopicsInner.liquidity) + && Objects.equals( + this.publishedAt, + listPredictionMarketsResponseMarketTopicsInner.publishedAt) + && Objects.equals( + this.startDate, listPredictionMarketsResponseMarketTopicsInner.startDate) + && Objects.equals( + this.endDate, listPredictionMarketsResponseMarketTopicsInner.endDate) + && Objects.equals( + this.status, listPredictionMarketsResponseMarketTopicsInner.status) + && Objects.equals( + this.markets, listPredictionMarketsResponseMarketTopicsInner.markets); + } + + @Override + public int hashCode() { + return Objects.hash( + marketTopicId, + vendor, + chainId, + slug, + title, + question, + description, + imageUrl, + topicType, + chartType, + symbol, + participantCount, + collateral, + feeRateBps, + slippageBps, + isYieldBearing, + tradeVolume, + liquidity, + publishedAt, + startDate, + endDate, + status, + markets); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ListPredictionMarketsResponseMarketTopicsInner {\n"); + sb.append(" marketTopicId: ").append(toIndentedString(marketTopicId)).append("\n"); + sb.append(" vendor: ").append(toIndentedString(vendor)).append("\n"); + sb.append(" chainId: ").append(toIndentedString(chainId)).append("\n"); + sb.append(" slug: ").append(toIndentedString(slug)).append("\n"); + sb.append(" title: ").append(toIndentedString(title)).append("\n"); + sb.append(" question: ").append(toIndentedString(question)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" imageUrl: ").append(toIndentedString(imageUrl)).append("\n"); + sb.append(" topicType: ").append(toIndentedString(topicType)).append("\n"); + sb.append(" chartType: ").append(toIndentedString(chartType)).append("\n"); + sb.append(" symbol: ").append(toIndentedString(symbol)).append("\n"); + sb.append(" participantCount: ").append(toIndentedString(participantCount)).append("\n"); + sb.append(" collateral: ").append(toIndentedString(collateral)).append("\n"); + sb.append(" feeRateBps: ").append(toIndentedString(feeRateBps)).append("\n"); + sb.append(" slippageBps: ").append(toIndentedString(slippageBps)).append("\n"); + sb.append(" isYieldBearing: ").append(toIndentedString(isYieldBearing)).append("\n"); + sb.append(" tradeVolume: ").append(toIndentedString(tradeVolume)).append("\n"); + sb.append(" liquidity: ").append(toIndentedString(liquidity)).append("\n"); + sb.append(" publishedAt: ").append(toIndentedString(publishedAt)).append("\n"); + sb.append(" startDate: ").append(toIndentedString(startDate)).append("\n"); + sb.append(" endDate: ").append(toIndentedString(endDate)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" markets: ").append(toIndentedString(markets)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object marketTopicIdValue = getMarketTopicId(); + String marketTopicIdValueAsString = ""; + marketTopicIdValueAsString = marketTopicIdValue.toString(); + sb.append("marketTopicId=").append(urlEncode(marketTopicIdValueAsString)).append(""); + Object vendorValue = getVendor(); + String vendorValueAsString = ""; + vendorValueAsString = vendorValue.toString(); + sb.append("vendor=").append(urlEncode(vendorValueAsString)).append(""); + Object chainIdValue = getChainId(); + String chainIdValueAsString = ""; + chainIdValueAsString = chainIdValue.toString(); + sb.append("chainId=").append(urlEncode(chainIdValueAsString)).append(""); + Object slugValue = getSlug(); + String slugValueAsString = ""; + slugValueAsString = slugValue.toString(); + sb.append("slug=").append(urlEncode(slugValueAsString)).append(""); + Object titleValue = getTitle(); + String titleValueAsString = ""; + titleValueAsString = titleValue.toString(); + sb.append("title=").append(urlEncode(titleValueAsString)).append(""); + Object questionValue = getQuestion(); + String questionValueAsString = ""; + questionValueAsString = questionValue.toString(); + sb.append("question=").append(urlEncode(questionValueAsString)).append(""); + Object descriptionValue = getDescription(); + String descriptionValueAsString = ""; + descriptionValueAsString = descriptionValue.toString(); + sb.append("description=").append(urlEncode(descriptionValueAsString)).append(""); + Object imageUrlValue = getImageUrl(); + String imageUrlValueAsString = ""; + imageUrlValueAsString = imageUrlValue.toString(); + sb.append("imageUrl=").append(urlEncode(imageUrlValueAsString)).append(""); + Object topicTypeValue = getTopicType(); + String topicTypeValueAsString = ""; + topicTypeValueAsString = topicTypeValue.toString(); + sb.append("topicType=").append(urlEncode(topicTypeValueAsString)).append(""); + Object chartTypeValue = getChartType(); + String chartTypeValueAsString = ""; + chartTypeValueAsString = chartTypeValue.toString(); + sb.append("chartType=").append(urlEncode(chartTypeValueAsString)).append(""); + Object symbolValue = getSymbol(); + String symbolValueAsString = ""; + symbolValueAsString = symbolValue.toString(); + sb.append("symbol=").append(urlEncode(symbolValueAsString)).append(""); + Object participantCountValue = getParticipantCount(); + String participantCountValueAsString = ""; + participantCountValueAsString = participantCountValue.toString(); + sb.append("participantCount=").append(urlEncode(participantCountValueAsString)).append(""); + Object collateralValue = getCollateral(); + String collateralValueAsString = ""; + collateralValueAsString = collateralValue.toString(); + sb.append("collateral=").append(urlEncode(collateralValueAsString)).append(""); + Object feeRateBpsValue = getFeeRateBps(); + String feeRateBpsValueAsString = ""; + feeRateBpsValueAsString = feeRateBpsValue.toString(); + sb.append("feeRateBps=").append(urlEncode(feeRateBpsValueAsString)).append(""); + Object slippageBpsValue = getSlippageBps(); + String slippageBpsValueAsString = ""; + slippageBpsValueAsString = slippageBpsValue.toString(); + sb.append("slippageBps=").append(urlEncode(slippageBpsValueAsString)).append(""); + Object isYieldBearingValue = getIsYieldBearing(); + String isYieldBearingValueAsString = ""; + isYieldBearingValueAsString = isYieldBearingValue.toString(); + sb.append("isYieldBearing=").append(urlEncode(isYieldBearingValueAsString)).append(""); + Object tradeVolumeValue = getTradeVolume(); + String tradeVolumeValueAsString = ""; + tradeVolumeValueAsString = tradeVolumeValue.toString(); + sb.append("tradeVolume=").append(urlEncode(tradeVolumeValueAsString)).append(""); + Object liquidityValue = getLiquidity(); + String liquidityValueAsString = ""; + liquidityValueAsString = liquidityValue.toString(); + sb.append("liquidity=").append(urlEncode(liquidityValueAsString)).append(""); + Object publishedAtValue = getPublishedAt(); + String publishedAtValueAsString = ""; + publishedAtValueAsString = publishedAtValue.toString(); + sb.append("publishedAt=").append(urlEncode(publishedAtValueAsString)).append(""); + Object startDateValue = getStartDate(); + String startDateValueAsString = ""; + startDateValueAsString = startDateValue.toString(); + sb.append("startDate=").append(urlEncode(startDateValueAsString)).append(""); + Object endDateValue = getEndDate(); + String endDateValueAsString = ""; + endDateValueAsString = endDateValue.toString(); + sb.append("endDate=").append(urlEncode(endDateValueAsString)).append(""); + Object statusValue = getStatus(); + String statusValueAsString = ""; + statusValueAsString = statusValue.toString(); + sb.append("status=").append(urlEncode(statusValueAsString)).append(""); + Object marketsValue = getMarkets(); + String marketsValueAsString = ""; + marketsValueAsString = + (String) + ((Collection) marketsValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("markets=").append(urlEncode(marketsValueAsString)).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("marketTopicId"); + openapiFields.add("vendor"); + openapiFields.add("chainId"); + openapiFields.add("slug"); + openapiFields.add("title"); + openapiFields.add("question"); + openapiFields.add("description"); + openapiFields.add("imageUrl"); + openapiFields.add("topicType"); + openapiFields.add("chartType"); + openapiFields.add("symbol"); + openapiFields.add("participantCount"); + openapiFields.add("collateral"); + openapiFields.add("feeRateBps"); + openapiFields.add("slippageBps"); + openapiFields.add("isYieldBearing"); + openapiFields.add("tradeVolume"); + openapiFields.add("liquidity"); + openapiFields.add("publishedAt"); + openapiFields.add("startDate"); + openapiFields.add("endDate"); + openapiFields.add("status"); + openapiFields.add("markets"); + + // 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 + * ListPredictionMarketsResponseMarketTopicsInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ListPredictionMarketsResponseMarketTopicsInner.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " ListPredictionMarketsResponseMarketTopicsInner is not found" + + " in the empty JSON string", + ListPredictionMarketsResponseMarketTopicsInner.openapiRequiredFields + .toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("vendor") != null && !jsonObj.get("vendor").isJsonNull()) + && !jsonObj.get("vendor").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `vendor` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("vendor").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("slug") != null && !jsonObj.get("slug").isJsonNull()) + && !jsonObj.get("slug").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `slug` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("slug").toString())); + } + if ((jsonObj.get("title") != null && !jsonObj.get("title").isJsonNull()) + && !jsonObj.get("title").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `title` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("title").toString())); + } + if ((jsonObj.get("question") != null && !jsonObj.get("question").isJsonNull()) + && !jsonObj.get("question").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `question` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("question").toString())); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) + && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `description` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("description").toString())); + } + if ((jsonObj.get("imageUrl") != null && !jsonObj.get("imageUrl").isJsonNull()) + && !jsonObj.get("imageUrl").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `imageUrl` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("imageUrl").toString())); + } + if ((jsonObj.get("topicType") != null && !jsonObj.get("topicType").isJsonNull()) + && !jsonObj.get("topicType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `topicType` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("topicType").toString())); + } + if ((jsonObj.get("chartType") != null && !jsonObj.get("chartType").isJsonNull()) + && !jsonObj.get("chartType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `chartType` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("chartType").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("collateral") != null && !jsonObj.get("collateral").isJsonNull()) + && !jsonObj.get("collateral").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `collateral` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("collateral").toString())); + } + if ((jsonObj.get("tradeVolume") != null && !jsonObj.get("tradeVolume").isJsonNull()) + && !jsonObj.get("tradeVolume").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `tradeVolume` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("tradeVolume").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("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())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("markets") != null + && !jsonObj.get("markets").isJsonNull() + && !jsonObj.get("markets").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `markets` to be an array in the JSON string but got" + + " `%s`", + jsonObj.get("markets").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ListPredictionMarketsResponseMarketTopicsInner.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'ListPredictionMarketsResponseMarketTopicsInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, + TypeToken.get(ListPredictionMarketsResponseMarketTopicsInner.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, + ListPredictionMarketsResponseMarketTopicsInner value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ListPredictionMarketsResponseMarketTopicsInner read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of ListPredictionMarketsResponseMarketTopicsInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of ListPredictionMarketsResponseMarketTopicsInner + * @throws IOException if the JSON string is invalid with respect to + * ListPredictionMarketsResponseMarketTopicsInner + */ + public static ListPredictionMarketsResponseMarketTopicsInner fromJson(String jsonString) + throws IOException { + return JSON.getGson() + .fromJson(jsonString, ListPredictionMarketsResponseMarketTopicsInner.class); + } + + /** + * Convert an instance of ListPredictionMarketsResponseMarketTopicsInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/ListPredictionWalletsResponse.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/ListPredictionWalletsResponse.java new file mode 100644 index 000000000..7a2528ac0 --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/ListPredictionWalletsResponse.java @@ -0,0 +1,251 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.model; + +import com.binance.connector.client.w3w_prediction.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.*; + +/** ListPredictionWalletsResponse */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class ListPredictionWalletsResponse { + public static final String SERIALIZED_NAME_WALLETS = "wallets"; + + @SerializedName(SERIALIZED_NAME_WALLETS) + @jakarta.annotation.Nullable + private List<@Valid ListPredictionWalletsResponseWalletsInner> wallets; + + public ListPredictionWalletsResponse() {} + + public ListPredictionWalletsResponse wallets( + @jakarta.annotation.Nullable + List<@Valid ListPredictionWalletsResponseWalletsInner> wallets) { + this.wallets = wallets; + return this; + } + + public ListPredictionWalletsResponse addWalletsItem( + ListPredictionWalletsResponseWalletsInner walletsItem) { + if (this.wallets == null) { + this.wallets = new ArrayList<>(); + } + this.wallets.add(walletsItem); + return this; + } + + /** + * Get wallets + * + * @return wallets + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid ListPredictionWalletsResponseWalletsInner> getWallets() { + return wallets; + } + + public void setWallets( + @jakarta.annotation.Nullable + List<@Valid ListPredictionWalletsResponseWalletsInner> wallets) { + this.wallets = wallets; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ListPredictionWalletsResponse listPredictionWalletsResponse = + (ListPredictionWalletsResponse) o; + return Objects.equals(this.wallets, listPredictionWalletsResponse.wallets); + } + + @Override + public int hashCode() { + return Objects.hash(wallets); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ListPredictionWalletsResponse {\n"); + sb.append(" wallets: ").append(toIndentedString(wallets)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object walletsValue = getWallets(); + String walletsValueAsString = ""; + walletsValueAsString = + (String) + ((Collection) walletsValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("wallets=").append(urlEncode(walletsValueAsString)).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("wallets"); + + // 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 + * ListPredictionWalletsResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ListPredictionWalletsResponse.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in ListPredictionWalletsResponse is not" + + " found in the empty JSON string", + ListPredictionWalletsResponse.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("wallets") != null && !jsonObj.get("wallets").isJsonNull()) { + JsonArray jsonArraywallets = jsonObj.getAsJsonArray("wallets"); + if (jsonArraywallets != null) { + // ensure the json data is an array + if (!jsonObj.get("wallets").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `wallets` to be an array in the JSON string" + + " but got `%s`", + jsonObj.get("wallets").toString())); + } + + // validate the optional field `wallets` (array) + for (int i = 0; i < jsonArraywallets.size(); i++) { + ListPredictionWalletsResponseWalletsInner.validateJsonElement( + jsonArraywallets.get(i)); + } + ; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ListPredictionWalletsResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ListPredictionWalletsResponse' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(ListPredictionWalletsResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ListPredictionWalletsResponse value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ListPredictionWalletsResponse read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of ListPredictionWalletsResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of ListPredictionWalletsResponse + * @throws IOException if the JSON string is invalid with respect to + * ListPredictionWalletsResponse + */ + public static ListPredictionWalletsResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ListPredictionWalletsResponse.class); + } + + /** + * Convert an instance of ListPredictionWalletsResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/ListPredictionWalletsResponseWalletsInner.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/ListPredictionWalletsResponseWalletsInner.java new file mode 100644 index 000000000..dc9e5f48e --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/ListPredictionWalletsResponseWalletsInner.java @@ -0,0 +1,299 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.model; + +import com.binance.connector.client.w3w_prediction.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.*; + +/** ListPredictionWalletsResponseWalletsInner */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class ListPredictionWalletsResponseWalletsInner { + public static final String SERIALIZED_NAME_WALLET_ADDRESS = "walletAddress"; + + @SerializedName(SERIALIZED_NAME_WALLET_ADDRESS) + @jakarta.annotation.Nullable + private String walletAddress; + + public static final String SERIALIZED_NAME_WALLET_ID = "walletId"; + + @SerializedName(SERIALIZED_NAME_WALLET_ID) + @jakarta.annotation.Nullable + private String walletId; + + public static final String SERIALIZED_NAME_REGISTERED_TIME = "registeredTime"; + + @SerializedName(SERIALIZED_NAME_REGISTERED_TIME) + @jakarta.annotation.Nullable + private Long registeredTime; + + public ListPredictionWalletsResponseWalletsInner() {} + + public ListPredictionWalletsResponseWalletsInner walletAddress( + @jakarta.annotation.Nullable String walletAddress) { + this.walletAddress = walletAddress; + return this; + } + + /** + * Get walletAddress + * + * @return walletAddress + */ + @jakarta.annotation.Nullable + public String getWalletAddress() { + return walletAddress; + } + + public void setWalletAddress(@jakarta.annotation.Nullable String walletAddress) { + this.walletAddress = walletAddress; + } + + public ListPredictionWalletsResponseWalletsInner walletId( + @jakarta.annotation.Nullable String walletId) { + this.walletId = walletId; + return this; + } + + /** + * Get walletId + * + * @return walletId + */ + @jakarta.annotation.Nullable + public String getWalletId() { + return walletId; + } + + public void setWalletId(@jakarta.annotation.Nullable String walletId) { + this.walletId = walletId; + } + + public ListPredictionWalletsResponseWalletsInner registeredTime( + @jakarta.annotation.Nullable Long registeredTime) { + this.registeredTime = registeredTime; + return this; + } + + /** + * Get registeredTime + * + * @return registeredTime + */ + @jakarta.annotation.Nullable + public Long getRegisteredTime() { + return registeredTime; + } + + public void setRegisteredTime(@jakarta.annotation.Nullable Long registeredTime) { + this.registeredTime = registeredTime; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ListPredictionWalletsResponseWalletsInner listPredictionWalletsResponseWalletsInner = + (ListPredictionWalletsResponseWalletsInner) o; + return Objects.equals( + this.walletAddress, listPredictionWalletsResponseWalletsInner.walletAddress) + && Objects.equals(this.walletId, listPredictionWalletsResponseWalletsInner.walletId) + && Objects.equals( + this.registeredTime, + listPredictionWalletsResponseWalletsInner.registeredTime); + } + + @Override + public int hashCode() { + return Objects.hash(walletAddress, walletId, registeredTime); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ListPredictionWalletsResponseWalletsInner {\n"); + sb.append(" walletAddress: ").append(toIndentedString(walletAddress)).append("\n"); + sb.append(" walletId: ").append(toIndentedString(walletId)).append("\n"); + sb.append(" registeredTime: ").append(toIndentedString(registeredTime)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object walletAddressValue = getWalletAddress(); + String walletAddressValueAsString = ""; + walletAddressValueAsString = walletAddressValue.toString(); + sb.append("walletAddress=").append(urlEncode(walletAddressValueAsString)).append(""); + Object walletIdValue = getWalletId(); + String walletIdValueAsString = ""; + walletIdValueAsString = walletIdValue.toString(); + sb.append("walletId=").append(urlEncode(walletIdValueAsString)).append(""); + Object registeredTimeValue = getRegisteredTime(); + String registeredTimeValueAsString = ""; + registeredTimeValueAsString = registeredTimeValue.toString(); + sb.append("registeredTime=").append(urlEncode(registeredTimeValueAsString)).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("walletAddress"); + openapiFields.add("walletId"); + openapiFields.add("registeredTime"); + + // 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 + * ListPredictionWalletsResponseWalletsInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ListPredictionWalletsResponseWalletsInner.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " ListPredictionWalletsResponseWalletsInner is not found in" + + " the empty JSON string", + ListPredictionWalletsResponseWalletsInner.openapiRequiredFields + .toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("walletAddress") != null && !jsonObj.get("walletAddress").isJsonNull()) + && !jsonObj.get("walletAddress").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `walletAddress` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("walletAddress").toString())); + } + if ((jsonObj.get("walletId") != null && !jsonObj.get("walletId").isJsonNull()) + && !jsonObj.get("walletId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `walletId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("walletId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ListPredictionWalletsResponseWalletsInner.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'ListPredictionWalletsResponseWalletsInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(ListPredictionWalletsResponseWalletsInner.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, ListPredictionWalletsResponseWalletsInner value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ListPredictionWalletsResponseWalletsInner read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of ListPredictionWalletsResponseWalletsInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of ListPredictionWalletsResponseWalletsInner + * @throws IOException if the JSON string is invalid with respect to + * ListPredictionWalletsResponseWalletsInner + */ + public static ListPredictionWalletsResponseWalletsInner fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, ListPredictionWalletsResponseWalletsInner.class); + } + + /** + * Convert an instance of ListPredictionWalletsResponseWalletsInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/MarketSearchResponse.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/MarketSearchResponse.java new file mode 100644 index 000000000..1d8380a52 --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/MarketSearchResponse.java @@ -0,0 +1,182 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.model; + +import com.binance.connector.client.w3w_prediction.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.*; + +/** MarketSearchResponse */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class MarketSearchResponse extends ArrayList { + public MarketSearchResponse() {} + + @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 MarketSearchResponse {\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 MarketSearchResponse + */ + 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) { + MarketSearchResponseInner.validateJsonElement(element); + } + if (jsonElement == null) { + if (!MarketSearchResponse.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in MarketSearchResponse is not found in" + + " the empty JSON string", + MarketSearchResponse.openapiRequiredFields.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MarketSearchResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MarketSearchResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(MarketSearchResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, MarketSearchResponse value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonArray(); + elementAdapter.write(out, obj); + } + + @Override + public MarketSearchResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of MarketSearchResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of MarketSearchResponse + * @throws IOException if the JSON string is invalid with respect to MarketSearchResponse + */ + public static MarketSearchResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MarketSearchResponse.class); + } + + /** + * Convert an instance of MarketSearchResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/MarketSearchResponseInner.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/MarketSearchResponseInner.java new file mode 100644 index 000000000..66380412b --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/MarketSearchResponseInner.java @@ -0,0 +1,896 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.model; + +import com.binance.connector.client.w3w_prediction.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; +import org.hibernate.validator.constraints.*; + +/** MarketSearchResponseInner */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class MarketSearchResponseInner { + public static final String SERIALIZED_NAME_MARKET_TOPIC_ID = "marketTopicId"; + + @SerializedName(SERIALIZED_NAME_MARKET_TOPIC_ID) + @jakarta.annotation.Nullable + private Long marketTopicId; + + public static final String SERIALIZED_NAME_VENDOR = "vendor"; + + @SerializedName(SERIALIZED_NAME_VENDOR) + @jakarta.annotation.Nullable + private String vendor; + + 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_SLUG = "slug"; + + @SerializedName(SERIALIZED_NAME_SLUG) + @jakarta.annotation.Nullable + private String slug; + + public static final String SERIALIZED_NAME_TITLE = "title"; + + @SerializedName(SERIALIZED_NAME_TITLE) + @jakarta.annotation.Nullable + private String title; + + public static final String SERIALIZED_NAME_QUESTION = "question"; + + @SerializedName(SERIALIZED_NAME_QUESTION) + @jakarta.annotation.Nullable + private String question; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @jakarta.annotation.Nullable + private String description; + + public static final String SERIALIZED_NAME_TOPIC_TYPE = "topicType"; + + @SerializedName(SERIALIZED_NAME_TOPIC_TYPE) + @jakarta.annotation.Nullable + private String topicType; + + public static final String SERIALIZED_NAME_CHART_TYPE = "chartType"; + + @SerializedName(SERIALIZED_NAME_CHART_TYPE) + @jakarta.annotation.Nullable + private String chartType; + + public static final String SERIALIZED_NAME_SYMBOL = "symbol"; + + @SerializedName(SERIALIZED_NAME_SYMBOL) + @jakarta.annotation.Nullable + private String symbol; + + public static final String SERIALIZED_NAME_PARTICIPANT_COUNT = "participantCount"; + + @SerializedName(SERIALIZED_NAME_PARTICIPANT_COUNT) + @jakarta.annotation.Nullable + private Integer participantCount; + + public static final String SERIALIZED_NAME_COLLATERAL = "collateral"; + + @SerializedName(SERIALIZED_NAME_COLLATERAL) + @jakarta.annotation.Nullable + private String collateral; + + public static final String SERIALIZED_NAME_TRADE_VOLUME = "tradeVolume"; + + @SerializedName(SERIALIZED_NAME_TRADE_VOLUME) + @jakarta.annotation.Nullable + private String tradeVolume; + + public static final String SERIALIZED_NAME_LIQUIDITY = "liquidity"; + + @SerializedName(SERIALIZED_NAME_LIQUIDITY) + @jakarta.annotation.Nullable + private String liquidity; + + public static final String SERIALIZED_NAME_START_DATE = "startDate"; + + @SerializedName(SERIALIZED_NAME_START_DATE) + @jakarta.annotation.Nullable + private Long startDate; + + public static final String SERIALIZED_NAME_END_DATE = "endDate"; + + @SerializedName(SERIALIZED_NAME_END_DATE) + @jakarta.annotation.Nullable + private Long endDate; + + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + @jakarta.annotation.Nullable + private String status; + + public static final String SERIALIZED_NAME_MARKETS = "markets"; + + @SerializedName(SERIALIZED_NAME_MARKETS) + @jakarta.annotation.Nullable + private List markets; + + public MarketSearchResponseInner() {} + + public MarketSearchResponseInner marketTopicId( + @jakarta.annotation.Nullable Long marketTopicId) { + this.marketTopicId = marketTopicId; + return this; + } + + /** + * Get marketTopicId + * + * @return marketTopicId + */ + @jakarta.annotation.Nullable + public Long getMarketTopicId() { + return marketTopicId; + } + + public void setMarketTopicId(@jakarta.annotation.Nullable Long marketTopicId) { + this.marketTopicId = marketTopicId; + } + + public MarketSearchResponseInner vendor(@jakarta.annotation.Nullable String vendor) { + this.vendor = vendor; + return this; + } + + /** + * Get vendor + * + * @return vendor + */ + @jakarta.annotation.Nullable + public String getVendor() { + return vendor; + } + + public void setVendor(@jakarta.annotation.Nullable String vendor) { + this.vendor = vendor; + } + + public MarketSearchResponseInner 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 MarketSearchResponseInner slug(@jakarta.annotation.Nullable String slug) { + this.slug = slug; + return this; + } + + /** + * Get slug + * + * @return slug + */ + @jakarta.annotation.Nullable + public String getSlug() { + return slug; + } + + public void setSlug(@jakarta.annotation.Nullable String slug) { + this.slug = slug; + } + + public MarketSearchResponseInner title(@jakarta.annotation.Nullable String title) { + this.title = title; + return this; + } + + /** + * Get title + * + * @return title + */ + @jakarta.annotation.Nullable + public String getTitle() { + return title; + } + + public void setTitle(@jakarta.annotation.Nullable String title) { + this.title = title; + } + + public MarketSearchResponseInner question(@jakarta.annotation.Nullable String question) { + this.question = question; + return this; + } + + /** + * Get question + * + * @return question + */ + @jakarta.annotation.Nullable + public String getQuestion() { + return question; + } + + public void setQuestion(@jakarta.annotation.Nullable String question) { + this.question = question; + } + + public MarketSearchResponseInner description(@jakarta.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Get description + * + * @return description + */ + @jakarta.annotation.Nullable + public String getDescription() { + return description; + } + + public void setDescription(@jakarta.annotation.Nullable String description) { + this.description = description; + } + + public MarketSearchResponseInner topicType(@jakarta.annotation.Nullable String topicType) { + this.topicType = topicType; + return this; + } + + /** + * Get topicType + * + * @return topicType + */ + @jakarta.annotation.Nullable + public String getTopicType() { + return topicType; + } + + public void setTopicType(@jakarta.annotation.Nullable String topicType) { + this.topicType = topicType; + } + + public MarketSearchResponseInner chartType(@jakarta.annotation.Nullable String chartType) { + this.chartType = chartType; + return this; + } + + /** + * Get chartType + * + * @return chartType + */ + @jakarta.annotation.Nullable + public String getChartType() { + return chartType; + } + + public void setChartType(@jakarta.annotation.Nullable String chartType) { + this.chartType = chartType; + } + + public MarketSearchResponseInner 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 MarketSearchResponseInner participantCount( + @jakarta.annotation.Nullable Integer participantCount) { + this.participantCount = participantCount; + return this; + } + + /** + * Get participantCount + * + * @return participantCount + */ + @jakarta.annotation.Nullable + public Integer getParticipantCount() { + return participantCount; + } + + public void setParticipantCount(@jakarta.annotation.Nullable Integer participantCount) { + this.participantCount = participantCount; + } + + public MarketSearchResponseInner collateral(@jakarta.annotation.Nullable String collateral) { + this.collateral = collateral; + return this; + } + + /** + * Get collateral + * + * @return collateral + */ + @jakarta.annotation.Nullable + public String getCollateral() { + return collateral; + } + + public void setCollateral(@jakarta.annotation.Nullable String collateral) { + this.collateral = collateral; + } + + public MarketSearchResponseInner tradeVolume(@jakarta.annotation.Nullable String tradeVolume) { + this.tradeVolume = tradeVolume; + return this; + } + + /** + * Get tradeVolume + * + * @return tradeVolume + */ + @jakarta.annotation.Nullable + public String getTradeVolume() { + return tradeVolume; + } + + public void setTradeVolume(@jakarta.annotation.Nullable String tradeVolume) { + this.tradeVolume = tradeVolume; + } + + public MarketSearchResponseInner 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 MarketSearchResponseInner startDate(@jakarta.annotation.Nullable Long startDate) { + this.startDate = startDate; + return this; + } + + /** + * Get startDate + * + * @return startDate + */ + @jakarta.annotation.Nullable + public Long getStartDate() { + return startDate; + } + + public void setStartDate(@jakarta.annotation.Nullable Long startDate) { + this.startDate = startDate; + } + + public MarketSearchResponseInner endDate(@jakarta.annotation.Nullable Long endDate) { + this.endDate = endDate; + return this; + } + + /** + * Get endDate + * + * @return endDate + */ + @jakarta.annotation.Nullable + public Long getEndDate() { + return endDate; + } + + public void setEndDate(@jakarta.annotation.Nullable Long endDate) { + this.endDate = endDate; + } + + public MarketSearchResponseInner 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 MarketSearchResponseInner markets(@jakarta.annotation.Nullable List markets) { + this.markets = markets; + return this; + } + + public MarketSearchResponseInner addMarketsItem(Object marketsItem) { + if (this.markets == null) { + this.markets = new ArrayList<>(); + } + this.markets.add(marketsItem); + return this; + } + + /** + * Get markets + * + * @return markets + */ + @jakarta.annotation.Nullable + public List getMarkets() { + return markets; + } + + public void setMarkets(@jakarta.annotation.Nullable List markets) { + this.markets = markets; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MarketSearchResponseInner marketSearchResponseInner = (MarketSearchResponseInner) o; + return Objects.equals(this.marketTopicId, marketSearchResponseInner.marketTopicId) + && Objects.equals(this.vendor, marketSearchResponseInner.vendor) + && Objects.equals(this.chainId, marketSearchResponseInner.chainId) + && Objects.equals(this.slug, marketSearchResponseInner.slug) + && Objects.equals(this.title, marketSearchResponseInner.title) + && Objects.equals(this.question, marketSearchResponseInner.question) + && Objects.equals(this.description, marketSearchResponseInner.description) + && Objects.equals(this.topicType, marketSearchResponseInner.topicType) + && Objects.equals(this.chartType, marketSearchResponseInner.chartType) + && Objects.equals(this.symbol, marketSearchResponseInner.symbol) + && Objects.equals(this.participantCount, marketSearchResponseInner.participantCount) + && Objects.equals(this.collateral, marketSearchResponseInner.collateral) + && Objects.equals(this.tradeVolume, marketSearchResponseInner.tradeVolume) + && Objects.equals(this.liquidity, marketSearchResponseInner.liquidity) + && Objects.equals(this.startDate, marketSearchResponseInner.startDate) + && Objects.equals(this.endDate, marketSearchResponseInner.endDate) + && Objects.equals(this.status, marketSearchResponseInner.status) + && Objects.equals(this.markets, marketSearchResponseInner.markets); + } + + @Override + public int hashCode() { + return Objects.hash( + marketTopicId, + vendor, + chainId, + slug, + title, + question, + description, + topicType, + chartType, + symbol, + participantCount, + collateral, + tradeVolume, + liquidity, + startDate, + endDate, + status, + markets); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MarketSearchResponseInner {\n"); + sb.append(" marketTopicId: ").append(toIndentedString(marketTopicId)).append("\n"); + sb.append(" vendor: ").append(toIndentedString(vendor)).append("\n"); + sb.append(" chainId: ").append(toIndentedString(chainId)).append("\n"); + sb.append(" slug: ").append(toIndentedString(slug)).append("\n"); + sb.append(" title: ").append(toIndentedString(title)).append("\n"); + sb.append(" question: ").append(toIndentedString(question)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" topicType: ").append(toIndentedString(topicType)).append("\n"); + sb.append(" chartType: ").append(toIndentedString(chartType)).append("\n"); + sb.append(" symbol: ").append(toIndentedString(symbol)).append("\n"); + sb.append(" participantCount: ").append(toIndentedString(participantCount)).append("\n"); + sb.append(" collateral: ").append(toIndentedString(collateral)).append("\n"); + sb.append(" tradeVolume: ").append(toIndentedString(tradeVolume)).append("\n"); + sb.append(" liquidity: ").append(toIndentedString(liquidity)).append("\n"); + sb.append(" startDate: ").append(toIndentedString(startDate)).append("\n"); + sb.append(" endDate: ").append(toIndentedString(endDate)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" markets: ").append(toIndentedString(markets)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object marketTopicIdValue = getMarketTopicId(); + String marketTopicIdValueAsString = ""; + marketTopicIdValueAsString = marketTopicIdValue.toString(); + sb.append("marketTopicId=").append(urlEncode(marketTopicIdValueAsString)).append(""); + Object vendorValue = getVendor(); + String vendorValueAsString = ""; + vendorValueAsString = vendorValue.toString(); + sb.append("vendor=").append(urlEncode(vendorValueAsString)).append(""); + Object chainIdValue = getChainId(); + String chainIdValueAsString = ""; + chainIdValueAsString = chainIdValue.toString(); + sb.append("chainId=").append(urlEncode(chainIdValueAsString)).append(""); + Object slugValue = getSlug(); + String slugValueAsString = ""; + slugValueAsString = slugValue.toString(); + sb.append("slug=").append(urlEncode(slugValueAsString)).append(""); + Object titleValue = getTitle(); + String titleValueAsString = ""; + titleValueAsString = titleValue.toString(); + sb.append("title=").append(urlEncode(titleValueAsString)).append(""); + Object questionValue = getQuestion(); + String questionValueAsString = ""; + questionValueAsString = questionValue.toString(); + sb.append("question=").append(urlEncode(questionValueAsString)).append(""); + Object descriptionValue = getDescription(); + String descriptionValueAsString = ""; + descriptionValueAsString = descriptionValue.toString(); + sb.append("description=").append(urlEncode(descriptionValueAsString)).append(""); + Object topicTypeValue = getTopicType(); + String topicTypeValueAsString = ""; + topicTypeValueAsString = topicTypeValue.toString(); + sb.append("topicType=").append(urlEncode(topicTypeValueAsString)).append(""); + Object chartTypeValue = getChartType(); + String chartTypeValueAsString = ""; + chartTypeValueAsString = chartTypeValue.toString(); + sb.append("chartType=").append(urlEncode(chartTypeValueAsString)).append(""); + Object symbolValue = getSymbol(); + String symbolValueAsString = ""; + symbolValueAsString = symbolValue.toString(); + sb.append("symbol=").append(urlEncode(symbolValueAsString)).append(""); + Object participantCountValue = getParticipantCount(); + String participantCountValueAsString = ""; + participantCountValueAsString = participantCountValue.toString(); + sb.append("participantCount=").append(urlEncode(participantCountValueAsString)).append(""); + Object collateralValue = getCollateral(); + String collateralValueAsString = ""; + collateralValueAsString = collateralValue.toString(); + sb.append("collateral=").append(urlEncode(collateralValueAsString)).append(""); + Object tradeVolumeValue = getTradeVolume(); + String tradeVolumeValueAsString = ""; + tradeVolumeValueAsString = tradeVolumeValue.toString(); + sb.append("tradeVolume=").append(urlEncode(tradeVolumeValueAsString)).append(""); + Object liquidityValue = getLiquidity(); + String liquidityValueAsString = ""; + liquidityValueAsString = liquidityValue.toString(); + sb.append("liquidity=").append(urlEncode(liquidityValueAsString)).append(""); + Object startDateValue = getStartDate(); + String startDateValueAsString = ""; + startDateValueAsString = startDateValue.toString(); + sb.append("startDate=").append(urlEncode(startDateValueAsString)).append(""); + Object endDateValue = getEndDate(); + String endDateValueAsString = ""; + endDateValueAsString = endDateValue.toString(); + sb.append("endDate=").append(urlEncode(endDateValueAsString)).append(""); + Object statusValue = getStatus(); + String statusValueAsString = ""; + statusValueAsString = statusValue.toString(); + sb.append("status=").append(urlEncode(statusValueAsString)).append(""); + Object marketsValue = getMarkets(); + String marketsValueAsString = ""; + marketsValueAsString = + (String) + ((Collection) marketsValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("markets=").append(urlEncode(marketsValueAsString)).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("marketTopicId"); + openapiFields.add("vendor"); + openapiFields.add("chainId"); + openapiFields.add("slug"); + openapiFields.add("title"); + openapiFields.add("question"); + openapiFields.add("description"); + openapiFields.add("topicType"); + openapiFields.add("chartType"); + openapiFields.add("symbol"); + openapiFields.add("participantCount"); + openapiFields.add("collateral"); + openapiFields.add("tradeVolume"); + openapiFields.add("liquidity"); + openapiFields.add("startDate"); + openapiFields.add("endDate"); + openapiFields.add("status"); + openapiFields.add("markets"); + + // 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 MarketSearchResponseInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MarketSearchResponseInner.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in MarketSearchResponseInner is not found" + + " in the empty JSON string", + MarketSearchResponseInner.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("vendor") != null && !jsonObj.get("vendor").isJsonNull()) + && !jsonObj.get("vendor").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `vendor` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("vendor").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("slug") != null && !jsonObj.get("slug").isJsonNull()) + && !jsonObj.get("slug").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `slug` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("slug").toString())); + } + if ((jsonObj.get("title") != null && !jsonObj.get("title").isJsonNull()) + && !jsonObj.get("title").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `title` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("title").toString())); + } + if ((jsonObj.get("question") != null && !jsonObj.get("question").isJsonNull()) + && !jsonObj.get("question").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `question` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("question").toString())); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) + && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `description` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("description").toString())); + } + if ((jsonObj.get("topicType") != null && !jsonObj.get("topicType").isJsonNull()) + && !jsonObj.get("topicType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `topicType` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("topicType").toString())); + } + if ((jsonObj.get("chartType") != null && !jsonObj.get("chartType").isJsonNull()) + && !jsonObj.get("chartType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `chartType` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("chartType").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("collateral") != null && !jsonObj.get("collateral").isJsonNull()) + && !jsonObj.get("collateral").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `collateral` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("collateral").toString())); + } + if ((jsonObj.get("tradeVolume") != null && !jsonObj.get("tradeVolume").isJsonNull()) + && !jsonObj.get("tradeVolume").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `tradeVolume` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("tradeVolume").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("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())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("markets") != null + && !jsonObj.get("markets").isJsonNull() + && !jsonObj.get("markets").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `markets` to be an array in the JSON string but got" + + " `%s`", + jsonObj.get("markets").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MarketSearchResponseInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MarketSearchResponseInner' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(MarketSearchResponseInner.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, MarketSearchResponseInner value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public MarketSearchResponseInner read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of MarketSearchResponseInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of MarketSearchResponseInner + * @throws IOException if the JSON string is invalid with respect to MarketSearchResponseInner + */ + public static MarketSearchResponseInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MarketSearchResponseInner.class); + } + + /** + * Convert an instance of MarketSearchResponseInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/OrderBy.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/OrderBy.java new file mode 100644 index 000000000..43a4502ae --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/OrderBy.java @@ -0,0 +1,73 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.model; + +import com.google.gson.JsonElement; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import org.hibernate.validator.constraints.*; + +/** Gets or Sets orderBy */ +@JsonAdapter(OrderBy.Adapter.class) +public enum OrderBy { + ASC("ASC"), + + DESC("DESC"); + + private String value; + + OrderBy(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static OrderBy fromValue(String value) { + for (OrderBy b : OrderBy.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final OrderBy enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public OrderBy read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return OrderBy.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + OrderBy.fromValue(value); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/OrderType.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/OrderType.java new file mode 100644 index 000000000..107425ff8 --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/OrderType.java @@ -0,0 +1,73 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.model; + +import com.google.gson.JsonElement; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import org.hibernate.validator.constraints.*; + +/** Gets or Sets orderType */ +@JsonAdapter(OrderType.Adapter.class) +public enum OrderType { + MARKET("MARKET"), + + LIMIT("LIMIT"); + + private String value; + + OrderType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static OrderType fromValue(String value) { + for (OrderType b : OrderType.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final OrderType enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public OrderType read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return OrderType.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + OrderType.fromValue(value); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/PlaceOrderRequest.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/PlaceOrderRequest.java new file mode 100644 index 000000000..ae6ae7be9 --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/PlaceOrderRequest.java @@ -0,0 +1,590 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.model; + +import com.binance.connector.client.w3w_prediction.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.*; + +/** PlaceOrderRequest */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class PlaceOrderRequest { + public static final String SERIALIZED_NAME_WALLET_ADDRESS = "walletAddress"; + + @SerializedName(SERIALIZED_NAME_WALLET_ADDRESS) + @jakarta.annotation.Nonnull + private String walletAddress; + + public static final String SERIALIZED_NAME_WALLET_ID = "walletId"; + + @SerializedName(SERIALIZED_NAME_WALLET_ID) + @jakarta.annotation.Nonnull + private String walletId; + + public static final String SERIALIZED_NAME_QUOTE_ID = "quoteId"; + + @SerializedName(SERIALIZED_NAME_QUOTE_ID) + @jakarta.annotation.Nonnull + private String quoteId; + + public static final String SERIALIZED_NAME_TIME_IN_FORCE = "timeInForce"; + + @SerializedName(SERIALIZED_NAME_TIME_IN_FORCE) + @jakarta.annotation.Nonnull + private String timeInForce; + + public static final String SERIALIZED_NAME_ACCOUNT_TYPE = "accountType"; + + @SerializedName(SERIALIZED_NAME_ACCOUNT_TYPE) + @jakarta.annotation.Nonnull + private AccountType accountType; + + public static final String SERIALIZED_NAME_ORDER_TYPE = "orderType"; + + @SerializedName(SERIALIZED_NAME_ORDER_TYPE) + @jakarta.annotation.Nonnull + private OrderType orderType; + + public static final String SERIALIZED_NAME_SLIPPAGE_BPS = "slippageBps"; + + @SerializedName(SERIALIZED_NAME_SLIPPAGE_BPS) + @jakarta.annotation.Nonnull + private Integer slippageBps; + + public static final String SERIALIZED_NAME_PRICE_LIMIT = "priceLimit"; + + @SerializedName(SERIALIZED_NAME_PRICE_LIMIT) + @jakarta.annotation.Nullable + private String priceLimit; + + public static final String SERIALIZED_NAME_FUNDING_SOURCE = "fundingSource"; + + @SerializedName(SERIALIZED_NAME_FUNDING_SOURCE) + @jakarta.annotation.Nullable + private FundingSource fundingSource = FundingSource.MPC; + + public static final String SERIALIZED_NAME_FUND_TRANSFER_AMOUNT = "fundTransferAmount"; + + @SerializedName(SERIALIZED_NAME_FUND_TRANSFER_AMOUNT) + @jakarta.annotation.Nullable + private String fundTransferAmount; + + public PlaceOrderRequest() {} + + public PlaceOrderRequest walletAddress(@jakarta.annotation.Nonnull String walletAddress) { + this.walletAddress = walletAddress; + return this; + } + + /** + * User's prediction wallet address + * + * @return walletAddress + */ + @jakarta.annotation.Nonnull + @NotNull + public String getWalletAddress() { + return walletAddress; + } + + public void setWalletAddress(@jakarta.annotation.Nonnull String walletAddress) { + this.walletAddress = walletAddress; + } + + public PlaceOrderRequest walletId(@jakarta.annotation.Nonnull String walletId) { + this.walletId = walletId; + return this; + } + + /** + * Wallet ID + * + * @return walletId + */ + @jakarta.annotation.Nonnull + @NotNull + public String getWalletId() { + return walletId; + } + + public void setWalletId(@jakarta.annotation.Nonnull String walletId) { + this.walletId = walletId; + } + + public PlaceOrderRequest quoteId(@jakarta.annotation.Nonnull String quoteId) { + this.quoteId = quoteId; + return this; + } + + /** + * Quote ID obtained from `Get Quote` + * + * @return quoteId + */ + @jakarta.annotation.Nonnull + @NotNull + public String getQuoteId() { + return quoteId; + } + + public void setQuoteId(@jakarta.annotation.Nonnull String quoteId) { + this.quoteId = quoteId; + } + + public PlaceOrderRequest timeInForce(@jakarta.annotation.Nonnull String timeInForce) { + this.timeInForce = timeInForce; + return this; + } + + /** + * Must match `orderType`: `FOK` for `MARKET`, `GTC` for + * `LIMIT` + * + * @return timeInForce + */ + @jakarta.annotation.Nonnull + @NotNull + public String getTimeInForce() { + return timeInForce; + } + + public void setTimeInForce(@jakarta.annotation.Nonnull String timeInForce) { + this.timeInForce = timeInForce; + } + + public PlaceOrderRequest accountType(@jakarta.annotation.Nonnull AccountType accountType) { + this.accountType = accountType; + return this; + } + + /** + * Get accountType + * + * @return accountType + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public AccountType getAccountType() { + return accountType; + } + + public void setAccountType(@jakarta.annotation.Nonnull AccountType accountType) { + this.accountType = accountType; + } + + public PlaceOrderRequest orderType(@jakarta.annotation.Nonnull OrderType orderType) { + this.orderType = orderType; + return this; + } + + /** + * Get orderType + * + * @return orderType + */ + @jakarta.annotation.Nonnull + @NotNull + @Valid + public OrderType getOrderType() { + return orderType; + } + + public void setOrderType(@jakarta.annotation.Nonnull OrderType orderType) { + this.orderType = orderType; + } + + public PlaceOrderRequest slippageBps(@jakarta.annotation.Nonnull Integer slippageBps) { + this.slippageBps = slippageBps; + return this; + } + + /** + * Slippage tolerance in basis points. Range 1–10000 minimum: 1 maximum: 10000 + * + * @return slippageBps + */ + @jakarta.annotation.Nonnull + @NotNull + @Min(1) + @Max(10000) + public Integer getSlippageBps() { + return slippageBps; + } + + public void setSlippageBps(@jakarta.annotation.Nonnull Integer slippageBps) { + this.slippageBps = slippageBps; + } + + public PlaceOrderRequest priceLimit(@jakarta.annotation.Nullable String priceLimit) { + this.priceLimit = priceLimit; + return this; + } + + /** + * Limit price. Required when `orderType=LIMIT`. Must be > 0 + * + * @return priceLimit + */ + @jakarta.annotation.Nullable + public String getPriceLimit() { + return priceLimit; + } + + public void setPriceLimit(@jakarta.annotation.Nullable String priceLimit) { + this.priceLimit = priceLimit; + } + + public PlaceOrderRequest fundingSource( + @jakarta.annotation.Nullable FundingSource fundingSource) { + this.fundingSource = fundingSource; + return this; + } + + /** + * Get fundingSource + * + * @return fundingSource + */ + @jakarta.annotation.Nullable + @Valid + public FundingSource getFundingSource() { + return fundingSource; + } + + public void setFundingSource(@jakarta.annotation.Nullable FundingSource fundingSource) { + this.fundingSource = fundingSource; + } + + public PlaceOrderRequest fundTransferAmount( + @jakarta.annotation.Nullable String fundTransferAmount) { + this.fundTransferAmount = fundTransferAmount; + return this; + } + + /** + * Auto-transfer amount before order (wei). Must be > 0 if provided + * + * @return fundTransferAmount + */ + @jakarta.annotation.Nullable + public String getFundTransferAmount() { + return fundTransferAmount; + } + + public void setFundTransferAmount(@jakarta.annotation.Nullable String fundTransferAmount) { + this.fundTransferAmount = fundTransferAmount; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PlaceOrderRequest placeOrderRequest = (PlaceOrderRequest) o; + return Objects.equals(this.walletAddress, placeOrderRequest.walletAddress) + && Objects.equals(this.walletId, placeOrderRequest.walletId) + && Objects.equals(this.quoteId, placeOrderRequest.quoteId) + && Objects.equals(this.timeInForce, placeOrderRequest.timeInForce) + && Objects.equals(this.accountType, placeOrderRequest.accountType) + && Objects.equals(this.orderType, placeOrderRequest.orderType) + && Objects.equals(this.slippageBps, placeOrderRequest.slippageBps) + && Objects.equals(this.priceLimit, placeOrderRequest.priceLimit) + && Objects.equals(this.fundingSource, placeOrderRequest.fundingSource) + && Objects.equals(this.fundTransferAmount, placeOrderRequest.fundTransferAmount); + } + + @Override + public int hashCode() { + return Objects.hash( + walletAddress, + walletId, + quoteId, + timeInForce, + accountType, + orderType, + slippageBps, + priceLimit, + fundingSource, + fundTransferAmount); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PlaceOrderRequest {\n"); + sb.append(" walletAddress: ").append(toIndentedString(walletAddress)).append("\n"); + sb.append(" walletId: ").append(toIndentedString(walletId)).append("\n"); + sb.append(" quoteId: ").append(toIndentedString(quoteId)).append("\n"); + sb.append(" timeInForce: ").append(toIndentedString(timeInForce)).append("\n"); + sb.append(" accountType: ").append(toIndentedString(accountType)).append("\n"); + sb.append(" orderType: ").append(toIndentedString(orderType)).append("\n"); + sb.append(" slippageBps: ").append(toIndentedString(slippageBps)).append("\n"); + sb.append(" priceLimit: ").append(toIndentedString(priceLimit)).append("\n"); + sb.append(" fundingSource: ").append(toIndentedString(fundingSource)).append("\n"); + sb.append(" fundTransferAmount: ") + .append(toIndentedString(fundTransferAmount)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object walletAddressValue = getWalletAddress(); + String walletAddressValueAsString = ""; + walletAddressValueAsString = walletAddressValue.toString(); + sb.append("walletAddress=").append(urlEncode(walletAddressValueAsString)).append(""); + Object walletIdValue = getWalletId(); + String walletIdValueAsString = ""; + walletIdValueAsString = walletIdValue.toString(); + sb.append("walletId=").append(urlEncode(walletIdValueAsString)).append(""); + Object quoteIdValue = getQuoteId(); + String quoteIdValueAsString = ""; + quoteIdValueAsString = quoteIdValue.toString(); + sb.append("quoteId=").append(urlEncode(quoteIdValueAsString)).append(""); + Object timeInForceValue = getTimeInForce(); + String timeInForceValueAsString = ""; + timeInForceValueAsString = timeInForceValue.toString(); + sb.append("timeInForce=").append(urlEncode(timeInForceValueAsString)).append(""); + Object accountTypeValue = getAccountType(); + String accountTypeValueAsString = ""; + accountTypeValueAsString = accountTypeValue.toString(); + sb.append("accountType=").append(urlEncode(accountTypeValueAsString)).append(""); + Object orderTypeValue = getOrderType(); + String orderTypeValueAsString = ""; + orderTypeValueAsString = orderTypeValue.toString(); + sb.append("orderType=").append(urlEncode(orderTypeValueAsString)).append(""); + Object slippageBpsValue = getSlippageBps(); + String slippageBpsValueAsString = ""; + slippageBpsValueAsString = slippageBpsValue.toString(); + sb.append("slippageBps=").append(urlEncode(slippageBpsValueAsString)).append(""); + Object priceLimitValue = getPriceLimit(); + String priceLimitValueAsString = ""; + priceLimitValueAsString = priceLimitValue.toString(); + sb.append("priceLimit=").append(urlEncode(priceLimitValueAsString)).append(""); + Object fundingSourceValue = getFundingSource(); + String fundingSourceValueAsString = ""; + fundingSourceValueAsString = fundingSourceValue.toString(); + sb.append("fundingSource=").append(urlEncode(fundingSourceValueAsString)).append(""); + Object fundTransferAmountValue = getFundTransferAmount(); + String fundTransferAmountValueAsString = ""; + fundTransferAmountValueAsString = fundTransferAmountValue.toString(); + sb.append("fundTransferAmount=") + .append(urlEncode(fundTransferAmountValueAsString)) + .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("walletAddress"); + openapiFields.add("walletId"); + openapiFields.add("quoteId"); + openapiFields.add("timeInForce"); + openapiFields.add("accountType"); + openapiFields.add("orderType"); + openapiFields.add("slippageBps"); + openapiFields.add("priceLimit"); + openapiFields.add("fundingSource"); + openapiFields.add("fundTransferAmount"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("walletAddress"); + openapiRequiredFields.add("walletId"); + openapiRequiredFields.add("quoteId"); + openapiRequiredFields.add("timeInForce"); + openapiRequiredFields.add("accountType"); + openapiRequiredFields.add("orderType"); + openapiRequiredFields.add("slippageBps"); + } + + /** + * 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 PlaceOrderRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PlaceOrderRequest.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in PlaceOrderRequest is not found in the" + + " empty JSON string", + PlaceOrderRequest.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PlaceOrderRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("walletAddress").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `walletAddress` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("walletAddress").toString())); + } + if (!jsonObj.get("walletId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `walletId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("walletId").toString())); + } + if (!jsonObj.get("quoteId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `quoteId` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("quoteId").toString())); + } + if (!jsonObj.get("timeInForce").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `timeInForce` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("timeInForce").toString())); + } + // validate the required field `accountType` + AccountType.validateJsonElement(jsonObj.get("accountType")); + // validate the required field `orderType` + OrderType.validateJsonElement(jsonObj.get("orderType")); + if ((jsonObj.get("priceLimit") != null && !jsonObj.get("priceLimit").isJsonNull()) + && !jsonObj.get("priceLimit").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `priceLimit` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("priceLimit").toString())); + } + // validate the optional field `fundingSource` + if (jsonObj.get("fundingSource") != null && !jsonObj.get("fundingSource").isJsonNull()) { + FundingSource.validateJsonElement(jsonObj.get("fundingSource")); + } + if ((jsonObj.get("fundTransferAmount") != null + && !jsonObj.get("fundTransferAmount").isJsonNull()) + && !jsonObj.get("fundTransferAmount").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `fundTransferAmount` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("fundTransferAmount").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PlaceOrderRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PlaceOrderRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(PlaceOrderRequest.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, PlaceOrderRequest value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PlaceOrderRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of PlaceOrderRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of PlaceOrderRequest + * @throws IOException if the JSON string is invalid with respect to PlaceOrderRequest + */ + public static PlaceOrderRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PlaceOrderRequest.class); + } + + /** + * Convert an instance of PlaceOrderRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/PlaceOrderResponse.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/PlaceOrderResponse.java new file mode 100644 index 000000000..124952696 --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/PlaceOrderResponse.java @@ -0,0 +1,210 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.model; + +import com.binance.connector.client.w3w_prediction.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.*; + +/** PlaceOrderResponse */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class PlaceOrderResponse { + public static final String SERIALIZED_NAME_ORDER_ID = "orderId"; + + @SerializedName(SERIALIZED_NAME_ORDER_ID) + @jakarta.annotation.Nullable + private String orderId; + + public PlaceOrderResponse() {} + + public PlaceOrderResponse orderId(@jakarta.annotation.Nullable String orderId) { + this.orderId = orderId; + return this; + } + + /** + * Get orderId + * + * @return orderId + */ + @jakarta.annotation.Nullable + public String getOrderId() { + return orderId; + } + + public void setOrderId(@jakarta.annotation.Nullable String orderId) { + this.orderId = orderId; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PlaceOrderResponse placeOrderResponse = (PlaceOrderResponse) o; + return Objects.equals(this.orderId, placeOrderResponse.orderId); + } + + @Override + public int hashCode() { + return Objects.hash(orderId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PlaceOrderResponse {\n"); + sb.append(" orderId: ").append(toIndentedString(orderId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object orderIdValue = getOrderId(); + String orderIdValueAsString = ""; + orderIdValueAsString = orderIdValue.toString(); + sb.append("orderId=").append(urlEncode(orderIdValueAsString)).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("orderId"); + + // 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 PlaceOrderResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PlaceOrderResponse.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in PlaceOrderResponse is not found in the" + + " empty JSON string", + PlaceOrderResponse.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("orderId") != null && !jsonObj.get("orderId").isJsonNull()) + && !jsonObj.get("orderId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `orderId` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("orderId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PlaceOrderResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PlaceOrderResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(PlaceOrderResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, PlaceOrderResponse value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PlaceOrderResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of PlaceOrderResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of PlaceOrderResponse + * @throws IOException if the JSON string is invalid with respect to PlaceOrderResponse + */ + public static PlaceOrderResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PlaceOrderResponse.class); + } + + /** + * Convert an instance of PlaceOrderResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryActiveOrdersResponse.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryActiveOrdersResponse.java new file mode 100644 index 000000000..95b71f158 --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryActiveOrdersResponse.java @@ -0,0 +1,340 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.model; + +import com.binance.connector.client.w3w_prediction.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.*; + +/** QueryActiveOrdersResponse */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class QueryActiveOrdersResponse { + public static final String SERIALIZED_NAME_TOTAL = "total"; + + @SerializedName(SERIALIZED_NAME_TOTAL) + @jakarta.annotation.Nullable + private Integer total; + + public static final String SERIALIZED_NAME_OFFSET = "offset"; + + @SerializedName(SERIALIZED_NAME_OFFSET) + @jakarta.annotation.Nullable + private Integer offset; + + public static final String SERIALIZED_NAME_LIMIT = "limit"; + + @SerializedName(SERIALIZED_NAME_LIMIT) + @jakarta.annotation.Nullable + private Integer limit; + + public static final String SERIALIZED_NAME_ORDERS = "orders"; + + @SerializedName(SERIALIZED_NAME_ORDERS) + @jakarta.annotation.Nullable + private List<@Valid QueryActiveOrdersResponseOrdersInner> orders; + + public QueryActiveOrdersResponse() {} + + public QueryActiveOrdersResponse total(@jakarta.annotation.Nullable Integer total) { + this.total = total; + return this; + } + + /** + * Get total + * + * @return total + */ + @jakarta.annotation.Nullable + public Integer getTotal() { + return total; + } + + public void setTotal(@jakarta.annotation.Nullable Integer total) { + this.total = total; + } + + public QueryActiveOrdersResponse offset(@jakarta.annotation.Nullable Integer offset) { + this.offset = offset; + return this; + } + + /** + * Get offset + * + * @return offset + */ + @jakarta.annotation.Nullable + public Integer getOffset() { + return offset; + } + + public void setOffset(@jakarta.annotation.Nullable Integer offset) { + this.offset = offset; + } + + public QueryActiveOrdersResponse limit(@jakarta.annotation.Nullable Integer limit) { + this.limit = limit; + return this; + } + + /** + * Get limit + * + * @return limit + */ + @jakarta.annotation.Nullable + public Integer getLimit() { + return limit; + } + + public void setLimit(@jakarta.annotation.Nullable Integer limit) { + this.limit = limit; + } + + public QueryActiveOrdersResponse orders( + @jakarta.annotation.Nullable List<@Valid QueryActiveOrdersResponseOrdersInner> orders) { + this.orders = orders; + return this; + } + + public QueryActiveOrdersResponse addOrdersItem( + QueryActiveOrdersResponseOrdersInner ordersItem) { + if (this.orders == null) { + this.orders = new ArrayList<>(); + } + this.orders.add(ordersItem); + return this; + } + + /** + * Get orders + * + * @return orders + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid QueryActiveOrdersResponseOrdersInner> getOrders() { + return orders; + } + + public void setOrders( + @jakarta.annotation.Nullable List<@Valid QueryActiveOrdersResponseOrdersInner> orders) { + this.orders = orders; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + QueryActiveOrdersResponse queryActiveOrdersResponse = (QueryActiveOrdersResponse) o; + return Objects.equals(this.total, queryActiveOrdersResponse.total) + && Objects.equals(this.offset, queryActiveOrdersResponse.offset) + && Objects.equals(this.limit, queryActiveOrdersResponse.limit) + && Objects.equals(this.orders, queryActiveOrdersResponse.orders); + } + + @Override + public int hashCode() { + return Objects.hash(total, offset, limit, orders); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class QueryActiveOrdersResponse {\n"); + sb.append(" total: ").append(toIndentedString(total)).append("\n"); + sb.append(" offset: ").append(toIndentedString(offset)).append("\n"); + sb.append(" limit: ").append(toIndentedString(limit)).append("\n"); + sb.append(" orders: ").append(toIndentedString(orders)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object totalValue = getTotal(); + String totalValueAsString = ""; + totalValueAsString = totalValue.toString(); + sb.append("total=").append(urlEncode(totalValueAsString)).append(""); + Object offsetValue = getOffset(); + String offsetValueAsString = ""; + offsetValueAsString = offsetValue.toString(); + sb.append("offset=").append(urlEncode(offsetValueAsString)).append(""); + Object limitValue = getLimit(); + String limitValueAsString = ""; + limitValueAsString = limitValue.toString(); + sb.append("limit=").append(urlEncode(limitValueAsString)).append(""); + Object ordersValue = getOrders(); + String ordersValueAsString = ""; + ordersValueAsString = + (String) + ((Collection) ordersValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("orders=").append(urlEncode(ordersValueAsString)).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("total"); + openapiFields.add("offset"); + openapiFields.add("limit"); + openapiFields.add("orders"); + + // 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 QueryActiveOrdersResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!QueryActiveOrdersResponse.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in QueryActiveOrdersResponse is not found" + + " in the empty JSON string", + QueryActiveOrdersResponse.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("orders") != null && !jsonObj.get("orders").isJsonNull()) { + JsonArray jsonArrayorders = jsonObj.getAsJsonArray("orders"); + if (jsonArrayorders != null) { + // ensure the json data is an array + if (!jsonObj.get("orders").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `orders` to be an array in the JSON string" + + " but got `%s`", + jsonObj.get("orders").toString())); + } + + // validate the optional field `orders` (array) + for (int i = 0; i < jsonArrayorders.size(); i++) { + QueryActiveOrdersResponseOrdersInner.validateJsonElement( + jsonArrayorders.get(i)); + } + ; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!QueryActiveOrdersResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'QueryActiveOrdersResponse' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(QueryActiveOrdersResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, QueryActiveOrdersResponse value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public QueryActiveOrdersResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of QueryActiveOrdersResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of QueryActiveOrdersResponse + * @throws IOException if the JSON string is invalid with respect to QueryActiveOrdersResponse + */ + public static QueryActiveOrdersResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, QueryActiveOrdersResponse.class); + } + + /** + * Convert an instance of QueryActiveOrdersResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryActiveOrdersResponseOrdersInner.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryActiveOrdersResponseOrdersInner.java new file mode 100644 index 000000000..21961ed94 --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryActiveOrdersResponseOrdersInner.java @@ -0,0 +1,1119 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.model; + +import com.binance.connector.client.w3w_prediction.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.*; + +/** QueryActiveOrdersResponseOrdersInner */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class QueryActiveOrdersResponseOrdersInner { + public static final String SERIALIZED_NAME_ORDER_ID = "orderId"; + + @SerializedName(SERIALIZED_NAME_ORDER_ID) + @jakarta.annotation.Nullable + private String orderId; + + public static final String SERIALIZED_NAME_VENDOR_ORDER_ID = "vendorOrderId"; + + @SerializedName(SERIALIZED_NAME_VENDOR_ORDER_ID) + @jakarta.annotation.Nullable + private String vendorOrderId; + + public static final String SERIALIZED_NAME_VENDOR = "vendor"; + + @SerializedName(SERIALIZED_NAME_VENDOR) + @jakarta.annotation.Nullable + private String vendor; + + public static final String SERIALIZED_NAME_MARKET_TOPIC_ID = "marketTopicId"; + + @SerializedName(SERIALIZED_NAME_MARKET_TOPIC_ID) + @jakarta.annotation.Nullable + private Long marketTopicId; + + public static final String SERIALIZED_NAME_SLUG = "slug"; + + @SerializedName(SERIALIZED_NAME_SLUG) + @jakarta.annotation.Nullable + private String slug; + + public static final String SERIALIZED_NAME_MARKET_TOPIC_TITLE = "marketTopicTitle"; + + @SerializedName(SERIALIZED_NAME_MARKET_TOPIC_TITLE) + @jakarta.annotation.Nullable + private String marketTopicTitle; + + public static final String SERIALIZED_NAME_MARKET_ID = "marketId"; + + @SerializedName(SERIALIZED_NAME_MARKET_ID) + @jakarta.annotation.Nullable + private Long marketId; + + public static final String SERIALIZED_NAME_MARKET_TITLE = "marketTitle"; + + @SerializedName(SERIALIZED_NAME_MARKET_TITLE) + @jakarta.annotation.Nullable + private String marketTitle; + + public static final String SERIALIZED_NAME_OUTCOME = "outcome"; + + @SerializedName(SERIALIZED_NAME_OUTCOME) + @jakarta.annotation.Nullable + private String outcome; + + public static final String SERIALIZED_NAME_OUTCOME_INDEX = "outcomeIndex"; + + @SerializedName(SERIALIZED_NAME_OUTCOME_INDEX) + @jakarta.annotation.Nullable + private Integer outcomeIndex; + + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + @jakarta.annotation.Nullable + private String status; + + public static final String SERIALIZED_NAME_SIDE = "side"; + + @SerializedName(SERIALIZED_NAME_SIDE) + @jakarta.annotation.Nullable + private String side; + + public static final String SERIALIZED_NAME_ORDER_TYPE = "orderType"; + + @SerializedName(SERIALIZED_NAME_ORDER_TYPE) + @jakarta.annotation.Nullable + private String orderType; + + public static final String SERIALIZED_NAME_CREATE_TIME = "createTime"; + + @SerializedName(SERIALIZED_NAME_CREATE_TIME) + @jakarta.annotation.Nullable + private Long createTime; + + public static final String SERIALIZED_NAME_MODIFY_TIME = "modifyTime"; + + @SerializedName(SERIALIZED_NAME_MODIFY_TIME) + @jakarta.annotation.Nullable + private Long modifyTime; + + public static final String SERIALIZED_NAME_MAKER_USDT_AMOUNT = "makerUsdtAmount"; + + @SerializedName(SERIALIZED_NAME_MAKER_USDT_AMOUNT) + @jakarta.annotation.Nullable + private String makerUsdtAmount; + + public static final String SERIALIZED_NAME_MAKER_SHARE_QTY = "makerShareQty"; + + @SerializedName(SERIALIZED_NAME_MAKER_SHARE_QTY) + @jakarta.annotation.Nullable + private String makerShareQty; + + public static final String SERIALIZED_NAME_FILLED_USDT_AMOUNT = "filledUsdtAmount"; + + @SerializedName(SERIALIZED_NAME_FILLED_USDT_AMOUNT) + @jakarta.annotation.Nullable + private String filledUsdtAmount; + + public static final String SERIALIZED_NAME_FILLED_SHARE_QTY = "filledShareQty"; + + @SerializedName(SERIALIZED_NAME_FILLED_SHARE_QTY) + @jakarta.annotation.Nullable + private String filledShareQty; + + public static final String SERIALIZED_NAME_FILL_PERCENTAGE = "fillPercentage"; + + @SerializedName(SERIALIZED_NAME_FILL_PERCENTAGE) + @jakarta.annotation.Nullable + private String fillPercentage; + + public static final String SERIALIZED_NAME_PRICE = "price"; + + @SerializedName(SERIALIZED_NAME_PRICE) + @jakarta.annotation.Nullable + private String price; + + public static final String SERIALIZED_NAME_MARKET_PROVIDER_FEE = "marketProviderFee"; + + @SerializedName(SERIALIZED_NAME_MARKET_PROVIDER_FEE) + @jakarta.annotation.Nullable + private String marketProviderFee; + + public static final String SERIALIZED_NAME_NETWORK_FEE = "networkFee"; + + @SerializedName(SERIALIZED_NAME_NETWORK_FEE) + @jakarta.annotation.Nullable + private String networkFee; + + public QueryActiveOrdersResponseOrdersInner() {} + + public QueryActiveOrdersResponseOrdersInner orderId( + @jakarta.annotation.Nullable String orderId) { + this.orderId = orderId; + return this; + } + + /** + * Get orderId + * + * @return orderId + */ + @jakarta.annotation.Nullable + public String getOrderId() { + return orderId; + } + + public void setOrderId(@jakarta.annotation.Nullable String orderId) { + this.orderId = orderId; + } + + public QueryActiveOrdersResponseOrdersInner vendorOrderId( + @jakarta.annotation.Nullable String vendorOrderId) { + this.vendorOrderId = vendorOrderId; + return this; + } + + /** + * Get vendorOrderId + * + * @return vendorOrderId + */ + @jakarta.annotation.Nullable + public String getVendorOrderId() { + return vendorOrderId; + } + + public void setVendorOrderId(@jakarta.annotation.Nullable String vendorOrderId) { + this.vendorOrderId = vendorOrderId; + } + + public QueryActiveOrdersResponseOrdersInner vendor(@jakarta.annotation.Nullable String vendor) { + this.vendor = vendor; + return this; + } + + /** + * Get vendor + * + * @return vendor + */ + @jakarta.annotation.Nullable + public String getVendor() { + return vendor; + } + + public void setVendor(@jakarta.annotation.Nullable String vendor) { + this.vendor = vendor; + } + + public QueryActiveOrdersResponseOrdersInner marketTopicId( + @jakarta.annotation.Nullable Long marketTopicId) { + this.marketTopicId = marketTopicId; + return this; + } + + /** + * Get marketTopicId + * + * @return marketTopicId + */ + @jakarta.annotation.Nullable + public Long getMarketTopicId() { + return marketTopicId; + } + + public void setMarketTopicId(@jakarta.annotation.Nullable Long marketTopicId) { + this.marketTopicId = marketTopicId; + } + + public QueryActiveOrdersResponseOrdersInner slug(@jakarta.annotation.Nullable String slug) { + this.slug = slug; + return this; + } + + /** + * Get slug + * + * @return slug + */ + @jakarta.annotation.Nullable + public String getSlug() { + return slug; + } + + public void setSlug(@jakarta.annotation.Nullable String slug) { + this.slug = slug; + } + + public QueryActiveOrdersResponseOrdersInner marketTopicTitle( + @jakarta.annotation.Nullable String marketTopicTitle) { + this.marketTopicTitle = marketTopicTitle; + return this; + } + + /** + * Get marketTopicTitle + * + * @return marketTopicTitle + */ + @jakarta.annotation.Nullable + public String getMarketTopicTitle() { + return marketTopicTitle; + } + + public void setMarketTopicTitle(@jakarta.annotation.Nullable String marketTopicTitle) { + this.marketTopicTitle = marketTopicTitle; + } + + public QueryActiveOrdersResponseOrdersInner marketId( + @jakarta.annotation.Nullable Long marketId) { + this.marketId = marketId; + return this; + } + + /** + * Get marketId + * + * @return marketId + */ + @jakarta.annotation.Nullable + public Long getMarketId() { + return marketId; + } + + public void setMarketId(@jakarta.annotation.Nullable Long marketId) { + this.marketId = marketId; + } + + public QueryActiveOrdersResponseOrdersInner marketTitle( + @jakarta.annotation.Nullable String marketTitle) { + this.marketTitle = marketTitle; + return this; + } + + /** + * Get marketTitle + * + * @return marketTitle + */ + @jakarta.annotation.Nullable + public String getMarketTitle() { + return marketTitle; + } + + public void setMarketTitle(@jakarta.annotation.Nullable String marketTitle) { + this.marketTitle = marketTitle; + } + + public QueryActiveOrdersResponseOrdersInner outcome( + @jakarta.annotation.Nullable String outcome) { + this.outcome = outcome; + return this; + } + + /** + * Get outcome + * + * @return outcome + */ + @jakarta.annotation.Nullable + public String getOutcome() { + return outcome; + } + + public void setOutcome(@jakarta.annotation.Nullable String outcome) { + this.outcome = outcome; + } + + public QueryActiveOrdersResponseOrdersInner outcomeIndex( + @jakarta.annotation.Nullable Integer outcomeIndex) { + this.outcomeIndex = outcomeIndex; + return this; + } + + /** + * Get outcomeIndex + * + * @return outcomeIndex + */ + @jakarta.annotation.Nullable + public Integer getOutcomeIndex() { + return outcomeIndex; + } + + public void setOutcomeIndex(@jakarta.annotation.Nullable Integer outcomeIndex) { + this.outcomeIndex = outcomeIndex; + } + + public QueryActiveOrdersResponseOrdersInner 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 QueryActiveOrdersResponseOrdersInner side(@jakarta.annotation.Nullable String side) { + this.side = side; + return this; + } + + /** + * Get side + * + * @return side + */ + @jakarta.annotation.Nullable + public String getSide() { + return side; + } + + public void setSide(@jakarta.annotation.Nullable String side) { + this.side = side; + } + + public QueryActiveOrdersResponseOrdersInner orderType( + @jakarta.annotation.Nullable String orderType) { + this.orderType = orderType; + return this; + } + + /** + * Get orderType + * + * @return orderType + */ + @jakarta.annotation.Nullable + public String getOrderType() { + return orderType; + } + + public void setOrderType(@jakarta.annotation.Nullable String orderType) { + this.orderType = orderType; + } + + public QueryActiveOrdersResponseOrdersInner createTime( + @jakarta.annotation.Nullable Long createTime) { + this.createTime = createTime; + return this; + } + + /** + * Get createTime + * + * @return createTime + */ + @jakarta.annotation.Nullable + public Long getCreateTime() { + return createTime; + } + + public void setCreateTime(@jakarta.annotation.Nullable Long createTime) { + this.createTime = createTime; + } + + public QueryActiveOrdersResponseOrdersInner modifyTime( + @jakarta.annotation.Nullable Long modifyTime) { + this.modifyTime = modifyTime; + return this; + } + + /** + * Get modifyTime + * + * @return modifyTime + */ + @jakarta.annotation.Nullable + public Long getModifyTime() { + return modifyTime; + } + + public void setModifyTime(@jakarta.annotation.Nullable Long modifyTime) { + this.modifyTime = modifyTime; + } + + public QueryActiveOrdersResponseOrdersInner makerUsdtAmount( + @jakarta.annotation.Nullable String makerUsdtAmount) { + this.makerUsdtAmount = makerUsdtAmount; + return this; + } + + /** + * Get makerUsdtAmount + * + * @return makerUsdtAmount + */ + @jakarta.annotation.Nullable + public String getMakerUsdtAmount() { + return makerUsdtAmount; + } + + public void setMakerUsdtAmount(@jakarta.annotation.Nullable String makerUsdtAmount) { + this.makerUsdtAmount = makerUsdtAmount; + } + + public QueryActiveOrdersResponseOrdersInner makerShareQty( + @jakarta.annotation.Nullable String makerShareQty) { + this.makerShareQty = makerShareQty; + return this; + } + + /** + * Get makerShareQty + * + * @return makerShareQty + */ + @jakarta.annotation.Nullable + public String getMakerShareQty() { + return makerShareQty; + } + + public void setMakerShareQty(@jakarta.annotation.Nullable String makerShareQty) { + this.makerShareQty = makerShareQty; + } + + public QueryActiveOrdersResponseOrdersInner filledUsdtAmount( + @jakarta.annotation.Nullable String filledUsdtAmount) { + this.filledUsdtAmount = filledUsdtAmount; + return this; + } + + /** + * Get filledUsdtAmount + * + * @return filledUsdtAmount + */ + @jakarta.annotation.Nullable + public String getFilledUsdtAmount() { + return filledUsdtAmount; + } + + public void setFilledUsdtAmount(@jakarta.annotation.Nullable String filledUsdtAmount) { + this.filledUsdtAmount = filledUsdtAmount; + } + + public QueryActiveOrdersResponseOrdersInner filledShareQty( + @jakarta.annotation.Nullable String filledShareQty) { + this.filledShareQty = filledShareQty; + return this; + } + + /** + * Get filledShareQty + * + * @return filledShareQty + */ + @jakarta.annotation.Nullable + public String getFilledShareQty() { + return filledShareQty; + } + + public void setFilledShareQty(@jakarta.annotation.Nullable String filledShareQty) { + this.filledShareQty = filledShareQty; + } + + public QueryActiveOrdersResponseOrdersInner fillPercentage( + @jakarta.annotation.Nullable String fillPercentage) { + this.fillPercentage = fillPercentage; + return this; + } + + /** + * Get fillPercentage + * + * @return fillPercentage + */ + @jakarta.annotation.Nullable + public String getFillPercentage() { + return fillPercentage; + } + + public void setFillPercentage(@jakarta.annotation.Nullable String fillPercentage) { + this.fillPercentage = fillPercentage; + } + + public QueryActiveOrdersResponseOrdersInner 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 QueryActiveOrdersResponseOrdersInner marketProviderFee( + @jakarta.annotation.Nullable String marketProviderFee) { + this.marketProviderFee = marketProviderFee; + return this; + } + + /** + * Get marketProviderFee + * + * @return marketProviderFee + */ + @jakarta.annotation.Nullable + public String getMarketProviderFee() { + return marketProviderFee; + } + + public void setMarketProviderFee(@jakarta.annotation.Nullable String marketProviderFee) { + this.marketProviderFee = marketProviderFee; + } + + public QueryActiveOrdersResponseOrdersInner networkFee( + @jakarta.annotation.Nullable String networkFee) { + this.networkFee = networkFee; + return this; + } + + /** + * Get networkFee + * + * @return networkFee + */ + @jakarta.annotation.Nullable + public String getNetworkFee() { + return networkFee; + } + + public void setNetworkFee(@jakarta.annotation.Nullable String networkFee) { + this.networkFee = networkFee; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + QueryActiveOrdersResponseOrdersInner queryActiveOrdersResponseOrdersInner = + (QueryActiveOrdersResponseOrdersInner) o; + return Objects.equals(this.orderId, queryActiveOrdersResponseOrdersInner.orderId) + && Objects.equals( + this.vendorOrderId, queryActiveOrdersResponseOrdersInner.vendorOrderId) + && Objects.equals(this.vendor, queryActiveOrdersResponseOrdersInner.vendor) + && Objects.equals( + this.marketTopicId, queryActiveOrdersResponseOrdersInner.marketTopicId) + && Objects.equals(this.slug, queryActiveOrdersResponseOrdersInner.slug) + && Objects.equals( + this.marketTopicTitle, + queryActiveOrdersResponseOrdersInner.marketTopicTitle) + && Objects.equals(this.marketId, queryActiveOrdersResponseOrdersInner.marketId) + && Objects.equals( + this.marketTitle, queryActiveOrdersResponseOrdersInner.marketTitle) + && Objects.equals(this.outcome, queryActiveOrdersResponseOrdersInner.outcome) + && Objects.equals( + this.outcomeIndex, queryActiveOrdersResponseOrdersInner.outcomeIndex) + && Objects.equals(this.status, queryActiveOrdersResponseOrdersInner.status) + && Objects.equals(this.side, queryActiveOrdersResponseOrdersInner.side) + && Objects.equals(this.orderType, queryActiveOrdersResponseOrdersInner.orderType) + && Objects.equals(this.createTime, queryActiveOrdersResponseOrdersInner.createTime) + && Objects.equals(this.modifyTime, queryActiveOrdersResponseOrdersInner.modifyTime) + && Objects.equals( + this.makerUsdtAmount, queryActiveOrdersResponseOrdersInner.makerUsdtAmount) + && Objects.equals( + this.makerShareQty, queryActiveOrdersResponseOrdersInner.makerShareQty) + && Objects.equals( + this.filledUsdtAmount, + queryActiveOrdersResponseOrdersInner.filledUsdtAmount) + && Objects.equals( + this.filledShareQty, queryActiveOrdersResponseOrdersInner.filledShareQty) + && Objects.equals( + this.fillPercentage, queryActiveOrdersResponseOrdersInner.fillPercentage) + && Objects.equals(this.price, queryActiveOrdersResponseOrdersInner.price) + && Objects.equals( + this.marketProviderFee, + queryActiveOrdersResponseOrdersInner.marketProviderFee) + && Objects.equals(this.networkFee, queryActiveOrdersResponseOrdersInner.networkFee); + } + + @Override + public int hashCode() { + return Objects.hash( + orderId, + vendorOrderId, + vendor, + marketTopicId, + slug, + marketTopicTitle, + marketId, + marketTitle, + outcome, + outcomeIndex, + status, + side, + orderType, + createTime, + modifyTime, + makerUsdtAmount, + makerShareQty, + filledUsdtAmount, + filledShareQty, + fillPercentage, + price, + marketProviderFee, + networkFee); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class QueryActiveOrdersResponseOrdersInner {\n"); + sb.append(" orderId: ").append(toIndentedString(orderId)).append("\n"); + sb.append(" vendorOrderId: ").append(toIndentedString(vendorOrderId)).append("\n"); + sb.append(" vendor: ").append(toIndentedString(vendor)).append("\n"); + sb.append(" marketTopicId: ").append(toIndentedString(marketTopicId)).append("\n"); + sb.append(" slug: ").append(toIndentedString(slug)).append("\n"); + sb.append(" marketTopicTitle: ").append(toIndentedString(marketTopicTitle)).append("\n"); + sb.append(" marketId: ").append(toIndentedString(marketId)).append("\n"); + sb.append(" marketTitle: ").append(toIndentedString(marketTitle)).append("\n"); + sb.append(" outcome: ").append(toIndentedString(outcome)).append("\n"); + sb.append(" outcomeIndex: ").append(toIndentedString(outcomeIndex)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" side: ").append(toIndentedString(side)).append("\n"); + sb.append(" orderType: ").append(toIndentedString(orderType)).append("\n"); + sb.append(" createTime: ").append(toIndentedString(createTime)).append("\n"); + sb.append(" modifyTime: ").append(toIndentedString(modifyTime)).append("\n"); + sb.append(" makerUsdtAmount: ").append(toIndentedString(makerUsdtAmount)).append("\n"); + sb.append(" makerShareQty: ").append(toIndentedString(makerShareQty)).append("\n"); + sb.append(" filledUsdtAmount: ").append(toIndentedString(filledUsdtAmount)).append("\n"); + sb.append(" filledShareQty: ").append(toIndentedString(filledShareQty)).append("\n"); + sb.append(" fillPercentage: ").append(toIndentedString(fillPercentage)).append("\n"); + sb.append(" price: ").append(toIndentedString(price)).append("\n"); + sb.append(" marketProviderFee: ").append(toIndentedString(marketProviderFee)).append("\n"); + sb.append(" networkFee: ").append(toIndentedString(networkFee)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object orderIdValue = getOrderId(); + String orderIdValueAsString = ""; + orderIdValueAsString = orderIdValue.toString(); + sb.append("orderId=").append(urlEncode(orderIdValueAsString)).append(""); + Object vendorOrderIdValue = getVendorOrderId(); + String vendorOrderIdValueAsString = ""; + vendorOrderIdValueAsString = vendorOrderIdValue.toString(); + sb.append("vendorOrderId=").append(urlEncode(vendorOrderIdValueAsString)).append(""); + Object vendorValue = getVendor(); + String vendorValueAsString = ""; + vendorValueAsString = vendorValue.toString(); + sb.append("vendor=").append(urlEncode(vendorValueAsString)).append(""); + Object marketTopicIdValue = getMarketTopicId(); + String marketTopicIdValueAsString = ""; + marketTopicIdValueAsString = marketTopicIdValue.toString(); + sb.append("marketTopicId=").append(urlEncode(marketTopicIdValueAsString)).append(""); + Object slugValue = getSlug(); + String slugValueAsString = ""; + slugValueAsString = slugValue.toString(); + sb.append("slug=").append(urlEncode(slugValueAsString)).append(""); + Object marketTopicTitleValue = getMarketTopicTitle(); + String marketTopicTitleValueAsString = ""; + marketTopicTitleValueAsString = marketTopicTitleValue.toString(); + sb.append("marketTopicTitle=").append(urlEncode(marketTopicTitleValueAsString)).append(""); + Object marketIdValue = getMarketId(); + String marketIdValueAsString = ""; + marketIdValueAsString = marketIdValue.toString(); + sb.append("marketId=").append(urlEncode(marketIdValueAsString)).append(""); + Object marketTitleValue = getMarketTitle(); + String marketTitleValueAsString = ""; + marketTitleValueAsString = marketTitleValue.toString(); + sb.append("marketTitle=").append(urlEncode(marketTitleValueAsString)).append(""); + Object outcomeValue = getOutcome(); + String outcomeValueAsString = ""; + outcomeValueAsString = outcomeValue.toString(); + sb.append("outcome=").append(urlEncode(outcomeValueAsString)).append(""); + Object outcomeIndexValue = getOutcomeIndex(); + String outcomeIndexValueAsString = ""; + outcomeIndexValueAsString = outcomeIndexValue.toString(); + sb.append("outcomeIndex=").append(urlEncode(outcomeIndexValueAsString)).append(""); + Object statusValue = getStatus(); + String statusValueAsString = ""; + statusValueAsString = statusValue.toString(); + sb.append("status=").append(urlEncode(statusValueAsString)).append(""); + Object sideValue = getSide(); + String sideValueAsString = ""; + sideValueAsString = sideValue.toString(); + sb.append("side=").append(urlEncode(sideValueAsString)).append(""); + Object orderTypeValue = getOrderType(); + String orderTypeValueAsString = ""; + orderTypeValueAsString = orderTypeValue.toString(); + sb.append("orderType=").append(urlEncode(orderTypeValueAsString)).append(""); + Object createTimeValue = getCreateTime(); + String createTimeValueAsString = ""; + createTimeValueAsString = createTimeValue.toString(); + sb.append("createTime=").append(urlEncode(createTimeValueAsString)).append(""); + Object modifyTimeValue = getModifyTime(); + String modifyTimeValueAsString = ""; + modifyTimeValueAsString = modifyTimeValue.toString(); + sb.append("modifyTime=").append(urlEncode(modifyTimeValueAsString)).append(""); + Object makerUsdtAmountValue = getMakerUsdtAmount(); + String makerUsdtAmountValueAsString = ""; + makerUsdtAmountValueAsString = makerUsdtAmountValue.toString(); + sb.append("makerUsdtAmount=").append(urlEncode(makerUsdtAmountValueAsString)).append(""); + Object makerShareQtyValue = getMakerShareQty(); + String makerShareQtyValueAsString = ""; + makerShareQtyValueAsString = makerShareQtyValue.toString(); + sb.append("makerShareQty=").append(urlEncode(makerShareQtyValueAsString)).append(""); + Object filledUsdtAmountValue = getFilledUsdtAmount(); + String filledUsdtAmountValueAsString = ""; + filledUsdtAmountValueAsString = filledUsdtAmountValue.toString(); + sb.append("filledUsdtAmount=").append(urlEncode(filledUsdtAmountValueAsString)).append(""); + Object filledShareQtyValue = getFilledShareQty(); + String filledShareQtyValueAsString = ""; + filledShareQtyValueAsString = filledShareQtyValue.toString(); + sb.append("filledShareQty=").append(urlEncode(filledShareQtyValueAsString)).append(""); + Object fillPercentageValue = getFillPercentage(); + String fillPercentageValueAsString = ""; + fillPercentageValueAsString = fillPercentageValue.toString(); + sb.append("fillPercentage=").append(urlEncode(fillPercentageValueAsString)).append(""); + Object priceValue = getPrice(); + String priceValueAsString = ""; + priceValueAsString = priceValue.toString(); + sb.append("price=").append(urlEncode(priceValueAsString)).append(""); + Object marketProviderFeeValue = getMarketProviderFee(); + String marketProviderFeeValueAsString = ""; + marketProviderFeeValueAsString = marketProviderFeeValue.toString(); + sb.append("marketProviderFee=") + .append(urlEncode(marketProviderFeeValueAsString)) + .append(""); + Object networkFeeValue = getNetworkFee(); + String networkFeeValueAsString = ""; + networkFeeValueAsString = networkFeeValue.toString(); + sb.append("networkFee=").append(urlEncode(networkFeeValueAsString)).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("orderId"); + openapiFields.add("vendorOrderId"); + openapiFields.add("vendor"); + openapiFields.add("marketTopicId"); + openapiFields.add("slug"); + openapiFields.add("marketTopicTitle"); + openapiFields.add("marketId"); + openapiFields.add("marketTitle"); + openapiFields.add("outcome"); + openapiFields.add("outcomeIndex"); + openapiFields.add("status"); + openapiFields.add("side"); + openapiFields.add("orderType"); + openapiFields.add("createTime"); + openapiFields.add("modifyTime"); + openapiFields.add("makerUsdtAmount"); + openapiFields.add("makerShareQty"); + openapiFields.add("filledUsdtAmount"); + openapiFields.add("filledShareQty"); + openapiFields.add("fillPercentage"); + openapiFields.add("price"); + openapiFields.add("marketProviderFee"); + openapiFields.add("networkFee"); + + // 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 + * QueryActiveOrdersResponseOrdersInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!QueryActiveOrdersResponseOrdersInner.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in QueryActiveOrdersResponseOrdersInner" + + " is not found in the empty JSON string", + QueryActiveOrdersResponseOrdersInner.openapiRequiredFields + .toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("orderId") != null && !jsonObj.get("orderId").isJsonNull()) + && !jsonObj.get("orderId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `orderId` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("orderId").toString())); + } + if ((jsonObj.get("vendorOrderId") != null && !jsonObj.get("vendorOrderId").isJsonNull()) + && !jsonObj.get("vendorOrderId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `vendorOrderId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("vendorOrderId").toString())); + } + if ((jsonObj.get("vendor") != null && !jsonObj.get("vendor").isJsonNull()) + && !jsonObj.get("vendor").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `vendor` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("vendor").toString())); + } + if ((jsonObj.get("slug") != null && !jsonObj.get("slug").isJsonNull()) + && !jsonObj.get("slug").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `slug` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("slug").toString())); + } + if ((jsonObj.get("marketTopicTitle") != null + && !jsonObj.get("marketTopicTitle").isJsonNull()) + && !jsonObj.get("marketTopicTitle").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `marketTopicTitle` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("marketTopicTitle").toString())); + } + if ((jsonObj.get("marketTitle") != null && !jsonObj.get("marketTitle").isJsonNull()) + && !jsonObj.get("marketTitle").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `marketTitle` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("marketTitle").toString())); + } + if ((jsonObj.get("outcome") != null && !jsonObj.get("outcome").isJsonNull()) + && !jsonObj.get("outcome").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `outcome` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("outcome").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("side") != null && !jsonObj.get("side").isJsonNull()) + && !jsonObj.get("side").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `side` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("side").toString())); + } + if ((jsonObj.get("orderType") != null && !jsonObj.get("orderType").isJsonNull()) + && !jsonObj.get("orderType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `orderType` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("orderType").toString())); + } + if ((jsonObj.get("makerUsdtAmount") != null && !jsonObj.get("makerUsdtAmount").isJsonNull()) + && !jsonObj.get("makerUsdtAmount").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `makerUsdtAmount` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("makerUsdtAmount").toString())); + } + if ((jsonObj.get("makerShareQty") != null && !jsonObj.get("makerShareQty").isJsonNull()) + && !jsonObj.get("makerShareQty").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `makerShareQty` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("makerShareQty").toString())); + } + if ((jsonObj.get("filledUsdtAmount") != null + && !jsonObj.get("filledUsdtAmount").isJsonNull()) + && !jsonObj.get("filledUsdtAmount").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `filledUsdtAmount` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("filledUsdtAmount").toString())); + } + if ((jsonObj.get("filledShareQty") != null && !jsonObj.get("filledShareQty").isJsonNull()) + && !jsonObj.get("filledShareQty").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `filledShareQty` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("filledShareQty").toString())); + } + if ((jsonObj.get("fillPercentage") != null && !jsonObj.get("fillPercentage").isJsonNull()) + && !jsonObj.get("fillPercentage").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `fillPercentage` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("fillPercentage").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("marketProviderFee") != null + && !jsonObj.get("marketProviderFee").isJsonNull()) + && !jsonObj.get("marketProviderFee").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `marketProviderFee` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("marketProviderFee").toString())); + } + if ((jsonObj.get("networkFee") != null && !jsonObj.get("networkFee").isJsonNull()) + && !jsonObj.get("networkFee").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `networkFee` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("networkFee").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!QueryActiveOrdersResponseOrdersInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'QueryActiveOrdersResponseOrdersInner' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(QueryActiveOrdersResponseOrdersInner.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, QueryActiveOrdersResponseOrdersInner value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public QueryActiveOrdersResponseOrdersInner read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of QueryActiveOrdersResponseOrdersInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of QueryActiveOrdersResponseOrdersInner + * @throws IOException if the JSON string is invalid with respect to + * QueryActiveOrdersResponseOrdersInner + */ + public static QueryActiveOrdersResponseOrdersInner fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, QueryActiveOrdersResponseOrdersInner.class); + } + + /** + * Convert an instance of QueryActiveOrdersResponseOrdersInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryLastTradePriceResponse.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryLastTradePriceResponse.java new file mode 100644 index 000000000..e8f249f68 --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryLastTradePriceResponse.java @@ -0,0 +1,245 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.model; + +import com.binance.connector.client.w3w_prediction.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.*; + +/** QueryLastTradePriceResponse */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class QueryLastTradePriceResponse { + public static final String SERIALIZED_NAME_MARKET_ID = "marketId"; + + @SerializedName(SERIALIZED_NAME_MARKET_ID) + @jakarta.annotation.Nullable + private Long marketId; + + public static final String SERIALIZED_NAME_LAST_TRADE_PRICE = "lastTradePrice"; + + @SerializedName(SERIALIZED_NAME_LAST_TRADE_PRICE) + @jakarta.annotation.Nullable + private String lastTradePrice; + + public QueryLastTradePriceResponse() {} + + public QueryLastTradePriceResponse marketId(@jakarta.annotation.Nullable Long marketId) { + this.marketId = marketId; + return this; + } + + /** + * Get marketId + * + * @return marketId + */ + @jakarta.annotation.Nullable + public Long getMarketId() { + return marketId; + } + + public void setMarketId(@jakarta.annotation.Nullable Long marketId) { + this.marketId = marketId; + } + + public QueryLastTradePriceResponse lastTradePrice( + @jakarta.annotation.Nullable String lastTradePrice) { + this.lastTradePrice = lastTradePrice; + return this; + } + + /** + * Get lastTradePrice + * + * @return lastTradePrice + */ + @jakarta.annotation.Nullable + public String getLastTradePrice() { + return lastTradePrice; + } + + public void setLastTradePrice(@jakarta.annotation.Nullable String lastTradePrice) { + this.lastTradePrice = lastTradePrice; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + QueryLastTradePriceResponse queryLastTradePriceResponse = (QueryLastTradePriceResponse) o; + return Objects.equals(this.marketId, queryLastTradePriceResponse.marketId) + && Objects.equals(this.lastTradePrice, queryLastTradePriceResponse.lastTradePrice); + } + + @Override + public int hashCode() { + return Objects.hash(marketId, lastTradePrice); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class QueryLastTradePriceResponse {\n"); + sb.append(" marketId: ").append(toIndentedString(marketId)).append("\n"); + sb.append(" lastTradePrice: ").append(toIndentedString(lastTradePrice)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object marketIdValue = getMarketId(); + String marketIdValueAsString = ""; + marketIdValueAsString = marketIdValue.toString(); + sb.append("marketId=").append(urlEncode(marketIdValueAsString)).append(""); + Object lastTradePriceValue = getLastTradePrice(); + String lastTradePriceValueAsString = ""; + lastTradePriceValueAsString = lastTradePriceValue.toString(); + sb.append("lastTradePrice=").append(urlEncode(lastTradePriceValueAsString)).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("marketId"); + openapiFields.add("lastTradePrice"); + + // 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 + * QueryLastTradePriceResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!QueryLastTradePriceResponse.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in QueryLastTradePriceResponse is not" + + " found in the empty JSON string", + QueryLastTradePriceResponse.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("lastTradePrice") != null && !jsonObj.get("lastTradePrice").isJsonNull()) + && !jsonObj.get("lastTradePrice").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `lastTradePrice` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("lastTradePrice").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!QueryLastTradePriceResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'QueryLastTradePriceResponse' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(QueryLastTradePriceResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, QueryLastTradePriceResponse value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public QueryLastTradePriceResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of QueryLastTradePriceResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of QueryLastTradePriceResponse + * @throws IOException if the JSON string is invalid with respect to QueryLastTradePriceResponse + */ + public static QueryLastTradePriceResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, QueryLastTradePriceResponse.class); + } + + /** + * Convert an instance of QueryLastTradePriceResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryOrderBookResponse.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryOrderBookResponse.java new file mode 100644 index 000000000..9fd5815d0 --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryOrderBookResponse.java @@ -0,0 +1,418 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.model; + +import com.binance.connector.client.w3w_prediction.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.*; + +/** QueryOrderBookResponse */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class QueryOrderBookResponse { + public static final String SERIALIZED_NAME_OUTCOME = "outcome"; + + @SerializedName(SERIALIZED_NAME_OUTCOME) + @jakarta.annotation.Nullable + private String outcome; + + 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_TIMESTAMP = "timestamp"; + + @SerializedName(SERIALIZED_NAME_TIMESTAMP) + @jakarta.annotation.Nullable + private Long timestamp; + + public static final String SERIALIZED_NAME_BIDS = "bids"; + + @SerializedName(SERIALIZED_NAME_BIDS) + @jakarta.annotation.Nullable + private List<@Valid QueryOrderBookResponseBidsInner> bids; + + public static final String SERIALIZED_NAME_ASKS = "asks"; + + @SerializedName(SERIALIZED_NAME_ASKS) + @jakarta.annotation.Nullable + private List<@Valid QueryOrderBookResponseAsksInner> asks; + + public QueryOrderBookResponse() {} + + public QueryOrderBookResponse outcome(@jakarta.annotation.Nullable String outcome) { + this.outcome = outcome; + return this; + } + + /** + * Get outcome + * + * @return outcome + */ + @jakarta.annotation.Nullable + public String getOutcome() { + return outcome; + } + + public void setOutcome(@jakarta.annotation.Nullable String outcome) { + this.outcome = outcome; + } + + public QueryOrderBookResponse 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 QueryOrderBookResponse timestamp(@jakarta.annotation.Nullable Long timestamp) { + this.timestamp = timestamp; + return this; + } + + /** + * Get timestamp + * + * @return timestamp + */ + @jakarta.annotation.Nullable + public Long getTimestamp() { + return timestamp; + } + + public void setTimestamp(@jakarta.annotation.Nullable Long timestamp) { + this.timestamp = timestamp; + } + + public QueryOrderBookResponse bids( + @jakarta.annotation.Nullable List<@Valid QueryOrderBookResponseBidsInner> bids) { + this.bids = bids; + return this; + } + + public QueryOrderBookResponse addBidsItem(QueryOrderBookResponseBidsInner bidsItem) { + if (this.bids == null) { + this.bids = new ArrayList<>(); + } + this.bids.add(bidsItem); + return this; + } + + /** + * Get bids + * + * @return bids + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid QueryOrderBookResponseBidsInner> getBids() { + return bids; + } + + public void setBids( + @jakarta.annotation.Nullable List<@Valid QueryOrderBookResponseBidsInner> bids) { + this.bids = bids; + } + + public QueryOrderBookResponse asks( + @jakarta.annotation.Nullable List<@Valid QueryOrderBookResponseAsksInner> asks) { + this.asks = asks; + return this; + } + + public QueryOrderBookResponse addAsksItem(QueryOrderBookResponseAsksInner asksItem) { + if (this.asks == null) { + this.asks = new ArrayList<>(); + } + this.asks.add(asksItem); + return this; + } + + /** + * Get asks + * + * @return asks + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid QueryOrderBookResponseAsksInner> getAsks() { + return asks; + } + + public void setAsks( + @jakarta.annotation.Nullable List<@Valid QueryOrderBookResponseAsksInner> asks) { + this.asks = asks; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + QueryOrderBookResponse queryOrderBookResponse = (QueryOrderBookResponse) o; + return Objects.equals(this.outcome, queryOrderBookResponse.outcome) + && Objects.equals(this.tokenId, queryOrderBookResponse.tokenId) + && Objects.equals(this.timestamp, queryOrderBookResponse.timestamp) + && Objects.equals(this.bids, queryOrderBookResponse.bids) + && Objects.equals(this.asks, queryOrderBookResponse.asks); + } + + @Override + public int hashCode() { + return Objects.hash(outcome, tokenId, timestamp, bids, asks); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class QueryOrderBookResponse {\n"); + sb.append(" outcome: ").append(toIndentedString(outcome)).append("\n"); + sb.append(" tokenId: ").append(toIndentedString(tokenId)).append("\n"); + sb.append(" timestamp: ").append(toIndentedString(timestamp)).append("\n"); + sb.append(" bids: ").append(toIndentedString(bids)).append("\n"); + sb.append(" asks: ").append(toIndentedString(asks)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object outcomeValue = getOutcome(); + String outcomeValueAsString = ""; + outcomeValueAsString = outcomeValue.toString(); + sb.append("outcome=").append(urlEncode(outcomeValueAsString)).append(""); + Object tokenIdValue = getTokenId(); + String tokenIdValueAsString = ""; + tokenIdValueAsString = tokenIdValue.toString(); + sb.append("tokenId=").append(urlEncode(tokenIdValueAsString)).append(""); + Object timestampValue = getTimestamp(); + String timestampValueAsString = ""; + timestampValueAsString = timestampValue.toString(); + sb.append("timestamp=").append(urlEncode(timestampValueAsString)).append(""); + Object bidsValue = getBids(); + String bidsValueAsString = ""; + bidsValueAsString = + (String) + ((Collection) bidsValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("bids=").append(urlEncode(bidsValueAsString)).append(""); + Object asksValue = getAsks(); + String asksValueAsString = ""; + asksValueAsString = + (String) + ((Collection) asksValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("asks=").append(urlEncode(asksValueAsString)).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("outcome"); + openapiFields.add("tokenId"); + openapiFields.add("timestamp"); + openapiFields.add("bids"); + openapiFields.add("asks"); + + // 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 QueryOrderBookResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!QueryOrderBookResponse.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in QueryOrderBookResponse is not found in" + + " the empty JSON string", + QueryOrderBookResponse.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("outcome") != null && !jsonObj.get("outcome").isJsonNull()) + && !jsonObj.get("outcome").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `outcome` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("outcome").toString())); + } + if ((jsonObj.get("tokenId") != null && !jsonObj.get("tokenId").isJsonNull()) + && !jsonObj.get("tokenId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `tokenId` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("tokenId").toString())); + } + if (jsonObj.get("bids") != null && !jsonObj.get("bids").isJsonNull()) { + JsonArray jsonArraybids = jsonObj.getAsJsonArray("bids"); + if (jsonArraybids != null) { + // ensure the json data is an array + if (!jsonObj.get("bids").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `bids` to be an array in the JSON string" + + " but got `%s`", + jsonObj.get("bids").toString())); + } + + // validate the optional field `bids` (array) + for (int i = 0; i < jsonArraybids.size(); i++) { + QueryOrderBookResponseBidsInner.validateJsonElement(jsonArraybids.get(i)); + } + ; + } + } + if (jsonObj.get("asks") != null && !jsonObj.get("asks").isJsonNull()) { + JsonArray jsonArrayasks = jsonObj.getAsJsonArray("asks"); + if (jsonArrayasks != null) { + // ensure the json data is an array + if (!jsonObj.get("asks").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `asks` to be an array in the JSON string" + + " but got `%s`", + jsonObj.get("asks").toString())); + } + + // validate the optional field `asks` (array) + for (int i = 0; i < jsonArrayasks.size(); i++) { + QueryOrderBookResponseAsksInner.validateJsonElement(jsonArrayasks.get(i)); + } + ; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!QueryOrderBookResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'QueryOrderBookResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(QueryOrderBookResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, QueryOrderBookResponse value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public QueryOrderBookResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of QueryOrderBookResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of QueryOrderBookResponse + * @throws IOException if the JSON string is invalid with respect to QueryOrderBookResponse + */ + public static QueryOrderBookResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, QueryOrderBookResponse.class); + } + + /** + * Convert an instance of QueryOrderBookResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryOrderBookResponseAsksInner.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryOrderBookResponseAsksInner.java new file mode 100644 index 000000000..6738e0b48 --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryOrderBookResponseAsksInner.java @@ -0,0 +1,256 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.model; + +import com.binance.connector.client.w3w_prediction.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.*; + +/** QueryOrderBookResponseAsksInner */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class QueryOrderBookResponseAsksInner { + public static final String SERIALIZED_NAME_PRICE = "price"; + + @SerializedName(SERIALIZED_NAME_PRICE) + @jakarta.annotation.Nullable + private String price; + + public static final String SERIALIZED_NAME_SIZE = "size"; + + @SerializedName(SERIALIZED_NAME_SIZE) + @jakarta.annotation.Nullable + private String size; + + public QueryOrderBookResponseAsksInner() {} + + public QueryOrderBookResponseAsksInner 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 QueryOrderBookResponseAsksInner size(@jakarta.annotation.Nullable String size) { + this.size = size; + return this; + } + + /** + * Get size + * + * @return size + */ + @jakarta.annotation.Nullable + public String getSize() { + return size; + } + + public void setSize(@jakarta.annotation.Nullable String size) { + this.size = size; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + QueryOrderBookResponseAsksInner queryOrderBookResponseAsksInner = + (QueryOrderBookResponseAsksInner) o; + return Objects.equals(this.price, queryOrderBookResponseAsksInner.price) + && Objects.equals(this.size, queryOrderBookResponseAsksInner.size); + } + + @Override + public int hashCode() { + return Objects.hash(price, size); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class QueryOrderBookResponseAsksInner {\n"); + sb.append(" price: ").append(toIndentedString(price)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object priceValue = getPrice(); + String priceValueAsString = ""; + priceValueAsString = priceValue.toString(); + sb.append("price=").append(urlEncode(priceValueAsString)).append(""); + Object sizeValue = getSize(); + String sizeValueAsString = ""; + sizeValueAsString = sizeValue.toString(); + sb.append("size=").append(urlEncode(sizeValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("price"); + openapiFields.add("size"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * QueryOrderBookResponseAsksInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!QueryOrderBookResponseAsksInner.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in QueryOrderBookResponseAsksInner is not" + + " found in the empty JSON string", + QueryOrderBookResponseAsksInner.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + 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("size") != null && !jsonObj.get("size").isJsonNull()) + && !jsonObj.get("size").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `size` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("size").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!QueryOrderBookResponseAsksInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'QueryOrderBookResponseAsksInner' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(QueryOrderBookResponseAsksInner.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, QueryOrderBookResponseAsksInner value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public QueryOrderBookResponseAsksInner read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of QueryOrderBookResponseAsksInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of QueryOrderBookResponseAsksInner + * @throws IOException if the JSON string is invalid with respect to + * QueryOrderBookResponseAsksInner + */ + public static QueryOrderBookResponseAsksInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, QueryOrderBookResponseAsksInner.class); + } + + /** + * Convert an instance of QueryOrderBookResponseAsksInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryOrderBookResponseBidsInner.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryOrderBookResponseBidsInner.java new file mode 100644 index 000000000..ea5b8e907 --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryOrderBookResponseBidsInner.java @@ -0,0 +1,256 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.model; + +import com.binance.connector.client.w3w_prediction.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.*; + +/** QueryOrderBookResponseBidsInner */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class QueryOrderBookResponseBidsInner { + public static final String SERIALIZED_NAME_PRICE = "price"; + + @SerializedName(SERIALIZED_NAME_PRICE) + @jakarta.annotation.Nullable + private String price; + + public static final String SERIALIZED_NAME_SIZE = "size"; + + @SerializedName(SERIALIZED_NAME_SIZE) + @jakarta.annotation.Nullable + private String size; + + public QueryOrderBookResponseBidsInner() {} + + public QueryOrderBookResponseBidsInner 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 QueryOrderBookResponseBidsInner size(@jakarta.annotation.Nullable String size) { + this.size = size; + return this; + } + + /** + * Get size + * + * @return size + */ + @jakarta.annotation.Nullable + public String getSize() { + return size; + } + + public void setSize(@jakarta.annotation.Nullable String size) { + this.size = size; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + QueryOrderBookResponseBidsInner queryOrderBookResponseBidsInner = + (QueryOrderBookResponseBidsInner) o; + return Objects.equals(this.price, queryOrderBookResponseBidsInner.price) + && Objects.equals(this.size, queryOrderBookResponseBidsInner.size); + } + + @Override + public int hashCode() { + return Objects.hash(price, size); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class QueryOrderBookResponseBidsInner {\n"); + sb.append(" price: ").append(toIndentedString(price)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object priceValue = getPrice(); + String priceValueAsString = ""; + priceValueAsString = priceValue.toString(); + sb.append("price=").append(urlEncode(priceValueAsString)).append(""); + Object sizeValue = getSize(); + String sizeValueAsString = ""; + sizeValueAsString = sizeValue.toString(); + sb.append("size=").append(urlEncode(sizeValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("price"); + openapiFields.add("size"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * QueryOrderBookResponseBidsInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!QueryOrderBookResponseBidsInner.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in QueryOrderBookResponseBidsInner is not" + + " found in the empty JSON string", + QueryOrderBookResponseBidsInner.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + 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("size") != null && !jsonObj.get("size").isJsonNull()) + && !jsonObj.get("size").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `size` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("size").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!QueryOrderBookResponseBidsInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'QueryOrderBookResponseBidsInner' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(QueryOrderBookResponseBidsInner.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, QueryOrderBookResponseBidsInner value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public QueryOrderBookResponseBidsInner read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of QueryOrderBookResponseBidsInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of QueryOrderBookResponseBidsInner + * @throws IOException if the JSON string is invalid with respect to + * QueryOrderBookResponseBidsInner + */ + public static QueryOrderBookResponseBidsInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, QueryOrderBookResponseBidsInner.class); + } + + /** + * Convert an instance of QueryOrderBookResponseBidsInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryOrderHistoryResponse.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryOrderHistoryResponse.java new file mode 100644 index 000000000..f082c8c70 --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryOrderHistoryResponse.java @@ -0,0 +1,340 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.model; + +import com.binance.connector.client.w3w_prediction.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.*; + +/** QueryOrderHistoryResponse */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class QueryOrderHistoryResponse { + public static final String SERIALIZED_NAME_TOTAL = "total"; + + @SerializedName(SERIALIZED_NAME_TOTAL) + @jakarta.annotation.Nullable + private Integer total; + + public static final String SERIALIZED_NAME_OFFSET = "offset"; + + @SerializedName(SERIALIZED_NAME_OFFSET) + @jakarta.annotation.Nullable + private Integer offset; + + public static final String SERIALIZED_NAME_LIMIT = "limit"; + + @SerializedName(SERIALIZED_NAME_LIMIT) + @jakarta.annotation.Nullable + private Integer limit; + + public static final String SERIALIZED_NAME_ORDERS = "orders"; + + @SerializedName(SERIALIZED_NAME_ORDERS) + @jakarta.annotation.Nullable + private List<@Valid QueryOrderHistoryResponseOrdersInner> orders; + + public QueryOrderHistoryResponse() {} + + public QueryOrderHistoryResponse total(@jakarta.annotation.Nullable Integer total) { + this.total = total; + return this; + } + + /** + * Get total + * + * @return total + */ + @jakarta.annotation.Nullable + public Integer getTotal() { + return total; + } + + public void setTotal(@jakarta.annotation.Nullable Integer total) { + this.total = total; + } + + public QueryOrderHistoryResponse offset(@jakarta.annotation.Nullable Integer offset) { + this.offset = offset; + return this; + } + + /** + * Get offset + * + * @return offset + */ + @jakarta.annotation.Nullable + public Integer getOffset() { + return offset; + } + + public void setOffset(@jakarta.annotation.Nullable Integer offset) { + this.offset = offset; + } + + public QueryOrderHistoryResponse limit(@jakarta.annotation.Nullable Integer limit) { + this.limit = limit; + return this; + } + + /** + * Get limit + * + * @return limit + */ + @jakarta.annotation.Nullable + public Integer getLimit() { + return limit; + } + + public void setLimit(@jakarta.annotation.Nullable Integer limit) { + this.limit = limit; + } + + public QueryOrderHistoryResponse orders( + @jakarta.annotation.Nullable List<@Valid QueryOrderHistoryResponseOrdersInner> orders) { + this.orders = orders; + return this; + } + + public QueryOrderHistoryResponse addOrdersItem( + QueryOrderHistoryResponseOrdersInner ordersItem) { + if (this.orders == null) { + this.orders = new ArrayList<>(); + } + this.orders.add(ordersItem); + return this; + } + + /** + * Get orders + * + * @return orders + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid QueryOrderHistoryResponseOrdersInner> getOrders() { + return orders; + } + + public void setOrders( + @jakarta.annotation.Nullable List<@Valid QueryOrderHistoryResponseOrdersInner> orders) { + this.orders = orders; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + QueryOrderHistoryResponse queryOrderHistoryResponse = (QueryOrderHistoryResponse) o; + return Objects.equals(this.total, queryOrderHistoryResponse.total) + && Objects.equals(this.offset, queryOrderHistoryResponse.offset) + && Objects.equals(this.limit, queryOrderHistoryResponse.limit) + && Objects.equals(this.orders, queryOrderHistoryResponse.orders); + } + + @Override + public int hashCode() { + return Objects.hash(total, offset, limit, orders); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class QueryOrderHistoryResponse {\n"); + sb.append(" total: ").append(toIndentedString(total)).append("\n"); + sb.append(" offset: ").append(toIndentedString(offset)).append("\n"); + sb.append(" limit: ").append(toIndentedString(limit)).append("\n"); + sb.append(" orders: ").append(toIndentedString(orders)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object totalValue = getTotal(); + String totalValueAsString = ""; + totalValueAsString = totalValue.toString(); + sb.append("total=").append(urlEncode(totalValueAsString)).append(""); + Object offsetValue = getOffset(); + String offsetValueAsString = ""; + offsetValueAsString = offsetValue.toString(); + sb.append("offset=").append(urlEncode(offsetValueAsString)).append(""); + Object limitValue = getLimit(); + String limitValueAsString = ""; + limitValueAsString = limitValue.toString(); + sb.append("limit=").append(urlEncode(limitValueAsString)).append(""); + Object ordersValue = getOrders(); + String ordersValueAsString = ""; + ordersValueAsString = + (String) + ((Collection) ordersValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("orders=").append(urlEncode(ordersValueAsString)).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("total"); + openapiFields.add("offset"); + openapiFields.add("limit"); + openapiFields.add("orders"); + + // 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 QueryOrderHistoryResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!QueryOrderHistoryResponse.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in QueryOrderHistoryResponse is not found" + + " in the empty JSON string", + QueryOrderHistoryResponse.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("orders") != null && !jsonObj.get("orders").isJsonNull()) { + JsonArray jsonArrayorders = jsonObj.getAsJsonArray("orders"); + if (jsonArrayorders != null) { + // ensure the json data is an array + if (!jsonObj.get("orders").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `orders` to be an array in the JSON string" + + " but got `%s`", + jsonObj.get("orders").toString())); + } + + // validate the optional field `orders` (array) + for (int i = 0; i < jsonArrayorders.size(); i++) { + QueryOrderHistoryResponseOrdersInner.validateJsonElement( + jsonArrayorders.get(i)); + } + ; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!QueryOrderHistoryResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'QueryOrderHistoryResponse' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(QueryOrderHistoryResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, QueryOrderHistoryResponse value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public QueryOrderHistoryResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of QueryOrderHistoryResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of QueryOrderHistoryResponse + * @throws IOException if the JSON string is invalid with respect to QueryOrderHistoryResponse + */ + public static QueryOrderHistoryResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, QueryOrderHistoryResponse.class); + } + + /** + * Convert an instance of QueryOrderHistoryResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryOrderHistoryResponseOrdersInner.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryOrderHistoryResponseOrdersInner.java new file mode 100644 index 000000000..dc24d1af9 --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryOrderHistoryResponseOrdersInner.java @@ -0,0 +1,1154 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.model; + +import com.binance.connector.client.w3w_prediction.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.*; + +/** QueryOrderHistoryResponseOrdersInner */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class QueryOrderHistoryResponseOrdersInner { + public static final String SERIALIZED_NAME_ORDER_ID = "orderId"; + + @SerializedName(SERIALIZED_NAME_ORDER_ID) + @jakarta.annotation.Nullable + private String orderId; + + public static final String SERIALIZED_NAME_VENDOR_ORDER_ID = "vendorOrderId"; + + @SerializedName(SERIALIZED_NAME_VENDOR_ORDER_ID) + @jakarta.annotation.Nullable + private String vendorOrderId; + + public static final String SERIALIZED_NAME_VENDOR = "vendor"; + + @SerializedName(SERIALIZED_NAME_VENDOR) + @jakarta.annotation.Nullable + private String vendor; + + public static final String SERIALIZED_NAME_MARKET_TOPIC_ID = "marketTopicId"; + + @SerializedName(SERIALIZED_NAME_MARKET_TOPIC_ID) + @jakarta.annotation.Nullable + private Long marketTopicId; + + public static final String SERIALIZED_NAME_SLUG = "slug"; + + @SerializedName(SERIALIZED_NAME_SLUG) + @jakarta.annotation.Nullable + private String slug; + + public static final String SERIALIZED_NAME_MARKET_TOPIC_TITLE = "marketTopicTitle"; + + @SerializedName(SERIALIZED_NAME_MARKET_TOPIC_TITLE) + @jakarta.annotation.Nullable + private String marketTopicTitle; + + public static final String SERIALIZED_NAME_MARKET_ID = "marketId"; + + @SerializedName(SERIALIZED_NAME_MARKET_ID) + @jakarta.annotation.Nullable + private Long marketId; + + public static final String SERIALIZED_NAME_MARKET_TITLE = "marketTitle"; + + @SerializedName(SERIALIZED_NAME_MARKET_TITLE) + @jakarta.annotation.Nullable + private String marketTitle; + + public static final String SERIALIZED_NAME_OUTCOME = "outcome"; + + @SerializedName(SERIALIZED_NAME_OUTCOME) + @jakarta.annotation.Nullable + private String outcome; + + public static final String SERIALIZED_NAME_OUTCOME_INDEX = "outcomeIndex"; + + @SerializedName(SERIALIZED_NAME_OUTCOME_INDEX) + @jakarta.annotation.Nullable + private Integer outcomeIndex; + + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + @jakarta.annotation.Nullable + private String status; + + public static final String SERIALIZED_NAME_SIDE = "side"; + + @SerializedName(SERIALIZED_NAME_SIDE) + @jakarta.annotation.Nullable + private String side; + + public static final String SERIALIZED_NAME_ORDER_TYPE = "orderType"; + + @SerializedName(SERIALIZED_NAME_ORDER_TYPE) + @jakarta.annotation.Nullable + private String orderType; + + public static final String SERIALIZED_NAME_CREATE_TIME = "createTime"; + + @SerializedName(SERIALIZED_NAME_CREATE_TIME) + @jakarta.annotation.Nullable + private Long createTime; + + public static final String SERIALIZED_NAME_MODIFY_TIME = "modifyTime"; + + @SerializedName(SERIALIZED_NAME_MODIFY_TIME) + @jakarta.annotation.Nullable + private Long modifyTime; + + public static final String SERIALIZED_NAME_TERMINAL_TIME = "terminalTime"; + + @SerializedName(SERIALIZED_NAME_TERMINAL_TIME) + @jakarta.annotation.Nullable + private Long terminalTime; + + public static final String SERIALIZED_NAME_MAKER_USDT_AMOUNT = "makerUsdtAmount"; + + @SerializedName(SERIALIZED_NAME_MAKER_USDT_AMOUNT) + @jakarta.annotation.Nullable + private String makerUsdtAmount; + + public static final String SERIALIZED_NAME_MAKER_SHARE_QTY = "makerShareQty"; + + @SerializedName(SERIALIZED_NAME_MAKER_SHARE_QTY) + @jakarta.annotation.Nullable + private String makerShareQty; + + public static final String SERIALIZED_NAME_FILLED_USDT_AMOUNT = "filledUsdtAmount"; + + @SerializedName(SERIALIZED_NAME_FILLED_USDT_AMOUNT) + @jakarta.annotation.Nullable + private String filledUsdtAmount; + + public static final String SERIALIZED_NAME_FILLED_SHARE_QTY = "filledShareQty"; + + @SerializedName(SERIALIZED_NAME_FILLED_SHARE_QTY) + @jakarta.annotation.Nullable + private String filledShareQty; + + public static final String SERIALIZED_NAME_FILL_PERCENTAGE = "fillPercentage"; + + @SerializedName(SERIALIZED_NAME_FILL_PERCENTAGE) + @jakarta.annotation.Nullable + private String fillPercentage; + + public static final String SERIALIZED_NAME_PRICE = "price"; + + @SerializedName(SERIALIZED_NAME_PRICE) + @jakarta.annotation.Nullable + private String price; + + public static final String SERIALIZED_NAME_MARKET_PROVIDER_FEE = "marketProviderFee"; + + @SerializedName(SERIALIZED_NAME_MARKET_PROVIDER_FEE) + @jakarta.annotation.Nullable + private String marketProviderFee; + + public static final String SERIALIZED_NAME_NETWORK_FEE = "networkFee"; + + @SerializedName(SERIALIZED_NAME_NETWORK_FEE) + @jakarta.annotation.Nullable + private String networkFee; + + public QueryOrderHistoryResponseOrdersInner() {} + + public QueryOrderHistoryResponseOrdersInner orderId( + @jakarta.annotation.Nullable String orderId) { + this.orderId = orderId; + return this; + } + + /** + * Get orderId + * + * @return orderId + */ + @jakarta.annotation.Nullable + public String getOrderId() { + return orderId; + } + + public void setOrderId(@jakarta.annotation.Nullable String orderId) { + this.orderId = orderId; + } + + public QueryOrderHistoryResponseOrdersInner vendorOrderId( + @jakarta.annotation.Nullable String vendorOrderId) { + this.vendorOrderId = vendorOrderId; + return this; + } + + /** + * Get vendorOrderId + * + * @return vendorOrderId + */ + @jakarta.annotation.Nullable + public String getVendorOrderId() { + return vendorOrderId; + } + + public void setVendorOrderId(@jakarta.annotation.Nullable String vendorOrderId) { + this.vendorOrderId = vendorOrderId; + } + + public QueryOrderHistoryResponseOrdersInner vendor(@jakarta.annotation.Nullable String vendor) { + this.vendor = vendor; + return this; + } + + /** + * Get vendor + * + * @return vendor + */ + @jakarta.annotation.Nullable + public String getVendor() { + return vendor; + } + + public void setVendor(@jakarta.annotation.Nullable String vendor) { + this.vendor = vendor; + } + + public QueryOrderHistoryResponseOrdersInner marketTopicId( + @jakarta.annotation.Nullable Long marketTopicId) { + this.marketTopicId = marketTopicId; + return this; + } + + /** + * Get marketTopicId + * + * @return marketTopicId + */ + @jakarta.annotation.Nullable + public Long getMarketTopicId() { + return marketTopicId; + } + + public void setMarketTopicId(@jakarta.annotation.Nullable Long marketTopicId) { + this.marketTopicId = marketTopicId; + } + + public QueryOrderHistoryResponseOrdersInner slug(@jakarta.annotation.Nullable String slug) { + this.slug = slug; + return this; + } + + /** + * Get slug + * + * @return slug + */ + @jakarta.annotation.Nullable + public String getSlug() { + return slug; + } + + public void setSlug(@jakarta.annotation.Nullable String slug) { + this.slug = slug; + } + + public QueryOrderHistoryResponseOrdersInner marketTopicTitle( + @jakarta.annotation.Nullable String marketTopicTitle) { + this.marketTopicTitle = marketTopicTitle; + return this; + } + + /** + * Get marketTopicTitle + * + * @return marketTopicTitle + */ + @jakarta.annotation.Nullable + public String getMarketTopicTitle() { + return marketTopicTitle; + } + + public void setMarketTopicTitle(@jakarta.annotation.Nullable String marketTopicTitle) { + this.marketTopicTitle = marketTopicTitle; + } + + public QueryOrderHistoryResponseOrdersInner marketId( + @jakarta.annotation.Nullable Long marketId) { + this.marketId = marketId; + return this; + } + + /** + * Get marketId + * + * @return marketId + */ + @jakarta.annotation.Nullable + public Long getMarketId() { + return marketId; + } + + public void setMarketId(@jakarta.annotation.Nullable Long marketId) { + this.marketId = marketId; + } + + public QueryOrderHistoryResponseOrdersInner marketTitle( + @jakarta.annotation.Nullable String marketTitle) { + this.marketTitle = marketTitle; + return this; + } + + /** + * Get marketTitle + * + * @return marketTitle + */ + @jakarta.annotation.Nullable + public String getMarketTitle() { + return marketTitle; + } + + public void setMarketTitle(@jakarta.annotation.Nullable String marketTitle) { + this.marketTitle = marketTitle; + } + + public QueryOrderHistoryResponseOrdersInner outcome( + @jakarta.annotation.Nullable String outcome) { + this.outcome = outcome; + return this; + } + + /** + * Get outcome + * + * @return outcome + */ + @jakarta.annotation.Nullable + public String getOutcome() { + return outcome; + } + + public void setOutcome(@jakarta.annotation.Nullable String outcome) { + this.outcome = outcome; + } + + public QueryOrderHistoryResponseOrdersInner outcomeIndex( + @jakarta.annotation.Nullable Integer outcomeIndex) { + this.outcomeIndex = outcomeIndex; + return this; + } + + /** + * Get outcomeIndex + * + * @return outcomeIndex + */ + @jakarta.annotation.Nullable + public Integer getOutcomeIndex() { + return outcomeIndex; + } + + public void setOutcomeIndex(@jakarta.annotation.Nullable Integer outcomeIndex) { + this.outcomeIndex = outcomeIndex; + } + + public QueryOrderHistoryResponseOrdersInner 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 QueryOrderHistoryResponseOrdersInner side(@jakarta.annotation.Nullable String side) { + this.side = side; + return this; + } + + /** + * Get side + * + * @return side + */ + @jakarta.annotation.Nullable + public String getSide() { + return side; + } + + public void setSide(@jakarta.annotation.Nullable String side) { + this.side = side; + } + + public QueryOrderHistoryResponseOrdersInner orderType( + @jakarta.annotation.Nullable String orderType) { + this.orderType = orderType; + return this; + } + + /** + * Get orderType + * + * @return orderType + */ + @jakarta.annotation.Nullable + public String getOrderType() { + return orderType; + } + + public void setOrderType(@jakarta.annotation.Nullable String orderType) { + this.orderType = orderType; + } + + public QueryOrderHistoryResponseOrdersInner createTime( + @jakarta.annotation.Nullable Long createTime) { + this.createTime = createTime; + return this; + } + + /** + * Get createTime + * + * @return createTime + */ + @jakarta.annotation.Nullable + public Long getCreateTime() { + return createTime; + } + + public void setCreateTime(@jakarta.annotation.Nullable Long createTime) { + this.createTime = createTime; + } + + public QueryOrderHistoryResponseOrdersInner modifyTime( + @jakarta.annotation.Nullable Long modifyTime) { + this.modifyTime = modifyTime; + return this; + } + + /** + * Get modifyTime + * + * @return modifyTime + */ + @jakarta.annotation.Nullable + public Long getModifyTime() { + return modifyTime; + } + + public void setModifyTime(@jakarta.annotation.Nullable Long modifyTime) { + this.modifyTime = modifyTime; + } + + public QueryOrderHistoryResponseOrdersInner terminalTime( + @jakarta.annotation.Nullable Long terminalTime) { + this.terminalTime = terminalTime; + return this; + } + + /** + * Get terminalTime + * + * @return terminalTime + */ + @jakarta.annotation.Nullable + public Long getTerminalTime() { + return terminalTime; + } + + public void setTerminalTime(@jakarta.annotation.Nullable Long terminalTime) { + this.terminalTime = terminalTime; + } + + public QueryOrderHistoryResponseOrdersInner makerUsdtAmount( + @jakarta.annotation.Nullable String makerUsdtAmount) { + this.makerUsdtAmount = makerUsdtAmount; + return this; + } + + /** + * Get makerUsdtAmount + * + * @return makerUsdtAmount + */ + @jakarta.annotation.Nullable + public String getMakerUsdtAmount() { + return makerUsdtAmount; + } + + public void setMakerUsdtAmount(@jakarta.annotation.Nullable String makerUsdtAmount) { + this.makerUsdtAmount = makerUsdtAmount; + } + + public QueryOrderHistoryResponseOrdersInner makerShareQty( + @jakarta.annotation.Nullable String makerShareQty) { + this.makerShareQty = makerShareQty; + return this; + } + + /** + * Get makerShareQty + * + * @return makerShareQty + */ + @jakarta.annotation.Nullable + public String getMakerShareQty() { + return makerShareQty; + } + + public void setMakerShareQty(@jakarta.annotation.Nullable String makerShareQty) { + this.makerShareQty = makerShareQty; + } + + public QueryOrderHistoryResponseOrdersInner filledUsdtAmount( + @jakarta.annotation.Nullable String filledUsdtAmount) { + this.filledUsdtAmount = filledUsdtAmount; + return this; + } + + /** + * Get filledUsdtAmount + * + * @return filledUsdtAmount + */ + @jakarta.annotation.Nullable + public String getFilledUsdtAmount() { + return filledUsdtAmount; + } + + public void setFilledUsdtAmount(@jakarta.annotation.Nullable String filledUsdtAmount) { + this.filledUsdtAmount = filledUsdtAmount; + } + + public QueryOrderHistoryResponseOrdersInner filledShareQty( + @jakarta.annotation.Nullable String filledShareQty) { + this.filledShareQty = filledShareQty; + return this; + } + + /** + * Get filledShareQty + * + * @return filledShareQty + */ + @jakarta.annotation.Nullable + public String getFilledShareQty() { + return filledShareQty; + } + + public void setFilledShareQty(@jakarta.annotation.Nullable String filledShareQty) { + this.filledShareQty = filledShareQty; + } + + public QueryOrderHistoryResponseOrdersInner fillPercentage( + @jakarta.annotation.Nullable String fillPercentage) { + this.fillPercentage = fillPercentage; + return this; + } + + /** + * Get fillPercentage + * + * @return fillPercentage + */ + @jakarta.annotation.Nullable + public String getFillPercentage() { + return fillPercentage; + } + + public void setFillPercentage(@jakarta.annotation.Nullable String fillPercentage) { + this.fillPercentage = fillPercentage; + } + + public QueryOrderHistoryResponseOrdersInner 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 QueryOrderHistoryResponseOrdersInner marketProviderFee( + @jakarta.annotation.Nullable String marketProviderFee) { + this.marketProviderFee = marketProviderFee; + return this; + } + + /** + * Get marketProviderFee + * + * @return marketProviderFee + */ + @jakarta.annotation.Nullable + public String getMarketProviderFee() { + return marketProviderFee; + } + + public void setMarketProviderFee(@jakarta.annotation.Nullable String marketProviderFee) { + this.marketProviderFee = marketProviderFee; + } + + public QueryOrderHistoryResponseOrdersInner networkFee( + @jakarta.annotation.Nullable String networkFee) { + this.networkFee = networkFee; + return this; + } + + /** + * Get networkFee + * + * @return networkFee + */ + @jakarta.annotation.Nullable + public String getNetworkFee() { + return networkFee; + } + + public void setNetworkFee(@jakarta.annotation.Nullable String networkFee) { + this.networkFee = networkFee; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + QueryOrderHistoryResponseOrdersInner queryOrderHistoryResponseOrdersInner = + (QueryOrderHistoryResponseOrdersInner) o; + return Objects.equals(this.orderId, queryOrderHistoryResponseOrdersInner.orderId) + && Objects.equals( + this.vendorOrderId, queryOrderHistoryResponseOrdersInner.vendorOrderId) + && Objects.equals(this.vendor, queryOrderHistoryResponseOrdersInner.vendor) + && Objects.equals( + this.marketTopicId, queryOrderHistoryResponseOrdersInner.marketTopicId) + && Objects.equals(this.slug, queryOrderHistoryResponseOrdersInner.slug) + && Objects.equals( + this.marketTopicTitle, + queryOrderHistoryResponseOrdersInner.marketTopicTitle) + && Objects.equals(this.marketId, queryOrderHistoryResponseOrdersInner.marketId) + && Objects.equals( + this.marketTitle, queryOrderHistoryResponseOrdersInner.marketTitle) + && Objects.equals(this.outcome, queryOrderHistoryResponseOrdersInner.outcome) + && Objects.equals( + this.outcomeIndex, queryOrderHistoryResponseOrdersInner.outcomeIndex) + && Objects.equals(this.status, queryOrderHistoryResponseOrdersInner.status) + && Objects.equals(this.side, queryOrderHistoryResponseOrdersInner.side) + && Objects.equals(this.orderType, queryOrderHistoryResponseOrdersInner.orderType) + && Objects.equals(this.createTime, queryOrderHistoryResponseOrdersInner.createTime) + && Objects.equals(this.modifyTime, queryOrderHistoryResponseOrdersInner.modifyTime) + && Objects.equals( + this.terminalTime, queryOrderHistoryResponseOrdersInner.terminalTime) + && Objects.equals( + this.makerUsdtAmount, queryOrderHistoryResponseOrdersInner.makerUsdtAmount) + && Objects.equals( + this.makerShareQty, queryOrderHistoryResponseOrdersInner.makerShareQty) + && Objects.equals( + this.filledUsdtAmount, + queryOrderHistoryResponseOrdersInner.filledUsdtAmount) + && Objects.equals( + this.filledShareQty, queryOrderHistoryResponseOrdersInner.filledShareQty) + && Objects.equals( + this.fillPercentage, queryOrderHistoryResponseOrdersInner.fillPercentage) + && Objects.equals(this.price, queryOrderHistoryResponseOrdersInner.price) + && Objects.equals( + this.marketProviderFee, + queryOrderHistoryResponseOrdersInner.marketProviderFee) + && Objects.equals(this.networkFee, queryOrderHistoryResponseOrdersInner.networkFee); + } + + @Override + public int hashCode() { + return Objects.hash( + orderId, + vendorOrderId, + vendor, + marketTopicId, + slug, + marketTopicTitle, + marketId, + marketTitle, + outcome, + outcomeIndex, + status, + side, + orderType, + createTime, + modifyTime, + terminalTime, + makerUsdtAmount, + makerShareQty, + filledUsdtAmount, + filledShareQty, + fillPercentage, + price, + marketProviderFee, + networkFee); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class QueryOrderHistoryResponseOrdersInner {\n"); + sb.append(" orderId: ").append(toIndentedString(orderId)).append("\n"); + sb.append(" vendorOrderId: ").append(toIndentedString(vendorOrderId)).append("\n"); + sb.append(" vendor: ").append(toIndentedString(vendor)).append("\n"); + sb.append(" marketTopicId: ").append(toIndentedString(marketTopicId)).append("\n"); + sb.append(" slug: ").append(toIndentedString(slug)).append("\n"); + sb.append(" marketTopicTitle: ").append(toIndentedString(marketTopicTitle)).append("\n"); + sb.append(" marketId: ").append(toIndentedString(marketId)).append("\n"); + sb.append(" marketTitle: ").append(toIndentedString(marketTitle)).append("\n"); + sb.append(" outcome: ").append(toIndentedString(outcome)).append("\n"); + sb.append(" outcomeIndex: ").append(toIndentedString(outcomeIndex)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" side: ").append(toIndentedString(side)).append("\n"); + sb.append(" orderType: ").append(toIndentedString(orderType)).append("\n"); + sb.append(" createTime: ").append(toIndentedString(createTime)).append("\n"); + sb.append(" modifyTime: ").append(toIndentedString(modifyTime)).append("\n"); + sb.append(" terminalTime: ").append(toIndentedString(terminalTime)).append("\n"); + sb.append(" makerUsdtAmount: ").append(toIndentedString(makerUsdtAmount)).append("\n"); + sb.append(" makerShareQty: ").append(toIndentedString(makerShareQty)).append("\n"); + sb.append(" filledUsdtAmount: ").append(toIndentedString(filledUsdtAmount)).append("\n"); + sb.append(" filledShareQty: ").append(toIndentedString(filledShareQty)).append("\n"); + sb.append(" fillPercentage: ").append(toIndentedString(fillPercentage)).append("\n"); + sb.append(" price: ").append(toIndentedString(price)).append("\n"); + sb.append(" marketProviderFee: ").append(toIndentedString(marketProviderFee)).append("\n"); + sb.append(" networkFee: ").append(toIndentedString(networkFee)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object orderIdValue = getOrderId(); + String orderIdValueAsString = ""; + orderIdValueAsString = orderIdValue.toString(); + sb.append("orderId=").append(urlEncode(orderIdValueAsString)).append(""); + Object vendorOrderIdValue = getVendorOrderId(); + String vendorOrderIdValueAsString = ""; + vendorOrderIdValueAsString = vendorOrderIdValue.toString(); + sb.append("vendorOrderId=").append(urlEncode(vendorOrderIdValueAsString)).append(""); + Object vendorValue = getVendor(); + String vendorValueAsString = ""; + vendorValueAsString = vendorValue.toString(); + sb.append("vendor=").append(urlEncode(vendorValueAsString)).append(""); + Object marketTopicIdValue = getMarketTopicId(); + String marketTopicIdValueAsString = ""; + marketTopicIdValueAsString = marketTopicIdValue.toString(); + sb.append("marketTopicId=").append(urlEncode(marketTopicIdValueAsString)).append(""); + Object slugValue = getSlug(); + String slugValueAsString = ""; + slugValueAsString = slugValue.toString(); + sb.append("slug=").append(urlEncode(slugValueAsString)).append(""); + Object marketTopicTitleValue = getMarketTopicTitle(); + String marketTopicTitleValueAsString = ""; + marketTopicTitleValueAsString = marketTopicTitleValue.toString(); + sb.append("marketTopicTitle=").append(urlEncode(marketTopicTitleValueAsString)).append(""); + Object marketIdValue = getMarketId(); + String marketIdValueAsString = ""; + marketIdValueAsString = marketIdValue.toString(); + sb.append("marketId=").append(urlEncode(marketIdValueAsString)).append(""); + Object marketTitleValue = getMarketTitle(); + String marketTitleValueAsString = ""; + marketTitleValueAsString = marketTitleValue.toString(); + sb.append("marketTitle=").append(urlEncode(marketTitleValueAsString)).append(""); + Object outcomeValue = getOutcome(); + String outcomeValueAsString = ""; + outcomeValueAsString = outcomeValue.toString(); + sb.append("outcome=").append(urlEncode(outcomeValueAsString)).append(""); + Object outcomeIndexValue = getOutcomeIndex(); + String outcomeIndexValueAsString = ""; + outcomeIndexValueAsString = outcomeIndexValue.toString(); + sb.append("outcomeIndex=").append(urlEncode(outcomeIndexValueAsString)).append(""); + Object statusValue = getStatus(); + String statusValueAsString = ""; + statusValueAsString = statusValue.toString(); + sb.append("status=").append(urlEncode(statusValueAsString)).append(""); + Object sideValue = getSide(); + String sideValueAsString = ""; + sideValueAsString = sideValue.toString(); + sb.append("side=").append(urlEncode(sideValueAsString)).append(""); + Object orderTypeValue = getOrderType(); + String orderTypeValueAsString = ""; + orderTypeValueAsString = orderTypeValue.toString(); + sb.append("orderType=").append(urlEncode(orderTypeValueAsString)).append(""); + Object createTimeValue = getCreateTime(); + String createTimeValueAsString = ""; + createTimeValueAsString = createTimeValue.toString(); + sb.append("createTime=").append(urlEncode(createTimeValueAsString)).append(""); + Object modifyTimeValue = getModifyTime(); + String modifyTimeValueAsString = ""; + modifyTimeValueAsString = modifyTimeValue.toString(); + sb.append("modifyTime=").append(urlEncode(modifyTimeValueAsString)).append(""); + Object terminalTimeValue = getTerminalTime(); + String terminalTimeValueAsString = ""; + terminalTimeValueAsString = terminalTimeValue.toString(); + sb.append("terminalTime=").append(urlEncode(terminalTimeValueAsString)).append(""); + Object makerUsdtAmountValue = getMakerUsdtAmount(); + String makerUsdtAmountValueAsString = ""; + makerUsdtAmountValueAsString = makerUsdtAmountValue.toString(); + sb.append("makerUsdtAmount=").append(urlEncode(makerUsdtAmountValueAsString)).append(""); + Object makerShareQtyValue = getMakerShareQty(); + String makerShareQtyValueAsString = ""; + makerShareQtyValueAsString = makerShareQtyValue.toString(); + sb.append("makerShareQty=").append(urlEncode(makerShareQtyValueAsString)).append(""); + Object filledUsdtAmountValue = getFilledUsdtAmount(); + String filledUsdtAmountValueAsString = ""; + filledUsdtAmountValueAsString = filledUsdtAmountValue.toString(); + sb.append("filledUsdtAmount=").append(urlEncode(filledUsdtAmountValueAsString)).append(""); + Object filledShareQtyValue = getFilledShareQty(); + String filledShareQtyValueAsString = ""; + filledShareQtyValueAsString = filledShareQtyValue.toString(); + sb.append("filledShareQty=").append(urlEncode(filledShareQtyValueAsString)).append(""); + Object fillPercentageValue = getFillPercentage(); + String fillPercentageValueAsString = ""; + fillPercentageValueAsString = fillPercentageValue.toString(); + sb.append("fillPercentage=").append(urlEncode(fillPercentageValueAsString)).append(""); + Object priceValue = getPrice(); + String priceValueAsString = ""; + priceValueAsString = priceValue.toString(); + sb.append("price=").append(urlEncode(priceValueAsString)).append(""); + Object marketProviderFeeValue = getMarketProviderFee(); + String marketProviderFeeValueAsString = ""; + marketProviderFeeValueAsString = marketProviderFeeValue.toString(); + sb.append("marketProviderFee=") + .append(urlEncode(marketProviderFeeValueAsString)) + .append(""); + Object networkFeeValue = getNetworkFee(); + String networkFeeValueAsString = ""; + networkFeeValueAsString = networkFeeValue.toString(); + sb.append("networkFee=").append(urlEncode(networkFeeValueAsString)).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("orderId"); + openapiFields.add("vendorOrderId"); + openapiFields.add("vendor"); + openapiFields.add("marketTopicId"); + openapiFields.add("slug"); + openapiFields.add("marketTopicTitle"); + openapiFields.add("marketId"); + openapiFields.add("marketTitle"); + openapiFields.add("outcome"); + openapiFields.add("outcomeIndex"); + openapiFields.add("status"); + openapiFields.add("side"); + openapiFields.add("orderType"); + openapiFields.add("createTime"); + openapiFields.add("modifyTime"); + openapiFields.add("terminalTime"); + openapiFields.add("makerUsdtAmount"); + openapiFields.add("makerShareQty"); + openapiFields.add("filledUsdtAmount"); + openapiFields.add("filledShareQty"); + openapiFields.add("fillPercentage"); + openapiFields.add("price"); + openapiFields.add("marketProviderFee"); + openapiFields.add("networkFee"); + + // 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 + * QueryOrderHistoryResponseOrdersInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!QueryOrderHistoryResponseOrdersInner.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in QueryOrderHistoryResponseOrdersInner" + + " is not found in the empty JSON string", + QueryOrderHistoryResponseOrdersInner.openapiRequiredFields + .toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("orderId") != null && !jsonObj.get("orderId").isJsonNull()) + && !jsonObj.get("orderId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `orderId` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("orderId").toString())); + } + if ((jsonObj.get("vendorOrderId") != null && !jsonObj.get("vendorOrderId").isJsonNull()) + && !jsonObj.get("vendorOrderId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `vendorOrderId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("vendorOrderId").toString())); + } + if ((jsonObj.get("vendor") != null && !jsonObj.get("vendor").isJsonNull()) + && !jsonObj.get("vendor").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `vendor` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("vendor").toString())); + } + if ((jsonObj.get("slug") != null && !jsonObj.get("slug").isJsonNull()) + && !jsonObj.get("slug").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `slug` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("slug").toString())); + } + if ((jsonObj.get("marketTopicTitle") != null + && !jsonObj.get("marketTopicTitle").isJsonNull()) + && !jsonObj.get("marketTopicTitle").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `marketTopicTitle` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("marketTopicTitle").toString())); + } + if ((jsonObj.get("marketTitle") != null && !jsonObj.get("marketTitle").isJsonNull()) + && !jsonObj.get("marketTitle").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `marketTitle` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("marketTitle").toString())); + } + if ((jsonObj.get("outcome") != null && !jsonObj.get("outcome").isJsonNull()) + && !jsonObj.get("outcome").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `outcome` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("outcome").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("side") != null && !jsonObj.get("side").isJsonNull()) + && !jsonObj.get("side").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `side` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("side").toString())); + } + if ((jsonObj.get("orderType") != null && !jsonObj.get("orderType").isJsonNull()) + && !jsonObj.get("orderType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `orderType` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("orderType").toString())); + } + if ((jsonObj.get("makerUsdtAmount") != null && !jsonObj.get("makerUsdtAmount").isJsonNull()) + && !jsonObj.get("makerUsdtAmount").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `makerUsdtAmount` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("makerUsdtAmount").toString())); + } + if ((jsonObj.get("makerShareQty") != null && !jsonObj.get("makerShareQty").isJsonNull()) + && !jsonObj.get("makerShareQty").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `makerShareQty` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("makerShareQty").toString())); + } + if ((jsonObj.get("filledUsdtAmount") != null + && !jsonObj.get("filledUsdtAmount").isJsonNull()) + && !jsonObj.get("filledUsdtAmount").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `filledUsdtAmount` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("filledUsdtAmount").toString())); + } + if ((jsonObj.get("filledShareQty") != null && !jsonObj.get("filledShareQty").isJsonNull()) + && !jsonObj.get("filledShareQty").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `filledShareQty` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("filledShareQty").toString())); + } + if ((jsonObj.get("fillPercentage") != null && !jsonObj.get("fillPercentage").isJsonNull()) + && !jsonObj.get("fillPercentage").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `fillPercentage` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("fillPercentage").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("marketProviderFee") != null + && !jsonObj.get("marketProviderFee").isJsonNull()) + && !jsonObj.get("marketProviderFee").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `marketProviderFee` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("marketProviderFee").toString())); + } + if ((jsonObj.get("networkFee") != null && !jsonObj.get("networkFee").isJsonNull()) + && !jsonObj.get("networkFee").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `networkFee` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("networkFee").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!QueryOrderHistoryResponseOrdersInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'QueryOrderHistoryResponseOrdersInner' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(QueryOrderHistoryResponseOrdersInner.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, QueryOrderHistoryResponseOrdersInner value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public QueryOrderHistoryResponseOrdersInner read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of QueryOrderHistoryResponseOrdersInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of QueryOrderHistoryResponseOrdersInner + * @throws IOException if the JSON string is invalid with respect to + * QueryOrderHistoryResponseOrdersInner + */ + public static QueryOrderHistoryResponseOrdersInner fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, QueryOrderHistoryResponseOrdersInner.class); + } + + /** + * Convert an instance of QueryOrderHistoryResponseOrdersInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryPaymentOptionBalancesResponse.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryPaymentOptionBalancesResponse.java new file mode 100644 index 000000000..9ca96e944 --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryPaymentOptionBalancesResponse.java @@ -0,0 +1,253 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.model; + +import com.binance.connector.client.w3w_prediction.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.*; + +/** QueryPaymentOptionBalancesResponse */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class QueryPaymentOptionBalancesResponse { + public static final String SERIALIZED_NAME_ITEMS = "items"; + + @SerializedName(SERIALIZED_NAME_ITEMS) + @jakarta.annotation.Nullable + private List<@Valid QueryPaymentOptionBalancesResponseItemsInner> items; + + public QueryPaymentOptionBalancesResponse() {} + + public QueryPaymentOptionBalancesResponse items( + @jakarta.annotation.Nullable + List<@Valid QueryPaymentOptionBalancesResponseItemsInner> items) { + this.items = items; + return this; + } + + public QueryPaymentOptionBalancesResponse addItemsItem( + QueryPaymentOptionBalancesResponseItemsInner itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * Get items + * + * @return items + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid QueryPaymentOptionBalancesResponseItemsInner> getItems() { + return items; + } + + public void setItems( + @jakarta.annotation.Nullable + List<@Valid QueryPaymentOptionBalancesResponseItemsInner> items) { + this.items = items; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + QueryPaymentOptionBalancesResponse queryPaymentOptionBalancesResponse = + (QueryPaymentOptionBalancesResponse) o; + return Objects.equals(this.items, queryPaymentOptionBalancesResponse.items); + } + + @Override + public int hashCode() { + return Objects.hash(items); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class QueryPaymentOptionBalancesResponse {\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object itemsValue = getItems(); + String itemsValueAsString = ""; + itemsValueAsString = + (String) + ((Collection) itemsValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("items=").append(urlEncode(itemsValueAsString)).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("items"); + + // 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 + * QueryPaymentOptionBalancesResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!QueryPaymentOptionBalancesResponse.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in QueryPaymentOptionBalancesResponse is" + + " not found in the empty JSON string", + QueryPaymentOptionBalancesResponse.openapiRequiredFields + .toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("items") != null && !jsonObj.get("items").isJsonNull()) { + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + if (jsonArrayitems != null) { + // ensure the json data is an array + if (!jsonObj.get("items").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `items` to be an array in the JSON string" + + " but got `%s`", + jsonObj.get("items").toString())); + } + + // validate the optional field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + QueryPaymentOptionBalancesResponseItemsInner.validateJsonElement( + jsonArrayitems.get(i)); + } + ; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!QueryPaymentOptionBalancesResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'QueryPaymentOptionBalancesResponse' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(QueryPaymentOptionBalancesResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, QueryPaymentOptionBalancesResponse value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public QueryPaymentOptionBalancesResponse read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of QueryPaymentOptionBalancesResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of QueryPaymentOptionBalancesResponse + * @throws IOException if the JSON string is invalid with respect to + * QueryPaymentOptionBalancesResponse + */ + public static QueryPaymentOptionBalancesResponse fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, QueryPaymentOptionBalancesResponse.class); + } + + /** + * Convert an instance of QueryPaymentOptionBalancesResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryPaymentOptionBalancesResponseItemsInner.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryPaymentOptionBalancesResponseItemsInner.java new file mode 100644 index 000000000..e555919f3 --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryPaymentOptionBalancesResponseItemsInner.java @@ -0,0 +1,309 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.model; + +import com.binance.connector.client.w3w_prediction.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.*; + +/** QueryPaymentOptionBalancesResponseItemsInner */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class QueryPaymentOptionBalancesResponseItemsInner { + public static final String SERIALIZED_NAME_ACCOUNT_TYPE = "accountType"; + + @SerializedName(SERIALIZED_NAME_ACCOUNT_TYPE) + @jakarta.annotation.Nullable + private String accountType; + + public static final String SERIALIZED_NAME_AVAILABLE_BALANCE_DISPLAY = + "availableBalanceDisplay"; + + @SerializedName(SERIALIZED_NAME_AVAILABLE_BALANCE_DISPLAY) + @jakarta.annotation.Nullable + private String availableBalanceDisplay; + + public static final String SERIALIZED_NAME_ENABLED = "enabled"; + + @SerializedName(SERIALIZED_NAME_ENABLED) + @jakarta.annotation.Nullable + private Boolean enabled; + + public QueryPaymentOptionBalancesResponseItemsInner() {} + + public QueryPaymentOptionBalancesResponseItemsInner accountType( + @jakarta.annotation.Nullable String accountType) { + this.accountType = accountType; + return this; + } + + /** + * Get accountType + * + * @return accountType + */ + @jakarta.annotation.Nullable + public String getAccountType() { + return accountType; + } + + public void setAccountType(@jakarta.annotation.Nullable String accountType) { + this.accountType = accountType; + } + + public QueryPaymentOptionBalancesResponseItemsInner availableBalanceDisplay( + @jakarta.annotation.Nullable String availableBalanceDisplay) { + this.availableBalanceDisplay = availableBalanceDisplay; + return this; + } + + /** + * Get availableBalanceDisplay + * + * @return availableBalanceDisplay + */ + @jakarta.annotation.Nullable + public String getAvailableBalanceDisplay() { + return availableBalanceDisplay; + } + + public void setAvailableBalanceDisplay( + @jakarta.annotation.Nullable String availableBalanceDisplay) { + this.availableBalanceDisplay = availableBalanceDisplay; + } + + public QueryPaymentOptionBalancesResponseItemsInner enabled( + @jakarta.annotation.Nullable Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get enabled + * + * @return enabled + */ + @jakarta.annotation.Nullable + public Boolean getEnabled() { + return enabled; + } + + public void setEnabled(@jakarta.annotation.Nullable Boolean enabled) { + this.enabled = enabled; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + QueryPaymentOptionBalancesResponseItemsInner queryPaymentOptionBalancesResponseItemsInner = + (QueryPaymentOptionBalancesResponseItemsInner) o; + return Objects.equals( + this.accountType, queryPaymentOptionBalancesResponseItemsInner.accountType) + && Objects.equals( + this.availableBalanceDisplay, + queryPaymentOptionBalancesResponseItemsInner.availableBalanceDisplay) + && Objects.equals( + this.enabled, queryPaymentOptionBalancesResponseItemsInner.enabled); + } + + @Override + public int hashCode() { + return Objects.hash(accountType, availableBalanceDisplay, enabled); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class QueryPaymentOptionBalancesResponseItemsInner {\n"); + sb.append(" accountType: ").append(toIndentedString(accountType)).append("\n"); + sb.append(" availableBalanceDisplay: ") + .append(toIndentedString(availableBalanceDisplay)) + .append("\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object accountTypeValue = getAccountType(); + String accountTypeValueAsString = ""; + accountTypeValueAsString = accountTypeValue.toString(); + sb.append("accountType=").append(urlEncode(accountTypeValueAsString)).append(""); + Object availableBalanceDisplayValue = getAvailableBalanceDisplay(); + String availableBalanceDisplayValueAsString = ""; + availableBalanceDisplayValueAsString = availableBalanceDisplayValue.toString(); + sb.append("availableBalanceDisplay=") + .append(urlEncode(availableBalanceDisplayValueAsString)) + .append(""); + Object enabledValue = getEnabled(); + String enabledValueAsString = ""; + enabledValueAsString = enabledValue.toString(); + sb.append("enabled=").append(urlEncode(enabledValueAsString)).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("accountType"); + openapiFields.add("availableBalanceDisplay"); + openapiFields.add("enabled"); + + // 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 + * QueryPaymentOptionBalancesResponseItemsInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!QueryPaymentOptionBalancesResponseItemsInner.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " QueryPaymentOptionBalancesResponseItemsInner is not found" + + " in the empty JSON string", + QueryPaymentOptionBalancesResponseItemsInner.openapiRequiredFields + .toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("accountType") != null && !jsonObj.get("accountType").isJsonNull()) + && !jsonObj.get("accountType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `accountType` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("accountType").toString())); + } + if ((jsonObj.get("availableBalanceDisplay") != null + && !jsonObj.get("availableBalanceDisplay").isJsonNull()) + && !jsonObj.get("availableBalanceDisplay").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `availableBalanceDisplay` to be a primitive type in" + + " the JSON string but got `%s`", + jsonObj.get("availableBalanceDisplay").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!QueryPaymentOptionBalancesResponseItemsInner.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'QueryPaymentOptionBalancesResponseItemsInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, + TypeToken.get(QueryPaymentOptionBalancesResponseItemsInner.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, QueryPaymentOptionBalancesResponseItemsInner value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public QueryPaymentOptionBalancesResponseItemsInner read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of QueryPaymentOptionBalancesResponseItemsInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of QueryPaymentOptionBalancesResponseItemsInner + * @throws IOException if the JSON string is invalid with respect to + * QueryPaymentOptionBalancesResponseItemsInner + */ + public static QueryPaymentOptionBalancesResponseItemsInner fromJson(String jsonString) + throws IOException { + return JSON.getGson() + .fromJson(jsonString, QueryPaymentOptionBalancesResponseItemsInner.class); + } + + /** + * Convert an instance of QueryPaymentOptionBalancesResponseItemsInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryPnLResponse.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryPnLResponse.java new file mode 100644 index 000000000..253e96db1 --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryPnLResponse.java @@ -0,0 +1,538 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.model; + +import com.binance.connector.client.w3w_prediction.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** QueryPnLResponse */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class QueryPnLResponse { + 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_WALLET_ADDRESS = "walletAddress"; + + @SerializedName(SERIALIZED_NAME_WALLET_ADDRESS) + @jakarta.annotation.Nullable + private String walletAddress; + + public static final String SERIALIZED_NAME_PNL = "pnl"; + + @SerializedName(SERIALIZED_NAME_PNL) + @jakarta.annotation.Nullable + private Object pnl; + + public static final String SERIALIZED_NAME_PNL_LIST = "pnlList"; + + @SerializedName(SERIALIZED_NAME_PNL_LIST) + @jakarta.annotation.Nullable + private List<@Valid GetPortfolioResponsePositionsInner> pnlList; + + public static final String SERIALIZED_NAME_TOTAL_COUNT = "totalCount"; + + @SerializedName(SERIALIZED_NAME_TOTAL_COUNT) + @jakarta.annotation.Nullable + private Integer totalCount; + + public static final String SERIALIZED_NAME_TOTAL_REALIZED_PNL = "totalRealizedPnl"; + + @SerializedName(SERIALIZED_NAME_TOTAL_REALIZED_PNL) + @jakarta.annotation.Nullable + private String totalRealizedPnl; + + public static final String SERIALIZED_NAME_TOTAL_UNREALIZED_PNL = "totalUnrealizedPnl"; + + @SerializedName(SERIALIZED_NAME_TOTAL_UNREALIZED_PNL) + @jakarta.annotation.Nullable + private String totalUnrealizedPnl; + + public static final String SERIALIZED_NAME_TOTAL_PNL = "totalPnl"; + + @SerializedName(SERIALIZED_NAME_TOTAL_PNL) + @jakarta.annotation.Nullable + private String totalPnl; + + public QueryPnLResponse() {} + + public QueryPnLResponse 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 QueryPnLResponse walletAddress(@jakarta.annotation.Nullable String walletAddress) { + this.walletAddress = walletAddress; + return this; + } + + /** + * Get walletAddress + * + * @return walletAddress + */ + @jakarta.annotation.Nullable + public String getWalletAddress() { + return walletAddress; + } + + public void setWalletAddress(@jakarta.annotation.Nullable String walletAddress) { + this.walletAddress = walletAddress; + } + + public QueryPnLResponse pnl(@jakarta.annotation.Nullable Object pnl) { + this.pnl = pnl; + return this; + } + + /** + * Get pnl + * + * @return pnl + */ + @jakarta.annotation.Nullable + public Object getPnl() { + return pnl; + } + + public void setPnl(@jakarta.annotation.Nullable Object pnl) { + this.pnl = pnl; + } + + public QueryPnLResponse pnlList( + @jakarta.annotation.Nullable List<@Valid GetPortfolioResponsePositionsInner> pnlList) { + this.pnlList = pnlList; + return this; + } + + public QueryPnLResponse addPnlListItem(GetPortfolioResponsePositionsInner pnlListItem) { + if (this.pnlList == null) { + this.pnlList = new ArrayList<>(); + } + this.pnlList.add(pnlListItem); + return this; + } + + /** + * Get pnlList + * + * @return pnlList + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid GetPortfolioResponsePositionsInner> getPnlList() { + return pnlList; + } + + public void setPnlList( + @jakarta.annotation.Nullable List<@Valid GetPortfolioResponsePositionsInner> pnlList) { + this.pnlList = pnlList; + } + + public QueryPnLResponse totalCount(@jakarta.annotation.Nullable Integer totalCount) { + this.totalCount = totalCount; + return this; + } + + /** + * Get totalCount + * + * @return totalCount + */ + @jakarta.annotation.Nullable + public Integer getTotalCount() { + return totalCount; + } + + public void setTotalCount(@jakarta.annotation.Nullable Integer totalCount) { + this.totalCount = totalCount; + } + + public QueryPnLResponse totalRealizedPnl(@jakarta.annotation.Nullable String totalRealizedPnl) { + this.totalRealizedPnl = totalRealizedPnl; + return this; + } + + /** + * Get totalRealizedPnl + * + * @return totalRealizedPnl + */ + @jakarta.annotation.Nullable + public String getTotalRealizedPnl() { + return totalRealizedPnl; + } + + public void setTotalRealizedPnl(@jakarta.annotation.Nullable String totalRealizedPnl) { + this.totalRealizedPnl = totalRealizedPnl; + } + + public QueryPnLResponse totalUnrealizedPnl( + @jakarta.annotation.Nullable String totalUnrealizedPnl) { + this.totalUnrealizedPnl = totalUnrealizedPnl; + return this; + } + + /** + * Get totalUnrealizedPnl + * + * @return totalUnrealizedPnl + */ + @jakarta.annotation.Nullable + public String getTotalUnrealizedPnl() { + return totalUnrealizedPnl; + } + + public void setTotalUnrealizedPnl(@jakarta.annotation.Nullable String totalUnrealizedPnl) { + this.totalUnrealizedPnl = totalUnrealizedPnl; + } + + public QueryPnLResponse totalPnl(@jakarta.annotation.Nullable String totalPnl) { + this.totalPnl = totalPnl; + return this; + } + + /** + * Get totalPnl + * + * @return totalPnl + */ + @jakarta.annotation.Nullable + public String getTotalPnl() { + return totalPnl; + } + + public void setTotalPnl(@jakarta.annotation.Nullable String totalPnl) { + this.totalPnl = totalPnl; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + QueryPnLResponse queryPnLResponse = (QueryPnLResponse) o; + return Objects.equals(this.chainId, queryPnLResponse.chainId) + && Objects.equals(this.walletAddress, queryPnLResponse.walletAddress) + && Objects.equals(this.pnl, queryPnLResponse.pnl) + && Objects.equals(this.pnlList, queryPnLResponse.pnlList) + && Objects.equals(this.totalCount, queryPnLResponse.totalCount) + && Objects.equals(this.totalRealizedPnl, queryPnLResponse.totalRealizedPnl) + && Objects.equals(this.totalUnrealizedPnl, queryPnLResponse.totalUnrealizedPnl) + && Objects.equals(this.totalPnl, queryPnLResponse.totalPnl); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash( + chainId, + walletAddress, + pnl, + pnlList, + totalCount, + totalRealizedPnl, + totalUnrealizedPnl, + totalPnl); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class QueryPnLResponse {\n"); + sb.append(" chainId: ").append(toIndentedString(chainId)).append("\n"); + sb.append(" walletAddress: ").append(toIndentedString(walletAddress)).append("\n"); + sb.append(" pnl: ").append(toIndentedString(pnl)).append("\n"); + sb.append(" pnlList: ").append(toIndentedString(pnlList)).append("\n"); + sb.append(" totalCount: ").append(toIndentedString(totalCount)).append("\n"); + sb.append(" totalRealizedPnl: ").append(toIndentedString(totalRealizedPnl)).append("\n"); + sb.append(" totalUnrealizedPnl: ") + .append(toIndentedString(totalUnrealizedPnl)) + .append("\n"); + sb.append(" totalPnl: ").append(toIndentedString(totalPnl)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object chainIdValue = getChainId(); + String chainIdValueAsString = ""; + chainIdValueAsString = chainIdValue.toString(); + sb.append("chainId=").append(urlEncode(chainIdValueAsString)).append(""); + Object walletAddressValue = getWalletAddress(); + String walletAddressValueAsString = ""; + walletAddressValueAsString = walletAddressValue.toString(); + sb.append("walletAddress=").append(urlEncode(walletAddressValueAsString)).append(""); + Object pnlValue = getPnl(); + String pnlValueAsString = ""; + pnlValueAsString = pnlValue.toString(); + sb.append("pnl=").append(urlEncode(pnlValueAsString)).append(""); + Object pnlListValue = getPnlList(); + String pnlListValueAsString = ""; + pnlListValueAsString = + (String) + ((Collection) pnlListValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("pnlList=").append(urlEncode(pnlListValueAsString)).append(""); + Object totalCountValue = getTotalCount(); + String totalCountValueAsString = ""; + totalCountValueAsString = totalCountValue.toString(); + sb.append("totalCount=").append(urlEncode(totalCountValueAsString)).append(""); + Object totalRealizedPnlValue = getTotalRealizedPnl(); + String totalRealizedPnlValueAsString = ""; + totalRealizedPnlValueAsString = totalRealizedPnlValue.toString(); + sb.append("totalRealizedPnl=").append(urlEncode(totalRealizedPnlValueAsString)).append(""); + Object totalUnrealizedPnlValue = getTotalUnrealizedPnl(); + String totalUnrealizedPnlValueAsString = ""; + totalUnrealizedPnlValueAsString = totalUnrealizedPnlValue.toString(); + sb.append("totalUnrealizedPnl=") + .append(urlEncode(totalUnrealizedPnlValueAsString)) + .append(""); + Object totalPnlValue = getTotalPnl(); + String totalPnlValueAsString = ""; + totalPnlValueAsString = totalPnlValue.toString(); + sb.append("totalPnl=").append(urlEncode(totalPnlValueAsString)).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("chainId"); + openapiFields.add("walletAddress"); + openapiFields.add("pnl"); + openapiFields.add("pnlList"); + openapiFields.add("totalCount"); + openapiFields.add("totalRealizedPnl"); + openapiFields.add("totalUnrealizedPnl"); + openapiFields.add("totalPnl"); + + // 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 QueryPnLResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!QueryPnLResponse.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in QueryPnLResponse is not found in the" + + " empty JSON string", + QueryPnLResponse.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + 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("walletAddress") != null && !jsonObj.get("walletAddress").isJsonNull()) + && !jsonObj.get("walletAddress").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `walletAddress` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("walletAddress").toString())); + } + if (jsonObj.get("pnlList") != null && !jsonObj.get("pnlList").isJsonNull()) { + JsonArray jsonArraypnlList = jsonObj.getAsJsonArray("pnlList"); + if (jsonArraypnlList != null) { + // ensure the json data is an array + if (!jsonObj.get("pnlList").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `pnlList` to be an array in the JSON string" + + " but got `%s`", + jsonObj.get("pnlList").toString())); + } + + // validate the optional field `pnlList` (array) + for (int i = 0; i < jsonArraypnlList.size(); i++) { + GetPortfolioResponsePositionsInner.validateJsonElement(jsonArraypnlList.get(i)); + } + ; + } + } + if ((jsonObj.get("totalRealizedPnl") != null + && !jsonObj.get("totalRealizedPnl").isJsonNull()) + && !jsonObj.get("totalRealizedPnl").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `totalRealizedPnl` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("totalRealizedPnl").toString())); + } + if ((jsonObj.get("totalUnrealizedPnl") != null + && !jsonObj.get("totalUnrealizedPnl").isJsonNull()) + && !jsonObj.get("totalUnrealizedPnl").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `totalUnrealizedPnl` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("totalUnrealizedPnl").toString())); + } + if ((jsonObj.get("totalPnl") != null && !jsonObj.get("totalPnl").isJsonNull()) + && !jsonObj.get("totalPnl").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `totalPnl` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("totalPnl").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!QueryPnLResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'QueryPnLResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(QueryPnLResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, QueryPnLResponse value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public QueryPnLResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of QueryPnLResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of QueryPnLResponse + * @throws IOException if the JSON string is invalid with respect to QueryPnLResponse + */ + public static QueryPnLResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, QueryPnLResponse.class); + } + + /** + * Convert an instance of QueryPnLResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryPositionsByFilterResponse.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryPositionsByFilterResponse.java new file mode 100644 index 000000000..8a611eee1 --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryPositionsByFilterResponse.java @@ -0,0 +1,251 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.model; + +import com.binance.connector.client.w3w_prediction.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.*; + +/** QueryPositionsByFilterResponse */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class QueryPositionsByFilterResponse { + public static final String SERIALIZED_NAME_POSITIONS = "positions"; + + @SerializedName(SERIALIZED_NAME_POSITIONS) + @jakarta.annotation.Nullable + private List<@Valid QueryPositionsByFilterResponsePositionsInner> positions; + + public QueryPositionsByFilterResponse() {} + + public QueryPositionsByFilterResponse positions( + @jakarta.annotation.Nullable + List<@Valid QueryPositionsByFilterResponsePositionsInner> positions) { + this.positions = positions; + return this; + } + + public QueryPositionsByFilterResponse addPositionsItem( + QueryPositionsByFilterResponsePositionsInner positionsItem) { + if (this.positions == null) { + this.positions = new ArrayList<>(); + } + this.positions.add(positionsItem); + return this; + } + + /** + * Get positions + * + * @return positions + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid QueryPositionsByFilterResponsePositionsInner> getPositions() { + return positions; + } + + public void setPositions( + @jakarta.annotation.Nullable + List<@Valid QueryPositionsByFilterResponsePositionsInner> positions) { + this.positions = positions; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + QueryPositionsByFilterResponse queryPositionsByFilterResponse = + (QueryPositionsByFilterResponse) o; + return Objects.equals(this.positions, queryPositionsByFilterResponse.positions); + } + + @Override + public int hashCode() { + return Objects.hash(positions); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class QueryPositionsByFilterResponse {\n"); + sb.append(" positions: ").append(toIndentedString(positions)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object positionsValue = getPositions(); + String positionsValueAsString = ""; + positionsValueAsString = + (String) + ((Collection) positionsValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("positions=").append(urlEncode(positionsValueAsString)).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("positions"); + + // 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 + * QueryPositionsByFilterResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!QueryPositionsByFilterResponse.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in QueryPositionsByFilterResponse is not" + + " found in the empty JSON string", + QueryPositionsByFilterResponse.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("positions") != null && !jsonObj.get("positions").isJsonNull()) { + JsonArray jsonArraypositions = jsonObj.getAsJsonArray("positions"); + if (jsonArraypositions != null) { + // ensure the json data is an array + if (!jsonObj.get("positions").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `positions` to be an array in the JSON" + + " string but got `%s`", + jsonObj.get("positions").toString())); + } + + // validate the optional field `positions` (array) + for (int i = 0; i < jsonArraypositions.size(); i++) { + QueryPositionsByFilterResponsePositionsInner.validateJsonElement( + jsonArraypositions.get(i)); + } + ; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!QueryPositionsByFilterResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'QueryPositionsByFilterResponse' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(QueryPositionsByFilterResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, QueryPositionsByFilterResponse value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public QueryPositionsByFilterResponse read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of QueryPositionsByFilterResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of QueryPositionsByFilterResponse + * @throws IOException if the JSON string is invalid with respect to + * QueryPositionsByFilterResponse + */ + public static QueryPositionsByFilterResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, QueryPositionsByFilterResponse.class); + } + + /** + * Convert an instance of QueryPositionsByFilterResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryPositionsByFilterResponsePositionsInner.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryPositionsByFilterResponsePositionsInner.java new file mode 100644 index 000000000..b5f6e281b --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryPositionsByFilterResponsePositionsInner.java @@ -0,0 +1,1164 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.model; + +import com.binance.connector.client.w3w_prediction.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.*; + +/** QueryPositionsByFilterResponsePositionsInner */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class QueryPositionsByFilterResponsePositionsInner { + public static final String SERIALIZED_NAME_POSITION_ID = "positionId"; + + @SerializedName(SERIALIZED_NAME_POSITION_ID) + @jakarta.annotation.Nullable + private Long positionId; + + public static final String SERIALIZED_NAME_VENDOR = "vendor"; + + @SerializedName(SERIALIZED_NAME_VENDOR) + @jakarta.annotation.Nullable + private String vendor; + + 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_TOKEN_ID = "tokenId"; + + @SerializedName(SERIALIZED_NAME_TOKEN_ID) + @jakarta.annotation.Nullable + private String tokenId; + + public static final String SERIALIZED_NAME_COLLATERAL_SYMBOL = "collateralSymbol"; + + @SerializedName(SERIALIZED_NAME_COLLATERAL_SYMBOL) + @jakarta.annotation.Nullable + private String collateralSymbol; + + public static final String SERIALIZED_NAME_TOPIC_TYPE = "topicType"; + + @SerializedName(SERIALIZED_NAME_TOPIC_TYPE) + @jakarta.annotation.Nullable + private String topicType; + + public static final String SERIALIZED_NAME_MARKET_TOPIC_ID = "marketTopicId"; + + @SerializedName(SERIALIZED_NAME_MARKET_TOPIC_ID) + @jakarta.annotation.Nullable + private Long marketTopicId; + + public static final String SERIALIZED_NAME_MARKET_ID = "marketId"; + + @SerializedName(SERIALIZED_NAME_MARKET_ID) + @jakarta.annotation.Nullable + private Long marketId; + + public static final String SERIALIZED_NAME_MARKET_TOPIC_TITLE = "marketTopicTitle"; + + @SerializedName(SERIALIZED_NAME_MARKET_TOPIC_TITLE) + @jakarta.annotation.Nullable + private String marketTopicTitle; + + public static final String SERIALIZED_NAME_MARKET_TITLE = "marketTitle"; + + @SerializedName(SERIALIZED_NAME_MARKET_TITLE) + @jakarta.annotation.Nullable + private String marketTitle; + + public static final String SERIALIZED_NAME_OUTCOME_NAME = "outcomeName"; + + @SerializedName(SERIALIZED_NAME_OUTCOME_NAME) + @jakarta.annotation.Nullable + private String outcomeName; + + public static final String SERIALIZED_NAME_OUTCOME_INDEX = "outcomeIndex"; + + @SerializedName(SERIALIZED_NAME_OUTCOME_INDEX) + @jakarta.annotation.Nullable + private Integer outcomeIndex; + + public static final String SERIALIZED_NAME_SHARES = "shares"; + + @SerializedName(SERIALIZED_NAME_SHARES) + @jakarta.annotation.Nullable + private String shares; + + public static final String SERIALIZED_NAME_AVG_PRICE = "avgPrice"; + + @SerializedName(SERIALIZED_NAME_AVG_PRICE) + @jakarta.annotation.Nullable + private String avgPrice; + + public static final String SERIALIZED_NAME_TOTAL_COST = "totalCost"; + + @SerializedName(SERIALIZED_NAME_TOTAL_COST) + @jakarta.annotation.Nullable + private String totalCost; + + public static final String SERIALIZED_NAME_VALUE = "value"; + + @SerializedName(SERIALIZED_NAME_VALUE) + @jakarta.annotation.Nullable + private String value; + + public static final String SERIALIZED_NAME_CURRENT_PRICE = "currentPrice"; + + @SerializedName(SERIALIZED_NAME_CURRENT_PRICE) + @jakarta.annotation.Nullable + private String currentPrice; + + public static final String SERIALIZED_NAME_POSITION_STATUS = "positionStatus"; + + @SerializedName(SERIALIZED_NAME_POSITION_STATUS) + @jakarta.annotation.Nullable + private String positionStatus; + + public static final String SERIALIZED_NAME_END_DATE = "endDate"; + + @SerializedName(SERIALIZED_NAME_END_DATE) + @jakarta.annotation.Nullable + private Long endDate; + + public static final String SERIALIZED_NAME_UNREALIZED_PNL = "unrealizedPnl"; + + @SerializedName(SERIALIZED_NAME_UNREALIZED_PNL) + @jakarta.annotation.Nullable + private String unrealizedPnl; + + public static final String SERIALIZED_NAME_REALIZED_PNL = "realizedPnl"; + + @SerializedName(SERIALIZED_NAME_REALIZED_PNL) + @jakarta.annotation.Nullable + private String realizedPnl; + + public static final String SERIALIZED_NAME_PNL = "pnl"; + + @SerializedName(SERIALIZED_NAME_PNL) + @jakarta.annotation.Nullable + private String pnl; + + public static final String SERIALIZED_NAME_CREATED_TIME = "createdTime"; + + @SerializedName(SERIALIZED_NAME_CREATED_TIME) + @jakarta.annotation.Nullable + private Long createdTime; + + public static final String SERIALIZED_NAME_UPDATED_TIME = "updatedTime"; + + @SerializedName(SERIALIZED_NAME_UPDATED_TIME) + @jakarta.annotation.Nullable + private Long updatedTime; + + public QueryPositionsByFilterResponsePositionsInner() {} + + public QueryPositionsByFilterResponsePositionsInner positionId( + @jakarta.annotation.Nullable Long positionId) { + this.positionId = positionId; + return this; + } + + /** + * Get positionId + * + * @return positionId + */ + @jakarta.annotation.Nullable + public Long getPositionId() { + return positionId; + } + + public void setPositionId(@jakarta.annotation.Nullable Long positionId) { + this.positionId = positionId; + } + + public QueryPositionsByFilterResponsePositionsInner vendor( + @jakarta.annotation.Nullable String vendor) { + this.vendor = vendor; + return this; + } + + /** + * Get vendor + * + * @return vendor + */ + @jakarta.annotation.Nullable + public String getVendor() { + return vendor; + } + + public void setVendor(@jakarta.annotation.Nullable String vendor) { + this.vendor = vendor; + } + + public QueryPositionsByFilterResponsePositionsInner 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 QueryPositionsByFilterResponsePositionsInner 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 QueryPositionsByFilterResponsePositionsInner collateralSymbol( + @jakarta.annotation.Nullable String collateralSymbol) { + this.collateralSymbol = collateralSymbol; + return this; + } + + /** + * Get collateralSymbol + * + * @return collateralSymbol + */ + @jakarta.annotation.Nullable + public String getCollateralSymbol() { + return collateralSymbol; + } + + public void setCollateralSymbol(@jakarta.annotation.Nullable String collateralSymbol) { + this.collateralSymbol = collateralSymbol; + } + + public QueryPositionsByFilterResponsePositionsInner topicType( + @jakarta.annotation.Nullable String topicType) { + this.topicType = topicType; + return this; + } + + /** + * Get topicType + * + * @return topicType + */ + @jakarta.annotation.Nullable + public String getTopicType() { + return topicType; + } + + public void setTopicType(@jakarta.annotation.Nullable String topicType) { + this.topicType = topicType; + } + + public QueryPositionsByFilterResponsePositionsInner marketTopicId( + @jakarta.annotation.Nullable Long marketTopicId) { + this.marketTopicId = marketTopicId; + return this; + } + + /** + * Get marketTopicId + * + * @return marketTopicId + */ + @jakarta.annotation.Nullable + public Long getMarketTopicId() { + return marketTopicId; + } + + public void setMarketTopicId(@jakarta.annotation.Nullable Long marketTopicId) { + this.marketTopicId = marketTopicId; + } + + public QueryPositionsByFilterResponsePositionsInner marketId( + @jakarta.annotation.Nullable Long marketId) { + this.marketId = marketId; + return this; + } + + /** + * Get marketId + * + * @return marketId + */ + @jakarta.annotation.Nullable + public Long getMarketId() { + return marketId; + } + + public void setMarketId(@jakarta.annotation.Nullable Long marketId) { + this.marketId = marketId; + } + + public QueryPositionsByFilterResponsePositionsInner marketTopicTitle( + @jakarta.annotation.Nullable String marketTopicTitle) { + this.marketTopicTitle = marketTopicTitle; + return this; + } + + /** + * Get marketTopicTitle + * + * @return marketTopicTitle + */ + @jakarta.annotation.Nullable + public String getMarketTopicTitle() { + return marketTopicTitle; + } + + public void setMarketTopicTitle(@jakarta.annotation.Nullable String marketTopicTitle) { + this.marketTopicTitle = marketTopicTitle; + } + + public QueryPositionsByFilterResponsePositionsInner marketTitle( + @jakarta.annotation.Nullable String marketTitle) { + this.marketTitle = marketTitle; + return this; + } + + /** + * Get marketTitle + * + * @return marketTitle + */ + @jakarta.annotation.Nullable + public String getMarketTitle() { + return marketTitle; + } + + public void setMarketTitle(@jakarta.annotation.Nullable String marketTitle) { + this.marketTitle = marketTitle; + } + + public QueryPositionsByFilterResponsePositionsInner outcomeName( + @jakarta.annotation.Nullable String outcomeName) { + this.outcomeName = outcomeName; + return this; + } + + /** + * Get outcomeName + * + * @return outcomeName + */ + @jakarta.annotation.Nullable + public String getOutcomeName() { + return outcomeName; + } + + public void setOutcomeName(@jakarta.annotation.Nullable String outcomeName) { + this.outcomeName = outcomeName; + } + + public QueryPositionsByFilterResponsePositionsInner outcomeIndex( + @jakarta.annotation.Nullable Integer outcomeIndex) { + this.outcomeIndex = outcomeIndex; + return this; + } + + /** + * Get outcomeIndex + * + * @return outcomeIndex + */ + @jakarta.annotation.Nullable + public Integer getOutcomeIndex() { + return outcomeIndex; + } + + public void setOutcomeIndex(@jakarta.annotation.Nullable Integer outcomeIndex) { + this.outcomeIndex = outcomeIndex; + } + + public QueryPositionsByFilterResponsePositionsInner shares( + @jakarta.annotation.Nullable String shares) { + this.shares = shares; + return this; + } + + /** + * Get shares + * + * @return shares + */ + @jakarta.annotation.Nullable + public String getShares() { + return shares; + } + + public void setShares(@jakarta.annotation.Nullable String shares) { + this.shares = shares; + } + + public QueryPositionsByFilterResponsePositionsInner avgPrice( + @jakarta.annotation.Nullable String avgPrice) { + this.avgPrice = avgPrice; + return this; + } + + /** + * Get avgPrice + * + * @return avgPrice + */ + @jakarta.annotation.Nullable + public String getAvgPrice() { + return avgPrice; + } + + public void setAvgPrice(@jakarta.annotation.Nullable String avgPrice) { + this.avgPrice = avgPrice; + } + + public QueryPositionsByFilterResponsePositionsInner totalCost( + @jakarta.annotation.Nullable String totalCost) { + this.totalCost = totalCost; + return this; + } + + /** + * Get totalCost + * + * @return totalCost + */ + @jakarta.annotation.Nullable + public String getTotalCost() { + return totalCost; + } + + public void setTotalCost(@jakarta.annotation.Nullable String totalCost) { + this.totalCost = totalCost; + } + + public QueryPositionsByFilterResponsePositionsInner value( + @jakarta.annotation.Nullable String value) { + this.value = value; + return this; + } + + /** + * Get value + * + * @return value + */ + @jakarta.annotation.Nullable + public String getValue() { + return value; + } + + public void setValue(@jakarta.annotation.Nullable String value) { + this.value = value; + } + + public QueryPositionsByFilterResponsePositionsInner currentPrice( + @jakarta.annotation.Nullable String currentPrice) { + this.currentPrice = currentPrice; + return this; + } + + /** + * Get currentPrice + * + * @return currentPrice + */ + @jakarta.annotation.Nullable + public String getCurrentPrice() { + return currentPrice; + } + + public void setCurrentPrice(@jakarta.annotation.Nullable String currentPrice) { + this.currentPrice = currentPrice; + } + + public QueryPositionsByFilterResponsePositionsInner positionStatus( + @jakarta.annotation.Nullable String positionStatus) { + this.positionStatus = positionStatus; + return this; + } + + /** + * Get positionStatus + * + * @return positionStatus + */ + @jakarta.annotation.Nullable + public String getPositionStatus() { + return positionStatus; + } + + public void setPositionStatus(@jakarta.annotation.Nullable String positionStatus) { + this.positionStatus = positionStatus; + } + + public QueryPositionsByFilterResponsePositionsInner endDate( + @jakarta.annotation.Nullable Long endDate) { + this.endDate = endDate; + return this; + } + + /** + * Get endDate + * + * @return endDate + */ + @jakarta.annotation.Nullable + public Long getEndDate() { + return endDate; + } + + public void setEndDate(@jakarta.annotation.Nullable Long endDate) { + this.endDate = endDate; + } + + public QueryPositionsByFilterResponsePositionsInner unrealizedPnl( + @jakarta.annotation.Nullable String unrealizedPnl) { + this.unrealizedPnl = unrealizedPnl; + return this; + } + + /** + * Get unrealizedPnl + * + * @return unrealizedPnl + */ + @jakarta.annotation.Nullable + public String getUnrealizedPnl() { + return unrealizedPnl; + } + + public void setUnrealizedPnl(@jakarta.annotation.Nullable String unrealizedPnl) { + this.unrealizedPnl = unrealizedPnl; + } + + public QueryPositionsByFilterResponsePositionsInner realizedPnl( + @jakarta.annotation.Nullable String realizedPnl) { + this.realizedPnl = realizedPnl; + return this; + } + + /** + * Get realizedPnl + * + * @return realizedPnl + */ + @jakarta.annotation.Nullable + public String getRealizedPnl() { + return realizedPnl; + } + + public void setRealizedPnl(@jakarta.annotation.Nullable String realizedPnl) { + this.realizedPnl = realizedPnl; + } + + public QueryPositionsByFilterResponsePositionsInner pnl( + @jakarta.annotation.Nullable String pnl) { + this.pnl = pnl; + return this; + } + + /** + * Get pnl + * + * @return pnl + */ + @jakarta.annotation.Nullable + public String getPnl() { + return pnl; + } + + public void setPnl(@jakarta.annotation.Nullable String pnl) { + this.pnl = pnl; + } + + public QueryPositionsByFilterResponsePositionsInner createdTime( + @jakarta.annotation.Nullable Long createdTime) { + this.createdTime = createdTime; + return this; + } + + /** + * Get createdTime + * + * @return createdTime + */ + @jakarta.annotation.Nullable + public Long getCreatedTime() { + return createdTime; + } + + public void setCreatedTime(@jakarta.annotation.Nullable Long createdTime) { + this.createdTime = createdTime; + } + + public QueryPositionsByFilterResponsePositionsInner updatedTime( + @jakarta.annotation.Nullable Long updatedTime) { + this.updatedTime = updatedTime; + return this; + } + + /** + * Get updatedTime + * + * @return updatedTime + */ + @jakarta.annotation.Nullable + public Long getUpdatedTime() { + return updatedTime; + } + + public void setUpdatedTime(@jakarta.annotation.Nullable Long updatedTime) { + this.updatedTime = updatedTime; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + QueryPositionsByFilterResponsePositionsInner queryPositionsByFilterResponsePositionsInner = + (QueryPositionsByFilterResponsePositionsInner) o; + return Objects.equals( + this.positionId, queryPositionsByFilterResponsePositionsInner.positionId) + && Objects.equals(this.vendor, queryPositionsByFilterResponsePositionsInner.vendor) + && Objects.equals( + this.chainId, queryPositionsByFilterResponsePositionsInner.chainId) + && Objects.equals( + this.tokenId, queryPositionsByFilterResponsePositionsInner.tokenId) + && Objects.equals( + this.collateralSymbol, + queryPositionsByFilterResponsePositionsInner.collateralSymbol) + && Objects.equals( + this.topicType, queryPositionsByFilterResponsePositionsInner.topicType) + && Objects.equals( + this.marketTopicId, + queryPositionsByFilterResponsePositionsInner.marketTopicId) + && Objects.equals( + this.marketId, queryPositionsByFilterResponsePositionsInner.marketId) + && Objects.equals( + this.marketTopicTitle, + queryPositionsByFilterResponsePositionsInner.marketTopicTitle) + && Objects.equals( + this.marketTitle, queryPositionsByFilterResponsePositionsInner.marketTitle) + && Objects.equals( + this.outcomeName, queryPositionsByFilterResponsePositionsInner.outcomeName) + && Objects.equals( + this.outcomeIndex, + queryPositionsByFilterResponsePositionsInner.outcomeIndex) + && Objects.equals(this.shares, queryPositionsByFilterResponsePositionsInner.shares) + && Objects.equals( + this.avgPrice, queryPositionsByFilterResponsePositionsInner.avgPrice) + && Objects.equals( + this.totalCost, queryPositionsByFilterResponsePositionsInner.totalCost) + && Objects.equals(this.value, queryPositionsByFilterResponsePositionsInner.value) + && Objects.equals( + this.currentPrice, + queryPositionsByFilterResponsePositionsInner.currentPrice) + && Objects.equals( + this.positionStatus, + queryPositionsByFilterResponsePositionsInner.positionStatus) + && Objects.equals( + this.endDate, queryPositionsByFilterResponsePositionsInner.endDate) + && Objects.equals( + this.unrealizedPnl, + queryPositionsByFilterResponsePositionsInner.unrealizedPnl) + && Objects.equals( + this.realizedPnl, queryPositionsByFilterResponsePositionsInner.realizedPnl) + && Objects.equals(this.pnl, queryPositionsByFilterResponsePositionsInner.pnl) + && Objects.equals( + this.createdTime, queryPositionsByFilterResponsePositionsInner.createdTime) + && Objects.equals( + this.updatedTime, queryPositionsByFilterResponsePositionsInner.updatedTime); + } + + @Override + public int hashCode() { + return Objects.hash( + positionId, + vendor, + chainId, + tokenId, + collateralSymbol, + topicType, + marketTopicId, + marketId, + marketTopicTitle, + marketTitle, + outcomeName, + outcomeIndex, + shares, + avgPrice, + totalCost, + value, + currentPrice, + positionStatus, + endDate, + unrealizedPnl, + realizedPnl, + pnl, + createdTime, + updatedTime); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class QueryPositionsByFilterResponsePositionsInner {\n"); + sb.append(" positionId: ").append(toIndentedString(positionId)).append("\n"); + sb.append(" vendor: ").append(toIndentedString(vendor)).append("\n"); + sb.append(" chainId: ").append(toIndentedString(chainId)).append("\n"); + sb.append(" tokenId: ").append(toIndentedString(tokenId)).append("\n"); + sb.append(" collateralSymbol: ").append(toIndentedString(collateralSymbol)).append("\n"); + sb.append(" topicType: ").append(toIndentedString(topicType)).append("\n"); + sb.append(" marketTopicId: ").append(toIndentedString(marketTopicId)).append("\n"); + sb.append(" marketId: ").append(toIndentedString(marketId)).append("\n"); + sb.append(" marketTopicTitle: ").append(toIndentedString(marketTopicTitle)).append("\n"); + sb.append(" marketTitle: ").append(toIndentedString(marketTitle)).append("\n"); + sb.append(" outcomeName: ").append(toIndentedString(outcomeName)).append("\n"); + sb.append(" outcomeIndex: ").append(toIndentedString(outcomeIndex)).append("\n"); + sb.append(" shares: ").append(toIndentedString(shares)).append("\n"); + sb.append(" avgPrice: ").append(toIndentedString(avgPrice)).append("\n"); + sb.append(" totalCost: ").append(toIndentedString(totalCost)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" currentPrice: ").append(toIndentedString(currentPrice)).append("\n"); + sb.append(" positionStatus: ").append(toIndentedString(positionStatus)).append("\n"); + sb.append(" endDate: ").append(toIndentedString(endDate)).append("\n"); + sb.append(" unrealizedPnl: ").append(toIndentedString(unrealizedPnl)).append("\n"); + sb.append(" realizedPnl: ").append(toIndentedString(realizedPnl)).append("\n"); + sb.append(" pnl: ").append(toIndentedString(pnl)).append("\n"); + sb.append(" createdTime: ").append(toIndentedString(createdTime)).append("\n"); + sb.append(" updatedTime: ").append(toIndentedString(updatedTime)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object positionIdValue = getPositionId(); + String positionIdValueAsString = ""; + positionIdValueAsString = positionIdValue.toString(); + sb.append("positionId=").append(urlEncode(positionIdValueAsString)).append(""); + Object vendorValue = getVendor(); + String vendorValueAsString = ""; + vendorValueAsString = vendorValue.toString(); + sb.append("vendor=").append(urlEncode(vendorValueAsString)).append(""); + Object chainIdValue = getChainId(); + String chainIdValueAsString = ""; + chainIdValueAsString = chainIdValue.toString(); + sb.append("chainId=").append(urlEncode(chainIdValueAsString)).append(""); + Object tokenIdValue = getTokenId(); + String tokenIdValueAsString = ""; + tokenIdValueAsString = tokenIdValue.toString(); + sb.append("tokenId=").append(urlEncode(tokenIdValueAsString)).append(""); + Object collateralSymbolValue = getCollateralSymbol(); + String collateralSymbolValueAsString = ""; + collateralSymbolValueAsString = collateralSymbolValue.toString(); + sb.append("collateralSymbol=").append(urlEncode(collateralSymbolValueAsString)).append(""); + Object topicTypeValue = getTopicType(); + String topicTypeValueAsString = ""; + topicTypeValueAsString = topicTypeValue.toString(); + sb.append("topicType=").append(urlEncode(topicTypeValueAsString)).append(""); + Object marketTopicIdValue = getMarketTopicId(); + String marketTopicIdValueAsString = ""; + marketTopicIdValueAsString = marketTopicIdValue.toString(); + sb.append("marketTopicId=").append(urlEncode(marketTopicIdValueAsString)).append(""); + Object marketIdValue = getMarketId(); + String marketIdValueAsString = ""; + marketIdValueAsString = marketIdValue.toString(); + sb.append("marketId=").append(urlEncode(marketIdValueAsString)).append(""); + Object marketTopicTitleValue = getMarketTopicTitle(); + String marketTopicTitleValueAsString = ""; + marketTopicTitleValueAsString = marketTopicTitleValue.toString(); + sb.append("marketTopicTitle=").append(urlEncode(marketTopicTitleValueAsString)).append(""); + Object marketTitleValue = getMarketTitle(); + String marketTitleValueAsString = ""; + marketTitleValueAsString = marketTitleValue.toString(); + sb.append("marketTitle=").append(urlEncode(marketTitleValueAsString)).append(""); + Object outcomeNameValue = getOutcomeName(); + String outcomeNameValueAsString = ""; + outcomeNameValueAsString = outcomeNameValue.toString(); + sb.append("outcomeName=").append(urlEncode(outcomeNameValueAsString)).append(""); + Object outcomeIndexValue = getOutcomeIndex(); + String outcomeIndexValueAsString = ""; + outcomeIndexValueAsString = outcomeIndexValue.toString(); + sb.append("outcomeIndex=").append(urlEncode(outcomeIndexValueAsString)).append(""); + Object sharesValue = getShares(); + String sharesValueAsString = ""; + sharesValueAsString = sharesValue.toString(); + sb.append("shares=").append(urlEncode(sharesValueAsString)).append(""); + Object avgPriceValue = getAvgPrice(); + String avgPriceValueAsString = ""; + avgPriceValueAsString = avgPriceValue.toString(); + sb.append("avgPrice=").append(urlEncode(avgPriceValueAsString)).append(""); + Object totalCostValue = getTotalCost(); + String totalCostValueAsString = ""; + totalCostValueAsString = totalCostValue.toString(); + sb.append("totalCost=").append(urlEncode(totalCostValueAsString)).append(""); + Object valueValue = getValue(); + String valueValueAsString = ""; + valueValueAsString = valueValue.toString(); + sb.append("value=").append(urlEncode(valueValueAsString)).append(""); + Object currentPriceValue = getCurrentPrice(); + String currentPriceValueAsString = ""; + currentPriceValueAsString = currentPriceValue.toString(); + sb.append("currentPrice=").append(urlEncode(currentPriceValueAsString)).append(""); + Object positionStatusValue = getPositionStatus(); + String positionStatusValueAsString = ""; + positionStatusValueAsString = positionStatusValue.toString(); + sb.append("positionStatus=").append(urlEncode(positionStatusValueAsString)).append(""); + Object endDateValue = getEndDate(); + String endDateValueAsString = ""; + endDateValueAsString = endDateValue.toString(); + sb.append("endDate=").append(urlEncode(endDateValueAsString)).append(""); + Object unrealizedPnlValue = getUnrealizedPnl(); + String unrealizedPnlValueAsString = ""; + unrealizedPnlValueAsString = unrealizedPnlValue.toString(); + sb.append("unrealizedPnl=").append(urlEncode(unrealizedPnlValueAsString)).append(""); + Object realizedPnlValue = getRealizedPnl(); + String realizedPnlValueAsString = ""; + realizedPnlValueAsString = realizedPnlValue.toString(); + sb.append("realizedPnl=").append(urlEncode(realizedPnlValueAsString)).append(""); + Object pnlValue = getPnl(); + String pnlValueAsString = ""; + pnlValueAsString = pnlValue.toString(); + sb.append("pnl=").append(urlEncode(pnlValueAsString)).append(""); + Object createdTimeValue = getCreatedTime(); + String createdTimeValueAsString = ""; + createdTimeValueAsString = createdTimeValue.toString(); + sb.append("createdTime=").append(urlEncode(createdTimeValueAsString)).append(""); + Object updatedTimeValue = getUpdatedTime(); + String updatedTimeValueAsString = ""; + updatedTimeValueAsString = updatedTimeValue.toString(); + sb.append("updatedTime=").append(urlEncode(updatedTimeValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("positionId"); + openapiFields.add("vendor"); + openapiFields.add("chainId"); + openapiFields.add("tokenId"); + openapiFields.add("collateralSymbol"); + openapiFields.add("topicType"); + openapiFields.add("marketTopicId"); + openapiFields.add("marketId"); + openapiFields.add("marketTopicTitle"); + openapiFields.add("marketTitle"); + openapiFields.add("outcomeName"); + openapiFields.add("outcomeIndex"); + openapiFields.add("shares"); + openapiFields.add("avgPrice"); + openapiFields.add("totalCost"); + openapiFields.add("value"); + openapiFields.add("currentPrice"); + openapiFields.add("positionStatus"); + openapiFields.add("endDate"); + openapiFields.add("unrealizedPnl"); + openapiFields.add("realizedPnl"); + openapiFields.add("pnl"); + openapiFields.add("createdTime"); + openapiFields.add("updatedTime"); + + // 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 + * QueryPositionsByFilterResponsePositionsInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!QueryPositionsByFilterResponsePositionsInner.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " QueryPositionsByFilterResponsePositionsInner is not found" + + " in the empty JSON string", + QueryPositionsByFilterResponsePositionsInner.openapiRequiredFields + .toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("vendor") != null && !jsonObj.get("vendor").isJsonNull()) + && !jsonObj.get("vendor").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `vendor` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("vendor").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("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("collateralSymbol") != null + && !jsonObj.get("collateralSymbol").isJsonNull()) + && !jsonObj.get("collateralSymbol").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `collateralSymbol` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("collateralSymbol").toString())); + } + if ((jsonObj.get("topicType") != null && !jsonObj.get("topicType").isJsonNull()) + && !jsonObj.get("topicType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `topicType` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("topicType").toString())); + } + if ((jsonObj.get("marketTopicTitle") != null + && !jsonObj.get("marketTopicTitle").isJsonNull()) + && !jsonObj.get("marketTopicTitle").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `marketTopicTitle` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("marketTopicTitle").toString())); + } + if ((jsonObj.get("marketTitle") != null && !jsonObj.get("marketTitle").isJsonNull()) + && !jsonObj.get("marketTitle").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `marketTitle` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("marketTitle").toString())); + } + if ((jsonObj.get("outcomeName") != null && !jsonObj.get("outcomeName").isJsonNull()) + && !jsonObj.get("outcomeName").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `outcomeName` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("outcomeName").toString())); + } + if ((jsonObj.get("shares") != null && !jsonObj.get("shares").isJsonNull()) + && !jsonObj.get("shares").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `shares` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("shares").toString())); + } + if ((jsonObj.get("avgPrice") != null && !jsonObj.get("avgPrice").isJsonNull()) + && !jsonObj.get("avgPrice").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `avgPrice` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("avgPrice").toString())); + } + if ((jsonObj.get("totalCost") != null && !jsonObj.get("totalCost").isJsonNull()) + && !jsonObj.get("totalCost").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `totalCost` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("totalCost").toString())); + } + if ((jsonObj.get("value") != null && !jsonObj.get("value").isJsonNull()) + && !jsonObj.get("value").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `value` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("value").toString())); + } + if ((jsonObj.get("currentPrice") != null && !jsonObj.get("currentPrice").isJsonNull()) + && !jsonObj.get("currentPrice").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `currentPrice` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("currentPrice").toString())); + } + if ((jsonObj.get("positionStatus") != null && !jsonObj.get("positionStatus").isJsonNull()) + && !jsonObj.get("positionStatus").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `positionStatus` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("positionStatus").toString())); + } + if ((jsonObj.get("unrealizedPnl") != null && !jsonObj.get("unrealizedPnl").isJsonNull()) + && !jsonObj.get("unrealizedPnl").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `unrealizedPnl` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("unrealizedPnl").toString())); + } + if ((jsonObj.get("realizedPnl") != null && !jsonObj.get("realizedPnl").isJsonNull()) + && !jsonObj.get("realizedPnl").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `realizedPnl` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("realizedPnl").toString())); + } + if ((jsonObj.get("pnl") != null && !jsonObj.get("pnl").isJsonNull()) + && !jsonObj.get("pnl").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `pnl` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("pnl").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!QueryPositionsByFilterResponsePositionsInner.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'QueryPositionsByFilterResponsePositionsInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, + TypeToken.get(QueryPositionsByFilterResponsePositionsInner.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, QueryPositionsByFilterResponsePositionsInner value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public QueryPositionsByFilterResponsePositionsInner read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of QueryPositionsByFilterResponsePositionsInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of QueryPositionsByFilterResponsePositionsInner + * @throws IOException if the JSON string is invalid with respect to + * QueryPositionsByFilterResponsePositionsInner + */ + public static QueryPositionsByFilterResponsePositionsInner fromJson(String jsonString) + throws IOException { + return JSON.getGson() + .fromJson(jsonString, QueryPositionsByFilterResponsePositionsInner.class); + } + + /** + * Convert an instance of QueryPositionsByFilterResponsePositionsInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryPositionsResponse.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryPositionsResponse.java new file mode 100644 index 000000000..28410897a --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryPositionsResponse.java @@ -0,0 +1,321 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.model; + +import com.binance.connector.client.w3w_prediction.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.*; + +/** QueryPositionsResponse */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class QueryPositionsResponse { + public static final String SERIALIZED_NAME_SUMMARY = "summary"; + + @SerializedName(SERIALIZED_NAME_SUMMARY) + @jakarta.annotation.Nullable + private QueryPositionsResponseSummary summary; + + public static final String SERIALIZED_NAME_COUNTS = "counts"; + + @SerializedName(SERIALIZED_NAME_COUNTS) + @jakarta.annotation.Nullable + private QueryPositionsResponseCounts counts; + + public static final String SERIALIZED_NAME_POSITIONS = "positions"; + + @SerializedName(SERIALIZED_NAME_POSITIONS) + @jakarta.annotation.Nullable + private List<@Valid QueryPositionsResponsePositionsInner> positions; + + public QueryPositionsResponse() {} + + public QueryPositionsResponse summary( + @jakarta.annotation.Nullable QueryPositionsResponseSummary summary) { + this.summary = summary; + return this; + } + + /** + * Get summary + * + * @return summary + */ + @jakarta.annotation.Nullable + @Valid + public QueryPositionsResponseSummary getSummary() { + return summary; + } + + public void setSummary(@jakarta.annotation.Nullable QueryPositionsResponseSummary summary) { + this.summary = summary; + } + + public QueryPositionsResponse counts( + @jakarta.annotation.Nullable QueryPositionsResponseCounts counts) { + this.counts = counts; + return this; + } + + /** + * Get counts + * + * @return counts + */ + @jakarta.annotation.Nullable + @Valid + public QueryPositionsResponseCounts getCounts() { + return counts; + } + + public void setCounts(@jakarta.annotation.Nullable QueryPositionsResponseCounts counts) { + this.counts = counts; + } + + public QueryPositionsResponse positions( + @jakarta.annotation.Nullable + List<@Valid QueryPositionsResponsePositionsInner> positions) { + this.positions = positions; + return this; + } + + public QueryPositionsResponse addPositionsItem( + QueryPositionsResponsePositionsInner positionsItem) { + if (this.positions == null) { + this.positions = new ArrayList<>(); + } + this.positions.add(positionsItem); + return this; + } + + /** + * Get positions + * + * @return positions + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid QueryPositionsResponsePositionsInner> getPositions() { + return positions; + } + + public void setPositions( + @jakarta.annotation.Nullable + List<@Valid QueryPositionsResponsePositionsInner> positions) { + this.positions = positions; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + QueryPositionsResponse queryPositionsResponse = (QueryPositionsResponse) o; + return Objects.equals(this.summary, queryPositionsResponse.summary) + && Objects.equals(this.counts, queryPositionsResponse.counts) + && Objects.equals(this.positions, queryPositionsResponse.positions); + } + + @Override + public int hashCode() { + return Objects.hash(summary, counts, positions); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class QueryPositionsResponse {\n"); + sb.append(" summary: ").append(toIndentedString(summary)).append("\n"); + sb.append(" counts: ").append(toIndentedString(counts)).append("\n"); + sb.append(" positions: ").append(toIndentedString(positions)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object summaryValue = getSummary(); + String summaryValueAsString = ""; + summaryValueAsString = summaryValue.toString(); + sb.append("summary=").append(urlEncode(summaryValueAsString)).append(""); + Object countsValue = getCounts(); + String countsValueAsString = ""; + countsValueAsString = countsValue.toString(); + sb.append("counts=").append(urlEncode(countsValueAsString)).append(""); + Object positionsValue = getPositions(); + String positionsValueAsString = ""; + positionsValueAsString = + (String) + ((Collection) positionsValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("positions=").append(urlEncode(positionsValueAsString)).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("summary"); + openapiFields.add("counts"); + openapiFields.add("positions"); + + // 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 QueryPositionsResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!QueryPositionsResponse.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in QueryPositionsResponse is not found in" + + " the empty JSON string", + QueryPositionsResponse.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `summary` + if (jsonObj.get("summary") != null && !jsonObj.get("summary").isJsonNull()) { + QueryPositionsResponseSummary.validateJsonElement(jsonObj.get("summary")); + } + // validate the optional field `counts` + if (jsonObj.get("counts") != null && !jsonObj.get("counts").isJsonNull()) { + QueryPositionsResponseCounts.validateJsonElement(jsonObj.get("counts")); + } + if (jsonObj.get("positions") != null && !jsonObj.get("positions").isJsonNull()) { + JsonArray jsonArraypositions = jsonObj.getAsJsonArray("positions"); + if (jsonArraypositions != null) { + // ensure the json data is an array + if (!jsonObj.get("positions").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `positions` to be an array in the JSON" + + " string but got `%s`", + jsonObj.get("positions").toString())); + } + + // validate the optional field `positions` (array) + for (int i = 0; i < jsonArraypositions.size(); i++) { + QueryPositionsResponsePositionsInner.validateJsonElement( + jsonArraypositions.get(i)); + } + ; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!QueryPositionsResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'QueryPositionsResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(QueryPositionsResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, QueryPositionsResponse value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public QueryPositionsResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of QueryPositionsResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of QueryPositionsResponse + * @throws IOException if the JSON string is invalid with respect to QueryPositionsResponse + */ + public static QueryPositionsResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, QueryPositionsResponse.class); + } + + /** + * Convert an instance of QueryPositionsResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryPositionsResponseCounts.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryPositionsResponseCounts.java new file mode 100644 index 000000000..b20dbf2f7 --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryPositionsResponseCounts.java @@ -0,0 +1,277 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.model; + +import com.binance.connector.client.w3w_prediction.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.*; + +/** QueryPositionsResponseCounts */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class QueryPositionsResponseCounts { + public static final String SERIALIZED_NAME_ONGOING_COUNT = "ongoingCount"; + + @SerializedName(SERIALIZED_NAME_ONGOING_COUNT) + @jakarta.annotation.Nullable + private Integer ongoingCount; + + public static final String SERIALIZED_NAME_ENDED_COUNT = "endedCount"; + + @SerializedName(SERIALIZED_NAME_ENDED_COUNT) + @jakarta.annotation.Nullable + private Integer endedCount; + + public static final String SERIALIZED_NAME_PENDING_CLAIM_COUNT = "pendingClaimCount"; + + @SerializedName(SERIALIZED_NAME_PENDING_CLAIM_COUNT) + @jakarta.annotation.Nullable + private Integer pendingClaimCount; + + public QueryPositionsResponseCounts() {} + + public QueryPositionsResponseCounts ongoingCount( + @jakarta.annotation.Nullable Integer ongoingCount) { + this.ongoingCount = ongoingCount; + return this; + } + + /** + * Get ongoingCount + * + * @return ongoingCount + */ + @jakarta.annotation.Nullable + public Integer getOngoingCount() { + return ongoingCount; + } + + public void setOngoingCount(@jakarta.annotation.Nullable Integer ongoingCount) { + this.ongoingCount = ongoingCount; + } + + public QueryPositionsResponseCounts endedCount( + @jakarta.annotation.Nullable Integer endedCount) { + this.endedCount = endedCount; + return this; + } + + /** + * Get endedCount + * + * @return endedCount + */ + @jakarta.annotation.Nullable + public Integer getEndedCount() { + return endedCount; + } + + public void setEndedCount(@jakarta.annotation.Nullable Integer endedCount) { + this.endedCount = endedCount; + } + + public QueryPositionsResponseCounts pendingClaimCount( + @jakarta.annotation.Nullable Integer pendingClaimCount) { + this.pendingClaimCount = pendingClaimCount; + return this; + } + + /** + * Get pendingClaimCount + * + * @return pendingClaimCount + */ + @jakarta.annotation.Nullable + public Integer getPendingClaimCount() { + return pendingClaimCount; + } + + public void setPendingClaimCount(@jakarta.annotation.Nullable Integer pendingClaimCount) { + this.pendingClaimCount = pendingClaimCount; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + QueryPositionsResponseCounts queryPositionsResponseCounts = + (QueryPositionsResponseCounts) o; + return Objects.equals(this.ongoingCount, queryPositionsResponseCounts.ongoingCount) + && Objects.equals(this.endedCount, queryPositionsResponseCounts.endedCount) + && Objects.equals( + this.pendingClaimCount, queryPositionsResponseCounts.pendingClaimCount); + } + + @Override + public int hashCode() { + return Objects.hash(ongoingCount, endedCount, pendingClaimCount); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class QueryPositionsResponseCounts {\n"); + sb.append(" ongoingCount: ").append(toIndentedString(ongoingCount)).append("\n"); + sb.append(" endedCount: ").append(toIndentedString(endedCount)).append("\n"); + sb.append(" pendingClaimCount: ").append(toIndentedString(pendingClaimCount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object ongoingCountValue = getOngoingCount(); + String ongoingCountValueAsString = ""; + ongoingCountValueAsString = ongoingCountValue.toString(); + sb.append("ongoingCount=").append(urlEncode(ongoingCountValueAsString)).append(""); + Object endedCountValue = getEndedCount(); + String endedCountValueAsString = ""; + endedCountValueAsString = endedCountValue.toString(); + sb.append("endedCount=").append(urlEncode(endedCountValueAsString)).append(""); + Object pendingClaimCountValue = getPendingClaimCount(); + String pendingClaimCountValueAsString = ""; + pendingClaimCountValueAsString = pendingClaimCountValue.toString(); + sb.append("pendingClaimCount=") + .append(urlEncode(pendingClaimCountValueAsString)) + .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("ongoingCount"); + openapiFields.add("endedCount"); + openapiFields.add("pendingClaimCount"); + + // 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 + * QueryPositionsResponseCounts + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!QueryPositionsResponseCounts.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in QueryPositionsResponseCounts is not" + + " found in the empty JSON string", + QueryPositionsResponseCounts.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!QueryPositionsResponseCounts.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'QueryPositionsResponseCounts' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(QueryPositionsResponseCounts.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, QueryPositionsResponseCounts value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public QueryPositionsResponseCounts read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of QueryPositionsResponseCounts given an JSON string + * + * @param jsonString JSON string + * @return An instance of QueryPositionsResponseCounts + * @throws IOException if the JSON string is invalid with respect to + * QueryPositionsResponseCounts + */ + public static QueryPositionsResponseCounts fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, QueryPositionsResponseCounts.class); + } + + /** + * Convert an instance of QueryPositionsResponseCounts to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryPositionsResponsePositionsInner.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryPositionsResponsePositionsInner.java new file mode 100644 index 000000000..d06eaee59 --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryPositionsResponsePositionsInner.java @@ -0,0 +1,1266 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.model; + +import com.binance.connector.client.w3w_prediction.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.*; + +/** QueryPositionsResponsePositionsInner */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class QueryPositionsResponsePositionsInner { + public static final String SERIALIZED_NAME_POSITION_ID = "positionId"; + + @SerializedName(SERIALIZED_NAME_POSITION_ID) + @jakarta.annotation.Nullable + private Long positionId; + + public static final String SERIALIZED_NAME_VENDOR = "vendor"; + + @SerializedName(SERIALIZED_NAME_VENDOR) + @jakarta.annotation.Nullable + private String vendor; + + 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_TOKEN_ID = "tokenId"; + + @SerializedName(SERIALIZED_NAME_TOKEN_ID) + @jakarta.annotation.Nullable + private String tokenId; + + public static final String SERIALIZED_NAME_COLLATERAL_SYMBOL = "collateralSymbol"; + + @SerializedName(SERIALIZED_NAME_COLLATERAL_SYMBOL) + @jakarta.annotation.Nullable + private String collateralSymbol; + + public static final String SERIALIZED_NAME_TOPIC_TYPE = "topicType"; + + @SerializedName(SERIALIZED_NAME_TOPIC_TYPE) + @jakarta.annotation.Nullable + private String topicType; + + public static final String SERIALIZED_NAME_MARKET_TOPIC_ID = "marketTopicId"; + + @SerializedName(SERIALIZED_NAME_MARKET_TOPIC_ID) + @jakarta.annotation.Nullable + private Long marketTopicId; + + public static final String SERIALIZED_NAME_MARKET_ID = "marketId"; + + @SerializedName(SERIALIZED_NAME_MARKET_ID) + @jakarta.annotation.Nullable + private Long marketId; + + public static final String SERIALIZED_NAME_MARKET_TOPIC_TITLE = "marketTopicTitle"; + + @SerializedName(SERIALIZED_NAME_MARKET_TOPIC_TITLE) + @jakarta.annotation.Nullable + private String marketTopicTitle; + + public static final String SERIALIZED_NAME_MARKET_TITLE = "marketTitle"; + + @SerializedName(SERIALIZED_NAME_MARKET_TITLE) + @jakarta.annotation.Nullable + private String marketTitle; + + public static final String SERIALIZED_NAME_OUTCOME_NAME = "outcomeName"; + + @SerializedName(SERIALIZED_NAME_OUTCOME_NAME) + @jakarta.annotation.Nullable + private String outcomeName; + + public static final String SERIALIZED_NAME_OUTCOME_INDEX = "outcomeIndex"; + + @SerializedName(SERIALIZED_NAME_OUTCOME_INDEX) + @jakarta.annotation.Nullable + private Integer outcomeIndex; + + public static final String SERIALIZED_NAME_SHARES = "shares"; + + @SerializedName(SERIALIZED_NAME_SHARES) + @jakarta.annotation.Nullable + private String shares; + + public static final String SERIALIZED_NAME_AVG_PRICE = "avgPrice"; + + @SerializedName(SERIALIZED_NAME_AVG_PRICE) + @jakarta.annotation.Nullable + private String avgPrice; + + public static final String SERIALIZED_NAME_TOTAL_COST = "totalCost"; + + @SerializedName(SERIALIZED_NAME_TOTAL_COST) + @jakarta.annotation.Nullable + private String totalCost; + + public static final String SERIALIZED_NAME_VALUE = "value"; + + @SerializedName(SERIALIZED_NAME_VALUE) + @jakarta.annotation.Nullable + private String value; + + public static final String SERIALIZED_NAME_CURRENT_PRICE = "currentPrice"; + + @SerializedName(SERIALIZED_NAME_CURRENT_PRICE) + @jakarta.annotation.Nullable + private String currentPrice; + + public static final String SERIALIZED_NAME_TO_WIN = "toWin"; + + @SerializedName(SERIALIZED_NAME_TO_WIN) + @jakarta.annotation.Nullable + private String toWin; + + public static final String SERIALIZED_NAME_POSITION_STATUS = "positionStatus"; + + @SerializedName(SERIALIZED_NAME_POSITION_STATUS) + @jakarta.annotation.Nullable + private String positionStatus; + + public static final String SERIALIZED_NAME_CAN_CLAIM = "canClaim"; + + @SerializedName(SERIALIZED_NAME_CAN_CLAIM) + @jakarta.annotation.Nullable + private Boolean canClaim; + + public static final String SERIALIZED_NAME_END_DATE = "endDate"; + + @SerializedName(SERIALIZED_NAME_END_DATE) + @jakarta.annotation.Nullable + private Long endDate; + + public static final String SERIALIZED_NAME_UNREALIZED_PNL = "unrealizedPnl"; + + @SerializedName(SERIALIZED_NAME_UNREALIZED_PNL) + @jakarta.annotation.Nullable + private String unrealizedPnl; + + public static final String SERIALIZED_NAME_UNREALIZED_PNL_PERCENT = "unrealizedPnlPercent"; + + @SerializedName(SERIALIZED_NAME_UNREALIZED_PNL_PERCENT) + @jakarta.annotation.Nullable + private String unrealizedPnlPercent; + + public static final String SERIALIZED_NAME_REALIZED_PNL = "realizedPnl"; + + @SerializedName(SERIALIZED_NAME_REALIZED_PNL) + @jakarta.annotation.Nullable + private String realizedPnl; + + public static final String SERIALIZED_NAME_PNL = "pnl"; + + @SerializedName(SERIALIZED_NAME_PNL) + @jakarta.annotation.Nullable + private String pnl; + + public static final String SERIALIZED_NAME_CREATED_TIME = "createdTime"; + + @SerializedName(SERIALIZED_NAME_CREATED_TIME) + @jakarta.annotation.Nullable + private Long createdTime; + + public static final String SERIALIZED_NAME_UPDATED_TIME = "updatedTime"; + + @SerializedName(SERIALIZED_NAME_UPDATED_TIME) + @jakarta.annotation.Nullable + private Long updatedTime; + + public QueryPositionsResponsePositionsInner() {} + + public QueryPositionsResponsePositionsInner positionId( + @jakarta.annotation.Nullable Long positionId) { + this.positionId = positionId; + return this; + } + + /** + * Get positionId + * + * @return positionId + */ + @jakarta.annotation.Nullable + public Long getPositionId() { + return positionId; + } + + public void setPositionId(@jakarta.annotation.Nullable Long positionId) { + this.positionId = positionId; + } + + public QueryPositionsResponsePositionsInner vendor(@jakarta.annotation.Nullable String vendor) { + this.vendor = vendor; + return this; + } + + /** + * Get vendor + * + * @return vendor + */ + @jakarta.annotation.Nullable + public String getVendor() { + return vendor; + } + + public void setVendor(@jakarta.annotation.Nullable String vendor) { + this.vendor = vendor; + } + + public QueryPositionsResponsePositionsInner 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 QueryPositionsResponsePositionsInner 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 QueryPositionsResponsePositionsInner collateralSymbol( + @jakarta.annotation.Nullable String collateralSymbol) { + this.collateralSymbol = collateralSymbol; + return this; + } + + /** + * Get collateralSymbol + * + * @return collateralSymbol + */ + @jakarta.annotation.Nullable + public String getCollateralSymbol() { + return collateralSymbol; + } + + public void setCollateralSymbol(@jakarta.annotation.Nullable String collateralSymbol) { + this.collateralSymbol = collateralSymbol; + } + + public QueryPositionsResponsePositionsInner topicType( + @jakarta.annotation.Nullable String topicType) { + this.topicType = topicType; + return this; + } + + /** + * Get topicType + * + * @return topicType + */ + @jakarta.annotation.Nullable + public String getTopicType() { + return topicType; + } + + public void setTopicType(@jakarta.annotation.Nullable String topicType) { + this.topicType = topicType; + } + + public QueryPositionsResponsePositionsInner marketTopicId( + @jakarta.annotation.Nullable Long marketTopicId) { + this.marketTopicId = marketTopicId; + return this; + } + + /** + * Get marketTopicId + * + * @return marketTopicId + */ + @jakarta.annotation.Nullable + public Long getMarketTopicId() { + return marketTopicId; + } + + public void setMarketTopicId(@jakarta.annotation.Nullable Long marketTopicId) { + this.marketTopicId = marketTopicId; + } + + public QueryPositionsResponsePositionsInner marketId( + @jakarta.annotation.Nullable Long marketId) { + this.marketId = marketId; + return this; + } + + /** + * Get marketId + * + * @return marketId + */ + @jakarta.annotation.Nullable + public Long getMarketId() { + return marketId; + } + + public void setMarketId(@jakarta.annotation.Nullable Long marketId) { + this.marketId = marketId; + } + + public QueryPositionsResponsePositionsInner marketTopicTitle( + @jakarta.annotation.Nullable String marketTopicTitle) { + this.marketTopicTitle = marketTopicTitle; + return this; + } + + /** + * Get marketTopicTitle + * + * @return marketTopicTitle + */ + @jakarta.annotation.Nullable + public String getMarketTopicTitle() { + return marketTopicTitle; + } + + public void setMarketTopicTitle(@jakarta.annotation.Nullable String marketTopicTitle) { + this.marketTopicTitle = marketTopicTitle; + } + + public QueryPositionsResponsePositionsInner marketTitle( + @jakarta.annotation.Nullable String marketTitle) { + this.marketTitle = marketTitle; + return this; + } + + /** + * Get marketTitle + * + * @return marketTitle + */ + @jakarta.annotation.Nullable + public String getMarketTitle() { + return marketTitle; + } + + public void setMarketTitle(@jakarta.annotation.Nullable String marketTitle) { + this.marketTitle = marketTitle; + } + + public QueryPositionsResponsePositionsInner outcomeName( + @jakarta.annotation.Nullable String outcomeName) { + this.outcomeName = outcomeName; + return this; + } + + /** + * Get outcomeName + * + * @return outcomeName + */ + @jakarta.annotation.Nullable + public String getOutcomeName() { + return outcomeName; + } + + public void setOutcomeName(@jakarta.annotation.Nullable String outcomeName) { + this.outcomeName = outcomeName; + } + + public QueryPositionsResponsePositionsInner outcomeIndex( + @jakarta.annotation.Nullable Integer outcomeIndex) { + this.outcomeIndex = outcomeIndex; + return this; + } + + /** + * Get outcomeIndex + * + * @return outcomeIndex + */ + @jakarta.annotation.Nullable + public Integer getOutcomeIndex() { + return outcomeIndex; + } + + public void setOutcomeIndex(@jakarta.annotation.Nullable Integer outcomeIndex) { + this.outcomeIndex = outcomeIndex; + } + + public QueryPositionsResponsePositionsInner shares(@jakarta.annotation.Nullable String shares) { + this.shares = shares; + return this; + } + + /** + * Get shares + * + * @return shares + */ + @jakarta.annotation.Nullable + public String getShares() { + return shares; + } + + public void setShares(@jakarta.annotation.Nullable String shares) { + this.shares = shares; + } + + public QueryPositionsResponsePositionsInner avgPrice( + @jakarta.annotation.Nullable String avgPrice) { + this.avgPrice = avgPrice; + return this; + } + + /** + * Get avgPrice + * + * @return avgPrice + */ + @jakarta.annotation.Nullable + public String getAvgPrice() { + return avgPrice; + } + + public void setAvgPrice(@jakarta.annotation.Nullable String avgPrice) { + this.avgPrice = avgPrice; + } + + public QueryPositionsResponsePositionsInner totalCost( + @jakarta.annotation.Nullable String totalCost) { + this.totalCost = totalCost; + return this; + } + + /** + * Get totalCost + * + * @return totalCost + */ + @jakarta.annotation.Nullable + public String getTotalCost() { + return totalCost; + } + + public void setTotalCost(@jakarta.annotation.Nullable String totalCost) { + this.totalCost = totalCost; + } + + public QueryPositionsResponsePositionsInner value(@jakarta.annotation.Nullable String value) { + this.value = value; + return this; + } + + /** + * Get value + * + * @return value + */ + @jakarta.annotation.Nullable + public String getValue() { + return value; + } + + public void setValue(@jakarta.annotation.Nullable String value) { + this.value = value; + } + + public QueryPositionsResponsePositionsInner currentPrice( + @jakarta.annotation.Nullable String currentPrice) { + this.currentPrice = currentPrice; + return this; + } + + /** + * Get currentPrice + * + * @return currentPrice + */ + @jakarta.annotation.Nullable + public String getCurrentPrice() { + return currentPrice; + } + + public void setCurrentPrice(@jakarta.annotation.Nullable String currentPrice) { + this.currentPrice = currentPrice; + } + + public QueryPositionsResponsePositionsInner toWin(@jakarta.annotation.Nullable String toWin) { + this.toWin = toWin; + return this; + } + + /** + * Get toWin + * + * @return toWin + */ + @jakarta.annotation.Nullable + public String getToWin() { + return toWin; + } + + public void setToWin(@jakarta.annotation.Nullable String toWin) { + this.toWin = toWin; + } + + public QueryPositionsResponsePositionsInner positionStatus( + @jakarta.annotation.Nullable String positionStatus) { + this.positionStatus = positionStatus; + return this; + } + + /** + * Get positionStatus + * + * @return positionStatus + */ + @jakarta.annotation.Nullable + public String getPositionStatus() { + return positionStatus; + } + + public void setPositionStatus(@jakarta.annotation.Nullable String positionStatus) { + this.positionStatus = positionStatus; + } + + public QueryPositionsResponsePositionsInner canClaim( + @jakarta.annotation.Nullable Boolean canClaim) { + this.canClaim = canClaim; + return this; + } + + /** + * Get canClaim + * + * @return canClaim + */ + @jakarta.annotation.Nullable + public Boolean getCanClaim() { + return canClaim; + } + + public void setCanClaim(@jakarta.annotation.Nullable Boolean canClaim) { + this.canClaim = canClaim; + } + + public QueryPositionsResponsePositionsInner endDate(@jakarta.annotation.Nullable Long endDate) { + this.endDate = endDate; + return this; + } + + /** + * Get endDate + * + * @return endDate + */ + @jakarta.annotation.Nullable + public Long getEndDate() { + return endDate; + } + + public void setEndDate(@jakarta.annotation.Nullable Long endDate) { + this.endDate = endDate; + } + + public QueryPositionsResponsePositionsInner unrealizedPnl( + @jakarta.annotation.Nullable String unrealizedPnl) { + this.unrealizedPnl = unrealizedPnl; + return this; + } + + /** + * Get unrealizedPnl + * + * @return unrealizedPnl + */ + @jakarta.annotation.Nullable + public String getUnrealizedPnl() { + return unrealizedPnl; + } + + public void setUnrealizedPnl(@jakarta.annotation.Nullable String unrealizedPnl) { + this.unrealizedPnl = unrealizedPnl; + } + + public QueryPositionsResponsePositionsInner unrealizedPnlPercent( + @jakarta.annotation.Nullable String unrealizedPnlPercent) { + this.unrealizedPnlPercent = unrealizedPnlPercent; + return this; + } + + /** + * Get unrealizedPnlPercent + * + * @return unrealizedPnlPercent + */ + @jakarta.annotation.Nullable + public String getUnrealizedPnlPercent() { + return unrealizedPnlPercent; + } + + public void setUnrealizedPnlPercent(@jakarta.annotation.Nullable String unrealizedPnlPercent) { + this.unrealizedPnlPercent = unrealizedPnlPercent; + } + + public QueryPositionsResponsePositionsInner realizedPnl( + @jakarta.annotation.Nullable String realizedPnl) { + this.realizedPnl = realizedPnl; + return this; + } + + /** + * Get realizedPnl + * + * @return realizedPnl + */ + @jakarta.annotation.Nullable + public String getRealizedPnl() { + return realizedPnl; + } + + public void setRealizedPnl(@jakarta.annotation.Nullable String realizedPnl) { + this.realizedPnl = realizedPnl; + } + + public QueryPositionsResponsePositionsInner pnl(@jakarta.annotation.Nullable String pnl) { + this.pnl = pnl; + return this; + } + + /** + * Get pnl + * + * @return pnl + */ + @jakarta.annotation.Nullable + public String getPnl() { + return pnl; + } + + public void setPnl(@jakarta.annotation.Nullable String pnl) { + this.pnl = pnl; + } + + public QueryPositionsResponsePositionsInner createdTime( + @jakarta.annotation.Nullable Long createdTime) { + this.createdTime = createdTime; + return this; + } + + /** + * Get createdTime + * + * @return createdTime + */ + @jakarta.annotation.Nullable + public Long getCreatedTime() { + return createdTime; + } + + public void setCreatedTime(@jakarta.annotation.Nullable Long createdTime) { + this.createdTime = createdTime; + } + + public QueryPositionsResponsePositionsInner updatedTime( + @jakarta.annotation.Nullable Long updatedTime) { + this.updatedTime = updatedTime; + return this; + } + + /** + * Get updatedTime + * + * @return updatedTime + */ + @jakarta.annotation.Nullable + public Long getUpdatedTime() { + return updatedTime; + } + + public void setUpdatedTime(@jakarta.annotation.Nullable Long updatedTime) { + this.updatedTime = updatedTime; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + QueryPositionsResponsePositionsInner queryPositionsResponsePositionsInner = + (QueryPositionsResponsePositionsInner) o; + return Objects.equals(this.positionId, queryPositionsResponsePositionsInner.positionId) + && Objects.equals(this.vendor, queryPositionsResponsePositionsInner.vendor) + && Objects.equals(this.chainId, queryPositionsResponsePositionsInner.chainId) + && Objects.equals(this.tokenId, queryPositionsResponsePositionsInner.tokenId) + && Objects.equals( + this.collateralSymbol, + queryPositionsResponsePositionsInner.collateralSymbol) + && Objects.equals(this.topicType, queryPositionsResponsePositionsInner.topicType) + && Objects.equals( + this.marketTopicId, queryPositionsResponsePositionsInner.marketTopicId) + && Objects.equals(this.marketId, queryPositionsResponsePositionsInner.marketId) + && Objects.equals( + this.marketTopicTitle, + queryPositionsResponsePositionsInner.marketTopicTitle) + && Objects.equals( + this.marketTitle, queryPositionsResponsePositionsInner.marketTitle) + && Objects.equals( + this.outcomeName, queryPositionsResponsePositionsInner.outcomeName) + && Objects.equals( + this.outcomeIndex, queryPositionsResponsePositionsInner.outcomeIndex) + && Objects.equals(this.shares, queryPositionsResponsePositionsInner.shares) + && Objects.equals(this.avgPrice, queryPositionsResponsePositionsInner.avgPrice) + && Objects.equals(this.totalCost, queryPositionsResponsePositionsInner.totalCost) + && Objects.equals(this.value, queryPositionsResponsePositionsInner.value) + && Objects.equals( + this.currentPrice, queryPositionsResponsePositionsInner.currentPrice) + && Objects.equals(this.toWin, queryPositionsResponsePositionsInner.toWin) + && Objects.equals( + this.positionStatus, queryPositionsResponsePositionsInner.positionStatus) + && Objects.equals(this.canClaim, queryPositionsResponsePositionsInner.canClaim) + && Objects.equals(this.endDate, queryPositionsResponsePositionsInner.endDate) + && Objects.equals( + this.unrealizedPnl, queryPositionsResponsePositionsInner.unrealizedPnl) + && Objects.equals( + this.unrealizedPnlPercent, + queryPositionsResponsePositionsInner.unrealizedPnlPercent) + && Objects.equals( + this.realizedPnl, queryPositionsResponsePositionsInner.realizedPnl) + && Objects.equals(this.pnl, queryPositionsResponsePositionsInner.pnl) + && Objects.equals( + this.createdTime, queryPositionsResponsePositionsInner.createdTime) + && Objects.equals( + this.updatedTime, queryPositionsResponsePositionsInner.updatedTime); + } + + @Override + public int hashCode() { + return Objects.hash( + positionId, + vendor, + chainId, + tokenId, + collateralSymbol, + topicType, + marketTopicId, + marketId, + marketTopicTitle, + marketTitle, + outcomeName, + outcomeIndex, + shares, + avgPrice, + totalCost, + value, + currentPrice, + toWin, + positionStatus, + canClaim, + endDate, + unrealizedPnl, + unrealizedPnlPercent, + realizedPnl, + pnl, + createdTime, + updatedTime); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class QueryPositionsResponsePositionsInner {\n"); + sb.append(" positionId: ").append(toIndentedString(positionId)).append("\n"); + sb.append(" vendor: ").append(toIndentedString(vendor)).append("\n"); + sb.append(" chainId: ").append(toIndentedString(chainId)).append("\n"); + sb.append(" tokenId: ").append(toIndentedString(tokenId)).append("\n"); + sb.append(" collateralSymbol: ").append(toIndentedString(collateralSymbol)).append("\n"); + sb.append(" topicType: ").append(toIndentedString(topicType)).append("\n"); + sb.append(" marketTopicId: ").append(toIndentedString(marketTopicId)).append("\n"); + sb.append(" marketId: ").append(toIndentedString(marketId)).append("\n"); + sb.append(" marketTopicTitle: ").append(toIndentedString(marketTopicTitle)).append("\n"); + sb.append(" marketTitle: ").append(toIndentedString(marketTitle)).append("\n"); + sb.append(" outcomeName: ").append(toIndentedString(outcomeName)).append("\n"); + sb.append(" outcomeIndex: ").append(toIndentedString(outcomeIndex)).append("\n"); + sb.append(" shares: ").append(toIndentedString(shares)).append("\n"); + sb.append(" avgPrice: ").append(toIndentedString(avgPrice)).append("\n"); + sb.append(" totalCost: ").append(toIndentedString(totalCost)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" currentPrice: ").append(toIndentedString(currentPrice)).append("\n"); + sb.append(" toWin: ").append(toIndentedString(toWin)).append("\n"); + sb.append(" positionStatus: ").append(toIndentedString(positionStatus)).append("\n"); + sb.append(" canClaim: ").append(toIndentedString(canClaim)).append("\n"); + sb.append(" endDate: ").append(toIndentedString(endDate)).append("\n"); + sb.append(" unrealizedPnl: ").append(toIndentedString(unrealizedPnl)).append("\n"); + sb.append(" unrealizedPnlPercent: ") + .append(toIndentedString(unrealizedPnlPercent)) + .append("\n"); + sb.append(" realizedPnl: ").append(toIndentedString(realizedPnl)).append("\n"); + sb.append(" pnl: ").append(toIndentedString(pnl)).append("\n"); + sb.append(" createdTime: ").append(toIndentedString(createdTime)).append("\n"); + sb.append(" updatedTime: ").append(toIndentedString(updatedTime)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object positionIdValue = getPositionId(); + String positionIdValueAsString = ""; + positionIdValueAsString = positionIdValue.toString(); + sb.append("positionId=").append(urlEncode(positionIdValueAsString)).append(""); + Object vendorValue = getVendor(); + String vendorValueAsString = ""; + vendorValueAsString = vendorValue.toString(); + sb.append("vendor=").append(urlEncode(vendorValueAsString)).append(""); + Object chainIdValue = getChainId(); + String chainIdValueAsString = ""; + chainIdValueAsString = chainIdValue.toString(); + sb.append("chainId=").append(urlEncode(chainIdValueAsString)).append(""); + Object tokenIdValue = getTokenId(); + String tokenIdValueAsString = ""; + tokenIdValueAsString = tokenIdValue.toString(); + sb.append("tokenId=").append(urlEncode(tokenIdValueAsString)).append(""); + Object collateralSymbolValue = getCollateralSymbol(); + String collateralSymbolValueAsString = ""; + collateralSymbolValueAsString = collateralSymbolValue.toString(); + sb.append("collateralSymbol=").append(urlEncode(collateralSymbolValueAsString)).append(""); + Object topicTypeValue = getTopicType(); + String topicTypeValueAsString = ""; + topicTypeValueAsString = topicTypeValue.toString(); + sb.append("topicType=").append(urlEncode(topicTypeValueAsString)).append(""); + Object marketTopicIdValue = getMarketTopicId(); + String marketTopicIdValueAsString = ""; + marketTopicIdValueAsString = marketTopicIdValue.toString(); + sb.append("marketTopicId=").append(urlEncode(marketTopicIdValueAsString)).append(""); + Object marketIdValue = getMarketId(); + String marketIdValueAsString = ""; + marketIdValueAsString = marketIdValue.toString(); + sb.append("marketId=").append(urlEncode(marketIdValueAsString)).append(""); + Object marketTopicTitleValue = getMarketTopicTitle(); + String marketTopicTitleValueAsString = ""; + marketTopicTitleValueAsString = marketTopicTitleValue.toString(); + sb.append("marketTopicTitle=").append(urlEncode(marketTopicTitleValueAsString)).append(""); + Object marketTitleValue = getMarketTitle(); + String marketTitleValueAsString = ""; + marketTitleValueAsString = marketTitleValue.toString(); + sb.append("marketTitle=").append(urlEncode(marketTitleValueAsString)).append(""); + Object outcomeNameValue = getOutcomeName(); + String outcomeNameValueAsString = ""; + outcomeNameValueAsString = outcomeNameValue.toString(); + sb.append("outcomeName=").append(urlEncode(outcomeNameValueAsString)).append(""); + Object outcomeIndexValue = getOutcomeIndex(); + String outcomeIndexValueAsString = ""; + outcomeIndexValueAsString = outcomeIndexValue.toString(); + sb.append("outcomeIndex=").append(urlEncode(outcomeIndexValueAsString)).append(""); + Object sharesValue = getShares(); + String sharesValueAsString = ""; + sharesValueAsString = sharesValue.toString(); + sb.append("shares=").append(urlEncode(sharesValueAsString)).append(""); + Object avgPriceValue = getAvgPrice(); + String avgPriceValueAsString = ""; + avgPriceValueAsString = avgPriceValue.toString(); + sb.append("avgPrice=").append(urlEncode(avgPriceValueAsString)).append(""); + Object totalCostValue = getTotalCost(); + String totalCostValueAsString = ""; + totalCostValueAsString = totalCostValue.toString(); + sb.append("totalCost=").append(urlEncode(totalCostValueAsString)).append(""); + Object valueValue = getValue(); + String valueValueAsString = ""; + valueValueAsString = valueValue.toString(); + sb.append("value=").append(urlEncode(valueValueAsString)).append(""); + Object currentPriceValue = getCurrentPrice(); + String currentPriceValueAsString = ""; + currentPriceValueAsString = currentPriceValue.toString(); + sb.append("currentPrice=").append(urlEncode(currentPriceValueAsString)).append(""); + Object toWinValue = getToWin(); + String toWinValueAsString = ""; + toWinValueAsString = toWinValue.toString(); + sb.append("toWin=").append(urlEncode(toWinValueAsString)).append(""); + Object positionStatusValue = getPositionStatus(); + String positionStatusValueAsString = ""; + positionStatusValueAsString = positionStatusValue.toString(); + sb.append("positionStatus=").append(urlEncode(positionStatusValueAsString)).append(""); + Object canClaimValue = getCanClaim(); + String canClaimValueAsString = ""; + canClaimValueAsString = canClaimValue.toString(); + sb.append("canClaim=").append(urlEncode(canClaimValueAsString)).append(""); + Object endDateValue = getEndDate(); + String endDateValueAsString = ""; + endDateValueAsString = endDateValue.toString(); + sb.append("endDate=").append(urlEncode(endDateValueAsString)).append(""); + Object unrealizedPnlValue = getUnrealizedPnl(); + String unrealizedPnlValueAsString = ""; + unrealizedPnlValueAsString = unrealizedPnlValue.toString(); + sb.append("unrealizedPnl=").append(urlEncode(unrealizedPnlValueAsString)).append(""); + Object unrealizedPnlPercentValue = getUnrealizedPnlPercent(); + String unrealizedPnlPercentValueAsString = ""; + unrealizedPnlPercentValueAsString = unrealizedPnlPercentValue.toString(); + sb.append("unrealizedPnlPercent=") + .append(urlEncode(unrealizedPnlPercentValueAsString)) + .append(""); + Object realizedPnlValue = getRealizedPnl(); + String realizedPnlValueAsString = ""; + realizedPnlValueAsString = realizedPnlValue.toString(); + sb.append("realizedPnl=").append(urlEncode(realizedPnlValueAsString)).append(""); + Object pnlValue = getPnl(); + String pnlValueAsString = ""; + pnlValueAsString = pnlValue.toString(); + sb.append("pnl=").append(urlEncode(pnlValueAsString)).append(""); + Object createdTimeValue = getCreatedTime(); + String createdTimeValueAsString = ""; + createdTimeValueAsString = createdTimeValue.toString(); + sb.append("createdTime=").append(urlEncode(createdTimeValueAsString)).append(""); + Object updatedTimeValue = getUpdatedTime(); + String updatedTimeValueAsString = ""; + updatedTimeValueAsString = updatedTimeValue.toString(); + sb.append("updatedTime=").append(urlEncode(updatedTimeValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("positionId"); + openapiFields.add("vendor"); + openapiFields.add("chainId"); + openapiFields.add("tokenId"); + openapiFields.add("collateralSymbol"); + openapiFields.add("topicType"); + openapiFields.add("marketTopicId"); + openapiFields.add("marketId"); + openapiFields.add("marketTopicTitle"); + openapiFields.add("marketTitle"); + openapiFields.add("outcomeName"); + openapiFields.add("outcomeIndex"); + openapiFields.add("shares"); + openapiFields.add("avgPrice"); + openapiFields.add("totalCost"); + openapiFields.add("value"); + openapiFields.add("currentPrice"); + openapiFields.add("toWin"); + openapiFields.add("positionStatus"); + openapiFields.add("canClaim"); + openapiFields.add("endDate"); + openapiFields.add("unrealizedPnl"); + openapiFields.add("unrealizedPnlPercent"); + openapiFields.add("realizedPnl"); + openapiFields.add("pnl"); + openapiFields.add("createdTime"); + openapiFields.add("updatedTime"); + + // 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 + * QueryPositionsResponsePositionsInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!QueryPositionsResponsePositionsInner.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in QueryPositionsResponsePositionsInner" + + " is not found in the empty JSON string", + QueryPositionsResponsePositionsInner.openapiRequiredFields + .toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("vendor") != null && !jsonObj.get("vendor").isJsonNull()) + && !jsonObj.get("vendor").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `vendor` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("vendor").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("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("collateralSymbol") != null + && !jsonObj.get("collateralSymbol").isJsonNull()) + && !jsonObj.get("collateralSymbol").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `collateralSymbol` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("collateralSymbol").toString())); + } + if ((jsonObj.get("topicType") != null && !jsonObj.get("topicType").isJsonNull()) + && !jsonObj.get("topicType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `topicType` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("topicType").toString())); + } + if ((jsonObj.get("marketTopicTitle") != null + && !jsonObj.get("marketTopicTitle").isJsonNull()) + && !jsonObj.get("marketTopicTitle").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `marketTopicTitle` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("marketTopicTitle").toString())); + } + if ((jsonObj.get("marketTitle") != null && !jsonObj.get("marketTitle").isJsonNull()) + && !jsonObj.get("marketTitle").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `marketTitle` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("marketTitle").toString())); + } + if ((jsonObj.get("outcomeName") != null && !jsonObj.get("outcomeName").isJsonNull()) + && !jsonObj.get("outcomeName").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `outcomeName` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("outcomeName").toString())); + } + if ((jsonObj.get("shares") != null && !jsonObj.get("shares").isJsonNull()) + && !jsonObj.get("shares").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `shares` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("shares").toString())); + } + if ((jsonObj.get("avgPrice") != null && !jsonObj.get("avgPrice").isJsonNull()) + && !jsonObj.get("avgPrice").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `avgPrice` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("avgPrice").toString())); + } + if ((jsonObj.get("totalCost") != null && !jsonObj.get("totalCost").isJsonNull()) + && !jsonObj.get("totalCost").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `totalCost` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("totalCost").toString())); + } + if ((jsonObj.get("value") != null && !jsonObj.get("value").isJsonNull()) + && !jsonObj.get("value").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `value` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("value").toString())); + } + if ((jsonObj.get("currentPrice") != null && !jsonObj.get("currentPrice").isJsonNull()) + && !jsonObj.get("currentPrice").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `currentPrice` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("currentPrice").toString())); + } + if ((jsonObj.get("toWin") != null && !jsonObj.get("toWin").isJsonNull()) + && !jsonObj.get("toWin").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `toWin` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("toWin").toString())); + } + if ((jsonObj.get("positionStatus") != null && !jsonObj.get("positionStatus").isJsonNull()) + && !jsonObj.get("positionStatus").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `positionStatus` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("positionStatus").toString())); + } + if ((jsonObj.get("unrealizedPnl") != null && !jsonObj.get("unrealizedPnl").isJsonNull()) + && !jsonObj.get("unrealizedPnl").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `unrealizedPnl` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("unrealizedPnl").toString())); + } + if ((jsonObj.get("unrealizedPnlPercent") != null + && !jsonObj.get("unrealizedPnlPercent").isJsonNull()) + && !jsonObj.get("unrealizedPnlPercent").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `unrealizedPnlPercent` to be a primitive type in" + + " the JSON string but got `%s`", + jsonObj.get("unrealizedPnlPercent").toString())); + } + if ((jsonObj.get("realizedPnl") != null && !jsonObj.get("realizedPnl").isJsonNull()) + && !jsonObj.get("realizedPnl").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `realizedPnl` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("realizedPnl").toString())); + } + if ((jsonObj.get("pnl") != null && !jsonObj.get("pnl").isJsonNull()) + && !jsonObj.get("pnl").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `pnl` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("pnl").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!QueryPositionsResponsePositionsInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'QueryPositionsResponsePositionsInner' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(QueryPositionsResponsePositionsInner.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, QueryPositionsResponsePositionsInner value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public QueryPositionsResponsePositionsInner read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of QueryPositionsResponsePositionsInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of QueryPositionsResponsePositionsInner + * @throws IOException if the JSON string is invalid with respect to + * QueryPositionsResponsePositionsInner + */ + public static QueryPositionsResponsePositionsInner fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, QueryPositionsResponsePositionsInner.class); + } + + /** + * Convert an instance of QueryPositionsResponsePositionsInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryPositionsResponseSummary.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryPositionsResponseSummary.java new file mode 100644 index 000000000..1fdc790c0 --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryPositionsResponseSummary.java @@ -0,0 +1,489 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.model; + +import com.binance.connector.client.w3w_prediction.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.*; + +/** QueryPositionsResponseSummary */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class QueryPositionsResponseSummary { + public static final String SERIALIZED_NAME_TOTAL_VALUE = "totalValue"; + + @SerializedName(SERIALIZED_NAME_TOTAL_VALUE) + @jakarta.annotation.Nullable + private String totalValue; + + public static final String SERIALIZED_NAME_POSITION_VALUE = "positionValue"; + + @SerializedName(SERIALIZED_NAME_POSITION_VALUE) + @jakarta.annotation.Nullable + private String positionValue; + + public static final String SERIALIZED_NAME_WALLET_BALANCE = "walletBalance"; + + @SerializedName(SERIALIZED_NAME_WALLET_BALANCE) + @jakarta.annotation.Nullable + private String walletBalance; + + public static final String SERIALIZED_NAME_TOTAL_CLAIMABLE_AMOUNT = "totalClaimableAmount"; + + @SerializedName(SERIALIZED_NAME_TOTAL_CLAIMABLE_AMOUNT) + @jakarta.annotation.Nullable + private String totalClaimableAmount; + + public static final String SERIALIZED_NAME_TODAY_REALIZED_PNL = "todayRealizedPnl"; + + @SerializedName(SERIALIZED_NAME_TODAY_REALIZED_PNL) + @jakarta.annotation.Nullable + private String todayRealizedPnl; + + public static final String SERIALIZED_NAME_TODAY_REALIZED_PNL_PERCENT = + "todayRealizedPnlPercent"; + + @SerializedName(SERIALIZED_NAME_TODAY_REALIZED_PNL_PERCENT) + @jakarta.annotation.Nullable + private String todayRealizedPnlPercent; + + public static final String SERIALIZED_NAME_TODAY_TOTAL_COST = "todayTotalCost"; + + @SerializedName(SERIALIZED_NAME_TODAY_TOTAL_COST) + @jakarta.annotation.Nullable + private String todayTotalCost; + + public QueryPositionsResponseSummary() {} + + public QueryPositionsResponseSummary totalValue( + @jakarta.annotation.Nullable String totalValue) { + this.totalValue = totalValue; + return this; + } + + /** + * Get totalValue + * + * @return totalValue + */ + @jakarta.annotation.Nullable + public String getTotalValue() { + return totalValue; + } + + public void setTotalValue(@jakarta.annotation.Nullable String totalValue) { + this.totalValue = totalValue; + } + + public QueryPositionsResponseSummary positionValue( + @jakarta.annotation.Nullable String positionValue) { + this.positionValue = positionValue; + return this; + } + + /** + * Get positionValue + * + * @return positionValue + */ + @jakarta.annotation.Nullable + public String getPositionValue() { + return positionValue; + } + + public void setPositionValue(@jakarta.annotation.Nullable String positionValue) { + this.positionValue = positionValue; + } + + public QueryPositionsResponseSummary walletBalance( + @jakarta.annotation.Nullable String walletBalance) { + this.walletBalance = walletBalance; + return this; + } + + /** + * Get walletBalance + * + * @return walletBalance + */ + @jakarta.annotation.Nullable + public String getWalletBalance() { + return walletBalance; + } + + public void setWalletBalance(@jakarta.annotation.Nullable String walletBalance) { + this.walletBalance = walletBalance; + } + + public QueryPositionsResponseSummary totalClaimableAmount( + @jakarta.annotation.Nullable String totalClaimableAmount) { + this.totalClaimableAmount = totalClaimableAmount; + return this; + } + + /** + * Get totalClaimableAmount + * + * @return totalClaimableAmount + */ + @jakarta.annotation.Nullable + public String getTotalClaimableAmount() { + return totalClaimableAmount; + } + + public void setTotalClaimableAmount(@jakarta.annotation.Nullable String totalClaimableAmount) { + this.totalClaimableAmount = totalClaimableAmount; + } + + public QueryPositionsResponseSummary todayRealizedPnl( + @jakarta.annotation.Nullable String todayRealizedPnl) { + this.todayRealizedPnl = todayRealizedPnl; + return this; + } + + /** + * Get todayRealizedPnl + * + * @return todayRealizedPnl + */ + @jakarta.annotation.Nullable + public String getTodayRealizedPnl() { + return todayRealizedPnl; + } + + public void setTodayRealizedPnl(@jakarta.annotation.Nullable String todayRealizedPnl) { + this.todayRealizedPnl = todayRealizedPnl; + } + + public QueryPositionsResponseSummary todayRealizedPnlPercent( + @jakarta.annotation.Nullable String todayRealizedPnlPercent) { + this.todayRealizedPnlPercent = todayRealizedPnlPercent; + return this; + } + + /** + * Get todayRealizedPnlPercent + * + * @return todayRealizedPnlPercent + */ + @jakarta.annotation.Nullable + public String getTodayRealizedPnlPercent() { + return todayRealizedPnlPercent; + } + + public void setTodayRealizedPnlPercent( + @jakarta.annotation.Nullable String todayRealizedPnlPercent) { + this.todayRealizedPnlPercent = todayRealizedPnlPercent; + } + + public QueryPositionsResponseSummary todayTotalCost( + @jakarta.annotation.Nullable String todayTotalCost) { + this.todayTotalCost = todayTotalCost; + return this; + } + + /** + * Get todayTotalCost + * + * @return todayTotalCost + */ + @jakarta.annotation.Nullable + public String getTodayTotalCost() { + return todayTotalCost; + } + + public void setTodayTotalCost(@jakarta.annotation.Nullable String todayTotalCost) { + this.todayTotalCost = todayTotalCost; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + QueryPositionsResponseSummary queryPositionsResponseSummary = + (QueryPositionsResponseSummary) o; + return Objects.equals(this.totalValue, queryPositionsResponseSummary.totalValue) + && Objects.equals(this.positionValue, queryPositionsResponseSummary.positionValue) + && Objects.equals(this.walletBalance, queryPositionsResponseSummary.walletBalance) + && Objects.equals( + this.totalClaimableAmount, + queryPositionsResponseSummary.totalClaimableAmount) + && Objects.equals( + this.todayRealizedPnl, queryPositionsResponseSummary.todayRealizedPnl) + && Objects.equals( + this.todayRealizedPnlPercent, + queryPositionsResponseSummary.todayRealizedPnlPercent) + && Objects.equals( + this.todayTotalCost, queryPositionsResponseSummary.todayTotalCost); + } + + @Override + public int hashCode() { + return Objects.hash( + totalValue, + positionValue, + walletBalance, + totalClaimableAmount, + todayRealizedPnl, + todayRealizedPnlPercent, + todayTotalCost); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class QueryPositionsResponseSummary {\n"); + sb.append(" totalValue: ").append(toIndentedString(totalValue)).append("\n"); + sb.append(" positionValue: ").append(toIndentedString(positionValue)).append("\n"); + sb.append(" walletBalance: ").append(toIndentedString(walletBalance)).append("\n"); + sb.append(" totalClaimableAmount: ") + .append(toIndentedString(totalClaimableAmount)) + .append("\n"); + sb.append(" todayRealizedPnl: ").append(toIndentedString(todayRealizedPnl)).append("\n"); + sb.append(" todayRealizedPnlPercent: ") + .append(toIndentedString(todayRealizedPnlPercent)) + .append("\n"); + sb.append(" todayTotalCost: ").append(toIndentedString(todayTotalCost)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object totalValueValue = getTotalValue(); + String totalValueValueAsString = ""; + totalValueValueAsString = totalValueValue.toString(); + sb.append("totalValue=").append(urlEncode(totalValueValueAsString)).append(""); + Object positionValueValue = getPositionValue(); + String positionValueValueAsString = ""; + positionValueValueAsString = positionValueValue.toString(); + sb.append("positionValue=").append(urlEncode(positionValueValueAsString)).append(""); + Object walletBalanceValue = getWalletBalance(); + String walletBalanceValueAsString = ""; + walletBalanceValueAsString = walletBalanceValue.toString(); + sb.append("walletBalance=").append(urlEncode(walletBalanceValueAsString)).append(""); + Object totalClaimableAmountValue = getTotalClaimableAmount(); + String totalClaimableAmountValueAsString = ""; + totalClaimableAmountValueAsString = totalClaimableAmountValue.toString(); + sb.append("totalClaimableAmount=") + .append(urlEncode(totalClaimableAmountValueAsString)) + .append(""); + Object todayRealizedPnlValue = getTodayRealizedPnl(); + String todayRealizedPnlValueAsString = ""; + todayRealizedPnlValueAsString = todayRealizedPnlValue.toString(); + sb.append("todayRealizedPnl=").append(urlEncode(todayRealizedPnlValueAsString)).append(""); + Object todayRealizedPnlPercentValue = getTodayRealizedPnlPercent(); + String todayRealizedPnlPercentValueAsString = ""; + todayRealizedPnlPercentValueAsString = todayRealizedPnlPercentValue.toString(); + sb.append("todayRealizedPnlPercent=") + .append(urlEncode(todayRealizedPnlPercentValueAsString)) + .append(""); + Object todayTotalCostValue = getTodayTotalCost(); + String todayTotalCostValueAsString = ""; + todayTotalCostValueAsString = todayTotalCostValue.toString(); + sb.append("todayTotalCost=").append(urlEncode(todayTotalCostValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("totalValue"); + openapiFields.add("positionValue"); + openapiFields.add("walletBalance"); + openapiFields.add("totalClaimableAmount"); + openapiFields.add("todayRealizedPnl"); + openapiFields.add("todayRealizedPnlPercent"); + openapiFields.add("todayTotalCost"); + + // 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 + * QueryPositionsResponseSummary + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!QueryPositionsResponseSummary.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in QueryPositionsResponseSummary is not" + + " found in the empty JSON string", + QueryPositionsResponseSummary.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("totalValue") != null && !jsonObj.get("totalValue").isJsonNull()) + && !jsonObj.get("totalValue").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `totalValue` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("totalValue").toString())); + } + if ((jsonObj.get("positionValue") != null && !jsonObj.get("positionValue").isJsonNull()) + && !jsonObj.get("positionValue").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `positionValue` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("positionValue").toString())); + } + if ((jsonObj.get("walletBalance") != null && !jsonObj.get("walletBalance").isJsonNull()) + && !jsonObj.get("walletBalance").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `walletBalance` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("walletBalance").toString())); + } + if ((jsonObj.get("totalClaimableAmount") != null + && !jsonObj.get("totalClaimableAmount").isJsonNull()) + && !jsonObj.get("totalClaimableAmount").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `totalClaimableAmount` to be a primitive type in" + + " the JSON string but got `%s`", + jsonObj.get("totalClaimableAmount").toString())); + } + if ((jsonObj.get("todayRealizedPnl") != null + && !jsonObj.get("todayRealizedPnl").isJsonNull()) + && !jsonObj.get("todayRealizedPnl").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `todayRealizedPnl` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("todayRealizedPnl").toString())); + } + if ((jsonObj.get("todayRealizedPnlPercent") != null + && !jsonObj.get("todayRealizedPnlPercent").isJsonNull()) + && !jsonObj.get("todayRealizedPnlPercent").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `todayRealizedPnlPercent` to be a primitive type in" + + " the JSON string but got `%s`", + jsonObj.get("todayRealizedPnlPercent").toString())); + } + if ((jsonObj.get("todayTotalCost") != null && !jsonObj.get("todayTotalCost").isJsonNull()) + && !jsonObj.get("todayTotalCost").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `todayTotalCost` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("todayTotalCost").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!QueryPositionsResponseSummary.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'QueryPositionsResponseSummary' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(QueryPositionsResponseSummary.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, QueryPositionsResponseSummary value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public QueryPositionsResponseSummary read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of QueryPositionsResponseSummary given an JSON string + * + * @param jsonString JSON string + * @return An instance of QueryPositionsResponseSummary + * @throws IOException if the JSON string is invalid with respect to + * QueryPositionsResponseSummary + */ + public static QueryPositionsResponseSummary fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, QueryPositionsResponseSummary.class); + } + + /** + * Convert an instance of QueryPositionsResponseSummary to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QuerySettledPositionHistoryResponse.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QuerySettledPositionHistoryResponse.java new file mode 100644 index 000000000..f4097081f --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QuerySettledPositionHistoryResponse.java @@ -0,0 +1,286 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.model; + +import com.binance.connector.client.w3w_prediction.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.*; + +/** QuerySettledPositionHistoryResponse */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class QuerySettledPositionHistoryResponse { + public static final String SERIALIZED_NAME_TOTAL_COUNT = "totalCount"; + + @SerializedName(SERIALIZED_NAME_TOTAL_COUNT) + @jakarta.annotation.Nullable + private Integer totalCount; + + public static final String SERIALIZED_NAME_POSITIONS = "positions"; + + @SerializedName(SERIALIZED_NAME_POSITIONS) + @jakarta.annotation.Nullable + private List<@Valid QuerySettledPositionHistoryResponsePositionsInner> positions; + + public QuerySettledPositionHistoryResponse() {} + + public QuerySettledPositionHistoryResponse totalCount( + @jakarta.annotation.Nullable Integer totalCount) { + this.totalCount = totalCount; + return this; + } + + /** + * Get totalCount + * + * @return totalCount + */ + @jakarta.annotation.Nullable + public Integer getTotalCount() { + return totalCount; + } + + public void setTotalCount(@jakarta.annotation.Nullable Integer totalCount) { + this.totalCount = totalCount; + } + + public QuerySettledPositionHistoryResponse positions( + @jakarta.annotation.Nullable + List<@Valid QuerySettledPositionHistoryResponsePositionsInner> positions) { + this.positions = positions; + return this; + } + + public QuerySettledPositionHistoryResponse addPositionsItem( + QuerySettledPositionHistoryResponsePositionsInner positionsItem) { + if (this.positions == null) { + this.positions = new ArrayList<>(); + } + this.positions.add(positionsItem); + return this; + } + + /** + * Get positions + * + * @return positions + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid QuerySettledPositionHistoryResponsePositionsInner> getPositions() { + return positions; + } + + public void setPositions( + @jakarta.annotation.Nullable + List<@Valid QuerySettledPositionHistoryResponsePositionsInner> positions) { + this.positions = positions; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + QuerySettledPositionHistoryResponse querySettledPositionHistoryResponse = + (QuerySettledPositionHistoryResponse) o; + return Objects.equals(this.totalCount, querySettledPositionHistoryResponse.totalCount) + && Objects.equals(this.positions, querySettledPositionHistoryResponse.positions); + } + + @Override + public int hashCode() { + return Objects.hash(totalCount, positions); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class QuerySettledPositionHistoryResponse {\n"); + sb.append(" totalCount: ").append(toIndentedString(totalCount)).append("\n"); + sb.append(" positions: ").append(toIndentedString(positions)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object totalCountValue = getTotalCount(); + String totalCountValueAsString = ""; + totalCountValueAsString = totalCountValue.toString(); + sb.append("totalCount=").append(urlEncode(totalCountValueAsString)).append(""); + Object positionsValue = getPositions(); + String positionsValueAsString = ""; + positionsValueAsString = + (String) + ((Collection) positionsValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("positions=").append(urlEncode(positionsValueAsString)).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("totalCount"); + openapiFields.add("positions"); + + // 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 + * QuerySettledPositionHistoryResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!QuerySettledPositionHistoryResponse.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in QuerySettledPositionHistoryResponse is" + + " not found in the empty JSON string", + QuerySettledPositionHistoryResponse.openapiRequiredFields + .toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("positions") != null && !jsonObj.get("positions").isJsonNull()) { + JsonArray jsonArraypositions = jsonObj.getAsJsonArray("positions"); + if (jsonArraypositions != null) { + // ensure the json data is an array + if (!jsonObj.get("positions").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `positions` to be an array in the JSON" + + " string but got `%s`", + jsonObj.get("positions").toString())); + } + + // validate the optional field `positions` (array) + for (int i = 0; i < jsonArraypositions.size(); i++) { + QuerySettledPositionHistoryResponsePositionsInner.validateJsonElement( + jsonArraypositions.get(i)); + } + ; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!QuerySettledPositionHistoryResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'QuerySettledPositionHistoryResponse' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(QuerySettledPositionHistoryResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, QuerySettledPositionHistoryResponse value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public QuerySettledPositionHistoryResponse read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of QuerySettledPositionHistoryResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of QuerySettledPositionHistoryResponse + * @throws IOException if the JSON string is invalid with respect to + * QuerySettledPositionHistoryResponse + */ + public static QuerySettledPositionHistoryResponse fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, QuerySettledPositionHistoryResponse.class); + } + + /** + * Convert an instance of QuerySettledPositionHistoryResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QuerySettledPositionHistoryResponsePositionsInner.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QuerySettledPositionHistoryResponsePositionsInner.java new file mode 100644 index 000000000..de2732921 --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QuerySettledPositionHistoryResponsePositionsInner.java @@ -0,0 +1,1378 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.model; + +import com.binance.connector.client.w3w_prediction.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.*; + +/** QuerySettledPositionHistoryResponsePositionsInner */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class QuerySettledPositionHistoryResponsePositionsInner { + public static final String SERIALIZED_NAME_POSITION_ID = "positionId"; + + @SerializedName(SERIALIZED_NAME_POSITION_ID) + @jakarta.annotation.Nullable + private Long positionId; + + public static final String SERIALIZED_NAME_VENDOR = "vendor"; + + @SerializedName(SERIALIZED_NAME_VENDOR) + @jakarta.annotation.Nullable + private String vendor; + + 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_TOKEN_ID = "tokenId"; + + @SerializedName(SERIALIZED_NAME_TOKEN_ID) + @jakarta.annotation.Nullable + private String tokenId; + + public static final String SERIALIZED_NAME_COLLATERAL_SYMBOL = "collateralSymbol"; + + @SerializedName(SERIALIZED_NAME_COLLATERAL_SYMBOL) + @jakarta.annotation.Nullable + private String collateralSymbol; + + public static final String SERIALIZED_NAME_TOPIC_TYPE = "topicType"; + + @SerializedName(SERIALIZED_NAME_TOPIC_TYPE) + @jakarta.annotation.Nullable + private String topicType; + + public static final String SERIALIZED_NAME_MARKET_TOPIC_ID = "marketTopicId"; + + @SerializedName(SERIALIZED_NAME_MARKET_TOPIC_ID) + @jakarta.annotation.Nullable + private Long marketTopicId; + + public static final String SERIALIZED_NAME_MARKET_ID = "marketId"; + + @SerializedName(SERIALIZED_NAME_MARKET_ID) + @jakarta.annotation.Nullable + private Long marketId; + + public static final String SERIALIZED_NAME_MARKET_TOPIC_TITLE = "marketTopicTitle"; + + @SerializedName(SERIALIZED_NAME_MARKET_TOPIC_TITLE) + @jakarta.annotation.Nullable + private String marketTopicTitle; + + public static final String SERIALIZED_NAME_MARKET_TITLE = "marketTitle"; + + @SerializedName(SERIALIZED_NAME_MARKET_TITLE) + @jakarta.annotation.Nullable + private String marketTitle; + + public static final String SERIALIZED_NAME_OUTCOME_NAME = "outcomeName"; + + @SerializedName(SERIALIZED_NAME_OUTCOME_NAME) + @jakarta.annotation.Nullable + private String outcomeName; + + public static final String SERIALIZED_NAME_OUTCOME_INDEX = "outcomeIndex"; + + @SerializedName(SERIALIZED_NAME_OUTCOME_INDEX) + @jakarta.annotation.Nullable + private Integer outcomeIndex; + + public static final String SERIALIZED_NAME_SHARES = "shares"; + + @SerializedName(SERIALIZED_NAME_SHARES) + @jakarta.annotation.Nullable + private String shares; + + public static final String SERIALIZED_NAME_AVG_PRICE = "avgPrice"; + + @SerializedName(SERIALIZED_NAME_AVG_PRICE) + @jakarta.annotation.Nullable + private String avgPrice; + + public static final String SERIALIZED_NAME_TOTAL_COST = "totalCost"; + + @SerializedName(SERIALIZED_NAME_TOTAL_COST) + @jakarta.annotation.Nullable + private String totalCost; + + public static final String SERIALIZED_NAME_VALUE = "value"; + + @SerializedName(SERIALIZED_NAME_VALUE) + @jakarta.annotation.Nullable + private String value; + + public static final String SERIALIZED_NAME_CURRENT_PRICE = "currentPrice"; + + @SerializedName(SERIALIZED_NAME_CURRENT_PRICE) + @jakarta.annotation.Nullable + private String currentPrice; + + public static final String SERIALIZED_NAME_TO_WIN = "toWin"; + + @SerializedName(SERIALIZED_NAME_TO_WIN) + @jakarta.annotation.Nullable + private String toWin; + + public static final String SERIALIZED_NAME_POSITION_STATUS = "positionStatus"; + + @SerializedName(SERIALIZED_NAME_POSITION_STATUS) + @jakarta.annotation.Nullable + private String positionStatus; + + public static final String SERIALIZED_NAME_IS_WINNER = "isWinner"; + + @SerializedName(SERIALIZED_NAME_IS_WINNER) + @jakarta.annotation.Nullable + private Boolean isWinner; + + public static final String SERIALIZED_NAME_REDEEM_STATUS = "redeemStatus"; + + @SerializedName(SERIALIZED_NAME_REDEEM_STATUS) + @jakarta.annotation.Nullable + private String redeemStatus; + + public static final String SERIALIZED_NAME_END_DATE = "endDate"; + + @SerializedName(SERIALIZED_NAME_END_DATE) + @jakarta.annotation.Nullable + private Long endDate; + + public static final String SERIALIZED_NAME_FINAL_OUTCOME = "finalOutcome"; + + @SerializedName(SERIALIZED_NAME_FINAL_OUTCOME) + @jakarta.annotation.Nullable + private String finalOutcome; + + public static final String SERIALIZED_NAME_REALIZED_PNL = "realizedPnl"; + + @SerializedName(SERIALIZED_NAME_REALIZED_PNL) + @jakarta.annotation.Nullable + private String realizedPnl; + + public static final String SERIALIZED_NAME_PNL = "pnl"; + + @SerializedName(SERIALIZED_NAME_PNL) + @jakarta.annotation.Nullable + private String pnl; + + public static final String SERIALIZED_NAME_CLAIM_AMOUNT = "claimAmount"; + + @SerializedName(SERIALIZED_NAME_CLAIM_AMOUNT) + @jakarta.annotation.Nullable + private String claimAmount; + + public static final String SERIALIZED_NAME_SETTLED_DATE = "settledDate"; + + @SerializedName(SERIALIZED_NAME_SETTLED_DATE) + @jakarta.annotation.Nullable + private Long settledDate; + + public static final String SERIALIZED_NAME_CREATED_TIME = "createdTime"; + + @SerializedName(SERIALIZED_NAME_CREATED_TIME) + @jakarta.annotation.Nullable + private Long createdTime; + + public static final String SERIALIZED_NAME_UPDATED_TIME = "updatedTime"; + + @SerializedName(SERIALIZED_NAME_UPDATED_TIME) + @jakarta.annotation.Nullable + private Long updatedTime; + + public QuerySettledPositionHistoryResponsePositionsInner() {} + + public QuerySettledPositionHistoryResponsePositionsInner positionId( + @jakarta.annotation.Nullable Long positionId) { + this.positionId = positionId; + return this; + } + + /** + * Get positionId + * + * @return positionId + */ + @jakarta.annotation.Nullable + public Long getPositionId() { + return positionId; + } + + public void setPositionId(@jakarta.annotation.Nullable Long positionId) { + this.positionId = positionId; + } + + public QuerySettledPositionHistoryResponsePositionsInner vendor( + @jakarta.annotation.Nullable String vendor) { + this.vendor = vendor; + return this; + } + + /** + * Get vendor + * + * @return vendor + */ + @jakarta.annotation.Nullable + public String getVendor() { + return vendor; + } + + public void setVendor(@jakarta.annotation.Nullable String vendor) { + this.vendor = vendor; + } + + public QuerySettledPositionHistoryResponsePositionsInner 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 QuerySettledPositionHistoryResponsePositionsInner 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 QuerySettledPositionHistoryResponsePositionsInner collateralSymbol( + @jakarta.annotation.Nullable String collateralSymbol) { + this.collateralSymbol = collateralSymbol; + return this; + } + + /** + * Get collateralSymbol + * + * @return collateralSymbol + */ + @jakarta.annotation.Nullable + public String getCollateralSymbol() { + return collateralSymbol; + } + + public void setCollateralSymbol(@jakarta.annotation.Nullable String collateralSymbol) { + this.collateralSymbol = collateralSymbol; + } + + public QuerySettledPositionHistoryResponsePositionsInner topicType( + @jakarta.annotation.Nullable String topicType) { + this.topicType = topicType; + return this; + } + + /** + * Get topicType + * + * @return topicType + */ + @jakarta.annotation.Nullable + public String getTopicType() { + return topicType; + } + + public void setTopicType(@jakarta.annotation.Nullable String topicType) { + this.topicType = topicType; + } + + public QuerySettledPositionHistoryResponsePositionsInner marketTopicId( + @jakarta.annotation.Nullable Long marketTopicId) { + this.marketTopicId = marketTopicId; + return this; + } + + /** + * Get marketTopicId + * + * @return marketTopicId + */ + @jakarta.annotation.Nullable + public Long getMarketTopicId() { + return marketTopicId; + } + + public void setMarketTopicId(@jakarta.annotation.Nullable Long marketTopicId) { + this.marketTopicId = marketTopicId; + } + + public QuerySettledPositionHistoryResponsePositionsInner marketId( + @jakarta.annotation.Nullable Long marketId) { + this.marketId = marketId; + return this; + } + + /** + * Get marketId + * + * @return marketId + */ + @jakarta.annotation.Nullable + public Long getMarketId() { + return marketId; + } + + public void setMarketId(@jakarta.annotation.Nullable Long marketId) { + this.marketId = marketId; + } + + public QuerySettledPositionHistoryResponsePositionsInner marketTopicTitle( + @jakarta.annotation.Nullable String marketTopicTitle) { + this.marketTopicTitle = marketTopicTitle; + return this; + } + + /** + * Get marketTopicTitle + * + * @return marketTopicTitle + */ + @jakarta.annotation.Nullable + public String getMarketTopicTitle() { + return marketTopicTitle; + } + + public void setMarketTopicTitle(@jakarta.annotation.Nullable String marketTopicTitle) { + this.marketTopicTitle = marketTopicTitle; + } + + public QuerySettledPositionHistoryResponsePositionsInner marketTitle( + @jakarta.annotation.Nullable String marketTitle) { + this.marketTitle = marketTitle; + return this; + } + + /** + * Get marketTitle + * + * @return marketTitle + */ + @jakarta.annotation.Nullable + public String getMarketTitle() { + return marketTitle; + } + + public void setMarketTitle(@jakarta.annotation.Nullable String marketTitle) { + this.marketTitle = marketTitle; + } + + public QuerySettledPositionHistoryResponsePositionsInner outcomeName( + @jakarta.annotation.Nullable String outcomeName) { + this.outcomeName = outcomeName; + return this; + } + + /** + * Get outcomeName + * + * @return outcomeName + */ + @jakarta.annotation.Nullable + public String getOutcomeName() { + return outcomeName; + } + + public void setOutcomeName(@jakarta.annotation.Nullable String outcomeName) { + this.outcomeName = outcomeName; + } + + public QuerySettledPositionHistoryResponsePositionsInner outcomeIndex( + @jakarta.annotation.Nullable Integer outcomeIndex) { + this.outcomeIndex = outcomeIndex; + return this; + } + + /** + * Get outcomeIndex + * + * @return outcomeIndex + */ + @jakarta.annotation.Nullable + public Integer getOutcomeIndex() { + return outcomeIndex; + } + + public void setOutcomeIndex(@jakarta.annotation.Nullable Integer outcomeIndex) { + this.outcomeIndex = outcomeIndex; + } + + public QuerySettledPositionHistoryResponsePositionsInner shares( + @jakarta.annotation.Nullable String shares) { + this.shares = shares; + return this; + } + + /** + * Get shares + * + * @return shares + */ + @jakarta.annotation.Nullable + public String getShares() { + return shares; + } + + public void setShares(@jakarta.annotation.Nullable String shares) { + this.shares = shares; + } + + public QuerySettledPositionHistoryResponsePositionsInner avgPrice( + @jakarta.annotation.Nullable String avgPrice) { + this.avgPrice = avgPrice; + return this; + } + + /** + * Get avgPrice + * + * @return avgPrice + */ + @jakarta.annotation.Nullable + public String getAvgPrice() { + return avgPrice; + } + + public void setAvgPrice(@jakarta.annotation.Nullable String avgPrice) { + this.avgPrice = avgPrice; + } + + public QuerySettledPositionHistoryResponsePositionsInner totalCost( + @jakarta.annotation.Nullable String totalCost) { + this.totalCost = totalCost; + return this; + } + + /** + * Get totalCost + * + * @return totalCost + */ + @jakarta.annotation.Nullable + public String getTotalCost() { + return totalCost; + } + + public void setTotalCost(@jakarta.annotation.Nullable String totalCost) { + this.totalCost = totalCost; + } + + public QuerySettledPositionHistoryResponsePositionsInner value( + @jakarta.annotation.Nullable String value) { + this.value = value; + return this; + } + + /** + * Get value + * + * @return value + */ + @jakarta.annotation.Nullable + public String getValue() { + return value; + } + + public void setValue(@jakarta.annotation.Nullable String value) { + this.value = value; + } + + public QuerySettledPositionHistoryResponsePositionsInner currentPrice( + @jakarta.annotation.Nullable String currentPrice) { + this.currentPrice = currentPrice; + return this; + } + + /** + * Get currentPrice + * + * @return currentPrice + */ + @jakarta.annotation.Nullable + public String getCurrentPrice() { + return currentPrice; + } + + public void setCurrentPrice(@jakarta.annotation.Nullable String currentPrice) { + this.currentPrice = currentPrice; + } + + public QuerySettledPositionHistoryResponsePositionsInner toWin( + @jakarta.annotation.Nullable String toWin) { + this.toWin = toWin; + return this; + } + + /** + * Get toWin + * + * @return toWin + */ + @jakarta.annotation.Nullable + public String getToWin() { + return toWin; + } + + public void setToWin(@jakarta.annotation.Nullable String toWin) { + this.toWin = toWin; + } + + public QuerySettledPositionHistoryResponsePositionsInner positionStatus( + @jakarta.annotation.Nullable String positionStatus) { + this.positionStatus = positionStatus; + return this; + } + + /** + * Get positionStatus + * + * @return positionStatus + */ + @jakarta.annotation.Nullable + public String getPositionStatus() { + return positionStatus; + } + + public void setPositionStatus(@jakarta.annotation.Nullable String positionStatus) { + this.positionStatus = positionStatus; + } + + public QuerySettledPositionHistoryResponsePositionsInner isWinner( + @jakarta.annotation.Nullable Boolean isWinner) { + this.isWinner = isWinner; + return this; + } + + /** + * Get isWinner + * + * @return isWinner + */ + @jakarta.annotation.Nullable + public Boolean getIsWinner() { + return isWinner; + } + + public void setIsWinner(@jakarta.annotation.Nullable Boolean isWinner) { + this.isWinner = isWinner; + } + + public QuerySettledPositionHistoryResponsePositionsInner redeemStatus( + @jakarta.annotation.Nullable String redeemStatus) { + this.redeemStatus = redeemStatus; + return this; + } + + /** + * Get redeemStatus + * + * @return redeemStatus + */ + @jakarta.annotation.Nullable + public String getRedeemStatus() { + return redeemStatus; + } + + public void setRedeemStatus(@jakarta.annotation.Nullable String redeemStatus) { + this.redeemStatus = redeemStatus; + } + + public QuerySettledPositionHistoryResponsePositionsInner endDate( + @jakarta.annotation.Nullable Long endDate) { + this.endDate = endDate; + return this; + } + + /** + * Get endDate + * + * @return endDate + */ + @jakarta.annotation.Nullable + public Long getEndDate() { + return endDate; + } + + public void setEndDate(@jakarta.annotation.Nullable Long endDate) { + this.endDate = endDate; + } + + public QuerySettledPositionHistoryResponsePositionsInner finalOutcome( + @jakarta.annotation.Nullable String finalOutcome) { + this.finalOutcome = finalOutcome; + return this; + } + + /** + * Get finalOutcome + * + * @return finalOutcome + */ + @jakarta.annotation.Nullable + public String getFinalOutcome() { + return finalOutcome; + } + + public void setFinalOutcome(@jakarta.annotation.Nullable String finalOutcome) { + this.finalOutcome = finalOutcome; + } + + public QuerySettledPositionHistoryResponsePositionsInner realizedPnl( + @jakarta.annotation.Nullable String realizedPnl) { + this.realizedPnl = realizedPnl; + return this; + } + + /** + * Get realizedPnl + * + * @return realizedPnl + */ + @jakarta.annotation.Nullable + public String getRealizedPnl() { + return realizedPnl; + } + + public void setRealizedPnl(@jakarta.annotation.Nullable String realizedPnl) { + this.realizedPnl = realizedPnl; + } + + public QuerySettledPositionHistoryResponsePositionsInner pnl( + @jakarta.annotation.Nullable String pnl) { + this.pnl = pnl; + return this; + } + + /** + * Get pnl + * + * @return pnl + */ + @jakarta.annotation.Nullable + public String getPnl() { + return pnl; + } + + public void setPnl(@jakarta.annotation.Nullable String pnl) { + this.pnl = pnl; + } + + public QuerySettledPositionHistoryResponsePositionsInner claimAmount( + @jakarta.annotation.Nullable String claimAmount) { + this.claimAmount = claimAmount; + return this; + } + + /** + * Get claimAmount + * + * @return claimAmount + */ + @jakarta.annotation.Nullable + public String getClaimAmount() { + return claimAmount; + } + + public void setClaimAmount(@jakarta.annotation.Nullable String claimAmount) { + this.claimAmount = claimAmount; + } + + public QuerySettledPositionHistoryResponsePositionsInner settledDate( + @jakarta.annotation.Nullable Long settledDate) { + this.settledDate = settledDate; + return this; + } + + /** + * Get settledDate + * + * @return settledDate + */ + @jakarta.annotation.Nullable + public Long getSettledDate() { + return settledDate; + } + + public void setSettledDate(@jakarta.annotation.Nullable Long settledDate) { + this.settledDate = settledDate; + } + + public QuerySettledPositionHistoryResponsePositionsInner createdTime( + @jakarta.annotation.Nullable Long createdTime) { + this.createdTime = createdTime; + return this; + } + + /** + * Get createdTime + * + * @return createdTime + */ + @jakarta.annotation.Nullable + public Long getCreatedTime() { + return createdTime; + } + + public void setCreatedTime(@jakarta.annotation.Nullable Long createdTime) { + this.createdTime = createdTime; + } + + public QuerySettledPositionHistoryResponsePositionsInner updatedTime( + @jakarta.annotation.Nullable Long updatedTime) { + this.updatedTime = updatedTime; + return this; + } + + /** + * Get updatedTime + * + * @return updatedTime + */ + @jakarta.annotation.Nullable + public Long getUpdatedTime() { + return updatedTime; + } + + public void setUpdatedTime(@jakarta.annotation.Nullable Long updatedTime) { + this.updatedTime = updatedTime; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + QuerySettledPositionHistoryResponsePositionsInner + querySettledPositionHistoryResponsePositionsInner = + (QuerySettledPositionHistoryResponsePositionsInner) o; + return Objects.equals( + this.positionId, + querySettledPositionHistoryResponsePositionsInner.positionId) + && Objects.equals( + this.vendor, querySettledPositionHistoryResponsePositionsInner.vendor) + && Objects.equals( + this.chainId, querySettledPositionHistoryResponsePositionsInner.chainId) + && Objects.equals( + this.tokenId, querySettledPositionHistoryResponsePositionsInner.tokenId) + && Objects.equals( + this.collateralSymbol, + querySettledPositionHistoryResponsePositionsInner.collateralSymbol) + && Objects.equals( + this.topicType, querySettledPositionHistoryResponsePositionsInner.topicType) + && Objects.equals( + this.marketTopicId, + querySettledPositionHistoryResponsePositionsInner.marketTopicId) + && Objects.equals( + this.marketId, querySettledPositionHistoryResponsePositionsInner.marketId) + && Objects.equals( + this.marketTopicTitle, + querySettledPositionHistoryResponsePositionsInner.marketTopicTitle) + && Objects.equals( + this.marketTitle, + querySettledPositionHistoryResponsePositionsInner.marketTitle) + && Objects.equals( + this.outcomeName, + querySettledPositionHistoryResponsePositionsInner.outcomeName) + && Objects.equals( + this.outcomeIndex, + querySettledPositionHistoryResponsePositionsInner.outcomeIndex) + && Objects.equals( + this.shares, querySettledPositionHistoryResponsePositionsInner.shares) + && Objects.equals( + this.avgPrice, querySettledPositionHistoryResponsePositionsInner.avgPrice) + && Objects.equals( + this.totalCost, querySettledPositionHistoryResponsePositionsInner.totalCost) + && Objects.equals( + this.value, querySettledPositionHistoryResponsePositionsInner.value) + && Objects.equals( + this.currentPrice, + querySettledPositionHistoryResponsePositionsInner.currentPrice) + && Objects.equals( + this.toWin, querySettledPositionHistoryResponsePositionsInner.toWin) + && Objects.equals( + this.positionStatus, + querySettledPositionHistoryResponsePositionsInner.positionStatus) + && Objects.equals( + this.isWinner, querySettledPositionHistoryResponsePositionsInner.isWinner) + && Objects.equals( + this.redeemStatus, + querySettledPositionHistoryResponsePositionsInner.redeemStatus) + && Objects.equals( + this.endDate, querySettledPositionHistoryResponsePositionsInner.endDate) + && Objects.equals( + this.finalOutcome, + querySettledPositionHistoryResponsePositionsInner.finalOutcome) + && Objects.equals( + this.realizedPnl, + querySettledPositionHistoryResponsePositionsInner.realizedPnl) + && Objects.equals(this.pnl, querySettledPositionHistoryResponsePositionsInner.pnl) + && Objects.equals( + this.claimAmount, + querySettledPositionHistoryResponsePositionsInner.claimAmount) + && Objects.equals( + this.settledDate, + querySettledPositionHistoryResponsePositionsInner.settledDate) + && Objects.equals( + this.createdTime, + querySettledPositionHistoryResponsePositionsInner.createdTime) + && Objects.equals( + this.updatedTime, + querySettledPositionHistoryResponsePositionsInner.updatedTime); + } + + @Override + public int hashCode() { + return Objects.hash( + positionId, + vendor, + chainId, + tokenId, + collateralSymbol, + topicType, + marketTopicId, + marketId, + marketTopicTitle, + marketTitle, + outcomeName, + outcomeIndex, + shares, + avgPrice, + totalCost, + value, + currentPrice, + toWin, + positionStatus, + isWinner, + redeemStatus, + endDate, + finalOutcome, + realizedPnl, + pnl, + claimAmount, + settledDate, + createdTime, + updatedTime); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class QuerySettledPositionHistoryResponsePositionsInner {\n"); + sb.append(" positionId: ").append(toIndentedString(positionId)).append("\n"); + sb.append(" vendor: ").append(toIndentedString(vendor)).append("\n"); + sb.append(" chainId: ").append(toIndentedString(chainId)).append("\n"); + sb.append(" tokenId: ").append(toIndentedString(tokenId)).append("\n"); + sb.append(" collateralSymbol: ").append(toIndentedString(collateralSymbol)).append("\n"); + sb.append(" topicType: ").append(toIndentedString(topicType)).append("\n"); + sb.append(" marketTopicId: ").append(toIndentedString(marketTopicId)).append("\n"); + sb.append(" marketId: ").append(toIndentedString(marketId)).append("\n"); + sb.append(" marketTopicTitle: ").append(toIndentedString(marketTopicTitle)).append("\n"); + sb.append(" marketTitle: ").append(toIndentedString(marketTitle)).append("\n"); + sb.append(" outcomeName: ").append(toIndentedString(outcomeName)).append("\n"); + sb.append(" outcomeIndex: ").append(toIndentedString(outcomeIndex)).append("\n"); + sb.append(" shares: ").append(toIndentedString(shares)).append("\n"); + sb.append(" avgPrice: ").append(toIndentedString(avgPrice)).append("\n"); + sb.append(" totalCost: ").append(toIndentedString(totalCost)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" currentPrice: ").append(toIndentedString(currentPrice)).append("\n"); + sb.append(" toWin: ").append(toIndentedString(toWin)).append("\n"); + sb.append(" positionStatus: ").append(toIndentedString(positionStatus)).append("\n"); + sb.append(" isWinner: ").append(toIndentedString(isWinner)).append("\n"); + sb.append(" redeemStatus: ").append(toIndentedString(redeemStatus)).append("\n"); + sb.append(" endDate: ").append(toIndentedString(endDate)).append("\n"); + sb.append(" finalOutcome: ").append(toIndentedString(finalOutcome)).append("\n"); + sb.append(" realizedPnl: ").append(toIndentedString(realizedPnl)).append("\n"); + sb.append(" pnl: ").append(toIndentedString(pnl)).append("\n"); + sb.append(" claimAmount: ").append(toIndentedString(claimAmount)).append("\n"); + sb.append(" settledDate: ").append(toIndentedString(settledDate)).append("\n"); + sb.append(" createdTime: ").append(toIndentedString(createdTime)).append("\n"); + sb.append(" updatedTime: ").append(toIndentedString(updatedTime)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object positionIdValue = getPositionId(); + String positionIdValueAsString = ""; + positionIdValueAsString = positionIdValue.toString(); + sb.append("positionId=").append(urlEncode(positionIdValueAsString)).append(""); + Object vendorValue = getVendor(); + String vendorValueAsString = ""; + vendorValueAsString = vendorValue.toString(); + sb.append("vendor=").append(urlEncode(vendorValueAsString)).append(""); + Object chainIdValue = getChainId(); + String chainIdValueAsString = ""; + chainIdValueAsString = chainIdValue.toString(); + sb.append("chainId=").append(urlEncode(chainIdValueAsString)).append(""); + Object tokenIdValue = getTokenId(); + String tokenIdValueAsString = ""; + tokenIdValueAsString = tokenIdValue.toString(); + sb.append("tokenId=").append(urlEncode(tokenIdValueAsString)).append(""); + Object collateralSymbolValue = getCollateralSymbol(); + String collateralSymbolValueAsString = ""; + collateralSymbolValueAsString = collateralSymbolValue.toString(); + sb.append("collateralSymbol=").append(urlEncode(collateralSymbolValueAsString)).append(""); + Object topicTypeValue = getTopicType(); + String topicTypeValueAsString = ""; + topicTypeValueAsString = topicTypeValue.toString(); + sb.append("topicType=").append(urlEncode(topicTypeValueAsString)).append(""); + Object marketTopicIdValue = getMarketTopicId(); + String marketTopicIdValueAsString = ""; + marketTopicIdValueAsString = marketTopicIdValue.toString(); + sb.append("marketTopicId=").append(urlEncode(marketTopicIdValueAsString)).append(""); + Object marketIdValue = getMarketId(); + String marketIdValueAsString = ""; + marketIdValueAsString = marketIdValue.toString(); + sb.append("marketId=").append(urlEncode(marketIdValueAsString)).append(""); + Object marketTopicTitleValue = getMarketTopicTitle(); + String marketTopicTitleValueAsString = ""; + marketTopicTitleValueAsString = marketTopicTitleValue.toString(); + sb.append("marketTopicTitle=").append(urlEncode(marketTopicTitleValueAsString)).append(""); + Object marketTitleValue = getMarketTitle(); + String marketTitleValueAsString = ""; + marketTitleValueAsString = marketTitleValue.toString(); + sb.append("marketTitle=").append(urlEncode(marketTitleValueAsString)).append(""); + Object outcomeNameValue = getOutcomeName(); + String outcomeNameValueAsString = ""; + outcomeNameValueAsString = outcomeNameValue.toString(); + sb.append("outcomeName=").append(urlEncode(outcomeNameValueAsString)).append(""); + Object outcomeIndexValue = getOutcomeIndex(); + String outcomeIndexValueAsString = ""; + outcomeIndexValueAsString = outcomeIndexValue.toString(); + sb.append("outcomeIndex=").append(urlEncode(outcomeIndexValueAsString)).append(""); + Object sharesValue = getShares(); + String sharesValueAsString = ""; + sharesValueAsString = sharesValue.toString(); + sb.append("shares=").append(urlEncode(sharesValueAsString)).append(""); + Object avgPriceValue = getAvgPrice(); + String avgPriceValueAsString = ""; + avgPriceValueAsString = avgPriceValue.toString(); + sb.append("avgPrice=").append(urlEncode(avgPriceValueAsString)).append(""); + Object totalCostValue = getTotalCost(); + String totalCostValueAsString = ""; + totalCostValueAsString = totalCostValue.toString(); + sb.append("totalCost=").append(urlEncode(totalCostValueAsString)).append(""); + Object valueValue = getValue(); + String valueValueAsString = ""; + valueValueAsString = valueValue.toString(); + sb.append("value=").append(urlEncode(valueValueAsString)).append(""); + Object currentPriceValue = getCurrentPrice(); + String currentPriceValueAsString = ""; + currentPriceValueAsString = currentPriceValue.toString(); + sb.append("currentPrice=").append(urlEncode(currentPriceValueAsString)).append(""); + Object toWinValue = getToWin(); + String toWinValueAsString = ""; + toWinValueAsString = toWinValue.toString(); + sb.append("toWin=").append(urlEncode(toWinValueAsString)).append(""); + Object positionStatusValue = getPositionStatus(); + String positionStatusValueAsString = ""; + positionStatusValueAsString = positionStatusValue.toString(); + sb.append("positionStatus=").append(urlEncode(positionStatusValueAsString)).append(""); + Object isWinnerValue = getIsWinner(); + String isWinnerValueAsString = ""; + isWinnerValueAsString = isWinnerValue.toString(); + sb.append("isWinner=").append(urlEncode(isWinnerValueAsString)).append(""); + Object redeemStatusValue = getRedeemStatus(); + String redeemStatusValueAsString = ""; + redeemStatusValueAsString = redeemStatusValue.toString(); + sb.append("redeemStatus=").append(urlEncode(redeemStatusValueAsString)).append(""); + Object endDateValue = getEndDate(); + String endDateValueAsString = ""; + endDateValueAsString = endDateValue.toString(); + sb.append("endDate=").append(urlEncode(endDateValueAsString)).append(""); + Object finalOutcomeValue = getFinalOutcome(); + String finalOutcomeValueAsString = ""; + finalOutcomeValueAsString = finalOutcomeValue.toString(); + sb.append("finalOutcome=").append(urlEncode(finalOutcomeValueAsString)).append(""); + Object realizedPnlValue = getRealizedPnl(); + String realizedPnlValueAsString = ""; + realizedPnlValueAsString = realizedPnlValue.toString(); + sb.append("realizedPnl=").append(urlEncode(realizedPnlValueAsString)).append(""); + Object pnlValue = getPnl(); + String pnlValueAsString = ""; + pnlValueAsString = pnlValue.toString(); + sb.append("pnl=").append(urlEncode(pnlValueAsString)).append(""); + Object claimAmountValue = getClaimAmount(); + String claimAmountValueAsString = ""; + claimAmountValueAsString = claimAmountValue.toString(); + sb.append("claimAmount=").append(urlEncode(claimAmountValueAsString)).append(""); + Object settledDateValue = getSettledDate(); + String settledDateValueAsString = ""; + settledDateValueAsString = settledDateValue.toString(); + sb.append("settledDate=").append(urlEncode(settledDateValueAsString)).append(""); + Object createdTimeValue = getCreatedTime(); + String createdTimeValueAsString = ""; + createdTimeValueAsString = createdTimeValue.toString(); + sb.append("createdTime=").append(urlEncode(createdTimeValueAsString)).append(""); + Object updatedTimeValue = getUpdatedTime(); + String updatedTimeValueAsString = ""; + updatedTimeValueAsString = updatedTimeValue.toString(); + sb.append("updatedTime=").append(urlEncode(updatedTimeValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("positionId"); + openapiFields.add("vendor"); + openapiFields.add("chainId"); + openapiFields.add("tokenId"); + openapiFields.add("collateralSymbol"); + openapiFields.add("topicType"); + openapiFields.add("marketTopicId"); + openapiFields.add("marketId"); + openapiFields.add("marketTopicTitle"); + openapiFields.add("marketTitle"); + openapiFields.add("outcomeName"); + openapiFields.add("outcomeIndex"); + openapiFields.add("shares"); + openapiFields.add("avgPrice"); + openapiFields.add("totalCost"); + openapiFields.add("value"); + openapiFields.add("currentPrice"); + openapiFields.add("toWin"); + openapiFields.add("positionStatus"); + openapiFields.add("isWinner"); + openapiFields.add("redeemStatus"); + openapiFields.add("endDate"); + openapiFields.add("finalOutcome"); + openapiFields.add("realizedPnl"); + openapiFields.add("pnl"); + openapiFields.add("claimAmount"); + openapiFields.add("settledDate"); + openapiFields.add("createdTime"); + openapiFields.add("updatedTime"); + + // 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 + * QuerySettledPositionHistoryResponsePositionsInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!QuerySettledPositionHistoryResponsePositionsInner.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " QuerySettledPositionHistoryResponsePositionsInner is not" + + " found in the empty JSON string", + QuerySettledPositionHistoryResponsePositionsInner + .openapiRequiredFields + .toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("vendor") != null && !jsonObj.get("vendor").isJsonNull()) + && !jsonObj.get("vendor").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `vendor` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("vendor").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("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("collateralSymbol") != null + && !jsonObj.get("collateralSymbol").isJsonNull()) + && !jsonObj.get("collateralSymbol").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `collateralSymbol` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("collateralSymbol").toString())); + } + if ((jsonObj.get("topicType") != null && !jsonObj.get("topicType").isJsonNull()) + && !jsonObj.get("topicType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `topicType` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("topicType").toString())); + } + if ((jsonObj.get("marketTopicTitle") != null + && !jsonObj.get("marketTopicTitle").isJsonNull()) + && !jsonObj.get("marketTopicTitle").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `marketTopicTitle` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("marketTopicTitle").toString())); + } + if ((jsonObj.get("marketTitle") != null && !jsonObj.get("marketTitle").isJsonNull()) + && !jsonObj.get("marketTitle").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `marketTitle` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("marketTitle").toString())); + } + if ((jsonObj.get("outcomeName") != null && !jsonObj.get("outcomeName").isJsonNull()) + && !jsonObj.get("outcomeName").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `outcomeName` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("outcomeName").toString())); + } + if ((jsonObj.get("shares") != null && !jsonObj.get("shares").isJsonNull()) + && !jsonObj.get("shares").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `shares` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("shares").toString())); + } + if ((jsonObj.get("avgPrice") != null && !jsonObj.get("avgPrice").isJsonNull()) + && !jsonObj.get("avgPrice").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `avgPrice` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("avgPrice").toString())); + } + if ((jsonObj.get("totalCost") != null && !jsonObj.get("totalCost").isJsonNull()) + && !jsonObj.get("totalCost").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `totalCost` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("totalCost").toString())); + } + if ((jsonObj.get("value") != null && !jsonObj.get("value").isJsonNull()) + && !jsonObj.get("value").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `value` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("value").toString())); + } + if ((jsonObj.get("currentPrice") != null && !jsonObj.get("currentPrice").isJsonNull()) + && !jsonObj.get("currentPrice").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `currentPrice` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("currentPrice").toString())); + } + if ((jsonObj.get("toWin") != null && !jsonObj.get("toWin").isJsonNull()) + && !jsonObj.get("toWin").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `toWin` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("toWin").toString())); + } + if ((jsonObj.get("positionStatus") != null && !jsonObj.get("positionStatus").isJsonNull()) + && !jsonObj.get("positionStatus").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `positionStatus` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("positionStatus").toString())); + } + if ((jsonObj.get("redeemStatus") != null && !jsonObj.get("redeemStatus").isJsonNull()) + && !jsonObj.get("redeemStatus").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `redeemStatus` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("redeemStatus").toString())); + } + if ((jsonObj.get("finalOutcome") != null && !jsonObj.get("finalOutcome").isJsonNull()) + && !jsonObj.get("finalOutcome").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `finalOutcome` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("finalOutcome").toString())); + } + if ((jsonObj.get("realizedPnl") != null && !jsonObj.get("realizedPnl").isJsonNull()) + && !jsonObj.get("realizedPnl").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `realizedPnl` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("realizedPnl").toString())); + } + if ((jsonObj.get("pnl") != null && !jsonObj.get("pnl").isJsonNull()) + && !jsonObj.get("pnl").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `pnl` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("pnl").toString())); + } + if ((jsonObj.get("claimAmount") != null && !jsonObj.get("claimAmount").isJsonNull()) + && !jsonObj.get("claimAmount").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `claimAmount` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("claimAmount").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!QuerySettledPositionHistoryResponsePositionsInner.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'QuerySettledPositionHistoryResponsePositionsInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, + TypeToken.get(QuerySettledPositionHistoryResponsePositionsInner.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, + QuerySettledPositionHistoryResponsePositionsInner value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public QuerySettledPositionHistoryResponsePositionsInner read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of QuerySettledPositionHistoryResponsePositionsInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of QuerySettledPositionHistoryResponsePositionsInner + * @throws IOException if the JSON string is invalid with respect to + * QuerySettledPositionHistoryResponsePositionsInner + */ + public static QuerySettledPositionHistoryResponsePositionsInner fromJson(String jsonString) + throws IOException { + return JSON.getGson() + .fromJson(jsonString, QuerySettledPositionHistoryResponsePositionsInner.class); + } + + /** + * Convert an instance of QuerySettledPositionHistoryResponsePositionsInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryTransferListResponse.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryTransferListResponse.java new file mode 100644 index 000000000..0486a2981 --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryTransferListResponse.java @@ -0,0 +1,246 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.model; + +import com.binance.connector.client.w3w_prediction.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.*; + +/** QueryTransferListResponse */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class QueryTransferListResponse { + public static final String SERIALIZED_NAME_TRANSFERS = "transfers"; + + @SerializedName(SERIALIZED_NAME_TRANSFERS) + @jakarta.annotation.Nullable + private List<@Valid QueryTransferListResponseTransfersInner> transfers; + + public QueryTransferListResponse() {} + + public QueryTransferListResponse transfers( + @jakarta.annotation.Nullable + List<@Valid QueryTransferListResponseTransfersInner> transfers) { + this.transfers = transfers; + return this; + } + + public QueryTransferListResponse addTransfersItem( + QueryTransferListResponseTransfersInner transfersItem) { + if (this.transfers == null) { + this.transfers = new ArrayList<>(); + } + this.transfers.add(transfersItem); + return this; + } + + /** + * Get transfers + * + * @return transfers + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid QueryTransferListResponseTransfersInner> getTransfers() { + return transfers; + } + + public void setTransfers( + @jakarta.annotation.Nullable + List<@Valid QueryTransferListResponseTransfersInner> transfers) { + this.transfers = transfers; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + QueryTransferListResponse queryTransferListResponse = (QueryTransferListResponse) o; + return Objects.equals(this.transfers, queryTransferListResponse.transfers); + } + + @Override + public int hashCode() { + return Objects.hash(transfers); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class QueryTransferListResponse {\n"); + sb.append(" transfers: ").append(toIndentedString(transfers)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object transfersValue = getTransfers(); + String transfersValueAsString = ""; + transfersValueAsString = + (String) + ((Collection) transfersValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("transfers=").append(urlEncode(transfersValueAsString)).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("transfers"); + + // 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 QueryTransferListResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!QueryTransferListResponse.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in QueryTransferListResponse is not found" + + " in the empty JSON string", + QueryTransferListResponse.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("transfers") != null && !jsonObj.get("transfers").isJsonNull()) { + JsonArray jsonArraytransfers = jsonObj.getAsJsonArray("transfers"); + if (jsonArraytransfers != null) { + // ensure the json data is an array + if (!jsonObj.get("transfers").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `transfers` to be an array in the JSON" + + " string but got `%s`", + jsonObj.get("transfers").toString())); + } + + // validate the optional field `transfers` (array) + for (int i = 0; i < jsonArraytransfers.size(); i++) { + QueryTransferListResponseTransfersInner.validateJsonElement( + jsonArraytransfers.get(i)); + } + ; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!QueryTransferListResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'QueryTransferListResponse' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(QueryTransferListResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, QueryTransferListResponse value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public QueryTransferListResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of QueryTransferListResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of QueryTransferListResponse + * @throws IOException if the JSON string is invalid with respect to QueryTransferListResponse + */ + public static QueryTransferListResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, QueryTransferListResponse.class); + } + + /** + * Convert an instance of QueryTransferListResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryTransferListResponseTransfersInner.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryTransferListResponseTransfersInner.java new file mode 100644 index 000000000..df55a8c52 --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryTransferListResponseTransfersInner.java @@ -0,0 +1,753 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.model; + +import com.binance.connector.client.w3w_prediction.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** QueryTransferListResponseTransfersInner */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class QueryTransferListResponseTransfersInner { + public static final String SERIALIZED_NAME_TRANSFER_ID = "transferId"; + + @SerializedName(SERIALIZED_NAME_TRANSFER_ID) + @jakarta.annotation.Nullable + private String transferId; + + public static final String SERIALIZED_NAME_DIRECTION = "direction"; + + @SerializedName(SERIALIZED_NAME_DIRECTION) + @jakarta.annotation.Nullable + private String direction; + + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + @jakarta.annotation.Nullable + private String status; + + public static final String SERIALIZED_NAME_WALLET_ADDRESS = "walletAddress"; + + @SerializedName(SERIALIZED_NAME_WALLET_ADDRESS) + @jakarta.annotation.Nullable + private String walletAddress; + + public static final String SERIALIZED_NAME_FROM_TOKEN = "fromToken"; + + @SerializedName(SERIALIZED_NAME_FROM_TOKEN) + @jakarta.annotation.Nullable + private String fromToken; + + public static final String SERIALIZED_NAME_FROM_TOKEN_AMOUNT = "fromTokenAmount"; + + @SerializedName(SERIALIZED_NAME_FROM_TOKEN_AMOUNT) + @jakarta.annotation.Nullable + private String fromTokenAmount; + + public static final String SERIALIZED_NAME_TO_TOKEN = "toToken"; + + @SerializedName(SERIALIZED_NAME_TO_TOKEN) + @jakarta.annotation.Nullable + private String toToken; + + public static final String SERIALIZED_NAME_TO_TOKEN_AMOUNT = "toTokenAmount"; + + @SerializedName(SERIALIZED_NAME_TO_TOKEN_AMOUNT) + @jakarta.annotation.Nullable + private String toTokenAmount; + + public static final String SERIALIZED_NAME_ERROR_CODE = "errorCode"; + + @SerializedName(SERIALIZED_NAME_ERROR_CODE) + @jakarta.annotation.Nullable + private String errorCode; + + public static final String SERIALIZED_NAME_ERROR_MESSAGE = "errorMessage"; + + @SerializedName(SERIALIZED_NAME_ERROR_MESSAGE) + @jakarta.annotation.Nullable + private String errorMessage; + + public static final String SERIALIZED_NAME_CREATE_TIME = "createTime"; + + @SerializedName(SERIALIZED_NAME_CREATE_TIME) + @jakarta.annotation.Nullable + private String createTime; + + public static final String SERIALIZED_NAME_UPDATE_TIME = "updateTime"; + + @SerializedName(SERIALIZED_NAME_UPDATE_TIME) + @jakarta.annotation.Nullable + private String updateTime; + + public static final String SERIALIZED_NAME_COMPLETE_AT = "completeAt"; + + @SerializedName(SERIALIZED_NAME_COMPLETE_AT) + @jakarta.annotation.Nullable + private String completeAt; + + public QueryTransferListResponseTransfersInner() {} + + public QueryTransferListResponseTransfersInner transferId( + @jakarta.annotation.Nullable String transferId) { + this.transferId = transferId; + return this; + } + + /** + * Get transferId + * + * @return transferId + */ + @jakarta.annotation.Nullable + public String getTransferId() { + return transferId; + } + + public void setTransferId(@jakarta.annotation.Nullable String transferId) { + this.transferId = transferId; + } + + public QueryTransferListResponseTransfersInner direction( + @jakarta.annotation.Nullable String direction) { + this.direction = direction; + return this; + } + + /** + * Get direction + * + * @return direction + */ + @jakarta.annotation.Nullable + public String getDirection() { + return direction; + } + + public void setDirection(@jakarta.annotation.Nullable String direction) { + this.direction = direction; + } + + public QueryTransferListResponseTransfersInner 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 QueryTransferListResponseTransfersInner walletAddress( + @jakarta.annotation.Nullable String walletAddress) { + this.walletAddress = walletAddress; + return this; + } + + /** + * Get walletAddress + * + * @return walletAddress + */ + @jakarta.annotation.Nullable + public String getWalletAddress() { + return walletAddress; + } + + public void setWalletAddress(@jakarta.annotation.Nullable String walletAddress) { + this.walletAddress = walletAddress; + } + + public QueryTransferListResponseTransfersInner fromToken( + @jakarta.annotation.Nullable String fromToken) { + this.fromToken = fromToken; + return this; + } + + /** + * Get fromToken + * + * @return fromToken + */ + @jakarta.annotation.Nullable + public String getFromToken() { + return fromToken; + } + + public void setFromToken(@jakarta.annotation.Nullable String fromToken) { + this.fromToken = fromToken; + } + + public QueryTransferListResponseTransfersInner fromTokenAmount( + @jakarta.annotation.Nullable String fromTokenAmount) { + this.fromTokenAmount = fromTokenAmount; + return this; + } + + /** + * Get fromTokenAmount + * + * @return fromTokenAmount + */ + @jakarta.annotation.Nullable + public String getFromTokenAmount() { + return fromTokenAmount; + } + + public void setFromTokenAmount(@jakarta.annotation.Nullable String fromTokenAmount) { + this.fromTokenAmount = fromTokenAmount; + } + + public QueryTransferListResponseTransfersInner toToken( + @jakarta.annotation.Nullable String toToken) { + this.toToken = toToken; + return this; + } + + /** + * Get toToken + * + * @return toToken + */ + @jakarta.annotation.Nullable + public String getToToken() { + return toToken; + } + + public void setToToken(@jakarta.annotation.Nullable String toToken) { + this.toToken = toToken; + } + + public QueryTransferListResponseTransfersInner toTokenAmount( + @jakarta.annotation.Nullable String toTokenAmount) { + this.toTokenAmount = toTokenAmount; + return this; + } + + /** + * Get toTokenAmount + * + * @return toTokenAmount + */ + @jakarta.annotation.Nullable + public String getToTokenAmount() { + return toTokenAmount; + } + + public void setToTokenAmount(@jakarta.annotation.Nullable String toTokenAmount) { + this.toTokenAmount = toTokenAmount; + } + + public QueryTransferListResponseTransfersInner errorCode( + @jakarta.annotation.Nullable String errorCode) { + this.errorCode = errorCode; + return this; + } + + /** + * Get errorCode + * + * @return errorCode + */ + @jakarta.annotation.Nullable + public String getErrorCode() { + return errorCode; + } + + public void setErrorCode(@jakarta.annotation.Nullable String errorCode) { + this.errorCode = errorCode; + } + + public QueryTransferListResponseTransfersInner errorMessage( + @jakarta.annotation.Nullable String errorMessage) { + this.errorMessage = errorMessage; + return this; + } + + /** + * Get errorMessage + * + * @return errorMessage + */ + @jakarta.annotation.Nullable + public String getErrorMessage() { + return errorMessage; + } + + public void setErrorMessage(@jakarta.annotation.Nullable String errorMessage) { + this.errorMessage = errorMessage; + } + + public QueryTransferListResponseTransfersInner createTime( + @jakarta.annotation.Nullable String createTime) { + this.createTime = createTime; + return this; + } + + /** + * Get createTime + * + * @return createTime + */ + @jakarta.annotation.Nullable + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(@jakarta.annotation.Nullable String createTime) { + this.createTime = createTime; + } + + public QueryTransferListResponseTransfersInner updateTime( + @jakarta.annotation.Nullable String updateTime) { + this.updateTime = updateTime; + return this; + } + + /** + * Get updateTime + * + * @return updateTime + */ + @jakarta.annotation.Nullable + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(@jakarta.annotation.Nullable String updateTime) { + this.updateTime = updateTime; + } + + public QueryTransferListResponseTransfersInner completeAt( + @jakarta.annotation.Nullable String completeAt) { + this.completeAt = completeAt; + return this; + } + + /** + * Get completeAt + * + * @return completeAt + */ + @jakarta.annotation.Nullable + public String getCompleteAt() { + return completeAt; + } + + public void setCompleteAt(@jakarta.annotation.Nullable String completeAt) { + this.completeAt = completeAt; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + QueryTransferListResponseTransfersInner queryTransferListResponseTransfersInner = + (QueryTransferListResponseTransfersInner) o; + return Objects.equals(this.transferId, queryTransferListResponseTransfersInner.transferId) + && Objects.equals(this.direction, queryTransferListResponseTransfersInner.direction) + && Objects.equals(this.status, queryTransferListResponseTransfersInner.status) + && Objects.equals( + this.walletAddress, queryTransferListResponseTransfersInner.walletAddress) + && Objects.equals(this.fromToken, queryTransferListResponseTransfersInner.fromToken) + && Objects.equals( + this.fromTokenAmount, + queryTransferListResponseTransfersInner.fromTokenAmount) + && Objects.equals(this.toToken, queryTransferListResponseTransfersInner.toToken) + && Objects.equals( + this.toTokenAmount, queryTransferListResponseTransfersInner.toTokenAmount) + && Objects.equals(this.errorCode, queryTransferListResponseTransfersInner.errorCode) + && Objects.equals( + this.errorMessage, queryTransferListResponseTransfersInner.errorMessage) + && Objects.equals( + this.createTime, queryTransferListResponseTransfersInner.createTime) + && Objects.equals( + this.updateTime, queryTransferListResponseTransfersInner.updateTime) + && Objects.equals( + this.completeAt, queryTransferListResponseTransfersInner.completeAt); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash( + transferId, + direction, + status, + walletAddress, + fromToken, + fromTokenAmount, + toToken, + toTokenAmount, + errorCode, + errorMessage, + createTime, + updateTime, + completeAt); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class QueryTransferListResponseTransfersInner {\n"); + sb.append(" transferId: ").append(toIndentedString(transferId)).append("\n"); + sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" walletAddress: ").append(toIndentedString(walletAddress)).append("\n"); + sb.append(" fromToken: ").append(toIndentedString(fromToken)).append("\n"); + sb.append(" fromTokenAmount: ").append(toIndentedString(fromTokenAmount)).append("\n"); + sb.append(" toToken: ").append(toIndentedString(toToken)).append("\n"); + sb.append(" toTokenAmount: ").append(toIndentedString(toTokenAmount)).append("\n"); + sb.append(" errorCode: ").append(toIndentedString(errorCode)).append("\n"); + sb.append(" errorMessage: ").append(toIndentedString(errorMessage)).append("\n"); + sb.append(" createTime: ").append(toIndentedString(createTime)).append("\n"); + sb.append(" updateTime: ").append(toIndentedString(updateTime)).append("\n"); + sb.append(" completeAt: ").append(toIndentedString(completeAt)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object transferIdValue = getTransferId(); + String transferIdValueAsString = ""; + transferIdValueAsString = transferIdValue.toString(); + sb.append("transferId=").append(urlEncode(transferIdValueAsString)).append(""); + Object directionValue = getDirection(); + String directionValueAsString = ""; + directionValueAsString = directionValue.toString(); + sb.append("direction=").append(urlEncode(directionValueAsString)).append(""); + Object statusValue = getStatus(); + String statusValueAsString = ""; + statusValueAsString = statusValue.toString(); + sb.append("status=").append(urlEncode(statusValueAsString)).append(""); + Object walletAddressValue = getWalletAddress(); + String walletAddressValueAsString = ""; + walletAddressValueAsString = walletAddressValue.toString(); + sb.append("walletAddress=").append(urlEncode(walletAddressValueAsString)).append(""); + Object fromTokenValue = getFromToken(); + String fromTokenValueAsString = ""; + fromTokenValueAsString = fromTokenValue.toString(); + sb.append("fromToken=").append(urlEncode(fromTokenValueAsString)).append(""); + Object fromTokenAmountValue = getFromTokenAmount(); + String fromTokenAmountValueAsString = ""; + fromTokenAmountValueAsString = fromTokenAmountValue.toString(); + sb.append("fromTokenAmount=").append(urlEncode(fromTokenAmountValueAsString)).append(""); + Object toTokenValue = getToToken(); + String toTokenValueAsString = ""; + toTokenValueAsString = toTokenValue.toString(); + sb.append("toToken=").append(urlEncode(toTokenValueAsString)).append(""); + Object toTokenAmountValue = getToTokenAmount(); + String toTokenAmountValueAsString = ""; + toTokenAmountValueAsString = toTokenAmountValue.toString(); + sb.append("toTokenAmount=").append(urlEncode(toTokenAmountValueAsString)).append(""); + Object errorCodeValue = getErrorCode(); + String errorCodeValueAsString = ""; + errorCodeValueAsString = errorCodeValue.toString(); + sb.append("errorCode=").append(urlEncode(errorCodeValueAsString)).append(""); + Object errorMessageValue = getErrorMessage(); + String errorMessageValueAsString = ""; + errorMessageValueAsString = errorMessageValue.toString(); + sb.append("errorMessage=").append(urlEncode(errorMessageValueAsString)).append(""); + Object createTimeValue = getCreateTime(); + String createTimeValueAsString = ""; + createTimeValueAsString = createTimeValue.toString(); + sb.append("createTime=").append(urlEncode(createTimeValueAsString)).append(""); + Object updateTimeValue = getUpdateTime(); + String updateTimeValueAsString = ""; + updateTimeValueAsString = updateTimeValue.toString(); + sb.append("updateTime=").append(urlEncode(updateTimeValueAsString)).append(""); + Object completeAtValue = getCompleteAt(); + String completeAtValueAsString = ""; + completeAtValueAsString = completeAtValue.toString(); + sb.append("completeAt=").append(urlEncode(completeAtValueAsString)).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("transferId"); + openapiFields.add("direction"); + openapiFields.add("status"); + openapiFields.add("walletAddress"); + openapiFields.add("fromToken"); + openapiFields.add("fromTokenAmount"); + openapiFields.add("toToken"); + openapiFields.add("toTokenAmount"); + openapiFields.add("errorCode"); + openapiFields.add("errorMessage"); + openapiFields.add("createTime"); + openapiFields.add("updateTime"); + openapiFields.add("completeAt"); + + // 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 + * QueryTransferListResponseTransfersInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!QueryTransferListResponseTransfersInner.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " QueryTransferListResponseTransfersInner is not found in the" + + " empty JSON string", + QueryTransferListResponseTransfersInner.openapiRequiredFields + .toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("transferId") != null && !jsonObj.get("transferId").isJsonNull()) + && !jsonObj.get("transferId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `transferId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("transferId").toString())); + } + if ((jsonObj.get("direction") != null && !jsonObj.get("direction").isJsonNull()) + && !jsonObj.get("direction").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `direction` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("direction").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("walletAddress") != null && !jsonObj.get("walletAddress").isJsonNull()) + && !jsonObj.get("walletAddress").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `walletAddress` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("walletAddress").toString())); + } + if ((jsonObj.get("fromToken") != null && !jsonObj.get("fromToken").isJsonNull()) + && !jsonObj.get("fromToken").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `fromToken` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("fromToken").toString())); + } + if ((jsonObj.get("fromTokenAmount") != null && !jsonObj.get("fromTokenAmount").isJsonNull()) + && !jsonObj.get("fromTokenAmount").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `fromTokenAmount` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("fromTokenAmount").toString())); + } + if ((jsonObj.get("toToken") != null && !jsonObj.get("toToken").isJsonNull()) + && !jsonObj.get("toToken").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `toToken` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("toToken").toString())); + } + if ((jsonObj.get("toTokenAmount") != null && !jsonObj.get("toTokenAmount").isJsonNull()) + && !jsonObj.get("toTokenAmount").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `toTokenAmount` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("toTokenAmount").toString())); + } + if ((jsonObj.get("errorCode") != null && !jsonObj.get("errorCode").isJsonNull()) + && !jsonObj.get("errorCode").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `errorCode` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("errorCode").toString())); + } + if ((jsonObj.get("errorMessage") != null && !jsonObj.get("errorMessage").isJsonNull()) + && !jsonObj.get("errorMessage").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `errorMessage` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("errorMessage").toString())); + } + if ((jsonObj.get("createTime") != null && !jsonObj.get("createTime").isJsonNull()) + && !jsonObj.get("createTime").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `createTime` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("createTime").toString())); + } + if ((jsonObj.get("updateTime") != null && !jsonObj.get("updateTime").isJsonNull()) + && !jsonObj.get("updateTime").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `updateTime` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("updateTime").toString())); + } + if ((jsonObj.get("completeAt") != null && !jsonObj.get("completeAt").isJsonNull()) + && !jsonObj.get("completeAt").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `completeAt` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("completeAt").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!QueryTransferListResponseTransfersInner.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes 'QueryTransferListResponseTransfersInner' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(QueryTransferListResponseTransfersInner.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, QueryTransferListResponseTransfersInner value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public QueryTransferListResponseTransfersInner read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of QueryTransferListResponseTransfersInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of QueryTransferListResponseTransfersInner + * @throws IOException if the JSON string is invalid with respect to + * QueryTransferListResponseTransfersInner + */ + public static QueryTransferListResponseTransfersInner fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, QueryTransferListResponseTransfersInner.class); + } + + /** + * Convert an instance of QueryTransferListResponseTransfersInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryTransferStatusResponse.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryTransferStatusResponse.java new file mode 100644 index 000000000..288a6e28b --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/QueryTransferStatusResponse.java @@ -0,0 +1,644 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.model; + +import com.binance.connector.client.w3w_prediction.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; +import org.openapitools.jackson.nullable.JsonNullable; + +/** QueryTransferStatusResponse */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class QueryTransferStatusResponse { + public static final String SERIALIZED_NAME_TRANSFER_ID = "transferId"; + + @SerializedName(SERIALIZED_NAME_TRANSFER_ID) + @jakarta.annotation.Nullable + private String transferId; + + public static final String SERIALIZED_NAME_DIRECTION = "direction"; + + @SerializedName(SERIALIZED_NAME_DIRECTION) + @jakarta.annotation.Nullable + private String direction; + + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + @jakarta.annotation.Nullable + private String status; + + public static final String SERIALIZED_NAME_FROM_TOKEN = "fromToken"; + + @SerializedName(SERIALIZED_NAME_FROM_TOKEN) + @jakarta.annotation.Nullable + private String fromToken; + + public static final String SERIALIZED_NAME_FROM_TOKEN_AMOUNT = "fromTokenAmount"; + + @SerializedName(SERIALIZED_NAME_FROM_TOKEN_AMOUNT) + @jakarta.annotation.Nullable + private String fromTokenAmount; + + public static final String SERIALIZED_NAME_TO_TOKEN = "toToken"; + + @SerializedName(SERIALIZED_NAME_TO_TOKEN) + @jakarta.annotation.Nullable + private String toToken; + + public static final String SERIALIZED_NAME_TO_TOKEN_AMOUNT = "toTokenAmount"; + + @SerializedName(SERIALIZED_NAME_TO_TOKEN_AMOUNT) + @jakarta.annotation.Nullable + private String toTokenAmount; + + public static final String SERIALIZED_NAME_ERROR_CODE = "errorCode"; + + @SerializedName(SERIALIZED_NAME_ERROR_CODE) + @jakarta.annotation.Nullable + private String errorCode; + + public static final String SERIALIZED_NAME_ERROR_MESSAGE = "errorMessage"; + + @SerializedName(SERIALIZED_NAME_ERROR_MESSAGE) + @jakarta.annotation.Nullable + private String errorMessage; + + public static final String SERIALIZED_NAME_CREATE_TIME = "createTime"; + + @SerializedName(SERIALIZED_NAME_CREATE_TIME) + @jakarta.annotation.Nullable + private String createTime; + + public static final String SERIALIZED_NAME_UPDATE_TIME = "updateTime"; + + @SerializedName(SERIALIZED_NAME_UPDATE_TIME) + @jakarta.annotation.Nullable + private String updateTime; + + public QueryTransferStatusResponse() {} + + public QueryTransferStatusResponse transferId(@jakarta.annotation.Nullable String transferId) { + this.transferId = transferId; + return this; + } + + /** + * Get transferId + * + * @return transferId + */ + @jakarta.annotation.Nullable + public String getTransferId() { + return transferId; + } + + public void setTransferId(@jakarta.annotation.Nullable String transferId) { + this.transferId = transferId; + } + + public QueryTransferStatusResponse direction(@jakarta.annotation.Nullable String direction) { + this.direction = direction; + return this; + } + + /** + * Get direction + * + * @return direction + */ + @jakarta.annotation.Nullable + public String getDirection() { + return direction; + } + + public void setDirection(@jakarta.annotation.Nullable String direction) { + this.direction = direction; + } + + public QueryTransferStatusResponse 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 QueryTransferStatusResponse fromToken(@jakarta.annotation.Nullable String fromToken) { + this.fromToken = fromToken; + return this; + } + + /** + * Get fromToken + * + * @return fromToken + */ + @jakarta.annotation.Nullable + public String getFromToken() { + return fromToken; + } + + public void setFromToken(@jakarta.annotation.Nullable String fromToken) { + this.fromToken = fromToken; + } + + public QueryTransferStatusResponse fromTokenAmount( + @jakarta.annotation.Nullable String fromTokenAmount) { + this.fromTokenAmount = fromTokenAmount; + return this; + } + + /** + * Get fromTokenAmount + * + * @return fromTokenAmount + */ + @jakarta.annotation.Nullable + public String getFromTokenAmount() { + return fromTokenAmount; + } + + public void setFromTokenAmount(@jakarta.annotation.Nullable String fromTokenAmount) { + this.fromTokenAmount = fromTokenAmount; + } + + public QueryTransferStatusResponse toToken(@jakarta.annotation.Nullable String toToken) { + this.toToken = toToken; + return this; + } + + /** + * Get toToken + * + * @return toToken + */ + @jakarta.annotation.Nullable + public String getToToken() { + return toToken; + } + + public void setToToken(@jakarta.annotation.Nullable String toToken) { + this.toToken = toToken; + } + + public QueryTransferStatusResponse toTokenAmount( + @jakarta.annotation.Nullable String toTokenAmount) { + this.toTokenAmount = toTokenAmount; + return this; + } + + /** + * Get toTokenAmount + * + * @return toTokenAmount + */ + @jakarta.annotation.Nullable + public String getToTokenAmount() { + return toTokenAmount; + } + + public void setToTokenAmount(@jakarta.annotation.Nullable String toTokenAmount) { + this.toTokenAmount = toTokenAmount; + } + + public QueryTransferStatusResponse errorCode(@jakarta.annotation.Nullable String errorCode) { + this.errorCode = errorCode; + return this; + } + + /** + * Get errorCode + * + * @return errorCode + */ + @jakarta.annotation.Nullable + public String getErrorCode() { + return errorCode; + } + + public void setErrorCode(@jakarta.annotation.Nullable String errorCode) { + this.errorCode = errorCode; + } + + public QueryTransferStatusResponse errorMessage( + @jakarta.annotation.Nullable String errorMessage) { + this.errorMessage = errorMessage; + return this; + } + + /** + * Get errorMessage + * + * @return errorMessage + */ + @jakarta.annotation.Nullable + public String getErrorMessage() { + return errorMessage; + } + + public void setErrorMessage(@jakarta.annotation.Nullable String errorMessage) { + this.errorMessage = errorMessage; + } + + public QueryTransferStatusResponse createTime(@jakarta.annotation.Nullable String createTime) { + this.createTime = createTime; + return this; + } + + /** + * Get createTime + * + * @return createTime + */ + @jakarta.annotation.Nullable + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(@jakarta.annotation.Nullable String createTime) { + this.createTime = createTime; + } + + public QueryTransferStatusResponse updateTime(@jakarta.annotation.Nullable String updateTime) { + this.updateTime = updateTime; + return this; + } + + /** + * Get updateTime + * + * @return updateTime + */ + @jakarta.annotation.Nullable + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(@jakarta.annotation.Nullable String updateTime) { + this.updateTime = updateTime; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + QueryTransferStatusResponse queryTransferStatusResponse = (QueryTransferStatusResponse) o; + return Objects.equals(this.transferId, queryTransferStatusResponse.transferId) + && Objects.equals(this.direction, queryTransferStatusResponse.direction) + && Objects.equals(this.status, queryTransferStatusResponse.status) + && Objects.equals(this.fromToken, queryTransferStatusResponse.fromToken) + && Objects.equals(this.fromTokenAmount, queryTransferStatusResponse.fromTokenAmount) + && Objects.equals(this.toToken, queryTransferStatusResponse.toToken) + && Objects.equals(this.toTokenAmount, queryTransferStatusResponse.toTokenAmount) + && Objects.equals(this.errorCode, queryTransferStatusResponse.errorCode) + && Objects.equals(this.errorMessage, queryTransferStatusResponse.errorMessage) + && Objects.equals(this.createTime, queryTransferStatusResponse.createTime) + && Objects.equals(this.updateTime, queryTransferStatusResponse.updateTime); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash( + transferId, + direction, + status, + fromToken, + fromTokenAmount, + toToken, + toTokenAmount, + errorCode, + errorMessage, + createTime, + updateTime); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class QueryTransferStatusResponse {\n"); + sb.append(" transferId: ").append(toIndentedString(transferId)).append("\n"); + sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" fromToken: ").append(toIndentedString(fromToken)).append("\n"); + sb.append(" fromTokenAmount: ").append(toIndentedString(fromTokenAmount)).append("\n"); + sb.append(" toToken: ").append(toIndentedString(toToken)).append("\n"); + sb.append(" toTokenAmount: ").append(toIndentedString(toTokenAmount)).append("\n"); + sb.append(" errorCode: ").append(toIndentedString(errorCode)).append("\n"); + sb.append(" errorMessage: ").append(toIndentedString(errorMessage)).append("\n"); + sb.append(" createTime: ").append(toIndentedString(createTime)).append("\n"); + sb.append(" updateTime: ").append(toIndentedString(updateTime)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object transferIdValue = getTransferId(); + String transferIdValueAsString = ""; + transferIdValueAsString = transferIdValue.toString(); + sb.append("transferId=").append(urlEncode(transferIdValueAsString)).append(""); + Object directionValue = getDirection(); + String directionValueAsString = ""; + directionValueAsString = directionValue.toString(); + sb.append("direction=").append(urlEncode(directionValueAsString)).append(""); + Object statusValue = getStatus(); + String statusValueAsString = ""; + statusValueAsString = statusValue.toString(); + sb.append("status=").append(urlEncode(statusValueAsString)).append(""); + Object fromTokenValue = getFromToken(); + String fromTokenValueAsString = ""; + fromTokenValueAsString = fromTokenValue.toString(); + sb.append("fromToken=").append(urlEncode(fromTokenValueAsString)).append(""); + Object fromTokenAmountValue = getFromTokenAmount(); + String fromTokenAmountValueAsString = ""; + fromTokenAmountValueAsString = fromTokenAmountValue.toString(); + sb.append("fromTokenAmount=").append(urlEncode(fromTokenAmountValueAsString)).append(""); + Object toTokenValue = getToToken(); + String toTokenValueAsString = ""; + toTokenValueAsString = toTokenValue.toString(); + sb.append("toToken=").append(urlEncode(toTokenValueAsString)).append(""); + Object toTokenAmountValue = getToTokenAmount(); + String toTokenAmountValueAsString = ""; + toTokenAmountValueAsString = toTokenAmountValue.toString(); + sb.append("toTokenAmount=").append(urlEncode(toTokenAmountValueAsString)).append(""); + Object errorCodeValue = getErrorCode(); + String errorCodeValueAsString = ""; + errorCodeValueAsString = errorCodeValue.toString(); + sb.append("errorCode=").append(urlEncode(errorCodeValueAsString)).append(""); + Object errorMessageValue = getErrorMessage(); + String errorMessageValueAsString = ""; + errorMessageValueAsString = errorMessageValue.toString(); + sb.append("errorMessage=").append(urlEncode(errorMessageValueAsString)).append(""); + Object createTimeValue = getCreateTime(); + String createTimeValueAsString = ""; + createTimeValueAsString = createTimeValue.toString(); + sb.append("createTime=").append(urlEncode(createTimeValueAsString)).append(""); + Object updateTimeValue = getUpdateTime(); + String updateTimeValueAsString = ""; + updateTimeValueAsString = updateTimeValue.toString(); + sb.append("updateTime=").append(urlEncode(updateTimeValueAsString)).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("transferId"); + openapiFields.add("direction"); + openapiFields.add("status"); + openapiFields.add("fromToken"); + openapiFields.add("fromTokenAmount"); + openapiFields.add("toToken"); + openapiFields.add("toTokenAmount"); + openapiFields.add("errorCode"); + openapiFields.add("errorMessage"); + openapiFields.add("createTime"); + openapiFields.add("updateTime"); + + // 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 + * QueryTransferStatusResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!QueryTransferStatusResponse.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in QueryTransferStatusResponse is not" + + " found in the empty JSON string", + QueryTransferStatusResponse.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("transferId") != null && !jsonObj.get("transferId").isJsonNull()) + && !jsonObj.get("transferId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `transferId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("transferId").toString())); + } + if ((jsonObj.get("direction") != null && !jsonObj.get("direction").isJsonNull()) + && !jsonObj.get("direction").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `direction` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("direction").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("fromToken") != null && !jsonObj.get("fromToken").isJsonNull()) + && !jsonObj.get("fromToken").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `fromToken` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("fromToken").toString())); + } + if ((jsonObj.get("fromTokenAmount") != null && !jsonObj.get("fromTokenAmount").isJsonNull()) + && !jsonObj.get("fromTokenAmount").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `fromTokenAmount` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("fromTokenAmount").toString())); + } + if ((jsonObj.get("toToken") != null && !jsonObj.get("toToken").isJsonNull()) + && !jsonObj.get("toToken").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `toToken` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("toToken").toString())); + } + if ((jsonObj.get("toTokenAmount") != null && !jsonObj.get("toTokenAmount").isJsonNull()) + && !jsonObj.get("toTokenAmount").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `toTokenAmount` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("toTokenAmount").toString())); + } + if ((jsonObj.get("errorCode") != null && !jsonObj.get("errorCode").isJsonNull()) + && !jsonObj.get("errorCode").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `errorCode` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("errorCode").toString())); + } + if ((jsonObj.get("errorMessage") != null && !jsonObj.get("errorMessage").isJsonNull()) + && !jsonObj.get("errorMessage").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `errorMessage` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("errorMessage").toString())); + } + if ((jsonObj.get("createTime") != null && !jsonObj.get("createTime").isJsonNull()) + && !jsonObj.get("createTime").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `createTime` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("createTime").toString())); + } + if ((jsonObj.get("updateTime") != null && !jsonObj.get("updateTime").isJsonNull()) + && !jsonObj.get("updateTime").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `updateTime` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("updateTime").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!QueryTransferStatusResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'QueryTransferStatusResponse' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(QueryTransferStatusResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, QueryTransferStatusResponse value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public QueryTransferStatusResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of QueryTransferStatusResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of QueryTransferStatusResponse + * @throws IOException if the JSON string is invalid with respect to QueryTransferStatusResponse + */ + public static QueryTransferStatusResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, QueryTransferStatusResponse.class); + } + + /** + * Convert an instance of QueryTransferStatusResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/Side.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/Side.java new file mode 100644 index 000000000..e58062b34 --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/Side.java @@ -0,0 +1,72 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.model; + +import com.google.gson.JsonElement; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import org.hibernate.validator.constraints.*; + +/** Trade direction. Enum: `BUY`, `SELL` */ +@JsonAdapter(Side.Adapter.class) +public enum Side { + BUY("BUY"), + + SELL("SELL"); + + private String value; + + Side(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static Side fromValue(String value) { + for (Side b : Side.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final Side enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public Side read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return Side.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + Side.fromValue(value); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/SortBy.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/SortBy.java new file mode 100644 index 000000000..42c2de752 --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/SortBy.java @@ -0,0 +1,79 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.model; + +import com.google.gson.JsonElement; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import org.hibernate.validator.constraints.*; + +/** Gets or Sets sortBy */ +@JsonAdapter(SortBy.Adapter.class) +public enum SortBy { + RECOMMENDED("RECOMMENDED"), + + VOLUME("VOLUME"), + + PARTICIPANTS("PARTICIPANTS"), + + CREATED_TIME("CREATED_TIME"), + + END_DATE("END_DATE"); + + private String value; + + SortBy(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static SortBy fromValue(String value) { + for (SortBy b : SortBy.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final SortBy enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public SortBy read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return SortBy.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + SortBy.fromValue(value); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/SourceBiz.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/SourceBiz.java new file mode 100644 index 000000000..6c21aae5c --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/SourceBiz.java @@ -0,0 +1,73 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.model; + +import com.google.gson.JsonElement; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import org.hibernate.validator.constraints.*; + +/** Business source. Enum: `USER_TRANSFER`, `PREDICTION_BUY` */ +@JsonAdapter(SourceBiz.Adapter.class) +public enum SourceBiz { + USER_TRANSFER("USER_TRANSFER"), + + PREDICTION_BUY("PREDICTION_BUY"); + + private String value; + + SourceBiz(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static SourceBiz fromValue(String value) { + for (SourceBiz b : SourceBiz.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final SourceBiz enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public SourceBiz read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return SourceBiz.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + SourceBiz.fromValue(value); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/TokenIds.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/TokenIds.java new file mode 100644 index 000000000..ef45d912f --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/TokenIds.java @@ -0,0 +1,190 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.model; + +import com.binance.connector.client.w3w_prediction.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.*; + +/** + * List of prediction token IDs to redeem. Not empty. Example: + * `tokenIds=112233&tokenIds=112234` + */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class TokenIds extends ArrayList { + public TokenIds() {} + + @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 TokenIds {\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 TokenIds + */ + 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) { + if (!element.getAsJsonPrimitive().isString()) { + throw new IllegalArgumentException( + String.format( + "Expected array items to be of type String in the JSON string but" + + " got `%s`", + jsonElement.toString())); + } + } + if (jsonElement == null) { + if (!TokenIds.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in TokenIds is not found in the empty" + + " JSON string", + TokenIds.openapiRequiredFields.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TokenIds.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TokenIds' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(TokenIds.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, TokenIds value) throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonArray(); + elementAdapter.write(out, obj); + } + + @Override + public TokenIds read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of TokenIds given an JSON string + * + * @param jsonString JSON string + * @return An instance of TokenIds + * @throws IOException if the JSON string is invalid with respect to TokenIds + */ + public static TokenIds fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TokenIds.class); + } + + /** + * Convert an instance of TokenIds to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/TradeSide.java b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/TradeSide.java new file mode 100644 index 000000000..caacd1ca5 --- /dev/null +++ b/clients/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/model/TradeSide.java @@ -0,0 +1,73 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.model; + +import com.google.gson.JsonElement; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import org.hibernate.validator.constraints.*; + +/** Gets or Sets tradeSide */ +@JsonAdapter(TradeSide.Adapter.class) +public enum TradeSide { + BUY("BUY"), + + SELL("SELL"); + + private String value; + + TradeSide(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TradeSide fromValue(String value) { + for (TradeSide b : TradeSide.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TradeSide enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TradeSide read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TradeSide.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TradeSide.fromValue(value); + } +} diff --git a/clients/w3w-prediction/src/test/java/com/binance/connector/client/w3w_prediction/rest/api/MarketDataApiTest.java b/clients/w3w-prediction/src/test/java/com/binance/connector/client/w3w_prediction/rest/api/MarketDataApiTest.java new file mode 100644 index 000000000..450c5c458 --- /dev/null +++ b/clients/w3w-prediction/src/test/java/com/binance/connector/client/w3w_prediction/rest/api/MarketDataApiTest.java @@ -0,0 +1,270 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.api; + +import static org.junit.Assert.assertEquals; + +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 com.binance.connector.client.w3w_prediction.rest.model.GetMarketDetailResponse; +import com.binance.connector.client.w3w_prediction.rest.model.ListPredictionCategoriesResponse; +import com.binance.connector.client.w3w_prediction.rest.model.ListPredictionMarketsResponse; +import com.binance.connector.client.w3w_prediction.rest.model.MarketSearchResponse; +import com.binance.connector.client.w3w_prediction.rest.model.OrderBy; +import com.binance.connector.client.w3w_prediction.rest.model.QueryLastTradePriceResponse; +import com.binance.connector.client.w3w_prediction.rest.model.QueryOrderBookResponse; +import com.binance.connector.client.w3w_prediction.rest.model.SortBy; +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); + } + + /** + * Get Market Detail + * + *

Get full details for a specific prediction market topic, including variant data and + * timeline. Weight(IP): 200 + * + * @throws ApiException if the Api call fails + */ + @Test + public void getMarketDetailTest() throws ApiException, CryptoException { + Long marketTopicId = 4229564L; + ApiResponse response = api.getMarketDetail(marketTopicId); + + ArgumentCaptor callArgumentCaptor = ArgumentCaptor.forClass(Call.class); + Mockito.verify(apiClientSpy) + .execute(callArgumentCaptor.capture(), Mockito.any(java.lang.reflect.Type.class)); + + ArgumentCaptor signInputCaptor = ArgumentCaptor.forClass(String.class); + Mockito.verify(signatureGeneratorSpy).signAsString(signInputCaptor.capture()); + + + Call captorValue = callArgumentCaptor.getValue(); + Request actualRequest = captorValue.request(); + + assertEquals("marketTopicId=4229564×tamp=1736393892000", signInputCaptor.getValue()); + assertEquals( + "47cb3089b54bb547f8a752a5dd2106ceb371a822827a64d5e7d064f8e40eaec1", actualRequest.url().queryParameter("signature")); + assertEquals("/sapi/v1/w3w/wallet/prediction/market/detail", actualRequest.url().encodedPath()); + } + + /** + * List Prediction Categories + * + *

Get all available prediction market categories (L1 and L2). Weight(IP): 200 + * + * @throws ApiException if the Api call fails + */ + @Test + public void listPredictionCategoriesTest() throws ApiException, CryptoException { + ApiResponse response = api.listPredictionCategories(); + + ArgumentCaptor callArgumentCaptor = ArgumentCaptor.forClass(Call.class); + Mockito.verify(apiClientSpy) + .execute(callArgumentCaptor.capture(), Mockito.any(java.lang.reflect.Type.class)); + + ArgumentCaptor signInputCaptor = ArgumentCaptor.forClass(String.class); + Mockito.verify(signatureGeneratorSpy).signAsString(signInputCaptor.capture()); + + + Call captorValue = callArgumentCaptor.getValue(); + Request actualRequest = captorValue.request(); + + assertEquals("timestamp=1736393892000", signInputCaptor.getValue()); + assertEquals( + "53668e00dc92eb93de0b253c301e9fc0c20042b13db384a0ad94b38688a5a84c", + actualRequest.url().queryParameter("signature")); + assertEquals("/sapi/v1/w3w/wallet/prediction/category/list", actualRequest.url().encodedPath()); + } + + /** + * List Prediction Markets + * + *

Get a paginated list of prediction market topics, with optional category and sort filters. + * Weight(IP): 200 + * + * @throws ApiException if the Api call fails + */ + @Test + public void listPredictionMarketsTest() throws ApiException, CryptoException { + String l1Category = "crypto"; + String l2Category = "up-down"; + SortBy sortBy = SortBy.RECOMMENDED; + OrderBy orderBy = OrderBy.ASC; + Integer offset = 0; + Integer limit = 20; + ApiResponse response = + api.listPredictionMarkets(l1Category, l2Category, sortBy, orderBy, offset, limit); + + ArgumentCaptor callArgumentCaptor = ArgumentCaptor.forClass(Call.class); + Mockito.verify(apiClientSpy) + .execute(callArgumentCaptor.capture(), Mockito.any(java.lang.reflect.Type.class)); + + ArgumentCaptor signInputCaptor = ArgumentCaptor.forClass(String.class); + Mockito.verify(signatureGeneratorSpy).signAsString(signInputCaptor.capture()); + + + Call captorValue = callArgumentCaptor.getValue(); + Request actualRequest = captorValue.request(); + + assertEquals("l1Category=crypto&l2Category=up-down&sortBy=RECOMMENDED&orderBy=ASC&offset=0&limit=20×tamp=1736393892000", signInputCaptor.getValue()); + assertEquals( + "83281116b7368d7ac1190e8a85711bd1a3add818ab18440a3c3fe5aa9787ad9a", + actualRequest.url().queryParameter("signature")); + assertEquals("/sapi/v1/w3w/wallet/prediction/market/list", actualRequest.url().encodedPath()); + } + + /** + * Market Search + * + *

Semantic search for prediction market topics by keyword. Weight(IP): 200 + * + * @throws ApiException if the Api call fails + */ + @Test + public void marketSearchTest() throws ApiException, CryptoException { + String query = "BTC price"; + Integer topK = 20; + ApiResponse response = api.marketSearch(query, topK); + + ArgumentCaptor callArgumentCaptor = ArgumentCaptor.forClass(Call.class); + Mockito.verify(apiClientSpy) + .execute(callArgumentCaptor.capture(), Mockito.any(java.lang.reflect.Type.class)); + + ArgumentCaptor signInputCaptor = ArgumentCaptor.forClass(String.class); + Mockito.verify(signatureGeneratorSpy).signAsString(signInputCaptor.capture()); + + + Call captorValue = callArgumentCaptor.getValue(); + Request actualRequest = captorValue.request(); + + assertEquals("query=BTC+price&topK=20×tamp=1736393892000", signInputCaptor.getValue()); + assertEquals("59c35d4885a5a2c8c2755b8b351cfd15b69e75bb437a5f42732d3971f0e6e8f7", actualRequest.url().queryParameter("signature")); + assertEquals("/sapi/v1/w3w/wallet/prediction/market/search", actualRequest.url().encodedPath()); + } + + /** + * Query Last Trade Price + * + *

Get the most recent trade price for a prediction market. Weight(IP): 200 + * + * @throws ApiException if the Api call fails + */ + @Test + public void queryLastTradePriceTest() throws ApiException, CryptoException { + Long marketId = 5567895L; + ApiResponse response = api.queryLastTradePrice(marketId); + + ArgumentCaptor callArgumentCaptor = ArgumentCaptor.forClass(Call.class); + Mockito.verify(apiClientSpy) + .execute(callArgumentCaptor.capture(), Mockito.any(java.lang.reflect.Type.class)); + + ArgumentCaptor signInputCaptor = ArgumentCaptor.forClass(String.class); + Mockito.verify(signatureGeneratorSpy).signAsString(signInputCaptor.capture()); + + + Call captorValue = callArgumentCaptor.getValue(); + Request actualRequest = captorValue.request(); + + assertEquals("marketId=5567895×tamp=1736393892000", signInputCaptor.getValue()); + assertEquals( + "3412167c340fdcbdf845734eaed7971544f4ba69408679692becab658139c036", actualRequest.url().queryParameter("signature")); + assertEquals("/sapi/v1/w3w/wallet/prediction/order-book/last-trade-price", actualRequest.url().encodedPath()); + } + + /** + * Query Order Book + * + *

Get the current order book (bids and asks) for a specific prediction market outcome token. + * Weight(IP): 200 + * + * @throws ApiException if the Api call fails + */ + @Test + public void queryOrderBookTest() throws ApiException, CryptoException { + String vendor = "predict_fun"; + Long marketId = 5567895L; + String tokenId = "112233"; + ApiResponse response = + api.queryOrderBook(vendor, marketId, tokenId); + + ArgumentCaptor callArgumentCaptor = ArgumentCaptor.forClass(Call.class); + Mockito.verify(apiClientSpy) + .execute(callArgumentCaptor.capture(), Mockito.any(java.lang.reflect.Type.class)); + + ArgumentCaptor signInputCaptor = ArgumentCaptor.forClass(String.class); + Mockito.verify(signatureGeneratorSpy).signAsString(signInputCaptor.capture()); + + + Call captorValue = callArgumentCaptor.getValue(); + Request actualRequest = captorValue.request(); + + assertEquals("vendor=predict_fun&marketId=5567895&tokenId=112233×tamp=1736393892000", signInputCaptor.getValue()); + assertEquals("959176214d54cd8e4eb4a7097b6f1ebe75d9c5101619747bf1e136be60bf4c58", actualRequest.url().queryParameter("signature")); + assertEquals("/sapi/v1/w3w/wallet/prediction/order-book", actualRequest.url().encodedPath()); + } +} diff --git a/clients/w3w-prediction/src/test/java/com/binance/connector/client/w3w_prediction/rest/api/PositionApiTest.java b/clients/w3w-prediction/src/test/java/com/binance/connector/client/w3w_prediction/rest/api/PositionApiTest.java new file mode 100644 index 000000000..fe9484a81 --- /dev/null +++ b/clients/w3w-prediction/src/test/java/com/binance/connector/client/w3w_prediction/rest/api/PositionApiTest.java @@ -0,0 +1,266 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.api; + +import static org.junit.Assert.assertEquals; + +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 com.binance.connector.client.w3w_prediction.rest.model.GetPositionByTokenResponse; +import com.binance.connector.client.w3w_prediction.rest.model.QueryPnLResponse; +import com.binance.connector.client.w3w_prediction.rest.model.QueryPositionsByFilterResponse; +import com.binance.connector.client.w3w_prediction.rest.model.QueryPositionsResponse; +import com.binance.connector.client.w3w_prediction.rest.model.QuerySettledPositionHistoryResponse; +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 PositionApi */ +public class PositionApiTest { + + private PositionApi 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 PositionApi(apiClientSpy); + } + + /** + * Get Position by Token + * + *

Get the authenticated user's position detail for a specific prediction token. + * Weight(IP): 200 Security Type: USER_DATA + * + * @throws ApiException if the Api call fails + */ + @Test + public void getPositionByTokenTest() throws ApiException, CryptoException { + String walletAddress = "0x12e32db8817e292508c34111cbc4b23340df542c"; + String tokenId = "112233"; + Long recvWindow = 5000L; + ApiResponse response = + api.getPositionByToken(walletAddress, tokenId, recvWindow); + + ArgumentCaptor callArgumentCaptor = ArgumentCaptor.forClass(Call.class); + Mockito.verify(apiClientSpy) + .execute(callArgumentCaptor.capture(), Mockito.any(java.lang.reflect.Type.class)); + + ArgumentCaptor signInputCaptor = ArgumentCaptor.forClass(String.class); + Mockito.verify(signatureGeneratorSpy).signAsString(signInputCaptor.capture()); + + + Call captorValue = callArgumentCaptor.getValue(); + Request actualRequest = captorValue.request(); + + assertEquals("walletAddress=0x12e32db8817e292508c34111cbc4b23340df542c&tokenId=112233&recvWindow=5000×tamp=1736393892000", signInputCaptor.getValue()); + assertEquals( + "4219d0932e14a4ff1137df3c224eee55a08ccfed7c2916ea5eb265423923ff56", actualRequest.url().queryParameter("signature")); + assertEquals("/sapi/v1/w3w/wallet/prediction/position/token", actualRequest.url().encodedPath()); + } + + /** + * Query PnL + * + *

Query profit and loss records for the authenticated user's prediction positions. When + * `tokenId` is provided, returns a single record in `pnl`; otherwise + * returns a list in `pnlList`. Weight(IP): 200 Security Type: USER_DATA + * + * @throws ApiException if the Api call fails + */ + @Test + public void queryPnLTest() throws ApiException, CryptoException { + String walletAddress = "0x12e32db8817e292508c34111cbc4b23340df542c"; + String tokenId = "112233"; + Long marketId = 5567895L; + Long marketTopicId = 4229564L; + Boolean activeOnly = false; + Long recvWindow = 5000L; + ApiResponse response = + api.queryPnL( + walletAddress, tokenId, marketId, marketTopicId, activeOnly, recvWindow); + + ArgumentCaptor callArgumentCaptor = ArgumentCaptor.forClass(Call.class); + Mockito.verify(apiClientSpy) + .execute(callArgumentCaptor.capture(), Mockito.any(java.lang.reflect.Type.class)); + + ArgumentCaptor signInputCaptor = ArgumentCaptor.forClass(String.class); + Mockito.verify(signatureGeneratorSpy).signAsString(signInputCaptor.capture()); + + + Call captorValue = callArgumentCaptor.getValue(); + Request actualRequest = captorValue.request(); + + assertEquals("walletAddress=0x12e32db8817e292508c34111cbc4b23340df542c&tokenId=112233&marketId=5567895&marketTopicId=4229564&activeOnly=false&recvWindow=5000×tamp=1736393892000", signInputCaptor.getValue()); + assertEquals("3391f5addbbd9df9223b3ee531bbdaf0f8861f6a01f0621b8f4c086b7dafd3bf", actualRequest.url().queryParameter("signature")); + assertEquals("/sapi/v1/w3w/wallet/prediction/pnl/query", actualRequest.url().encodedPath()); + } + + /** + * Query Positions + * + *

Get the authenticated user's prediction token positions with portfolio summary and + * tab-based filtering. Weight(IP): 200 Security Type: USER_DATA + * + * @throws ApiException if the Api call fails + */ + @Test + public void queryPositionsTest() throws ApiException, CryptoException { + String walletAddress = "0x12e32db8817e292508c34111cbc4b23340df542c"; + String tab = "ONGOING"; + Integer offset = 0; + Integer limit = 20; + Long recvWindow = 5000L; + ApiResponse response = + api.queryPositions(walletAddress, tab, offset, limit, recvWindow); + + ArgumentCaptor callArgumentCaptor = ArgumentCaptor.forClass(Call.class); + Mockito.verify(apiClientSpy) + .execute(callArgumentCaptor.capture(), Mockito.any(java.lang.reflect.Type.class)); + + ArgumentCaptor signInputCaptor = ArgumentCaptor.forClass(String.class); + Mockito.verify(signatureGeneratorSpy).signAsString(signInputCaptor.capture()); + + + Call captorValue = callArgumentCaptor.getValue(); + Request actualRequest = captorValue.request(); + + assertEquals("walletAddress=0x12e32db8817e292508c34111cbc4b23340df542c&tab=ONGOING&offset=0&limit=20&recvWindow=5000×tamp=1736393892000", signInputCaptor.getValue()); + assertEquals("218e44c5ac2dc71ed6156d86dfe7127d3fbb7a43af71173151ad24504d107c9e", actualRequest.url().queryParameter("signature")); + assertEquals("/sapi/v1/w3w/wallet/prediction/position/list", actualRequest.url().encodedPath()); + } + + /** + * Query Positions by Filter + * + *

Get prediction positions filtered by wallet address and/or market topic ID. Both + * parameters are optional. Weight(IP): 200 Security Type: USER_DATA + * + * @throws ApiException if the Api call fails + */ + @Test + public void queryPositionsByFilterTest() throws ApiException, CryptoException { + String walletAddress = "0x12e32db8817e292508c34111cbc4b23340df542c"; + Long marketTopicId = 4229564L; + Long recvWindow = 5000L; + ApiResponse response = + api.queryPositionsByFilter(walletAddress, marketTopicId, recvWindow); + + ArgumentCaptor callArgumentCaptor = ArgumentCaptor.forClass(Call.class); + Mockito.verify(apiClientSpy) + .execute(callArgumentCaptor.capture(), Mockito.any(java.lang.reflect.Type.class)); + + ArgumentCaptor signInputCaptor = ArgumentCaptor.forClass(String.class); + Mockito.verify(signatureGeneratorSpy).signAsString(signInputCaptor.capture()); + + + Call captorValue = callArgumentCaptor.getValue(); + Request actualRequest = captorValue.request(); + + assertEquals("walletAddress=0x12e32db8817e292508c34111cbc4b23340df542c&marketTopicId=4229564&recvWindow=5000×tamp=1736393892000", signInputCaptor.getValue()); + assertEquals( + "8573d39d5cd734c300a3636d9f79713aa62d98440e7f9478e6b62e687ee0c8da", + actualRequest.url().queryParameter("signature")); + assertEquals("/sapi/v1/w3w/wallet/prediction/position/filter", actualRequest.url().encodedPath()); + } + + /** + * Query Settled Position History + * + *

Get the authenticated user's settled (resolved) prediction position history with + * optional filters. Weight(IP): 200 Security Type: USER_DATA + * + * @throws ApiException if the Api call fails + */ + @Test + public void querySettledPositionHistoryTest() throws ApiException, CryptoException { + String walletAddress = "0x12e32db8817e292508c34111cbc4b23340df542c"; + String l1Category = "crypto"; + Integer result = 1; + String startDate = "2026-05-01"; + String endDate = "2026-05-25"; + Integer offset = 0; + Integer limit = 20; + Long recvWindow = 5000L; + ApiResponse response = + api.querySettledPositionHistory( + walletAddress, + l1Category, + result, + startDate, + endDate, + offset, + limit, + recvWindow); + + ArgumentCaptor callArgumentCaptor = ArgumentCaptor.forClass(Call.class); + Mockito.verify(apiClientSpy) + .execute(callArgumentCaptor.capture(), Mockito.any(java.lang.reflect.Type.class)); + + ArgumentCaptor signInputCaptor = ArgumentCaptor.forClass(String.class); + Mockito.verify(signatureGeneratorSpy).signAsString(signInputCaptor.capture()); + + + Call captorValue = callArgumentCaptor.getValue(); + Request actualRequest = captorValue.request(); + + assertEquals("walletAddress=0x12e32db8817e292508c34111cbc4b23340df542c&l1Category=crypto&result=1&startDate=2026-05-01&endDate=2026-05-25&offset=0&limit=20&recvWindow=5000×tamp=1736393892000", signInputCaptor.getValue()); + assertEquals( + "195610ffeab8a255dd46890ea5843825a3d7e9f629b5e5803c5cfad239006cfa", + actualRequest.url().queryParameter("signature")); + assertEquals("/sapi/v1/w3w/wallet/prediction/position/settled-history", actualRequest.url().encodedPath()); + } +} diff --git a/clients/w3w-prediction/src/test/java/com/binance/connector/client/w3w_prediction/rest/api/RedeemApiTest.java b/clients/w3w-prediction/src/test/java/com/binance/connector/client/w3w_prediction/rest/api/RedeemApiTest.java new file mode 100644 index 000000000..32ab1ed52 --- /dev/null +++ b/clients/w3w-prediction/src/test/java/com/binance/connector/client/w3w_prediction/rest/api/RedeemApiTest.java @@ -0,0 +1,150 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.api; + +import static org.junit.Assert.assertEquals; + +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 com.binance.connector.client.w3w_prediction.rest.model.BatchRedeemRequest; +import com.binance.connector.client.w3w_prediction.rest.model.BatchRedeemResponse; +import com.binance.connector.client.w3w_prediction.rest.model.GetRedeemStatusResponse; +import com.binance.connector.client.w3w_prediction.rest.model.TokenIds; +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 RedeemApi */ +public class RedeemApiTest { + + private RedeemApi 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 RedeemApi(apiClientSpy); + } + + /** + * Batch Redeem + * + *

Redeem one or more settled prediction tokens on-chain to claim winnings. Requires SAS + * authorization. Weight(IP): 200 Security Type: TRADE + * + * @throws ApiException if the Api call fails + */ + @Test + public void batchRedeemTest() throws ApiException, CryptoException { + BatchRedeemRequest batchRedeemRequest = new BatchRedeemRequest(); + batchRedeemRequest.walletAddress("0x12e32db8817e292508c34111cbc4b23340df542c"); + batchRedeemRequest.walletId("5b5c1ec3be4e4416a5872b21c1ca5d20"); + batchRedeemRequest.tokenIds(new TokenIds()); + + ApiResponse response = api.batchRedeem(batchRedeemRequest); + + ArgumentCaptor callArgumentCaptor = ArgumentCaptor.forClass(Call.class); + Mockito.verify(apiClientSpy) + .execute(callArgumentCaptor.capture(), Mockito.any(java.lang.reflect.Type.class)); + + ArgumentCaptor signInputCaptor = ArgumentCaptor.forClass(String.class); + Mockito.verify(signatureGeneratorSpy).signAsString(signInputCaptor.capture()); + + + Call captorValue = callArgumentCaptor.getValue(); + Request actualRequest = captorValue.request(); + + assertEquals("timestamp=1736393892000walletId=5b5c1ec3be4e4416a5872b21c1ca5d20&chainId=56&tokenIds=%5B%5D&walletAddress=0x12e32db8817e292508c34111cbc4b23340df542c", signInputCaptor.getValue()); + assertEquals("5e51a5463ac4d89c3b13de400dba35ce60a0d43e8d62418de696ac97382d530f", actualRequest.url().queryParameter("signature")); + assertEquals("/sapi/v1/w3w/wallet/prediction/batch-redeem", actualRequest.url().encodedPath()); + } + + /** + * Get Redeem Status + * + *

Query the on-chain transaction status of a previously submitted redeem request. + * Weight(IP): 200 Security Type: USER_DATA Response Notes: - Status values: | Value | + * Description | | ----------- | -------------------------------------------- | | + * `PENDING` | Transaction submitted, awaiting confirmation | | `CONFIRMED` + * | Transaction confirmed on-chain | | `FAILED` | Transaction failed | | + * `NOT_FOUND` | Transaction hash not found | + * + * @throws ApiException if the Api call fails + */ + @Test + public void getRedeemStatusTest() throws ApiException, CryptoException { + String walletAddress = "0x12e32db8817e292508c34111cbc4b23340df542c"; + String txHash = "0xabc123def456789abcdef123456789abcdef123456789abcdef123456789abcd"; + Long recvWindow = 5000L; + ApiResponse response = + api.getRedeemStatus(walletAddress, txHash, recvWindow); + + ArgumentCaptor callArgumentCaptor = ArgumentCaptor.forClass(Call.class); + Mockito.verify(apiClientSpy) + .execute(callArgumentCaptor.capture(), Mockito.any(java.lang.reflect.Type.class)); + + ArgumentCaptor signInputCaptor = ArgumentCaptor.forClass(String.class); + Mockito.verify(signatureGeneratorSpy).signAsString(signInputCaptor.capture()); + + + Call captorValue = callArgumentCaptor.getValue(); + Request actualRequest = captorValue.request(); + + assertEquals("walletAddress=0x12e32db8817e292508c34111cbc4b23340df542c&txHash=0xabc123def456789abcdef123456789abcdef123456789abcdef123456789abcd&recvWindow=5000×tamp=1736393892000", signInputCaptor.getValue()); + assertEquals( + "00ad7e48da8f6e21b0726ab6928edce87d095961798e2b8539685011b95d925f", actualRequest.url().queryParameter("signature")); + assertEquals("/sapi/v1/w3w/wallet/prediction/redeem/status", actualRequest.url().encodedPath()); + } +} diff --git a/clients/w3w-prediction/src/test/java/com/binance/connector/client/w3w_prediction/rest/api/TradeApiTest.java b/clients/w3w-prediction/src/test/java/com/binance/connector/client/w3w_prediction/rest/api/TradeApiTest.java new file mode 100644 index 000000000..f89a1db7f --- /dev/null +++ b/clients/w3w-prediction/src/test/java/com/binance/connector/client/w3w_prediction/rest/api/TradeApiTest.java @@ -0,0 +1,306 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.api; + +import static org.junit.Assert.assertEquals; + +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 com.binance.connector.client.w3w_prediction.rest.model.AccountType; +import com.binance.connector.client.w3w_prediction.rest.model.BatchCancelOrdersRequest; +import com.binance.connector.client.w3w_prediction.rest.model.BatchCancelOrdersResponse; +import com.binance.connector.client.w3w_prediction.rest.model.GetQuoteRequest; +import com.binance.connector.client.w3w_prediction.rest.model.GetQuoteResponse; +import com.binance.connector.client.w3w_prediction.rest.model.OrderType; +import com.binance.connector.client.w3w_prediction.rest.model.PlaceOrderRequest; +import com.binance.connector.client.w3w_prediction.rest.model.PlaceOrderResponse; +import com.binance.connector.client.w3w_prediction.rest.model.QueryActiveOrdersResponse; +import com.binance.connector.client.w3w_prediction.rest.model.QueryOrderHistoryResponse; +import com.binance.connector.client.w3w_prediction.rest.model.Side; +import com.binance.connector.client.w3w_prediction.rest.model.TradeSide; +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 TradeApi */ +public class TradeApiTest { + + private TradeApi 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 TradeApi(apiClientSpy); + } + + /** + * Batch Cancel Orders + * + *

Cancel one or more active prediction orders in a single request. Requires SAS + * authorization. **Known Issue — Bracket Encoding Incompatibility:** This endpoint uses indexed + * bracket notation (`cancelInfoList[0].orderId`). Binance SAPI signature verification + * runs over the **raw, unencoded** canonical string. However, mainstream HTTP libraries (Python + * `requests`, Java `HttpURLConnection`/`URI`, Go + * `net/url`, Node.js `url`) automatically percent-encode `[` → + * `%5B` and `]` → `%5D`, producing a signature mismatch with + * error `-1022 Signature for this request is not valid`. Postman is unaffected + * because it does not encode keys. **Workarounds** (use low-level HTTP APIs that do not + * normalize URLs): - **Python:** use `http.client` (stdlib) and hand-build the body + * string. - **Java:** use `HttpURLConnection` and write the raw body bytes directly. + * - **Go:** use `strings.NewReader` with a hand-built body instead of + * `url.Values.Encode()`. Weight(IP): 200 Security Type: TRADE Notes: - Use dot + * notation for nested list fields: `cancelInfoList[0].orderId`, + * `cancelInfoList[1].orderId`, etc. - `vendor` does not need to be + * supplied. The server automatically sets the correct vendor (`predict_fun`) for + * every item in the batch. + * + * @throws ApiException if the Api call fails + */ + @Test + public void batchCancelOrdersTest() throws ApiException, CryptoException { + BatchCancelOrdersRequest batchCancelOrdersRequest = new BatchCancelOrdersRequest(); + batchCancelOrdersRequest.walletAddress("0x12e32db8817e292508c34111cbc4b23340df542c"); + batchCancelOrdersRequest.walletId("5b5c1ec3be4e4416a5872b21c1ca5d20"); + + ApiResponse response = + api.batchCancelOrders(batchCancelOrdersRequest); + + ArgumentCaptor callArgumentCaptor = ArgumentCaptor.forClass(Call.class); + Mockito.verify(apiClientSpy) + .execute(callArgumentCaptor.capture(), Mockito.any(java.lang.reflect.Type.class)); + + ArgumentCaptor signInputCaptor = ArgumentCaptor.forClass(String.class); + Mockito.verify(signatureGeneratorSpy).signAsString(signInputCaptor.capture()); + + Call captorValue = callArgumentCaptor.getValue(); + Request actualRequest = captorValue.request(); + + assertEquals("timestamp=1736393892000walletId=5b5c1ec3be4e4416a5872b21c1ca5d20&walletAddress=0x12e32db8817e292508c34111cbc4b23340df542c", signInputCaptor.getValue()); + assertEquals( + "19652c6a1daadf6b6979264f3db1c235e738c59a804935580598d47169584a65", actualRequest.url().queryParameter("signature")); + assertEquals("/sapi/v1/w3w/wallet/prediction/trade/batch-cancel", actualRequest.url().encodedPath()); + } + + /** + * Get Quote + * + *

Get a price quote for a prediction order. The returned `quoteId` must be used in + * the subsequent Place Order request. Weight(IP): 200 Security Type: TRADE Response Notes: - + * `feeAmount` is a string because it is denominated in wei (18 decimals) and may + * exceed JavaScript's safe integer range. `feeDiscountBps` is also a string to + * allow fractional basis-point values in the future. `feeRateBps` and + * `slippageBps` are integers and will never exceed safe integer bounds. - **MARKET + * order minimum amount:** For `MARKET` orders, `amountIn` must be at least + * approximately **1.5 USDT** (in wei: `1500000000000000000`). The exact minimum + * varies by market liquidity. If the amount is too small, the server returns `-9000 Your + * order amount is too small`. This limit does **not** apply to `LIMIT` orders. + * + * @throws ApiException if the Api call fails + */ + @Test + public void getQuoteTest() throws ApiException, CryptoException { + GetQuoteRequest getQuoteRequest = new GetQuoteRequest(); + getQuoteRequest.walletAddress("0x12e32db8817e292508c34111cbc4b23340df542c"); + getQuoteRequest.tokenId("112233"); + getQuoteRequest.side(Side.BUY); + getQuoteRequest.amountIn("1000000000000000000"); + getQuoteRequest.orderType(OrderType.MARKET); + getQuoteRequest.slippageBps(1200); + + ApiResponse response = api.getQuote(getQuoteRequest); + + ArgumentCaptor callArgumentCaptor = ArgumentCaptor.forClass(Call.class); + Mockito.verify(apiClientSpy) + .execute(callArgumentCaptor.capture(), Mockito.any(java.lang.reflect.Type.class)); + + ArgumentCaptor signInputCaptor = ArgumentCaptor.forClass(String.class); + Mockito.verify(signatureGeneratorSpy).signAsString(signInputCaptor.capture()); + + + Call captorValue = callArgumentCaptor.getValue(); + Request actualRequest = captorValue.request(); + + assertEquals("timestamp=1736393892000orderType=MARKET&slippageBps=1200&side=BUY&tokenId=112233&chainId=56&amountIn=1000000000000000000&walletAddress=0x12e32db8817e292508c34111cbc4b23340df542c&fundingSource=MPC&feeRateBps=200", signInputCaptor.getValue()); + assertEquals("7acd89da1c0d3d8e4b794047614aa1ba5b1cf2de41d20ee4dbd35e502db8b338", actualRequest.url().queryParameter("signature")); + assertEquals("/sapi/v1/w3w/wallet/prediction/trade/get-quote", actualRequest.url().encodedPath()); + } + + /** + * Place Order + * + *

Place a prediction order using a previously obtained quote. Requires SAS authorization. + * Weight(IP): 200 Security Type: TRADE Notes: - Validation rules: | orderType | timeInForce | + * priceLimit | | --------- | ------------- | --------------------- | | `MARKET` | + * Must be `FOK` | Not required | | `LIMIT` | Must be `GTC` | + * Required, must be > 0 | + * + * @throws ApiException if the Api call fails + */ + @Test + public void placeOrderTest() throws ApiException, CryptoException { + PlaceOrderRequest placeOrderRequest = new PlaceOrderRequest(); + placeOrderRequest.walletAddress("0x12e32db8817e292508c34111cbc4b23340df542c"); + placeOrderRequest.walletId("5b5c1ec3be4e4416a5872b21c1ca5d20"); + placeOrderRequest.quoteId("q_20260525_abc123xyz"); + placeOrderRequest.timeInForce("FOK"); + placeOrderRequest.accountType(AccountType.SPOT); + placeOrderRequest.orderType(OrderType.MARKET); + placeOrderRequest.slippageBps(1200); + + ApiResponse response = api.placeOrder(placeOrderRequest); + + ArgumentCaptor callArgumentCaptor = ArgumentCaptor.forClass(Call.class); + Mockito.verify(apiClientSpy) + .execute(callArgumentCaptor.capture(), Mockito.any(java.lang.reflect.Type.class)); + + ArgumentCaptor signInputCaptor = ArgumentCaptor.forClass(String.class); + Mockito.verify(signatureGeneratorSpy).signAsString(signInputCaptor.capture()); + + + Call captorValue = callArgumentCaptor.getValue(); + Request actualRequest = captorValue.request(); + + assertEquals("timestamp=1736393892000walletId=5b5c1ec3be4e4416a5872b21c1ca5d20&orderType=MARKET&slippageBps=1200&accountType=SPOT&walletAddress=0x12e32db8817e292508c34111cbc4b23340df542c&fundingSource=MPC&timeInForce=FOK"eId=q_20260525_abc123xyz", signInputCaptor.getValue()); + assertEquals("5037f8585fd2d908f01b435e2006c0c006e246266a2ce7850919680722a66c05", actualRequest.url().queryParameter("signature")); + assertEquals("/sapi/v1/w3w/wallet/prediction/trade/place-order-bundle", actualRequest.url().encodedPath()); + } + + /** + * Query Active Orders + * + *

Get active (open) prediction orders for the authenticated user. Weight(IP): 200 Security + * Type: USER_DATA + * + * @throws ApiException if the Api call fails + */ + @Test + public void queryActiveOrdersTest() throws ApiException, CryptoException { + String walletAddress = "0x12e32db8817e292508c34111cbc4b23340df542c"; + TradeSide tradeSide = TradeSide.BUY; + String l1Category = "crypto"; + Long marketId = 5567895L; + Integer offset = 0; + Integer limit = 20; + Long recvWindow = 5000L; + ApiResponse response = + api.queryActiveOrders( + walletAddress, tradeSide, l1Category, marketId, offset, limit, recvWindow); + + ArgumentCaptor callArgumentCaptor = ArgumentCaptor.forClass(Call.class); + Mockito.verify(apiClientSpy) + .execute(callArgumentCaptor.capture(), Mockito.any(java.lang.reflect.Type.class)); + + ArgumentCaptor signInputCaptor = ArgumentCaptor.forClass(String.class); + Mockito.verify(signatureGeneratorSpy).signAsString(signInputCaptor.capture()); + + + Call captorValue = callArgumentCaptor.getValue(); + Request actualRequest = captorValue.request(); + + assertEquals("walletAddress=0x12e32db8817e292508c34111cbc4b23340df542c&tradeSide=BUY&l1Category=crypto&marketId=5567895&offset=0&limit=20&recvWindow=5000×tamp=1736393892000", signInputCaptor.getValue()); + assertEquals( + "41c3000e747a8ca5ddee25a700085a0ef5d6c4d8133ed2a1426a0d8a5de1e679", actualRequest.url().queryParameter("signature")); + assertEquals("/sapi/v1/w3w/wallet/prediction/order/list", actualRequest.url().encodedPath()); + } + + /** + * Query Order History + * + *

Get historical prediction orders (all statuses) for the authenticated user, with optional + * filters. Weight(IP): 200 Security Type: USER_DATA + * + * @throws ApiException if the Api call fails + */ + @Test + public void queryOrderHistoryTest() throws ApiException, CryptoException { + String walletAddress = "0x12e32db8817e292508c34111cbc4b23340df542c"; + String l1Category = "crypto"; + OrderType orderType = OrderType.MARKET; + String status = "CLOSED"; + String startDate = "2026-05-01"; + String endDate = "2026-05-25"; + Integer offset = 0; + Integer limit = 20; + Long recvWindow = 5000L; + ApiResponse response = + api.queryOrderHistory( + walletAddress, + l1Category, + orderType, + status, + startDate, + endDate, + offset, + limit, + recvWindow); + + ArgumentCaptor callArgumentCaptor = ArgumentCaptor.forClass(Call.class); + Mockito.verify(apiClientSpy) + .execute(callArgumentCaptor.capture(), Mockito.any(java.lang.reflect.Type.class)); + + ArgumentCaptor signInputCaptor = ArgumentCaptor.forClass(String.class); + Mockito.verify(signatureGeneratorSpy).signAsString(signInputCaptor.capture()); + + + Call captorValue = callArgumentCaptor.getValue(); + Request actualRequest = captorValue.request(); + + assertEquals("walletAddress=0x12e32db8817e292508c34111cbc4b23340df542c&l1Category=crypto&orderType=MARKET&status=CLOSED&startDate=2026-05-01&endDate=2026-05-25&offset=0&limit=20&recvWindow=5000×tamp=1736393892000", signInputCaptor.getValue()); + assertEquals( + "162df57247ffeab31cc4e93533da2b67e1505575f0366a29df08aa99ad12be5c", actualRequest.url().queryParameter("signature")); + assertEquals("/sapi/v1/w3w/wallet/prediction/order/history", actualRequest.url().encodedPath()); + } +} diff --git a/clients/w3w-prediction/src/test/java/com/binance/connector/client/w3w_prediction/rest/api/TransferApiTest.java b/clients/w3w-prediction/src/test/java/com/binance/connector/client/w3w_prediction/rest/api/TransferApiTest.java new file mode 100644 index 000000000..9b611d3f8 --- /dev/null +++ b/clients/w3w-prediction/src/test/java/com/binance/connector/client/w3w_prediction/rest/api/TransferApiTest.java @@ -0,0 +1,246 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.api; + +import static org.junit.Assert.assertEquals; + +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 com.binance.connector.client.w3w_prediction.rest.model.AccountType; +import com.binance.connector.client.w3w_prediction.rest.model.CreateInboundTransferRequest; +import com.binance.connector.client.w3w_prediction.rest.model.CreateInboundTransferResponse; +import com.binance.connector.client.w3w_prediction.rest.model.CreateOutboundTransferRequest; +import com.binance.connector.client.w3w_prediction.rest.model.CreateOutboundTransferResponse; +import com.binance.connector.client.w3w_prediction.rest.model.Direction; +import com.binance.connector.client.w3w_prediction.rest.model.QueryTransferListResponse; +import com.binance.connector.client.w3w_prediction.rest.model.QueryTransferStatusResponse; +import com.binance.connector.client.w3w_prediction.rest.model.SourceBiz; +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 TransferApi */ +public class TransferApiTest { + + private TransferApi 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 TransferApi(apiClientSpy); + } + + /** + * Create Inbound Transfer + * + *

Transfer funds from the prediction wallet back to the user's CEX account (SPOT or + * FUNDING). Requires SAS authorization. ⚠️ **SAS Authorization Required:** This endpoint + * enforces SAS (Self-Authorization Service) authorization. If SAS is not enabled for the + * wallet, the request will be rejected with `-31003 SAS authorization required`. + * Enable SAS for your wallet before calling this endpoint. Weight(IP): 200 Security Type: TRADE + * + * @throws ApiException if the Api call fails + */ + @Test + public void createInboundTransferTest() throws ApiException, CryptoException { + CreateInboundTransferRequest createInboundTransferRequest = + new CreateInboundTransferRequest(); + createInboundTransferRequest.walletId("5b5c1ec3be4e4416a5872b21c1ca5d20"); + createInboundTransferRequest.walletAddress("0x12e32db8817e292508c34111cbc4b23340df542c"); + createInboundTransferRequest.fromTokenAmount("1000000000000000000"); + createInboundTransferRequest.accountType(AccountType.SPOT); + + ApiResponse response = + api.createInboundTransfer(createInboundTransferRequest); + + ArgumentCaptor callArgumentCaptor = ArgumentCaptor.forClass(Call.class); + Mockito.verify(apiClientSpy) + .execute(callArgumentCaptor.capture(), Mockito.any(java.lang.reflect.Type.class)); + + ArgumentCaptor signInputCaptor = ArgumentCaptor.forClass(String.class); + Mockito.verify(signatureGeneratorSpy).signAsString(signInputCaptor.capture()); + + + Call captorValue = callArgumentCaptor.getValue(); + Request actualRequest = captorValue.request(); + + assertEquals("timestamp=1736393892000walletId=5b5c1ec3be4e4416a5872b21c1ca5d20&fromTokenAmount=1000000000000000000&chainId=56&accountType=SPOT&walletAddress=0x12e32db8817e292508c34111cbc4b23340df542c&fromToken=USDT&toToken=USDT", signInputCaptor.getValue()); + assertEquals( + "dec3a713b953eff76f12bf609d51c8298963a76016957d81ad892ced90a49e8f", + actualRequest.url().queryParameter("signature")); + assertEquals("/sapi/v1/w3w/wallet/prediction/transfer/inbound", actualRequest.url().encodedPath()); + } + + /** + * Create Outbound Transfer + * + *

Transfer funds from the user's CEX account (SPOT or FUNDING) into the prediction + * wallet. Requires SAS authorization. Weight(IP): 200 Security Type: TRADE + * + * @throws ApiException if the Api call fails + */ + @Test + public void createOutboundTransferTest() throws ApiException, CryptoException { + CreateOutboundTransferRequest createOutboundTransferRequest = + new CreateOutboundTransferRequest(); + createOutboundTransferRequest.walletId("5b5c1ec3be4e4416a5872b21c1ca5d20"); + createOutboundTransferRequest.walletAddress("0x12e32db8817e292508c34111cbc4b23340df542c"); + createOutboundTransferRequest.fromTokenAmount("1000000000000000000"); + createOutboundTransferRequest.accountType(AccountType.SPOT); + createOutboundTransferRequest.sourceBiz(SourceBiz.USER_TRANSFER); + + ApiResponse response = + api.createOutboundTransfer(createOutboundTransferRequest); + + ArgumentCaptor callArgumentCaptor = ArgumentCaptor.forClass(Call.class); + Mockito.verify(apiClientSpy) + .execute(callArgumentCaptor.capture(), Mockito.any(java.lang.reflect.Type.class)); + + ArgumentCaptor signInputCaptor = ArgumentCaptor.forClass(String.class); + Mockito.verify(signatureGeneratorSpy).signAsString(signInputCaptor.capture()); + + + Call captorValue = callArgumentCaptor.getValue(); + Request actualRequest = captorValue.request(); + + assertEquals("timestamp=1736393892000walletId=5b5c1ec3be4e4416a5872b21c1ca5d20&fromTokenAmount=1000000000000000000&chainId=56&accountType=SPOT&sourceBiz=USER_TRANSFER&walletAddress=0x12e32db8817e292508c34111cbc4b23340df542c&fromToken=USDT&toToken=USDT", signInputCaptor.getValue()); + assertEquals( + "e897706bbf1ea01c544168ff626c38086e34aabecd398ac829267cdb81734778", + actualRequest.url().queryParameter("signature")); + assertEquals("/sapi/v1/w3w/wallet/prediction/transfer/outbound", actualRequest.url().encodedPath()); + } + + /** + * Query Transfer List + * + *

Get the authenticated user's prediction wallet transfer history within a date range. + * Weight(IP): 200 Security Type: USER_DATA + * + * @throws ApiException if the Api call fails + */ + @Test + public void queryTransferListTest() throws ApiException, CryptoException { + String walletAddress = "0x12e32db8817e292508c34111cbc4b23340df542c"; + String startDate = "2026-05-01"; + String endDate = "2026-05-25"; + String tokenSymbol = "USDT"; + Direction direction = Direction.INBOUND; + Integer offset = 0; + Integer limit = 20; + Long recvWindow = 5000L; + ApiResponse response = + api.queryTransferList( + walletAddress, + startDate, + endDate, + tokenSymbol, + direction, + offset, + limit, + recvWindow); + + ArgumentCaptor callArgumentCaptor = ArgumentCaptor.forClass(Call.class); + Mockito.verify(apiClientSpy) + .execute(callArgumentCaptor.capture(), Mockito.any(java.lang.reflect.Type.class)); + + ArgumentCaptor signInputCaptor = ArgumentCaptor.forClass(String.class); + Mockito.verify(signatureGeneratorSpy).signAsString(signInputCaptor.capture()); + + + Call captorValue = callArgumentCaptor.getValue(); + Request actualRequest = captorValue.request(); + + assertEquals("walletAddress=0x12e32db8817e292508c34111cbc4b23340df542c&startDate=2026-05-01&endDate=2026-05-25&tokenSymbol=USDT&direction=INBOUND&offset=0&limit=20&recvWindow=5000×tamp=1736393892000", signInputCaptor.getValue()); + assertEquals( + "a0bfcdd90cfd312cfe55c646ab62b221b937c42d1c725390994b060476c07c7c", actualRequest.url().queryParameter("signature")); + assertEquals("/sapi/v1/w3w/wallet/prediction/transfer/list", actualRequest.url().encodedPath()); + } + + /** + * Query Transfer Status + * + *

Query the current status of a prediction wallet transfer by transfer ID. + * **`status` values:** Terminal states are `COMPLETED` and + * `FAILED`. Intermediate states are `PROCESSING` and `PENDING`. + * **Do not** poll for `SUCCESS` — it is not a valid terminal state. Weight(IP): 200 + * Security Type: USER_DATA + * + * @throws ApiException if the Api call fails + */ + @Test + public void queryTransferStatusTest() throws ApiException, CryptoException { + String transferId = "tf_20260525_out_001"; + Long recvWindow = 5000L; + ApiResponse response = + api.queryTransferStatus(transferId, recvWindow); + + ArgumentCaptor callArgumentCaptor = ArgumentCaptor.forClass(Call.class); + Mockito.verify(apiClientSpy) + .execute(callArgumentCaptor.capture(), Mockito.any(java.lang.reflect.Type.class)); + + ArgumentCaptor signInputCaptor = ArgumentCaptor.forClass(String.class); + Mockito.verify(signatureGeneratorSpy).signAsString(signInputCaptor.capture()); + + + Call captorValue = callArgumentCaptor.getValue(); + Request actualRequest = captorValue.request(); + + assertEquals("transferId=tf_20260525_out_001&recvWindow=5000×tamp=1736393892000", signInputCaptor.getValue()); + assertEquals( + "fe1e56ec365ca65f201112ebc36131ec412957628067242dca06f1b3b28c1e18", actualRequest.url().queryParameter("signature")); + assertEquals("/sapi/v1/w3w/wallet/prediction/transfer/status", actualRequest.url().encodedPath()); + } +} diff --git a/clients/w3w-prediction/src/test/java/com/binance/connector/client/w3w_prediction/rest/api/WalletApiTest.java b/clients/w3w-prediction/src/test/java/com/binance/connector/client/w3w_prediction/rest/api/WalletApiTest.java new file mode 100644 index 000000000..6bff5440c --- /dev/null +++ b/clients/w3w-prediction/src/test/java/com/binance/connector/client/w3w_prediction/rest/api/WalletApiTest.java @@ -0,0 +1,208 @@ +/* + * Prediction Trading REST API + * Place and manage prediction market orders, query positions, and transfer funds via the Prediction Trading 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.w3w_prediction.rest.api; + +import static org.junit.Assert.assertEquals; + +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 com.binance.connector.client.w3w_prediction.rest.model.GetPortfolioResponse; +import com.binance.connector.client.w3w_prediction.rest.model.GetQuotaStatusResponse; +import com.binance.connector.client.w3w_prediction.rest.model.ListPredictionWalletsResponse; +import com.binance.connector.client.w3w_prediction.rest.model.QueryPaymentOptionBalancesResponse; +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 WalletApi */ +public class WalletApiTest { + + private WalletApi 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 WalletApi(apiClientSpy); + } + + /** + * Get Portfolio + * + *

Get the authenticated user's prediction portfolio overview including active positions + * count, aggregated PnL, and full position list. Weight(IP): 200 Security Type: USER_DATA + * + * @throws ApiException if the Api call fails + */ + @Test + public void getPortfolioTest() throws ApiException, CryptoException { + String walletAddress = "0x12e32db8817e292508c34111cbc4b23340df542c"; + String tokenId = "112233"; + Long marketId = 5567895L; + Long marketTopicId = 4229564L; + Boolean activeOnly = false; + Long recvWindow = 5000L; + ApiResponse response = + api.getPortfolio( + walletAddress, tokenId, marketId, marketTopicId, activeOnly, recvWindow); + + ArgumentCaptor callArgumentCaptor = ArgumentCaptor.forClass(Call.class); + Mockito.verify(apiClientSpy) + .execute(callArgumentCaptor.capture(), Mockito.any(java.lang.reflect.Type.class)); + + ArgumentCaptor signInputCaptor = ArgumentCaptor.forClass(String.class); + Mockito.verify(signatureGeneratorSpy).signAsString(signInputCaptor.capture()); + + + Call captorValue = callArgumentCaptor.getValue(); + Request actualRequest = captorValue.request(); + + assertEquals("walletAddress=0x12e32db8817e292508c34111cbc4b23340df542c&tokenId=112233&marketId=5567895&marketTopicId=4229564&activeOnly=false&recvWindow=5000×tamp=1736393892000", signInputCaptor.getValue()); + assertEquals("3391f5addbbd9df9223b3ee531bbdaf0f8861f6a01f0621b8f4c086b7dafd3bf", actualRequest.url().queryParameter("signature")); + assertEquals("/sapi/v1/w3w/wallet/prediction/pnl/portfolio", actualRequest.url().encodedPath()); + } + + /** + * Get Quota Status + * + *

Query the current user's daily trading quota limit and remaining allowance for + * prediction markets. Weight(IP): 200 Security Type: USER_DATA + * + * @throws ApiException if the Api call fails + */ + @Test + public void getQuotaStatusTest() throws ApiException, CryptoException { + Long recvWindow = 5000L; + ApiResponse response = api.getQuotaStatus(recvWindow); + + ArgumentCaptor callArgumentCaptor = ArgumentCaptor.forClass(Call.class); + Mockito.verify(apiClientSpy) + .execute(callArgumentCaptor.capture(), Mockito.any(java.lang.reflect.Type.class)); + + ArgumentCaptor signInputCaptor = ArgumentCaptor.forClass(String.class); + Mockito.verify(signatureGeneratorSpy).signAsString(signInputCaptor.capture()); + + + Call captorValue = callArgumentCaptor.getValue(); + Request actualRequest = captorValue.request(); + + assertEquals("recvWindow=5000×tamp=1736393892000", signInputCaptor.getValue()); + assertEquals("2cdd1e484bce80021437bee6b762e6a276b1954c3a0c011a16f6f2f6a47aba75", actualRequest.url().queryParameter("signature")); + assertEquals("/sapi/v1/w3w/wallet/prediction/quota/limit/status", actualRequest.url().encodedPath()); + } + + /** + * List Prediction Wallets + * + *

Get all prediction wallets registered for the authenticated user. Weight(IP): 200 Security + * Type: USER_DATA + * + * @throws ApiException if the Api call fails + */ + @Test + public void listPredictionWalletsTest() throws ApiException, CryptoException { + Long recvWindow = 5000L; + ApiResponse response = api.listPredictionWallets(recvWindow); + + ArgumentCaptor callArgumentCaptor = ArgumentCaptor.forClass(Call.class); + Mockito.verify(apiClientSpy) + .execute(callArgumentCaptor.capture(), Mockito.any(java.lang.reflect.Type.class)); + + ArgumentCaptor signInputCaptor = ArgumentCaptor.forClass(String.class); + Mockito.verify(signatureGeneratorSpy).signAsString(signInputCaptor.capture()); + + + Call captorValue = callArgumentCaptor.getValue(); + Request actualRequest = captorValue.request(); + + assertEquals("recvWindow=5000×tamp=1736393892000", signInputCaptor.getValue()); + assertEquals( + "2cdd1e484bce80021437bee6b762e6a276b1954c3a0c011a16f6f2f6a47aba75", + actualRequest.url().queryParameter("signature")); + assertEquals("/sapi/v1/w3w/wallet/prediction/wallet/list", actualRequest.url().encodedPath()); + } + + /** + * Query Payment Option Balances + * + *

Get available balances for each payment option that can be used for prediction trading. + * Weight(IP): 200 Security Type: USER_DATA + * + * @throws ApiException if the Api call fails + */ + @Test + public void queryPaymentOptionBalancesTest() throws ApiException, CryptoException { + Long recvWindow = 5000L; + ApiResponse response = + api.queryPaymentOptionBalances(recvWindow); + + ArgumentCaptor callArgumentCaptor = ArgumentCaptor.forClass(Call.class); + Mockito.verify(apiClientSpy) + .execute(callArgumentCaptor.capture(), Mockito.any(java.lang.reflect.Type.class)); + + ArgumentCaptor signInputCaptor = ArgumentCaptor.forClass(String.class); + Mockito.verify(signatureGeneratorSpy).signAsString(signInputCaptor.capture()); + + + Call captorValue = callArgumentCaptor.getValue(); + Request actualRequest = captorValue.request(); + + assertEquals("recvWindow=5000×tamp=1736393892000", signInputCaptor.getValue()); + assertEquals( + "2cdd1e484bce80021437bee6b762e6a276b1954c3a0c011a16f6f2f6a47aba75", + actualRequest.url().queryParameter("signature")); + assertEquals("/sapi/v1/w3w/wallet/prediction/balance/payment-options", actualRequest.url().encodedPath()); + } +} diff --git a/examples/pom.xml b/examples/pom.xml index 3f7dc25fc..ba72d85f2 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -39,6 +39,7 @@ staking sub-account vip-loan + w3w-prediction wallet diff --git a/examples/w3w-prediction/pom.xml b/examples/w3w-prediction/pom.xml new file mode 100644 index 000000000..c0c474239 --- /dev/null +++ b/examples/w3w-prediction/pom.xml @@ -0,0 +1,37 @@ + + + + 4.0.0 + binance-w3w-prediction-examples + w3w-prediction + 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-w3w-prediction + 1.0.0 + + + \ No newline at end of file diff --git a/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/marketdata/GetMarketDetailExample.java b/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/marketdata/GetMarketDetailExample.java new file mode 100644 index 000000000..4a98ffea8 --- /dev/null +++ b/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/marketdata/GetMarketDetailExample.java @@ -0,0 +1,41 @@ +package com.binance.connector.client.w3w_prediction.rest.marketdata; + +import com.binance.connector.client.common.ApiException; +import com.binance.connector.client.common.ApiResponse; +import com.binance.connector.client.common.configuration.ClientConfiguration; +import com.binance.connector.client.common.configuration.SignatureConfiguration; +import com.binance.connector.client.w3w_prediction.rest.W3WPredictionRestApiUtil; +import com.binance.connector.client.w3w_prediction.rest.api.W3WPredictionRestApi; +import com.binance.connector.client.w3w_prediction.rest.model.GetMarketDetailResponse; + +/** API examples for MarketDataApi */ +public class GetMarketDetailExample { + private W3WPredictionRestApi api; + + public W3WPredictionRestApi getApi() { + if (api == null) { + ClientConfiguration clientConfiguration = + W3WPredictionRestApiUtil.getClientConfiguration(); + SignatureConfiguration signatureConfiguration = new SignatureConfiguration(); + signatureConfiguration.setApiKey("apiKey"); + signatureConfiguration.setPrivateKey("path/to/private.key"); + clientConfiguration.setSignatureConfiguration(signatureConfiguration); + api = new W3WPredictionRestApi(clientConfiguration); + } + return api; + } + + /** + * Get Market Detail + * + *

Get full details for a specific prediction market topic, including variant data and + * timeline. Weight(IP): 200 + * + * @throws ApiException if the Api call fails + */ + public void getMarketDetailExample() throws ApiException { + Long marketTopicId = 4229564L; + ApiResponse response = getApi().getMarketDetail(marketTopicId); + System.out.println(response.getData()); + } +} diff --git a/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/marketdata/ListPredictionCategoriesExample.java b/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/marketdata/ListPredictionCategoriesExample.java new file mode 100644 index 000000000..9f1c0725c --- /dev/null +++ b/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/marketdata/ListPredictionCategoriesExample.java @@ -0,0 +1,40 @@ +package com.binance.connector.client.w3w_prediction.rest.marketdata; + +import com.binance.connector.client.common.ApiException; +import com.binance.connector.client.common.ApiResponse; +import com.binance.connector.client.common.configuration.ClientConfiguration; +import com.binance.connector.client.common.configuration.SignatureConfiguration; +import com.binance.connector.client.w3w_prediction.rest.W3WPredictionRestApiUtil; +import com.binance.connector.client.w3w_prediction.rest.api.W3WPredictionRestApi; +import com.binance.connector.client.w3w_prediction.rest.model.ListPredictionCategoriesResponse; + +/** API examples for MarketDataApi */ +public class ListPredictionCategoriesExample { + private W3WPredictionRestApi api; + + public W3WPredictionRestApi getApi() { + if (api == null) { + ClientConfiguration clientConfiguration = + W3WPredictionRestApiUtil.getClientConfiguration(); + SignatureConfiguration signatureConfiguration = new SignatureConfiguration(); + signatureConfiguration.setApiKey("apiKey"); + signatureConfiguration.setPrivateKey("path/to/private.key"); + clientConfiguration.setSignatureConfiguration(signatureConfiguration); + api = new W3WPredictionRestApi(clientConfiguration); + } + return api; + } + + /** + * List Prediction Categories + * + *

Get all available prediction market categories (L1 and L2). Weight(IP): 200 + * + * @throws ApiException if the Api call fails + */ + public void listPredictionCategoriesExample() throws ApiException { + ApiResponse response = + getApi().listPredictionCategories(); + System.out.println(response.getData()); + } +} diff --git a/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/marketdata/ListPredictionMarketsExample.java b/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/marketdata/ListPredictionMarketsExample.java new file mode 100644 index 000000000..dcaaea103 --- /dev/null +++ b/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/marketdata/ListPredictionMarketsExample.java @@ -0,0 +1,50 @@ +package com.binance.connector.client.w3w_prediction.rest.marketdata; + +import com.binance.connector.client.common.ApiException; +import com.binance.connector.client.common.ApiResponse; +import com.binance.connector.client.common.configuration.ClientConfiguration; +import com.binance.connector.client.common.configuration.SignatureConfiguration; +import com.binance.connector.client.w3w_prediction.rest.W3WPredictionRestApiUtil; +import com.binance.connector.client.w3w_prediction.rest.api.W3WPredictionRestApi; +import com.binance.connector.client.w3w_prediction.rest.model.ListPredictionMarketsResponse; +import com.binance.connector.client.w3w_prediction.rest.model.OrderBy; +import com.binance.connector.client.w3w_prediction.rest.model.SortBy; + +/** API examples for MarketDataApi */ +public class ListPredictionMarketsExample { + private W3WPredictionRestApi api; + + public W3WPredictionRestApi getApi() { + if (api == null) { + ClientConfiguration clientConfiguration = + W3WPredictionRestApiUtil.getClientConfiguration(); + SignatureConfiguration signatureConfiguration = new SignatureConfiguration(); + signatureConfiguration.setApiKey("apiKey"); + signatureConfiguration.setPrivateKey("path/to/private.key"); + clientConfiguration.setSignatureConfiguration(signatureConfiguration); + api = new W3WPredictionRestApi(clientConfiguration); + } + return api; + } + + /** + * List Prediction Markets + * + *

Get a paginated list of prediction market topics, with optional category and sort filters. + * Weight(IP): 200 + * + * @throws ApiException if the Api call fails + */ + public void listPredictionMarketsExample() throws ApiException { + String l1Category = "crypto"; + String l2Category = "up-down"; + SortBy sortBy = SortBy.RECOMMENDED; + OrderBy orderBy = OrderBy.ASC; + Integer offset = 0; + Integer limit = 20; + ApiResponse response = + getApi().listPredictionMarkets( + l1Category, l2Category, sortBy, orderBy, offset, limit); + System.out.println(response.getData()); + } +} diff --git a/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/marketdata/MarketSearchExample.java b/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/marketdata/MarketSearchExample.java new file mode 100644 index 000000000..325a2a3ec --- /dev/null +++ b/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/marketdata/MarketSearchExample.java @@ -0,0 +1,41 @@ +package com.binance.connector.client.w3w_prediction.rest.marketdata; + +import com.binance.connector.client.common.ApiException; +import com.binance.connector.client.common.ApiResponse; +import com.binance.connector.client.common.configuration.ClientConfiguration; +import com.binance.connector.client.common.configuration.SignatureConfiguration; +import com.binance.connector.client.w3w_prediction.rest.W3WPredictionRestApiUtil; +import com.binance.connector.client.w3w_prediction.rest.api.W3WPredictionRestApi; +import com.binance.connector.client.w3w_prediction.rest.model.MarketSearchResponse; + +/** API examples for MarketDataApi */ +public class MarketSearchExample { + private W3WPredictionRestApi api; + + public W3WPredictionRestApi getApi() { + if (api == null) { + ClientConfiguration clientConfiguration = + W3WPredictionRestApiUtil.getClientConfiguration(); + SignatureConfiguration signatureConfiguration = new SignatureConfiguration(); + signatureConfiguration.setApiKey("apiKey"); + signatureConfiguration.setPrivateKey("path/to/private.key"); + clientConfiguration.setSignatureConfiguration(signatureConfiguration); + api = new W3WPredictionRestApi(clientConfiguration); + } + return api; + } + + /** + * Market Search + * + *

Semantic search for prediction market topics by keyword. Weight(IP): 200 + * + * @throws ApiException if the Api call fails + */ + public void marketSearchExample() throws ApiException { + String query = "BTC price"; + Integer topK = 20; + ApiResponse response = getApi().marketSearch(query, topK); + System.out.println(response.getData()); + } +} diff --git a/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/marketdata/QueryLastTradePriceExample.java b/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/marketdata/QueryLastTradePriceExample.java new file mode 100644 index 000000000..f445628ca --- /dev/null +++ b/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/marketdata/QueryLastTradePriceExample.java @@ -0,0 +1,40 @@ +package com.binance.connector.client.w3w_prediction.rest.marketdata; + +import com.binance.connector.client.common.ApiException; +import com.binance.connector.client.common.ApiResponse; +import com.binance.connector.client.common.configuration.ClientConfiguration; +import com.binance.connector.client.common.configuration.SignatureConfiguration; +import com.binance.connector.client.w3w_prediction.rest.W3WPredictionRestApiUtil; +import com.binance.connector.client.w3w_prediction.rest.api.W3WPredictionRestApi; +import com.binance.connector.client.w3w_prediction.rest.model.QueryLastTradePriceResponse; + +/** API examples for MarketDataApi */ +public class QueryLastTradePriceExample { + private W3WPredictionRestApi api; + + public W3WPredictionRestApi getApi() { + if (api == null) { + ClientConfiguration clientConfiguration = + W3WPredictionRestApiUtil.getClientConfiguration(); + SignatureConfiguration signatureConfiguration = new SignatureConfiguration(); + signatureConfiguration.setApiKey("apiKey"); + signatureConfiguration.setPrivateKey("path/to/private.key"); + clientConfiguration.setSignatureConfiguration(signatureConfiguration); + api = new W3WPredictionRestApi(clientConfiguration); + } + return api; + } + + /** + * Query Last Trade Price + * + *

Get the most recent trade price for a prediction market. Weight(IP): 200 + * + * @throws ApiException if the Api call fails + */ + public void queryLastTradePriceExample() throws ApiException { + Long marketId = 5567895L; + ApiResponse response = getApi().queryLastTradePrice(marketId); + System.out.println(response.getData()); + } +} diff --git a/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/marketdata/QueryOrderBookExample.java b/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/marketdata/QueryOrderBookExample.java new file mode 100644 index 000000000..e3516abcd --- /dev/null +++ b/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/marketdata/QueryOrderBookExample.java @@ -0,0 +1,44 @@ +package com.binance.connector.client.w3w_prediction.rest.marketdata; + +import com.binance.connector.client.common.ApiException; +import com.binance.connector.client.common.ApiResponse; +import com.binance.connector.client.common.configuration.ClientConfiguration; +import com.binance.connector.client.common.configuration.SignatureConfiguration; +import com.binance.connector.client.w3w_prediction.rest.W3WPredictionRestApiUtil; +import com.binance.connector.client.w3w_prediction.rest.api.W3WPredictionRestApi; +import com.binance.connector.client.w3w_prediction.rest.model.QueryOrderBookResponse; + +/** API examples for MarketDataApi */ +public class QueryOrderBookExample { + private W3WPredictionRestApi api; + + public W3WPredictionRestApi getApi() { + if (api == null) { + ClientConfiguration clientConfiguration = + W3WPredictionRestApiUtil.getClientConfiguration(); + SignatureConfiguration signatureConfiguration = new SignatureConfiguration(); + signatureConfiguration.setApiKey("apiKey"); + signatureConfiguration.setPrivateKey("path/to/private.key"); + clientConfiguration.setSignatureConfiguration(signatureConfiguration); + api = new W3WPredictionRestApi(clientConfiguration); + } + return api; + } + + /** + * Query Order Book + * + *

Get the current order book (bids and asks) for a specific prediction market outcome token. + * Weight(IP): 200 + * + * @throws ApiException if the Api call fails + */ + public void queryOrderBookExample() throws ApiException { + String vendor = "predict_fun"; + Long marketId = 5567895L; + String tokenId = "112233"; + ApiResponse response = + getApi().queryOrderBook(vendor, marketId, tokenId); + System.out.println(response.getData()); + } +} diff --git a/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/position/GetPositionByTokenExample.java b/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/position/GetPositionByTokenExample.java new file mode 100644 index 000000000..4dfaeb626 --- /dev/null +++ b/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/position/GetPositionByTokenExample.java @@ -0,0 +1,44 @@ +package com.binance.connector.client.w3w_prediction.rest.position; + +import com.binance.connector.client.common.ApiException; +import com.binance.connector.client.common.ApiResponse; +import com.binance.connector.client.common.configuration.ClientConfiguration; +import com.binance.connector.client.common.configuration.SignatureConfiguration; +import com.binance.connector.client.w3w_prediction.rest.W3WPredictionRestApiUtil; +import com.binance.connector.client.w3w_prediction.rest.api.W3WPredictionRestApi; +import com.binance.connector.client.w3w_prediction.rest.model.GetPositionByTokenResponse; + +/** API examples for PositionApi */ +public class GetPositionByTokenExample { + private W3WPredictionRestApi api; + + public W3WPredictionRestApi getApi() { + if (api == null) { + ClientConfiguration clientConfiguration = + W3WPredictionRestApiUtil.getClientConfiguration(); + SignatureConfiguration signatureConfiguration = new SignatureConfiguration(); + signatureConfiguration.setApiKey("apiKey"); + signatureConfiguration.setPrivateKey("path/to/private.key"); + clientConfiguration.setSignatureConfiguration(signatureConfiguration); + api = new W3WPredictionRestApi(clientConfiguration); + } + return api; + } + + /** + * Get Position by Token + * + *

Get the authenticated user's position detail for a specific prediction token. + * Weight(IP): 200 Security Type: USER_DATA + * + * @throws ApiException if the Api call fails + */ + public void getPositionByTokenExample() throws ApiException { + String walletAddress = "0x12e32db8817e292508c34111cbc4b23340df542c"; + String tokenId = "112233"; + Long recvWindow = 5000L; + ApiResponse response = + getApi().getPositionByToken(walletAddress, tokenId, recvWindow); + System.out.println(response.getData()); + } +} diff --git a/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/position/QueryPnLExample.java b/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/position/QueryPnLExample.java new file mode 100644 index 000000000..1cfbd6b27 --- /dev/null +++ b/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/position/QueryPnLExample.java @@ -0,0 +1,54 @@ +package com.binance.connector.client.w3w_prediction.rest.position; + +import com.binance.connector.client.common.ApiException; +import com.binance.connector.client.common.ApiResponse; +import com.binance.connector.client.common.configuration.ClientConfiguration; +import com.binance.connector.client.common.configuration.SignatureConfiguration; +import com.binance.connector.client.w3w_prediction.rest.W3WPredictionRestApiUtil; +import com.binance.connector.client.w3w_prediction.rest.api.W3WPredictionRestApi; +import com.binance.connector.client.w3w_prediction.rest.model.QueryPnLResponse; + +/** API examples for PositionApi */ +public class QueryPnLExample { + private W3WPredictionRestApi api; + + public W3WPredictionRestApi getApi() { + if (api == null) { + ClientConfiguration clientConfiguration = + W3WPredictionRestApiUtil.getClientConfiguration(); + SignatureConfiguration signatureConfiguration = new SignatureConfiguration(); + signatureConfiguration.setApiKey("apiKey"); + signatureConfiguration.setPrivateKey("path/to/private.key"); + clientConfiguration.setSignatureConfiguration(signatureConfiguration); + api = new W3WPredictionRestApi(clientConfiguration); + } + return api; + } + + /** + * Query PnL + * + *

Query profit and loss records for the authenticated user's prediction positions. When + * `tokenId` is provided, returns a single record in `pnl`; otherwise + * returns a list in `pnlList`. Weight(IP): 200 Security Type: USER_DATA + * + * @throws ApiException if the Api call fails + */ + public void queryPnLExample() throws ApiException { + String walletAddress = "0x12e32db8817e292508c34111cbc4b23340df542c"; + String tokenId = "112233"; + Long marketId = 5567895L; + Long marketTopicId = 4229564L; + Boolean activeOnly = false; + Long recvWindow = 5000L; + ApiResponse response = + getApi().queryPnL( + walletAddress, + tokenId, + marketId, + marketTopicId, + activeOnly, + recvWindow); + System.out.println(response.getData()); + } +} diff --git a/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/position/QueryPositionsByFilterExample.java b/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/position/QueryPositionsByFilterExample.java new file mode 100644 index 000000000..50f820e54 --- /dev/null +++ b/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/position/QueryPositionsByFilterExample.java @@ -0,0 +1,44 @@ +package com.binance.connector.client.w3w_prediction.rest.position; + +import com.binance.connector.client.common.ApiException; +import com.binance.connector.client.common.ApiResponse; +import com.binance.connector.client.common.configuration.ClientConfiguration; +import com.binance.connector.client.common.configuration.SignatureConfiguration; +import com.binance.connector.client.w3w_prediction.rest.W3WPredictionRestApiUtil; +import com.binance.connector.client.w3w_prediction.rest.api.W3WPredictionRestApi; +import com.binance.connector.client.w3w_prediction.rest.model.QueryPositionsByFilterResponse; + +/** API examples for PositionApi */ +public class QueryPositionsByFilterExample { + private W3WPredictionRestApi api; + + public W3WPredictionRestApi getApi() { + if (api == null) { + ClientConfiguration clientConfiguration = + W3WPredictionRestApiUtil.getClientConfiguration(); + SignatureConfiguration signatureConfiguration = new SignatureConfiguration(); + signatureConfiguration.setApiKey("apiKey"); + signatureConfiguration.setPrivateKey("path/to/private.key"); + clientConfiguration.setSignatureConfiguration(signatureConfiguration); + api = new W3WPredictionRestApi(clientConfiguration); + } + return api; + } + + /** + * Query Positions by Filter + * + *

Get prediction positions filtered by wallet address and/or market topic ID. Both + * parameters are optional. Weight(IP): 200 Security Type: USER_DATA + * + * @throws ApiException if the Api call fails + */ + public void queryPositionsByFilterExample() throws ApiException { + String walletAddress = "0x12e32db8817e292508c34111cbc4b23340df542c"; + Long marketTopicId = 4229564L; + Long recvWindow = 5000L; + ApiResponse response = + getApi().queryPositionsByFilter(walletAddress, marketTopicId, recvWindow); + System.out.println(response.getData()); + } +} diff --git a/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/position/QueryPositionsExample.java b/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/position/QueryPositionsExample.java new file mode 100644 index 000000000..b0429fa4c --- /dev/null +++ b/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/position/QueryPositionsExample.java @@ -0,0 +1,46 @@ +package com.binance.connector.client.w3w_prediction.rest.position; + +import com.binance.connector.client.common.ApiException; +import com.binance.connector.client.common.ApiResponse; +import com.binance.connector.client.common.configuration.ClientConfiguration; +import com.binance.connector.client.common.configuration.SignatureConfiguration; +import com.binance.connector.client.w3w_prediction.rest.W3WPredictionRestApiUtil; +import com.binance.connector.client.w3w_prediction.rest.api.W3WPredictionRestApi; +import com.binance.connector.client.w3w_prediction.rest.model.QueryPositionsResponse; + +/** API examples for PositionApi */ +public class QueryPositionsExample { + private W3WPredictionRestApi api; + + public W3WPredictionRestApi getApi() { + if (api == null) { + ClientConfiguration clientConfiguration = + W3WPredictionRestApiUtil.getClientConfiguration(); + SignatureConfiguration signatureConfiguration = new SignatureConfiguration(); + signatureConfiguration.setApiKey("apiKey"); + signatureConfiguration.setPrivateKey("path/to/private.key"); + clientConfiguration.setSignatureConfiguration(signatureConfiguration); + api = new W3WPredictionRestApi(clientConfiguration); + } + return api; + } + + /** + * Query Positions + * + *

Get the authenticated user's prediction token positions with portfolio summary and + * tab-based filtering. Weight(IP): 200 Security Type: USER_DATA + * + * @throws ApiException if the Api call fails + */ + public void queryPositionsExample() throws ApiException { + String walletAddress = "0x12e32db8817e292508c34111cbc4b23340df542c"; + String tab = "ONGOING"; + Integer offset = 0; + Integer limit = 20; + Long recvWindow = 5000L; + ApiResponse response = + getApi().queryPositions(walletAddress, tab, offset, limit, recvWindow); + System.out.println(response.getData()); + } +} diff --git a/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/position/QuerySettledPositionHistoryExample.java b/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/position/QuerySettledPositionHistoryExample.java new file mode 100644 index 000000000..9a6d470f6 --- /dev/null +++ b/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/position/QuerySettledPositionHistoryExample.java @@ -0,0 +1,57 @@ +package com.binance.connector.client.w3w_prediction.rest.position; + +import com.binance.connector.client.common.ApiException; +import com.binance.connector.client.common.ApiResponse; +import com.binance.connector.client.common.configuration.ClientConfiguration; +import com.binance.connector.client.common.configuration.SignatureConfiguration; +import com.binance.connector.client.w3w_prediction.rest.W3WPredictionRestApiUtil; +import com.binance.connector.client.w3w_prediction.rest.api.W3WPredictionRestApi; +import com.binance.connector.client.w3w_prediction.rest.model.QuerySettledPositionHistoryResponse; + +/** API examples for PositionApi */ +public class QuerySettledPositionHistoryExample { + private W3WPredictionRestApi api; + + public W3WPredictionRestApi getApi() { + if (api == null) { + ClientConfiguration clientConfiguration = + W3WPredictionRestApiUtil.getClientConfiguration(); + SignatureConfiguration signatureConfiguration = new SignatureConfiguration(); + signatureConfiguration.setApiKey("apiKey"); + signatureConfiguration.setPrivateKey("path/to/private.key"); + clientConfiguration.setSignatureConfiguration(signatureConfiguration); + api = new W3WPredictionRestApi(clientConfiguration); + } + return api; + } + + /** + * Query Settled Position History + * + *

Get the authenticated user's settled (resolved) prediction position history with + * optional filters. Weight(IP): 200 Security Type: USER_DATA + * + * @throws ApiException if the Api call fails + */ + public void querySettledPositionHistoryExample() throws ApiException { + String walletAddress = "0x12e32db8817e292508c34111cbc4b23340df542c"; + String l1Category = "crypto"; + Integer result = 1; + String startDate = "2026-05-01"; + String endDate = "2026-05-25"; + Integer offset = 0; + Integer limit = 20; + Long recvWindow = 5000L; + ApiResponse response = + getApi().querySettledPositionHistory( + walletAddress, + l1Category, + result, + startDate, + endDate, + offset, + limit, + recvWindow); + System.out.println(response.getData()); + } +} diff --git a/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/redeem/BatchRedeemExample.java b/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/redeem/BatchRedeemExample.java new file mode 100644 index 000000000..0cf425b50 --- /dev/null +++ b/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/redeem/BatchRedeemExample.java @@ -0,0 +1,46 @@ +package com.binance.connector.client.w3w_prediction.rest.redeem; + +import com.binance.connector.client.common.ApiException; +import com.binance.connector.client.common.ApiResponse; +import com.binance.connector.client.common.configuration.ClientConfiguration; +import com.binance.connector.client.common.configuration.SignatureConfiguration; +import com.binance.connector.client.w3w_prediction.rest.W3WPredictionRestApiUtil; +import com.binance.connector.client.w3w_prediction.rest.api.W3WPredictionRestApi; +import com.binance.connector.client.w3w_prediction.rest.model.BatchRedeemRequest; +import com.binance.connector.client.w3w_prediction.rest.model.BatchRedeemResponse; +import com.binance.connector.client.w3w_prediction.rest.model.TokenIds; + +/** API examples for RedeemApi */ +public class BatchRedeemExample { + private W3WPredictionRestApi api; + + public W3WPredictionRestApi getApi() { + if (api == null) { + ClientConfiguration clientConfiguration = + W3WPredictionRestApiUtil.getClientConfiguration(); + SignatureConfiguration signatureConfiguration = new SignatureConfiguration(); + signatureConfiguration.setApiKey("apiKey"); + signatureConfiguration.setPrivateKey("path/to/private.key"); + clientConfiguration.setSignatureConfiguration(signatureConfiguration); + api = new W3WPredictionRestApi(clientConfiguration); + } + return api; + } + + /** + * Batch Redeem + * + *

Redeem one or more settled prediction tokens on-chain to claim winnings. Requires SAS + * authorization. Weight(IP): 200 Security Type: TRADE + * + * @throws ApiException if the Api call fails + */ + public void batchRedeemExample() throws ApiException { + BatchRedeemRequest batchRedeemRequest = new BatchRedeemRequest(); + batchRedeemRequest.walletAddress("0x12e32db8817e292508c34111cbc4b23340df542c"); + batchRedeemRequest.walletId("5b5c1ec3be4e4416a5872b21c1ca5d20"); + batchRedeemRequest.tokenIds(new TokenIds()); + ApiResponse response = getApi().batchRedeem(batchRedeemRequest); + System.out.println(response.getData()); + } +} diff --git a/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/redeem/GetRedeemStatusExample.java b/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/redeem/GetRedeemStatusExample.java new file mode 100644 index 000000000..8309dde5a --- /dev/null +++ b/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/redeem/GetRedeemStatusExample.java @@ -0,0 +1,48 @@ +package com.binance.connector.client.w3w_prediction.rest.redeem; + +import com.binance.connector.client.common.ApiException; +import com.binance.connector.client.common.ApiResponse; +import com.binance.connector.client.common.configuration.ClientConfiguration; +import com.binance.connector.client.common.configuration.SignatureConfiguration; +import com.binance.connector.client.w3w_prediction.rest.W3WPredictionRestApiUtil; +import com.binance.connector.client.w3w_prediction.rest.api.W3WPredictionRestApi; +import com.binance.connector.client.w3w_prediction.rest.model.GetRedeemStatusResponse; + +/** API examples for RedeemApi */ +public class GetRedeemStatusExample { + private W3WPredictionRestApi api; + + public W3WPredictionRestApi getApi() { + if (api == null) { + ClientConfiguration clientConfiguration = + W3WPredictionRestApiUtil.getClientConfiguration(); + SignatureConfiguration signatureConfiguration = new SignatureConfiguration(); + signatureConfiguration.setApiKey("apiKey"); + signatureConfiguration.setPrivateKey("path/to/private.key"); + clientConfiguration.setSignatureConfiguration(signatureConfiguration); + api = new W3WPredictionRestApi(clientConfiguration); + } + return api; + } + + /** + * Get Redeem Status + * + *

Query the on-chain transaction status of a previously submitted redeem request. + * Weight(IP): 200 Security Type: USER_DATA Response Notes: - Status values: | Value | + * Description | | ----------- | -------------------------------------------- | | + * `PENDING` | Transaction submitted, awaiting confirmation | | `CONFIRMED` + * | Transaction confirmed on-chain | | `FAILED` | Transaction failed | | + * `NOT_FOUND` | Transaction hash not found | + * + * @throws ApiException if the Api call fails + */ + public void getRedeemStatusExample() throws ApiException { + String walletAddress = "0x12e32db8817e292508c34111cbc4b23340df542c"; + String txHash = "0xabc123def456789abcdef123456789abcdef123456789abcdef123456789abcd"; + Long recvWindow = 5000L; + ApiResponse response = + getApi().getRedeemStatus(walletAddress, txHash, recvWindow); + System.out.println(response.getData()); + } +} diff --git a/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/trade/BatchCancelOrdersExample.java b/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/trade/BatchCancelOrdersExample.java new file mode 100644 index 000000000..894842ef8 --- /dev/null +++ b/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/trade/BatchCancelOrdersExample.java @@ -0,0 +1,60 @@ +package com.binance.connector.client.w3w_prediction.rest.trade; + +import com.binance.connector.client.common.ApiException; +import com.binance.connector.client.common.ApiResponse; +import com.binance.connector.client.common.configuration.ClientConfiguration; +import com.binance.connector.client.common.configuration.SignatureConfiguration; +import com.binance.connector.client.w3w_prediction.rest.W3WPredictionRestApiUtil; +import com.binance.connector.client.w3w_prediction.rest.api.W3WPredictionRestApi; +import com.binance.connector.client.w3w_prediction.rest.model.BatchCancelOrdersRequest; +import com.binance.connector.client.w3w_prediction.rest.model.BatchCancelOrdersResponse; + +/** API examples for TradeApi */ +public class BatchCancelOrdersExample { + private W3WPredictionRestApi api; + + public W3WPredictionRestApi getApi() { + if (api == null) { + ClientConfiguration clientConfiguration = + W3WPredictionRestApiUtil.getClientConfiguration(); + SignatureConfiguration signatureConfiguration = new SignatureConfiguration(); + signatureConfiguration.setApiKey("apiKey"); + signatureConfiguration.setPrivateKey("path/to/private.key"); + clientConfiguration.setSignatureConfiguration(signatureConfiguration); + api = new W3WPredictionRestApi(clientConfiguration); + } + return api; + } + + /** + * Batch Cancel Orders + * + *

Cancel one or more active prediction orders in a single request. Requires SAS + * authorization. **Known Issue — Bracket Encoding Incompatibility:** This endpoint uses indexed + * bracket notation (`cancelInfoList[0].orderId`). Binance SAPI signature verification + * runs over the **raw, unencoded** canonical string. However, mainstream HTTP libraries (Python + * `requests`, Java `HttpURLConnection`/`URI`, Go + * `net/url`, Node.js `url`) automatically percent-encode `[` → + * `%5B` and `]` → `%5D`, producing a signature mismatch with + * error `-1022 Signature for this request is not valid`. Postman is unaffected + * because it does not encode keys. **Workarounds** (use low-level HTTP APIs that do not + * normalize URLs): - **Python:** use `http.client` (stdlib) and hand-build the body + * string. - **Java:** use `HttpURLConnection` and write the raw body bytes directly. + * - **Go:** use `strings.NewReader` with a hand-built body instead of + * `url.Values.Encode()`. Weight(IP): 200 Security Type: TRADE Notes: - Use dot + * notation for nested list fields: `cancelInfoList[0].orderId`, + * `cancelInfoList[1].orderId`, etc. - `vendor` does not need to be + * supplied. The server automatically sets the correct vendor (`predict_fun`) for + * every item in the batch. + * + * @throws ApiException if the Api call fails + */ + public void batchCancelOrdersExample() throws ApiException { + BatchCancelOrdersRequest batchCancelOrdersRequest = new BatchCancelOrdersRequest(); + batchCancelOrdersRequest.walletAddress("0x12e32db8817e292508c34111cbc4b23340df542c"); + batchCancelOrdersRequest.walletId("5b5c1ec3be4e4416a5872b21c1ca5d20"); + ApiResponse response = + getApi().batchCancelOrders(batchCancelOrdersRequest); + System.out.println(response.getData()); + } +} diff --git a/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/trade/GetQuoteExample.java b/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/trade/GetQuoteExample.java new file mode 100644 index 000000000..4ecc0d617 --- /dev/null +++ b/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/trade/GetQuoteExample.java @@ -0,0 +1,58 @@ +package com.binance.connector.client.w3w_prediction.rest.trade; + +import com.binance.connector.client.common.ApiException; +import com.binance.connector.client.common.ApiResponse; +import com.binance.connector.client.common.configuration.ClientConfiguration; +import com.binance.connector.client.common.configuration.SignatureConfiguration; +import com.binance.connector.client.w3w_prediction.rest.W3WPredictionRestApiUtil; +import com.binance.connector.client.w3w_prediction.rest.api.W3WPredictionRestApi; +import com.binance.connector.client.w3w_prediction.rest.model.GetQuoteRequest; +import com.binance.connector.client.w3w_prediction.rest.model.GetQuoteResponse; +import com.binance.connector.client.w3w_prediction.rest.model.OrderType; +import com.binance.connector.client.w3w_prediction.rest.model.Side; + +/** API examples for TradeApi */ +public class GetQuoteExample { + private W3WPredictionRestApi api; + + public W3WPredictionRestApi getApi() { + if (api == null) { + ClientConfiguration clientConfiguration = + W3WPredictionRestApiUtil.getClientConfiguration(); + SignatureConfiguration signatureConfiguration = new SignatureConfiguration(); + signatureConfiguration.setApiKey("apiKey"); + signatureConfiguration.setPrivateKey("path/to/private.key"); + clientConfiguration.setSignatureConfiguration(signatureConfiguration); + api = new W3WPredictionRestApi(clientConfiguration); + } + return api; + } + + /** + * Get Quote + * + *

Get a price quote for a prediction order. The returned `quoteId` must be used in + * the subsequent Place Order request. Weight(IP): 200 Security Type: TRADE Response Notes: - + * `feeAmount` is a string because it is denominated in wei (18 decimals) and may + * exceed JavaScript's safe integer range. `feeDiscountBps` is also a string to + * allow fractional basis-point values in the future. `feeRateBps` and + * `slippageBps` are integers and will never exceed safe integer bounds. - **MARKET + * order minimum amount:** For `MARKET` orders, `amountIn` must be at least + * approximately **1.5 USDT** (in wei: `1500000000000000000`). The exact minimum + * varies by market liquidity. If the amount is too small, the server returns `-9000 Your + * order amount is too small`. This limit does **not** apply to `LIMIT` orders. + * + * @throws ApiException if the Api call fails + */ + public void getQuoteExample() throws ApiException { + GetQuoteRequest getQuoteRequest = new GetQuoteRequest(); + getQuoteRequest.walletAddress("0x12e32db8817e292508c34111cbc4b23340df542c"); + getQuoteRequest.tokenId("112233"); + getQuoteRequest.side(Side.BUY); + getQuoteRequest.amountIn("1000000000000000000"); + getQuoteRequest.orderType(OrderType.MARKET); + getQuoteRequest.slippageBps(1200); + ApiResponse response = getApi().getQuote(getQuoteRequest); + System.out.println(response.getData()); + } +} diff --git a/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/trade/PlaceOrderExample.java b/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/trade/PlaceOrderExample.java new file mode 100644 index 000000000..a5fc9f8d0 --- /dev/null +++ b/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/trade/PlaceOrderExample.java @@ -0,0 +1,54 @@ +package com.binance.connector.client.w3w_prediction.rest.trade; + +import com.binance.connector.client.common.ApiException; +import com.binance.connector.client.common.ApiResponse; +import com.binance.connector.client.common.configuration.ClientConfiguration; +import com.binance.connector.client.common.configuration.SignatureConfiguration; +import com.binance.connector.client.w3w_prediction.rest.W3WPredictionRestApiUtil; +import com.binance.connector.client.w3w_prediction.rest.api.W3WPredictionRestApi; +import com.binance.connector.client.w3w_prediction.rest.model.AccountType; +import com.binance.connector.client.w3w_prediction.rest.model.OrderType; +import com.binance.connector.client.w3w_prediction.rest.model.PlaceOrderRequest; +import com.binance.connector.client.w3w_prediction.rest.model.PlaceOrderResponse; + +/** API examples for TradeApi */ +public class PlaceOrderExample { + private W3WPredictionRestApi api; + + public W3WPredictionRestApi getApi() { + if (api == null) { + ClientConfiguration clientConfiguration = + W3WPredictionRestApiUtil.getClientConfiguration(); + SignatureConfiguration signatureConfiguration = new SignatureConfiguration(); + signatureConfiguration.setApiKey("apiKey"); + signatureConfiguration.setPrivateKey("path/to/private.key"); + clientConfiguration.setSignatureConfiguration(signatureConfiguration); + api = new W3WPredictionRestApi(clientConfiguration); + } + return api; + } + + /** + * Place Order + * + *

Place a prediction order using a previously obtained quote. Requires SAS authorization. + * Weight(IP): 200 Security Type: TRADE Notes: - Validation rules: | orderType | timeInForce | + * priceLimit | | --------- | ------------- | --------------------- | | `MARKET` | + * Must be `FOK` | Not required | | `LIMIT` | Must be `GTC` | + * Required, must be > 0 | + * + * @throws ApiException if the Api call fails + */ + public void placeOrderExample() throws ApiException { + PlaceOrderRequest placeOrderRequest = new PlaceOrderRequest(); + placeOrderRequest.walletAddress("0x12e32db8817e292508c34111cbc4b23340df542c"); + placeOrderRequest.walletId("5b5c1ec3be4e4416a5872b21c1ca5d20"); + placeOrderRequest.quoteId("q_20260525_abc123xyz"); + placeOrderRequest.timeInForce("FOK"); + placeOrderRequest.accountType(AccountType.SPOT); + placeOrderRequest.orderType(OrderType.MARKET); + placeOrderRequest.slippageBps(1200); + ApiResponse response = getApi().placeOrder(placeOrderRequest); + System.out.println(response.getData()); + } +} diff --git a/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/trade/QueryActiveOrdersExample.java b/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/trade/QueryActiveOrdersExample.java new file mode 100644 index 000000000..7c113d379 --- /dev/null +++ b/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/trade/QueryActiveOrdersExample.java @@ -0,0 +1,56 @@ +package com.binance.connector.client.w3w_prediction.rest.trade; + +import com.binance.connector.client.common.ApiException; +import com.binance.connector.client.common.ApiResponse; +import com.binance.connector.client.common.configuration.ClientConfiguration; +import com.binance.connector.client.common.configuration.SignatureConfiguration; +import com.binance.connector.client.w3w_prediction.rest.W3WPredictionRestApiUtil; +import com.binance.connector.client.w3w_prediction.rest.api.W3WPredictionRestApi; +import com.binance.connector.client.w3w_prediction.rest.model.QueryActiveOrdersResponse; +import com.binance.connector.client.w3w_prediction.rest.model.TradeSide; + +/** API examples for TradeApi */ +public class QueryActiveOrdersExample { + private W3WPredictionRestApi api; + + public W3WPredictionRestApi getApi() { + if (api == null) { + ClientConfiguration clientConfiguration = + W3WPredictionRestApiUtil.getClientConfiguration(); + SignatureConfiguration signatureConfiguration = new SignatureConfiguration(); + signatureConfiguration.setApiKey("apiKey"); + signatureConfiguration.setPrivateKey("path/to/private.key"); + clientConfiguration.setSignatureConfiguration(signatureConfiguration); + api = new W3WPredictionRestApi(clientConfiguration); + } + return api; + } + + /** + * Query Active Orders + * + *

Get active (open) prediction orders for the authenticated user. Weight(IP): 200 Security + * Type: USER_DATA + * + * @throws ApiException if the Api call fails + */ + public void queryActiveOrdersExample() throws ApiException { + String walletAddress = "0x12e32db8817e292508c34111cbc4b23340df542c"; + TradeSide tradeSide = TradeSide.BUY; + String l1Category = "crypto"; + Long marketId = 5567895L; + Integer offset = 0; + Integer limit = 20; + Long recvWindow = 5000L; + ApiResponse response = + getApi().queryActiveOrders( + walletAddress, + tradeSide, + l1Category, + marketId, + offset, + limit, + recvWindow); + System.out.println(response.getData()); + } +} diff --git a/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/trade/QueryOrderHistoryExample.java b/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/trade/QueryOrderHistoryExample.java new file mode 100644 index 000000000..bfbed6091 --- /dev/null +++ b/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/trade/QueryOrderHistoryExample.java @@ -0,0 +1,60 @@ +package com.binance.connector.client.w3w_prediction.rest.trade; + +import com.binance.connector.client.common.ApiException; +import com.binance.connector.client.common.ApiResponse; +import com.binance.connector.client.common.configuration.ClientConfiguration; +import com.binance.connector.client.common.configuration.SignatureConfiguration; +import com.binance.connector.client.w3w_prediction.rest.W3WPredictionRestApiUtil; +import com.binance.connector.client.w3w_prediction.rest.api.W3WPredictionRestApi; +import com.binance.connector.client.w3w_prediction.rest.model.OrderType; +import com.binance.connector.client.w3w_prediction.rest.model.QueryOrderHistoryResponse; + +/** API examples for TradeApi */ +public class QueryOrderHistoryExample { + private W3WPredictionRestApi api; + + public W3WPredictionRestApi getApi() { + if (api == null) { + ClientConfiguration clientConfiguration = + W3WPredictionRestApiUtil.getClientConfiguration(); + SignatureConfiguration signatureConfiguration = new SignatureConfiguration(); + signatureConfiguration.setApiKey("apiKey"); + signatureConfiguration.setPrivateKey("path/to/private.key"); + clientConfiguration.setSignatureConfiguration(signatureConfiguration); + api = new W3WPredictionRestApi(clientConfiguration); + } + return api; + } + + /** + * Query Order History + * + *

Get historical prediction orders (all statuses) for the authenticated user, with optional + * filters. Weight(IP): 200 Security Type: USER_DATA + * + * @throws ApiException if the Api call fails + */ + public void queryOrderHistoryExample() throws ApiException { + String walletAddress = "0x12e32db8817e292508c34111cbc4b23340df542c"; + String l1Category = "crypto"; + OrderType orderType = OrderType.MARKET; + String status = "CLOSED"; + String startDate = "2026-05-01"; + String endDate = "2026-05-25"; + Integer offset = 0; + Integer limit = 20; + Long recvWindow = 5000L; + ApiResponse response = + getApi().queryOrderHistory( + walletAddress, + l1Category, + orderType, + status, + startDate, + endDate, + offset, + limit, + recvWindow); + System.out.println(response.getData()); + } +} diff --git a/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/transfer/CreateInboundTransferExample.java b/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/transfer/CreateInboundTransferExample.java new file mode 100644 index 000000000..b471bafe4 --- /dev/null +++ b/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/transfer/CreateInboundTransferExample.java @@ -0,0 +1,52 @@ +package com.binance.connector.client.w3w_prediction.rest.transfer; + +import com.binance.connector.client.common.ApiException; +import com.binance.connector.client.common.ApiResponse; +import com.binance.connector.client.common.configuration.ClientConfiguration; +import com.binance.connector.client.common.configuration.SignatureConfiguration; +import com.binance.connector.client.w3w_prediction.rest.W3WPredictionRestApiUtil; +import com.binance.connector.client.w3w_prediction.rest.api.W3WPredictionRestApi; +import com.binance.connector.client.w3w_prediction.rest.model.AccountType; +import com.binance.connector.client.w3w_prediction.rest.model.CreateInboundTransferRequest; +import com.binance.connector.client.w3w_prediction.rest.model.CreateInboundTransferResponse; + +/** API examples for TransferApi */ +public class CreateInboundTransferExample { + private W3WPredictionRestApi api; + + public W3WPredictionRestApi getApi() { + if (api == null) { + ClientConfiguration clientConfiguration = + W3WPredictionRestApiUtil.getClientConfiguration(); + SignatureConfiguration signatureConfiguration = new SignatureConfiguration(); + signatureConfiguration.setApiKey("apiKey"); + signatureConfiguration.setPrivateKey("path/to/private.key"); + clientConfiguration.setSignatureConfiguration(signatureConfiguration); + api = new W3WPredictionRestApi(clientConfiguration); + } + return api; + } + + /** + * Create Inbound Transfer + * + *

Transfer funds from the prediction wallet back to the user's CEX account (SPOT or + * FUNDING). Requires SAS authorization. ⚠️ **SAS Authorization Required:** This endpoint + * enforces SAS (Self-Authorization Service) authorization. If SAS is not enabled for the + * wallet, the request will be rejected with `-31003 SAS authorization required`. + * Enable SAS for your wallet before calling this endpoint. Weight(IP): 200 Security Type: TRADE + * + * @throws ApiException if the Api call fails + */ + public void createInboundTransferExample() throws ApiException { + CreateInboundTransferRequest createInboundTransferRequest = + new CreateInboundTransferRequest(); + createInboundTransferRequest.walletId("5b5c1ec3be4e4416a5872b21c1ca5d20"); + createInboundTransferRequest.walletAddress("0x12e32db8817e292508c34111cbc4b23340df542c"); + createInboundTransferRequest.fromTokenAmount("1000000000000000000"); + createInboundTransferRequest.accountType(AccountType.SPOT); + ApiResponse response = + getApi().createInboundTransfer(createInboundTransferRequest); + System.out.println(response.getData()); + } +} diff --git a/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/transfer/CreateOutboundTransferExample.java b/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/transfer/CreateOutboundTransferExample.java new file mode 100644 index 000000000..10bc79f2b --- /dev/null +++ b/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/transfer/CreateOutboundTransferExample.java @@ -0,0 +1,51 @@ +package com.binance.connector.client.w3w_prediction.rest.transfer; + +import com.binance.connector.client.common.ApiException; +import com.binance.connector.client.common.ApiResponse; +import com.binance.connector.client.common.configuration.ClientConfiguration; +import com.binance.connector.client.common.configuration.SignatureConfiguration; +import com.binance.connector.client.w3w_prediction.rest.W3WPredictionRestApiUtil; +import com.binance.connector.client.w3w_prediction.rest.api.W3WPredictionRestApi; +import com.binance.connector.client.w3w_prediction.rest.model.AccountType; +import com.binance.connector.client.w3w_prediction.rest.model.CreateOutboundTransferRequest; +import com.binance.connector.client.w3w_prediction.rest.model.CreateOutboundTransferResponse; +import com.binance.connector.client.w3w_prediction.rest.model.SourceBiz; + +/** API examples for TransferApi */ +public class CreateOutboundTransferExample { + private W3WPredictionRestApi api; + + public W3WPredictionRestApi getApi() { + if (api == null) { + ClientConfiguration clientConfiguration = + W3WPredictionRestApiUtil.getClientConfiguration(); + SignatureConfiguration signatureConfiguration = new SignatureConfiguration(); + signatureConfiguration.setApiKey("apiKey"); + signatureConfiguration.setPrivateKey("path/to/private.key"); + clientConfiguration.setSignatureConfiguration(signatureConfiguration); + api = new W3WPredictionRestApi(clientConfiguration); + } + return api; + } + + /** + * Create Outbound Transfer + * + *

Transfer funds from the user's CEX account (SPOT or FUNDING) into the prediction + * wallet. Requires SAS authorization. Weight(IP): 200 Security Type: TRADE + * + * @throws ApiException if the Api call fails + */ + public void createOutboundTransferExample() throws ApiException { + CreateOutboundTransferRequest createOutboundTransferRequest = + new CreateOutboundTransferRequest(); + createOutboundTransferRequest.walletId("5b5c1ec3be4e4416a5872b21c1ca5d20"); + createOutboundTransferRequest.walletAddress("0x12e32db8817e292508c34111cbc4b23340df542c"); + createOutboundTransferRequest.fromTokenAmount("1000000000000000000"); + createOutboundTransferRequest.accountType(AccountType.SPOT); + createOutboundTransferRequest.sourceBiz(SourceBiz.USER_TRANSFER); + ApiResponse response = + getApi().createOutboundTransfer(createOutboundTransferRequest); + System.out.println(response.getData()); + } +} diff --git a/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/transfer/QueryTransferListExample.java b/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/transfer/QueryTransferListExample.java new file mode 100644 index 000000000..fd19f7724 --- /dev/null +++ b/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/transfer/QueryTransferListExample.java @@ -0,0 +1,58 @@ +package com.binance.connector.client.w3w_prediction.rest.transfer; + +import com.binance.connector.client.common.ApiException; +import com.binance.connector.client.common.ApiResponse; +import com.binance.connector.client.common.configuration.ClientConfiguration; +import com.binance.connector.client.common.configuration.SignatureConfiguration; +import com.binance.connector.client.w3w_prediction.rest.W3WPredictionRestApiUtil; +import com.binance.connector.client.w3w_prediction.rest.api.W3WPredictionRestApi; +import com.binance.connector.client.w3w_prediction.rest.model.Direction; +import com.binance.connector.client.w3w_prediction.rest.model.QueryTransferListResponse; + +/** API examples for TransferApi */ +public class QueryTransferListExample { + private W3WPredictionRestApi api; + + public W3WPredictionRestApi getApi() { + if (api == null) { + ClientConfiguration clientConfiguration = + W3WPredictionRestApiUtil.getClientConfiguration(); + SignatureConfiguration signatureConfiguration = new SignatureConfiguration(); + signatureConfiguration.setApiKey("apiKey"); + signatureConfiguration.setPrivateKey("path/to/private.key"); + clientConfiguration.setSignatureConfiguration(signatureConfiguration); + api = new W3WPredictionRestApi(clientConfiguration); + } + return api; + } + + /** + * Query Transfer List + * + *

Get the authenticated user's prediction wallet transfer history within a date range. + * Weight(IP): 200 Security Type: USER_DATA + * + * @throws ApiException if the Api call fails + */ + public void queryTransferListExample() throws ApiException { + String walletAddress = "0x12e32db8817e292508c34111cbc4b23340df542c"; + String startDate = "2026-05-01"; + String endDate = "2026-05-25"; + String tokenSymbol = "USDT"; + Direction direction = Direction.INBOUND; + Integer offset = 0; + Integer limit = 20; + Long recvWindow = 5000L; + ApiResponse response = + getApi().queryTransferList( + walletAddress, + startDate, + endDate, + tokenSymbol, + direction, + offset, + limit, + recvWindow); + System.out.println(response.getData()); + } +} diff --git a/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/transfer/QueryTransferStatusExample.java b/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/transfer/QueryTransferStatusExample.java new file mode 100644 index 000000000..33a233133 --- /dev/null +++ b/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/transfer/QueryTransferStatusExample.java @@ -0,0 +1,46 @@ +package com.binance.connector.client.w3w_prediction.rest.transfer; + +import com.binance.connector.client.common.ApiException; +import com.binance.connector.client.common.ApiResponse; +import com.binance.connector.client.common.configuration.ClientConfiguration; +import com.binance.connector.client.common.configuration.SignatureConfiguration; +import com.binance.connector.client.w3w_prediction.rest.W3WPredictionRestApiUtil; +import com.binance.connector.client.w3w_prediction.rest.api.W3WPredictionRestApi; +import com.binance.connector.client.w3w_prediction.rest.model.QueryTransferStatusResponse; + +/** API examples for TransferApi */ +public class QueryTransferStatusExample { + private W3WPredictionRestApi api; + + public W3WPredictionRestApi getApi() { + if (api == null) { + ClientConfiguration clientConfiguration = + W3WPredictionRestApiUtil.getClientConfiguration(); + SignatureConfiguration signatureConfiguration = new SignatureConfiguration(); + signatureConfiguration.setApiKey("apiKey"); + signatureConfiguration.setPrivateKey("path/to/private.key"); + clientConfiguration.setSignatureConfiguration(signatureConfiguration); + api = new W3WPredictionRestApi(clientConfiguration); + } + return api; + } + + /** + * Query Transfer Status + * + *

Query the current status of a prediction wallet transfer by transfer ID. + * **`status` values:** Terminal states are `COMPLETED` and + * `FAILED`. Intermediate states are `PROCESSING` and `PENDING`. + * **Do not** poll for `SUCCESS` — it is not a valid terminal state. Weight(IP): 200 + * Security Type: USER_DATA + * + * @throws ApiException if the Api call fails + */ + public void queryTransferStatusExample() throws ApiException { + String transferId = "tf_20260525_out_001"; + Long recvWindow = 5000L; + ApiResponse response = + getApi().queryTransferStatus(transferId, recvWindow); + System.out.println(response.getData()); + } +} diff --git a/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/wallet/GetPortfolioExample.java b/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/wallet/GetPortfolioExample.java new file mode 100644 index 000000000..855b4478d --- /dev/null +++ b/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/wallet/GetPortfolioExample.java @@ -0,0 +1,53 @@ +package com.binance.connector.client.w3w_prediction.rest.wallet; + +import com.binance.connector.client.common.ApiException; +import com.binance.connector.client.common.ApiResponse; +import com.binance.connector.client.common.configuration.ClientConfiguration; +import com.binance.connector.client.common.configuration.SignatureConfiguration; +import com.binance.connector.client.w3w_prediction.rest.W3WPredictionRestApiUtil; +import com.binance.connector.client.w3w_prediction.rest.api.W3WPredictionRestApi; +import com.binance.connector.client.w3w_prediction.rest.model.GetPortfolioResponse; + +/** API examples for WalletApi */ +public class GetPortfolioExample { + private W3WPredictionRestApi api; + + public W3WPredictionRestApi getApi() { + if (api == null) { + ClientConfiguration clientConfiguration = + W3WPredictionRestApiUtil.getClientConfiguration(); + SignatureConfiguration signatureConfiguration = new SignatureConfiguration(); + signatureConfiguration.setApiKey("apiKey"); + signatureConfiguration.setPrivateKey("path/to/private.key"); + clientConfiguration.setSignatureConfiguration(signatureConfiguration); + api = new W3WPredictionRestApi(clientConfiguration); + } + return api; + } + + /** + * Get Portfolio + * + *

Get the authenticated user's prediction portfolio overview including active positions + * count, aggregated PnL, and full position list. Weight(IP): 200 Security Type: USER_DATA + * + * @throws ApiException if the Api call fails + */ + public void getPortfolioExample() throws ApiException { + String walletAddress = "0x12e32db8817e292508c34111cbc4b23340df542c"; + String tokenId = "112233"; + Long marketId = 5567895L; + Long marketTopicId = 4229564L; + Boolean activeOnly = false; + Long recvWindow = 5000L; + ApiResponse response = + getApi().getPortfolio( + walletAddress, + tokenId, + marketId, + marketTopicId, + activeOnly, + recvWindow); + System.out.println(response.getData()); + } +} diff --git a/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/wallet/GetQuotaStatusExample.java b/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/wallet/GetQuotaStatusExample.java new file mode 100644 index 000000000..bc9c7a97e --- /dev/null +++ b/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/wallet/GetQuotaStatusExample.java @@ -0,0 +1,41 @@ +package com.binance.connector.client.w3w_prediction.rest.wallet; + +import com.binance.connector.client.common.ApiException; +import com.binance.connector.client.common.ApiResponse; +import com.binance.connector.client.common.configuration.ClientConfiguration; +import com.binance.connector.client.common.configuration.SignatureConfiguration; +import com.binance.connector.client.w3w_prediction.rest.W3WPredictionRestApiUtil; +import com.binance.connector.client.w3w_prediction.rest.api.W3WPredictionRestApi; +import com.binance.connector.client.w3w_prediction.rest.model.GetQuotaStatusResponse; + +/** API examples for WalletApi */ +public class GetQuotaStatusExample { + private W3WPredictionRestApi api; + + public W3WPredictionRestApi getApi() { + if (api == null) { + ClientConfiguration clientConfiguration = + W3WPredictionRestApiUtil.getClientConfiguration(); + SignatureConfiguration signatureConfiguration = new SignatureConfiguration(); + signatureConfiguration.setApiKey("apiKey"); + signatureConfiguration.setPrivateKey("path/to/private.key"); + clientConfiguration.setSignatureConfiguration(signatureConfiguration); + api = new W3WPredictionRestApi(clientConfiguration); + } + return api; + } + + /** + * Get Quota Status + * + *

Query the current user's daily trading quota limit and remaining allowance for + * prediction markets. Weight(IP): 200 Security Type: USER_DATA + * + * @throws ApiException if the Api call fails + */ + public void getQuotaStatusExample() throws ApiException { + Long recvWindow = 5000L; + ApiResponse response = getApi().getQuotaStatus(recvWindow); + System.out.println(response.getData()); + } +} diff --git a/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/wallet/ListPredictionWalletsExample.java b/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/wallet/ListPredictionWalletsExample.java new file mode 100644 index 000000000..8e7a39ea1 --- /dev/null +++ b/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/wallet/ListPredictionWalletsExample.java @@ -0,0 +1,42 @@ +package com.binance.connector.client.w3w_prediction.rest.wallet; + +import com.binance.connector.client.common.ApiException; +import com.binance.connector.client.common.ApiResponse; +import com.binance.connector.client.common.configuration.ClientConfiguration; +import com.binance.connector.client.common.configuration.SignatureConfiguration; +import com.binance.connector.client.w3w_prediction.rest.W3WPredictionRestApiUtil; +import com.binance.connector.client.w3w_prediction.rest.api.W3WPredictionRestApi; +import com.binance.connector.client.w3w_prediction.rest.model.ListPredictionWalletsResponse; + +/** API examples for WalletApi */ +public class ListPredictionWalletsExample { + private W3WPredictionRestApi api; + + public W3WPredictionRestApi getApi() { + if (api == null) { + ClientConfiguration clientConfiguration = + W3WPredictionRestApiUtil.getClientConfiguration(); + SignatureConfiguration signatureConfiguration = new SignatureConfiguration(); + signatureConfiguration.setApiKey("apiKey"); + signatureConfiguration.setPrivateKey("path/to/private.key"); + clientConfiguration.setSignatureConfiguration(signatureConfiguration); + api = new W3WPredictionRestApi(clientConfiguration); + } + return api; + } + + /** + * List Prediction Wallets + * + *

Get all prediction wallets registered for the authenticated user. Weight(IP): 200 Security + * Type: USER_DATA + * + * @throws ApiException if the Api call fails + */ + public void listPredictionWalletsExample() throws ApiException { + Long recvWindow = 5000L; + ApiResponse response = + getApi().listPredictionWallets(recvWindow); + System.out.println(response.getData()); + } +} diff --git a/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/wallet/QueryPaymentOptionBalancesExample.java b/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/wallet/QueryPaymentOptionBalancesExample.java new file mode 100644 index 000000000..eb862d313 --- /dev/null +++ b/examples/w3w-prediction/src/main/java/com/binance/connector/client/w3w_prediction/rest/wallet/QueryPaymentOptionBalancesExample.java @@ -0,0 +1,42 @@ +package com.binance.connector.client.w3w_prediction.rest.wallet; + +import com.binance.connector.client.common.ApiException; +import com.binance.connector.client.common.ApiResponse; +import com.binance.connector.client.common.configuration.ClientConfiguration; +import com.binance.connector.client.common.configuration.SignatureConfiguration; +import com.binance.connector.client.w3w_prediction.rest.W3WPredictionRestApiUtil; +import com.binance.connector.client.w3w_prediction.rest.api.W3WPredictionRestApi; +import com.binance.connector.client.w3w_prediction.rest.model.QueryPaymentOptionBalancesResponse; + +/** API examples for WalletApi */ +public class QueryPaymentOptionBalancesExample { + private W3WPredictionRestApi api; + + public W3WPredictionRestApi getApi() { + if (api == null) { + ClientConfiguration clientConfiguration = + W3WPredictionRestApiUtil.getClientConfiguration(); + SignatureConfiguration signatureConfiguration = new SignatureConfiguration(); + signatureConfiguration.setApiKey("apiKey"); + signatureConfiguration.setPrivateKey("path/to/private.key"); + clientConfiguration.setSignatureConfiguration(signatureConfiguration); + api = new W3WPredictionRestApi(clientConfiguration); + } + return api; + } + + /** + * Query Payment Option Balances + * + *

Get available balances for each payment option that can be used for prediction trading. + * Weight(IP): 200 Security Type: USER_DATA + * + * @throws ApiException if the Api call fails + */ + public void queryPaymentOptionBalancesExample() throws ApiException { + Long recvWindow = 5000L; + ApiResponse response = + getApi().queryPaymentOptionBalances(recvWindow); + System.out.println(response.getData()); + } +}