Spring Social Facebook

org.springframework.social.facebook.api
Interface FeedOperations


public interface FeedOperations

Interface defining operations that can be performed on a Facebook feed.

Author:
Craig Walls

Method Summary
 void deletePost(java.lang.String id)
          Deletes a post.
 java.util.List<Post> getFeed()
          Retrieves recent posts for the authenticated user.
 java.util.List<Post> getFeed(int offset, int limit)
          Retrieves recent posts for the authenticated user.
 java.util.List<Post> getFeed(java.lang.String ownerId)
          Retrieves recent feed entries for a given user.
 java.util.List<Post> getFeed(java.lang.String ownerId, int offset, int limit)
          Retrieves recent feed entries for a given user.
 java.util.List<Post> getHomeFeed()
          Retrieves the user's home feed.
 java.util.List<Post> getHomeFeed(int offset, int limit)
          Retrieves the user's home feed.
 java.util.List<LinkPost> getLinks()
          Retrieves the link entries from the authenticated user's feed.
 java.util.List<LinkPost> getLinks(int offset, int limit)
          Retrieves the link entries from the authenticated user's feed.
 java.util.List<LinkPost> getLinks(java.lang.String ownerId)
          Retrieves the link entries from the specified owner's feed.
 java.util.List<LinkPost> getLinks(java.lang.String ownerId, int offset, int limit)
          Retrieves the link entries from the specified owner's feed.
 java.util.List<NotePost> getNotes()
          Retrieves the note entries from the authenticated user's feed.
 java.util.List<NotePost> getNotes(int offset, int limit)
          Retrieves the note entries from the authenticated user's feed.
 java.util.List<NotePost> getNotes(java.lang.String ownerId)
          Retrieves the note entries from the specified owner's feed.
 java.util.List<NotePost> getNotes(java.lang.String ownerId, int offset, int limit)
          Retrieves the note entries from the specified owner's feed.
 Post getPost(java.lang.String entryId)
          Retrieves a single post.
 java.util.List<Post> getPosts()
          Retrieves the post entries from the authenticated user's feed.
 java.util.List<Post> getPosts(int offset, int limit)
          Retrieves the post entries from the authenticated user's feed.
 java.util.List<Post> getPosts(java.lang.String ownerId)
          Retrieves the post entries from the specified owner's feed.
 java.util.List<Post> getPosts(java.lang.String ownerId, int offset, int limit)
          Retrieves the post entries from the specified owner's feed.
 java.util.List<StatusPost> getStatuses()
          Retrieves the status entries from the authenticated user's feed.
 java.util.List<StatusPost> getStatuses(int offset, int limit)
          Retrieves the status entries from the authenticated user's feed.
 java.util.List<StatusPost> getStatuses(java.lang.String userId)
          Retrieves the status entries from the specified user's feed.
 java.util.List<StatusPost> getStatuses(java.lang.String userId, int offset, int limit)
          Retrieves the status entries from the specified user's feed.
 java.lang.String post(java.lang.String ownerId, java.lang.String message)
          Posts a message to a feed.
 java.lang.String postLink(java.lang.String message, FacebookLink link)
          Posts a link to the authenticated user's feed.
 java.lang.String postLink(java.lang.String ownerId, java.lang.String message, FacebookLink link)
          Posts a link to a feed.
 java.util.List<Post> searchHomeFeed(java.lang.String query)
          Searches the authenticated user's home feed.
 java.util.List<Post> searchHomeFeed(java.lang.String query, int offset, int limit)
          Searches the authenticated user's home feed.
 java.util.List<Post> searchPublicFeed(java.lang.String query)
          Searches Facebook's public feed.
 java.util.List<Post> searchPublicFeed(java.lang.String query, int offset, int limit)
          Searches Facebook's public feed.
 java.util.List<Post> searchUserFeed(java.lang.String query)
          Searches the authenticated user's feed.
 java.util.List<Post> searchUserFeed(java.lang.String query, int offset, int limit)
          Searches the authenticated user's feed.
 java.util.List<Post> searchUserFeed(java.lang.String userId, java.lang.String query)
          Searches a specified user's feed.
 java.util.List<Post> searchUserFeed(java.lang.String userId, java.lang.String query, int offset, int limit)
          Searches a specified user's feed.
 java.lang.String updateStatus(java.lang.String message)
          Posts a status update to the authenticated user's feed.
 

