Spring Social Facebook

org.springframework.social.facebook.api
Interface GroupOperations


public interface GroupOperations

Defines operations for retrieving data about groups and group members.

Author:
Craig Walls

Method Summary
 Group getGroup(java.lang.String groupId)
          Retrieve data for a specified group.
 byte[] getGroupImage(java.lang.String groupId)
          Retrieves a group's image as an array of bytes.
 byte[] getGroupImage(java.lang.String groupId, ImageType imageType)
          Retrieves a group's image as an array of bytes.
 java.util.List<FacebookProfile> getMemberProfiles(java.lang.String groupId)
          Retrieves the profiles for the members of the specified group.
 java.util.List<GroupMemberReference> getMembers(java.lang.String groupId)
          Retrieves the members of the specified group.
 java.util.List<GroupMembership> getMemberships()
          Retrieves a list of group memberships for the authenticated user.
 java.util.List<GroupMembership> getMemberships(java.lang.String userId)
          Retrieves a list of group memberships for a specific user.
 java.util.List<Group> search(java.lang.String query)
          Search for groups.
 java.util.List<Group> search(java.lang.String query, int offset, int limit)
          Search for groups.
 

Method Detail

getGroup

Group getGroup(java.lang.String groupId)
Retrieve data for a specified group.

Parameters:
groupId - the ID of the group
Returns:
a Group object
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.

getGroupImage

byte[] getGroupImage(java.lang.String groupId)
Retrieves a group's image as an array of bytes. Returns the image in Facebook's "normal" type.

Parameters:
groupId - the group ID
Returns:
an array of bytes containing the group's image.
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.

getGroupImage

byte[] getGroupImage(java.lang.String groupId,
                     ImageType imageType)
Retrieves a group's image as an array of bytes.

Parameters:
groupId - the group ID
imageType - the image type (eg., small, normal, large. square)
Returns:
an array of bytes containing the group's image.
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.

getMembers

java.util.List<GroupMemberReference> getMembers(java.lang.String groupId)
Retrieves the members of the specified group.

Parameters:
groupId - the ID of the group
Returns:
a list of References, one for each member of the group.
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.

getMemberProfiles

java.util.List<FacebookProfile> getMemberProfiles(java.lang.String groupId)
Retrieves the profiles for the members of the specified group.

Parameters:
groupId - the ID of the group
Returns:
a list of FacebookProfiles, one for each member of the group.
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.

getMemberships

java.util.List<GroupMembership> getMemberships()
Retrieves a list of group memberships for the authenticated user. Requires "user_groups" permission.

Returns:
a list of GroupMemberships, one for each group the user is a member of.
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.
org.springframework.social.InsufficientPermissionException - if the user has not granted "user_groups" permission.

getMemberships

java.util.List<GroupMembership> getMemberships(java.lang.String userId)
Retrieves a list of group memberships for a specific user. Requires "user_groups" or "friends_groups" permission.

Parameters:
userId - the user ID to retrieve memberships for.
Returns:
a list of GroupMemberships, one for each group the user is a member of.
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.
org.springframework.social.InsufficientPermissionException - if the user has not granted "user_groups" or "friends_groups" permission.

search

java.util.List<Group> search(java.lang.String query)
Search for groups. Returns up to 25 groups matching the query.

Parameters:
query - the search query (e.g., "Spring User Group")
Returns:
a list of Groups matching the search query
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.

search

java.util.List<Group> search(java.lang.String query,
                             int offset,
                             int limit)
Search for groups.

Parameters:
query - the search query (e.g., "Spring User Group")
offset - the offset into the matching groups list
limit - the maximum number of groups to return
Returns:
a list of Groups matching the search query
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.

Spring Social Facebook