#![allow(unused_imports, clippy::too_many_arguments)]
use reqwest::Method;
use serde::{Deserialize, Serialize};
use crate::client::{Client, Request, NO_BODY, NO_QUERY};
use crate::error::Result;
use crate::generated::models;
use crate::multipart::{field_text, FilePart};
use crate::util::encode_path;
#[derive(Debug, Clone)]
pub struct LLMCredentialsApi {
pub(crate) client: Client,
}
impl Client {
pub fn llm_credentials(&self) -> LLMCredentialsApi {
LLMCredentialsApi { client: self.clone() }
}
}
impl LLMCredentialsApi {
pub async fn delete_llm_provider_key(&self, provider: &models::SetLLMProviderKeyProvider) -> Result<models::DeleteLLMProviderKeyResponse> {
self.client
.request_json(Request {
method: Method::DELETE,
path: format!("/api/v1/llm-credentials/{}", encode_path(&provider.to_string())),
query: NO_QUERY,
body: NO_BODY,
headers: Vec::new(),
idempotent: true,
})
.await
}
pub async fn list_llm_credentials_providers(&self) -> Result<models::ListLLMCredentialsProvidersResponse> {
self.client
.request_json(Request {
method: Method::GET,
path: "/api/v1/llm-credentials/providers".to_string(),
query: NO_QUERY,
body: NO_BODY,
headers: Vec::new(),
idempotent: false,
})
.await
}
pub async fn set_llm_provider_key(&self, provider: &models::SetLLMProviderKeyProvider, body: &models::SetLLMProviderKeyRequest) -> Result<models::SetLLMProviderKeyResponse> {
self.client
.request_json(Request {
method: Method::PUT,
path: format!("/api/v1/llm-credentials/{}", encode_path(&provider.to_string())),
query: NO_QUERY,
body: Some(body),
headers: Vec::new(),
idempotent: true,
})
.await
}
pub async fn test_llm_provider_key(&self, provider: &models::SetLLMProviderKeyProvider) -> Result<models::TestLLMProviderKeyResponse> {
self.client
.request_json(Request {
method: Method::POST,
path: format!("/api/v1/llm-credentials/{}/test", encode_path(&provider.to_string())),
query: NO_QUERY,
body: NO_BODY,
headers: Vec::new(),
idempotent: true,
})
.await
}
}