diff options
| author | Pinapelz <donaldshan1@outlook.com> | 2023-04-04 22:53:38 -0700 |
|---|---|---|
| committer | Pinapelz <donaldshan1@outlook.com> | 2023-04-04 22:53:38 -0700 |
| commit | 88719faedddd17c180e799db750ea98129ac6382 (patch) | |
| tree | 577501dbc5a0653f4619a83a4714d354268a52d4 /src | |
| parent | c0f3a15069c0af41e9196779c829fb545ba870e6 (diff) | |
Implemented getVideoByChannelId
Diffstat (limited to 'src')
| -rw-r--r-- | src/main/java/com/pina/Holodex.java | 10 | ||||
| -rw-r--r-- | src/main/java/com/pina/query/VideosByChannelIDQuery.java | 75 |
2 files changed, 84 insertions, 1 deletions
diff --git a/src/main/java/com/pina/Holodex.java b/src/main/java/com/pina/Holodex.java index 5ea09aa..f1d4805 100644 --- a/src/main/java/com/pina/Holodex.java +++ b/src/main/java/com/pina/Holodex.java @@ -3,6 +3,7 @@ package com.pina; import com.pina.datatypes.Channel; import com.pina.datatypes.Video; import com.pina.query.VideoQueryBuilder; +import com.pina.query.VideosByChannelIDQuery; import retrofit2.Call; import retrofit2.Response; import retrofit2.Retrofit; @@ -14,13 +15,14 @@ import java.util.List; public class Holodex { private final HolodexService service; - public Holodex(){ + public Holodex() { Retrofit retrofit = new Retrofit.Builder() .baseUrl("https://holodex.net") .addConverterFactory(JacksonConverterFactory.create()) .build(); service = retrofit.create(HolodexService.class); } + public List<Video> getLiveVideos(VideoQueryBuilder queryBuilder) throws HolodexException { Call<List<Video>> call = service.getLiveVideos(queryBuilder.getChannelId(), queryBuilder.getId(), queryBuilder.getInclude(), queryBuilder.getLang(), @@ -50,7 +52,13 @@ public class Holodex { return executeCall(call); } + public List<Video> getVideosByChannelId(VideosByChannelIDQuery query) throws HolodexException { + Call<List<Video>> call = service.getVideosByChannelId(query.getChannelId(), query.getType(), query.getInclude(), + query.getLang(), query.getLimit(), query.getOffset(), query.getPaginated()); + return executeCall(call); + + } private <T> T executeCall(Call<T> call) throws HolodexException { diff --git a/src/main/java/com/pina/query/VideosByChannelIDQuery.java b/src/main/java/com/pina/query/VideosByChannelIDQuery.java new file mode 100644 index 0000000..73999f0 --- /dev/null +++ b/src/main/java/com/pina/query/VideosByChannelIDQuery.java @@ -0,0 +1,75 @@ +package com.pina.query; + +public class VideosByChannelIDQuery { + private String channelId; + private String type; + private String include; + private String lang; + private Integer limit; + private Integer offset; + private String paginated; + + public VideosByChannelIDQuery setChannelId(String channelId) { + this.channelId = channelId; + return this; + } + + public VideosByChannelIDQuery setType(String type) { + this.type = type; + return this; + } + + public VideosByChannelIDQuery setInclude(String include) { + this.include = include; + return this; + } + + public VideosByChannelIDQuery setLang(String lang) { + this.lang = lang; + return this; + } + + public VideosByChannelIDQuery setLimit(Integer limit) { + this.limit = limit; + return this; + } + + public VideosByChannelIDQuery setOffset(Integer offset) { + this.offset = offset; + return this; + } + + public VideosByChannelIDQuery setPaginated(String paginated) { + this.paginated = paginated; + return this; + } + + public String getChannelId() { + return channelId; + } + + public String getType() { + return type; + } + + public String getInclude() { + return include; + } + + public String getLang() { + return lang; + } + + public Integer getLimit() { + return limit; + } + + public Integer getOffset() { + return offset; + } + + public String getPaginated() { + return paginated; + } + +} |
