Skip to main content

Get Topics

The LikeMinds Feed SDK offers a fundamental function for enhanced community engagement—categorizing posts and discussions into topics. This feature empowers users by providing easy access to a comprehensive list of topics within the community, fostering organized and insightful interactions, making the platform a hub for focused and meaningful discussions. This function allows fetching a list of all topics in the community.

Steps to get topics

  1. Create a GetTopicRequest object using GetTopicRequest.Builder class by passing all the required parameters.
  2. Call getTopics() function using the instance of LMFeedClient.
  3. Process the response (LMResponse<GetTopicResponse>) as per your requirement.
CoroutineScope(Dispatchers.IO).launch {
// object of GetTopicRequest
val getTopicRequest = GetTopicRequest.Builder()
.isEnabled(true) // whether to fetch enabled/disabled or all topics
.page(1) // page number for paginated data
.pageSize(20) // page size for paginated data
.search("Nipun") // text to search the topics
.searchType("name") // type of search
.build()
// get response (LMResponse<GetTopicResponse>)
val response = LMFeedClient.getInstance().getTopics(getTopicRequest)
if (response.success) {
// your function to process the response data
processGetTopicsResponse(response.data)
} else {
// your function to process error message
processError(response.errorMessage)
}
}
note

isEnabled key is nullable, if you want to fetch enabled topics send isEnabled = true. For disabled topics send isEnabled = false and to fetch all the existing topics send send isEnabled = null

Models

GetTopicRequest

VARIABLETYPEDESCRIPTIONOPTIONAL
isEnabledBooleanWhether to fetch enabled/disables/all topics.
searchStringInput text to search topics.
searchTypeStringType of search.
pageIntPage number of paginated data.
pageSizeIntPage size for paginated data.

GetTopicResponse

VARIABLETYPEDESCRIPTIONOPTIONAL
topicsList<Topic>List of topics.