From 643250ad2a67f677c43e24bfe764ac0483086bb6 Mon Sep 17 00:00:00 2001 From: Pinapelz Date: Sat, 15 Apr 2023 02:07:12 -0700 Subject: General cleanup of POST features --- src/main/java/com/pina/Holodex.java | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'src/main/java/com/pina/Holodex.java') diff --git a/src/main/java/com/pina/Holodex.java b/src/main/java/com/pina/Holodex.java index 2b211e0..eca6147 100644 --- a/src/main/java/com/pina/Holodex.java +++ b/src/main/java/com/pina/Holodex.java @@ -188,6 +188,15 @@ public class Holodex { return executeCall(call); } + /** + * Sends a POST request to search for videos matching the VideoSearchQueryBuilder attributes + * If the query is paginated, the response will be a VideoSearchResult object + * If the query is not paginated, the response will be a list of SimpleVideo objects + * @param query + * @return + * @throws HolodexException + */ + public Object searchVideo(VideoSearchQueryBuilder query) throws HolodexException { Map payload = toMap(query); RequestBody body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), @@ -201,6 +210,14 @@ public class Holodex { } + /** + * Sends a POST request to search for comments matching the CommentSearchQueryBuilder attributes + * If the query is paginated, the response will be a CommentSearchResult object + * If the query is not paginated, the response will be a list of SimpleCommentVideo objects + * @param query + * @return + * @throws HolodexException + */ public Object searchComment(CommentSearchQueryBuilder query) throws HolodexException{ Map payload = toMap(query); RequestBody body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), @@ -213,7 +230,7 @@ public class Holodex { return executeCall(call); } - public static Map toMap(Object obj) throws HolodexException { + private static Map toMap(Object obj) throws HolodexException { Map map = new HashMap<>(); Field[] fields = obj.getClass().getDeclaredFields(); for (Field field : fields) { -- cgit v1.2.3