Spring Social Facebook

org.springframework.social.facebook.api
Interface FriendOperations


public interface FriendOperations

Defines operations for interacting with a user's friends and friend lists.

Author:
Craig Walls

Method Summary
 void addToFriendList(java.lang.String friendListId, java.lang.String friendId)
          Adds a friend to a friend list.
 java.lang.String createFriendList(java.lang.String name)
          Creates a new friend list for the authenticated user.
 java.lang.String createFriendList(java.lang.String userId, java.lang.String name)
          Creates a new friend list.
 void deleteFriendList(java.lang.String friendListId)
          Deletes a friend list.
 java.util.List<java.lang.String> getFriendIds()
          Retrieves a list of the authenticating user's friends' IDs.
 java.util.List<java.lang.String> getFriendIds(java.lang.String userId)
          Retrieves a list of the authenticating user's friends' IDs.
 Reference getFriendList(java.lang.String friendListId)
          Retrieves a reference to the specified friend list.
 java.util.List<Reference> getFriendListMembers(java.lang.String friendListId)
          Retrieves references for all users who are members of the specified friend list.
 java.util.List<Reference> getFriendLists()
          Retrieves a list of custom friend lists belonging to the authenticated user.
 java.util.List<Reference> getFriendLists(java.lang.String userId)
          Retrieves a list of custom friend lists belonging to the specified user.
 java.util.List<FacebookProfile> getFriendProfiles()
          Retrieves profile data for up to 100 of the authenticated user's friends.
 java.util.List<FacebookProfile> getFriendProfiles(int offset, int limit)
          Retrieves profile data for the authenticated user's friends.
 java.util.List<FacebookProfile> getFriendProfiles(java.lang.String userId)
          Retrieves profile data for up to 100 of the specified user's friends.
 java.util.List<FacebookProfile> getFriendProfiles(java.lang.String userId, int offset, int limit)
          Retrieves profile data for the specified user's friends.
 java.util.List<Reference> getFriends()
          Retrieves a list of user references for the authenticated user's friends.
 java.util.List<Reference> getFriends(java.lang.String userId)
          Retrieves a list of user references for the specified user's friends.
 void removeFromFriendList(java.lang.String friendListId, java.lang.String friendId)
          Removes a friend from a friend list.
 

Method Detail

getFriendLists

java.util.List<Reference> getFriendLists()
Retrieves a list of custom friend lists belonging to the authenticated user. Requires "read_friendlists" permission.

Returns:
a list References, each representing a friends list for the user, or an empty list if not available.
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_friendlists" permission.
org.springframework.social.MissingAuthorizationException - if FacebookTemplate was not created with an access token.

getFriendLists

java.util.List<Reference> getFriendLists(java.lang.String userId)
Retrieves a list of custom friend lists belonging to the specified user. Requires "read_friendlists" permission.

Parameters:
userId - the user's ID
Returns:
a list References, each representing a friends list for the user, or an empty list if not available.
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_friendlists" permission.
org.springframework.social.MissingAuthorizationException - if FacebookTemplate was not created with an access token.

getFriendList

Reference getFriendList(java.lang.String friendListId)
Retrieves a reference to the specified friend list.

Parameters:
friendListId - the friend list ID.
Returns:
a Reference to the requested friend list.
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.

getFriendListMembers

java.util.List<Reference> getFriendListMembers(java.lang.String friendListId)
Retrieves references for all users who are members of the specified friend list.

Parameters:
friendListId - the friend list ID.
Returns:
a list of Reference, each representing a member of the friend list.
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.

createFriendList

java.lang.String createFriendList(java.lang.String name)
Creates a new friend list for the authenticated user. Requires "manage_friendlists" permission.

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

createFriendList

java.lang.String createFriendList(java.lang.String userId,
                                  java.lang.String name)
Creates a new friend list. Requires "manage_friendlists" permission.

Parameters:
userId - the user ID to create the friend list for.
name - the name of the friend list.
Returns:
the ID of the newly created friend list.
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.
org.springframework.social.InsufficientPermissionException - if the user has not granted "manage_friendlists" permission.
org.springframework.social.MissingAuthorizationException - if FacebookTemplate was not created with an access token.

