Class NewsfeedAPI
- java.lang.Object
-
- com.cheetahdigital.corekit.models.module.Controller
-
- com.cheetahdigital.newsfeed.core.api.NewsfeedAPI
-
- All Implemented Interfaces:
RestController
public class NewsfeedAPI extends Controller
Class for setting the query parameters of Newsfeed API
-
-
Field Summary
-
Fields inherited from class com.cheetahdigital.corekit.models.module.Controller
STANDARD_DATE_FORMAT, TIMEZONE_DATE_FORMAT
-
-
Constructor Summary
Constructors Constructor Description NewsfeedAPI()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddComment(NewsfeedParams queryParams, NewsfeedFields fieldParams, Listener<SuccessResponse> listener)Add a comment to the post.voidaddPost(NewsfeedParams queryParams, NewsfeedFields fieldParams, java.util.List<okhttp3.MultipartBody.Part> attachments, ListenerModel<BaseModel<NewPost>,NewPost> listener)Add a new post to the newsfeed.voiddeleteComment(NewsfeedParams queryParams, ListenerModel<BaseModel<DeletedComment>,DeletedComment> listener)Delete a comment for a specific post.voiddeletePost(NewsfeedParams queryParams, ListenerModel<BaseModel<Post>,Post> listener)Delete a post from the newsfeed.voidflagComment(NewsfeedParams queryParams, NewsfeedFields fieldParams, Listener<SuccessResponse> callback)Flag a comment for a specific news feed post.voidflagPost(NewsfeedParams queryParams, NewsfeedFields fieldParams, Listener<SuccessResponse> callback)Flag a post.voidgetComment(NewsfeedParams queryParams, boolean clearCache, ListenerModel<BaseModel<SingleComment>,SingleComment> listener)Get a comment from post.voidgetComments(NewsfeedParams queryParams, boolean clearCache, ListenerModel<BaseModel<Comments>,Comments> listener)Get the list of comments for a specific post.voidgetFeeds(NewsfeedParams queryParams, boolean clearCache, ListenerModel<BaseModel<Feeds>,Feeds> listener)Get all the newsfeed.voidgetFlags(NewsfeedParams queryParams, boolean clearCache, ListenerModel<BaseModel<java.util.List<Flag>>,java.util.List<Flag>> listener)Lists all available flags to be assigned or set later on a news feed post/comment.voidgetNewsfeed(NewsfeedParams queryParams, boolean clearCache, ListenerModel<BaseModel<Newsfeed>,Newsfeed> listener)Get the list of posts.voidgetPost(NewsfeedParams queryParams, boolean clearCache, ListenerModel<BaseModel<Post>,Post> listener)Get a post.voidlikeComment(NewsfeedParams queryParams, Listener<SuccessResponse> listener)Like a comment for a specific post.voidlikePost(NewsfeedParams queryParams, Listener<SuccessResponse> listener)Like a post from the newsfeed.voidunflagComment(NewsfeedParams queryParams, Listener<SuccessResponse> callback)Unflag a comment for a specific news feed post.voidunflagPost(NewsfeedParams queryParams, Listener<SuccessResponse> callback)Unflag a post.voidunlikeComment(NewsfeedParams queryParams, Listener<SuccessResponse> listener)Unlike a comment for a specific post.voidunLikePost(NewsfeedParams queryParams, Listener<SuccessResponse> listener)Unlike a post from the newsfeed.-
Methods inherited from class com.cheetahdigital.corekit.models.module.Controller
createCache, createHttpClient, createRetrofitInterface, evictAllCache, getGsonConfiguration, getRestAdapter, getTimeoutConnectionInSeconds, getTimeoutSocketInSeconds, initialize, removeResponsesFromCache
-
-
-
-
Method Detail
-
getFeeds
public void getFeeds(NewsfeedParams queryParams, boolean clearCache, ListenerModel<BaseModel<Feeds>,Feeds> listener)
Get all the newsfeed. To get a list of newsfeed for a specific category(optional), includeNewsfeedParams.setCategory(String)in the params.- Parameters:
queryParams- theNewsfeedParamsfor Newsfeed APIclearCache- clear previously stored cachelistener- whether the newsfeed is already received from the server
-
getNewsfeed
public void getNewsfeed(NewsfeedParams queryParams, boolean clearCache, ListenerModel<BaseModel<Newsfeed>,Newsfeed> listener)
Get the list of posts. To get a list of post for a specific newsfeed, includeNewsfeedParams.setFeedName(String). Feed name is optional, if nothing is specified, The default newsfeed is main_newsfeed, or the first available news feed.- Parameters:
queryParams- theNewsfeedParamsfor Newsfeed APIclearCache- clear previously stored cachelistener- callback to handle the results
-
getPost
public void getPost(NewsfeedParams queryParams, boolean clearCache, ListenerModel<BaseModel<Post>,Post> listener)
Get a post. Remember to set the id byBaseParams.setId(String)- Parameters:
queryParams- theNewsfeedParamsfor Newsfeed APIclearCache- clear previously stored cachelistener- callback to handle the results
-
deletePost
public void deletePost(NewsfeedParams queryParams, ListenerModel<BaseModel<Post>,Post> listener)
Delete a post from the newsfeed. The post must be owned by the user. Remember to set the id byBaseParams.setId(String).- Parameters:
queryParams- theNewsfeedParamsfor Newsfeed APIlistener- callback to handle the results
-
likePost
public void likePost(NewsfeedParams queryParams, Listener<SuccessResponse> listener)
Like a post from the newsfeed. Remember to set the id byBaseParams.setId(String).- Parameters:
queryParams- theNewsfeedParamsfor Newsfeed APIlistener- callback to handle the results
-
unLikePost
public void unLikePost(NewsfeedParams queryParams, Listener<SuccessResponse> listener)
Unlike a post from the newsfeed. Remember to set the id byBaseParams.setId(String).- Parameters:
queryParams- theNewsfeedParamsfor Newsfeed APIlistener- callback to handle the results
-
addPost
public void addPost(NewsfeedParams queryParams, NewsfeedFields fieldParams, java.util.List<okhttp3.MultipartBody.Part> attachments, ListenerModel<BaseModel<NewPost>,NewPost> listener)
Add a new post to the newsfeed. Remember to set the body byNewsfeedFields.setBody(String).- Parameters:
queryParams- theNewsfeedParamsfor Newsfeed APIfieldParams- theNewsfeedFieldsfor Newsfeed APIattachments- a set of images and /or videos that will be attached to the postlistener- callback to handle the results
-
getComments
public void getComments(NewsfeedParams queryParams, boolean clearCache, ListenerModel<BaseModel<Comments>,Comments> listener)
Get the list of comments for a specific post. Remember to set the id byBaseParams.setId(String).- Parameters:
queryParams- theNewsfeedParamsfor Newsfeed APIclearCache- clear previously stored cachelistener- callback to handle the results
-
addComment
public void addComment(NewsfeedParams queryParams, NewsfeedFields fieldParams, Listener<SuccessResponse> listener)
Add a comment to the post. Remember to set the id of thePostbyBaseParams.setId(String)and set the content of the comment byNewsfeedFields.setMessage(String).- Parameters:
queryParams- theNewsfeedParamsfor Newsfeed APIfieldParams- theNewsfeedFieldsfor Newsfeed APIlistener- callback to handle the results
-
getComment
public void getComment(NewsfeedParams queryParams, boolean clearCache, ListenerModel<BaseModel<SingleComment>,SingleComment> listener)
Get a comment from post. Remember to set the id of thePostbyBaseParams.setId(String)and the id of theCommentbyNewsfeedParams.setCommentId(String).- Parameters:
queryParams- theNewsfeedParamsfor Newsfeed APIclearCache- clear previously stored cachelistener- callback to handle the results
-
likeComment
public void likeComment(NewsfeedParams queryParams, Listener<SuccessResponse> listener)
Like a comment for a specific post. Remember to set the id of thePostbyBaseParams.setId(String)and the id of theCommentbyNewsfeedParams.setCommentId(String).- Parameters:
queryParams- theNewsfeedParamsfor Newsfeed APIlistener- callback to handle the results
-
unlikeComment
public void unlikeComment(NewsfeedParams queryParams, Listener<SuccessResponse> listener)
Unlike a comment for a specific post. Remember to set the id of thePostbyBaseParams.setId(String)and the id of theCommentbyNewsfeedParams.setCommentId(String).- Parameters:
queryParams- theNewsfeedParamsfor Newsfeed APIlistener- callback to handle the results
-
deleteComment
public void deleteComment(NewsfeedParams queryParams, ListenerModel<BaseModel<DeletedComment>,DeletedComment> listener)
Delete a comment for a specific post. Remember to set the id of thePostbyBaseParams.setId(String)and the id of theCommentbyNewsfeedParams.setCommentId(String).- Parameters:
queryParams- theNewsfeedParamsfor Newsfeed APIlistener- callback to handle the results
-
getFlags
public void getFlags(NewsfeedParams queryParams, boolean clearCache, ListenerModel<BaseModel<java.util.List<Flag>>,java.util.List<Flag>> listener)
Lists all available flags to be assigned or set later on a news feed post/comment.- Parameters:
queryParams- theNewsfeedParamsfor Newsfeed APIclearCache- true to clear cached response, else falselistener- callback to handle the results
-
flagPost
public void flagPost(NewsfeedParams queryParams, NewsfeedFields fieldParams, Listener<SuccessResponse> callback)
Flag a post. Remember to set the id of thePostbyBaseParams.setId(String)and set the selected flag byNewsfeedFields.setFlag(String).- Parameters:
queryParams- theNewsfeedParamsfor Newsfeed APIfieldParams- contains the field parameter for Newsfeed APIcallback- callback to handle the results
-
unflagPost
public void unflagPost(NewsfeedParams queryParams, Listener<SuccessResponse> callback)
Unflag a post. Remember to set the id of thePostbyBaseParams.setId(String)- Parameters:
queryParams- theNewsfeedParamsfor Newsfeed APIcallback- callback to handle the results
-
flagComment
public void flagComment(NewsfeedParams queryParams, NewsfeedFields fieldParams, Listener<SuccessResponse> callback)
Flag a comment for a specific news feed post. Remember to set the id of thePostbyBaseParams.setId(String), id of theCommentbyNewsfeedParams.setCommentId(String), and set the selected flag byNewsfeedFields.setFlag(String).- Parameters:
queryParams- theNewsfeedParamsfor Newsfeed APIfieldParams- theNewsfeedFieldsfor Newsfeed APIcallback- callback to handle the results
-
unflagComment
public void unflagComment(NewsfeedParams queryParams, Listener<SuccessResponse> callback)
Unflag a comment for a specific news feed post. Remember to set the id of thePostbyBaseParams.setId(String)and the id of theCommentbyNewsfeedParams.setCommentId(String),- Parameters:
queryParams- theNewsfeedParamsfor Newsfeed APIcallback- callback to handle the results
-
-