Skip to main content

uarp_sdk/generated/api/
llm_credentials.rs

1// Code generated by @uarp/codegen from spec/openapi.json. DO NOT EDIT.
2//!
3//! LLM provider API key management
4
5#![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/// LLM provider API key management
17#[derive(Debug, Clone)]
18pub struct LLMCredentialsApi {
19    pub(crate) client: Client,
20}
21
22impl Client {
23    /// LLM provider API key management
24    pub fn llm_credentials(&self) -> LLMCredentialsApi {
25        LLMCredentialsApi { client: self.clone() }
26    }
27}
28
29impl LLMCredentialsApi {
30    /// Remove stored API key for an LLM provider
31    ///
32    /// `DELETE /api/v1/llm-credentials/{provider}`
33    ///
34    /// Required scopes: `agents:write`.
35    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    /// List LLM providers with configured status for current user
49    ///
50    /// `GET /api/v1/llm-credentials/providers`
51    ///
52    /// Required scopes: `agents:read`.
53    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    /// Set or update API key for an LLM provider
67    ///
68    /// `PUT /api/v1/llm-credentials/{provider}`
69    ///
70    /// Required scopes: `agents:write`.
71    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    /// Test configured API key for an LLM provider
85    ///
86    /// `POST /api/v1/llm-credentials/{provider}/test`
87    ///
88    /// Required scopes: `agents:write`.
89    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}