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. Use the getTopics() function provided by the lmFeedClient object created earlier.
  2. Create an instance of GetTopicRequest, as shown in the snippet and pass it to the above method.
  3. Use the response as per your requirement
try {
const GetTopicRequest = GetTopicRequest.builder()
.setIsEnabled(true) // whether to fetch enabled/disabled or all topics
.setPage(1) // page number for paginated data
.setPageSize(10) // page size for paginated data
.setSearch("<SEARCH_STRING>") // text to search the topics
.setSearchType("name") // type of search
.build();
const response = await lmFeedClient.getTopics(GetTopicRequest);
// Use the response as per your requirement.
} catch (error) {
// Use the error as per your requirement.
}
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
topicsTopicList of topics.