uarp_sdk/generated/api/
llm_credentials.rs1#![allow(unused_imports, clippy::too_many_arguments)]
6
7use reqwest::Method;
8use serde::{Deserialize, Serialize};
9
10use crate::client::{Client, Request, NO_BODY, NO_QUERY};
11use crate::error::Result;
12use crate::generated::models;
13use crate::multipart::{field_text, FilePart};
14use crate::util::encode_path;
15
16#[derive(Debug, Clone)]
18pub struct LLMCredentialsApi {
19 pub(crate) client: Client,
20}
21
22impl Client {
23 pub fn llm_credentials(&self) -> LLMCredentialsApi {
25 LLMCredentialsApi { client: self.clone() }
26 }
27}
28
29impl LLMCredentialsApi {
30 pub async fn delete_llm_provider_key(&self, provider: &models::SetLLMProviderKeyProvider) -> Result<models::DeleteLLMProviderKeyResponse> {
36 self.client
37 .request_json(Request {
38 method: Method::DELETE,
39 path: format!("/api/v1/llm-credentials/{}", encode_path(&provider.to_string())),
40 query: NO_QUERY,
41 body: NO_BODY,
42 headers: Vec::new(),
43 idempotent: true,
44 })
45 .await
46 }
47
48 pub async fn list_llm_credentials_providers(&self) -> Result<models::ListLLMCredentialsProvidersResponse> {
54 self.client
55 .request_json(Request {
56 method: Method::GET,
57 path: "/api/v1/llm-credentials/providers".to_string(),
58 query: NO_QUERY,
59 body: NO_BODY,
60 headers: Vec::new(),
61 idempotent: false,
62 })
63 .await
64 }
65
66 pub async fn set_llm_provider_key(&self, provider: &models::SetLLMProviderKeyProvider, body: &models::SetLLMProviderKeyRequest) -> Result<models::SetLLMProviderKeyResponse> {
72 self.client
73 .request_json(Request {
74 method: Method::PUT,
75 path: format!("/api/v1/llm-credentials/{}", encode_path(&provider.to_string())),
76 query: NO_QUERY,
77 body: Some(body),
78 headers: Vec::new(),
79 idempotent: true,
80 })
81 .await
82 }
83
84 pub async fn test_llm_provider_key(&self, provider: &models::SetLLMProviderKeyProvider) -> Result<models::TestLLMProviderKeyResponse> {
90 self.client
91 .request_json(Request {
92 method: Method::POST,
93 path: format!("/api/v1/llm-credentials/{}/test", encode_path(&provider.to_string())),
94 query: NO_QUERY,
95 body: NO_BODY,
96 headers: Vec::new(),
97 idempotent: true,
98 })
99 .await
100 }
101}