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
- Create a GetTopicRequest object using
GetTopicRequest.builder()
class by passing all the required parameters. - Call
getTopics()
function using the instance ofLMFeedClient
. - Process the response LMResponse<GetTopicResponse> as per your requirement.
let request = 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(SEARCH_STRING) // text to search the topics
.searchType("name") // type of search
.build()
LMFeedClient.shared.getTopics(request) { response in
if response.success {
// your function to process the response data
processResponse(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
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. |