Knowledge Base Methods
UsedeskKnowledgeBaseSdk Class Methods
1. Configuration setting method
fun setConfiguration(knowledgeBaseConfiguration: UsedeskKnowledgeBaseConfiguration)
Arguments:
Name | Type | Description |
---|---|---|
knowledgeBaseConfiguration | UsedeskKnowledgeBaseConfiguration | Knowledge Base Configuration |
Example:
UsedeskKnowledgeBaseSdk.setConfiguration(knowledgeBaseConfiguration)
2. Configuration getting method
fun requireConfiguration(): UsedeskKnowledgeBaseConfiguration
Example:
val knowledgeBaseConfiguration= UsedeskKnowledgeBaseSdk.requireConfiguration()
3. Knowledge Base initialization method
fun init(context: Context): IUsedeskKnowledgeBase
Arguments:
Name | Type | Description |
---|---|---|
context | Context | Context |
Example:
val usedeskKnowledgeBase = UsedeskKnowledgeBaseSdk.init(requireContext())
4. The method for obtaining an instance of the Knowledge Base
fun getInstance(): IUsedeskKnowledgeBase
Arguments:
val usedeskKnowledgeBase = UsedeskKnowledgeBaseSdk.getInstance()
5. Method of freeing resources of the Knowledge Base
fun release()
Example:
UsedeskKnowledgeBaseSdk.release()
IUsedeskKnowledgeBase Class Methods
1. Getting a list of sections
fun getSections(): Listfun getSectionsRx(): Single >
Example:
val sections = usedeskKnowledgeBase.getSections() usedeskKnowledgeBase.getSectionsRx().subscribe({ sections -> //loaded }, { throwable -> throwable.printStackTrace() })
2. Getting a list of categories
fun getCategories(sectionId: Long): Listfun getCategoriesRx(sectionId: Long): Single >
Arguments:
Name | Type | Description |
---|---|---|
sectionId | Long | Category ID |
Example:
val categories = usedeskKnowledgeBase.getCategories(sectionId) usedeskKnowledgeBase.getCategoriesRx(sectionId).subscribe({ categories -> //loaded }, { throwable -> throwable.printStackTrace() })
3. Getting a list of articles
fun getArticles(categoryId: Long): Listfun getArticlesRx(categoryId: Long): Single >
Arguments:
Name | Type | Description |
---|---|---|
categoryId | Long | Category ID |
Example:
val articles = usedeskKnowledgeBase.getArticles(categoryId) usedeskKnowledgeBase.getArticlesRx(categoryId).subscribe({ articles -> //loaded }, { throwable -> throwable.printStackTrace() })
4. Searching the articles
fun getArticles(searchQuery: String): Listfun getArticlesRx(searchQuery: String): Single >
Arguments:
Name | Type | Description |
---|---|---|
searchQuery | String | Text search query |
Example:
val articles = usedeskKnowledgeBase.getArticles(searchQuery) usedeskKnowledgeBase.getArticlesRx(searchQuery).subscribe({ articles -> //loaded }, { throwable -> throwable.printStackTrace() })
5. Get an article data
fun getArticle(articleId: Long): UsedeskArticleContent fun getArticleRx(articleId: Long): Single
Arguments:
Name | Type | Description |
---|---|---|
articleId | Long | Category ID |
Example:
val article = usedeskKnowledgeBase.getArticle(articleId) usedeskKnowledgeBase.getArticleRx(articleId).subscribe({ article -> //loaded }, { throwable -> throwable.printStackTrace() })
6. Add an a view to the article
fun addViews(articleId: Long) fun addViewsRx(articleId: Long): Completable
Arguments:
Name | Type | Description |
---|---|---|
articleId | Long | Category ID |
Example:
usedeskKnowledgeBase.addViews(articleId) usedeskKnowledgeBase.addViewsRx(articleId).subscribe({ //completed }, { throwable -> throwable.printStackTrace() })
7. Rate this article
fun sendRating(articleId: Long, good: Boolean) fun sendRatingRx(articleId: Long, good: Boolean): Completable
Arguments:
Name | Type | Description |
---|---|---|
articleId | Long | Article ID |
good | Boolean | Positive (true) or negative (false) feedback |
Example:
usedeskKnowledgeBase.sendRating(articleId, good) usedeskKnowledgeBase.sendRatingRx(articleId, good).subscribe({ //completed }, { throwable -> throwable.printStackTrace() })
8. Leave a review about this article
fun sendRating(articleId: Long, message: String) fun sendRatingRx(articleId: Long, message: String): Completable
Arguments:
Name | Type | Description |
---|---|---|
articleId | Long | Article ID |
message | String | Text of the review |
Example:
usedeskKnowledgeBase.sendRating(articleId, message) usedeskKnowledgeBase.sendRatingRx(articleId, message).subscribe({ //completed }, { throwable -> throwable.printStackTrace() })