org.springframework.social.facebook.api
Interface GroupOperations


public interface GroupOperations

Defines operations for retrieving data about groups and group members.


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

Method Detail

getGroup

Group getGroup(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(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(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

PagedList<GroupMemberReference> getMembers(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

PagedList<FacebookProfile> getMemberProfiles(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

PagedList<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

PagedList<GroupMembership> getMemberships(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

PagedList<Group> search(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

@Deprecated
PagedList<Group> search(String query,
                                   int offset,
                                   int limit)
Deprecated. Use search(String, PagingParameters) instead.

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.

search

PagedList<Group> search(String query,
                        PagingParameters pagedListParameters)
Search for groups.

Parameters:
query - the search query (e.g., "Spring User Group")
pagedListParameters - the parameters defining the bounds of the list 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.