pub struct KnowledgeBaseApi<'a> { /* private fields */ }Expand description
Knowledge Base (FAQ) endpoints.
Implementations§
Source§impl<'a> KnowledgeBaseApi<'a>
impl<'a> KnowledgeBaseApi<'a>
Sourcepub async fn list(&self) -> Result<Vec<KbAnswer>>
pub async fn list(&self) -> Result<Vec<KbAnswer>>
List every answer known to the instance, flattened to
KbAnswers (title + category, no body).
POST /api/v1/knowledge_bases/init.
Sourcepub async fn get(&self, answer_id: u64) -> Result<KbAnswer>
pub async fn get(&self, answer_id: u64) -> Result<KbAnswer>
Fetch a single answer by its numeric id, including its full body.
Returns Error::NotFound when no answer with that id exists.
Issues two POST /api/v1/knowledge_bases/init calls: one for the
structure and one that requests the answer’s translation content.
Sourcepub async fn create_answer(&self, answer: NewKbAnswer) -> Result<KbAnswer>
pub async fn create_answer(&self, answer: NewKbAnswer) -> Result<KbAnswer>
Create a new answer in a category, in the knowledge base’s primary locale.
When NewKbAnswer::published is true the answer is published in the
same request; otherwise it is left as a draft. The knowledge base and
locale are resolved from the category.
POST /api/v1/knowledge_bases/:kb_id/answers.
Sourcepub async fn update_answer(
&self,
answer_id: u64,
patch: KbAnswerPatch,
) -> Result<KbAnswer>
pub async fn update_answer( &self, answer_id: u64, patch: KbAnswerPatch, ) -> Result<KbAnswer>
Update an existing answer’s title, body, and/or published state. Fields
left as None in the KbAnswerPatch are preserved.
Returns Error::NotFound when no answer with that id exists.
PATCH /api/v1/knowledge_bases/:kb_id/answers/:id.
Sourcepub fn search(&self, query: impl Into<String>) -> SearchKnowledgeBase<'a>
pub fn search(&self, query: impl Into<String>) -> SearchKnowledgeBase<'a>
Full-text search across the Knowledge Base.
Returns a builder; call SearchKnowledgeBase::send to run it.