Build and nurture vibrant communities where users can exchange and connect
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.
In the case where you only want to fetch a community's data without joining, you can use the getCommunity(withId:)
method:
There are methods to obtain communities that will only meet certain specific criterias:
the keyword
parameter allows you to filter communities based on the community displayName
the filter
parameter let you filter communities based on the logged in user membership status
the categoryId
parameters let you filter communities based on community categories
the sortBy
parameters let you filter communities based on the order that the communities were created or based on alphabetical order
the 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.
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.
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.
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.
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.