Method Detail

getFeed

java.util.List<Post> getFeed()
Retrieves recent posts for the authenticated user. Requires "read_stream" permission to read non-public posts. Returns up to the most recent 25 posts.

Returns:
a list of Posts for the authenticated user.
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.
org.springframework.social.MissingAuthorizationException - if FacebookTemplate was not created with an access token.

getFeed

java.util.List<Post> getFeed(int offset,
                             int limit)
Retrieves recent posts for the authenticated user. Requires "read_stream" permission to read non-public posts.

Parameters:
offset - the offset into the feed to start retrieving posts.
limit - the maximum number of posts to return.
Returns:
a list of Posts for the authenticated user.
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.
org.springframework.social.MissingAuthorizationException - if FacebookTemplate was not created with an access token.

getFeed

java.util.List<Post> getFeed(java.lang.String ownerId)
Retrieves recent feed entries for a given user. Returns up to the most recent 25 posts. Requires "read_stream" permission to read non-public posts.

Parameters:
ownerId - the Facebook ID or alias for the owner (user, group, event, page, etc) of the feed.
Returns:
a list of Posts for the specified user.
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.
org.springframework.social.MissingAuthorizationException - if FacebookTemplate was not created with an access token.

getFeed

java.util.List<Post> getFeed(java.lang.String ownerId,
                             int offset,
                             int limit)
Retrieves recent feed entries for a given user. Requires "read_stream" permission to read non-public posts. Returns up to the most recent 25 posts.

Parameters:
ownerId - the Facebook ID or alias for the owner (user, group, event, page, etc) of the feed.
offset - the offset into the feed to start retrieving posts.
limit - the maximum number of posts to return.
Returns:
a list of Posts for the specified user.
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.
org.springframework.social.MissingAuthorizationException - if FacebookTemplate was not created with an access token.

getHomeFeed

java.util.List<Post> getHomeFeed()
Retrieves the user's home feed. This includes entries from the user's friends. Returns up to the most recent 25 posts. Requires "read_stream" permission.

Returns:
a list of Posts from the authenticated user's home feed.
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.
org.springframework.social.InsufficientPermissionException - if the user has not granted "read_stream" permission.
org.springframework.social.MissingAuthorizationException - if FacebookTemplate was not created with an access token.

getHomeFeed

java.util.List<Post> getHomeFeed(int offset,
                                 int limit)
Retrieves the user's home feed. This includes entries from the user's friends. Requires "read_stream" permission.

Parameters:
offset - the offset into the feed to start retrieving posts.
limit - the maximum number of posts to return.
Returns:
a list of Posts from the authenticated user's home feed.
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.
org.springframework.social.InsufficientPermissionException - if the user has not granted "read_stream" permission.
org.springframework.social.MissingAuthorizationException - if FacebookTemplate was not created with an access token.

getPost

Post getPost(java.lang.String entryId)
Retrieves a single post.

Parameters:
entryId - the entry ID
Returns:
the requested Post
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.

getStatuses

java.util.List<StatusPost> getStatuses()
Retrieves the status entries from the authenticated user's feed. Returns up to the most recent 25 posts.

Returns:
a list of status Posts.
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.
org.springframework.social.MissingAuthorizationException - if FacebookTemplate was not created with an access token.

getStatuses

java.util.List<StatusPost> getStatuses(int offset,
                                       int limit)
Retrieves the status entries from the authenticated user's feed.

Parameters:
offset - the offset into the feed to start retrieving posts.
limit - the maximum number of posts to return.
Returns:
a list of status Posts.
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.
org.springframework.social.MissingAuthorizationException - if FacebookTemplate was not created with an access token.

getStatuses

java.util.List<StatusPost> getStatuses(java.lang.String userId)
Retrieves the status entries from the specified user's feed. Returns up to the most recent 25 posts. Requires "read_stream" permission.

Parameters:
userId - the user's ID
Returns:
a list of status Posts.
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.
org.springframework.social.InsufficientPermissionException - if the user has not granted "read_stream" permission.
org.springframework.social.MissingAuthorizationException - if FacebookTemplate was not created with an access token.

getStatuses

java.util.List<StatusPost> getStatuses(java.lang.String userId,
                                       int offset,
                                       int limit)
