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