Skip to main content

Get Topics

The LikeMinds ReactNative 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
.setParentIds("[<LIST_OF_IDs>]") // list of parent Ids
.setOrderBy([
"number_of_posts_desc",
"updated_at_desc",
"alphabetically_desc",
"priority_desc",
]) // list of value to specify the sorting order
.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.
parentIdsstring[]List of parent Ids
orderBystring[]List of value to specify the sorting order

GetTopicResponse

VARIABLETYPEDESCRIPTIONOPTIONAL
topicsTopicList of topics.
childTopicsRecord<string, Topic >Map of all the child topics.
widgetsRecord<string, Widget>Map of the widget data for the topic.