Knowledge Base Methods

All methods are current as of version 4.7.0.

UsedeskKnowledgeBaseSdk methods

1. Set the configuration

fun setConfiguration(knowledgeBaseConfiguration: UsedeskKnowledgeBaseConfiguration)

2. Get the configuration

fun requireConfiguration(): UsedeskKnowledgeBaseConfiguration

3. Initialize the Knowledge Base

fun init(
    context: Context,
    configuration: UsedeskKnowledgeBaseConfiguration = requireConfiguration()
): UsedeskKnowledgeBase

If the configuration has already been set via setConfiguration, the second argument can be omitted.

4. Get the instance

fun getInstance(): UsedeskKnowledgeBase?

Returns null if the Knowledge Base has not been initialized yet.

5. Get the instance with a check

fun requireInstance(): UsedeskKnowledgeBase

Same as getInstance(), but throws an exception if the Knowledge Base has not been initialized.

6. Release the resources

fun release()


UsedeskKnowledgeBase methods

All methods perform network requests and must not be called on the main thread.

Each method returns one of two values:

  • Done — the request succeeded, contains the result;
  • Error — the request failed, contains the error code if there is one.
Name Type Description
getSections() GetSectionsResponse Get the list of sections. Done contains List<UsedeskSection>
getArticle(articleId: Long) GetArticleResponse Get an article by identifier. Done contains UsedeskArticleContent
getArticles(query: String, page: Long) GetArticlesResponse Search articles by query with pagination. Done contains List<UsedeskArticleContent>
addViews(articleId: Long) AddViewsResponse Count an article view. Done contains the new view count
sendRating(articleId: Long, good: Boolean) SendRatingResponse Rate an article. Done contains the number of positive and negative ratings
sendReview(subject: String, message: String) SendReviewResponse Send a review about an article