zai_rs/knowledge/
capacity.rs1use super::types::KnowledgeCapacityResponse;
2use crate::client::http::HttpClient;
3
4pub struct KnowledgeCapacityRequest {
6 pub key: String,
8 url: String,
9 _body: (),
10}
11
12impl KnowledgeCapacityRequest {
13 pub fn new(key: String) -> Self {
15 let url =
16 "https://open.bigmodel.cn/api/llm-application/open/knowledge/capacity".to_string();
17 Self {
18 key,
19 url,
20 _body: (),
21 }
22 }
23
24 pub async fn send(&self) -> anyhow::Result<KnowledgeCapacityResponse> {
26 let resp = self.get().await?;
27 let parsed = resp.json::<KnowledgeCapacityResponse>().await?;
28 Ok(parsed)
29 }
30}
31
32impl HttpClient for KnowledgeCapacityRequest {
33 type Body = ();
34 type ApiUrl = String;
35 type ApiKey = String;
36
37 fn api_url(&self) -> &Self::ApiUrl {
38 &self.url
39 }
40 fn api_key(&self) -> &Self::ApiKey {
41 &self.key
42 }
43 fn body(&self) -> &Self::Body {
44 &self._body
45 }
46}