langfuse_client_base/apis/
blob_storage_integrations_api.rs1use super::{configuration, ContentType, Error};
12use crate::{apis::ResponseContent, models};
13use reqwest;
14use serde::{de::Error as _, Deserialize, Serialize};
15
16#[derive(Debug, Clone, Serialize, Deserialize)]
18#[serde(untagged)]
19pub enum BlobStorageIntegrationsDeleteBlobStorageIntegrationError {
20 Status400(serde_json::Value),
21 Status401(serde_json::Value),
22 Status403(serde_json::Value),
23 Status404(serde_json::Value),
24 Status405(serde_json::Value),
25 UnknownValue(serde_json::Value),
26}
27
28#[derive(Debug, Clone, Serialize, Deserialize)]
30#[serde(untagged)]
31pub enum BlobStorageIntegrationsGetBlobStorageIntegrationStatusError {
32 Status400(serde_json::Value),
33 Status401(serde_json::Value),
34 Status403(serde_json::Value),
35 Status404(serde_json::Value),
36 Status405(serde_json::Value),
37 UnknownValue(serde_json::Value),
38}
39
40#[derive(Debug, Clone, Serialize, Deserialize)]
42#[serde(untagged)]
43pub enum BlobStorageIntegrationsGetBlobStorageIntegrationsError {
44 Status400(serde_json::Value),
45 Status401(serde_json::Value),
46 Status403(serde_json::Value),
47 Status404(serde_json::Value),
48 Status405(serde_json::Value),
49 UnknownValue(serde_json::Value),
50}
51
52#[derive(Debug, Clone, Serialize, Deserialize)]
54#[serde(untagged)]
55pub enum BlobStorageIntegrationsUpsertBlobStorageIntegrationError {
56 Status400(serde_json::Value),
57 Status401(serde_json::Value),
58 Status403(serde_json::Value),
59 Status404(serde_json::Value),
60 Status405(serde_json::Value),
61 UnknownValue(serde_json::Value),
62}
63
64#[bon::builder]
66pub async fn blob_storage_integrations_delete_blob_storage_integration(
67 configuration: &configuration::Configuration,
68 id: &str,
69) -> Result<
70 models::BlobStorageIntegrationDeletionResponse,
71 Error<BlobStorageIntegrationsDeleteBlobStorageIntegrationError>,
72> {
73 let p_path_id = id;
75
76 let uri_str = format!(
77 "{}/api/public/integrations/blob-storage/{id}",
78 configuration.base_path,
79 id = crate::apis::urlencode(p_path_id)
80 );
81 let mut req_builder = configuration
82 .client
83 .request(reqwest::Method::DELETE, &uri_str);
84
85 if let Some(ref user_agent) = configuration.user_agent {
86 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
87 }
88 if let Some(ref auth_conf) = configuration.basic_auth {
89 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
90 };
91
92 let req = req_builder.build()?;
93 let resp = configuration.client.execute(req).await?;
94
95 let status = resp.status();
96 let content_type = resp
97 .headers()
98 .get("content-type")
99 .and_then(|v| v.to_str().ok())
100 .unwrap_or("application/octet-stream");
101 let content_type = super::ContentType::from(content_type);
102
103 if !status.is_client_error() && !status.is_server_error() {
104 let content = resp.text().await?;
105 match content_type {
106 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
107 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::BlobStorageIntegrationDeletionResponse`"))),
108 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::BlobStorageIntegrationDeletionResponse`")))),
109 }
110 } else {
111 let content = resp.text().await?;
112 let entity: Option<BlobStorageIntegrationsDeleteBlobStorageIntegrationError> =
113 serde_json::from_str(&content).ok();
114 Err(Error::ResponseError(ResponseContent {
115 status,
116 content,
117 entity,
118 }))
119 }
120}
121
122#[bon::builder]
124pub async fn blob_storage_integrations_get_blob_storage_integration_status(
125 configuration: &configuration::Configuration,
126 id: &str,
127) -> Result<
128 models::BlobStorageIntegrationStatusResponse,
129 Error<BlobStorageIntegrationsGetBlobStorageIntegrationStatusError>,
130> {
131 let p_path_id = id;
133
134 let uri_str = format!(
135 "{}/api/public/integrations/blob-storage/{id}",
136 configuration.base_path,
137 id = crate::apis::urlencode(p_path_id)
138 );
139 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
140
141 if let Some(ref user_agent) = configuration.user_agent {
142 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
143 }
144 if let Some(ref auth_conf) = configuration.basic_auth {
145 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
146 };
147
148 let req = req_builder.build()?;
149 let resp = configuration.client.execute(req).await?;
150
151 let status = resp.status();
152 let content_type = resp
153 .headers()
154 .get("content-type")
155 .and_then(|v| v.to_str().ok())
156 .unwrap_or("application/octet-stream");
157 let content_type = super::ContentType::from(content_type);
158
159 if !status.is_client_error() && !status.is_server_error() {
160 let content = resp.text().await?;
161 match content_type {
162 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
163 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::BlobStorageIntegrationStatusResponse`"))),
164 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::BlobStorageIntegrationStatusResponse`")))),
165 }
166 } else {
167 let content = resp.text().await?;
168 let entity: Option<BlobStorageIntegrationsGetBlobStorageIntegrationStatusError> =
169 serde_json::from_str(&content).ok();
170 Err(Error::ResponseError(ResponseContent {
171 status,
172 content,
173 entity,
174 }))
175 }
176}
177
178#[bon::builder]
180pub async fn blob_storage_integrations_get_blob_storage_integrations(
181 configuration: &configuration::Configuration,
182) -> Result<
183 models::BlobStorageIntegrationsResponse,
184 Error<BlobStorageIntegrationsGetBlobStorageIntegrationsError>,
185> {
186 let uri_str = format!(
187 "{}/api/public/integrations/blob-storage",
188 configuration.base_path
189 );
190 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
191
192 if let Some(ref user_agent) = configuration.user_agent {
193 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
194 }
195 if let Some(ref auth_conf) = configuration.basic_auth {
196 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
197 };
198
199 let req = req_builder.build()?;
200 let resp = configuration.client.execute(req).await?;
201
202 let status = resp.status();
203 let content_type = resp
204 .headers()
205 .get("content-type")
206 .and_then(|v| v.to_str().ok())
207 .unwrap_or("application/octet-stream");
208 let content_type = super::ContentType::from(content_type);
209
210 if !status.is_client_error() && !status.is_server_error() {
211 let content = resp.text().await?;
212 match content_type {
213 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
214 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::BlobStorageIntegrationsResponse`"))),
215 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::BlobStorageIntegrationsResponse`")))),
216 }
217 } else {
218 let content = resp.text().await?;
219 let entity: Option<BlobStorageIntegrationsGetBlobStorageIntegrationsError> =
220 serde_json::from_str(&content).ok();
221 Err(Error::ResponseError(ResponseContent {
222 status,
223 content,
224 entity,
225 }))
226 }
227}
228
229#[bon::builder]
231pub async fn blob_storage_integrations_upsert_blob_storage_integration(
232 configuration: &configuration::Configuration,
233 create_blob_storage_integration_request: models::CreateBlobStorageIntegrationRequest,
234) -> Result<
235 models::BlobStorageIntegrationResponse,
236 Error<BlobStorageIntegrationsUpsertBlobStorageIntegrationError>,
237> {
238 let p_body_create_blob_storage_integration_request = create_blob_storage_integration_request;
240
241 let uri_str = format!(
242 "{}/api/public/integrations/blob-storage",
243 configuration.base_path
244 );
245 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
246
247 if let Some(ref user_agent) = configuration.user_agent {
248 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
249 }
250 if let Some(ref auth_conf) = configuration.basic_auth {
251 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
252 };
253 req_builder = req_builder.json(&p_body_create_blob_storage_integration_request);
254
255 let req = req_builder.build()?;
256 let resp = configuration.client.execute(req).await?;
257
258 let status = resp.status();
259 let content_type = resp
260 .headers()
261 .get("content-type")
262 .and_then(|v| v.to_str().ok())
263 .unwrap_or("application/octet-stream");
264 let content_type = super::ContentType::from(content_type);
265
266 if !status.is_client_error() && !status.is_server_error() {
267 let content = resp.text().await?;
268 match content_type {
269 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
270 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::BlobStorageIntegrationResponse`"))),
271 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::BlobStorageIntegrationResponse`")))),
272 }
273 } else {
274 let content = resp.text().await?;
275 let entity: Option<BlobStorageIntegrationsUpsertBlobStorageIntegrationError> =
276 serde_json::from_str(&content).ok();
277 Err(Error::ResponseError(ResponseContent {
278 status,
279 content,
280 entity,
281 }))
282 }
283}