From c0f3a15069c0af41e9196779c829fb545ba870e6 Mon Sep 17 00:00:00 2001 From: Pinapelz Date: Tue, 4 Apr 2023 22:19:22 -0700 Subject: Implemented getChannel method and added javadoc to VideoQueryBuilder --- src/main/java/com/pina/Holodex.java | 6 + src/main/java/com/pina/HolodexService.java | 9 +- .../com/pina/query/LiveStreamsQueryBuilder.java | 154 -------------------- .../java/com/pina/query/VideoQueryBuilder.java | 157 +++++++++++++++++++++ 4 files changed, 168 insertions(+), 158 deletions(-) delete mode 100644 src/main/java/com/pina/query/LiveStreamsQueryBuilder.java create mode 100644 src/main/java/com/pina/query/VideoQueryBuilder.java (limited to 'src/main/java/com/pina') diff --git a/src/main/java/com/pina/Holodex.java b/src/main/java/com/pina/Holodex.java index b3ce5ec..5ea09aa 100644 --- a/src/main/java/com/pina/Holodex.java +++ b/src/main/java/com/pina/Holodex.java @@ -45,6 +45,12 @@ public class Holodex { return executeCall(call); } + public Channel getChannel(String channelId) throws HolodexException { + Call call = service.getChannel(channelId); + return executeCall(call); + } + + private T executeCall(Call call) throws HolodexException { diff --git a/src/main/java/com/pina/HolodexService.java b/src/main/java/com/pina/HolodexService.java index da2a62a..40a402c 100644 --- a/src/main/java/com/pina/HolodexService.java +++ b/src/main/java/com/pina/HolodexService.java @@ -2,6 +2,7 @@ package com.pina; import java.util.List; +import com.pina.datatypes.Channel; import com.pina.datatypes.Video; import retrofit2.Call; import retrofit2.http.GET; @@ -10,7 +11,7 @@ import retrofit2.http.Query; public interface HolodexService { @GET("/api/v2/live") - Call> getLiveVideo( + Call> getLiveVideos( @Query("channelID") String channelID, @Query("id") String id, @Query("include") String include, @@ -48,12 +49,12 @@ public interface HolodexService { ); @GET("/api/v2/channels/{channelID}") - Call> getChannel( + Call getChannel( @Path("channelID") String channelID ); @GET("/api/v2/channels/{channelID}/{type}") - Call> getChannelType( + Call> getVideosByChannelId( @Path("channelID") String channelID, @Path("type") String type, @Query("include") String include, @@ -64,7 +65,7 @@ public interface HolodexService { ); @GET("/api/v2/channels/users/live") - Call> getLiveChannels( + Call> getVideosFromChannels( @Query("channels") String[] channels ); diff --git a/src/main/java/com/pina/query/LiveStreamsQueryBuilder.java b/src/main/java/com/pina/query/LiveStreamsQueryBuilder.java deleted file mode 100644 index ca7f86e..0000000 --- a/src/main/java/com/pina/query/LiveStreamsQueryBuilder.java +++ /dev/null @@ -1,154 +0,0 @@ -package com.pina.query; - -public class LiveStreamsQueryBuilder { - private String channelId; - private String id; - private String include; - private String lang; - private Integer limit; - private Integer maxUpcomingHours; - private String mentionedChannelId; - private Integer offset; - private String order; - private String org; - private String paginated; - private String sort; - private String status; - private String topic; - private String type; - - public LiveStreamsQueryBuilder setChannelId(String channelId) { - this.channelId = channelId; - return this; - } - - public LiveStreamsQueryBuilder setId(String id) { - this.id = id; - return this; - } - - public LiveStreamsQueryBuilder setInclude(String include) { - this.include = include; - return this; - } - - public LiveStreamsQueryBuilder setLang(String lang) { - this.lang = lang; - return this; - } - - public LiveStreamsQueryBuilder setLimit(Integer limit) { - this.limit = limit; - return this; - } - - public LiveStreamsQueryBuilder setMaxUpcomingHours(Integer maxUpcomingHours) { - this.maxUpcomingHours = maxUpcomingHours; - return this; - } - - public LiveStreamsQueryBuilder setMentionedChannelId(String mentionedChannelId) { - this.mentionedChannelId = mentionedChannelId; - return this; - } - - public LiveStreamsQueryBuilder setOffset(Integer offset) { - this.offset = offset; - return this; - } - - public LiveStreamsQueryBuilder setOrder(String order) { - this.order = order; - return this; - } - - public LiveStreamsQueryBuilder setOrg(String org) { - this.org = org; - return this; - } - - public LiveStreamsQueryBuilder setPaginated(String paginated) { - this.paginated = paginated; - return this; - } - - public LiveStreamsQueryBuilder setSort(String sort) { - this.sort = sort; - return this; - } - - public LiveStreamsQueryBuilder setStatus(String status) { - this.status = status; - return this; - } - - public LiveStreamsQueryBuilder setTopic(String topic) { - this.topic = topic; - return this; - } - - public LiveStreamsQueryBuilder setType(String type) { - this.type = type; - return this; - } - - public String getChannelId() { - return channelId; - } - - public String getId() { - return id; - } - - public String getInclude() { - return include; - } - - public String getLang() { - return lang; - } - - public Integer getLimit() { - return limit; - } - - public Integer getMaxUpcomingHours() { - return maxUpcomingHours; - } - - public String getMentionedChannelId() { - return mentionedChannelId; - } - - public Integer getOffset() { - return offset; - } - - public String getOrder() { - return order; - } - - public String getOrg() { - return org; - } - - public String getPaginated() { - return paginated; - } - - public String getSort() { - return sort; - } - - public String getStatus() { - return status; - } - - public String getTopic() { - return topic; - } - - public String getType() { - return type; - } -} \ No newline at end of file diff --git a/src/main/java/com/pina/query/VideoQueryBuilder.java b/src/main/java/com/pina/query/VideoQueryBuilder.java new file mode 100644 index 0000000..e65a04c --- /dev/null +++ b/src/main/java/com/pina/query/VideoQueryBuilder.java @@ -0,0 +1,157 @@ +package com.pina.query; + +public class VideoQueryBuilder { + /*** + * Query parameters for /api/v2/live and /api/v2/videos + */ + private String channelId; + private String id; + private String include; + private String lang; + private Integer limit; + private Integer maxUpcomingHours; + private String mentionedChannelId; + private Integer offset; + private String order; + private String org; + private String paginated; + private String sort; + private String status; + private String topic; + private String type; + + public VideoQueryBuilder setChannelId(String channelId) { + this.channelId = channelId; + return this; + } + + public VideoQueryBuilder setId(String id) { + this.id = id; + return this; + } + + public VideoQueryBuilder setInclude(String include) { + this.include = include; + return this; + } + + public VideoQueryBuilder setLang(String lang) { + this.lang = lang; + return this; + } + + public VideoQueryBuilder setLimit(Integer limit) { + this.limit = limit; + return this; + } + + public VideoQueryBuilder setMaxUpcomingHours(Integer maxUpcomingHours) { + this.maxUpcomingHours = maxUpcomingHours; + return this; + } + + public VideoQueryBuilder setMentionedChannelId(String mentionedChannelId) { + this.mentionedChannelId = mentionedChannelId; + return this; + } + + public VideoQueryBuilder setOffset(Integer offset) { + this.offset = offset; + return this; + } + + public VideoQueryBuilder setOrder(String order) { + this.order = order; + return this; + } + + public VideoQueryBuilder setOrg(String org) { + this.org = org; + return this; + } + + public VideoQueryBuilder setPaginated(String paginated) { + this.paginated = paginated; + return this; + } + + public VideoQueryBuilder setSort(String sort) { + this.sort = sort; + return this; + } + + public VideoQueryBuilder setStatus(String status) { + this.status = status; + return this; + } + + public VideoQueryBuilder setTopic(String topic) { + this.topic = topic; + return this; + } + + public VideoQueryBuilder setType(String type) { + this.type = type; + return this; + } + + public String getChannelId() { + return channelId; + } + + public String getId() { + return id; + } + + public String getInclude() { + return include; + } + + public String getLang() { + return lang; + } + + public Integer getLimit() { + return limit; + } + + public Integer getMaxUpcomingHours() { + return maxUpcomingHours; + } + + public String getMentionedChannelId() { + return mentionedChannelId; + } + + public Integer getOffset() { + return offset; + } + + public String getOrder() { + return order; + } + + public String getOrg() { + return org; + } + + public String getPaginated() { + return paginated; + } + + public String getSort() { + return sort; + } + + public String getStatus() { + return status; + } + + public String getTopic() { + return topic; + } + + public String getType() { + return type; + } +} \ No newline at end of file -- cgit v1.2.3