From 23e49ca0cfa2778ed883006e3cb81c25c28fd1d4 Mon Sep 17 00:00:00 2001 From: revide Date: Tue, 25 Sep 2018 16:45:53 +0200 Subject: [PATCH] - Fixed new JSON Format for the https://bittrex.com/api/v2.0/pub/markets/getmarketsummaries API call + isRestricted field in Market + explanation field in Response ~ Changed creation of Response Objects to fit new constructor --- .../java/com/github/ccob/bittrex4j/BittrexExchange.java | 4 ++-- src/main/java/com/github/ccob/bittrex4j/dao/Market.java | 8 +++++++- src/main/java/com/github/ccob/bittrex4j/dao/Response.java | 6 +++++- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/github/ccob/bittrex4j/BittrexExchange.java b/src/main/java/com/github/ccob/bittrex4j/BittrexExchange.java index 0483098..42c1686 100644 --- a/src/main/java/com/github/ccob/bittrex4j/BittrexExchange.java +++ b/src/main/java/com/github/ccob/bittrex4j/BittrexExchange.java @@ -605,11 +605,11 @@ public void run() { }else{ log.warn("HTTP request failed with error code {} and reason {}",responseCode,httpResponse.getStatusLine().getReasonPhrase()); task.cancel(); - return new Response<>(false,httpResponse.getStatusLine().getReasonPhrase(),null); + return new Response<>(false,httpResponse.getStatusLine().getReasonPhrase(),null, ""); } } catch (NoSuchAlgorithmException | IOException | InvalidKeyException e) { - return new Response<>(false,e.getMessage(),null); + return new Response<>(false,e.getMessage(),null, ""); } finally { if(httpResponse != null){ diff --git a/src/main/java/com/github/ccob/bittrex4j/dao/Market.java b/src/main/java/com/github/ccob/bittrex4j/dao/Market.java index 8c27a81..907300a 100644 --- a/src/main/java/com/github/ccob/bittrex4j/dao/Market.java +++ b/src/main/java/com/github/ccob/bittrex4j/dao/Market.java @@ -33,13 +33,14 @@ public class Market { private String notice; private boolean isSponsored; private String logoUrl; + private boolean isRestricted; @JsonCreator public Market( @JsonProperty("MarketCurrency") String marketCurrency, @JsonProperty("BaseCurrency") String baseCurrency, @JsonProperty("MarketCurrencyLong") String marketCurrencyLong, @JsonProperty("BaseCurrencyLong") String baseCurrencyLong, @JsonProperty("MinTradeSize") double minTradeSize, @JsonProperty("MarketName") String marketName, @JsonProperty("IsActive") boolean isActive, @JsonProperty("Created") ZonedDateTime created, @JsonProperty("Notice") String notice, - @JsonProperty("IsSponsored") boolean isSponsored, @JsonProperty("LogoUrl") String logoUrl) { + @JsonProperty("IsSponsored") boolean isSponsored, @JsonProperty("LogoUrl") String logoUrl, @JsonProperty("IsRestricted") boolean isRestricted) { this.marketCurrency = marketCurrency; this.baseCurrency = baseCurrency; this.marketCurrencyLong = marketCurrencyLong; @@ -51,6 +52,11 @@ public Market( @JsonProperty("MarketCurrency") String marketCurrency, @JsonPrope this.notice = notice; this.isSponsored = isSponsored; this.logoUrl = logoUrl; + this.isRestricted = isRestricted; + } + + public boolean isRestricted() { + return isRestricted; } public String getMarketCurrency() { diff --git a/src/main/java/com/github/ccob/bittrex4j/dao/Response.java b/src/main/java/com/github/ccob/bittrex4j/dao/Response.java index 1f2e193..1bad226 100644 --- a/src/main/java/com/github/ccob/bittrex4j/dao/Response.java +++ b/src/main/java/com/github/ccob/bittrex4j/dao/Response.java @@ -19,14 +19,16 @@ public class Response { boolean success; String message; Result result; + String explanation; @JsonCreator public Response(@JsonProperty("success") boolean success, @JsonProperty("message") String message, - @JsonProperty("result") Result result) { + @JsonProperty("result") Result result, @JsonProperty("explanation") String explanation) { this.success = success; this.message = message; this.result = result; + this.explanation = explanation; } public boolean isSuccess() { @@ -40,4 +42,6 @@ public String getMessage() { public Result getResult() { return result; } + + public String getExplanation() {return explanation;} }