Retrieves the status entries from the specified user's feed. Requires "read_stream" permission.

Parameters:
userId - the user's ID
offset - the offset into the feed to start retrieving posts.
limit - the maximum number of posts to return.
Returns:
a list of status Posts.
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.
org.springframework.social.InsufficientPermissionException - if the user has not granted "read_stream" permission.
org.springframework.social.MissingAuthorizationException - if FacebookTemplate was not created with an access token.

getLinks

java.util.List<LinkPost> getLinks()
Retrieves the link entries from the authenticated user's feed. Returns up to the most recent 25 posts. Requires "read_stream" permission.

Returns:
a list of link Posts.
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.
org.springframework.social.InsufficientPermissionException - if the user has not granted "read_stream" permission.
org.springframework.social.MissingAuthorizationException - if FacebookTemplate was not created with an access token.

getLinks

java.util.List<LinkPost> getLinks(int offset,
                                  int limit)
Retrieves the link entries from the authenticated user's feed. Requires "read_stream" permission.

Parameters:
offset - the offset into the feed to start retrieving posts.
limit - the maximum number of posts to return.
Returns:
a list of link Posts.
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.
org.springframework.social.InsufficientPermissionException - if the user has not granted "read_stream" permission.
org.springframework.social.MissingAuthorizationException - if FacebookTemplate was not created with an access token.

getLinks

java.util.List<LinkPost> getLinks(java.lang.String ownerId)
Retrieves the link entries from the specified owner's feed. Returns up to the most recent 25 posts. Requires "read_stream" permission.

Parameters:
ownerId - the owner of the feed (could be a user, page, event, etc)
Returns:
a list of link Posts.
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.
org.springframework.social.InsufficientPermissionException - if the user has not granted "read_stream" permission.
org.springframework.social.MissingAuthorizationException - if FacebookTemplate was not created with an access token.

getLinks

java.util.List<LinkPost> getLinks(java.lang.String ownerId,
                                  int offset,
                                  int limit)
Retrieves the link entries from the specified owner's feed. Requires "read_stream" permission.

Parameters:
ownerId - the owner of the feed (could be a user, page, event, etc)
offset - the offset into the feed to start retrieving posts.
limit - the maximum number of posts to return.
Returns:
a list of link Posts.
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.
org.springframework.social.InsufficientPermissionException - if the user has not granted "read_stream" permission.
org.springframework.social.MissingAuthorizationException - if FacebookTemplate was not created with an access token.

getNotes

java.util.List<NotePost> getNotes()
Retrieves the note entries from the authenticated user's feed. Returns up to the most recent 25 posts. Requires "read_stream" permission.

Returns:
a list of note Posts.
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.
org.springframework.social.InsufficientPermissionException - if the user has not granted "read_stream" permission.
org.springframework.social.MissingAuthorizationException - if FacebookTemplate was not created with an access token.

getNotes

java.util.List<NotePost> getNotes(int offset,
                                  int limit)
Retrieves the note entries from the authenticated user's feed. Requires "read_stream" permission.

Parameters:
offset - the offset into the feed to start retrieving posts.
limit - the maximum number of posts to return.
Returns:
a list of note Posts.
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.
org.springframework.social.InsufficientPermissionException - if the user has not granted "read_stream" permission.
org.springframework.social.MissingAuthorizationException - if FacebookTemplate was not created with an access token.

getNotes

java.util.List<NotePost> getNotes(java.lang.String ownerId)
Retrieves the note entries from the specified owner's feed. Returns up to the most recent 25 posts. Requires "read_stream" permission.

Parameters:
ownerId - the owner of the feed (could be a user, page, event, etc)
Returns:
a list of note Posts.
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.
org.springframework.social.InsufficientPermissionException - if the user has not granted "read_stream" permission.
org.springframework.social.MissingAuthorizationException - if FacebookTemplate was not created with an access token.

getNotes

java.util.List<NotePost> getNotes(java.lang.String ownerId,
                                  int offset,
                                  int limit)
Retrieves the note entries from the specified owner's feed. Requires "read_stream" permission.

Parameters:
ownerId - the owner of the feed (could be a user, page, event, etc)
offset - the offset into the feed to start retrieving posts.
limit - the maximum number of posts to return.
Returns:
a list of note Posts.
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.
org.springframework.social.InsufficientPermissionException - if the user has not granted "read_stream" permission.
org.springframework.social.MissingAuthorizationException - if FacebookTemplate was not created with an access token.

