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
- Use the
getTopics()
function provided by thelmFeedClient
object created earlier. - Create an instance of
GetTopicRequest
, as shown in the snippet and pass it to the above method. - 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
VARIABLE | TYPE | DESCRIPTION | OPTIONAL |
---|---|---|---|
isEnabled | boolean | Whether to fetch enabled/disables/all topics. | ✔ |
search | string | Input text to search topics. | ✔ |
searchType | string | Type of search. | ✔ |
page | int | Page number of paginated data. | |
pageSize | int | Page size for paginated data. |
GetTopicResponse
VARIABLE | TYPE | DESCRIPTION | OPTIONAL |
---|---|---|---|
topics | Topic | List of topics. |