Spring Social Facebook

org.springframework.social.facebook.api
Interface LikeOperations


public interface LikeOperations

Defines operations for working with a user's likes and interests.

Author:
Craig Walls

Method Summary
 java.util.List<Page> getActivities()
          Retrieves a list of activities that the authenticated user likes.
 java.util.List<Page> getActivities(java.lang.String userId)
          Retrieves a list of activities that the given user likes.
 java.util.List<Page> getBooks()
          Retrieves a list of books that the authenticated user likes.
 java.util.List<Page> getBooks(java.lang.String userId)
          Retrieves a list of books that the given user has liked.
 java.util.List<Page> getInterests()
          Retrieves a list of interests that the authenticated user likes.
 java.util.List<Page> getInterests(java.lang.String userId)
          Retrieves a list of interests that the given user likes.
 java.util.List<Reference> getLikes(java.lang.String objectId)
          Retrieves a list of references to users who have liked the specified object.
 java.util.List<Page> getMovies()
          Retrieves a list of movies that the authenticated user likes.
 java.util.List<Page> getMovies(java.lang.String userId)
          Retrieves a list of movies that the given user has liked.
 java.util.List<Page> getMusic()
          Retrieves a list of music that the authenticated user likes.
 java.util.List<Page> getMusic(java.lang.String userId)
          Retrieves a list of music that the given user has liked.
 java.util.List<Page> getPagesLiked()
          Retrieves a list of pages that the authenticated user has liked.
 java.util.List<Page> getPagesLiked(java.lang.String userId)
          Retrieves a list of pages that the given user has liked.
 java.util.List<Page> getTelevision()
          Retrieves a list of television shows that the authenticated user likes.
 java.util.List<Page> getTelevision(java.lang.String userId)
          Retrieves a list of television shows that the given user has liked.
 void like(java.lang.String objectId)
          Like an object on behalf of the authenticated user.
 void unlike(java.lang.String objectId)
          Unlike an object on behalf of the authenticated user.
 

Method Detail

getLikes

java.util.List<Reference> getLikes(java.lang.String objectId)
Retrieves a list of references to users who have liked the specified object.

Parameters:
objectId - the object ID (an Album, Checkin, Comment, Note, Photo, Post, or Video).
Returns:
a list of Reference objects for the users who have liked the object.
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.

getPagesLiked

java.util.List<Page> getPagesLiked()
Retrieves a list of pages that the authenticated user has liked. Requires "user_likes" permission. Returns an empty list if permission isn't granted.

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

getPagesLiked

java.util.List<Page> getPagesLiked(java.lang.String userId)
Retrieves a list of pages that the given user has liked. Requires "user_likes" permission for the authenticated user and "friends_likes" for the authenticated user's friends. Returns an empty list if permission isn't granted.

Parameters:
userId - the ID of the user
Returns:
a list of Page objects
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.
org.springframework.social.InsufficientPermissionException - if the user has not granted "user_likes" or "friends_likes" permission.
org.springframework.social.MissingAuthorizationException - if FacebookTemplate was not created with an access token.

like

void like(java.lang.String objectId)
Like an object on behalf of the authenticated user. The type of object to be liked is limited to Album, Checkin, Comment, Note, Photo, Post, or Video. You cannot like a Facebook Page through this API. Requires "publish_stream" permission and permission to access the object being liked.

Parameters:
objectId - the object 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 or if the user does not have permission to access the object.
org.springframework.social.MissingAuthorizationException - if FacebookTemplate was not created with an access token.

unlike

void unlike(java.lang.String objectId)
Unlike an object on behalf of the authenticated user. The type of object to be liked is limited to Album, Checkin, Comment, Note, Photo, Post, or Video. You cannot unlike a Facebook Page through this API. Requires "publish_stream" permission and permission to access the object being liked.

Parameters:
objectId - the object 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 or if the user does not have permission to access the object.
org.springframework.social.MissingAuthorizationException - if FacebookTemplate was not created with an access token.

getBooks

java.util.List<Page> getBooks()
Retrieves a list of books that the authenticated user likes. Requires "user_likes" permission. Returns an empty list if permission isn't granted.

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

getBooks

java.util.List<Page> getBooks(java.lang.String userId)
Retrieves a list of books that the given user has liked. Requires "user_likes" permission for the authenticated user and "friends_likes" for the authenticated user's friends. Returns an empty list if permission isn't granted.

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

getMovies

java.util.List<Page> getMovies()
Retrieves a list of movies that the authenticated user likes. Requires "user_likes" permission. Returns an empty list if permission isn't granted.

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

getMovies

java.util.List<Page> getMovies(java.lang.String userId)
Retrieves a list of movies that the given user has liked. Requires "user_likes" permission for the authenticated user and "friends_likes" for the authenticated user's friends. Returns an empty list if permission isn't granted.

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

getMusic

java.util.List<Page> getMusic()
Retrieves a list of music that the authenticated user likes. Requires "user_likes" permission. Returns an empty list if permission isn't granted.

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

getMusic

java.util.List<Page> getMusic(java.lang.String userId)
Retrieves a list of music that the given user has liked. Requires "user_likes" permission for the authenticated user and "friends_likes" for the authenticated user's friends. Returns an empty list if permission isn't granted.

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

getTelevision

java.util.List<Page> getTelevision()
Retrieves a list of television shows that the authenticated user likes. Requires "user_likes" permission. Returns an empty list if permission isn't granted.

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

getTelevision

java.util.List<Page> getTelevision(java.lang.String userId)
Retrieves a list of television shows that the given user has liked. Requires "user_likes" permission for the authenticated user and "friends_likes" for the authenticated user's friends. Returns an empty list if permission isn't granted.

Parameters:
userId - the ID of the user
Returns:
a list of Page objects
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.
org.springframework.social.InsufficientPermissionException - if the user has not granted "user_likes" or "friends_likes" permission.
org.springframework.social.MissingAuthorizationException - if FacebookTemplate was not created with an access token.

getActivities

java.util.List<Page> getActivities()
Retrieves a list of activities that the authenticated user likes. Requires "user_activities" permission. Returns an empty list if permission isn't granted.

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

getActivities

java.util.List<Page> getActivities(java.lang.String userId)
Retrieves a list of activities that the given user likes. Requires "user_activities" permission for the authenticated user and "friends_activities" for the authenticated user's friends. Returns an empty list if permission isn't granted.

Parameters:
userId - the ID of the user
Returns:
a list of Page objects
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.
org.springframework.social.InsufficientPermissionException - if the user has not granted "user_activities" or "friends_activities" permission.
org.springframework.social.MissingAuthorizationException - if FacebookTemplate was not created with an access token.

getInterests

java.util.List<Page> getInterests()
Retrieves a list of interests that the authenticated user likes. Requires "user_interests" permission. Returns an empty list if permission isn't granted.

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

getInterests

java.util.List<Page> getInterests(java.lang.String userId)
Retrieves a list of interests that the given user likes. Requires "user_interests" permission for the authenticated user and "friends_interests" for the authenticated user's friends. Returns an empty list if permission isn't granted.

Parameters:
userId - the ID of the user
Returns:
a list of Page objects
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.
org.springframework.social.InsufficientPermissionException - if the user has not granted "user_interests" or "friends_interests" permission.
org.springframework.social.MissingAuthorizationException - if FacebookTemplate was not created with an access token.

Spring Social Facebook