Skip to content

Commit f5fd459

Browse files
committed
Add support for the Proxer Streams API
This is done by providing a builder method to the StreamsRequest
1 parent 7098e2f commit f5fd459

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

library/src/main/java/com/proxerme/library/connection/anime/request/StreamsRequest.java

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
*/
2424
public class StreamsRequest extends AnimeRequest<Stream[]> {
2525

26-
private static final String ENDPOINT = "streams";
26+
private static final String STREAMS = "streams";
27+
private static final String STREAMS_WITH_PROXER = "proxerstreams";
2728

2829
private static final String ID_PARAMETER = "id";
2930
private static final String EPISODE_PARAMETER = "episode";
@@ -33,6 +34,8 @@ public class StreamsRequest extends AnimeRequest<Stream[]> {
3334
private int episode;
3435
private String language;
3536

37+
private boolean withProxerStreams;
38+
3639
/**
3740
* The constructor.
3841
*
@@ -47,6 +50,12 @@ public StreamsRequest(@NonNull String id, @IntRange(from = 1) int episode,
4750
this.language = language;
4851
}
4952

53+
public StreamsRequest withProxerStreams(boolean enable) {
54+
this.withProxerStreams = enable;
55+
56+
return this;
57+
}
58+
5059
@Override
5160
protected ProxerResult<Stream[]> parse(@NonNull Moshi moshi, @NonNull ResponseBody body)
5261
throws IOException {
@@ -56,7 +65,11 @@ protected ProxerResult<Stream[]> parse(@NonNull Moshi moshi, @NonNull ResponseBo
5665
@NonNull
5766
@Override
5867
protected String getApiEndpoint() {
59-
return ENDPOINT;
68+
if (withProxerStreams) {
69+
return STREAMS_WITH_PROXER;
70+
} else {
71+
return STREAMS;
72+
}
6073
}
6174

6275
@NonNull

0 commit comments

Comments
 (0)