Communities
Build and nurture vibrant communities where users can exchange and connect
Create Community
First, you will need to create the community by using EkoCommunityCreationDataBuilder
instance. The mandatory property is displayName
. You can set other properties as per your necessities.
Join Community
Leave Community
Get Community
In the case where you only want to fetch a community's data without joining, you can use the getCommunity(withId:)
method:
Community Query
There are methods to obtain communities that will only meet certain specific criterias:
the
keyword
parameter allows you to filter communities based on the communitydisplayName
the
filter
parameter let you filter communities based on the logged in user membership statusthe
categoryId
parameters let you filter communities based on community categoriesthe
sortBy
parameters let you filter communities based on the order that the communities were created or based on alphabetical orderthe
includeDeleted
parameters let you specify if you want to include deleted communities in your query
If you want to fetch all communities, you can pass the keyword as nil.
Community Repository also provides a way to fetch trending communities or recommended communities. getTrendingCommunities
method fetches trending communities whereas getRecommendedCommunities
method fetches recommended communities.
Update Community
SDK provides the builder class EkoCommunityUpdateDataBuilder
which allows you to set properties that you want to update. Then you can use updateCommunity
method in EkoCommunityRepository
to update the community.
You can also delete the community by using deleteCommunity(_:)
method.
Note. By default, only the community's original creator or administrators can update/delete the community.
Community Membership
You can get a list of community members through EkoCommunityParticipation
class. It exposes getMemberships
method which accepts filter
and sortBy
parameters.
Same class provides addUsers(_:)
and removeUsers(_:)
which can be used to add or remove user from the community.
Community Moderation
EkoCommunityModeration
class provides a way to moderate the community by banning or unbanning users. banUsers(_:)
method accepts array of user ids to ban and unbanUsers(_:)
accepts array of user ids to unban. You can also add/remove roles using addRole(_:)
and removeRole(_:)
method.
addRole(_:)
andremoveRole(_:)
does not create new roles but assign and remove existing roles from given user.
Community Categories
The EkoCommunityRepository
will also be able to manage community categories. When communities are put into a category, you will be able to sort and filter each of the communities in that category. You can access the categories for any communities through categories
property in each EkoCommunity
object.
Note: Categories can only be created and updated from Amity Social Cloud Console.
Get Categories
Last updated