Class Communities


  • public final class Communities
    extends java.lang.Object
    • Method Detail

      • search

        public static void search​(PagingQuery<SearchQuery> query,
                                  Callback<SearchResult> success,
                                  FailureCallback failure)
        Search topics, groups, users, activities, tags and labels by matching query. Returns a list of each of those entities with a cursor for a next query. If cursor is empty string, or PagingResult.isLastPage() is true, this is a last page.
        Parameters:
        query - Tags query and pagination details.
        success - Called with list of topics and a cursor for a next query.
        failure - Called with an error.
      • addFriends

        public static void addFriends​(UserIdList userIds,
                                      Callback<java.lang.Integer> callback,
                                      FailureCallback failure)
        Add users to a friend list, if operation succeed - user become friends with everyone in the list. If some or all users are already in the friends list, they will be ignored.
        Parameters:
        userIds - Users identifiers you want to become friend with.
        callback - Callback with updated number of friends.
        failure - Callback with an error.
      • removeFriends

        public static void removeFriends​(UserIdList userIds,
                                         Callback<java.lang.Integer> callback,
                                         FailureCallback failure)
        Remove users from a friends list. If some or all users are not in the friends list, they will be ignored.
        Parameters:
        userIds - Users identifiers you don't want to be friends anymore.
        callback - Callback with updated number of friends.
        failure - Callback with an error.
      • setFriends

        public static void setFriends​(UserIdList userIds,
                                      Callback<java.lang.Integer> callback,
                                      FailureCallback failure)
        Replace existing friends with the provided list of users.
        Parameters:
        userIds - List of GetSocial user identifiers.
        callback - A callback to indicate if this operation was successful.
        failure - Called if operation fails.
      • isFriend

        public static void isFriend​(UserId userId,
                                    Callback<java.lang.Boolean> success,
                                    FailureCallback failure)
        Check if user is your friend.
        Parameters:
        userId - Unique user identifier.
        success - Called with true, if user is your friend, false otherwise
        failure - Called if operation fails.
      • areFriends

        public static void areFriends​(UserIdList userIds,
                                      Callback<java.util.Map<java.lang.String,​java.lang.Boolean>> success,
                                      FailureCallback failure)
        Check if users are your friends.
        Parameters:
        userIds - Users identifiers.
        success - Called with a map of booleans, where key is user ID and value if boolean indicating is the user in a friends list or not.
        failure - Called in case of any error.
      • getFriendsCount

        public static void getFriendsCount​(FriendsQuery query,
                                           Callback<java.lang.Integer> callback,
                                           FailureCallback failure)
        Get count of friends.
        Parameters:
        query - Query.
        callback - Called with count of friends.
        failure - Called if operation failed.
      • getFriends

        public static void getFriends​(PagingQuery<FriendsQuery> query,
                                      Callback<PagingResult<User>> callback,
                                      FailureCallback failure)
        Get a list of friends for current user.
        Parameters:
        query - Pagination query.
        callback - Called with list of users that are friends of current user.
        failure - Called in case of any error.
      • getUser

        public static void getUser​(UserId singleUserId,
                                   Callback<User> success,
                                   FailureCallback failure)
        Get a single user by his identifier. Returns an error if user with this ID doesn't exist.
        Parameters:
        singleUserId - single user identifier.
        success - Called with a user object.
        failure - Called in case of any error.
      • getUsers

        public static void getUsers​(UserIdList identifiers,
                                    Callback<java.util.Map<java.lang.String,​User>> success,
                                    FailureCallback failure)
        Get users by their identifiers.
        Parameters:
        identifiers - Users identifiers.
        success - Called with a map of users, where key is user ID from identifiers and value - user object.
        failure - Called with an error.
      • getUsers

        public static void getUsers​(PagingQuery<UsersQuery> query,
                                    Callback<PagingResult<User>> success,
                                    FailureCallback failure)
        Get users matching query. Returns a list of users and a cursor for a next query. If cursor is empty string, or PagingResult.isLastPage() is true, this is a last page.
        Parameters:
        query - Users query and pagination details.
        success - Called with a list of results and a cursor for a next query.
        failure - Called with an error.
      • getUsersCount

        public static void getUsersCount​(UsersQuery query,
                                         Callback<java.lang.Integer> callback,
                                         FailureCallback failure)
        Get total count of users matching provided query.
        Parameters:
        query - Users query.
        callback - Called with a number of users matching the query.
        failure - Called with an error.
      • getActivities

        public static void getActivities​(PagingQuery<ActivitiesQuery> query,
                                         Callback<PagingResult<GetSocialActivity>> success,
                                         FailureCallback failureCallback)
        Get activities matching query. Returns a list of activities and a cursor for a next query. If cursor is empty string, or PagingResult.isLastPage() is true, this is a last page.
        Parameters:
        query - Activities query and pagination details.
        success - Called with list of activities and a cursor for a next query.
        failureCallback - Called with an error.
      • getAnnouncements

        public static void getAnnouncements​(AnnouncementsQuery query,
                                            Callback<java.util.List<GetSocialActivity>> success,
                                            FailureCallback failureCallback)
        Get announcements matching query. Returns a list of announcements.
        Parameters:
        query - Announcements query and pagination details.
        success - Called with list of announcements.
        failureCallback - Called with an error.
      • getActivity

        public static void getActivity​(java.lang.String id,
                                       Callback<GetSocialActivity> success,
                                       FailureCallback failureCallback)
        Get activity by ID. If activity doesn't exist, returns an error.
        Parameters:
        id - ID of activity.
        success - Called with activity object.
        failureCallback - Called with an error.
      • postActivity

        public static void postActivity​(ActivityContent content,
                                        PostActivityTarget target,
                                        Callback<GetSocialActivity> success,
                                        FailureCallback failureCallback)
        Post activity to a specific target.
        Parameters:
        content - Content of activity which should be posted.
        target - A target where activity should be posted.
        success - Called with activity object if it was posted successfully.
        failureCallback - Called with an error.
      • updateActivity

        public static void updateActivity​(java.lang.String activityId,
                                          ActivityContent content,
                                          Callback<GetSocialActivity> success,
                                          FailureCallback failureCallback)
        Update activity with a new content. Activity is entire replaced.
        Parameters:
        activityId - Id of activity to be updated.
        content - Content of activity which should be posted.
        success - Called with activity object if it was posted successfully.
        failureCallback - Called with an error.
      • addReaction

        public static void addReaction​(java.lang.String reaction,
                                       java.lang.String activityId,
                                       CompletionCallback success,
                                       FailureCallback failure)
        Add reaction to the activity, existing reactions will be kept.
        Parameters:
        reaction - Type of reaction.
        activityId - Id of activity you want to react to.
        success - Called if operation was successful.
        failure - Called with an error.
      • setReaction

        public static void setReaction​(java.lang.String reaction,
                                       java.lang.String activityId,
                                       CompletionCallback success,
                                       FailureCallback failure)
        Set reaction to the activity, existing reactions will be removed.
        Parameters:
        reaction - Type of reaction.
        activityId - Id of activity you want to react to.
        success - Called if operation was successful.
        failure - Called with an error.
      • removeReaction

        public static void removeReaction​(java.lang.String reaction,
                                          java.lang.String activityId,
                                          CompletionCallback success,
                                          FailureCallback failure)
        Remove reaction from the activity. If you haven't added this reaction to the activity, success is called.
        Parameters:
        reaction - Type of reaction.
        activityId - Id of activity you want to remove reaction from.
        success - Called if operation was successful.
        failure - Called with an error.
      • getReactions

        public static void getReactions​(PagingQuery<ReactionsQuery> query,
                                        Callback<PagingResult<UserReactions>> success,
                                        FailureCallback failure)
        Get reactions matching query. Returns a list of reactions and a cursor for a next query. If cursor is empty string, or PagingResult.isLastPage() is true, this is a last page.
        Parameters:
        query - Reactions query and pagination details.
        success - Called with list of reactions and a cursor for a next query.
        failure - Called with an error.
      • bookmark

        public static void bookmark​(java.lang.String activityId,
                                    CompletionCallback success,
                                    FailureCallback failure)
        Bookmark an activity.
        Parameters:
        activityId - Id of activity you want to bookmark.
        success - Called if operation was successful.
        failure - Called with an error.
      • removeBookmark

        public static void removeBookmark​(java.lang.String activityId,
                                          CompletionCallback success,
                                          FailureCallback failure)
        Remove bookmark from the activity. If you haven't bookmarked this activity, success is called.
        Parameters:
        activityId - Id of activity you want to remove bookmark from.
        success - Called if operation was successful.
        failure - Called with an error.
      • reportActivity

        public static void reportActivity​(java.lang.String activityId,
                                          ReportingReason reason,
                                          java.lang.String explanation,
                                          CompletionCallback success,
                                          FailureCallback failure)
        Report activity with a specified reason.
        Parameters:
        activityId - ID of activity.
        reason - Reason of reporting.
        explanation - Could be arbitrary string.
        success - Called if operation succeeded.
        failure - Called with an error.
      • removeActivities

        public static void removeActivities​(RemoveActivitiesQuery query,
                                            CompletionCallback success,
                                            FailureCallback failure)
        Remove all activities matching query.
        Parameters:
        query - Which activities should be removed.
        success - Called if operation succeeded.
        failure - Called with an error.
      • getTags

        public static void getTags​(PagingQuery<TagsQuery> query,
                                   Callback<PagingResult<Tag>> success,
                                   FailureCallback failure)
        Get tags matching query. Returns a list of tags and a cursor for a next query. If cursor is empty string, or PagingResult.isLastPage() is true, this is a last page.
        Parameters:
        query - Tags query and pagination details.
        success - Called with list of topics and a cursor for a next query.
        failure - Called with an error.
      • getTagsCount

        public static void getTagsCount​(TagsQuery query,
                                        Callback<java.lang.Integer> success,
                                        FailureCallback failure)
        Get total count of tags matching provided query.
        Parameters:
        query - tags query.
        success - Called with a number of topics matching the query.
        failure - Called with an error.
      • addVotes

        public static void addVotes​(java.util.Set<java.lang.String> pollOptionIds,
                                    java.lang.String activityId,
                                    CompletionCallback success,
                                    FailureCallback failure)
        Add votes to the activity, existing votes will be kept.
        Parameters:
        pollOptionIds - Poll option ids to vote for.
        activityId - Id of activity you want to react to.
        success - Called if operation was successful.
        failure - Called with an error.
      • setVotes

        public static void setVotes​(java.util.Set<java.lang.String> pollOptionIds,
                                    java.lang.String activityId,
                                    CompletionCallback success,
                                    FailureCallback failure)
        Set votes to the activity, existing votes will be removed.
        Parameters:
        pollOptionIds - Poll option ids to vote for.
        activityId - Id of activity you want to react to.
        success - Called if operation was successful.
        failure - Called with an error.
      • removeVotes

        public static void removeVotes​(java.util.Set<java.lang.String> pollOptionIds,
                                       java.lang.String activityId,
                                       CompletionCallback success,
                                       FailureCallback failure)
        Remove vote from the activity.
        Parameters:
        pollOptionIds - Poll option id to remove.
        activityId - Id of activity you want to remove reaction from.
        success - Called if operation was successful.
        failure - Called with an error.
      • getVotes

        public static void getVotes​(PagingQuery<VotesQuery> query,
                                    Callback<PagingResult<UserVotes>> success,
                                    FailureCallback failure)
        Get votes matching query. Returns a list of votes and a cursor for a next query. If cursor is empty string, or PagingResult.isLastPage() is true, this is a last page.
        Parameters:
        query - Votes query and pagination details.
        success - Called with list of votes and a cursor for a next query.
        failure - Called with an error.
      • getTopics

        public static void getTopics​(PagingQuery<TopicsQuery> query,
                                     Callback<PagingResult<Topic>> success,
                                     FailureCallback failure)
        Get topics matching query. Returns a list of topics and a cursor for a next query. If cursor is empty string, or PagingResult.isLastPage() is true, this is a last page.
        Parameters:
        query - Tags query and pagination details.
        success - Called with list of topics and a cursor for a next query.
        failure - Called with an error.
      • getTopic

        public static void getTopic​(java.lang.String id,
                                    Callback<Topic> success,
                                    FailureCallback failure)
        Get topic by ID. If topic with given ID doesn't exist, return an error.
        Parameters:
        id - ID of topic.
        success - Called with a topic for a given ID.
        failure - Called with an error.
      • getTopicsCount

        public static void getTopicsCount​(TopicsQuery query,
                                          Callback<java.lang.Integer> success,
                                          FailureCallback failure)
        Get total count of topics matching provided query.
        Parameters:
        query - Topics query.
        success - Called with a number of topics matching the query.
        failure - Called with an error.
      • follow

        public static void follow​(FollowQuery query,
                                  Callback<java.lang.Integer> success,
                                  FailureCallback failure)
        Follow users, topics, groups, hashtags or labels
        Parameters:
        query - Entities to be followed.
        success - Called with a total number of entities (from type set in FollowQuery) you follow after the call.
        failure - Called with an error.
      • unfollow

        public static void unfollow​(FollowQuery query,
                                    Callback<java.lang.Integer> success,
                                    FailureCallback failure)
        Unfollow users, topics, groups, hashtags or labels
        Parameters:
        query - Entities to be followed.
        success - Called with a total number of entities (from type set in FollowQuery) you follow after the call.
        failure - Called with an error.
      • isFollowing

        public static void isFollowing​(UserId userId,
                                       FollowQuery query,
                                       Callback<java.util.Map<java.lang.String,​java.lang.Boolean>> success,
                                       FailureCallback failure)
        Check if user with given ID is following a list of entities. Returns a map, where key is an id of entity. Value indicated if user follows the entity for that key.
        Parameters:
        userId - ID of user to check if he follows certain entities.
        query - List of entities to check.
        success - Called with a map of results.
        failure - Called with an error.
      • getFollowers

        public static void getFollowers​(PagingQuery<FollowersQuery> query,
                                        Callback<PagingResult<User>> success,
                                        FailureCallback failure)
        Get users who follow certain entity. Returns a list of followers and a cursor for a next query. If cursor is empty string, or PagingResult.isLastPage() is true, this is a last page.
        Parameters:
        query - Followers query and pagination details.
        success - Called with list of followers and a cursor for a next query.
        failure - Called with an error.
      • getFollowersCount

        public static void getFollowersCount​(FollowersQuery query,
                                             Callback<java.lang.Integer> success,
                                             FailureCallback failure)
        Get total count of users who follows certain entity.
        Parameters:
        query - Followers query.
        success - Called with a number of users who follows certain entity.
        failure - Called with an error.
      • createGroup

        public static void createGroup​(GroupContent groupContent,
                                       Callback<Group> success,
                                       FailureCallback failure)
        Create a new group.
        Parameters:
        groupContent - Group content.
        success - Called with created group.
        failure - Called with an error.
      • updateGroup

        public static void updateGroup​(java.lang.String groupId,
                                       GroupContent groupContent,
                                       Callback<Group> success,
                                       FailureCallback failure)
        Update an existing group.
        Parameters:
        groupId - Group id to update.
        groupContent - New group content.
        success - Called with updated group.
        failure - Called with an error.
      • removeGroups

        public static void removeGroups​(RemoveGroupsQuery query,
                                        CompletionCallback success,
                                        FailureCallback failure)
        Remove groups.
        Parameters:
        query - Group ids to delete.
        success - Called if groups are removed.
        failure - Called with an error.
      • getGroup

        public static void getGroup​(java.lang.String id,
                                    Callback<Group> success,
                                    FailureCallback failure)
        Get a single group.
        Parameters:
        id - Group id.
        success - Called if groups are removed.
        failure - Called with an error.
      • getGroupsCount

        public static void getGroupsCount​(GroupsQuery query,
                                          Callback<java.lang.Integer> success,
                                          FailureCallback failure)
        Get number of groups based on query parameters.
        Parameters:
        query - Query parameter.
        success - Called with number of groups.
        failure - Called with an error.
      • addGroupMembers

        public static void addGroupMembers​(AddGroupMembersQuery query,
                                           Callback<java.util.List<GroupMember>> success,
                                           FailureCallback failure)
        Add group members to a group.
        Parameters:
        query - Query parameter.
        success - Called with new group member.
        failure - Called with an error.
      • joinGroup

        public static void joinGroup​(JoinGroupQuery query,
                                     Callback<GroupMember> success,
                                     FailureCallback failure)
        Current user join to group.
        Parameters:
        query - Query parameter.
        success - Called with new group member.
        failure - Called with an error.
      • updateGroupMembers

        public static void updateGroupMembers​(UpdateGroupMembersQuery query,
                                              Callback<java.util.List<GroupMember>> success,
                                              FailureCallback failure)
        Update an existing group member.
        Parameters:
        query - Query parameter.
        success - Called with updated member.
        failure - Called with an error.
      • removeGroupMembers

        public static void removeGroupMembers​(RemoveGroupMembersQuery query,
                                              CompletionCallback success,
                                              FailureCallback failure)
        Remove users from a group.
        Parameters:
        query - Query parameter.
        success - Called if members removed.
        failure - Called with an error.
      • areGroupMembers

        public static void areGroupMembers​(java.lang.String groupId,
                                           UserIdList users,
                                           Callback<java.util.Map<java.lang.String,​Membership>> success,
                                           FailureCallback failure)
        Check if users are member of group.
        Parameters:
        groupId - Group id.
        users - User ids to check.
        success - Called with member statuses.
        failure - Called with an error.
      • blockUsers

        public static void blockUsers​(UserIdList userIds,
                                      CompletionCallback success,
                                      FailureCallback failure)
        Block users.
        Parameters:
        userIds - Users to be blocked
        success - Called if users were blocked.
        failure - Called with an error.
      • unblockUsers

        public static void unblockUsers​(UserIdList userIds,
                                        CompletionCallback success,
                                        FailureCallback failure)
        Unblock users.
        Parameters:
        userIds - Users to be unblocked.
        success - Called if users were unblocked.
        failure - Called with an error.
      • getLabels

        public static void getLabels​(PagingQuery<LabelsQuery> query,
                                     Callback<PagingResult<Label>> success,
                                     FailureCallback failure)
        Get labels matching query. Returns a list of labels and a cursor for a next query. If cursor is empty string, or PagingResult.isLastPage() is true, this is a last page.
        Parameters:
        query - labels query and pagination details.
        success - Called with list of topics and a cursor for a next query.
        failure - Called with an error.
      • getLabelsCount

        public static void getLabelsCount​(LabelsQuery query,
                                          Callback<java.lang.Integer> success,
                                          FailureCallback failure)
        Get total count of tags matching provided query.
        Parameters:
        query - labels query.
        success - Called with a number of topics matching the query.
        failure - Called with an error.
      • sendChatMessage

        public static void sendChatMessage​(ChatMessageContent content,
                                           ChatId target,
                                           Callback<ChatMessage> success,
                                           FailureCallback failure)
        Send chat message to the specified recipient.
        Parameters:
        content - Chat message content.
        target - Chat message target.
        success - Called with the sent message.
        failure - Called with an error.
      • getChat

        public static void getChat​(ChatId chatId,
                                   Callback<Chat> success,
                                   FailureCallback failure)
        Get a single chat.
        Parameters:
        chatId - ChatId parameter.
        success - Called with chat messages.
        failure - Called with an error.