aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/com/pina/Holodex.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/pina/Holodex.java')
-rw-r--r--src/main/java/com/pina/Holodex.java67
1 files changed, 66 insertions, 1 deletions
diff --git a/src/main/java/com/pina/Holodex.java b/src/main/java/com/pina/Holodex.java
index 931021f..9e7ef39 100644
--- a/src/main/java/com/pina/Holodex.java
+++ b/src/main/java/com/pina/Holodex.java
@@ -17,15 +17,28 @@ import retrofit2.converter.jackson.JacksonConverterFactory;
import java.io.IOException;
import java.util.List;
+/**
+ * The class for interacting with the Holodex API
+ */
public class Holodex {
private HolodexService service;
+ /**
+ * Instantiates a new Holodex with the default base url
+ *
+ * @param apiKey the api key
+ */
public Holodex(String apiKey) {
initializeHolodexService(apiKey, "https://holodex.net");
}
+ /**
+ * Instantiates a new Holodex with a custom base url
+ *
+ * @param apiKey the api key
+ * @param baseUrl the base url
+ */
public Holodex(String apiKey, String baseUrl) {
- // purely for unit testing
initializeHolodexService(apiKey, baseUrl);
}
@@ -47,6 +60,13 @@ public class Holodex {
service = retrofit.create(HolodexService.class);
}
+ /**
+ * Gets a list of upcoming and/or live SimpleVideos matching the VideoQueryBuilder attributes
+ *
+ * @param queryBuilder the query builder
+ * @return A list of upcoming and/or live SimpleVideos
+ * @throws HolodexException the holodex exception
+ */
public List<SimpleVideo> getLiveAndUpcomingVideos(VideoQueryBuilder queryBuilder) throws HolodexException {
Call<List<SimpleVideo>> call = service.getLiveVideos(queryBuilder.getChannelId(), queryBuilder.getId(),
queryBuilder.getInclude(), queryBuilder.getLang(),
@@ -59,6 +79,13 @@ public class Holodex {
return executeCall(call);
}
+ /**
+ * Gets a list of videos matching the VideoQueryBuilder attributes
+ *
+ * @param queryBuilder the query builder
+ * @return list of videos
+ * @throws HolodexException the holodex exception
+ */
public List<Video> getVideos(VideoQueryBuilder queryBuilder) throws HolodexException {
Call<List<Video>> call = service.getVideos(queryBuilder.getChannelId(), queryBuilder.getId(),
queryBuilder.getInclude(), queryBuilder.getLang(),
@@ -71,11 +98,26 @@ public class Holodex {
return executeCall(call);
}
+ /**
+ * Gets information about a channel when given a channel id
+ *
+ * @param channelId the channel id
+ * @return the Channel
+ * @throws HolodexException the holodex exception
+ */
public Channel getChannel(String channelId) throws HolodexException {
Call<Channel> call = service.getChannel(channelId);
return executeCall(call);
}
+ /**
+ * Gets a list of Videos matching the VideoByVideoIdQueryBuilder attributes for a specific channel
+ * Used for when the channel id is known
+ *
+ * @param query the query
+ * @return List of videos matching the query
+ * @throws HolodexException the holodex exception
+ */
public List<Video> getVideosByChannelId(VideosByChannelIDQueryBuilder query) throws HolodexException {
Call<List<Video>> call = service.getVideosByChannelId(query.getChannelId(), query.getType(), query.getInclude(),
query.getLang(), query.getLimit(), query.getOffset(), query.getPaginated());
@@ -83,17 +125,40 @@ public class Holodex {
}
+ /**
+ * Gets upcoming and live videos from an array of channel ids
+ * Response will contain videos from all channels together
+ * This should be used when there is a set of channels that need to be queried
+ *
+ * @param channels the channel ids to get videos from
+ * @return List of live and/or upcoming videos where the channel id is the author
+ * @throws HolodexException the holodex exception
+ */
public List<Video> getVideosFromChannels(String[] channels) throws HolodexException{
String channelsString = String.join(",", channels);
Call<List<Video>> call = service.getVideosFromChannels(channelsString);
return executeCall(call);
}
+ /**
+ * Gets the video matching the VideoByVideoIdQueryBuilder attributes
+ *
+ * @param query the query
+ * @return Video matching the query
+ * @throws HolodexException holodex exception
+ */
public Video getVideo(VideoByVideoIdQueryBuilder query) throws HolodexException {
Call<Video> call = service.getVideo(query.getVideoId(), query.getLang(), query.getC());
return executeCall(call);
}
+ /**
+ * Gets a list of channels the match the ChannelQueryBuilder attributes
+ *
+ * @param query the query
+ * @return List of channels matching the query
+ * @throws HolodexException the holodex exception
+ */
public List<Channel> getChannels(ChannelQueryBuilder query) throws HolodexException{
Call<List<Channel>> call = service.getChannels(query.getLimit(), query.getOffset(), query.getType(),
query.getLang(), query.getOrder(), query.getOrg(), query.getSort()
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage