diff options
| author | Pinapelz <donaldshan1@outlook.com> | 2023-04-15 02:07:12 -0700 |
|---|---|---|
| committer | Pinapelz <donaldshan1@outlook.com> | 2023-04-15 02:07:12 -0700 |
| commit | 643250ad2a67f677c43e24bfe764ac0483086bb6 (patch) | |
| tree | e463c9a5c74440a2291bf400c5167597564e3e0b /src/main/java/com/pina/Holodex.java | |
| parent | 4a8bcd9b59ef437597606dcd112af11d48509f92 (diff) | |
General cleanup of POST features0.1
Diffstat (limited to 'src/main/java/com/pina/Holodex.java')
| -rw-r--r-- | src/main/java/com/pina/Holodex.java | 19 |
1 files changed, 18 insertions, 1 deletions
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<String, Object> 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<String, Object> 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<String, Object> toMap(Object obj) throws HolodexException { + private static Map<String, Object> toMap(Object obj) throws HolodexException { Map<String, Object> map = new HashMap<>(); Field[] fields = obj.getClass().getDeclaredFields(); for (Field field : fields) { |
