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