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.505.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_latest_key_renewal_attempt`]
54#[derive(Debug, Clone, Serialize, Deserialize)]
55#[serde(untagged)]
56pub enum GetLatestKeyRenewalAttemptError {
57    UnknownValue(serde_json::Value),
58}
59
60/// struct for typed errors of method [`get_local`]
61#[derive(Debug, Clone, Serialize, Deserialize)]
62#[serde(untagged)]
63pub enum GetLocalError {
64    UnknownValue(serde_json::Value),
65}
66
67/// struct for typed errors of method [`get_secondary_storage_names`]
68#[derive(Debug, Clone, Serialize, Deserialize)]
69#[serde(untagged)]
70pub enum GetSecondaryStorageNamesError {
71    UnknownValue(serde_json::Value),
72}
73
74/// struct for typed errors of method [`list_global_settings`]
75#[derive(Debug, Clone, Serialize, Deserialize)]
76#[serde(untagged)]
77pub enum ListGlobalSettingsError {
78    UnknownValue(serde_json::Value),
79}
80
81/// struct for typed errors of method [`renew_license_key`]
82#[derive(Debug, Clone, Serialize, Deserialize)]
83#[serde(untagged)]
84pub enum RenewLicenseKeyError {
85    UnknownValue(serde_json::Value),
86}
87
88/// struct for typed errors of method [`send_stats`]
89#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum SendStatsError {
92    UnknownValue(serde_json::Value),
93}
94
95/// struct for typed errors of method [`set_global`]
96#[derive(Debug, Clone, Serialize, Deserialize)]
97#[serde(untagged)]
98pub enum SetGlobalError {
99    UnknownValue(serde_json::Value),
100}
101
102/// struct for typed errors of method [`test_critical_channels`]
103#[derive(Debug, Clone, Serialize, Deserialize)]
104#[serde(untagged)]
105pub enum TestCriticalChannelsError {
106    UnknownValue(serde_json::Value),
107}
108
109/// struct for typed errors of method [`test_license_key`]
110#[derive(Debug, Clone, Serialize, Deserialize)]
111#[serde(untagged)]
112pub enum TestLicenseKeyError {
113    UnknownValue(serde_json::Value),
114}
115
116/// struct for typed errors of method [`test_metadata`]
117#[derive(Debug, Clone, Serialize, Deserialize)]
118#[serde(untagged)]
119pub enum TestMetadataError {
120    UnknownValue(serde_json::Value),
121}
122
123/// struct for typed errors of method [`test_object_storage_config`]
124#[derive(Debug, Clone, Serialize, Deserialize)]
125#[serde(untagged)]
126pub enum TestObjectStorageConfigError {
127    UnknownValue(serde_json::Value),
128}
129
130/// struct for typed errors of method [`test_smtp`]
131#[derive(Debug, Clone, Serialize, Deserialize)]
132#[serde(untagged)]
133pub enum TestSmtpError {
134    UnknownValue(serde_json::Value),
135}
136
137/// struct for typed errors of method [`workspace_acknowledge_all_critical_alerts`]
138#[derive(Debug, Clone, Serialize, Deserialize)]
139#[serde(untagged)]
140pub enum WorkspaceAcknowledgeAllCriticalAlertsError {
141    UnknownValue(serde_json::Value),
142}
143
144/// struct for typed errors of method [`workspace_acknowledge_critical_alert`]
145#[derive(Debug, Clone, Serialize, Deserialize)]
146#[serde(untagged)]
147pub enum WorkspaceAcknowledgeCriticalAlertError {
148    UnknownValue(serde_json::Value),
149}
150
151/// struct for typed errors of method [`workspace_get_critical_alerts`]
152#[derive(Debug, Clone, Serialize, Deserialize)]
153#[serde(untagged)]
154pub enum WorkspaceGetCriticalAlertsError {
155    UnknownValue(serde_json::Value),
156}
157
158/// struct for typed errors of method [`workspace_mute_critical_alerts_ui`]
159#[derive(Debug, Clone, Serialize, Deserialize)]
160#[serde(untagged)]
161pub enum WorkspaceMuteCriticalAlertsUiError {
162    UnknownValue(serde_json::Value),
163}
164
165
166pub async fn acknowledge_all_critical_alerts(configuration: &configuration::Configuration, ) -> Result<String, Error<AcknowledgeAllCriticalAlertsError>> {
167    let local_var_configuration = configuration;
168
169    let local_var_client = &local_var_configuration.client;
170
171    let local_var_uri_str = format!("{}/settings/critical_alerts/acknowledge_all", local_var_configuration.base_path);
172    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
173
174    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
175        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
176    }
177    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
178        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
179    };
180
181    let local_var_req = local_var_req_builder.build()?;
182    let local_var_resp = local_var_client.execute(local_var_req).await?;
183
184    let local_var_status = local_var_resp.status();
185    let local_var_content = local_var_resp.text().await?;
186
187    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
188        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
189    } else {
190        let local_var_entity: Option<AcknowledgeAllCriticalAlertsError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
191        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
192        Err(Error::ResponseError(local_var_error))
193    }
194}
195
196pub async fn acknowledge_critical_alert(configuration: &configuration::Configuration, id: i32) -> Result<String, Error<AcknowledgeCriticalAlertError>> {
197    let local_var_configuration = configuration;
198
199    let local_var_client = &local_var_configuration.client;
200
201    let local_var_uri_str = format!("{}/settings/critical_alerts/{id}/acknowledge", local_var_configuration.base_path, id=id);
202    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
203
204    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
205        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
206    }
207    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
208        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
209    };
210
211    let local_var_req = local_var_req_builder.build()?;
212    let local_var_resp = local_var_client.execute(local_var_req).await?;
213
214    let local_var_status = local_var_resp.status();
215    let local_var_content = local_var_resp.text().await?;
216
217    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
218        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
219    } else {
220        let local_var_entity: Option<AcknowledgeCriticalAlertError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
221        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
222        Err(Error::ResponseError(local_var_error))
223    }
224}
225
226pub async fn create_customer_portal_session(configuration: &configuration::Configuration, license_key: Option<&str>) -> Result<String, Error<CreateCustomerPortalSessionError>> {
227    let local_var_configuration = configuration;
228
229    let local_var_client = &local_var_configuration.client;
230
231    let local_var_uri_str = format!("{}/settings/customer_portal", local_var_configuration.base_path);
232    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
233
234    if let Some(ref local_var_str) = license_key {
235        local_var_req_builder = local_var_req_builder.query(&[("license_key", &local_var_str.to_string())]);
236    }
237    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
238        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
239    }
240    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
241        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
242    };
243
244    let local_var_req = local_var_req_builder.build()?;
245    let local_var_resp = local_var_client.execute(local_var_req).await?;
246
247    let local_var_status = local_var_resp.status();
248    let local_var_content = local_var_resp.text().await?;
249
250    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
251        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
252    } else {
253        let local_var_entity: Option<CreateCustomerPortalSessionError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
254        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
255        Err(Error::ResponseError(local_var_error))
256    }
257}
258
259pub async fn get_critical_alerts(configuration: &configuration::Configuration, page: Option<i32>, page_size: Option<i32>, acknowledged: Option<bool>) -> Result<models::GetCriticalAlerts200Response, Error<GetCriticalAlertsError>> {
260    let local_var_configuration = configuration;
261
262    let local_var_client = &local_var_configuration.client;
263
264    let local_var_uri_str = format!("{}/settings/critical_alerts", local_var_configuration.base_path);
265    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
266
267    if let Some(ref local_var_str) = page {
268        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
269    }
270    if let Some(ref local_var_str) = page_size {
271        local_var_req_builder = local_var_req_builder.query(&[("page_size", &local_var_str.to_string())]);
272    }
273    if let Some(ref local_var_str) = acknowledged {
274        local_var_req_builder = local_var_req_builder.query(&[("acknowledged", &local_var_str.to_string())]);
275    }
276    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
277        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
278    }
279    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
280        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
281    };
282
283    let local_var_req = local_var_req_builder.build()?;
284    let local_var_resp = local_var_client.execute(local_var_req).await?;
285
286    let local_var_status = local_var_resp.status();
287    let local_var_content = local_var_resp.text().await?;
288
289    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
290        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
291    } else {
292        let local_var_entity: Option<GetCriticalAlertsError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
293        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
294        Err(Error::ResponseError(local_var_error))
295    }
296}
297
298pub async fn get_global(configuration: &configuration::Configuration, key: &str) -> Result<serde_json::Value, Error<GetGlobalError>> {
299    let local_var_configuration = configuration;
300
301    let local_var_client = &local_var_configuration.client;
302
303    let local_var_uri_str = format!("{}/settings/global/{key}", local_var_configuration.base_path, key=crate::apis::urlencode(key));
304    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
305
306    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
307        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
308    }
309    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
310        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
311    };
312
313    let local_var_req = local_var_req_builder.build()?;
314    let local_var_resp = local_var_client.execute(local_var_req).await?;
315
316    let local_var_status = local_var_resp.status();
317    let local_var_content = local_var_resp.text().await?;
318
319    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
320        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
321    } else {
322        let local_var_entity: Option<GetGlobalError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
323        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
324        Err(Error::ResponseError(local_var_error))
325    }
326}
327
328pub async fn get_latest_key_renewal_attempt(configuration: &configuration::Configuration, ) -> Result<models::GetLatestKeyRenewalAttempt200Response, Error<GetLatestKeyRenewalAttemptError>> {
329    let local_var_configuration = configuration;
330
331    let local_var_client = &local_var_configuration.client;
332
333    let local_var_uri_str = format!("{}/settings/latest_key_renewal_attempt", local_var_configuration.base_path);
334    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
335
336    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
337        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
338    }
339    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
340        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
341    };
342
343    let local_var_req = local_var_req_builder.build()?;
344    let local_var_resp = local_var_client.execute(local_var_req).await?;
345
346    let local_var_status = local_var_resp.status();
347    let local_var_content = local_var_resp.text().await?;
348
349    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
350        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
351    } else {
352        let local_var_entity: Option<GetLatestKeyRenewalAttemptError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
353        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
354        Err(Error::ResponseError(local_var_error))
355    }
356}
357
358pub async fn get_local(configuration: &configuration::Configuration, ) -> Result<serde_json::Value, Error<GetLocalError>> {
359    let local_var_configuration = configuration;
360
361    let local_var_client = &local_var_configuration.client;
362
363    let local_var_uri_str = format!("{}/settings/local", local_var_configuration.base_path);
364    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
365
366    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
367        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
368    }
369    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
370        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
371    };
372
373    let local_var_req = local_var_req_builder.build()?;
374    let local_var_resp = local_var_client.execute(local_var_req).await?;
375
376    let local_var_status = local_var_resp.status();
377    let local_var_content = local_var_resp.text().await?;
378
379    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
380        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
381    } else {
382        let local_var_entity: Option<GetLocalError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
383        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
384        Err(Error::ResponseError(local_var_error))
385    }
386}
387
388pub async fn get_secondary_storage_names(configuration: &configuration::Configuration, workspace: &str) -> Result<Vec<String>, Error<GetSecondaryStorageNamesError>> {
389    let local_var_configuration = configuration;
390
391    let local_var_client = &local_var_configuration.client;
392
393    let local_var_uri_str = format!("{}/w/{workspace}/workspaces/get_secondary_storage_names", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
394    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
395
396    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
397        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
398    }
399    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
400        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
401    };
402
403    let local_var_req = local_var_req_builder.build()?;
404    let local_var_resp = local_var_client.execute(local_var_req).await?;
405
406    let local_var_status = local_var_resp.status();
407    let local_var_content = local_var_resp.text().await?;
408
409    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
410        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
411    } else {
412        let local_var_entity: Option<GetSecondaryStorageNamesError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
413        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
414        Err(Error::ResponseError(local_var_error))
415    }
416}
417
418pub async fn list_global_settings(configuration: &configuration::Configuration, ) -> Result<Vec<models::GlobalSetting>, Error<ListGlobalSettingsError>> {
419    let local_var_configuration = configuration;
420
421    let local_var_client = &local_var_configuration.client;
422
423    let local_var_uri_str = format!("{}/settings/list_global", local_var_configuration.base_path);
424    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
425
426    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
427        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
428    }
429    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
430        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
431    };
432
433    let local_var_req = local_var_req_builder.build()?;
434    let local_var_resp = local_var_client.execute(local_var_req).await?;
435
436    let local_var_status = local_var_resp.status();
437    let local_var_content = local_var_resp.text().await?;
438
439    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
440        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
441    } else {
442        let local_var_entity: Option<ListGlobalSettingsError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
443        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
444        Err(Error::ResponseError(local_var_error))
445    }
446}
447
448pub async fn renew_license_key(configuration: &configuration::Configuration, license_key: Option<&str>) -> Result<String, Error<RenewLicenseKeyError>> {
449    let local_var_configuration = configuration;
450
451    let local_var_client = &local_var_configuration.client;
452
453    let local_var_uri_str = format!("{}/settings/renew_license_key", local_var_configuration.base_path);
454    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
455
456    if let Some(ref local_var_str) = license_key {
457        local_var_req_builder = local_var_req_builder.query(&[("license_key", &local_var_str.to_string())]);
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<RenewLicenseKeyError> = 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 send_stats(configuration: &configuration::Configuration, ) -> Result<String, Error<SendStatsError>> {
482    let local_var_configuration = configuration;
483
484    let local_var_client = &local_var_configuration.client;
485
486    let local_var_uri_str = format!("{}/settings/send_stats", local_var_configuration.base_path);
487    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, 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<SendStatsError> = 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 set_global(configuration: &configuration::Configuration, key: &str, set_global_request: models::SetGlobalRequest) -> Result<String, Error<SetGlobalError>> {
512    let local_var_configuration = configuration;
513
514    let local_var_client = &local_var_configuration.client;
515
516    let local_var_uri_str = format!("{}/settings/global/{key}", local_var_configuration.base_path, key=crate::apis::urlencode(key));
517    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
518
519    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
520        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
521    }
522    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
523        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
524    };
525    local_var_req_builder = local_var_req_builder.json(&set_global_request);
526
527    let local_var_req = local_var_req_builder.build()?;
528    let local_var_resp = local_var_client.execute(local_var_req).await?;
529
530    let local_var_status = local_var_resp.status();
531    let local_var_content = local_var_resp.text().await?;
532
533    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
534        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
535    } else {
536        let local_var_entity: Option<SetGlobalError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
537        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
538        Err(Error::ResponseError(local_var_error))
539    }
540}
541
542pub async fn test_critical_channels(configuration: &configuration::Configuration, test_critical_channels_request_inner: Vec<models::TestCriticalChannelsRequestInner>) -> Result<String, Error<TestCriticalChannelsError>> {
543    let local_var_configuration = configuration;
544
545    let local_var_client = &local_var_configuration.client;
546
547    let local_var_uri_str = format!("{}/settings/test_critical_channels", local_var_configuration.base_path);
548    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
549
550    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
551        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
552    }
553    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
554        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
555    };
556    local_var_req_builder = local_var_req_builder.json(&test_critical_channels_request_inner);
557
558    let local_var_req = local_var_req_builder.build()?;
559    let local_var_resp = local_var_client.execute(local_var_req).await?;
560
561    let local_var_status = local_var_resp.status();
562    let local_var_content = local_var_resp.text().await?;
563
564    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
565        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
566    } else {
567        let local_var_entity: Option<TestCriticalChannelsError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
568        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
569        Err(Error::ResponseError(local_var_error))
570    }
571}
572
573pub async fn test_license_key(configuration: &configuration::Configuration, test_license_key_request: models::TestLicenseKeyRequest) -> Result<String, Error<TestLicenseKeyError>> {
574    let local_var_configuration = configuration;
575
576    let local_var_client = &local_var_configuration.client;
577
578    let local_var_uri_str = format!("{}/settings/test_license_key", local_var_configuration.base_path);
579    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
580
581    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
582        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
583    }
584    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
585        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
586    };
587    local_var_req_builder = local_var_req_builder.json(&test_license_key_request);
588
589    let local_var_req = local_var_req_builder.build()?;
590    let local_var_resp = local_var_client.execute(local_var_req).await?;
591
592    let local_var_status = local_var_resp.status();
593    let local_var_content = local_var_resp.text().await?;
594
595    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
596        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
597    } else {
598        let local_var_entity: Option<TestLicenseKeyError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
599        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
600        Err(Error::ResponseError(local_var_error))
601    }
602}
603
604pub async fn test_metadata(configuration: &configuration::Configuration, body: &str) -> Result<String, Error<TestMetadataError>> {
605    let local_var_configuration = configuration;
606
607    let local_var_client = &local_var_configuration.client;
608
609    let local_var_uri_str = format!("{}/saml/test_metadata", local_var_configuration.base_path);
610    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
611
612    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
613        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
614    }
615    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
616        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
617    };
618    local_var_req_builder = local_var_req_builder.json(&body);
619
620    let local_var_req = local_var_req_builder.build()?;
621    let local_var_resp = local_var_client.execute(local_var_req).await?;
622
623    let local_var_status = local_var_resp.status();
624    let local_var_content = local_var_resp.text().await?;
625
626    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
627        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
628    } else {
629        let local_var_entity: Option<TestMetadataError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
630        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
631        Err(Error::ResponseError(local_var_error))
632    }
633}
634
635pub async fn test_object_storage_config(configuration: &configuration::Configuration, request_body: std::collections::HashMap<String, serde_json::Value>) -> Result<String, Error<TestObjectStorageConfigError>> {
636    let local_var_configuration = configuration;
637
638    let local_var_client = &local_var_configuration.client;
639
640    let local_var_uri_str = format!("{}/settings/test_object_storage_config", local_var_configuration.base_path);
641    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
642
643    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
644        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
645    }
646    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
647        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
648    };
649    local_var_req_builder = local_var_req_builder.json(&request_body);
650
651    let local_var_req = local_var_req_builder.build()?;
652    let local_var_resp = local_var_client.execute(local_var_req).await?;
653
654    let local_var_status = local_var_resp.status();
655    let local_var_content = local_var_resp.text().await?;
656
657    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
658        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
659    } else {
660        let local_var_entity: Option<TestObjectStorageConfigError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
661        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
662        Err(Error::ResponseError(local_var_error))
663    }
664}
665
666pub async fn test_smtp(configuration: &configuration::Configuration, test_smtp_request: models::TestSmtpRequest) -> Result<String, Error<TestSmtpError>> {
667    let local_var_configuration = configuration;
668
669    let local_var_client = &local_var_configuration.client;
670
671    let local_var_uri_str = format!("{}/settings/test_smtp", local_var_configuration.base_path);
672    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
673
674    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
675        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
676    }
677    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
678        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
679    };
680    local_var_req_builder = local_var_req_builder.json(&test_smtp_request);
681
682    let local_var_req = local_var_req_builder.build()?;
683    let local_var_resp = local_var_client.execute(local_var_req).await?;
684
685    let local_var_status = local_var_resp.status();
686    let local_var_content = local_var_resp.text().await?;
687
688    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
689        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
690    } else {
691        let local_var_entity: Option<TestSmtpError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
692        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
693        Err(Error::ResponseError(local_var_error))
694    }
695}
696
697pub async fn workspace_acknowledge_all_critical_alerts(configuration: &configuration::Configuration, workspace: &str) -> Result<String, Error<WorkspaceAcknowledgeAllCriticalAlertsError>> {
698    let local_var_configuration = configuration;
699
700    let local_var_client = &local_var_configuration.client;
701
702    let local_var_uri_str = format!("{}/w/{workspace}/workspaces/critical_alerts/acknowledge_all", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
703    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
704
705    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
706        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
707    }
708    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
709        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
710    };
711
712    let local_var_req = local_var_req_builder.build()?;
713    let local_var_resp = local_var_client.execute(local_var_req).await?;
714
715    let local_var_status = local_var_resp.status();
716    let local_var_content = local_var_resp.text().await?;
717
718    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
719        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
720    } else {
721        let local_var_entity: Option<WorkspaceAcknowledgeAllCriticalAlertsError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
722        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
723        Err(Error::ResponseError(local_var_error))
724    }
725}
726
727pub async fn workspace_acknowledge_critical_alert(configuration: &configuration::Configuration, workspace: &str, id: i32) -> Result<String, Error<WorkspaceAcknowledgeCriticalAlertError>> {
728    let local_var_configuration = configuration;
729
730    let local_var_client = &local_var_configuration.client;
731
732    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);
733    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
734
735    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
736        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
737    }
738    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
739        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
740    };
741
742    let local_var_req = local_var_req_builder.build()?;
743    let local_var_resp = local_var_client.execute(local_var_req).await?;
744
745    let local_var_status = local_var_resp.status();
746    let local_var_content = local_var_resp.text().await?;
747
748    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
749        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
750    } else {
751        let local_var_entity: Option<WorkspaceAcknowledgeCriticalAlertError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
752        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
753        Err(Error::ResponseError(local_var_error))
754    }
755}
756
757pub 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>> {
758    let local_var_configuration = configuration;
759
760    let local_var_client = &local_var_configuration.client;
761
762    let local_var_uri_str = format!("{}/w/{workspace}/workspaces/critical_alerts", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
763    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
764
765    if let Some(ref local_var_str) = page {
766        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
767    }
768    if let Some(ref local_var_str) = page_size {
769        local_var_req_builder = local_var_req_builder.query(&[("page_size", &local_var_str.to_string())]);
770    }
771    if let Some(ref local_var_str) = acknowledged {
772        local_var_req_builder = local_var_req_builder.query(&[("acknowledged", &local_var_str.to_string())]);
773    }
774    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
775        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
776    }
777    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
778        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
779    };
780
781    let local_var_req = local_var_req_builder.build()?;
782    let local_var_resp = local_var_client.execute(local_var_req).await?;
783
784    let local_var_status = local_var_resp.status();
785    let local_var_content = local_var_resp.text().await?;
786
787    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
788        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
789    } else {
790        let local_var_entity: Option<WorkspaceGetCriticalAlertsError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
791        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
792        Err(Error::ResponseError(local_var_error))
793    }
794}
795
796pub async fn workspace_mute_critical_alerts_ui(configuration: &configuration::Configuration, workspace: &str, workspace_mute_critical_alerts_ui_request: models::WorkspaceMuteCriticalAlertsUiRequest) -> Result<String, Error<WorkspaceMuteCriticalAlertsUiError>> {
797    let local_var_configuration = configuration;
798
799    let local_var_client = &local_var_configuration.client;
800
801    let local_var_uri_str = format!("{}/w/{workspace}/workspaces/critical_alerts/mute", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
802    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
803
804    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
805        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
806    }
807    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
808        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
809    };
810    local_var_req_builder = local_var_req_builder.json(&workspace_mute_critical_alerts_ui_request);
811
812    let local_var_req = local_var_req_builder.build()?;
813    let local_var_resp = local_var_client.execute(local_var_req).await?;
814
815    let local_var_status = local_var_resp.status();
816    let local_var_content = local_var_resp.text().await?;
817
818    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
819        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
820    } else {
821        let local_var_entity: Option<WorkspaceMuteCriticalAlertsUiError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
822        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
823        Err(Error::ResponseError(local_var_error))
824    }
825}
826