1 | package pl.zankowski.iextrading4j.client.rest.request.alternative; | |
2 | ||
3 | import pl.zankowski.iextrading4j.api.alternative.Sentiment; | |
4 | import pl.zankowski.iextrading4j.client.rest.manager.RestRequest; | |
5 | import pl.zankowski.iextrading4j.client.rest.manager.RestRequestBuilder; | |
6 | import pl.zankowski.iextrading4j.client.rest.request.IEXCloudV1RestRequest; | |
7 | ||
8 | import javax.ws.rs.core.GenericType; | |
9 | import java.util.List; | |
10 | ||
11 | import static pl.zankowski.iextrading4j.client.rest.request.util.RequestUtil.IEX_DATE_FORMATTER; | |
12 | ||
13 | public class SentimentRequestBuilder extends AbstractSentimentRequestBuilder<List<Sentiment>, SentimentRequestBuilder> | |
14 | implements IEXCloudV1RestRequest<List<Sentiment>> { | |
15 | ||
16 | public SentimentRequestBuilder withSentimentType(final SentimentType sentimentType) { | |
17 | this.sentimentType = sentimentType; | |
18 |
1
1. withSentimentType : replaced return value with null for pl/zankowski/iextrading4j/client/rest/request/alternative/SentimentRequestBuilder::withSentimentType → KILLED |
return this; |
19 | } | |
20 | ||
21 | @Override | |
22 | public RestRequest<List<Sentiment>> build() { | |
23 |
1
1. build : negated conditional → KILLED |
if (date != null) { |
24 |
1
1. build : replaced return value with null for pl/zankowski/iextrading4j/client/rest/request/alternative/SentimentRequestBuilder::build → KILLED |
return requestWithDate(); |
25 |
1
1. build : negated conditional → KILLED |
} else if (sentimentType != null) { |
26 |
1
1. build : replaced return value with null for pl/zankowski/iextrading4j/client/rest/request/alternative/SentimentRequestBuilder::build → KILLED |
return requestWithType(); |
27 | } | |
28 |
1
1. build : replaced return value with null for pl/zankowski/iextrading4j/client/rest/request/alternative/SentimentRequestBuilder::build → KILLED |
return request(); |
29 | } | |
30 | ||
31 | private RestRequest<List<Sentiment>> request() { | |
32 |
1
1. request : replaced return value with null for pl/zankowski/iextrading4j/client/rest/request/alternative/SentimentRequestBuilder::request → KILLED |
return RestRequestBuilder.<List<Sentiment>>builder() |
33 | .withPath("/stock/{symbol}/sentiment") | |
34 | .addPathParam(SYMBOL_PARAM_NAME, getSymbol()).get() | |
35 | .withResponse(new GenericType<List<Sentiment>>() {}) | |
36 | .build(); | |
37 | } | |
38 | ||
39 | private RestRequest<List<Sentiment>> requestWithType() { | |
40 |
1
1. requestWithType : replaced return value with null for pl/zankowski/iextrading4j/client/rest/request/alternative/SentimentRequestBuilder::requestWithType → KILLED |
return RestRequestBuilder.<List<Sentiment>>builder() |
41 | .withPath("/stock/{symbol}/sentiment/{type}") | |
42 | .addPathParam(SYMBOL_PARAM_NAME, getSymbol()) | |
43 | .addPathParam(TYPE_PARAM_NAME, sentimentType.name().toLowerCase()).get() | |
44 | .withResponse(new GenericType<List<Sentiment>>() {}) | |
45 | .build(); | |
46 | } | |
47 | ||
48 | private RestRequest<List<Sentiment>> requestWithDate() { | |
49 |
1
1. requestWithDate : replaced return value with null for pl/zankowski/iextrading4j/client/rest/request/alternative/SentimentRequestBuilder::requestWithDate → KILLED |
return RestRequestBuilder.<List<Sentiment>>builder() |
50 | .withPath("/stock/{symbol}/sentiment/{type}/{date}") | |
51 | .addPathParam(SYMBOL_PARAM_NAME, getSymbol()) | |
52 | .addPathParam(TYPE_PARAM_NAME, sentimentType.name().toLowerCase()) | |
53 | .addPathParam(DATE_PARAM_NAME, IEX_DATE_FORMATTER.format(date)).get() | |
54 | .withResponse(new GenericType<List<Sentiment>>() {}) | |
55 | .build(); | |
56 | } | |
57 | ||
58 | } | |
Mutations | ||
18 |
1.1 |
|
23 |
1.1 |
|
24 |
1.1 |
|
25 |
1.1 |
|
26 |
1.1 |
|
28 |
1.1 |
|
32 |
1.1 |
|
40 |
1.1 |
|
49 |
1.1 |