zai_rs/knowledge/
retrieve.rs1use super::types::KnowledgeGetResponse;
2use crate::client::ZaiClient;
3
4pub struct KnowledgeGetRequest {
9 id: String,
10}
11
12impl KnowledgeGetRequest {
13 pub fn new(id: impl Into<String>) -> Self {
15 Self { id: id.into() }
16 }
17
18 pub async fn send_via(&self, client: &ZaiClient) -> crate::ZaiResult<KnowledgeGetResponse> {
20 crate::client::validation::require_non_blank(&self.id, "knowledge_id")?;
21 let route = crate::client::routes::KNOWLEDGE_GET;
22 let url = client.endpoints().resolve_route(route, &[&self.id])?;
23 client
24 .send_empty::<KnowledgeGetResponse>(route.method(), url)
25 .await
26 }
27}