deleteFriendList

void deleteFriendList(java.lang.String friendListId)
Deletes a friend list. Requires "manage_friendlists" permission.

Parameters:
friendListId - the ID of the friend list to remove.
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.
org.springframework.social.InsufficientPermissionException - if the user has not granted "manage_friendlists" permission.
org.springframework.social.MissingAuthorizationException - if FacebookTemplate was not created with an access token.

addToFriendList

void addToFriendList(java.lang.String friendListId,
                     java.lang.String friendId)
Adds a friend to a friend list. Requires "manage_friendlists" permission.

Parameters:
friendListId - the friend list ID
friendId - The ID of the user to add to the list. The user must be a friend of the list's owner.
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.
org.springframework.social.InsufficientPermissionException - if the user has not granted "manage_friendlists" permission.
org.springframework.social.MissingAuthorizationException - if FacebookTemplate was not created with an access token.

removeFromFriendList

void removeFromFriendList(java.lang.String friendListId,
                          java.lang.String friendId)
Removes a friend from a friend list. Requires "manage_friendlists" permission.

Parameters:
friendListId - the friend list ID
friendId - The ID of the user to add to the list.
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.
org.springframework.social.InsufficientPermissionException - if the user has not granted "manage_friendlists" permission.
org.springframework.social.MissingAuthorizationException - if FacebookTemplate was not created with an access token.

getFriends

java.util.List<Reference> getFriends()
Retrieves a list of user references for the authenticated user's friends.

Returns:
a list References, each representing a friend of the user, or an empty list if not available.
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.

getFriendIds

java.util.List<java.lang.String> getFriendIds()
Retrieves a list of the authenticating user's friends' IDs.

Returns:
a list of Strings, where each entry is the ID of one of the user's friends.
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.

getFriendProfiles

java.util.List<FacebookProfile> getFriendProfiles()
Retrieves profile data for up to 100 of the authenticated user's friends. For additional friend profiles, you must specify the offset and limit. The list of profiles is ordered by each user's Facebook ID.

Returns:
a list FacebookProfiles, each representing a friend of the user, or an empty list if not available.
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.

getFriendProfiles

java.util.List<FacebookProfile> getFriendProfiles(int offset,
                                                  int limit)
Retrieves profile data for the authenticated user's friends. The list of profiles is ordered by each user's Facebook ID.

Parameters:
offset - the offset into the friends list to start retrieving profiles.
limit - the maximum number of profiles to return.
Returns:
a list FacebookProfiles, each representing a friend of the user, or an empty list if not available.
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.

getFriends

java.util.List<Reference> getFriends(java.lang.String userId)
Retrieves a list of user references for the specified user's friends. The list of profiles is ordered by each user's Facebook ID.

Parameters:
userId - the user's ID
Returns:
a list References, each representing a friend of the user, or an empty list if not available.
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.

getFriendIds

java.util.List<java.lang.String> getFriendIds(java.lang.String userId)
Retrieves a list of the authenticating user's friends' IDs. The list of profiles is ordered by each user's Facebook ID.

Parameters:
userId - the user's ID
Returns:
a list of Strings, where each entry is the ID of one of the user's friends.
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.

getFriendProfiles

java.util.List<FacebookProfile> getFriendProfiles(java.lang.String userId)
Retrieves profile data for up to 100 of the specified user's friends. The list of profiles is ordered by each user's Facebook ID.

Parameters:
userId - the user's ID
Returns:
a list FacebookProfiles, each representing a friend of the user, or an empty list if not available.
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.

getFriendProfiles

java.util.List<FacebookProfile> getFriendProfiles(java.lang.String userId,
                                                  int offset,
                                                  int limit)
Retrieves profile data for the specified user's friends. The list of profiles is ordered by each user's Facebook ID.

Parameters:
userId - the user's ID
offset - the offset into the friends list to start retrieving profiles.
limit - the maximum number of profiles to return.
Returns:
a list FacebookProfiles, each representing a friend of the user, or an empty list if not available.
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