API corresponding to each social networking library function.

This commit is contained in:
Ahmed Salah Tawfik Ibrahim 2023-11-21 18:36:28 +01:00
parent a8aa40c1cd
commit 86cf7f6d70
1 changed files with 22 additions and 6 deletions

View File

@ -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<ResponseBean<Boolean>>(){}, 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<Attachment> 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<Post, List<Attachment>> obj = new HashMap<>();
obj.put(post, attachments);
return HttpClient.post(new GenericType<ResponseBean<Boolean>>(){}, request, obj);
}
public boolean saveAppPostLib(Post post, List<Attachment> 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<Post, List<Attachment>> obj = new HashMap<>();
obj.put(post, attachments);
return HttpClient.post(new GenericType<ResponseBean<Boolean>>(){}, 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<ResponseBean<Boolean>>(){}, request, attachment);
}
public boolean saveAppPostLib(Post post){