getPosts

java.util.List<Post> getPosts()
Retrieves the post entries from the authenticated user's feed. Returns up to the most recent 25 posts. Requires "read_stream" permission.

Returns:
a list of post Posts.
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.
org.springframework.social.InsufficientPermissionException - if the user has not granted "read_stream" permission.
org.springframework.social.MissingAuthorizationException - if FacebookTemplate was not created with an access token.

getPosts

java.util.List<Post> getPosts(int offset,
                              int limit)
Retrieves the post entries from the authenticated user's feed. Requires "read_stream" permission.

Parameters:
offset - the offset into the feed to start retrieving posts.
limit - the maximum number of posts to return.
Returns:
a list of post Posts.
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.
org.springframework.social.InsufficientPermissionException - if the user has not granted "read_stream" permission.
org.springframework.social.MissingAuthorizationException - if FacebookTemplate was not created with an access token.

getPosts

java.util.List<Post> getPosts(java.lang.String ownerId)
Retrieves the post entries from the specified owner's feed. Returns up to the most recent 25 posts. Requires "read_stream" permission.

Parameters:
ownerId - the owner of the feed (could be a user, page, event, etc)
Returns:
a list of post Posts.
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.
org.springframework.social.InsufficientPermissionException - if the user has not granted "read_stream" permission.
org.springframework.social.MissingAuthorizationException - if FacebookTemplate was not created with an access token.

getPosts

java.util.List<Post> getPosts(java.lang.String ownerId,
                              int offset,
                              int limit)
Retrieves the post entries from the specified owner's feed. Requires "read_stream" permission.

Parameters:
ownerId - the owner of the feed (could be a user, page, event, etc)
offset - the offset into the feed to start retrieving posts.
limit - the maximum number of posts to return.
Returns:
a list of post Posts.
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.
org.springframework.social.InsufficientPermissionException - if the user has not granted "read_stream" permission.
org.springframework.social.MissingAuthorizationException - if FacebookTemplate was not created with an access token.

updateStatus

java.lang.String updateStatus(java.lang.String message)
Posts a status update to the authenticated user's feed. Requires "publish_stream" permission.

Parameters:
message - the message to post.
Returns:
the ID of the new feed entry.
Throws:
org.springframework.social.DuplicateStatusException - if the status message duplicates a previously posted status.
org.springframework.social.RateLimitExceededException - if the per-user/per-app rate limit is exceeded.
org.springframework.social.ApiException - if there is an error while communicating with Facebook.
org.springframework.social.InsufficientPermissionException - if the user has not granted "publish_stream" permission.
org.springframework.social.MissingAuthorizationException - if FacebookTemplate was not created with an access token.

postLink

java.lang.String postLink(java.lang.String message,
                          FacebookLink link)
Posts a link to the authenticated user's feed. Requires "publish_stream" permission.

Parameters:
message - a message to send with the link.
Returns:
the ID of the new feed entry.
Throws:
org.springframework.social.DuplicateStatusException - if the post duplicates a previous post.
org.springframework.social.RateLimitExceededException - if the per-user/per-app rate limit is exceeded.
org.springframework.social.ApiException - if there is an error while communicating with Facebook.
org.springframework.social.InsufficientPermissionException - if the user has not granted "publish_stream" permission.
org.springframework.social.MissingAuthorizationException - if FacebookTemplate was not created with an access token.

post

java.lang.String post(java.lang.String ownerId,
                      java.lang.String message)
Posts a message to a feed. Requires "publish_stream" permission.

Parameters:
ownerId - the feed owner ID. Could be a user ID or a page ID.
message - the message to post.
Returns:
the id of the new feed entry.
Throws:
org.springframework.social.DuplicateStatusException - if the post duplicates a previous post.
org.springframework.social.RateLimitExceededException - if the per-user/per-app rate limit is exceeded.
org.springframework.social.ApiException - if there is an error while communicating with Facebook.
org.springframework.social.InsufficientPermissionException - if the user has not granted "publish_stream" permission.
org.springframework.social.MissingAuthorizationException - if FacebookTemplate was not created with an access token.

postLink

