| 1 | package pl.zankowski.iextrading4j.client.rest.request.options; | |
| 2 | ||
| 3 | import javax.ws.rs.core.GenericType; | |
| 4 | import pl.zankowski.iextrading4j.api.options.Option; | |
| 5 | import pl.zankowski.iextrading4j.client.rest.manager.RestRequest; | |
| 6 | import pl.zankowski.iextrading4j.client.rest.manager.RestRequestBuilder; | |
| 7 | import pl.zankowski.iextrading4j.client.rest.request.IEXCloudV1RestRequest; | |
| 8 | import pl.zankowski.iextrading4j.client.rest.request.stocks.AbstractStocksRequestBuilder; | |
| 9 | ||
| 10 | import java.util.List; | |
| 11 | ||
| 12 | public class OptionsRequestBuilder extends AbstractStocksRequestBuilder<List<String>, OptionsRequestBuilder> | |
| 13 | implements IEXCloudV1RestRequest<List<String>> { | |
| 14 | ||
| 15 | private static final String EXPIRATION_DATE_PARAM = "expirationDate"; | |
| 16 | ||
| 17 | public SpecificOptionRequestBuilder withExpirationDate(final String expirationDate) { | |
| 18 |
1
1. withExpirationDate : replaced return value with null for pl/zankowski/iextrading4j/client/rest/request/options/OptionsRequestBuilder::withExpirationDate → KILLED |
return new SpecificOptionRequestBuilder(expirationDate, getSymbol()); |
| 19 | } | |
| 20 | ||
| 21 | @Override | |
| 22 | public RestRequest<List<String>> build() { | |
| 23 |
1
1. build : replaced return value with null for pl/zankowski/iextrading4j/client/rest/request/options/OptionsRequestBuilder::build → KILLED |
return RestRequestBuilder.<List<String>>builder() |
| 24 | .withPath("/stock/{symbol}/options") | |
| 25 | .addPathParam(SYMBOL_PARAM_NAME, getSymbol()).get() | |
| 26 | .withResponse(new GenericType<List<String>>() { | |
| 27 | }) | |
| 28 | .build(); | |
| 29 | } | |
| 30 | ||
| 31 | public static class SpecificOptionRequestBuilder extends AbstractStocksRequestBuilder<List<Option>, SpecificOptionRequestBuilder> | |
| 32 | implements IEXCloudV1RestRequest<List<Option>> { | |
| 33 | ||
| 34 | private String expirationDate; | |
| 35 | private OptionSide side; | |
| 36 | ||
| 37 | public SpecificOptionRequestBuilder(final String expirationDate, final String symbol) { | |
| 38 | this.expirationDate = expirationDate; | |
| 39 | withSymbol(symbol); | |
| 40 | } | |
| 41 | ||
| 42 | public SpecificOptionRequestBuilder withSide(final OptionSide side) { | |
| 43 | this.side = side; | |
| 44 |
1
1. withSide : replaced return value with null for pl/zankowski/iextrading4j/client/rest/request/options/OptionsRequestBuilder$SpecificOptionRequestBuilder::withSide → KILLED |
return this; |
| 45 | } | |
| 46 | ||
| 47 | private RestRequest<List<Option>> request() { | |
| 48 |
1
1. request : replaced return value with null for pl/zankowski/iextrading4j/client/rest/request/options/OptionsRequestBuilder$SpecificOptionRequestBuilder::request → KILLED |
return RestRequestBuilder.<List<Option>>builder() |
| 49 | .withPath("/stock/{symbol}/options/{expirationDate}") | |
| 50 | .addPathParam(SYMBOL_PARAM_NAME, getSymbol()) | |
| 51 | .addPathParam(EXPIRATION_DATE_PARAM, expirationDate).get() | |
| 52 | .withResponse(new GenericType<List<Option>>() { | |
| 53 | }) | |
| 54 | .build(); | |
| 55 | } | |
| 56 | ||
| 57 | private RestRequest<List<Option>> requestWithSide() { | |
| 58 |
1
1. requestWithSide : replaced return value with null for pl/zankowski/iextrading4j/client/rest/request/options/OptionsRequestBuilder$SpecificOptionRequestBuilder::requestWithSide → KILLED |
return RestRequestBuilder.<List<Option>>builder() |
| 59 | .withPath("/stock/{symbol}/options/{expirationDate}/{side}") | |
| 60 | .addPathParam(SYMBOL_PARAM_NAME, getSymbol()) | |
| 61 | .addPathParam(EXPIRATION_DATE_PARAM, expirationDate) | |
| 62 | .addPathParam("side", side.getName()).get() | |
| 63 | .withResponse(new GenericType<List<Option>>() { | |
| 64 | }) | |
| 65 | .build(); | |
| 66 | } | |
| 67 | ||
| 68 | @Override | |
| 69 | public RestRequest<List<Option>> build() { | |
| 70 |
1
1. build : negated conditional → KILLED |
if (side != null) { |
| 71 |
1
1. build : replaced return value with null for pl/zankowski/iextrading4j/client/rest/request/options/OptionsRequestBuilder$SpecificOptionRequestBuilder::build → KILLED |
return requestWithSide(); |
| 72 | } | |
| 73 |
1
1. build : replaced return value with null for pl/zankowski/iextrading4j/client/rest/request/options/OptionsRequestBuilder$SpecificOptionRequestBuilder::build → KILLED |
return request(); |
| 74 | } | |
| 75 | ||
| 76 | } | |
| 77 | ||
| 78 | } | |
Mutations | ||
| 18 |
1.1 |
|
| 23 |
1.1 |
|
| 44 |
1.1 |
|
| 48 |
1.1 |
|
| 58 |
1.1 |
|
| 70 |
1.1 |
|
| 71 |
1.1 |
|
| 73 |
1.1 |