Browse Source

Update README.md

master
Taylor Bockman 6 years ago committed by GitHub
parent
commit
221651d934
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      README.md

12
README.md

@ -35,7 +35,7 @@ processing and are a very natural way to delineate success and failure cleanly.
of throwing exceptions on errors, and allows exceptions to be reserved for truly exceptional behavior as intended. of throwing exceptions on errors, and allows exceptions to be reserved for truly exceptional behavior as intended.
By convention I adapted the Haskell Either type style to this code. What this means is that the Either type's Right By convention I adapted the Haskell Either type style to this code. What this means is that the Either type's Right
value is the correct one (mnemonic: "right" as in correct) and the Left value is the serviceError. value is the correct one (mnemonic: "right" as in correct) and the Left value is the `ServiceError`.
### How do I extract the raw value from the Either type? ### How do I extract the raw value from the Either type?
@ -73,7 +73,7 @@ if(res.isRight()) {
GeneralUtilities generalUtilities = GeneralUtilities.builder().apiKey("KEY").secretKey("KEY").build(); GeneralUtilities generalUtilities = GeneralUtilities.builder().apiKey("KEY").secretKey("KEY").build();
Either<ServiceError, ServerTime> res = generalUtilities.getServerTime(); Either<ServiceError, ServerTime> res = generalUtilities.getServerTime();
if(res.isRight() { if(res.isRight()) {
ServerTime response = Helpers.extractEitherValueSafely(res.right()); ServerTime response = Helpers.extractEitherValueSafely(res.right());
//... //...
} }
@ -85,7 +85,7 @@ if(res.isRight() {
GeneralUtilities generalUtilities = GeneralUtilities.builder().apiKey("KEY").secretKey("KEY").build(); GeneralUtilities generalUtilities = GeneralUtilities.builder().apiKey("KEY").secretKey("KEY").build();
Either<ServiceError, ExchangeInfo> res = generalUtilities.getExchangeInfo(); Either<ServiceError, ExchangeInfo> res = generalUtilities.getExchangeInfo();
if(res.isRight() { if(res.isRight()) {
ExchangeInfo response = Helpers.extractEitherValueSafely(res.right()); ExchangeInfo response = Helpers.extractEitherValueSafely(res.right());
//... //...
} }
@ -97,7 +97,7 @@ if(res.isRight() {
MarketData marketData = MarketData.builder().apiKey("KEY").secretKey("KEY").build(); MarketData marketData = MarketData.builder().apiKey("KEY").secretKey("KEY").build();
Either<ServiceError, List<Candlestick>> res = marketData.getCandlestickData("ETHBTC", Interval.ONE_MINUTE); Either<ServiceError, List<Candlestick>> res = marketData.getCandlestickData("ETHBTC", Interval.ONE_MINUTE);
if(res.isRight() { if(res.isRight()) {
List<Candlestick> data = Helpers.extractEitherValueSafely(res.right()); List<Candlestick> data = Helpers.extractEitherValueSafely(res.right());
//... //...
} }
@ -109,7 +109,7 @@ if(res.isRight() {
MarketData marketData = MarketData.builder().apiKey("KEY").secretKey("KEY").build(); MarketData marketData = MarketData.builder().apiKey("KEY").secretKey("KEY").build();
Either<ServiceError, OrderBookDepth> res = marketData.getOrderBookDepth("ETHBTC", 1000); Either<ServiceError, OrderBookDepth> res = marketData.getOrderBookDepth("ETHBTC", 1000);
if(res.isRight() { if(res.isRight()) {
OrderBookDepth orderBookDepth = Helpers.extractEitherValueSafely(res.right()); OrderBookDepth orderBookDepth = Helpers.extractEitherValueSafely(res.right());
//... //...
} }
@ -121,7 +121,7 @@ if(res.isRight() {
MarketData marketData = MarketData.builder().apiKey("KEY").secretKey("KEY").build(); MarketData marketData = MarketData.builder().apiKey("KEY").secretKey("KEY").build();
Either<ServiceError, TickerPrice> res = marketData.getTickerPriceForSymbol("ETHBTC"); Either<ServiceError, TickerPrice> res = marketData.getTickerPriceForSymbol("ETHBTC");
if(res.isRight() { if(res.isRight()) {
TickerPrice tickerPrice = Helpers.extractEitherValueSafely(res.right()); TickerPrice tickerPrice = Helpers.extractEitherValueSafely(res.right());
//... //...
} }

Loading…
Cancel
Save