diff --git a/src/main/java/org/gcube/social_networking/social_networking_client_library/PostClient.java b/src/main/java/org/gcube/social_networking/social_networking_client_library/PostClient.java index 4e9ac80..f01da59 100644 --- a/src/main/java/org/gcube/social_networking/social_networking_client_library/PostClient.java +++ b/src/main/java/org/gcube/social_networking/social_networking_client_library/PostClient.java @@ -3,7 +3,9 @@ package org.gcube.social_networking.social_networking_client_library; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; import javax.ws.rs.core.GenericType; @@ -197,13 +199,27 @@ public class PostClient extends BaseClient{ return HttpClient.post(new GenericType>(){}, request, post); } //bool - public boolean saveAttachmentEntryLib(String key, Attachment attachment){ - Validate.isTrue(attachment != null, "attachment to write cannot be null"); + public boolean saveUserPostLib(Post post, List attachments) { + Validate.isTrue(post != null, "Post to write cannot be null"); + + logger.debug("Request for saving application post"); + String thisMethodSignature = "save-user-post-attachments-lib"; + String request = getServiceEndpoint() + thisMethodSignature; + Map> obj = new HashMap<>(); + obj.put(post, attachments); + return HttpClient.post(new GenericType>(){}, request, obj); + } + + public boolean saveAppPostLib(Post post, List attachments) { + Validate.isTrue(post != null, "Post to write cannot be null"); + + logger.debug("Request for saving application post"); + String thisMethodSignature = "save-app-post-attachments-lib"; + String request = getServiceEndpoint() + thisMethodSignature; + Map> obj = new HashMap<>(); + obj.put(post, attachments); + return HttpClient.post(new GenericType>(){}, request, obj); - logger.debug("Request for save attachment"); - String thisMethodSignature = "save-attachment-entry-lib"; - String request = getServiceEndpoint() + thisMethodSignature + "?postid=" + key; - return HttpClient.post(new GenericType>(){}, request, attachment); } public boolean saveAppPostLib(Post post){