Class GroupService

java.lang.Object
com.bitheads.braincloud.services.GroupService

public class GroupService
extends Object
Created by bradleyh on 5/6/2016.
  • Constructor Details

  • Method Details

    • acceptGroupInvitation

      public void acceptGroupInvitation​(String groupId, IServerCallback callback)
      Accept an outstanding invitation to join the group. Service Name - group Service Operation - ACCEPT_GROUP_INVITATION
      Parameters:
      groupId - ID of the group.
      callback - The method to be invoked when the server response is received
    • addGroupMember

      public void addGroupMember​(String groupId, String profileId, GroupService.Role role, String jsonAttributes, IServerCallback callback)
      Add a member to the group. Service Name - group Service Operation - ADD_GROUP_MEMBER
      Parameters:
      groupId - ID of the group.
      profileId - Profile ID of the member being added.
      role - Role of the member being added.
      jsonAttributes - Attributes of the member being added.
      callback - The method to be invoked when the server response is received
    • approveGroupJoinRequest

      public void approveGroupJoinRequest​(String groupId, String profileId, GroupService.Role role, String jsonAttributes, IServerCallback callback)
      Approve an outstanding request to join the group. Service Name - group Service Operation - APPROVE_GROUP_JOIN_REQUEST
      Parameters:
      groupId - ID of the group.
      profileId - Profile ID of the invitation being deleted.
      role - Role of the member being invited.
      jsonAttributes - Attributes of the member being invited.
      callback - The method to be invoked when the server response is received
    • autoJoinGroup

      public void autoJoinGroup​(String groupType, GroupService.AutoJoinStrategy autoJoinStrategy, String dataQueryJson, IServerCallback callback)
      Automatically join an open group that matches the search criteria and has space available. Service Name - group Service Operation - AUTO_JOIN_GROUP
      Parameters:
      groupType - Name of the associated group type.
      autoJoinStrategy - Selection strategy to employ when there are multiple matches
      dataQueryJson - Query parameters (optional)
      callback - The method to be invoked when the server response is received
    • autoJoinGroupMulti

      public void autoJoinGroupMulti​(String[] groupTypes, GroupService.AutoJoinStrategy autoJoinStrategy, String where, IServerCallback callback)
      Find and join an open group in the pool of groups in multiple group types provided as input arguments. * Service Name - group Service Operation - AUTO_JOIN_GROUP_MULTI
      Parameters:
      groupTypes - Name of the associated group type.
      autoJoinStrategy - Selection strategy to employ when there are multiple matches
      where - Query parameters (optional)
      callback - The method to be invoked when the server response is received
    • cancelGroupInvitation

      public void cancelGroupInvitation​(String groupId, String profileId, IServerCallback callback)
      Cancel an outstanding invitation to the group. Service Name - group Service Operation - CANCEL_GROUP_INVITATION
      Parameters:
      groupId - ID of the group.
      profileId - Profile ID of the invitation being deleted.
      callback - The method to be invoked when the server response is received
    • createGroup

      public void createGroup​(String name, String groupType, boolean isOpenGroup, GroupACL acl, String jsonData, String jsonOwnerAttributes, String jsonDefaultMemberAttributes, IServerCallback callback)
      Create a group. Service Name - group Service Operation - CREATE_GROUP
      Parameters:
      name - Name of the group.
      groupType - Name of the type of group.
      isOpenGroup - true if group is open; false if closed.
      acl - The group's access control list. A null ACL implies default.
      jsonOwnerAttributes - Attributes for the group owner (current player).
      jsonDefaultMemberAttributes - Default attributes for group members.
      jsonData - Custom application data.
      callback - The method to be invoked when the server response is received
    • createGroupWithSummaryData

      public void createGroupWithSummaryData​(String name, String groupType, boolean isOpenGroup, GroupACL acl, String jsonData, String jsonOwnerAttributes, String jsonDefaultMemberAttributes, String summaryData, IServerCallback callback)
      Create a group with summaryData. Service Name - group Service Operation - CREATE_GROUP
      Parameters:
      name - Name of the group.
      groupType - Name of the type of group.
      isOpenGroup - true if group is open; false if closed.
      acl - The group's access control list. A null ACL implies default.
      jsonOwnerAttributes - Attributes for the group owner (current player).
      jsonDefaultMemberAttributes - Default attributes for group members.
      jsonData - Custom application data.
      summaryData - summary
      callback - The method to be invoked when the server response is received
    • createGroupEntity

      public void createGroupEntity​(String groupId, String entityType, boolean isOwnedByGroupMember, GroupACL acl, String jsonData, IServerCallback callback)
      Create a group entity. Service Name - group Service Operation - CREATE_GROUP_ENTITY
      Parameters:
      groupId - ID of the group.
      isOwnedByGroupMember - true if entity is owned by a member; false if owned by the entire group.
      entityType - Type of the group entity.
      acl - Access control list for the group entity.
      jsonData - Custom application data.
      callback - The method to be invoked when the server response is received
    • deleteGroup

      public void deleteGroup​(String groupId, long version, IServerCallback callback)
      Delete a group. Service Name - group Service Operation - DELETE_GROUP
      Parameters:
      groupId - ID of the group.
      version - Current version of the group
      callback - The method to be invoked when the server response is received
    • deleteGroupEntity

      public void deleteGroupEntity​(String groupId, String entityId, long version, IServerCallback callback)
      Delete a group entity. Service Name - group Service Operation - DELETE_GROUP_ENTITY
      Parameters:
      groupId - ID of the group.
      entityId - ID of the entity.
      version - The current version of the group entity (for concurrency checking).
      callback - The method to be invoked when the server response is received
    • getMyGroups

      public void getMyGroups​(IServerCallback callback)
      Read information on groups to which the current player belongs. Service Name - group Service Operation - GET_MY_GROUPS
      Parameters:
      callback - The method to be invoked when the server response is received
    • incrementGroupData

      public void incrementGroupData​(String groupId, String jsonData, IServerCallback callback)
      Increment elements for the group's data field. Service Name - group Service Operation - INCREMENT_GROUP_DATA
      Parameters:
      groupId - ID of the group.
      jsonData - Partial data map with incremental values.
      callback - The method to be invoked when the server response is received
    • incrementGroupEntityData

      public void incrementGroupEntityData​(String groupId, String entityId, String jsonData, IServerCallback callback)
      Increment elements for the group entity's data field. Service Name - group Service Operation - INCREMENT_GROUP_ENTITY_DATA
      Parameters:
      groupId - ID of the group.
      entityId - ID of the entity.
      jsonData - Partial data map with incremental values.
      callback - The method to be invoked when the server response is received
    • inviteGroupMember

      public void inviteGroupMember​(String groupId, String profileId, GroupService.Role role, String jsonAttributes, IServerCallback callback)
      Invite a member to the group. Service Name - group Service Operation - INVITE_GROUP_MEMBER
      Parameters:
      groupId - ID of the group.
      profileId - Profile ID of the member being invited.
      role - Role of the member being invited.
      jsonAttributes - Attributes of the member being invited.
      callback - The method to be invoked when the server response is received
    • joinGroup

      public void joinGroup​(String groupId, IServerCallback callback)
      Join an open group or request to join a closed group. Service Name - group Service Operation - JOIN_GROUP
      Parameters:
      groupId - ID of the group.
      callback - The method to be invoked when the server response is received
    • leaveGroup

      public void leaveGroup​(String groupId, IServerCallback callback)
      Leave a group in which the player is a member. Service Name - group Service Operation - LEAVE_GROUP
      Parameters:
      groupId - ID of the group.
      callback - The method to be invoked when the server response is received
    • listGroupsPage

      public void listGroupsPage​(String jsonContext, IServerCallback callback)
      Read a page of group information. Service Name - group Service Operation - LIST_GROUPS_PAGE
      Parameters:
      jsonContext - Query context.
      callback - The method to be invoked when the server response is received
    • listGroupsPageByOffset

      public void listGroupsPageByOffset​(String encodedContext, int pageOffset, IServerCallback callback)
      Read a page of group information. Service Name - group Service Operation - LIST_GROUPS_PAGE_BY_OFFSET
      Parameters:
      encodedContext - Encoded reference query context.
      pageOffset - Number of pages by which to offset the query.
      callback - The method to be invoked when the server response is received
    • listGroupsWithMember

      public void listGroupsWithMember​(String profileId, IServerCallback callback)
      Read information on groups to which the specified player belongs. Access is subject to restrictions. Service Name - group Service Operation - LIST_GROUPS_WITH_MEMBER
      Parameters:
      profileId - ID of the user to search for
      callback - The method to be invoked when the server response is received
    • readGroup

      public void readGroup​(String groupId, IServerCallback callback)
      Read the specified group. Service Name - group Service Operation - READ_GROUP
      Parameters:
      groupId - ID of the group.
      callback - The method to be invoked when the server response is received
    • readGroupEntitiesPage

      public void readGroupEntitiesPage​(String jsonContext, IServerCallback callback)
      Read a page of group entity information. Service Name - group Service Operation - READ_GROUP_ENTITIES_PAGE
      Parameters:
      jsonContext - Query context.
      callback - The method to be invoked when the server response is received
    • readGroupEntitiesPageByOffset

      public void readGroupEntitiesPageByOffset​(String encodedContext, int pageOffset, IServerCallback callback)
      Read a page of group entity information. Service Name - group Service Operation - READ_GROUP_ENTITIES_PAGE_BY_OFFSET
      Parameters:
      encodedContext - Encoded reference query context.
      pageOffset - Number of pages by which to offset the query.
      callback - The method to be invoked when the server response is received
    • readGroupData

      public void readGroupData​(String groupId, IServerCallback callback)
      Read the data of the specified group. Service Name - group Service Operation - READ_GROUP_DATA
      Parameters:
      groupId - ID of the group.
      callback - The method to be invoked when the server response is received
    • readGroupEntity

      public void readGroupEntity​(String groupId, String entityId, IServerCallback callback)
      Read the specified group entity. Service Name - group Service Operation - READ_GROUP_ENTITY
      Parameters:
      groupId - ID of the group.
      entityId - ID of the entity.
      callback - The method to be invoked when the server response is received
    • readGroupMembers

      public void readGroupMembers​(String groupId, IServerCallback callback)
      Read the members of the group. Service Name - group Service Operation - READ_MEMBERS_OF_GROUP
      Parameters:
      groupId - ID of the group.
      callback - The method to be invoked when the server response is received
    • rejectGroupInvitation

      public void rejectGroupInvitation​(String groupId, IServerCallback callback)
      Reject an outstanding invitation to join the group. Service Name - group Service Operation - REJECT_GROUP_INVITATION
      Parameters:
      groupId - ID of the group.
      callback - The method to be invoked when the server response is received
    • rejectGroupJoinRequest

      public void rejectGroupJoinRequest​(String groupId, String profileId, IServerCallback callback)
      Reject an outstanding request to join the group. Service Name - group Service Operation - REJECT_GROUP_JOIN_REQUEST
      Parameters:
      groupId - ID of the group.
      profileId - Profile ID of the invitation being deleted.
      callback - The method to be invoked when the server response is received
    • removeGroupMember

      public void removeGroupMember​(String groupId, String profileId, IServerCallback callback)
      Remove a member from the group. Service Name - group Service Operation - REMOVE_GROUP_MEMBER
      Parameters:
      groupId - ID of the group.
      profileId - Profile ID of the member being deleted.
      callback - The method to be invoked when the server response is received
    • setGroupOpen

      public void setGroupOpen​(String groupId, boolean isOpenGroup, IServerCallback callback)
      Set whether a group is open (true) or closed (false). Service Name - group Service Operation - SET_GROUP_OPEN
      Parameters:
      groupId - ID of the group.
      isOpenGroup - true if group is open; false if closed
      callback - The method to be invoked when the server response is received
    • updateGroupData

      public void updateGroupData​(String groupId, long version, String jsonData, IServerCallback callback)
      Updates a group's data. Service Name - group Service Operation - UPDATE_GROUP_DATA
      Parameters:
      groupId - ID of the group.
      version - Version to verify.
      jsonData - Data to apply.
      callback - The method to be invoked when the server response is received
    • updateGroupEntityData

      public void updateGroupEntityData​(String groupId, String entityId, long version, String jsonData, IServerCallback callback)
      Update a group entity. Service Name - group Service Operation - UPDATE_GROUP_ENTITY_DATA
      Parameters:
      groupId - ID of the group.
      entityId - ID of the entity.
      version - The current version of the group entity (for concurrency checking).
      jsonData - Custom application data.
      callback - The method to be invoked when the server response is received
    • updateGroupMember

      public void updateGroupMember​(String groupId, String profileId, GroupService.Role role, String jsonAttributes, IServerCallback callback)
      Update a member of the group. Service Name - group Service Operation - UPDATE_GROUP_MEMBER
      Parameters:
      groupId - ID of the group.
      profileId - Profile ID of the member being updated.
      role - Role of the member being updated (optional).
      jsonAttributes - Attributes of the member being updated (optional).
      callback - The method to be invoked when the server response is received
    • updateGroupName

      public void updateGroupName​(String groupId, String name, IServerCallback callback)
      Updates a group's name. Service Name - group Service Operation - UPDATE_GROUP_NAME
      Parameters:
      groupId - ID of the group.
      name - Name to apply.
      callback - The method to be invoked when the server response is received
    • updateGroupSummaryData

      public void updateGroupSummaryData​(String groupId, int version, String jsonSummaryData, IServerCallback callback)
      Updates a group's summaryData Service Name - group Service Operation - UPDATE_GROUP_SUMMARY_DATA
      Parameters:
      groupId - ID of the group.
      version - version of the group
      jsonSummaryData - summary
      callback - The method to be invoked when the server response is received
    • getRandomGroupsMatching

      public void getRandomGroupsMatching​(String jsonWhere, int maxReturn, IServerCallback callback)
      Gets a list of up to maxReturn randomly selected groups from the server based on the where condition Service Name - group Service Operation - GET_RANDOM_GROUPS_MATCHING
      Parameters:
      jsonWhere - ID of the group.
      maxReturn - max num groups to search
      callback - The method to be invoked when the server response is received