Class Posts


  • @Path("2/posts")
    public class Posts
    extends Object
    REST interface for the social networking library (posts).
    Author:
    Ahmed Ibrahim ISTI-CNR
    • Constructor Summary

      Constructors 
      Constructor Description
      Posts()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      javax.ws.rs.core.Response getAllLikedPostIdsByUser()
      Retrieve ids (UUID) of the liked posts by the user
      javax.ws.rs.core.Response getAllLikedPostsByUser​(@javax.validation.constraints.Min(message="limit cannot be negative", value=0L) int limit)
      Retrieve posts liked by the user
      javax.ws.rs.core.Response getAllPostsByApp()
      Retrieve the application's posts
      javax.ws.rs.core.Response getAllPostsByUser()
      Retrieve all user's posts
      javax.ws.rs.core.Response getAllPostsByVRE()  
      javax.ws.rs.core.Response getPost​(String id)
      Retrieve a post by id
      javax.ws.rs.core.Response getPostsByHashTags​(@NotNull(message="hashtag cannot be missing") String hashtag)
      Retrieve posts containing the hashtag in the context bound to the auth token
      javax.ws.rs.core.Response getQuantityPostsByUser​(@javax.validation.constraints.Min(value=0L, message="quantity cannot be negative") int quantity)
      Retrieve a given quantity of latest user's posts
      javax.ws.rs.core.Response getRecentPostsByUserAndDate​(@javax.validation.constraints.Min(value=0L, message="time cannot be negative") long timeInMillis)
      Retrieve posts of the auth token's owner, and allow to filter them by time"
      javax.ws.rs.core.Response getRecentPostsByVREAndRange​(@javax.validation.constraints.Min(value=1L, message="from cannot be negative") int from, @javax.validation.constraints.Min(value=1L, message="quantity cannot be negative") int quantity)
      return the most recent posts for this vre up to quantity param and the last index of the posts in the timeline lastReturnedPostTimelineIndex is useful to know from where to start the range the next time you ask, because there are deletions
      javax.ws.rs.core.Response saveAppPostLib​(@NotNull(message="post to add is missing") @Valid org.gcube.portal.databook.shared.PostWithAttachment postWithAttachment)  
      javax.ws.rs.core.Response saveUserPostLib​(@NotNull(message="post to add is missing") @Valid org.gcube.portal.databook.shared.PostWithAttachment postWithAttachment)  
      javax.ws.rs.core.Response writePostApp​(@NotNull(message="Post to write is null") @Valid PostInputBean post)
      Create a new application post having as owner-application the token's owner (the IAM Client), note that the application must be registered on the Information System
      javax.ws.rs.core.Response writePostUser​(@NotNull(message="Post to write is missing") @Valid PostInputBean post)
      Create a new user post having as owner the auth token's owner
    • Constructor Detail

      • Posts

        public Posts()
    • Method Detail

      • getRecentPostsByUserAndDate

        @GET
        @Path("get-posts-user-since/")
        @Produces("application/json")
        public javax.ws.rs.core.Response getRecentPostsByUserAndDate​(@QueryParam("time") @Min(value=0L,message="time cannot be negative")
                                                                     @javax.validation.constraints.Min(value=0L, message="time cannot be negative") long timeInMillis)
                                                              throws javax.validation.ValidationException
        Retrieve posts of the auth token's owner, and allow to filter them by time"
        Parameters:
        timeInMillis - The reference time since when retrieving posts
        Returns:
        the posts
        Throws:
        javax.validation.ValidationException
      • getAllPostsByUser

        @GET
        @Path("get-posts-user/")
        @Produces("application/json")
        public javax.ws.rs.core.Response getAllPostsByUser()
        Retrieve all user's posts
        Returns:
        all posts of the auth token's owner in the context identified by the token
      • getPost

        @GET
        @Path("get-post/")
        @Produces("application/json")
        public javax.ws.rs.core.Response getPost​(@QueryParam("id")
                                                 String id)
        Retrieve a post by id
        Returns:
        the post if the post id belongs to a post in the context identified by the token
      • getQuantityPostsByUser

        @GET
        @Path("get-posts-user-quantity/")
        @Produces("application/json")
        public javax.ws.rs.core.Response getQuantityPostsByUser​(@DefaultValue("10") @QueryParam("quantity") @Min(value=0L,message="quantity cannot be negative")
                                                                @javax.validation.constraints.Min(value=0L, message="quantity cannot be negative") int quantity)
                                                         throws javax.validation.ValidationException
        Retrieve a given quantity of latest user's posts
        Parameters:
        quantity - the number of latest post to get
        Returns:
        all posts of the auth token's owner in the context identified by the token, in reverse chronological order up to quantity (at most)
        Throws:
        javax.validation.ValidationException
      • writePostUser

        @POST
        @Path("write-post-user")
        @Consumes("application/json")
        @Produces("application/json")
        public javax.ws.rs.core.Response writePostUser​(@NotNull(message="Post to write is missing") @Valid
                                                       @NotNull(message="Post to write is missing") @Valid PostInputBean post)
                                                throws javax.validation.ValidationException
        Create a new user post having as owner the auth token's owner
        Parameters:
        post - The post to be written
        Returns:
        Throws:
        javax.validation.ValidationException
      • getAllPostsByApp

        @GET
        @Path("get-posts-app/")
        @Produces("application/json")
        public javax.ws.rs.core.Response getAllPostsByApp()
        Retrieve the application's posts
        Returns:
        the application (IAM Client) posts belonging to the token's owner (i.e., an application)"
      • writePostApp

        @POST
        @Path("write-post-app")
        @Consumes("application/json")
        @Produces("application/json")
        public javax.ws.rs.core.Response writePostApp​(@NotNull(message="Post to write is null") @Valid
                                                      @NotNull(message="Post to write is null") @Valid PostInputBean post)
        Create a new application post having as owner-application the token's owner (the IAM Client), note that the application must be registered on the Information System
        Parameters:
        post - The post to be written
        Returns:
      • getAllPostsByVRE

        @GET
        @Path("get-posts-vre/")
        @Produces("application/json")
        public javax.ws.rs.core.Response getAllPostsByVRE()
        Returns:
        all the posts in the context bound to the auth token
      • getRecentPostsByVREAndRange

        @GET
        @Path("get-recent-posts-vre-by-range/")
        @Produces("application/json")
        public javax.ws.rs.core.Response getRecentPostsByVREAndRange​(@QueryParam("from") @Min(value=1L,message="from cannot be negative")
                                                                     @javax.validation.constraints.Min(value=1L, message="from cannot be negative") int from,
                                                                     @QueryParam("quantity") @Min(value=1L,message="quantity cannot be negative")
                                                                     @javax.validation.constraints.Min(value=1L, message="quantity cannot be negative") int quantity)
                                                              throws javax.validation.ValidationException
        return the most recent posts for this vre up to quantity param and the last index of the posts in the timeline lastReturnedPostTimelineIndex is useful to know from where to start the range the next time you ask, because there are deletions
        Parameters:
        from - the range start (most recent feeds for this vre) has to be greater than 0
        quantity - the number of most recent feeds for this vre starting from "from" param
        Returns:
        a RangePosts containing of most recent feeds for this vre
        Throws:
        org.gcube.portal.databook.shared.ex.FeedTypeNotFoundException
        org.gcube.portal.databook.shared.ex.PrivacyLevelTypeNotFoundException
        org.gcube.portal.databook.shared.ex.ColumnNameNotFoundException
        javax.validation.ValidationException
      • getPostsByHashTags

        @GET
        @Path("get-posts-by-hashtag/")
        @Produces("application/json")
        public javax.ws.rs.core.Response getPostsByHashTags​(@QueryParam("hashtag") @NotNull(message="hashtag cannot be missing")
                                                            @NotNull(message="hashtag cannot be missing") String hashtag)
                                                     throws javax.validation.ValidationException
        Retrieve posts containing the hashtag in the context bound to the auth token
        Parameters:
        hashtag - he hashtag to be contained within the posts
        Returns:
        the posts in the context bound to the auth token matching the hashtag
        Throws:
        javax.validation.ValidationException
      • getAllLikedPostIdsByUser

        @GET
        @Path("get-id-liked-posts/")
        @Produces("application/json")
        public javax.ws.rs.core.Response getAllLikedPostIdsByUser()
        Retrieve ids (UUID) of the liked posts by the user
        Returns:
        ids (UUID) of the liked posts by the user in the context bound to the auth token
      • getAllLikedPostsByUser

        @GET
        @Path("get-liked-posts/")
        @Produces("application/json")
        public javax.ws.rs.core.Response getAllLikedPostsByUser​(@DefaultValue("10") @QueryParam("limit") @Min(message="limit cannot be negative",value=0L)
                                                                @javax.validation.constraints.Min(message="limit cannot be negative", value=0L) int limit)
                                                         throws javax.validation.ValidationException
        Retrieve posts liked by the user
        Parameters:
        limit - The maximum number of posts to be retrieved
        Returns:
        posts liked by the user (up to a given quantity) in the context bound to the auth token
        Throws:
        javax.validation.ValidationException
      • saveUserPostLib

        @POST
        @Consumes("application/json")
        @Produces("application/json")
        @Path("save-user-post-attachments-lib")
        public javax.ws.rs.core.Response saveUserPostLib​(@NotNull(message="post to add is missing") @Valid
                                                         @NotNull(message="post to add is missing") @Valid org.gcube.portal.databook.shared.PostWithAttachment postWithAttachment)
                                                  throws javax.validation.ValidationException
        Throws:
        javax.validation.ValidationException
      • saveAppPostLib

        @POST
        @Consumes("application/json")
        @Produces("application/json")
        @Path("save-app-post-attachments-lib")
        public javax.ws.rs.core.Response saveAppPostLib​(@NotNull(message="post to add is missing") @Valid
                                                        @NotNull(message="post to add is missing") @Valid org.gcube.portal.databook.shared.PostWithAttachment postWithAttachment)
                                                 throws javax.validation.ValidationException
        Throws:
        javax.validation.ValidationException