mattermost_rust_client/apis/
system_api.rs

1/*
2 * Mattermost API Reference
3 *
4 * There is also a work-in-progress [Postman API reference](https://documenter.getpostman.com/view/4508214/RW8FERUn). 
5 *
6 * The version of the OpenAPI document: 4.0.0
7 * Contact: feedback@mattermost.com
8 * Generated by: https://openapi-generator.tech
9 */
10
11
12use reqwest;
13
14use crate::apis::ResponseContent;
15use super::{Error, configuration};
16
17
18/// struct for typed errors of method [`check_integrity`]
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum CheckIntegrityError {
22    UnknownValue(serde_json::Value),
23}
24
25/// struct for typed errors of method [`clear_server_busy`]
26#[derive(Debug, Clone, Serialize, Deserialize)]
27#[serde(untagged)]
28pub enum ClearServerBusyError {
29    Status403(crate::models::AppError),
30    UnknownValue(serde_json::Value),
31}
32
33/// struct for typed errors of method [`database_recycle`]
34#[derive(Debug, Clone, Serialize, Deserialize)]
35#[serde(untagged)]
36pub enum DatabaseRecycleError {
37    Status403(crate::models::AppError),
38    UnknownValue(serde_json::Value),
39}
40
41/// struct for typed errors of method [`generate_support_packet`]
42#[derive(Debug, Clone, Serialize, Deserialize)]
43#[serde(untagged)]
44pub enum GenerateSupportPacketError {
45    Status400(crate::models::AppError),
46    Status401(crate::models::AppError),
47    Status403(crate::models::AppError),
48    Status404(crate::models::AppError),
49    UnknownValue(serde_json::Value),
50}
51
52/// struct for typed errors of method [`get_analytics_old`]
53#[derive(Debug, Clone, Serialize, Deserialize)]
54#[serde(untagged)]
55pub enum GetAnalyticsOldError {
56    Status400(crate::models::AppError),
57    Status401(crate::models::AppError),
58    Status403(crate::models::AppError),
59    UnknownValue(serde_json::Value),
60}
61
62/// struct for typed errors of method [`get_audits`]
63#[derive(Debug, Clone, Serialize, Deserialize)]
64#[serde(untagged)]
65pub enum GetAuditsError {
66    Status403(crate::models::AppError),
67    UnknownValue(serde_json::Value),
68}
69
70/// struct for typed errors of method [`get_client_config`]
71#[derive(Debug, Clone, Serialize, Deserialize)]
72#[serde(untagged)]
73pub enum GetClientConfigError {
74    Status400(crate::models::AppError),
75    Status501(crate::models::AppError),
76    UnknownValue(serde_json::Value),
77}
78
79/// struct for typed errors of method [`get_client_license`]
80#[derive(Debug, Clone, Serialize, Deserialize)]
81#[serde(untagged)]
82pub enum GetClientLicenseError {
83    Status400(crate::models::AppError),
84    Status501(crate::models::AppError),
85    UnknownValue(serde_json::Value),
86}
87
88/// struct for typed errors of method [`get_config`]
89#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum GetConfigError {
92    Status400(crate::models::AppError),
93    Status403(crate::models::AppError),
94    UnknownValue(serde_json::Value),
95}
96
97/// struct for typed errors of method [`get_environment_config`]
98#[derive(Debug, Clone, Serialize, Deserialize)]
99#[serde(untagged)]
100pub enum GetEnvironmentConfigError {
101    Status400(crate::models::AppError),
102    Status401(crate::models::AppError),
103    Status403(crate::models::AppError),
104    UnknownValue(serde_json::Value),
105}
106
107/// struct for typed errors of method [`get_image_by_url`]
108#[derive(Debug, Clone, Serialize, Deserialize)]
109#[serde(untagged)]
110pub enum GetImageByUrlError {
111    Status404(crate::models::AppError),
112    UnknownValue(serde_json::Value),
113}
114
115/// struct for typed errors of method [`get_logs`]
116#[derive(Debug, Clone, Serialize, Deserialize)]
117#[serde(untagged)]
118pub enum GetLogsError {
119    Status403(crate::models::AppError),
120    UnknownValue(serde_json::Value),
121}
122
123/// struct for typed errors of method [`get_notices`]
124#[derive(Debug, Clone, Serialize, Deserialize)]
125#[serde(untagged)]
126pub enum GetNoticesError {
127    Status500(crate::models::AppError),
128    UnknownValue(serde_json::Value),
129}
130
131/// struct for typed errors of method [`get_ping`]
132#[derive(Debug, Clone, Serialize, Deserialize)]
133#[serde(untagged)]
134pub enum GetPingError {
135    Status500(crate::models::AppError),
136    UnknownValue(serde_json::Value),
137}
138
139/// struct for typed errors of method [`get_prev_trial_license`]
140#[derive(Debug, Clone, Serialize, Deserialize)]
141#[serde(untagged)]
142pub enum GetPrevTrialLicenseError {
143    Status400(crate::models::AppError),
144    Status401(crate::models::AppError),
145    Status403(crate::models::AppError),
146    UnknownValue(serde_json::Value),
147}
148
149/// struct for typed errors of method [`get_redirect_location`]
150#[derive(Debug, Clone, Serialize, Deserialize)]
151#[serde(untagged)]
152pub enum GetRedirectLocationError {
153    Status404(crate::models::AppError),
154    UnknownValue(serde_json::Value),
155}
156
157/// struct for typed errors of method [`get_server_busy_expires`]
158#[derive(Debug, Clone, Serialize, Deserialize)]
159#[serde(untagged)]
160pub enum GetServerBusyExpiresError {
161    Status403(crate::models::AppError),
162    UnknownValue(serde_json::Value),
163}
164
165/// struct for typed errors of method [`get_supported_timezone`]
166#[derive(Debug, Clone, Serialize, Deserialize)]
167#[serde(untagged)]
168pub enum GetSupportedTimezoneError {
169    Status500(crate::models::AppError),
170    UnknownValue(serde_json::Value),
171}
172
173/// struct for typed errors of method [`get_warn_metrics_status`]
174#[derive(Debug, Clone, Serialize, Deserialize)]
175#[serde(untagged)]
176pub enum GetWarnMetricsStatusError {
177    Status400(crate::models::AppError),
178    Status401(crate::models::AppError),
179    Status403(crate::models::AppError),
180    UnknownValue(serde_json::Value),
181}
182
183/// struct for typed errors of method [`invalidate_caches`]
184#[derive(Debug, Clone, Serialize, Deserialize)]
185#[serde(untagged)]
186pub enum InvalidateCachesError {
187    Status403(crate::models::AppError),
188    UnknownValue(serde_json::Value),
189}
190
191/// struct for typed errors of method [`mark_notices_viewed`]
192#[derive(Debug, Clone, Serialize, Deserialize)]
193#[serde(untagged)]
194pub enum MarkNoticesViewedError {
195    Status500(crate::models::AppError),
196    UnknownValue(serde_json::Value),
197}
198
199/// struct for typed errors of method [`patch_config`]
200#[derive(Debug, Clone, Serialize, Deserialize)]
201#[serde(untagged)]
202pub enum PatchConfigError {
203    Status400(crate::models::AppError),
204    Status403(crate::models::AppError),
205    UnknownValue(serde_json::Value),
206}
207
208/// struct for typed errors of method [`post_log`]
209#[derive(Debug, Clone, Serialize, Deserialize)]
210#[serde(untagged)]
211pub enum PostLogError {
212    Status403(crate::models::AppError),
213    UnknownValue(serde_json::Value),
214}
215
216/// struct for typed errors of method [`reload_config`]
217#[derive(Debug, Clone, Serialize, Deserialize)]
218#[serde(untagged)]
219pub enum ReloadConfigError {
220    Status400(crate::models::AppError),
221    Status403(crate::models::AppError),
222    UnknownValue(serde_json::Value),
223}
224
225/// struct for typed errors of method [`remove_license_file`]
226#[derive(Debug, Clone, Serialize, Deserialize)]
227#[serde(untagged)]
228pub enum RemoveLicenseFileError {
229    Status401(crate::models::AppError),
230    Status403(crate::models::AppError),
231    UnknownValue(serde_json::Value),
232}
233
234/// struct for typed errors of method [`request_license_renewal_link`]
235#[derive(Debug, Clone, Serialize, Deserialize)]
236#[serde(untagged)]
237pub enum RequestLicenseRenewalLinkError {
238    Status400(crate::models::AppError),
239    Status401(crate::models::AppError),
240    Status403(crate::models::AppError),
241    Status500(crate::models::AppError),
242    UnknownValue(serde_json::Value),
243}
244
245/// struct for typed errors of method [`request_trial_license`]
246#[derive(Debug, Clone, Serialize, Deserialize)]
247#[serde(untagged)]
248pub enum RequestTrialLicenseError {
249    Status400(crate::models::AppError),
250    Status401(crate::models::AppError),
251    Status403(crate::models::AppError),
252    UnknownValue(serde_json::Value),
253}
254
255/// struct for typed errors of method [`restart_server`]
256#[derive(Debug, Clone, Serialize, Deserialize)]
257#[serde(untagged)]
258pub enum RestartServerError {
259    Status403(crate::models::AppError),
260    UnknownValue(serde_json::Value),
261}
262
263/// struct for typed errors of method [`send_trial_license_warn_metric_ack`]
264#[derive(Debug, Clone, Serialize, Deserialize)]
265#[serde(untagged)]
266pub enum SendTrialLicenseWarnMetricAckError {
267    Status400(crate::models::AppError),
268    Status401(crate::models::AppError),
269    Status403(crate::models::AppError),
270    UnknownValue(serde_json::Value),
271}
272
273/// struct for typed errors of method [`send_warn_metric_ack`]
274#[derive(Debug, Clone, Serialize, Deserialize)]
275#[serde(untagged)]
276pub enum SendWarnMetricAckError {
277    Status400(crate::models::AppError),
278    Status401(crate::models::AppError),
279    Status403(crate::models::AppError),
280    UnknownValue(serde_json::Value),
281}
282
283/// struct for typed errors of method [`set_server_busy`]
284#[derive(Debug, Clone, Serialize, Deserialize)]
285#[serde(untagged)]
286pub enum SetServerBusyError {
287    Status400(crate::models::AppError),
288    Status403(crate::models::AppError),
289    UnknownValue(serde_json::Value),
290}
291
292/// struct for typed errors of method [`test_email`]
293#[derive(Debug, Clone, Serialize, Deserialize)]
294#[serde(untagged)]
295pub enum TestEmailError {
296    Status403(crate::models::AppError),
297    Status500(crate::models::AppError),
298    UnknownValue(serde_json::Value),
299}
300
301/// struct for typed errors of method [`test_s3_connection`]
302#[derive(Debug, Clone, Serialize, Deserialize)]
303#[serde(untagged)]
304pub enum TestS3ConnectionError {
305    Status403(crate::models::AppError),
306    Status500(crate::models::AppError),
307    UnknownValue(serde_json::Value),
308}
309
310/// struct for typed errors of method [`test_site_url`]
311#[derive(Debug, Clone, Serialize, Deserialize)]
312#[serde(untagged)]
313pub enum TestSiteUrlError {
314    Status400(crate::models::AppError),
315    Status403(crate::models::AppError),
316    Status500(crate::models::AppError),
317    UnknownValue(serde_json::Value),
318}
319
320/// struct for typed errors of method [`update_config`]
321#[derive(Debug, Clone, Serialize, Deserialize)]
322#[serde(untagged)]
323pub enum UpdateConfigError {
324    Status400(crate::models::AppError),
325    Status403(crate::models::AppError),
326    UnknownValue(serde_json::Value),
327}
328
329/// struct for typed errors of method [`update_marketplace_visited_by_admin`]
330#[derive(Debug, Clone, Serialize, Deserialize)]
331#[serde(untagged)]
332pub enum UpdateMarketplaceVisitedByAdminError {
333    Status403(crate::models::AppError),
334    Status500(crate::models::AppError),
335    UnknownValue(serde_json::Value),
336}
337
338/// struct for typed errors of method [`upgrade_to_enterprise`]
339#[derive(Debug, Clone, Serialize, Deserialize)]
340#[serde(untagged)]
341pub enum UpgradeToEnterpriseError {
342    Status403(crate::models::AppError),
343    Status429(crate::models::AppError),
344    UnknownValue(serde_json::Value),
345}
346
347/// struct for typed errors of method [`upgrade_to_enterprise_status`]
348#[derive(Debug, Clone, Serialize, Deserialize)]
349#[serde(untagged)]
350pub enum UpgradeToEnterpriseStatusError {
351    Status403(crate::models::AppError),
352    UnknownValue(serde_json::Value),
353}
354
355/// struct for typed errors of method [`upload_license_file`]
356#[derive(Debug, Clone, Serialize, Deserialize)]
357#[serde(untagged)]
358pub enum UploadLicenseFileError {
359    Status400(crate::models::AppError),
360    Status401(crate::models::AppError),
361    Status403(crate::models::AppError),
362    Status413(crate::models::AppError),
363    UnknownValue(serde_json::Value),
364}
365
366
367/// Performs a database integrity check.   __Note__: This check may temporarily harm system performance.   __Minimum server version__: 5.28.0   __Local mode only__: This endpoint is only available through [local mode](https://docs.mattermost.com/administration/mmctl-cli-tool.html#local-mode). 
368pub async fn check_integrity(configuration: &configuration::Configuration, ) -> Result<Vec<crate::models::IntegrityCheckResult>, Error<CheckIntegrityError>> {
369    let local_var_configuration = configuration;
370
371    let local_var_client = &local_var_configuration.client;
372
373    let local_var_uri_str = format!("{}/integrity", local_var_configuration.base_path);
374    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
375
376    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
377        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
378    }
379    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
380        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
381    };
382
383    let local_var_req = local_var_req_builder.build()?;
384    let local_var_resp = local_var_client.execute(local_var_req).await?;
385
386    let local_var_status = local_var_resp.status();
387    let local_var_content = local_var_resp.text().await?;
388
389    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
390        serde_json::from_str(&local_var_content).map_err(Error::from)
391    } else {
392        let local_var_entity: Option<CheckIntegrityError> = serde_json::from_str(&local_var_content).ok();
393        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
394        Err(Error::ResponseError(local_var_error))
395    }
396}
397
398/// Marks the server as not having high load which re-enables non-critical services such as search, statuses and typing notifications.  __Minimum server version__: 5.20  ##### Permissions Must have `manage_system` permission. 
399pub async fn clear_server_busy(configuration: &configuration::Configuration, ) -> Result<crate::models::StatusOk, Error<ClearServerBusyError>> {
400    let local_var_configuration = configuration;
401
402    let local_var_client = &local_var_configuration.client;
403
404    let local_var_uri_str = format!("{}/server_busy", local_var_configuration.base_path);
405    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
406
407    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
408        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
409    }
410    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
411        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
412    };
413
414    let local_var_req = local_var_req_builder.build()?;
415    let local_var_resp = local_var_client.execute(local_var_req).await?;
416
417    let local_var_status = local_var_resp.status();
418    let local_var_content = local_var_resp.text().await?;
419
420    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
421        serde_json::from_str(&local_var_content).map_err(Error::from)
422    } else {
423        let local_var_entity: Option<ClearServerBusyError> = serde_json::from_str(&local_var_content).ok();
424        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
425        Err(Error::ResponseError(local_var_error))
426    }
427}
428
429/// Recycle database connections by closing and reconnecting all connections to master and read replica databases. ##### Permissions Must have `manage_system` permission. 
430pub async fn database_recycle(configuration: &configuration::Configuration, ) -> Result<crate::models::StatusOk, Error<DatabaseRecycleError>> {
431    let local_var_configuration = configuration;
432
433    let local_var_client = &local_var_configuration.client;
434
435    let local_var_uri_str = format!("{}/database/recycle", local_var_configuration.base_path);
436    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
437
438    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
439        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
440    }
441    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
442        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
443    };
444
445    let local_var_req = local_var_req_builder.build()?;
446    let local_var_resp = local_var_client.execute(local_var_req).await?;
447
448    let local_var_status = local_var_resp.status();
449    let local_var_content = local_var_resp.text().await?;
450
451    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
452        serde_json::from_str(&local_var_content).map_err(Error::from)
453    } else {
454        let local_var_entity: Option<DatabaseRecycleError> = serde_json::from_str(&local_var_content).ok();
455        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
456        Err(Error::ResponseError(local_var_error))
457    }
458}
459
460/// Download a zip file which contains helpful and useful information for troubleshooting your mattermost instance. __Minimum server version: 5.32__ ##### Permissions Must have any of the system console read permissions. ##### License Requires either a E10 or E20 license. 
461pub async fn generate_support_packet(configuration: &configuration::Configuration, ) -> Result<(), Error<GenerateSupportPacketError>> {
462    let local_var_configuration = configuration;
463
464    let local_var_client = &local_var_configuration.client;
465
466    let local_var_uri_str = format!("{}/system/support_packet", local_var_configuration.base_path);
467    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
468
469    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
470        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
471    }
472    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
473        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
474    };
475
476    let local_var_req = local_var_req_builder.build()?;
477    let local_var_resp = local_var_client.execute(local_var_req).await?;
478
479    let local_var_status = local_var_resp.status();
480    let local_var_content = local_var_resp.text().await?;
481
482    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
483        Ok(())
484    } else {
485        let local_var_entity: Option<GenerateSupportPacketError> = serde_json::from_str(&local_var_content).ok();
486        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
487        Err(Error::ResponseError(local_var_error))
488    }
489}
490
491/// Get some analytics data about the system. This endpoint uses the old format, the `/analytics` route is reserved for the new format when it gets implemented.  The returned JSON changes based on the `name` query parameter but is always key/value pairs.  __Minimum server version__: 4.0  ##### Permissions Must have `manage_system` permission. 
492pub async fn get_analytics_old(configuration: &configuration::Configuration, name: Option<&str>, team_id: Option<&str>) -> Result<(), Error<GetAnalyticsOldError>> {
493    let local_var_configuration = configuration;
494
495    let local_var_client = &local_var_configuration.client;
496
497    let local_var_uri_str = format!("{}/analytics/old", local_var_configuration.base_path);
498    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
499
500    if let Some(ref local_var_str) = name {
501        local_var_req_builder = local_var_req_builder.query(&[("name", &local_var_str.to_string())]);
502    }
503    if let Some(ref local_var_str) = team_id {
504        local_var_req_builder = local_var_req_builder.query(&[("team_id", &local_var_str.to_string())]);
505    }
506    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
507        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
508    }
509    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
510        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
511    };
512
513    let local_var_req = local_var_req_builder.build()?;
514    let local_var_resp = local_var_client.execute(local_var_req).await?;
515
516    let local_var_status = local_var_resp.status();
517    let local_var_content = local_var_resp.text().await?;
518
519    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
520        Ok(())
521    } else {
522        let local_var_entity: Option<GetAnalyticsOldError> = serde_json::from_str(&local_var_content).ok();
523        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
524        Err(Error::ResponseError(local_var_error))
525    }
526}
527
528/// Get a page of audits for all users on the system, selected with `page` and `per_page` query parameters. ##### Permissions Must have `manage_system` permission. 
529pub async fn get_audits(configuration: &configuration::Configuration, page: Option<i32>, per_page: Option<i32>) -> Result<Vec<crate::models::Audit>, Error<GetAuditsError>> {
530    let local_var_configuration = configuration;
531
532    let local_var_client = &local_var_configuration.client;
533
534    let local_var_uri_str = format!("{}/audits", local_var_configuration.base_path);
535    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
536
537    if let Some(ref local_var_str) = page {
538        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
539    }
540    if let Some(ref local_var_str) = per_page {
541        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
542    }
543    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
544        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
545    }
546    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
547        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
548    };
549
550    let local_var_req = local_var_req_builder.build()?;
551    let local_var_resp = local_var_client.execute(local_var_req).await?;
552
553    let local_var_status = local_var_resp.status();
554    let local_var_content = local_var_resp.text().await?;
555
556    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
557        serde_json::from_str(&local_var_content).map_err(Error::from)
558    } else {
559        let local_var_entity: Option<GetAuditsError> = serde_json::from_str(&local_var_content).ok();
560        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
561        Err(Error::ResponseError(local_var_error))
562    }
563}
564
565/// Get a subset of the server configuration needed by the client. ##### Permissions No permission required. 
566pub async fn get_client_config(configuration: &configuration::Configuration, format: &str) -> Result<(), Error<GetClientConfigError>> {
567    let local_var_configuration = configuration;
568
569    let local_var_client = &local_var_configuration.client;
570
571    let local_var_uri_str = format!("{}/config/client", local_var_configuration.base_path);
572    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
573
574    local_var_req_builder = local_var_req_builder.query(&[("format", &format.to_string())]);
575    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
576        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
577    }
578    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
579        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
580    };
581
582    let local_var_req = local_var_req_builder.build()?;
583    let local_var_resp = local_var_client.execute(local_var_req).await?;
584
585    let local_var_status = local_var_resp.status();
586    let local_var_content = local_var_resp.text().await?;
587
588    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
589        Ok(())
590    } else {
591        let local_var_entity: Option<GetClientConfigError> = serde_json::from_str(&local_var_content).ok();
592        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
593        Err(Error::ResponseError(local_var_error))
594    }
595}
596
597/// Get a subset of the server license needed by the client. ##### Permissions No permission required but having the `manage_system` permission returns more information. 
598pub async fn get_client_license(configuration: &configuration::Configuration, format: &str) -> Result<(), Error<GetClientLicenseError>> {
599    let local_var_configuration = configuration;
600
601    let local_var_client = &local_var_configuration.client;
602
603    let local_var_uri_str = format!("{}/license/client", local_var_configuration.base_path);
604    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
605
606    local_var_req_builder = local_var_req_builder.query(&[("format", &format.to_string())]);
607    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
608        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
609    }
610    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
611        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
612    };
613
614    let local_var_req = local_var_req_builder.build()?;
615    let local_var_resp = local_var_client.execute(local_var_req).await?;
616
617    let local_var_status = local_var_resp.status();
618    let local_var_content = local_var_resp.text().await?;
619
620    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
621        Ok(())
622    } else {
623        let local_var_entity: Option<GetClientLicenseError> = serde_json::from_str(&local_var_content).ok();
624        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
625        Err(Error::ResponseError(local_var_error))
626    }
627}
628
629/// Retrieve the current server configuration ##### Permissions Must have `manage_system` permission. 
630pub async fn get_config(configuration: &configuration::Configuration, ) -> Result<crate::models::Config, Error<GetConfigError>> {
631    let local_var_configuration = configuration;
632
633    let local_var_client = &local_var_configuration.client;
634
635    let local_var_uri_str = format!("{}/config", local_var_configuration.base_path);
636    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
637
638    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
639        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
640    }
641    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
642        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
643    };
644
645    let local_var_req = local_var_req_builder.build()?;
646    let local_var_resp = local_var_client.execute(local_var_req).await?;
647
648    let local_var_status = local_var_resp.status();
649    let local_var_content = local_var_resp.text().await?;
650
651    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
652        serde_json::from_str(&local_var_content).map_err(Error::from)
653    } else {
654        let local_var_entity: Option<GetConfigError> = serde_json::from_str(&local_var_content).ok();
655        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
656        Err(Error::ResponseError(local_var_error))
657    }
658}
659
660/// Retrieve a json object mirroring the server configuration where fields are set to true if the corresponding config setting is set through an environment variable. Settings that haven't been set through environment variables will be missing from the object.  __Minimum server version__: 4.10  ##### Permissions Must have `manage_system` permission. 
661pub async fn get_environment_config(configuration: &configuration::Configuration, ) -> Result<crate::models::EnvironmentConfig, Error<GetEnvironmentConfigError>> {
662    let local_var_configuration = configuration;
663
664    let local_var_client = &local_var_configuration.client;
665
666    let local_var_uri_str = format!("{}/config/environment", local_var_configuration.base_path);
667    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
668
669    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
670        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
671    }
672    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
673        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
674    };
675
676    let local_var_req = local_var_req_builder.build()?;
677    let local_var_resp = local_var_client.execute(local_var_req).await?;
678
679    let local_var_status = local_var_resp.status();
680    let local_var_content = local_var_resp.text().await?;
681
682    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
683        serde_json::from_str(&local_var_content).map_err(Error::from)
684    } else {
685        let local_var_entity: Option<GetEnvironmentConfigError> = serde_json::from_str(&local_var_content).ok();
686        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
687        Err(Error::ResponseError(local_var_error))
688    }
689}
690
691/// Fetches an image via Mattermost image proxy. __Minimum server version__: 3.10 ##### Permissions Must be logged in. 
692pub async fn get_image_by_url(configuration: &configuration::Configuration, ) -> Result<std::path::PathBuf, Error<GetImageByUrlError>> {
693    let local_var_configuration = configuration;
694
695    let local_var_client = &local_var_configuration.client;
696
697    let local_var_uri_str = format!("{}/image", local_var_configuration.base_path);
698    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
699
700    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
701        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
702    }
703    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
704        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
705    };
706
707    let local_var_req = local_var_req_builder.build()?;
708    let local_var_resp = local_var_client.execute(local_var_req).await?;
709
710    let local_var_status = local_var_resp.status();
711    let local_var_content = local_var_resp.text().await?;
712
713    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
714        serde_json::from_str(&local_var_content).map_err(Error::from)
715    } else {
716        let local_var_entity: Option<GetImageByUrlError> = serde_json::from_str(&local_var_content).ok();
717        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
718        Err(Error::ResponseError(local_var_error))
719    }
720}
721
722/// Get a page of server logs, selected with `page` and `logs_per_page` query parameters. ##### Permissions Must have `manage_system` permission. 
723pub async fn get_logs(configuration: &configuration::Configuration, page: Option<i32>, logs_per_page: Option<&str>) -> Result<Vec<String>, Error<GetLogsError>> {
724    let local_var_configuration = configuration;
725
726    let local_var_client = &local_var_configuration.client;
727
728    let local_var_uri_str = format!("{}/logs", local_var_configuration.base_path);
729    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
730
731    if let Some(ref local_var_str) = page {
732        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
733    }
734    if let Some(ref local_var_str) = logs_per_page {
735        local_var_req_builder = local_var_req_builder.query(&[("logs_per_page", &local_var_str.to_string())]);
736    }
737    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
738        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
739    }
740    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
741        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
742    };
743
744    let local_var_req = local_var_req_builder.build()?;
745    let local_var_resp = local_var_client.execute(local_var_req).await?;
746
747    let local_var_status = local_var_resp.status();
748    let local_var_content = local_var_resp.text().await?;
749
750    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
751        serde_json::from_str(&local_var_content).map_err(Error::from)
752    } else {
753        let local_var_entity: Option<GetLogsError> = serde_json::from_str(&local_var_content).ok();
754        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
755        Err(Error::ResponseError(local_var_error))
756    }
757}
758
759/// Will return appropriate product notices for current user in the team specified by teamId parameter. __Minimum server version__: 5.26 ##### Permissions Must be logged in. 
760pub async fn get_notices(configuration: &configuration::Configuration, client_version: &str, client: &str, team_id: &str, locale: Option<&str>) -> Result<Vec<crate::models::Notice>, Error<GetNoticesError>> {
761    let local_var_configuration = configuration;
762
763    let local_var_client = &local_var_configuration.client;
764
765    let local_var_uri_str = format!("{}/system/notices/{teamId}", local_var_configuration.base_path, teamId=crate::apis::urlencode(team_id));
766    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
767
768    local_var_req_builder = local_var_req_builder.query(&[("clientVersion", &client_version.to_string())]);
769    if let Some(ref local_var_str) = locale {
770        local_var_req_builder = local_var_req_builder.query(&[("locale", &local_var_str.to_string())]);
771    }
772    local_var_req_builder = local_var_req_builder.query(&[("client", &client.to_string())]);
773    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
774        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
775    }
776    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
777        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
778    };
779
780    let local_var_req = local_var_req_builder.build()?;
781    let local_var_resp = local_var_client.execute(local_var_req).await?;
782
783    let local_var_status = local_var_resp.status();
784    let local_var_content = local_var_resp.text().await?;
785
786    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
787        serde_json::from_str(&local_var_content).map_err(Error::from)
788    } else {
789        let local_var_entity: Option<GetNoticesError> = serde_json::from_str(&local_var_content).ok();
790        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
791        Err(Error::ResponseError(local_var_error))
792    }
793}
794
795/// Check if the server is up and healthy based on the configuration setting `GoRoutineHealthThreshold`. If `GoRoutineHealthThreshold` and the number of goroutines on the server exceeds that threshold the server is considered unhealthy. If `GoRoutineHealthThreshold` is not set or the number of goroutines is below the threshold the server is considered healthy. __Minimum server version__: 3.10 If a \"device_id\" is passed in the query, it will test the Push Notification Proxy in order to discover whether the device is able to receive notifications. The response will have a \"CanReceiveNotifications\" property with one of the following values: - true: It can receive notifications - false: It cannot receive notifications - unknown: There has been an unknown error, and it is not certain whether it can   receive notifications.  __Minimum server version__: 6.5 ##### Permissions None. 
796pub async fn get_ping(configuration: &configuration::Configuration, get_server_status: Option<bool>, device_id: Option<&str>) -> Result<crate::models::SystemStatusResponse, Error<GetPingError>> {
797    let local_var_configuration = configuration;
798
799    let local_var_client = &local_var_configuration.client;
800
801    let local_var_uri_str = format!("{}/system/ping", local_var_configuration.base_path);
802    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
803
804    if let Some(ref local_var_str) = get_server_status {
805        local_var_req_builder = local_var_req_builder.query(&[("get_server_status", &local_var_str.to_string())]);
806    }
807    if let Some(ref local_var_str) = device_id {
808        local_var_req_builder = local_var_req_builder.query(&[("device_id", &local_var_str.to_string())]);
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        serde_json::from_str(&local_var_content).map_err(Error::from)
825    } else {
826        let local_var_entity: Option<GetPingError> = serde_json::from_str(&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
832/// Get the last trial license used on the sevrer __Minimum server version__: 5.36 ##### Permissions Must have `manage_systems` permissions. 
833pub async fn get_prev_trial_license(configuration: &configuration::Configuration, ) -> Result<(), Error<GetPrevTrialLicenseError>> {
834    let local_var_configuration = configuration;
835
836    let local_var_client = &local_var_configuration.client;
837
838    let local_var_uri_str = format!("{}/trial-license/prev", local_var_configuration.base_path);
839    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
840
841    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
842        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
843    }
844    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
845        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
846    };
847
848    let local_var_req = local_var_req_builder.build()?;
849    let local_var_resp = local_var_client.execute(local_var_req).await?;
850
851    let local_var_status = local_var_resp.status();
852    let local_var_content = local_var_resp.text().await?;
853
854    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
855        Ok(())
856    } else {
857        let local_var_entity: Option<GetPrevTrialLicenseError> = serde_json::from_str(&local_var_content).ok();
858        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
859        Err(Error::ResponseError(local_var_error))
860    }
861}
862
863/// __Minimum server version__: 3.10 ##### Permissions Must be logged in. 
864pub async fn get_redirect_location(configuration: &configuration::Configuration, url: &str) -> Result<crate::models::GetRedirectLocation200Response, Error<GetRedirectLocationError>> {
865    let local_var_configuration = configuration;
866
867    let local_var_client = &local_var_configuration.client;
868
869    let local_var_uri_str = format!("{}/redirect_location", local_var_configuration.base_path);
870    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
871
872    local_var_req_builder = local_var_req_builder.query(&[("url", &url.to_string())]);
873    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
874        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
875    }
876    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
877        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
878    };
879
880    let local_var_req = local_var_req_builder.build()?;
881    let local_var_resp = local_var_client.execute(local_var_req).await?;
882
883    let local_var_status = local_var_resp.status();
884    let local_var_content = local_var_resp.text().await?;
885
886    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
887        serde_json::from_str(&local_var_content).map_err(Error::from)
888    } else {
889        let local_var_entity: Option<GetRedirectLocationError> = serde_json::from_str(&local_var_content).ok();
890        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
891        Err(Error::ResponseError(local_var_error))
892    }
893}
894
895/// Gets the timestamp corresponding to when the server busy flag will be automatically cleared.  __Minimum server version__: 5.20  ##### Permissions Must have `manage_system` permission. 
896pub async fn get_server_busy_expires(configuration: &configuration::Configuration, ) -> Result<crate::models::ServerBusy, Error<GetServerBusyExpiresError>> {
897    let local_var_configuration = configuration;
898
899    let local_var_client = &local_var_configuration.client;
900
901    let local_var_uri_str = format!("{}/server_busy", local_var_configuration.base_path);
902    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
903
904    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
905        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
906    }
907    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
908        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
909    };
910
911    let local_var_req = local_var_req_builder.build()?;
912    let local_var_resp = local_var_client.execute(local_var_req).await?;
913
914    let local_var_status = local_var_resp.status();
915    let local_var_content = local_var_resp.text().await?;
916
917    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
918        serde_json::from_str(&local_var_content).map_err(Error::from)
919    } else {
920        let local_var_entity: Option<GetServerBusyExpiresError> = serde_json::from_str(&local_var_content).ok();
921        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
922        Err(Error::ResponseError(local_var_error))
923    }
924}
925
926/// __Minimum server version__: 3.10 ##### Permissions Must be logged in. 
927pub async fn get_supported_timezone(configuration: &configuration::Configuration, ) -> Result<Vec<String>, Error<GetSupportedTimezoneError>> {
928    let local_var_configuration = configuration;
929
930    let local_var_client = &local_var_configuration.client;
931
932    let local_var_uri_str = format!("{}/system/timezones", local_var_configuration.base_path);
933    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
934
935    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
936        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
937    }
938    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
939        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
940    };
941
942    let local_var_req = local_var_req_builder.build()?;
943    let local_var_resp = local_var_client.execute(local_var_req).await?;
944
945    let local_var_status = local_var_resp.status();
946    let local_var_content = local_var_resp.text().await?;
947
948    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
949        serde_json::from_str(&local_var_content).map_err(Error::from)
950    } else {
951        let local_var_entity: Option<GetSupportedTimezoneError> = serde_json::from_str(&local_var_content).ok();
952        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
953        Err(Error::ResponseError(local_var_error))
954    }
955}
956
957/// Get the status of a set of metrics (enabled or disabled) from the Systems table.  The returned JSON contains the metrics that we need to warn the admin on with regard to their status (we return the ones whose status is \"true\", which means that they are in a \"warnable\" state - e.g. a threshold has been crossed or some other condition has been fulfilled).  __Minimum server version__: 5.26  ##### Permissions  Must have `manage_system` permission. 
958pub async fn get_warn_metrics_status(configuration: &configuration::Configuration, ) -> Result<crate::models::StatusOk, Error<GetWarnMetricsStatusError>> {
959    let local_var_configuration = configuration;
960
961    let local_var_client = &local_var_configuration.client;
962
963    let local_var_uri_str = format!("{}/warn_metrics/status", local_var_configuration.base_path);
964    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
965
966    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
967        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
968    }
969    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
970        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
971    };
972
973    let local_var_req = local_var_req_builder.build()?;
974    let local_var_resp = local_var_client.execute(local_var_req).await?;
975
976    let local_var_status = local_var_resp.status();
977    let local_var_content = local_var_resp.text().await?;
978
979    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
980        serde_json::from_str(&local_var_content).map_err(Error::from)
981    } else {
982        let local_var_entity: Option<GetWarnMetricsStatusError> = serde_json::from_str(&local_var_content).ok();
983        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
984        Err(Error::ResponseError(local_var_error))
985    }
986}
987
988/// Purge all the in-memory caches for the Mattermost server. This can have a temporary negative effect on performance while the caches are re-populated. ##### Permissions Must have `manage_system` permission. 
989pub async fn invalidate_caches(configuration: &configuration::Configuration, ) -> Result<crate::models::StatusOk, Error<InvalidateCachesError>> {
990    let local_var_configuration = configuration;
991
992    let local_var_client = &local_var_configuration.client;
993
994    let local_var_uri_str = format!("{}/caches/invalidate", local_var_configuration.base_path);
995    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
996
997    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
998        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
999    }
1000    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1001        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1002    };
1003
1004    let local_var_req = local_var_req_builder.build()?;
1005    let local_var_resp = local_var_client.execute(local_var_req).await?;
1006
1007    let local_var_status = local_var_resp.status();
1008    let local_var_content = local_var_resp.text().await?;
1009
1010    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1011        serde_json::from_str(&local_var_content).map_err(Error::from)
1012    } else {
1013        let local_var_entity: Option<InvalidateCachesError> = serde_json::from_str(&local_var_content).ok();
1014        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1015        Err(Error::ResponseError(local_var_error))
1016    }
1017}
1018
1019/// Will mark the specified notices as 'viewed' by the logged in user. __Minimum server version__: 5.26 ##### Permissions Must be logged in. 
1020pub async fn mark_notices_viewed(configuration: &configuration::Configuration, request_body: Vec<String>) -> Result<crate::models::StatusOk, Error<MarkNoticesViewedError>> {
1021    let local_var_configuration = configuration;
1022
1023    let local_var_client = &local_var_configuration.client;
1024
1025    let local_var_uri_str = format!("{}/system/notices/view", local_var_configuration.base_path);
1026    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
1027
1028    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1029        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1030    }
1031    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1032        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1033    };
1034    local_var_req_builder = local_var_req_builder.json(&request_body);
1035
1036    let local_var_req = local_var_req_builder.build()?;
1037    let local_var_resp = local_var_client.execute(local_var_req).await?;
1038
1039    let local_var_status = local_var_resp.status();
1040    let local_var_content = local_var_resp.text().await?;
1041
1042    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1043        serde_json::from_str(&local_var_content).map_err(Error::from)
1044    } else {
1045        let local_var_entity: Option<MarkNoticesViewedError> = serde_json::from_str(&local_var_content).ok();
1046        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1047        Err(Error::ResponseError(local_var_error))
1048    }
1049}
1050
1051/// Submit configuration to patch. As of server version 4.8, the `PluginSettings.EnableUploads` setting cannot be modified by this endpoint. ##### Permissions Must have `manage_system` permission. __Minimum server version__: 5.20 ##### Note The Plugins are stored as a map, and since a map may recursively go  down to any depth, individual fields of a map are not changed.  Consider using the `update config` (PUT api/v4/config) endpoint to update a plugins configurations. 
1052pub async fn patch_config(configuration: &configuration::Configuration, config: crate::models::Config) -> Result<crate::models::Config, Error<PatchConfigError>> {
1053    let local_var_configuration = configuration;
1054
1055    let local_var_client = &local_var_configuration.client;
1056
1057    let local_var_uri_str = format!("{}/config/patch", local_var_configuration.base_path);
1058    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
1059
1060    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1061        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1062    }
1063    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1064        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1065    };
1066    local_var_req_builder = local_var_req_builder.json(&config);
1067
1068    let local_var_req = local_var_req_builder.build()?;
1069    let local_var_resp = local_var_client.execute(local_var_req).await?;
1070
1071    let local_var_status = local_var_resp.status();
1072    let local_var_content = local_var_resp.text().await?;
1073
1074    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1075        serde_json::from_str(&local_var_content).map_err(Error::from)
1076    } else {
1077        let local_var_entity: Option<PatchConfigError> = serde_json::from_str(&local_var_content).ok();
1078        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1079        Err(Error::ResponseError(local_var_error))
1080    }
1081}
1082
1083/// Add log messages to the server logs. ##### Permissions Users with `manage_system` permission can log ERROR or DEBUG messages. Logged in users can log ERROR or DEBUG messages when `ServiceSettings.EnableDeveloper` is `true` or just DEBUG messages when `false`. Non-logged in users can log ERROR or DEBUG messages when `ServiceSettings.EnableDeveloper` is `true` and cannot log when `false`. 
1084pub async fn post_log(configuration: &configuration::Configuration, post_log_request: crate::models::PostLogRequest) -> Result<Vec<String>, Error<PostLogError>> {
1085    let local_var_configuration = configuration;
1086
1087    let local_var_client = &local_var_configuration.client;
1088
1089    let local_var_uri_str = format!("{}/logs", local_var_configuration.base_path);
1090    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1091
1092    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1093        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1094    }
1095    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1096        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1097    };
1098    local_var_req_builder = local_var_req_builder.json(&post_log_request);
1099
1100    let local_var_req = local_var_req_builder.build()?;
1101    let local_var_resp = local_var_client.execute(local_var_req).await?;
1102
1103    let local_var_status = local_var_resp.status();
1104    let local_var_content = local_var_resp.text().await?;
1105
1106    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1107        serde_json::from_str(&local_var_content).map_err(Error::from)
1108    } else {
1109        let local_var_entity: Option<PostLogError> = serde_json::from_str(&local_var_content).ok();
1110        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1111        Err(Error::ResponseError(local_var_error))
1112    }
1113}
1114
1115/// Reload the configuration file to pick up on any changes made to it. ##### Permissions Must have `manage_system` permission. 
1116pub async fn reload_config(configuration: &configuration::Configuration, ) -> Result<crate::models::StatusOk, Error<ReloadConfigError>> {
1117    let local_var_configuration = configuration;
1118
1119    let local_var_client = &local_var_configuration.client;
1120
1121    let local_var_uri_str = format!("{}/config/reload", local_var_configuration.base_path);
1122    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1123
1124    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1125        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1126    }
1127    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1128        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1129    };
1130
1131    let local_var_req = local_var_req_builder.build()?;
1132    let local_var_resp = local_var_client.execute(local_var_req).await?;
1133
1134    let local_var_status = local_var_resp.status();
1135    let local_var_content = local_var_resp.text().await?;
1136
1137    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1138        serde_json::from_str(&local_var_content).map_err(Error::from)
1139    } else {
1140        let local_var_entity: Option<ReloadConfigError> = serde_json::from_str(&local_var_content).ok();
1141        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1142        Err(Error::ResponseError(local_var_error))
1143    }
1144}
1145
1146/// Remove the license file from the server. This will disable all enterprise features.  __Minimum server version__: 4.0  ##### Permissions Must have `manage_system` permission. 
1147pub async fn remove_license_file(configuration: &configuration::Configuration, ) -> Result<(), Error<RemoveLicenseFileError>> {
1148    let local_var_configuration = configuration;
1149
1150    let local_var_client = &local_var_configuration.client;
1151
1152    let local_var_uri_str = format!("{}/license", local_var_configuration.base_path);
1153    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
1154
1155    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1156        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1157    }
1158    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1159        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1160    };
1161
1162    let local_var_req = local_var_req_builder.build()?;
1163    let local_var_resp = local_var_client.execute(local_var_req).await?;
1164
1165    let local_var_status = local_var_resp.status();
1166    let local_var_content = local_var_resp.text().await?;
1167
1168    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1169        Ok(())
1170    } else {
1171        let local_var_entity: Option<RemoveLicenseFileError> = serde_json::from_str(&local_var_content).ok();
1172        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1173        Err(Error::ResponseError(local_var_error))
1174    }
1175}
1176
1177/// Request the renewal link that would be used to start the license renewal process __Minimum server version__: 5.32 ##### Permissions Must have `sysconsole_write_about` permission. 
1178pub async fn request_license_renewal_link(configuration: &configuration::Configuration, ) -> Result<crate::models::LicenseRenewalLink, Error<RequestLicenseRenewalLinkError>> {
1179    let local_var_configuration = configuration;
1180
1181    let local_var_client = &local_var_configuration.client;
1182
1183    let local_var_uri_str = format!("{}/license/renewal", local_var_configuration.base_path);
1184    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1185
1186    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1187        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1188    }
1189    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1190        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1191    };
1192
1193    let local_var_req = local_var_req_builder.build()?;
1194    let local_var_resp = local_var_client.execute(local_var_req).await?;
1195
1196    let local_var_status = local_var_resp.status();
1197    let local_var_content = local_var_resp.text().await?;
1198
1199    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1200        serde_json::from_str(&local_var_content).map_err(Error::from)
1201    } else {
1202        let local_var_entity: Option<RequestLicenseRenewalLinkError> = serde_json::from_str(&local_var_content).ok();
1203        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1204        Err(Error::ResponseError(local_var_error))
1205    }
1206}
1207
1208/// Request and install a trial license for your server __Minimum server version__: 5.25 ##### Permissions Must have `manage_system` permission. 
1209pub async fn request_trial_license(configuration: &configuration::Configuration, request_trial_license_request: crate::models::RequestTrialLicenseRequest) -> Result<(), Error<RequestTrialLicenseError>> {
1210    let local_var_configuration = configuration;
1211
1212    let local_var_client = &local_var_configuration.client;
1213
1214    let local_var_uri_str = format!("{}/trial-license", local_var_configuration.base_path);
1215    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1216
1217    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1218        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1219    }
1220    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1221        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1222    };
1223    local_var_req_builder = local_var_req_builder.json(&request_trial_license_request);
1224
1225    let local_var_req = local_var_req_builder.build()?;
1226    let local_var_resp = local_var_client.execute(local_var_req).await?;
1227
1228    let local_var_status = local_var_resp.status();
1229    let local_var_content = local_var_resp.text().await?;
1230
1231    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1232        Ok(())
1233    } else {
1234        let local_var_entity: Option<RequestTrialLicenseError> = serde_json::from_str(&local_var_content).ok();
1235        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1236        Err(Error::ResponseError(local_var_error))
1237    }
1238}
1239
1240/// It restarts the current running mattermost instance to execute the new Enterprise binary. __Minimum server version__: 5.27 ##### Permissions Must have `manage_system` permission. 
1241pub async fn restart_server(configuration: &configuration::Configuration, ) -> Result<crate::models::StatusOk, Error<RestartServerError>> {
1242    let local_var_configuration = configuration;
1243
1244    let local_var_client = &local_var_configuration.client;
1245
1246    let local_var_uri_str = format!("{}/restart", local_var_configuration.base_path);
1247    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1248
1249    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1250        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1251    }
1252    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1253        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1254    };
1255
1256    let local_var_req = local_var_req_builder.build()?;
1257    let local_var_resp = local_var_client.execute(local_var_req).await?;
1258
1259    let local_var_status = local_var_resp.status();
1260    let local_var_content = local_var_resp.text().await?;
1261
1262    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1263        serde_json::from_str(&local_var_content).map_err(Error::from)
1264    } else {
1265        let local_var_entity: Option<RestartServerError> = serde_json::from_str(&local_var_content).ok();
1266        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1267        Err(Error::ResponseError(local_var_error))
1268    }
1269}
1270
1271/// Request a trial license and acknowledge a warning for the warn_metric_id metric crossing a threshold (or some similar condition being fulfilled) - sets the \"ack\" status for all the warn metrics in the system.  __Minimum server version__: 5.28  ##### Permissions  Must have `manage_system` permission. 
1272pub async fn send_trial_license_warn_metric_ack(configuration: &configuration::Configuration, warn_metric_id: &str) -> Result<crate::models::StatusOk, Error<SendTrialLicenseWarnMetricAckError>> {
1273    let local_var_configuration = configuration;
1274
1275    let local_var_client = &local_var_configuration.client;
1276
1277    let local_var_uri_str = format!("{}/warn_metrics/trial-license-ack/{warn_metric_id}", local_var_configuration.base_path, warn_metric_id=crate::apis::urlencode(warn_metric_id));
1278    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1279
1280    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1281        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1282    }
1283    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1284        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1285    };
1286
1287    let local_var_req = local_var_req_builder.build()?;
1288    let local_var_resp = local_var_client.execute(local_var_req).await?;
1289
1290    let local_var_status = local_var_resp.status();
1291    let local_var_content = local_var_resp.text().await?;
1292
1293    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1294        serde_json::from_str(&local_var_content).map_err(Error::from)
1295    } else {
1296        let local_var_entity: Option<SendTrialLicenseWarnMetricAckError> = serde_json::from_str(&local_var_content).ok();
1297        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1298        Err(Error::ResponseError(local_var_error))
1299    }
1300}
1301
1302/// Acknowledge a warning for the warn_metric_id metric crossing a threshold (or some similar condition being fulfilled) - attempts to send an ack email to acknowledge@mattermost.com and sets the \"ack\" status for all the warn metrics in the system.  __Minimum server version__: 5.26  ##### Permissions  Must have `manage_system` permission. 
1303pub async fn send_warn_metric_ack(configuration: &configuration::Configuration, warn_metric_id: &str, send_warn_metric_ack_request: crate::models::SendWarnMetricAckRequest) -> Result<crate::models::StatusOk, Error<SendWarnMetricAckError>> {
1304    let local_var_configuration = configuration;
1305
1306    let local_var_client = &local_var_configuration.client;
1307
1308    let local_var_uri_str = format!("{}/warn_metrics/ack/{warn_metric_id}", local_var_configuration.base_path, warn_metric_id=crate::apis::urlencode(warn_metric_id));
1309    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1310
1311    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1312        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1313    }
1314    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1315        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1316    };
1317    local_var_req_builder = local_var_req_builder.json(&send_warn_metric_ack_request);
1318
1319    let local_var_req = local_var_req_builder.build()?;
1320    let local_var_resp = local_var_client.execute(local_var_req).await?;
1321
1322    let local_var_status = local_var_resp.status();
1323    let local_var_content = local_var_resp.text().await?;
1324
1325    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1326        serde_json::from_str(&local_var_content).map_err(Error::from)
1327    } else {
1328        let local_var_entity: Option<SendWarnMetricAckError> = serde_json::from_str(&local_var_content).ok();
1329        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1330        Err(Error::ResponseError(local_var_error))
1331    }
1332}
1333
1334/// Marks the server as currently having high load which disables non-critical services such as search, statuses and typing notifications.  __Minimum server version__: 5.20  ##### Permissions Must have `manage_system` permission. 
1335pub async fn set_server_busy(configuration: &configuration::Configuration, seconds: Option<&str>) -> Result<crate::models::StatusOk, Error<SetServerBusyError>> {
1336    let local_var_configuration = configuration;
1337
1338    let local_var_client = &local_var_configuration.client;
1339
1340    let local_var_uri_str = format!("{}/server_busy", local_var_configuration.base_path);
1341    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1342
1343    if let Some(ref local_var_str) = seconds {
1344        local_var_req_builder = local_var_req_builder.query(&[("seconds", &local_var_str.to_string())]);
1345    }
1346    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1347        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1348    }
1349    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1350        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1351    };
1352
1353    let local_var_req = local_var_req_builder.build()?;
1354    let local_var_resp = local_var_client.execute(local_var_req).await?;
1355
1356    let local_var_status = local_var_resp.status();
1357    let local_var_content = local_var_resp.text().await?;
1358
1359    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1360        serde_json::from_str(&local_var_content).map_err(Error::from)
1361    } else {
1362        let local_var_entity: Option<SetServerBusyError> = serde_json::from_str(&local_var_content).ok();
1363        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1364        Err(Error::ResponseError(local_var_error))
1365    }
1366}
1367
1368/// Send a test email to make sure you have your email settings configured correctly. Optionally provide a configuration in the request body to test. If no valid configuration is present in the request body the current server configuration will be tested. ##### Permissions Must have `manage_system` permission. 
1369pub async fn test_email(configuration: &configuration::Configuration, config: crate::models::Config) -> Result<crate::models::StatusOk, Error<TestEmailError>> {
1370    let local_var_configuration = configuration;
1371
1372    let local_var_client = &local_var_configuration.client;
1373
1374    let local_var_uri_str = format!("{}/email/test", local_var_configuration.base_path);
1375    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1376
1377    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1378        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1379    }
1380    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1381        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1382    };
1383    local_var_req_builder = local_var_req_builder.json(&config);
1384
1385    let local_var_req = local_var_req_builder.build()?;
1386    let local_var_resp = local_var_client.execute(local_var_req).await?;
1387
1388    let local_var_status = local_var_resp.status();
1389    let local_var_content = local_var_resp.text().await?;
1390
1391    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1392        serde_json::from_str(&local_var_content).map_err(Error::from)
1393    } else {
1394        let local_var_entity: Option<TestEmailError> = serde_json::from_str(&local_var_content).ok();
1395        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1396        Err(Error::ResponseError(local_var_error))
1397    }
1398}
1399
1400/// Send a test to validate if can connect to AWS S3. Optionally provide a configuration in the request body to test. If no valid configuration is present in the request body the current server configuration will be tested. ##### Permissions Must have `manage_system` permission. __Minimum server version__: 4.8 
1401pub async fn test_s3_connection(configuration: &configuration::Configuration, config: crate::models::Config) -> Result<crate::models::StatusOk, Error<TestS3ConnectionError>> {
1402    let local_var_configuration = configuration;
1403
1404    let local_var_client = &local_var_configuration.client;
1405
1406    let local_var_uri_str = format!("{}/file/s3_test", local_var_configuration.base_path);
1407    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1408
1409    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1410        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1411    }
1412    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1413        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1414    };
1415    local_var_req_builder = local_var_req_builder.json(&config);
1416
1417    let local_var_req = local_var_req_builder.build()?;
1418    let local_var_resp = local_var_client.execute(local_var_req).await?;
1419
1420    let local_var_status = local_var_resp.status();
1421    let local_var_content = local_var_resp.text().await?;
1422
1423    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1424        serde_json::from_str(&local_var_content).map_err(Error::from)
1425    } else {
1426        let local_var_entity: Option<TestS3ConnectionError> = serde_json::from_str(&local_var_content).ok();
1427        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1428        Err(Error::ResponseError(local_var_error))
1429    }
1430}
1431
1432/// Sends a Ping request to the mattermost server using the specified Site URL.  ##### Permissions Must have `manage_system` permission.  __Minimum server version__: 5.16 
1433pub async fn test_site_url(configuration: &configuration::Configuration, test_site_url_request: crate::models::TestSiteUrlRequest) -> Result<crate::models::StatusOk, Error<TestSiteUrlError>> {
1434    let local_var_configuration = configuration;
1435
1436    let local_var_client = &local_var_configuration.client;
1437
1438    let local_var_uri_str = format!("{}/site_url/test", local_var_configuration.base_path);
1439    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1440
1441    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1442        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1443    }
1444    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1445        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1446    };
1447    local_var_req_builder = local_var_req_builder.json(&test_site_url_request);
1448
1449    let local_var_req = local_var_req_builder.build()?;
1450    let local_var_resp = local_var_client.execute(local_var_req).await?;
1451
1452    let local_var_status = local_var_resp.status();
1453    let local_var_content = local_var_resp.text().await?;
1454
1455    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1456        serde_json::from_str(&local_var_content).map_err(Error::from)
1457    } else {
1458        let local_var_entity: Option<TestSiteUrlError> = serde_json::from_str(&local_var_content).ok();
1459        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1460        Err(Error::ResponseError(local_var_error))
1461    }
1462}
1463
1464/// Submit a new configuration for the server to use. As of server version 4.8, the `PluginSettings.EnableUploads` setting cannot be modified by this endpoint. Note that the parameters that aren't set in the configuration that you provide will be reset to default values. Therefore, if you want to change a configuration parameter and leave the other ones unchanged, you need to get the existing configuration first, change the field that you want, then put that new configuration. ##### Permissions Must have `manage_system` permission. 
1465pub async fn update_config(configuration: &configuration::Configuration, config: crate::models::Config) -> Result<crate::models::Config, Error<UpdateConfigError>> {
1466    let local_var_configuration = configuration;
1467
1468    let local_var_client = &local_var_configuration.client;
1469
1470    let local_var_uri_str = format!("{}/config", local_var_configuration.base_path);
1471    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
1472
1473    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1474        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1475    }
1476    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1477        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1478    };
1479    local_var_req_builder = local_var_req_builder.json(&config);
1480
1481    let local_var_req = local_var_req_builder.build()?;
1482    let local_var_resp = local_var_client.execute(local_var_req).await?;
1483
1484    let local_var_status = local_var_resp.status();
1485    let local_var_content = local_var_resp.text().await?;
1486
1487    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1488        serde_json::from_str(&local_var_content).map_err(Error::from)
1489    } else {
1490        let local_var_entity: Option<UpdateConfigError> = serde_json::from_str(&local_var_content).ok();
1491        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1492        Err(Error::ResponseError(local_var_error))
1493    }
1494}
1495
1496/// Stores the system-level status that specifies that at least an admin has visited the in-product Plugin Marketplace. __Minimum server version: 5.33__ ##### Permissions Must have `manage_system` permissions. 
1497pub async fn update_marketplace_visited_by_admin(configuration: &configuration::Configuration, system: crate::models::System) -> Result<crate::models::StatusOk, Error<UpdateMarketplaceVisitedByAdminError>> {
1498    let local_var_configuration = configuration;
1499
1500    let local_var_client = &local_var_configuration.client;
1501
1502    let local_var_uri_str = format!("{}/plugins/marketplace/first_admin_visit", local_var_configuration.base_path);
1503    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1504
1505    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1506        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1507    }
1508    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1509        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1510    };
1511    local_var_req_builder = local_var_req_builder.json(&system);
1512
1513    let local_var_req = local_var_req_builder.build()?;
1514    let local_var_resp = local_var_client.execute(local_var_req).await?;
1515
1516    let local_var_status = local_var_resp.status();
1517    let local_var_content = local_var_resp.text().await?;
1518
1519    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1520        serde_json::from_str(&local_var_content).map_err(Error::from)
1521    } else {
1522        let local_var_entity: Option<UpdateMarketplaceVisitedByAdminError> = serde_json::from_str(&local_var_content).ok();
1523        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1524        Err(Error::ResponseError(local_var_error))
1525    }
1526}
1527
1528/// It downloads the Mattermost Enterprise Edition of your current version and replace your current version with it. After the upgrade you need to restart the Mattermost server. __Minimum server version__: 5.27 ##### Permissions Must have `manage_system` permission. 
1529pub async fn upgrade_to_enterprise(configuration: &configuration::Configuration, ) -> Result<crate::models::PushNotification, Error<UpgradeToEnterpriseError>> {
1530    let local_var_configuration = configuration;
1531
1532    let local_var_client = &local_var_configuration.client;
1533
1534    let local_var_uri_str = format!("{}/upgrade_to_enterprise", local_var_configuration.base_path);
1535    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1536
1537    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1538        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1539    }
1540    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1541        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1542    };
1543
1544    let local_var_req = local_var_req_builder.build()?;
1545    let local_var_resp = local_var_client.execute(local_var_req).await?;
1546
1547    let local_var_status = local_var_resp.status();
1548    let local_var_content = local_var_resp.text().await?;
1549
1550    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1551        serde_json::from_str(&local_var_content).map_err(Error::from)
1552    } else {
1553        let local_var_entity: Option<UpgradeToEnterpriseError> = serde_json::from_str(&local_var_content).ok();
1554        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1555        Err(Error::ResponseError(local_var_error))
1556    }
1557}
1558
1559/// It returns the percentage of completion of the current upgrade or the error if there is any. __Minimum server version__: 5.27 ##### Permissions Must have `manage_system` permission. 
1560pub async fn upgrade_to_enterprise_status(configuration: &configuration::Configuration, ) -> Result<crate::models::UpgradeToEnterpriseStatus200Response, Error<UpgradeToEnterpriseStatusError>> {
1561    let local_var_configuration = configuration;
1562
1563    let local_var_client = &local_var_configuration.client;
1564
1565    let local_var_uri_str = format!("{}/upgrade_to_enterprise/status", local_var_configuration.base_path);
1566    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1567
1568    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1569        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1570    }
1571    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1572        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1573    };
1574
1575    let local_var_req = local_var_req_builder.build()?;
1576    let local_var_resp = local_var_client.execute(local_var_req).await?;
1577
1578    let local_var_status = local_var_resp.status();
1579    let local_var_content = local_var_resp.text().await?;
1580
1581    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1582        serde_json::from_str(&local_var_content).map_err(Error::from)
1583    } else {
1584        let local_var_entity: Option<UpgradeToEnterpriseStatusError> = serde_json::from_str(&local_var_content).ok();
1585        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1586        Err(Error::ResponseError(local_var_error))
1587    }
1588}
1589
1590/// Upload a license to enable enterprise features.  __Minimum server version__: 4.0  ##### Permissions Must have `manage_system` permission. 
1591pub async fn upload_license_file(configuration: &configuration::Configuration, license: std::path::PathBuf) -> Result<crate::models::StatusOk, Error<UploadLicenseFileError>> {
1592    let local_var_configuration = configuration;
1593
1594    let local_var_client = &local_var_configuration.client;
1595
1596    let local_var_uri_str = format!("{}/license", local_var_configuration.base_path);
1597    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1598
1599    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1600        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1601    }
1602    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1603        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1604    };
1605    let mut local_var_form = reqwest::multipart::Form::new();
1606    // TODO: support file upload for 'license' parameter
1607    local_var_req_builder = local_var_req_builder.multipart(local_var_form);
1608
1609    let local_var_req = local_var_req_builder.build()?;
1610    let local_var_resp = local_var_client.execute(local_var_req).await?;
1611
1612    let local_var_status = local_var_resp.status();
1613    let local_var_content = local_var_resp.text().await?;
1614
1615    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1616        serde_json::from_str(&local_var_content).map_err(Error::from)
1617    } else {
1618        let local_var_entity: Option<UploadLicenseFileError> = serde_json::from_str(&local_var_content).ok();
1619        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1620        Err(Error::ResponseError(local_var_error))
1621    }
1622}
1623