# new Communities()
- Source:
Methods
# (static) addFriends(userIdList) → {Promise.<number>}
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:
Name | Type | Description |
---|---|---|
userIdList |
UserIdList | User identifiers you want to become friend with. |
- Source:
Returns:
Promise with updated number of friends.
- Type
- Promise.<number>
# (static) addGroupMembers(query) → {Promise.<Array.<GroupMember>>}
Add group members to a group.
Parameters:
Name | Type | Description |
---|---|---|
query |
AddGroupMembersQuery | Query parameter. |
- Source:
Returns:
Promise with new group members.
- Type
- Promise.<Array.<GroupMember>>
# (static) addReaction(reaction, activityId) → {Promise.<void>}
Add reaction to the activity. If this reaction was already added, success is called.
Existing reactions will be kept.
Parameters:
Name | Type | Description |
---|---|---|
reaction |
string | Reaction type. |
activityId |
string | Activity ID. |
- Source:
Returns:
Promise.
- Type
- Promise.<void>
# (static) addVotes(pollOptionIds, activityId) → {Promise.<void>}
Add votes to the activity.
Existing votes will be kept.
Parameters:
Name | Type | Description |
---|---|---|
pollOptionIds |
Array.<string> | Poll option IDs. |
activityId |
string | Activity ID. |
- Source:
Returns:
Promise.
- Type
- Promise.<void>
# (static) areFriends(userIdList) → {Promise.<string, boolean>}
Check if users are your friends.
Parameters:
Name | Type | Description |
---|---|---|
userIdList |
UserIdList | Users identifiers. |
- Source:
Returns:
Promise of a map of booleans, where key is user ID and value is a boolean
indicating if the user is in the friends list or not.
- Type
- Promise.<string, boolean>
# (static) areGroupMembers(groupId, userIds) → {Promise.<Object.<string, Membership>>}
Check if users are member of group.
Parameters:
Name | Type | Description |
---|---|---|
groupId |
string | Group ID. |
userIds |
UserIdList | User IDs. |
- Source:
Returns:
Promise with map of user ID and membership.
- Type
- Promise.<Object.<string, Membership>>
# (static) blockUsers(ids) → {Promise.<void>}
Block one or more users.
Parameters:
Name | Type | Description |
---|---|---|
ids |
UserIdList | List of User IDs to block. |
- Source:
Returns:
Promise.
- Type
- Promise.<void>
# (static) bookmark(activityId) → {Promise.<void>}
Bookmark an activity
Parameters:
Name | Type | Description |
---|---|---|
activityId |
string | Acitivity ID |
- Source:
Returns:
Promise
- Type
- Promise.<void>
# (static) createGroup(groupContent) → {Promise.<Group>}
Create a new group.
Parameters:
Name | Type | Description |
---|---|---|
groupContent |
GroupContent | Group content. |
- Source:
Returns:
Promise with created group.
- Type
- Promise.<Group>
# (static) follow(query) → {Promise.<number>}
Follow users or topics.
If follow users, returns a number of users you are following now.
If follow topics, returns a number of topics you are following now.
Parameters:
Name | Type | Description |
---|---|---|
query |
FollowQuery | Topics or users to be followed. |
- Source:
Returns:
Promise with total number of users/topics you follow after the call.
- Type
- Promise.<number>
# (static) getActivities(pagingQuery) → {Promise.<PagingResult.<Activity>>}
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:
Name | Type | Description |
---|---|---|
pagingQuery |
PagingQuery.<ActivitiesQuery> | Activities query and pagination details. |
- Source:
Returns:
Promise with list of activities and a cursor for a next query.
- Type
- Promise.<PagingResult.<Activity>>
# (static) getActivity(id) → {Promise.<Activity>}
Get activity by ID
Parameters:
Name | Type | Description |
---|---|---|
id |
string | Activity ID. |
- Source:
Returns:
Promise with activity.
- Type
- Promise.<Activity>
# (static) getAnnouncements(query) → {Promise.<Array.<Activity>>}
Get announcements matching query. Returns a list of announcements.
Parameters:
Name | Type | Description |
---|---|---|
query |
AnnouncementsQuery | Announcements query and pagination details. |
- Source:
Returns:
Promise with list of announcements.
- Type
- Promise.<Array.<Activity>>
# (static) getBlockedUsers(query) → {Promise.<PagingResult.<Array.<User>>>}
Get list of users blocked by the current user.
Parameters:
Name | Type | Description |
---|---|---|
query |
PagingQuery | Pagination query. |
- Source:
Returns:
Promise with users and cursor for next query.
- Type
- Promise.<PagingResult.<Array.<User>>>
# (static) getChat(chatId) → {Promise.<Chat>}
Get a single chat.
Parameters:
Name | Type | Description |
---|---|---|
chatId |
ChatId | Chat ID. |
- Source:
Returns:
Promise with Chat.
- Type
- Promise.<Chat>
# (static) getChatMessages(query) → {Promise.<ChatMessagesPagingResult.<Array.<ChatMessage>>>}
Get chat messages.
Parameters:
Name | Type | Description |
---|---|---|
query |
ChatMessagesPagingQuery.<ChatMessagesQuery> | Query. |
- Source:
Returns:
Promise with chat messages and cursors.
- Type
- Promise.<ChatMessagesPagingResult.<Array.<ChatMessage>>>
# (static) getChats(pagingQuery) → {Promise.<PagingResult.<Array.<Chat>>>}
Get existing chats.
Parameters:
Name | Type | Description |
---|---|---|
pagingQuery |
PagingQuery | Query and pagination. |
- Source:
Returns:
Promise with chats and cursor for next query.
- Type
- Promise.<PagingResult.<Array.<Chat>>>
# (static) getFollowers(pagingQuery) → {Promise.<PagingResult.<Array.<User>>>}
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 the last page.
Parameters:
Name | Type | Description |
---|---|---|
pagingQuery |
PagingQuery.<FollowersQuery> | Followers query and pagination details. |
- Source:
Returns:
Promise with list of followers and a cursor for the next request.
- Type
- Promise.<PagingResult.<Array.<User>>>
# (static) getFollowersCount(query) → {Promise.<number>}
Get total count of users who follows certain entity.
Parameters:
Name | Type | Description |
---|---|---|
query |
FollowersQuery | Followers query. |
- Source:
Returns:
Promise with number of users who follows certain entity.
- Type
- Promise.<number>
# (static) getFriends(pagingQuery) → {Promise.<PagingResult.<Array.<User>>>}
Get a list of friends for current user.
Parameters:
Name | Type | Description |
---|---|---|
pagingQuery |
PagingQuery.<FriendsQuery> | Pagination query. |
- Source:
Returns:
Promise with list of users.
- Type
- Promise.<PagingResult.<Array.<User>>>
# (static) getFriendsCount(query) → {Promise.<number>}
Get number of friends.
Parameters:
Name | Type | Description |
---|---|---|
query |
FriendsQuery | Query. |
- Source:
Returns:
Promiswe with friends count.
- Type
- Promise.<number>
# (static) getGroup(groupId) → {Promise.<Group>}
Get a single group.
Parameters:
Name | Type | Description |
---|---|---|
groupId |
string | Group ID. |
- Source:
Returns:
Promise if groups are removed.
- Type
- Promise.<Group>
# (static) getGroupMembers(pagingQuery) → {Promise.<PagingResult.<Array.<GroupMember>>>}
Get members of a group.
Parameters:
Name | Type | Description |
---|---|---|
pagingQuery |
PagingQuery.<MembersQuery> | Query with pagination details. |
- Source:
Returns:
Promise with group members and cursor for next query.
- Type
- Promise.<PagingResult.<Array.<GroupMember>>>
# (static) getGroups(pagingQuery) → {PagingResult.<Array.<Group>>}
Get groups based on query parameters.
Parameters:
Name | Type | Description |
---|---|---|
pagingQuery |
PagingQuery.<GroupsQuery> | Query parameter. |
- Source:
Returns:
Promise with groups and cursor for next query.
- Type
- PagingResult.<Array.<Group>>
# (static) getGroupsCount(query) → {Promise.<number>}
Get number of groups based on query parameters.
Parameters:
Name | Type | Description |
---|---|---|
query |
GroupsQuery | Groups Query. |
- Source:
Returns:
Promsie with amount of groups.
- Type
- Promise.<number>
# (static) getLabels(query) → {Promise.<PagingResult.<Array.<Label>>>}
Get labels matching query. Returns a list of labels.
Parameters:
Name | Type | Description |
---|---|---|
query |
PagingQuery.<LabelsQuery> | Labels query and pagination details. |
- Source:
Returns:
Promise with list of labels and a cursor for a next query.
- Type
- Promise.<PagingResult.<Array.<Label>>>
# (static) getLabelsCount(query) → {Promise.<number>}
Get labels count for matching query. Returns amount of labels.
Parameters:
Name | Type | Description |
---|---|---|
query |
LabelsQuery | Labels query. |
- Source:
Returns:
Called with labels count.
- Type
- Promise.<number>
# (static) getReactions(pagingQuery) → {Promise.<PagingResult.<UserReactions>>}
Get reactions matching query.
If cursor is empty string, or PagingResult#isLastPage() is true, this is a last page.
Parameters:
Name | Type | Description |
---|---|---|
pagingQuery |
PagingQuery.<ReactionsQuery> | Reactions query and pagination details. |
- Source:
Returns:
Promise with list of reactions and a cursor for a next query.
- Type
- Promise.<PagingResult.<UserReactions>>
# (static) getSuggestedFriends(pagingQuery) → {Promise.<PagingResult.<Array.<SuggestedFriend>>>}
Get a list of suggested friends for current user.
Parameters:
Name | Type | Description |
---|---|---|
pagingQuery |
PagingQuery | Pagination query. |
- Source:
Returns:
Promise with list of users.
- Type
- Promise.<PagingResult.<Array.<SuggestedFriend>>>
# (static) getTags(pagingQuery) → {Promise.<PagingResult.<Array.<Tag>>>}
Get tags matching query. Returns a list of tags.
Parameters:
Name | Type | Description |
---|---|---|
pagingQuery |
PagingQuery.<TagsQuery> | Tags query and pagination details. |
- Source:
Returns:
Promise with list of tags and next cursor.
- Type
- Promise.<PagingResult.<Array.<Tag>>>
# (static) getTagsCount(query) → {Promise.<number>}
Get tags count for matching query. Returns amount of tags.
Parameters:
Name | Type | Description |
---|---|---|
query |
TagsQuery | Tags query. |
- Source:
Returns:
Promise with tags count.
- Type
- Promise.<number>
# (static) getTopic(id) → {Promise.<Topic>}
Get topic by ID. If topic with given ID doesn't exist, return an error.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | Topic ID. |
- Source:
Returns:
Promise with topic.
- Type
- Promise.<Topic>
# (static) getTopics(pagingQuery) → {Promise.<PagingResult.<Array.<Topic>>>}
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:
Name | Type | Description |
---|---|---|
pagingQuery |
PagingQuery.<TopicsQuery> | Topics query and pagination details. |
- Source:
Returns:
Promise with list of topics and a cursor for a next query.
- Type
- Promise.<PagingResult.<Array.<Topic>>>
# (static) getTopicsCount(query) → {Promise.<number>}
Get total count of topics matching provided query.
Parameters:
Name | Type | Description |
---|---|---|
query |
TopicsQuery | Topics query. |
- Source:
Returns:
Promise with a number of topics matching the query.
- Type
- Promise.<number>
# (static) getUser(userId) → {Promise.<User>}
Get a single user by his identifier. Returns an error if user with this ID doesn't exist.
Parameters:
Name | Type | Description |
---|---|---|
userId |
UserId | Single user identifier. |
- Source:
Returns:
Promise with a user object.
- Type
- Promise.<User>
# (static) getUsers(pagingQuery) → {PagingResult.<User>}
Get users matching query
Parameters:
Name | Type | Description |
---|---|---|
pagingQuery |
PagingQuery.<UsersQuery> | Pagination query. |
- Source:
Returns:
Promise with list of users.
- Type
- PagingResult.<User>
# (static) getUsersByIds(userIdList) → {Promise.<Object.<string, User>>}
Get users by their identifiers.
Parameters:
Name | Type | Description |
---|---|---|
userIdList |
UserIdList | List of GetSocial user identifiers. |
- Source:
Returns:
Promise with a map of users, where key is user ID.
- Type
- Promise.<Object.<string, User>>
# (static) getUsersCount(query) → {Promise.<number>}
Get total count of users matching provided query.
Parameters:
Name | Type | Description |
---|---|---|
query |
UsersQuery | Users query. |
- Source:
Returns:
Promise with the number of users matching the query.
- Type
- Promise.<number>
# (static) getVotes(pagingQuery) → {Promise.<PagingResult.<UserVotes>>}
Get votes matching query. Returns votes and a cursor for the next query.
If cursor is empty string, or PagingResult#isLastPage() is true, this is a last page.
Parameters:
Name | Type | Description |
---|---|---|
pagingQuery |
PagingQuery.<VotesQuery> | Votes query and pagination details. |
- Source:
Returns:
Promise with votes and a cursor for a next query.
- Type
- Promise.<PagingResult.<UserVotes>>
# (static) isFollowing(userId, query) → {Promise.<Object.<string, boolean>>}
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:
Name | Type | Description |
---|---|---|
userId |
UserId | ID of user to check if he follows certain entities. |
query |
FollowQuery | List of entities to check. |
- Source:
Returns:
Promise with a map of results.
- Type
- Promise.<Object.<string, boolean>>
# (static) isFriend(id) → {Promise.<boolean>}
Check if a user is your friend.
Parameters:
Name | Type | Description |
---|---|---|
id |
UserId | Unique user identifier. |
- Source:
Returns:
Promis with boolean: true, if user is your friend, false otherwise
- Type
- Promise.<boolean>
# (static) joinGroup(query) → {Promise.<GroupMember>}
Current user join to group.
Parameters:
Name | Type | Description |
---|---|---|
query |
JoinGroupQuery | Query parameter. |
- Source:
Returns:
Promise with new group member.
- Type
- Promise.<GroupMember>
# (static) postActivity(content, target) → {Promise.<Activity>}
Post activity to a specific target.
Parameters:
Name | Type | Description |
---|---|---|
content |
ActivityContent | Activity content. |
target |
PostActivityTarget | Target where to post the activity. |
- Source:
Returns:
Promise with activity, if posted successfully.
- Type
- Promise.<Activity>
# (static) removeActivities(query) → {Promise.<void>}
Remove all activities matching query.
Parameters:
Name | Type | Description |
---|---|---|
query |
RemoveActivitiesQuery | Activities to be removed. |
- Source:
Returns:
Promise.
- Type
- Promise.<void>
# (static) removeBookmark(activityId) → {Promise.<void>}
Remove a bookmark from an activity
Parameters:
Name | Type | Description |
---|---|---|
activityId |
string | Acitivity ID |
- Source:
Returns:
Promise
- Type
- Promise.<void>
# (static) removeFriends(userIdList) → {Promise.<number>}
Remove users from a friends list.
If some or all users are not in the friends list, they will be ignored.
Parameters:
Name | Type | Description |
---|---|---|
userIdList |
UserIdList | Users identifiers you don't want to be friends anymore. |
- Source:
Returns:
Promise with updated number of friends.
- Type
- Promise.<number>
# (static) removeGroupMembers(query) → {Promise.<void>}
Remove users from a group.
Parameters:
Name | Type | Description |
---|---|---|
query |
RemoveGroupMembersQuery | Query. |
- Source:
Returns:
Promise.
- Type
- Promise.<void>
# (static) removeGroups(groupIds) → {Promise.<void>}
Remove groups.
Parameters:
Name | Type | Description |
---|---|---|
groupIds |
Array.<string> | Group IDs. |
- Source:
Returns:
Promise.
- Type
- Promise.<void>
# (static) removeReaction(reaction, activityId) → {Promise.<void>}
Remove reaction from the activity
Parameters:
Name | Type | Description |
---|---|---|
reaction |
string | Reaction type. |
activityId |
string | Activity ID. |
- Source:
Returns:
Promise.
- Type
- Promise.<void>
# (static) removeVotes(pollOptionIds, activityId) → {Promise.<void>}
Remove votes from the activity.
Parameters:
Name | Type | Description |
---|---|---|
pollOptionIds |
Array.<string> | Poll option IDs. |
activityId |
string | Activity ID. |
- Source:
Returns:
Promise.
- Type
- Promise.<void>
# (static) reportActivity(id, reason, explanationopt) → {Promise.<void>}
Report activity with a specified reason.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
id |
string | Activity ID. | |
reason |
number | Reason of reporting. One of ReportingReason | |
explanation |
string |
<optional> |
Could be arbitrary string. |
- Source:
Returns:
Promise.
- Type
- Promise.<void>
# (static) search(query) → {Promise.<SearchResult>}
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:
Name | Type | Description |
---|---|---|
query |
PagingQuery.<SearchQuery> | Search query and pagination. |
- Source:
Returns:
Promise with Result and cursor(s) for next query.
- Type
- Promise.<SearchResult>
# (static) sendChatMessage(content, target) → {Promise.<ChatMessage>}
Send chat message to the specified recipient.
Parameters:
Name | Type | Description |
---|---|---|
content |
ChatMessageContent | Chat message content. |
target |
ChatId | Chat ID. |
- Source:
Returns:
Promise with the sent message.
- Type
- Promise.<ChatMessage>
# (static) setFriends(userIdList) → {Promise.<number>}
Replace existing friends with the provided list of users.
Parameters:
Name | Type | Description |
---|---|---|
userIdList |
UserIdList | List of GetSocial user identifiers. |
- Source:
Returns:
Promise with number of users set.
- Type
- Promise.<number>
# (static) setReaction(reaction, activityId) → {Promise.<void>}
Set reaction to the activity.
Existing reactions will be removed.
Parameters:
Name | Type | Description |
---|---|---|
reaction |
string | Reaction type. |
activityId |
string | Activity ID. |
- Source:
Returns:
Promise.
- Type
- Promise.<void>
# (static) setVotes(pollOptionIds, activityId) → {Promise.<void>}
Set votes to the activity.
Existing votes will be removed.
Parameters:
Name | Type | Description |
---|---|---|
pollOptionIds |
Array.<string> | Poll option IDs. |
activityId |
string | Activity ID. |
- Source:
Returns:
Promise.
- Type
- Promise.<void>
# (static) unblockUsers(ids) → {Promise.<void>}
Unblock one or more users.
Parameters:
Name | Type | Description |
---|---|---|
ids |
UserIdList | List of User IDs to unblock. |
- Source:
Returns:
Promise
- Type
- Promise.<void>
# (static) unfollow(query) → {Promise.<number>}
Unfollow users or topics.
If unfollow users, returns a number of users you are following now.
If unfollow topics, returns a number of topics you are following now.
Parameters:
Name | Type | Description |
---|---|---|
query |
FollowQuery | Topics or users to be followed. |
- Source:
Returns:
Promise with the total number of users/topics you follow after the call.
- Type
- Promise.<number>
# (static) updateActivity(id, content) → {Promise.<Activity>}
Update activity with a new content. Activity is entire replaced.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | Activity ID. |
content |
ActivityContent | Activity content. |
- Source:
Returns:
Promise with activity, if updated successfully.
- Type
- Promise.<Activity>
# (static) updateGroup(groupId, groupContent) → {Promise.<Group>}
Update an existing group.
Parameters:
Name | Type | Description |
---|---|---|
groupId |
string | Group ID. |
groupContent |
GroupContent | New Group content. |
- Source:
Returns:
Promise with updated group.
- Type
- Promise.<Group>
# (static) updateGroupMembers(query) → {Promise.<Array.<GroupMember>>}
Update existing group members.
Parameters:
Name | Type | Description |
---|---|---|
query |
UpdateGroupMembersQuery | Query. |
- Source:
Returns:
Promise with updated members.
- Type
- Promise.<Array.<GroupMember>>