windmill_api/apis/
setting_api.rs

1/*
2 * Windmill 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.614.0
7 * Contact: contact@windmill.dev
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 [`acknowledge_all_critical_alerts`]
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum AcknowledgeAllCriticalAlertsError {
22    UnknownValue(serde_json::Value),
23}
24
25/// struct for typed errors of method [`acknowledge_critical_alert`]
26#[derive(Debug, Clone, Serialize, Deserialize)]
27#[serde(untagged)]
28pub enum AcknowledgeCriticalAlertError {
29    UnknownValue(serde_json::Value),
30}
31
32/// struct for typed errors of method [`create_customer_portal_session`]
33#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum CreateCustomerPortalSessionError {
36    UnknownValue(serde_json::Value),
37}
38
39/// struct for typed errors of method [`get_critical_alerts`]
40#[derive(Debug, Clone, Serialize, Deserialize)]
41#[serde(untagged)]
42pub enum GetCriticalAlertsError {
43    UnknownValue(serde_json::Value),
44}
45
46/// struct for typed errors of method [`get_global`]
47#[derive(Debug, Clone, Serialize, Deserialize)]
48#[serde(untagged)]
49pub enum GetGlobalError {
50    UnknownValue(serde_json::Value),
51}
52
53/// struct for typed errors of method [`get_jwks`]
54#[derive(Debug, Clone, Serialize, Deserialize)]
55#[serde(untagged)]
56pub enum GetJwksError {
57    UnknownValue(serde_json::Value),
58}
59
60/// struct for typed errors of method [`get_latest_key_renewal_attempt`]
61#[derive(Debug, Clone, Serialize, Deserialize)]
62#[serde(untagged)]
63pub enum GetLatestKeyRenewalAttemptError {
64    UnknownValue(serde_json::Value),
65}
66
67/// struct for typed errors of method [`get_local`]
68#[derive(Debug, Clone, Serialize, Deserialize)]
69#[serde(untagged)]
70pub enum GetLocalError {
71    UnknownValue(serde_json::Value),
72}
73
74/// struct for typed errors of method [`get_min_keep_alive_version`]
75#[derive(Debug, Clone, Serialize, Deserialize)]
76#[serde(untagged)]
77pub enum GetMinKeepAliveVersionError {
78    UnknownValue(serde_json::Value),
79}
80
81/// struct for typed errors of method [`get_secondary_storage_names`]
82#[derive(Debug, Clone, Serialize, Deserialize)]
83#[serde(untagged)]
84pub enum GetSecondaryStorageNamesError {
85    UnknownValue(serde_json::Value),
86}
87
88/// struct for typed errors of method [`list_custom_instance_dbs`]
89#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum ListCustomInstanceDbsError {
92    UnknownValue(serde_json::Value),
93}
94
95/// struct for typed errors of method [`list_global_settings`]
96#[derive(Debug, Clone, Serialize, Deserialize)]
97#[serde(untagged)]
98pub enum ListGlobalSettingsError {
99    UnknownValue(serde_json::Value),
100}
101
102/// struct for typed errors of method [`migrate_secrets_to_database`]
103#[derive(Debug, Clone, Serialize, Deserialize)]
104#[serde(untagged)]
105pub enum MigrateSecretsToDatabaseError {
106    UnknownValue(serde_json::Value),
107}
108
109/// struct for typed errors of method [`migrate_secrets_to_vault`]
110#[derive(Debug, Clone, Serialize, Deserialize)]
111#[serde(untagged)]
112pub enum MigrateSecretsToVaultError {
113    UnknownValue(serde_json::Value),
114}
115
116/// struct for typed errors of method [`refresh_custom_instance_user_pwd`]
117#[derive(Debug, Clone, Serialize, Deserialize)]
118#[serde(untagged)]
119pub enum RefreshCustomInstanceUserPwdError {
120    UnknownValue(serde_json::Value),
121}
122
123/// struct for typed errors of method [`renew_license_key`]
124#[derive(Debug, Clone, Serialize, Deserialize)]
125#[serde(untagged)]
126pub enum RenewLicenseKeyError {
127    UnknownValue(serde_json::Value),
128}
129
130/// struct for typed errors of method [`send_stats`]
131#[derive(Debug, Clone, Serialize, Deserialize)]
132#[serde(untagged)]
133pub enum SendStatsError {
134    UnknownValue(serde_json::Value),
135}
136
137/// struct for typed errors of method [`set_global`]
138#[derive(Debug, Clone, Serialize, Deserialize)]
139#[serde(untagged)]
140pub enum SetGlobalError {
141    UnknownValue(serde_json::Value),
142}
143
144/// struct for typed errors of method [`setup_custom_instance_db`]
145#[derive(Debug, Clone, Serialize, Deserialize)]
146#[serde(untagged)]
147pub enum SetupCustomInstanceDbError {
148    UnknownValue(serde_json::Value),
149}
150
151/// struct for typed errors of method [`test_critical_channels`]
152#[derive(Debug, Clone, Serialize, Deserialize)]
153#[serde(untagged)]
154pub enum TestCriticalChannelsError {
155    UnknownValue(serde_json::Value),
156}
157
158/// struct for typed errors of method [`test_license_key`]
159#[derive(Debug, Clone, Serialize, Deserialize)]
160#[serde(untagged)]
161pub enum TestLicenseKeyError {
162    UnknownValue(serde_json::Value),
163}
164
165/// struct for typed errors of method [`test_metadata`]
166#[derive(Debug, Clone, Serialize, Deserialize)]
167#[serde(untagged)]
168pub enum TestMetadataError {
169    UnknownValue(serde_json::Value),
170}
171
172/// struct for typed errors of method [`test_object_storage_config`]
173#[derive(Debug, Clone, Serialize, Deserialize)]
174#[serde(untagged)]
175pub enum TestObjectStorageConfigError {
176    UnknownValue(serde_json::Value),
177}
178
179/// struct for typed errors of method [`test_secret_backend`]
180#[derive(Debug, Clone, Serialize, Deserialize)]
181#[serde(untagged)]
182pub enum TestSecretBackendError {
183    UnknownValue(serde_json::Value),
184}
185
186/// struct for typed errors of method [`test_smtp`]
187#[derive(Debug, Clone, Serialize, Deserialize)]
188#[serde(untagged)]
189pub enum TestSmtpError {
190    UnknownValue(serde_json::Value),
191}
192
193/// struct for typed errors of method [`workspace_acknowledge_all_critical_alerts`]
194#[derive(Debug, Clone, Serialize, Deserialize)]
195#[serde(untagged)]
196pub enum WorkspaceAcknowledgeAllCriticalAlertsError {
197    UnknownValue(serde_json::Value),
198}
199
200/// struct for typed errors of method [`workspace_acknowledge_critical_alert`]
201#[derive(Debug, Clone, Serialize, Deserialize)]
202#[serde(untagged)]
203pub enum WorkspaceAcknowledgeCriticalAlertError {
204    UnknownValue(serde_json::Value),
205}
206
207/// struct for typed errors of method [`workspace_get_critical_alerts`]
208#[derive(Debug, Clone, Serialize, Deserialize)]
209#[serde(untagged)]
210pub enum WorkspaceGetCriticalAlertsError {
211    UnknownValue(serde_json::Value),
212}
213
214/// struct for typed errors of method [`workspace_mute_critical_alerts_ui`]
215#[derive(Debug, Clone, Serialize, Deserialize)]
216#[serde(untagged)]
217pub enum WorkspaceMuteCriticalAlertsUiError {
218    UnknownValue(serde_json::Value),
219}
220
221
222pub async fn acknowledge_all_critical_alerts(configuration: &configuration::Configuration, ) -> Result<String, Error<AcknowledgeAllCriticalAlertsError>> {
223    let local_var_configuration = configuration;
224
225    let local_var_client = &local_var_configuration.client;
226
227    let local_var_uri_str = format!("{}/settings/critical_alerts/acknowledge_all", local_var_configuration.base_path);
228    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
229
230    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
231        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
232    }
233    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
234        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
235    };
236
237    let local_var_req = local_var_req_builder.build()?;
238    let local_var_resp = local_var_client.execute(local_var_req).await?;
239
240    let local_var_status = local_var_resp.status();
241    let local_var_content = local_var_resp.text().await?;
242
243    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
244        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
245    } else {
246        let local_var_entity: Option<AcknowledgeAllCriticalAlertsError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
247        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
248        Err(Error::ResponseError(local_var_error))
249    }
250}
251
252pub async fn acknowledge_critical_alert(configuration: &configuration::Configuration, id: i32) -> Result<String, Error<AcknowledgeCriticalAlertError>> {
253    let local_var_configuration = configuration;
254
255    let local_var_client = &local_var_configuration.client;
256
257    let local_var_uri_str = format!("{}/settings/critical_alerts/{id}/acknowledge", local_var_configuration.base_path, id=id);
258    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
259
260    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
261        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
262    }
263    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
264        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
265    };
266
267    let local_var_req = local_var_req_builder.build()?;
268    let local_var_resp = local_var_client.execute(local_var_req).await?;
269
270    let local_var_status = local_var_resp.status();
271    let local_var_content = local_var_resp.text().await?;
272
273    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
274        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
275    } else {
276        let local_var_entity: Option<AcknowledgeCriticalAlertError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
277        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
278        Err(Error::ResponseError(local_var_error))
279    }
280}
281
282pub async fn create_customer_portal_session(configuration: &configuration::Configuration, license_key: Option<&str>) -> Result<String, Error<CreateCustomerPortalSessionError>> {
283    let local_var_configuration = configuration;
284
285    let local_var_client = &local_var_configuration.client;
286
287    let local_var_uri_str = format!("{}/settings/customer_portal", local_var_configuration.base_path);
288    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
289
290    if let Some(ref local_var_str) = license_key {
291        local_var_req_builder = local_var_req_builder.query(&[("license_key", &local_var_str.to_string())]);
292    }
293    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
294        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
295    }
296    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
297        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
298    };
299
300    let local_var_req = local_var_req_builder.build()?;
301    let local_var_resp = local_var_client.execute(local_var_req).await?;
302
303    let local_var_status = local_var_resp.status();
304    let local_var_content = local_var_resp.text().await?;
305
306    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
307        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
308    } else {
309        let local_var_entity: Option<CreateCustomerPortalSessionError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
310        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
311        Err(Error::ResponseError(local_var_error))
312    }
313}
314
315pub async fn get_critical_alerts(configuration: &configuration::Configuration, page: Option<i32>, page_size: Option<i32>, acknowledged: Option<bool>) -> Result<models::GetCriticalAlerts200Response, Error<GetCriticalAlertsError>> {
316    let local_var_configuration = configuration;
317
318    let local_var_client = &local_var_configuration.client;
319
320    let local_var_uri_str = format!("{}/settings/critical_alerts", local_var_configuration.base_path);
321    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
322
323    if let Some(ref local_var_str) = page {
324        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
325    }
326    if let Some(ref local_var_str) = page_size {
327        local_var_req_builder = local_var_req_builder.query(&[("page_size", &local_var_str.to_string())]);
328    }
329    if let Some(ref local_var_str) = acknowledged {
330        local_var_req_builder = local_var_req_builder.query(&[("acknowledged", &local_var_str.to_string())]);
331    }
332    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
333        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
334    }
335    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
336        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
337    };
338
339    let local_var_req = local_var_req_builder.build()?;
340    let local_var_resp = local_var_client.execute(local_var_req).await?;
341
342    let local_var_status = local_var_resp.status();
343    let local_var_content = local_var_resp.text().await?;
344
345    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
346        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
347    } else {
348        let local_var_entity: Option<GetCriticalAlertsError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
349        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
350        Err(Error::ResponseError(local_var_error))
351    }
352}
353
354pub async fn get_global(configuration: &configuration::Configuration, key: &str) -> Result<serde_json::Value, Error<GetGlobalError>> {
355    let local_var_configuration = configuration;
356
357    let local_var_client = &local_var_configuration.client;
358
359    let local_var_uri_str = format!("{}/settings/global/{key}", local_var_configuration.base_path, key=crate::apis::urlencode(key));
360    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
361
362    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
363        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
364    }
365    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
366        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
367    };
368
369    let local_var_req = local_var_req_builder.build()?;
370    let local_var_resp = local_var_client.execute(local_var_req).await?;
371
372    let local_var_status = local_var_resp.status();
373    let local_var_content = local_var_resp.text().await?;
374
375    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
376        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
377    } else {
378        let local_var_entity: Option<GetGlobalError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
379        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
380        Err(Error::ResponseError(local_var_error))
381    }
382}
383
384pub async fn get_jwks(configuration: &configuration::Configuration, ) -> Result<models::JwksResponse, Error<GetJwksError>> {
385    let local_var_configuration = configuration;
386
387    let local_var_client = &local_var_configuration.client;
388
389    let local_var_uri_str = format!("{}/.well-known/jwks.json", local_var_configuration.base_path);
390    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
391
392    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
393        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
394    }
395    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
396        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
397    };
398
399    let local_var_req = local_var_req_builder.build()?;
400    let local_var_resp = local_var_client.execute(local_var_req).await?;
401
402    let local_var_status = local_var_resp.status();
403    let local_var_content = local_var_resp.text().await?;
404
405    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
406        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
407    } else {
408        let local_var_entity: Option<GetJwksError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
409        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
410        Err(Error::ResponseError(local_var_error))
411    }
412}
413
414pub async fn get_latest_key_renewal_attempt(configuration: &configuration::Configuration, ) -> Result<models::GetLatestKeyRenewalAttempt200Response, Error<GetLatestKeyRenewalAttemptError>> {
415    let local_var_configuration = configuration;
416
417    let local_var_client = &local_var_configuration.client;
418
419    let local_var_uri_str = format!("{}/settings/latest_key_renewal_attempt", local_var_configuration.base_path);
420    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
421
422    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
423        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
424    }
425    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
426        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
427    };
428
429    let local_var_req = local_var_req_builder.build()?;
430    let local_var_resp = local_var_client.execute(local_var_req).await?;
431
432    let local_var_status = local_var_resp.status();
433    let local_var_content = local_var_resp.text().await?;
434
435    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
436        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
437    } else {
438        let local_var_entity: Option<GetLatestKeyRenewalAttemptError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
439        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
440        Err(Error::ResponseError(local_var_error))
441    }
442}
443
444pub async fn get_local(configuration: &configuration::Configuration, ) -> Result<serde_json::Value, Error<GetLocalError>> {
445    let local_var_configuration = configuration;
446
447    let local_var_client = &local_var_configuration.client;
448
449    let local_var_uri_str = format!("{}/settings/local", local_var_configuration.base_path);
450    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
451
452    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
453        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
454    }
455    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
456        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
457    };
458
459    let local_var_req = local_var_req_builder.build()?;
460    let local_var_resp = local_var_client.execute(local_var_req).await?;
461
462    let local_var_status = local_var_resp.status();
463    let local_var_content = local_var_resp.text().await?;
464
465    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
466        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
467    } else {
468        let local_var_entity: Option<GetLocalError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
469        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
470        Err(Error::ResponseError(local_var_error))
471    }
472}
473
474pub async fn get_min_keep_alive_version(configuration: &configuration::Configuration, ) -> Result<String, Error<GetMinKeepAliveVersionError>> {
475    let local_var_configuration = configuration;
476
477    let local_var_client = &local_var_configuration.client;
478
479    let local_var_uri_str = format!("{}/min_keep_alive_version", local_var_configuration.base_path);
480    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
481
482    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
483        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
484    }
485    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
486        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
487    };
488
489    let local_var_req = local_var_req_builder.build()?;
490    let local_var_resp = local_var_client.execute(local_var_req).await?;
491
492    let local_var_status = local_var_resp.status();
493    let local_var_content = local_var_resp.text().await?;
494
495    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
496        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
497    } else {
498        let local_var_entity: Option<GetMinKeepAliveVersionError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
499        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
500        Err(Error::ResponseError(local_var_error))
501    }
502}
503
504pub async fn get_secondary_storage_names(configuration: &configuration::Configuration, workspace: &str) -> Result<Vec<String>, Error<GetSecondaryStorageNamesError>> {
505    let local_var_configuration = configuration;
506
507    let local_var_client = &local_var_configuration.client;
508
509    let local_var_uri_str = format!("{}/w/{workspace}/workspaces/get_secondary_storage_names", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
510    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
511
512    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
513        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
514    }
515    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
516        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
517    };
518
519    let local_var_req = local_var_req_builder.build()?;
520    let local_var_resp = local_var_client.execute(local_var_req).await?;
521
522    let local_var_status = local_var_resp.status();
523    let local_var_content = local_var_resp.text().await?;
524
525    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
526        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
527    } else {
528        let local_var_entity: Option<GetSecondaryStorageNamesError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
529        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
530        Err(Error::ResponseError(local_var_error))
531    }
532}
533
534pub async fn list_custom_instance_dbs(configuration: &configuration::Configuration, ) -> Result<std::collections::HashMap<String, models::CustomInstanceDb>, Error<ListCustomInstanceDbsError>> {
535    let local_var_configuration = configuration;
536
537    let local_var_client = &local_var_configuration.client;
538
539    let local_var_uri_str = format!("{}/settings/list_custom_instance_pg_databases", local_var_configuration.base_path);
540    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
541
542    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
543        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
544    }
545    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
546        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
547    };
548
549    let local_var_req = local_var_req_builder.build()?;
550    let local_var_resp = local_var_client.execute(local_var_req).await?;
551
552    let local_var_status = local_var_resp.status();
553    let local_var_content = local_var_resp.text().await?;
554
555    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
556        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
557    } else {
558        let local_var_entity: Option<ListCustomInstanceDbsError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
559        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
560        Err(Error::ResponseError(local_var_error))
561    }
562}
563
564pub async fn list_global_settings(configuration: &configuration::Configuration, ) -> Result<Vec<models::GlobalSetting>, Error<ListGlobalSettingsError>> {
565    let local_var_configuration = configuration;
566
567    let local_var_client = &local_var_configuration.client;
568
569    let local_var_uri_str = format!("{}/settings/list_global", local_var_configuration.base_path);
570    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
571
572    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
573        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
574    }
575    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
576        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
577    };
578
579    let local_var_req = local_var_req_builder.build()?;
580    let local_var_resp = local_var_client.execute(local_var_req).await?;
581
582    let local_var_status = local_var_resp.status();
583    let local_var_content = local_var_resp.text().await?;
584
585    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
586        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
587    } else {
588        let local_var_entity: Option<ListGlobalSettingsError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
589        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
590        Err(Error::ResponseError(local_var_error))
591    }
592}
593
594pub async fn migrate_secrets_to_database(configuration: &configuration::Configuration, vault_settings: models::VaultSettings) -> Result<models::SecretMigrationReport, Error<MigrateSecretsToDatabaseError>> {
595    let local_var_configuration = configuration;
596
597    let local_var_client = &local_var_configuration.client;
598
599    let local_var_uri_str = format!("{}/settings/migrate_secrets_to_database", local_var_configuration.base_path);
600    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
601
602    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
603        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
604    }
605    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
606        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
607    };
608    local_var_req_builder = local_var_req_builder.json(&vault_settings);
609
610    let local_var_req = local_var_req_builder.build()?;
611    let local_var_resp = local_var_client.execute(local_var_req).await?;
612
613    let local_var_status = local_var_resp.status();
614    let local_var_content = local_var_resp.text().await?;
615
616    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
617        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
618    } else {
619        let local_var_entity: Option<MigrateSecretsToDatabaseError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
620        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
621        Err(Error::ResponseError(local_var_error))
622    }
623}
624
625pub async fn migrate_secrets_to_vault(configuration: &configuration::Configuration, vault_settings: models::VaultSettings) -> Result<models::SecretMigrationReport, Error<MigrateSecretsToVaultError>> {
626    let local_var_configuration = configuration;
627
628    let local_var_client = &local_var_configuration.client;
629
630    let local_var_uri_str = format!("{}/settings/migrate_secrets_to_vault", local_var_configuration.base_path);
631    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
632
633    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
634        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
635    }
636    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
637        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
638    };
639    local_var_req_builder = local_var_req_builder.json(&vault_settings);
640
641    let local_var_req = local_var_req_builder.build()?;
642    let local_var_resp = local_var_client.execute(local_var_req).await?;
643
644    let local_var_status = local_var_resp.status();
645    let local_var_content = local_var_resp.text().await?;
646
647    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
648        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
649    } else {
650        let local_var_entity: Option<MigrateSecretsToVaultError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
651        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
652        Err(Error::ResponseError(local_var_error))
653    }
654}
655
656pub async fn refresh_custom_instance_user_pwd(configuration: &configuration::Configuration, ) -> Result<serde_json::Value, Error<RefreshCustomInstanceUserPwdError>> {
657    let local_var_configuration = configuration;
658
659    let local_var_client = &local_var_configuration.client;
660
661    let local_var_uri_str = format!("{}/settings/refresh_custom_instance_user_pwd", local_var_configuration.base_path);
662    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
663
664    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
665        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
666    }
667    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
668        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
669    };
670
671    let local_var_req = local_var_req_builder.build()?;
672    let local_var_resp = local_var_client.execute(local_var_req).await?;
673
674    let local_var_status = local_var_resp.status();
675    let local_var_content = local_var_resp.text().await?;
676
677    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
678        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
679    } else {
680        let local_var_entity: Option<RefreshCustomInstanceUserPwdError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
681        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
682        Err(Error::ResponseError(local_var_error))
683    }
684}
685
686pub async fn renew_license_key(configuration: &configuration::Configuration, license_key: Option<&str>) -> Result<String, Error<RenewLicenseKeyError>> {
687    let local_var_configuration = configuration;
688
689    let local_var_client = &local_var_configuration.client;
690
691    let local_var_uri_str = format!("{}/settings/renew_license_key", local_var_configuration.base_path);
692    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
693
694    if let Some(ref local_var_str) = license_key {
695        local_var_req_builder = local_var_req_builder.query(&[("license_key", &local_var_str.to_string())]);
696    }
697    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
698        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
699    }
700    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
701        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
702    };
703
704    let local_var_req = local_var_req_builder.build()?;
705    let local_var_resp = local_var_client.execute(local_var_req).await?;
706
707    let local_var_status = local_var_resp.status();
708    let local_var_content = local_var_resp.text().await?;
709
710    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
711        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
712    } else {
713        let local_var_entity: Option<RenewLicenseKeyError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
714        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
715        Err(Error::ResponseError(local_var_error))
716    }
717}
718
719pub async fn send_stats(configuration: &configuration::Configuration, ) -> Result<String, Error<SendStatsError>> {
720    let local_var_configuration = configuration;
721
722    let local_var_client = &local_var_configuration.client;
723
724    let local_var_uri_str = format!("{}/settings/send_stats", local_var_configuration.base_path);
725    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
726
727    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
728        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
729    }
730    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
731        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
732    };
733
734    let local_var_req = local_var_req_builder.build()?;
735    let local_var_resp = local_var_client.execute(local_var_req).await?;
736
737    let local_var_status = local_var_resp.status();
738    let local_var_content = local_var_resp.text().await?;
739
740    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
741        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
742    } else {
743        let local_var_entity: Option<SendStatsError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
744        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
745        Err(Error::ResponseError(local_var_error))
746    }
747}
748
749pub async fn set_global(configuration: &configuration::Configuration, key: &str, set_global_request: models::SetGlobalRequest) -> Result<String, Error<SetGlobalError>> {
750    let local_var_configuration = configuration;
751
752    let local_var_client = &local_var_configuration.client;
753
754    let local_var_uri_str = format!("{}/settings/global/{key}", local_var_configuration.base_path, key=crate::apis::urlencode(key));
755    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
756
757    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
758        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
759    }
760    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
761        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
762    };
763    local_var_req_builder = local_var_req_builder.json(&set_global_request);
764
765    let local_var_req = local_var_req_builder.build()?;
766    let local_var_resp = local_var_client.execute(local_var_req).await?;
767
768    let local_var_status = local_var_resp.status();
769    let local_var_content = local_var_resp.text().await?;
770
771    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
772        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
773    } else {
774        let local_var_entity: Option<SetGlobalError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
775        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
776        Err(Error::ResponseError(local_var_error))
777    }
778}
779
780pub async fn setup_custom_instance_db(configuration: &configuration::Configuration, name: &str, setup_custom_instance_db_request: models::SetupCustomInstanceDbRequest) -> Result<models::CustomInstanceDb, Error<SetupCustomInstanceDbError>> {
781    let local_var_configuration = configuration;
782
783    let local_var_client = &local_var_configuration.client;
784
785    let local_var_uri_str = format!("{}/settings/setup_custom_instance_pg_database/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name));
786    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
787
788    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
789        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
790    }
791    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
792        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
793    };
794    local_var_req_builder = local_var_req_builder.json(&setup_custom_instance_db_request);
795
796    let local_var_req = local_var_req_builder.build()?;
797    let local_var_resp = local_var_client.execute(local_var_req).await?;
798
799    let local_var_status = local_var_resp.status();
800    let local_var_content = local_var_resp.text().await?;
801
802    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
803        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
804    } else {
805        let local_var_entity: Option<SetupCustomInstanceDbError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
806        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
807        Err(Error::ResponseError(local_var_error))
808    }
809}
810
811pub async fn test_critical_channels(configuration: &configuration::Configuration, test_critical_channels_request_inner: Vec<models::TestCriticalChannelsRequestInner>) -> Result<String, Error<TestCriticalChannelsError>> {
812    let local_var_configuration = configuration;
813
814    let local_var_client = &local_var_configuration.client;
815
816    let local_var_uri_str = format!("{}/settings/test_critical_channels", local_var_configuration.base_path);
817    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
818
819    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
820        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
821    }
822    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
823        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
824    };
825    local_var_req_builder = local_var_req_builder.json(&test_critical_channels_request_inner);
826
827    let local_var_req = local_var_req_builder.build()?;
828    let local_var_resp = local_var_client.execute(local_var_req).await?;
829
830    let local_var_status = local_var_resp.status();
831    let local_var_content = local_var_resp.text().await?;
832
833    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
834        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
835    } else {
836        let local_var_entity: Option<TestCriticalChannelsError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
837        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
838        Err(Error::ResponseError(local_var_error))
839    }
840}
841
842pub async fn test_license_key(configuration: &configuration::Configuration, test_license_key_request: models::TestLicenseKeyRequest) -> Result<String, Error<TestLicenseKeyError>> {
843    let local_var_configuration = configuration;
844
845    let local_var_client = &local_var_configuration.client;
846
847    let local_var_uri_str = format!("{}/settings/test_license_key", local_var_configuration.base_path);
848    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
849
850    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
851        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
852    }
853    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
854        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
855    };
856    local_var_req_builder = local_var_req_builder.json(&test_license_key_request);
857
858    let local_var_req = local_var_req_builder.build()?;
859    let local_var_resp = local_var_client.execute(local_var_req).await?;
860
861    let local_var_status = local_var_resp.status();
862    let local_var_content = local_var_resp.text().await?;
863
864    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
865        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
866    } else {
867        let local_var_entity: Option<TestLicenseKeyError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
868        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
869        Err(Error::ResponseError(local_var_error))
870    }
871}
872
873pub async fn test_metadata(configuration: &configuration::Configuration, body: &str) -> Result<String, Error<TestMetadataError>> {
874    let local_var_configuration = configuration;
875
876    let local_var_client = &local_var_configuration.client;
877
878    let local_var_uri_str = format!("{}/saml/test_metadata", local_var_configuration.base_path);
879    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
880
881    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
882        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
883    }
884    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
885        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
886    };
887    local_var_req_builder = local_var_req_builder.json(&body);
888
889    let local_var_req = local_var_req_builder.build()?;
890    let local_var_resp = local_var_client.execute(local_var_req).await?;
891
892    let local_var_status = local_var_resp.status();
893    let local_var_content = local_var_resp.text().await?;
894
895    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
896        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
897    } else {
898        let local_var_entity: Option<TestMetadataError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
899        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
900        Err(Error::ResponseError(local_var_error))
901    }
902}
903
904pub async fn test_object_storage_config(configuration: &configuration::Configuration, request_body: std::collections::HashMap<String, serde_json::Value>) -> Result<String, Error<TestObjectStorageConfigError>> {
905    let local_var_configuration = configuration;
906
907    let local_var_client = &local_var_configuration.client;
908
909    let local_var_uri_str = format!("{}/settings/test_object_storage_config", local_var_configuration.base_path);
910    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
911
912    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
913        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
914    }
915    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
916        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
917    };
918    local_var_req_builder = local_var_req_builder.json(&request_body);
919
920    let local_var_req = local_var_req_builder.build()?;
921    let local_var_resp = local_var_client.execute(local_var_req).await?;
922
923    let local_var_status = local_var_resp.status();
924    let local_var_content = local_var_resp.text().await?;
925
926    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
927        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
928    } else {
929        let local_var_entity: Option<TestObjectStorageConfigError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
930        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
931        Err(Error::ResponseError(local_var_error))
932    }
933}
934
935pub async fn test_secret_backend(configuration: &configuration::Configuration, vault_settings: models::VaultSettings) -> Result<String, Error<TestSecretBackendError>> {
936    let local_var_configuration = configuration;
937
938    let local_var_client = &local_var_configuration.client;
939
940    let local_var_uri_str = format!("{}/settings/test_secret_backend", local_var_configuration.base_path);
941    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
942
943    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
944        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
945    }
946    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
947        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
948    };
949    local_var_req_builder = local_var_req_builder.json(&vault_settings);
950
951    let local_var_req = local_var_req_builder.build()?;
952    let local_var_resp = local_var_client.execute(local_var_req).await?;
953
954    let local_var_status = local_var_resp.status();
955    let local_var_content = local_var_resp.text().await?;
956
957    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
958        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
959    } else {
960        let local_var_entity: Option<TestSecretBackendError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
961        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
962        Err(Error::ResponseError(local_var_error))
963    }
964}
965
966pub async fn test_smtp(configuration: &configuration::Configuration, test_smtp_request: models::TestSmtpRequest) -> Result<String, Error<TestSmtpError>> {
967    let local_var_configuration = configuration;
968
969    let local_var_client = &local_var_configuration.client;
970
971    let local_var_uri_str = format!("{}/settings/test_smtp", local_var_configuration.base_path);
972    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
973
974    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
975        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
976    }
977    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
978        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
979    };
980    local_var_req_builder = local_var_req_builder.json(&test_smtp_request);
981
982    let local_var_req = local_var_req_builder.build()?;
983    let local_var_resp = local_var_client.execute(local_var_req).await?;
984
985    let local_var_status = local_var_resp.status();
986    let local_var_content = local_var_resp.text().await?;
987
988    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
989        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
990    } else {
991        let local_var_entity: Option<TestSmtpError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
992        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
993        Err(Error::ResponseError(local_var_error))
994    }
995}
996
997pub async fn workspace_acknowledge_all_critical_alerts(configuration: &configuration::Configuration, workspace: &str) -> Result<String, Error<WorkspaceAcknowledgeAllCriticalAlertsError>> {
998    let local_var_configuration = configuration;
999
1000    let local_var_client = &local_var_configuration.client;
1001
1002    let local_var_uri_str = format!("{}/w/{workspace}/workspaces/critical_alerts/acknowledge_all", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
1003    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1004
1005    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1006        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1007    }
1008    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1009        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1010    };
1011
1012    let local_var_req = local_var_req_builder.build()?;
1013    let local_var_resp = local_var_client.execute(local_var_req).await?;
1014
1015    let local_var_status = local_var_resp.status();
1016    let local_var_content = local_var_resp.text().await?;
1017
1018    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1019        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1020    } else {
1021        let local_var_entity: Option<WorkspaceAcknowledgeAllCriticalAlertsError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1022        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1023        Err(Error::ResponseError(local_var_error))
1024    }
1025}
1026
1027pub async fn workspace_acknowledge_critical_alert(configuration: &configuration::Configuration, workspace: &str, id: i32) -> Result<String, Error<WorkspaceAcknowledgeCriticalAlertError>> {
1028    let local_var_configuration = configuration;
1029
1030    let local_var_client = &local_var_configuration.client;
1031
1032    let local_var_uri_str = format!("{}/w/{workspace}/workspaces/critical_alerts/{id}/acknowledge", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), id=id);
1033    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1034
1035    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1036        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1037    }
1038    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1039        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1040    };
1041
1042    let local_var_req = local_var_req_builder.build()?;
1043    let local_var_resp = local_var_client.execute(local_var_req).await?;
1044
1045    let local_var_status = local_var_resp.status();
1046    let local_var_content = local_var_resp.text().await?;
1047
1048    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1049        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1050    } else {
1051        let local_var_entity: Option<WorkspaceAcknowledgeCriticalAlertError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1052        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1053        Err(Error::ResponseError(local_var_error))
1054    }
1055}
1056
1057pub async fn workspace_get_critical_alerts(configuration: &configuration::Configuration, workspace: &str, page: Option<i32>, page_size: Option<i32>, acknowledged: Option<bool>) -> Result<models::GetCriticalAlerts200Response, Error<WorkspaceGetCriticalAlertsError>> {
1058    let local_var_configuration = configuration;
1059
1060    let local_var_client = &local_var_configuration.client;
1061
1062    let local_var_uri_str = format!("{}/w/{workspace}/workspaces/critical_alerts", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
1063    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1064
1065    if let Some(ref local_var_str) = page {
1066        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1067    }
1068    if let Some(ref local_var_str) = page_size {
1069        local_var_req_builder = local_var_req_builder.query(&[("page_size", &local_var_str.to_string())]);
1070    }
1071    if let Some(ref local_var_str) = acknowledged {
1072        local_var_req_builder = local_var_req_builder.query(&[("acknowledged", &local_var_str.to_string())]);
1073    }
1074    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1075        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1076    }
1077    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1078        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1079    };
1080
1081    let local_var_req = local_var_req_builder.build()?;
1082    let local_var_resp = local_var_client.execute(local_var_req).await?;
1083
1084    let local_var_status = local_var_resp.status();
1085    let local_var_content = local_var_resp.text().await?;
1086
1087    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1088        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1089    } else {
1090        let local_var_entity: Option<WorkspaceGetCriticalAlertsError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1091        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1092        Err(Error::ResponseError(local_var_error))
1093    }
1094}
1095
1096pub async fn workspace_mute_critical_alerts_ui(configuration: &configuration::Configuration, workspace: &str, workspace_mute_critical_alerts_ui_request: models::WorkspaceMuteCriticalAlertsUiRequest) -> Result<String, Error<WorkspaceMuteCriticalAlertsUiError>> {
1097    let local_var_configuration = configuration;
1098
1099    let local_var_client = &local_var_configuration.client;
1100
1101    let local_var_uri_str = format!("{}/w/{workspace}/workspaces/critical_alerts/mute", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
1102    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1103
1104    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1105        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1106    }
1107    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1108        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1109    };
1110    local_var_req_builder = local_var_req_builder.json(&workspace_mute_critical_alerts_ui_request);
1111
1112    let local_var_req = local_var_req_builder.build()?;
1113    let local_var_resp = local_var_client.execute(local_var_req).await?;
1114
1115    let local_var_status = local_var_resp.status();
1116    let local_var_content = local_var_resp.text().await?;
1117
1118    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1119        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1120    } else {
1121        let local_var_entity: Option<WorkspaceMuteCriticalAlertsUiError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1122        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1123        Err(Error::ResponseError(local_var_error))
1124    }
1125}
1126