java.lang.String postLink(java.lang.String ownerId,
                          java.lang.String message,
                          FacebookLink link)
Posts a link to a feed. Requires "publish_stream" permission.

Parameters:
ownerId - the feed owner ID. Could be a user ID or a page ID.
message - a message to send with the link.
Returns:
the ID of the new feed entry.
Throws:
org.springframework.social.DuplicateStatusException - if the post duplicates a previous post.
org.springframework.social.ApiException - if there is an error while communicating with Facebook.
org.springframework.social.InsufficientPermissionException - if the user has not granted "publish_stream" permission.
org.springframework.social.MissingAuthorizationException - if FacebookTemplate was not created with an access token.

deletePost

void deletePost(java.lang.String id)
Deletes a post. Requires "publish_stream" permission and the post must have been created by the same application.

Parameters:
id - the feed entry ID
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.
org.springframework.social.InsufficientPermissionException - if the user has not granted "publish_stream" permission.
org.springframework.social.MissingAuthorizationException - if FacebookTemplate was not created with an access token.

searchPublicFeed

java.util.List<Post> searchPublicFeed(java.lang.String query)
Searches Facebook's public feed. Returns up to 25 posts that match the query.

Parameters:
query - the search query (e.g., "Dr Seuss")
Returns:
a list of Posts that match the search query
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.

searchPublicFeed

java.util.List<Post> searchPublicFeed(java.lang.String query,
                                      int offset,
                                      int limit)
Searches Facebook's public feed.

Parameters:
query - the search query (e.g., "Dr Seuss")
offset - the offset into the feed to start retrieving posts.
limit - the maximum number of posts to return.
Returns:
a list of Posts that match the search query
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.

searchHomeFeed

java.util.List<Post> searchHomeFeed(java.lang.String query)
Searches the authenticated user's home feed. Returns up to 25 posts that match the query.

Parameters:
query - the search query (e.g., "Dr Seuss")
Returns:
a list of Posts that match the search query
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.
org.springframework.social.MissingAuthorizationException - if FacebookTemplate was not created with an access token.

searchHomeFeed

java.util.List<Post> searchHomeFeed(java.lang.String query,
                                    int offset,
                                    int limit)
Searches the authenticated user's home feed.

Parameters:
query - the search query (e.g., "Dr Seuss")
offset - the offset into the feed to start retrieving posts.
limit - the maximum number of posts to return.
Returns:
a list of Posts that match the search query
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.
org.springframework.social.MissingAuthorizationException - if FacebookTemplate was not created with an access token.

searchUserFeed

java.util.List<Post> searchUserFeed(java.lang.String query)
Searches the authenticated user's feed. Returns up to 25 posts that match the query.

Parameters:
query - the search query (e.g., "football")
Returns:
a list of Posts that match the search query
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.
org.springframework.social.MissingAuthorizationException - if FacebookTemplate was not created with an access token.

searchUserFeed

java.util.List<Post> searchUserFeed(java.lang.String query,
                                    int offset,
                                    int limit)
Searches the authenticated user's feed.

Parameters:
query - the search query (e.g., "football")
offset - the offset into the feed to start retrieving posts.
limit - the maximum number of posts to return.
Returns:
a list of Posts that match the search query
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.
org.springframework.social.MissingAuthorizationException - if FacebookTemplate was not created with an access token.

searchUserFeed

java.util.List<Post> searchUserFeed(java.lang.String userId,
                                    java.lang.String query)
Searches a specified user's feed. Returns up to 25 posts that match the query.

Parameters:
userId - the ID of the user whose feed is to be searched
query - the search query (e.g., "football")
Returns:
a list of Posts that match the search query
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.
org.springframework.social.MissingAuthorizationException - if FacebookTemplate was not created with an access token.

searchUserFeed

java.util.List<Post> searchUserFeed(java.lang.String userId,
                                    java.lang.String query,
                                    int offset,
                                    int limit)
Searches a specified user's feed.

Parameters:
userId - the ID of the user whose feed is to be searched
query - the search query (e.g., "football")
offset - the offset into the feed to start retrieving posts.
limit - the maximum number of posts to return.
Returns:
a list of Posts that match the search query
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.
org.springframework.social.MissingAuthorizationException - if FacebookTemplate was not created with an access token.

Spring Social Facebook