Skip to main content

orvanta_api/apis/
connection_api.rs

1/*
2 * Orvanta API
3 *
4 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5 *
6 * The version of the OpenAPI document: 1.7.1
7 * Contact: contact@orvanta.cloud
8 * Generated by: https://openapi-generator.tech
9 */
10
11
12use reqwest;
13use serde::{Deserialize, Serialize};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration};
16
17
18/// struct for typed errors of method [`create_connection`]
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum CreateConnectionError {
22    UnknownValue(serde_json::Value),
23}
24
25/// struct for typed errors of method [`create_connection_type`]
26#[derive(Debug, Clone, Serialize, Deserialize)]
27#[serde(untagged)]
28pub enum CreateConnectionTypeError {
29    UnknownValue(serde_json::Value),
30}
31
32/// struct for typed errors of method [`delete_connection`]
33#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum DeleteConnectionError {
36    UnknownValue(serde_json::Value),
37}
38
39/// struct for typed errors of method [`delete_connection_type`]
40#[derive(Debug, Clone, Serialize, Deserialize)]
41#[serde(untagged)]
42pub enum DeleteConnectionTypeError {
43    UnknownValue(serde_json::Value),
44}
45
46/// struct for typed errors of method [`delete_connections_bulk`]
47#[derive(Debug, Clone, Serialize, Deserialize)]
48#[serde(untagged)]
49pub enum DeleteConnectionsBulkError {
50    UnknownValue(serde_json::Value),
51}
52
53/// struct for typed errors of method [`exists_connection`]
54#[derive(Debug, Clone, Serialize, Deserialize)]
55#[serde(untagged)]
56pub enum ExistsConnectionError {
57    UnknownValue(serde_json::Value),
58}
59
60/// struct for typed errors of method [`exists_connection_type`]
61#[derive(Debug, Clone, Serialize, Deserialize)]
62#[serde(untagged)]
63pub enum ExistsConnectionTypeError {
64    UnknownValue(serde_json::Value),
65}
66
67/// struct for typed errors of method [`file_connection_type_to_file_ext_map`]
68#[derive(Debug, Clone, Serialize, Deserialize)]
69#[serde(untagged)]
70pub enum FileConnectionTypeToFileExtMapError {
71    UnknownValue(serde_json::Value),
72}
73
74/// struct for typed errors of method [`get_connection`]
75#[derive(Debug, Clone, Serialize, Deserialize)]
76#[serde(untagged)]
77pub enum GetConnectionError {
78    UnknownValue(serde_json::Value),
79}
80
81/// struct for typed errors of method [`get_connection_type`]
82#[derive(Debug, Clone, Serialize, Deserialize)]
83#[serde(untagged)]
84pub enum GetConnectionTypeError {
85    UnknownValue(serde_json::Value),
86}
87
88/// struct for typed errors of method [`get_connection_value`]
89#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum GetConnectionValueError {
92    UnknownValue(serde_json::Value),
93}
94
95/// struct for typed errors of method [`get_connection_value_interpolated`]
96#[derive(Debug, Clone, Serialize, Deserialize)]
97#[serde(untagged)]
98pub enum GetConnectionValueInterpolatedError {
99    UnknownValue(serde_json::Value),
100}
101
102/// struct for typed errors of method [`get_git_commit_hash_for_connection`]
103#[derive(Debug, Clone, Serialize, Deserialize)]
104#[serde(untagged)]
105pub enum GetGitCommitHashForConnectionError {
106    UnknownValue(serde_json::Value),
107}
108
109/// struct for typed errors of method [`get_mcp_tools_for_connection`]
110#[derive(Debug, Clone, Serialize, Deserialize)]
111#[serde(untagged)]
112pub enum GetMcpToolsForConnectionError {
113    UnknownValue(serde_json::Value),
114}
115
116/// struct for typed errors of method [`list_connection`]
117#[derive(Debug, Clone, Serialize, Deserialize)]
118#[serde(untagged)]
119pub enum ListConnectionError {
120    UnknownValue(serde_json::Value),
121}
122
123/// struct for typed errors of method [`list_connection_names`]
124#[derive(Debug, Clone, Serialize, Deserialize)]
125#[serde(untagged)]
126pub enum ListConnectionNamesError {
127    UnknownValue(serde_json::Value),
128}
129
130/// struct for typed errors of method [`list_connection_type`]
131#[derive(Debug, Clone, Serialize, Deserialize)]
132#[serde(untagged)]
133pub enum ListConnectionTypeError {
134    UnknownValue(serde_json::Value),
135}
136
137/// struct for typed errors of method [`list_connection_type_names`]
138#[derive(Debug, Clone, Serialize, Deserialize)]
139#[serde(untagged)]
140pub enum ListConnectionTypeNamesError {
141    UnknownValue(serde_json::Value),
142}
143
144/// struct for typed errors of method [`list_search_connection`]
145#[derive(Debug, Clone, Serialize, Deserialize)]
146#[serde(untagged)]
147pub enum ListSearchConnectionError {
148    UnknownValue(serde_json::Value),
149}
150
151/// struct for typed errors of method [`update_connection`]
152#[derive(Debug, Clone, Serialize, Deserialize)]
153#[serde(untagged)]
154pub enum UpdateConnectionError {
155    UnknownValue(serde_json::Value),
156}
157
158/// struct for typed errors of method [`update_connection_type`]
159#[derive(Debug, Clone, Serialize, Deserialize)]
160#[serde(untagged)]
161pub enum UpdateConnectionTypeError {
162    UnknownValue(serde_json::Value),
163}
164
165/// struct for typed errors of method [`update_connection_value`]
166#[derive(Debug, Clone, Serialize, Deserialize)]
167#[serde(untagged)]
168pub enum UpdateConnectionValueError {
169    UnknownValue(serde_json::Value),
170}
171
172
173pub async fn create_connection(configuration: &configuration::Configuration, workspace: &str, create_resource: models::CreateResource, update_if_exists: Option<bool>) -> Result<String, Error<CreateConnectionError>> {
174    let local_var_configuration = configuration;
175
176    let local_var_client = &local_var_configuration.client;
177
178    let local_var_uri_str = format!("{}/w/{workspace}/connections/create", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
179    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
180
181    if let Some(ref local_var_str) = update_if_exists {
182        local_var_req_builder = local_var_req_builder.query(&[("update_if_exists", &local_var_str.to_string())]);
183    }
184    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
185        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
186    }
187    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
188        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
189    };
190    local_var_req_builder = local_var_req_builder.json(&create_resource);
191
192    let local_var_req = local_var_req_builder.build()?;
193    let local_var_resp = local_var_client.execute(local_var_req).await?;
194
195    let local_var_status = local_var_resp.status();
196    let local_var_content = local_var_resp.text().await?;
197
198    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
199        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
200    } else {
201        let local_var_entity: Option<CreateConnectionError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
202        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
203        Err(Error::ResponseError(local_var_error))
204    }
205}
206
207pub async fn create_connection_type(configuration: &configuration::Configuration, workspace: &str, resource_type: models::ResourceType) -> Result<String, Error<CreateConnectionTypeError>> {
208    let local_var_configuration = configuration;
209
210    let local_var_client = &local_var_configuration.client;
211
212    let local_var_uri_str = format!("{}/w/{workspace}/connections/type/create", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
213    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
214
215    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
216        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
217    }
218    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
219        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
220    };
221    local_var_req_builder = local_var_req_builder.json(&resource_type);
222
223    let local_var_req = local_var_req_builder.build()?;
224    let local_var_resp = local_var_client.execute(local_var_req).await?;
225
226    let local_var_status = local_var_resp.status();
227    let local_var_content = local_var_resp.text().await?;
228
229    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
230        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
231    } else {
232        let local_var_entity: Option<CreateConnectionTypeError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
233        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
234        Err(Error::ResponseError(local_var_error))
235    }
236}
237
238pub async fn delete_connection(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<String, Error<DeleteConnectionError>> {
239    let local_var_configuration = configuration;
240
241    let local_var_client = &local_var_configuration.client;
242
243    let local_var_uri_str = format!("{}/w/{workspace}/connections/delete/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
244    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
245
246    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
247        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
248    }
249    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
250        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
251    };
252
253    let local_var_req = local_var_req_builder.build()?;
254    let local_var_resp = local_var_client.execute(local_var_req).await?;
255
256    let local_var_status = local_var_resp.status();
257    let local_var_content = local_var_resp.text().await?;
258
259    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
260        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
261    } else {
262        let local_var_entity: Option<DeleteConnectionError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
263        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
264        Err(Error::ResponseError(local_var_error))
265    }
266}
267
268pub async fn delete_connection_type(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<String, Error<DeleteConnectionTypeError>> {
269    let local_var_configuration = configuration;
270
271    let local_var_client = &local_var_configuration.client;
272
273    let local_var_uri_str = format!("{}/w/{workspace}/connections/type/delete/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
274    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
275
276    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
277        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
278    }
279    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
280        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
281    };
282
283    let local_var_req = local_var_req_builder.build()?;
284    let local_var_resp = local_var_client.execute(local_var_req).await?;
285
286    let local_var_status = local_var_resp.status();
287    let local_var_content = local_var_resp.text().await?;
288
289    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
290        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
291    } else {
292        let local_var_entity: Option<DeleteConnectionTypeError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
293        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
294        Err(Error::ResponseError(local_var_error))
295    }
296}
297
298pub async fn delete_connections_bulk(configuration: &configuration::Configuration, workspace: &str, delete_variables_bulk_request: models::DeleteVariablesBulkRequest) -> Result<Vec<String>, Error<DeleteConnectionsBulkError>> {
299    let local_var_configuration = configuration;
300
301    let local_var_client = &local_var_configuration.client;
302
303    let local_var_uri_str = format!("{}/w/{workspace}/connections/delete_bulk", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
304    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
305
306    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
307        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
308    }
309    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
310        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
311    };
312    local_var_req_builder = local_var_req_builder.json(&delete_variables_bulk_request);
313
314    let local_var_req = local_var_req_builder.build()?;
315    let local_var_resp = local_var_client.execute(local_var_req).await?;
316
317    let local_var_status = local_var_resp.status();
318    let local_var_content = local_var_resp.text().await?;
319
320    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
321        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
322    } else {
323        let local_var_entity: Option<DeleteConnectionsBulkError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
324        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
325        Err(Error::ResponseError(local_var_error))
326    }
327}
328
329pub async fn exists_connection(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<bool, Error<ExistsConnectionError>> {
330    let local_var_configuration = configuration;
331
332    let local_var_client = &local_var_configuration.client;
333
334    let local_var_uri_str = format!("{}/w/{workspace}/connections/exists/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
335    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
336
337    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
338        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
339    }
340    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
341        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
342    };
343
344    let local_var_req = local_var_req_builder.build()?;
345    let local_var_resp = local_var_client.execute(local_var_req).await?;
346
347    let local_var_status = local_var_resp.status();
348    let local_var_content = local_var_resp.text().await?;
349
350    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
351        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
352    } else {
353        let local_var_entity: Option<ExistsConnectionError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
354        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
355        Err(Error::ResponseError(local_var_error))
356    }
357}
358
359pub async fn exists_connection_type(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<bool, Error<ExistsConnectionTypeError>> {
360    let local_var_configuration = configuration;
361
362    let local_var_client = &local_var_configuration.client;
363
364    let local_var_uri_str = format!("{}/w/{workspace}/connections/type/exists/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
365    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
366
367    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
368        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
369    }
370    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
371        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
372    };
373
374    let local_var_req = local_var_req_builder.build()?;
375    let local_var_resp = local_var_client.execute(local_var_req).await?;
376
377    let local_var_status = local_var_resp.status();
378    let local_var_content = local_var_resp.text().await?;
379
380    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
381        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
382    } else {
383        let local_var_entity: Option<ExistsConnectionTypeError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
384        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
385        Err(Error::ResponseError(local_var_error))
386    }
387}
388
389pub async fn file_connection_type_to_file_ext_map(configuration: &configuration::Configuration, workspace: &str) -> Result<std::collections::HashMap<String, models::FileResourceTypeToFileExtMap200ResponseValue>, Error<FileConnectionTypeToFileExtMapError>> {
390    let local_var_configuration = configuration;
391
392    let local_var_client = &local_var_configuration.client;
393
394    let local_var_uri_str = format!("{}/w/{workspace}/connections/file_connection_type_to_file_ext_map", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
395    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
396
397    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
398        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
399    }
400    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
401        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
402    };
403
404    let local_var_req = local_var_req_builder.build()?;
405    let local_var_resp = local_var_client.execute(local_var_req).await?;
406
407    let local_var_status = local_var_resp.status();
408    let local_var_content = local_var_resp.text().await?;
409
410    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
411        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
412    } else {
413        let local_var_entity: Option<FileConnectionTypeToFileExtMapError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
414        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
415        Err(Error::ResponseError(local_var_error))
416    }
417}
418
419pub async fn get_connection(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<models::Resource, Error<GetConnectionError>> {
420    let local_var_configuration = configuration;
421
422    let local_var_client = &local_var_configuration.client;
423
424    let local_var_uri_str = format!("{}/w/{workspace}/connections/get/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
425    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
426
427    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
428        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
429    }
430    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
431        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
432    };
433
434    let local_var_req = local_var_req_builder.build()?;
435    let local_var_resp = local_var_client.execute(local_var_req).await?;
436
437    let local_var_status = local_var_resp.status();
438    let local_var_content = local_var_resp.text().await?;
439
440    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
441        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
442    } else {
443        let local_var_entity: Option<GetConnectionError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
444        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
445        Err(Error::ResponseError(local_var_error))
446    }
447}
448
449pub async fn get_connection_type(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<models::ResourceType, Error<GetConnectionTypeError>> {
450    let local_var_configuration = configuration;
451
452    let local_var_client = &local_var_configuration.client;
453
454    let local_var_uri_str = format!("{}/w/{workspace}/connections/type/get/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
455    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
456
457    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
458        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
459    }
460    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
461        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
462    };
463
464    let local_var_req = local_var_req_builder.build()?;
465    let local_var_resp = local_var_client.execute(local_var_req).await?;
466
467    let local_var_status = local_var_resp.status();
468    let local_var_content = local_var_resp.text().await?;
469
470    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
471        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
472    } else {
473        let local_var_entity: Option<GetConnectionTypeError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
474        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
475        Err(Error::ResponseError(local_var_error))
476    }
477}
478
479pub async fn get_connection_value(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<serde_json::Value, Error<GetConnectionValueError>> {
480    let local_var_configuration = configuration;
481
482    let local_var_client = &local_var_configuration.client;
483
484    let local_var_uri_str = format!("{}/w/{workspace}/connections/get_value/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
485    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
486
487    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
488        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
489    }
490    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
491        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
492    };
493
494    let local_var_req = local_var_req_builder.build()?;
495    let local_var_resp = local_var_client.execute(local_var_req).await?;
496
497    let local_var_status = local_var_resp.status();
498    let local_var_content = local_var_resp.text().await?;
499
500    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
501        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
502    } else {
503        let local_var_entity: Option<GetConnectionValueError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
504        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
505        Err(Error::ResponseError(local_var_error))
506    }
507}
508
509pub async fn get_connection_value_interpolated(configuration: &configuration::Configuration, workspace: &str, path: &str, job_id: Option<&str>, allow_cache: Option<bool>) -> Result<serde_json::Value, Error<GetConnectionValueInterpolatedError>> {
510    let local_var_configuration = configuration;
511
512    let local_var_client = &local_var_configuration.client;
513
514    let local_var_uri_str = format!("{}/w/{workspace}/connections/get_value_interpolated/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
515    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
516
517    if let Some(ref local_var_str) = job_id {
518        local_var_req_builder = local_var_req_builder.query(&[("job_id", &local_var_str.to_string())]);
519    }
520    if let Some(ref local_var_str) = allow_cache {
521        local_var_req_builder = local_var_req_builder.query(&[("allow_cache", &local_var_str.to_string())]);
522    }
523    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
524        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
525    }
526    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
527        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
528    };
529
530    let local_var_req = local_var_req_builder.build()?;
531    let local_var_resp = local_var_client.execute(local_var_req).await?;
532
533    let local_var_status = local_var_resp.status();
534    let local_var_content = local_var_resp.text().await?;
535
536    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
537        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
538    } else {
539        let local_var_entity: Option<GetConnectionValueInterpolatedError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
540        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
541        Err(Error::ResponseError(local_var_error))
542    }
543}
544
545pub async fn get_git_commit_hash_for_connection(configuration: &configuration::Configuration, workspace: &str, path: &str, git_ssh_identity: Option<&str>) -> Result<models::GetGitCommitHash200Response, Error<GetGitCommitHashForConnectionError>> {
546    let local_var_configuration = configuration;
547
548    let local_var_client = &local_var_configuration.client;
549
550    let local_var_uri_str = format!("{}/w/{workspace}/connections/git_commit_hash/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
551    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
552
553    if let Some(ref local_var_str) = git_ssh_identity {
554        local_var_req_builder = local_var_req_builder.query(&[("git_ssh_identity", &local_var_str.to_string())]);
555    }
556    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
557        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
558    }
559    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
560        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
561    };
562
563    let local_var_req = local_var_req_builder.build()?;
564    let local_var_resp = local_var_client.execute(local_var_req).await?;
565
566    let local_var_status = local_var_resp.status();
567    let local_var_content = local_var_resp.text().await?;
568
569    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
570        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
571    } else {
572        let local_var_entity: Option<GetGitCommitHashForConnectionError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
573        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
574        Err(Error::ResponseError(local_var_error))
575    }
576}
577
578pub async fn get_mcp_tools_for_connection(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<Vec<models::GetMcpTools200ResponseInner>, Error<GetMcpToolsForConnectionError>> {
579    let local_var_configuration = configuration;
580
581    let local_var_client = &local_var_configuration.client;
582
583    let local_var_uri_str = format!("{}/w/{workspace}/connections/mcp_tools/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
584    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
585
586    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
587        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
588    }
589    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
590        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
591    };
592
593    let local_var_req = local_var_req_builder.build()?;
594    let local_var_resp = local_var_client.execute(local_var_req).await?;
595
596    let local_var_status = local_var_resp.status();
597    let local_var_content = local_var_resp.text().await?;
598
599    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
600        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
601    } else {
602        let local_var_entity: Option<GetMcpToolsForConnectionError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
603        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
604        Err(Error::ResponseError(local_var_error))
605    }
606}
607
608pub async fn list_connection(configuration: &configuration::Configuration, workspace: &str, page: Option<i32>, per_page: Option<i32>, connection_type: Option<&str>, connection_type_exclude: Option<&str>, path_start: Option<&str>, path: Option<&str>, description: Option<&str>, value: Option<&str>, broad_filter: Option<&str>, label: Option<&str>) -> Result<Vec<models::ListableResource>, Error<ListConnectionError>> {
609    let local_var_configuration = configuration;
610
611    let local_var_client = &local_var_configuration.client;
612
613    let local_var_uri_str = format!("{}/w/{workspace}/connections/list", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
614    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
615
616    if let Some(ref local_var_str) = page {
617        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
618    }
619    if let Some(ref local_var_str) = per_page {
620        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
621    }
622    if let Some(ref local_var_str) = connection_type {
623        local_var_req_builder = local_var_req_builder.query(&[("connection_type", &local_var_str.to_string())]);
624    }
625    if let Some(ref local_var_str) = connection_type_exclude {
626        local_var_req_builder = local_var_req_builder.query(&[("connection_type_exclude", &local_var_str.to_string())]);
627    }
628    if let Some(ref local_var_str) = path_start {
629        local_var_req_builder = local_var_req_builder.query(&[("path_start", &local_var_str.to_string())]);
630    }
631    if let Some(ref local_var_str) = path {
632        local_var_req_builder = local_var_req_builder.query(&[("path", &local_var_str.to_string())]);
633    }
634    if let Some(ref local_var_str) = description {
635        local_var_req_builder = local_var_req_builder.query(&[("description", &local_var_str.to_string())]);
636    }
637    if let Some(ref local_var_str) = value {
638        local_var_req_builder = local_var_req_builder.query(&[("value", &local_var_str.to_string())]);
639    }
640    if let Some(ref local_var_str) = broad_filter {
641        local_var_req_builder = local_var_req_builder.query(&[("broad_filter", &local_var_str.to_string())]);
642    }
643    if let Some(ref local_var_str) = label {
644        local_var_req_builder = local_var_req_builder.query(&[("label", &local_var_str.to_string())]);
645    }
646    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
647        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
648    }
649    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
650        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
651    };
652
653    let local_var_req = local_var_req_builder.build()?;
654    let local_var_resp = local_var_client.execute(local_var_req).await?;
655
656    let local_var_status = local_var_resp.status();
657    let local_var_content = local_var_resp.text().await?;
658
659    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
660        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
661    } else {
662        let local_var_entity: Option<ListConnectionError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
663        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
664        Err(Error::ResponseError(local_var_error))
665    }
666}
667
668pub async fn list_connection_names(configuration: &configuration::Configuration, workspace: &str, name: &str) -> Result<Vec<models::ListResourceNames200ResponseInner>, Error<ListConnectionNamesError>> {
669    let local_var_configuration = configuration;
670
671    let local_var_client = &local_var_configuration.client;
672
673    let local_var_uri_str = format!("{}/w/{workspace}/connections/list_names/{name}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), name=crate::apis::urlencode(name));
674    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
675
676    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
677        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
678    }
679    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
680        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
681    };
682
683    let local_var_req = local_var_req_builder.build()?;
684    let local_var_resp = local_var_client.execute(local_var_req).await?;
685
686    let local_var_status = local_var_resp.status();
687    let local_var_content = local_var_resp.text().await?;
688
689    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
690        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
691    } else {
692        let local_var_entity: Option<ListConnectionNamesError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
693        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
694        Err(Error::ResponseError(local_var_error))
695    }
696}
697
698pub async fn list_connection_type(configuration: &configuration::Configuration, workspace: &str) -> Result<Vec<models::ResourceType>, Error<ListConnectionTypeError>> {
699    let local_var_configuration = configuration;
700
701    let local_var_client = &local_var_configuration.client;
702
703    let local_var_uri_str = format!("{}/w/{workspace}/connections/type/list", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
704    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
705
706    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
707        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
708    }
709    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
710        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
711    };
712
713    let local_var_req = local_var_req_builder.build()?;
714    let local_var_resp = local_var_client.execute(local_var_req).await?;
715
716    let local_var_status = local_var_resp.status();
717    let local_var_content = local_var_resp.text().await?;
718
719    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
720        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
721    } else {
722        let local_var_entity: Option<ListConnectionTypeError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
723        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
724        Err(Error::ResponseError(local_var_error))
725    }
726}
727
728pub async fn list_connection_type_names(configuration: &configuration::Configuration, workspace: &str) -> Result<Vec<String>, Error<ListConnectionTypeNamesError>> {
729    let local_var_configuration = configuration;
730
731    let local_var_client = &local_var_configuration.client;
732
733    let local_var_uri_str = format!("{}/w/{workspace}/connections/type/listnames", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
734    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
735
736    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
737        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
738    }
739    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
740        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
741    };
742
743    let local_var_req = local_var_req_builder.build()?;
744    let local_var_resp = local_var_client.execute(local_var_req).await?;
745
746    let local_var_status = local_var_resp.status();
747    let local_var_content = local_var_resp.text().await?;
748
749    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
750        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
751    } else {
752        let local_var_entity: Option<ListConnectionTypeNamesError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
753        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
754        Err(Error::ResponseError(local_var_error))
755    }
756}
757
758pub async fn list_search_connection(configuration: &configuration::Configuration, workspace: &str) -> Result<Vec<models::ListSearchResource200ResponseInner>, Error<ListSearchConnectionError>> {
759    let local_var_configuration = configuration;
760
761    let local_var_client = &local_var_configuration.client;
762
763    let local_var_uri_str = format!("{}/w/{workspace}/connections/list_search", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
764    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
765
766    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
767        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
768    }
769    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
770        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
771    };
772
773    let local_var_req = local_var_req_builder.build()?;
774    let local_var_resp = local_var_client.execute(local_var_req).await?;
775
776    let local_var_status = local_var_resp.status();
777    let local_var_content = local_var_resp.text().await?;
778
779    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
780        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
781    } else {
782        let local_var_entity: Option<ListSearchConnectionError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
783        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
784        Err(Error::ResponseError(local_var_error))
785    }
786}
787
788pub async fn update_connection(configuration: &configuration::Configuration, workspace: &str, path: &str, edit_resource: models::EditResource) -> Result<String, Error<UpdateConnectionError>> {
789    let local_var_configuration = configuration;
790
791    let local_var_client = &local_var_configuration.client;
792
793    let local_var_uri_str = format!("{}/w/{workspace}/connections/update/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
794    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
795
796    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
797        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
798    }
799    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
800        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
801    };
802    local_var_req_builder = local_var_req_builder.json(&edit_resource);
803
804    let local_var_req = local_var_req_builder.build()?;
805    let local_var_resp = local_var_client.execute(local_var_req).await?;
806
807    let local_var_status = local_var_resp.status();
808    let local_var_content = local_var_resp.text().await?;
809
810    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
811        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
812    } else {
813        let local_var_entity: Option<UpdateConnectionError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
814        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
815        Err(Error::ResponseError(local_var_error))
816    }
817}
818
819pub async fn update_connection_type(configuration: &configuration::Configuration, workspace: &str, path: &str, edit_resource_type: models::EditResourceType) -> Result<String, Error<UpdateConnectionTypeError>> {
820    let local_var_configuration = configuration;
821
822    let local_var_client = &local_var_configuration.client;
823
824    let local_var_uri_str = format!("{}/w/{workspace}/connections/type/update/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
825    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
826
827    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
828        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
829    }
830    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
831        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
832    };
833    local_var_req_builder = local_var_req_builder.json(&edit_resource_type);
834
835    let local_var_req = local_var_req_builder.build()?;
836    let local_var_resp = local_var_client.execute(local_var_req).await?;
837
838    let local_var_status = local_var_resp.status();
839    let local_var_content = local_var_resp.text().await?;
840
841    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
842        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
843    } else {
844        let local_var_entity: Option<UpdateConnectionTypeError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
845        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
846        Err(Error::ResponseError(local_var_error))
847    }
848}
849
850pub async fn update_connection_value(configuration: &configuration::Configuration, workspace: &str, path: &str, set_global_request: models::SetGlobalRequest) -> Result<String, Error<UpdateConnectionValueError>> {
851    let local_var_configuration = configuration;
852
853    let local_var_client = &local_var_configuration.client;
854
855    let local_var_uri_str = format!("{}/w/{workspace}/connections/update_value/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
856    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
857
858    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
859        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
860    }
861    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
862        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
863    };
864    local_var_req_builder = local_var_req_builder.json(&set_global_request);
865
866    let local_var_req = local_var_req_builder.build()?;
867    let local_var_resp = local_var_client.execute(local_var_req).await?;
868
869    let local_var_status = local_var_resp.status();
870    let local_var_content = local_var_resp.text().await?;
871
872    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
873        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
874    } else {
875        let local_var_entity: Option<UpdateConnectionValueError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
876        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
877        Err(Error::ResponseError(local_var_error))
878    }
879}
880