API corresponding to each social networking library function.
This commit is contained in:
parent
a8aa40c1cd
commit
86cf7f6d70
|
@ -3,7 +3,9 @@ package org.gcube.social_networking.social_networking_client_library;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.ws.rs.core.GenericType;
|
import javax.ws.rs.core.GenericType;
|
||||||
|
|
||||||
|
@ -197,13 +199,27 @@ public class PostClient extends BaseClient{
|
||||||
return HttpClient.post(new GenericType<ResponseBean<Boolean>>(){}, request, post);
|
return HttpClient.post(new GenericType<ResponseBean<Boolean>>(){}, request, post);
|
||||||
} //bool
|
} //bool
|
||||||
|
|
||||||
public boolean saveAttachmentEntryLib(String key, Attachment attachment){
|
public boolean saveUserPostLib(Post post, List<Attachment> attachments) {
|
||||||
Validate.isTrue(attachment != null, "attachment to write cannot be null");
|
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){
|
public boolean saveAppPostLib(Post post){
|
||||||
|
|
Loading…
Reference in New Issue