mattermost_client/openapi/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
11use reqwest;
12
13use super::{configuration, Error};
14use super::ResponseContent;
15
16/// struct for passing parameters to the method [`get_analytics_old`]
17#[derive(Clone, Debug, Default)]
18pub struct GetAnalyticsOldParams {
19    /// Possible values are \"standard\", \"bot_post_counts_day\", \"post_counts_day\", \"user_counts_with_posts_day\" or \"extra_counts\"
20    pub name: Option<String>,
21    /// The team ID to filter the data by
22    pub team_id: Option<String>,
23}
24
25/// struct for passing parameters to the method [`get_audits`]
26#[derive(Clone, Debug, Default)]
27pub struct GetAuditsParams {
28    /// The page to select.
29    pub page: Option<i32>,
30    /// The number of audits per page.
31    pub per_page: Option<i32>,
32}
33
34/// struct for passing parameters to the method [`get_client_config`]
35#[derive(Clone, Debug, Default)]
36pub struct GetClientConfigParams {
37    /// Must be `old`, other formats not implemented yet
38    pub format: String,
39}
40
41/// struct for passing parameters to the method [`get_client_license`]
42#[derive(Clone, Debug, Default)]
43pub struct GetClientLicenseParams {
44    /// Must be `old`, other formats not implemented yet
45    pub format: String,
46}
47
48/// struct for passing parameters to the method [`get_logs`]
49#[derive(Clone, Debug, Default)]
50pub struct GetLogsParams {
51    /// The page to select.
52    pub page: Option<i32>,
53    /// The number of logs per page. There is a maximum limit of 10000 logs per page.
54    pub logs_per_page: Option<String>,
55}
56
57/// struct for passing parameters to the method [`get_notices`]
58#[derive(Clone, Debug, Default)]
59pub struct GetNoticesParams {
60    /// Version of the client (desktop/mobile/web) that issues the request
61    pub client_version: String,
62    /// Client type (web/mobile-ios/mobile-android/desktop)
63    pub client: String,
64    /// ID of the team
65    pub team_id: String,
66    /// Client locale
67    pub locale: Option<String>,
68}
69
70/// struct for passing parameters to the method [`get_ping`]
71#[derive(Clone, Debug, Default)]
72pub struct GetPingParams {
73    /// Check the status of the database and file storage as well
74    pub get_server_status: Option<bool>,
75    /// Check whether this device id can receive push notifications
76    pub device_id: Option<String>,
77}
78
79/// struct for passing parameters to the method [`get_redirect_location`]
80#[derive(Clone, Debug, Default)]
81pub struct GetRedirectLocationParams {
82    /// Url to check
83    pub url: String,
84}
85
86/// struct for passing parameters to the method [`mark_notices_viewed`]
87#[derive(Clone, Debug, Default)]
88pub struct MarkNoticesViewedParams {
89    /// Array of notice IDs
90    pub request_body: Vec<String>,
91}
92
93/// struct for passing parameters to the method [`patch_config`]
94#[derive(Clone, Debug, Default)]
95pub struct PatchConfigParams {
96    /// Mattermost configuration
97    pub config: crate::openapi::models::Config,
98}
99
100/// struct for passing parameters to the method [`post_log`]
101#[derive(Clone, Debug, Default)]
102pub struct PostLogParams {
103    pub post_log_request: crate::openapi::models::PostLogRequest,
104}
105
106/// struct for passing parameters to the method [`request_trial_license`]
107#[derive(Clone, Debug, Default)]
108pub struct RequestTrialLicenseParams {
109    /// License request
110    pub request_trial_license_request: crate::openapi::models::RequestTrialLicenseRequest,
111}
112
113/// struct for passing parameters to the method [`send_trial_license_warn_metric_ack`]
114#[derive(Clone, Debug, Default)]
115pub struct SendTrialLicenseWarnMetricAckParams {
116    /// Warn Metric Id.
117    pub warn_metric_id: String,
118}
119
120/// struct for passing parameters to the method [`send_warn_metric_ack`]
121#[derive(Clone, Debug, Default)]
122pub struct SendWarnMetricAckParams {
123    /// Warn Metric Id.
124    pub warn_metric_id: String,
125    /// payload that contains the ack flag
126    pub send_warn_metric_ack_request: crate::openapi::models::SendWarnMetricAckRequest,
127}
128
129/// struct for passing parameters to the method [`set_server_busy`]
130#[derive(Clone, Debug, Default)]
131pub struct SetServerBusyParams {
132    /// Number of seconds until server is automatically marked as not busy.
133    pub seconds: Option<String>,
134}
135
136/// struct for passing parameters to the method [`test_email`]
137#[derive(Clone, Debug, Default)]
138pub struct TestEmailParams {
139    /// Mattermost configuration
140    pub config: crate::openapi::models::Config,
141}
142
143/// struct for passing parameters to the method [`test_s3_connection`]
144#[derive(Clone, Debug, Default)]
145pub struct TestS3ConnectionParams {
146    /// Mattermost configuration
147    pub config: crate::openapi::models::Config,
148}
149
150/// struct for passing parameters to the method [`test_site_url`]
151#[derive(Clone, Debug, Default)]
152pub struct TestSiteUrlParams {
153    pub test_site_url_request: crate::openapi::models::TestSiteUrlRequest,
154}
155
156/// struct for passing parameters to the method [`update_config`]
157#[derive(Clone, Debug, Default)]
158pub struct UpdateConfigParams {
159    /// Mattermost configuration
160    pub config: crate::openapi::models::Config,
161}
162
163/// struct for passing parameters to the method [`update_marketplace_visited_by_admin`]
164#[derive(Clone, Debug, Default)]
165pub struct UpdateMarketplaceVisitedByAdminParams {
166    pub system: crate::openapi::models::System,
167}
168
169/// struct for passing parameters to the method [`upload_license_file`]
170#[derive(Clone, Debug, Default)]
171pub struct UploadLicenseFileParams {
172    /// The license to be uploaded
173    pub license: std::path::PathBuf,
174}
175
176/// struct for typed errors of method [`check_integrity`]
177#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
178#[serde(untagged)]
179pub enum CheckIntegrityError {
180    UnknownValue(serde_json::Value),
181}
182
183/// struct for typed errors of method [`clear_server_busy`]
184#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
185#[serde(untagged)]
186pub enum ClearServerBusyError {
187    Status403(crate::openapi::models::AppError),
188    UnknownValue(serde_json::Value),
189}
190
191/// struct for typed errors of method [`database_recycle`]
192#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
193#[serde(untagged)]
194pub enum DatabaseRecycleError {
195    Status403(crate::openapi::models::AppError),
196    UnknownValue(serde_json::Value),
197}
198
199/// struct for typed errors of method [`generate_support_packet`]
200#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
201#[serde(untagged)]
202pub enum GenerateSupportPacketError {
203    Status400(crate::openapi::models::AppError),
204    Status401(crate::openapi::models::AppError),
205    Status403(crate::openapi::models::AppError),
206    Status404(crate::openapi::models::AppError),
207    UnknownValue(serde_json::Value),
208}
209
210/// struct for typed errors of method [`get_analytics_old`]
211#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
212#[serde(untagged)]
213pub enum GetAnalyticsOldError {
214    Status400(crate::openapi::models::AppError),
215    Status401(crate::openapi::models::AppError),
216    Status403(crate::openapi::models::AppError),
217    UnknownValue(serde_json::Value),
218}
219
220/// struct for typed errors of method [`get_audits`]
221#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
222#[serde(untagged)]
223pub enum GetAuditsError {
224    Status403(crate::openapi::models::AppError),
225    UnknownValue(serde_json::Value),
226}
227
228/// struct for typed errors of method [`get_client_config`]
229#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
230#[serde(untagged)]
231pub enum GetClientConfigError {
232    Status400(crate::openapi::models::AppError),
233    Status501(crate::openapi::models::AppError),
234    UnknownValue(serde_json::Value),
235}
236
237/// struct for typed errors of method [`get_client_license`]
238#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
239#[serde(untagged)]
240pub enum GetClientLicenseError {
241    Status400(crate::openapi::models::AppError),
242    Status501(crate::openapi::models::AppError),
243    UnknownValue(serde_json::Value),
244}
245
246/// struct for typed errors of method [`get_config`]
247#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
248#[serde(untagged)]
249pub enum GetConfigError {
250    Status400(crate::openapi::models::AppError),
251    Status403(crate::openapi::models::AppError),
252    UnknownValue(serde_json::Value),
253}
254
255/// struct for typed errors of method [`get_environment_config`]
256#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
257#[serde(untagged)]
258pub enum GetEnvironmentConfigError {
259    Status400(crate::openapi::models::AppError),
260    Status401(crate::openapi::models::AppError),
261    Status403(crate::openapi::models::AppError),
262    UnknownValue(serde_json::Value),
263}
264
265/// struct for typed errors of method [`get_image_by_url`]
266#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
267#[serde(untagged)]
268pub enum GetImageByUrlError {
269    Status404(crate::openapi::models::AppError),
270    UnknownValue(serde_json::Value),
271}
272
273/// struct for typed errors of method [`get_logs`]
274#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
275#[serde(untagged)]
276pub enum GetLogsError {
277    Status403(crate::openapi::models::AppError),
278    UnknownValue(serde_json::Value),
279}
280
281/// struct for typed errors of method [`get_notices`]
282#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
283#[serde(untagged)]
284pub enum GetNoticesError {
285    Status500(crate::openapi::models::AppError),
286    UnknownValue(serde_json::Value),
287}
288
289/// struct for typed errors of method [`get_ping`]
290#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
291#[serde(untagged)]
292pub enum GetPingError {
293    Status500(crate::openapi::models::AppError),
294    UnknownValue(serde_json::Value),
295}
296
297/// struct for typed errors of method [`get_prev_trial_license`]
298#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
299#[serde(untagged)]
300pub enum GetPrevTrialLicenseError {
301    Status400(crate::openapi::models::AppError),
302    Status401(crate::openapi::models::AppError),
303    Status403(crate::openapi::models::AppError),
304    UnknownValue(serde_json::Value),
305}
306
307/// struct for typed errors of method [`get_redirect_location`]
308#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
309#[serde(untagged)]
310pub enum GetRedirectLocationError {
311    Status404(crate::openapi::models::AppError),
312    UnknownValue(serde_json::Value),
313}
314
315/// struct for typed errors of method [`get_server_busy_expires`]
316#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
317#[serde(untagged)]
318pub enum GetServerBusyExpiresError {
319    Status403(crate::openapi::models::AppError),
320    UnknownValue(serde_json::Value),
321}
322
323/// struct for typed errors of method [`get_supported_timezone`]
324#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
325#[serde(untagged)]
326pub enum GetSupportedTimezoneError {
327    Status500(crate::openapi::models::AppError),
328    UnknownValue(serde_json::Value),
329}
330
331/// struct for typed errors of method [`get_warn_metrics_status`]
332#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
333#[serde(untagged)]
334pub enum GetWarnMetricsStatusError {
335    Status400(crate::openapi::models::AppError),
336    Status401(crate::openapi::models::AppError),
337    Status403(crate::openapi::models::AppError),
338    UnknownValue(serde_json::Value),
339}
340
341/// struct for typed errors of method [`invalidate_caches`]
342#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
343#[serde(untagged)]
344pub enum InvalidateCachesError {
345    Status403(crate::openapi::models::AppError),
346    UnknownValue(serde_json::Value),
347}
348
349/// struct for typed errors of method [`mark_notices_viewed`]
350#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
351#[serde(untagged)]
352pub enum MarkNoticesViewedError {
353    Status500(crate::openapi::models::AppError),
354    UnknownValue(serde_json::Value),
355}
356
357/// struct for typed errors of method [`patch_config`]
358#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
359#[serde(untagged)]
360pub enum PatchConfigError {
361    Status400(crate::openapi::models::AppError),
362    Status403(crate::openapi::models::AppError),
363    UnknownValue(serde_json::Value),
364}
365
366/// struct for typed errors of method [`post_log`]
367#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
368#[serde(untagged)]
369pub enum PostLogError {
370    Status403(crate::openapi::models::AppError),
371    UnknownValue(serde_json::Value),
372}
373
374/// struct for typed errors of method [`reload_config`]
375#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
376#[serde(untagged)]
377pub enum ReloadConfigError {
378    Status400(crate::openapi::models::AppError),
379    Status403(crate::openapi::models::AppError),
380    UnknownValue(serde_json::Value),
381}
382
383/// struct for typed errors of method [`remove_license_file`]
384#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
385#[serde(untagged)]
386pub enum RemoveLicenseFileError {
387    Status401(crate::openapi::models::AppError),
388    Status403(crate::openapi::models::AppError),
389    UnknownValue(serde_json::Value),
390}
391
392/// struct for typed errors of method [`request_license_renewal_link`]
393#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
394#[serde(untagged)]
395pub enum RequestLicenseRenewalLinkError {
396    Status400(crate::openapi::models::AppError),
397    Status401(crate::openapi::models::AppError),
398    Status403(crate::openapi::models::AppError),
399    Status500(crate::openapi::models::AppError),
400    UnknownValue(serde_json::Value),
401}
402
403/// struct for typed errors of method [`request_trial_license`]
404#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
405#[serde(untagged)]
406pub enum RequestTrialLicenseError {
407    Status400(crate::openapi::models::AppError),
408    Status401(crate::openapi::models::AppError),
409    Status403(crate::openapi::models::AppError),
410    UnknownValue(serde_json::Value),
411}
412
413/// struct for typed errors of method [`restart_server`]
414#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
415#[serde(untagged)]
416pub enum RestartServerError {
417    Status403(crate::openapi::models::AppError),
418    UnknownValue(serde_json::Value),
419}
420
421/// struct for typed errors of method [`send_trial_license_warn_metric_ack`]
422#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
423#[serde(untagged)]
424pub enum SendTrialLicenseWarnMetricAckError {
425    Status400(crate::openapi::models::AppError),
426    Status401(crate::openapi::models::AppError),
427    Status403(crate::openapi::models::AppError),
428    UnknownValue(serde_json::Value),
429}
430
431/// struct for typed errors of method [`send_warn_metric_ack`]
432#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
433#[serde(untagged)]
434pub enum SendWarnMetricAckError {
435    Status400(crate::openapi::models::AppError),
436    Status401(crate::openapi::models::AppError),
437    Status403(crate::openapi::models::AppError),
438    UnknownValue(serde_json::Value),
439}
440
441/// struct for typed errors of method [`set_server_busy`]
442#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
443#[serde(untagged)]
444pub enum SetServerBusyError {
445    Status400(crate::openapi::models::AppError),
446    Status403(crate::openapi::models::AppError),
447    UnknownValue(serde_json::Value),
448}
449
450/// struct for typed errors of method [`test_email`]
451#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
452#[serde(untagged)]
453pub enum TestEmailError {
454    Status403(crate::openapi::models::AppError),
455    Status500(crate::openapi::models::AppError),
456    UnknownValue(serde_json::Value),
457}
458
459/// struct for typed errors of method [`test_s3_connection`]
460#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
461#[serde(untagged)]
462pub enum TestS3ConnectionError {
463    Status403(crate::openapi::models::AppError),
464    Status500(crate::openapi::models::AppError),
465    UnknownValue(serde_json::Value),
466}
467
468/// struct for typed errors of method [`test_site_url`]
469#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
470#[serde(untagged)]
471pub enum TestSiteUrlError {
472    Status400(crate::openapi::models::AppError),
473    Status403(crate::openapi::models::AppError),
474    Status500(crate::openapi::models::AppError),
475    UnknownValue(serde_json::Value),
476}
477
478/// struct for typed errors of method [`update_config`]
479#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
480#[serde(untagged)]
481pub enum UpdateConfigError {
482    Status400(crate::openapi::models::AppError),
483    Status403(crate::openapi::models::AppError),
484    UnknownValue(serde_json::Value),
485}
486
487/// struct for typed errors of method [`update_marketplace_visited_by_admin`]
488#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
489#[serde(untagged)]
490pub enum UpdateMarketplaceVisitedByAdminError {
491    Status403(crate::openapi::models::AppError),
492    Status500(crate::openapi::models::AppError),
493    UnknownValue(serde_json::Value),
494}
495
496/// struct for typed errors of method [`upgrade_to_enterprise`]
497#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
498#[serde(untagged)]
499pub enum UpgradeToEnterpriseError {
500    Status403(crate::openapi::models::AppError),
501    Status429(crate::openapi::models::AppError),
502    UnknownValue(serde_json::Value),
503}
504
505/// struct for typed errors of method [`upgrade_to_enterprise_status`]
506#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
507#[serde(untagged)]
508pub enum UpgradeToEnterpriseStatusError {
509    Status403(crate::openapi::models::AppError),
510    UnknownValue(serde_json::Value),
511}
512
513/// struct for typed errors of method [`upload_license_file`]
514#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
515#[serde(untagged)]
516pub enum UploadLicenseFileError {
517    Status400(crate::openapi::models::AppError),
518    Status401(crate::openapi::models::AppError),
519    Status403(crate::openapi::models::AppError),
520    Status413(crate::openapi::models::AppError),
521    UnknownValue(serde_json::Value),
522}
523
524/// 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).
525pub async fn check_integrity(
526    configuration: &configuration::Configuration,
527) -> Result<Vec<crate::openapi::models::IntegrityCheckResult>, Error<CheckIntegrityError>> {
528    let local_var_configuration = configuration;
529
530    // unbox the parameters
531
532    let local_var_client = &local_var_configuration.client;
533
534    let local_var_uri_str = format!("{}/api/v4/integrity", local_var_configuration.base_path);
535    let mut local_var_req_builder =
536        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
537
538    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
539        local_var_req_builder =
540            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
541    }
542    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
543        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
544    };
545
546    let local_var_req = local_var_req_builder.build()?;
547    let local_var_resp = local_var_client.execute(local_var_req).await?;
548
549    let local_var_status = local_var_resp.status();
550    let local_var_content = local_var_resp.text().await?;
551
552    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
553        serde_json::from_str(&local_var_content).map_err(Error::from)
554    } else {
555        let local_var_entity: Option<CheckIntegrityError> =
556            serde_json::from_str(&local_var_content).ok();
557        let local_var_error = ResponseContent {
558            status: local_var_status,
559            content: local_var_content,
560            entity: local_var_entity,
561        };
562        Err(Error::ResponseError(local_var_error))
563    }
564}
565
566/// 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.
567pub async fn clear_server_busy(
568    configuration: &configuration::Configuration,
569) -> Result<crate::openapi::models::StatusOk, Error<ClearServerBusyError>> {
570    let local_var_configuration = configuration;
571
572    // unbox the parameters
573
574    let local_var_client = &local_var_configuration.client;
575
576    let local_var_uri_str = format!("{}/api/v4/server_busy", local_var_configuration.base_path);
577    let mut local_var_req_builder =
578        local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
579
580    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
581        local_var_req_builder =
582            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
583    }
584    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
585        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
586    };
587
588    let local_var_req = local_var_req_builder.build()?;
589    let local_var_resp = local_var_client.execute(local_var_req).await?;
590
591    let local_var_status = local_var_resp.status();
592    let local_var_content = local_var_resp.text().await?;
593
594    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
595        serde_json::from_str(&local_var_content).map_err(Error::from)
596    } else {
597        let local_var_entity: Option<ClearServerBusyError> =
598            serde_json::from_str(&local_var_content).ok();
599        let local_var_error = ResponseContent {
600            status: local_var_status,
601            content: local_var_content,
602            entity: local_var_entity,
603        };
604        Err(Error::ResponseError(local_var_error))
605    }
606}
607
608/// Recycle database connections by closing and reconnecting all connections to master and read replica databases. ##### Permissions Must have `manage_system` permission.
609pub async fn database_recycle(
610    configuration: &configuration::Configuration,
611) -> Result<crate::openapi::models::StatusOk, Error<DatabaseRecycleError>> {
612    let local_var_configuration = configuration;
613
614    // unbox the parameters
615
616    let local_var_client = &local_var_configuration.client;
617
618    let local_var_uri_str = format!(
619        "{}/api/v4/database/recycle",
620        local_var_configuration.base_path
621    );
622    let mut local_var_req_builder =
623        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 =
627            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
628    }
629    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
630        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
631    };
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        serde_json::from_str(&local_var_content).map_err(Error::from)
641    } else {
642        let local_var_entity: Option<DatabaseRecycleError> =
643            serde_json::from_str(&local_var_content).ok();
644        let local_var_error = ResponseContent {
645            status: local_var_status,
646            content: local_var_content,
647            entity: local_var_entity,
648        };
649        Err(Error::ResponseError(local_var_error))
650    }
651}
652
653/// 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.
654pub async fn generate_support_packet(
655    configuration: &configuration::Configuration,
656) -> Result<(), Error<GenerateSupportPacketError>> {
657    let local_var_configuration = configuration;
658
659    // unbox the parameters
660
661    let local_var_client = &local_var_configuration.client;
662
663    let local_var_uri_str = format!(
664        "{}/api/v4/system/support_packet",
665        local_var_configuration.base_path
666    );
667    let mut local_var_req_builder =
668        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
669
670    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
671        local_var_req_builder =
672            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
673    }
674    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
675        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
676    };
677
678    let local_var_req = local_var_req_builder.build()?;
679    let local_var_resp = local_var_client.execute(local_var_req).await?;
680
681    let local_var_status = local_var_resp.status();
682    let local_var_content = local_var_resp.text().await?;
683
684    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
685        Ok(())
686    } else {
687        let local_var_entity: Option<GenerateSupportPacketError> =
688            serde_json::from_str(&local_var_content).ok();
689        let local_var_error = ResponseContent {
690            status: local_var_status,
691            content: local_var_content,
692            entity: local_var_entity,
693        };
694        Err(Error::ResponseError(local_var_error))
695    }
696}
697
698/// 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.
699pub async fn get_analytics_old(
700    configuration: &configuration::Configuration,
701    params: GetAnalyticsOldParams,
702) -> Result<(), Error<GetAnalyticsOldError>> {
703    let local_var_configuration = configuration;
704
705    // unbox the parameters
706    let name = params.name;
707    let team_id = params.team_id;
708
709    let local_var_client = &local_var_configuration.client;
710
711    let local_var_uri_str = format!("{}/api/v4/analytics/old", local_var_configuration.base_path);
712    let mut local_var_req_builder =
713        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
714
715    if let Some(ref local_var_str) = name {
716        local_var_req_builder =
717            local_var_req_builder.query(&[("name", &local_var_str.to_string())]);
718    }
719    if let Some(ref local_var_str) = team_id {
720        local_var_req_builder =
721            local_var_req_builder.query(&[("team_id", &local_var_str.to_string())]);
722    }
723    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
724        local_var_req_builder =
725            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
726    }
727    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
728        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
729    };
730
731    let local_var_req = local_var_req_builder.build()?;
732    let local_var_resp = local_var_client.execute(local_var_req).await?;
733
734    let local_var_status = local_var_resp.status();
735    let local_var_content = local_var_resp.text().await?;
736
737    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
738        Ok(())
739    } else {
740        let local_var_entity: Option<GetAnalyticsOldError> =
741            serde_json::from_str(&local_var_content).ok();
742        let local_var_error = ResponseContent {
743            status: local_var_status,
744            content: local_var_content,
745            entity: local_var_entity,
746        };
747        Err(Error::ResponseError(local_var_error))
748    }
749}
750
751/// 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.
752pub async fn get_audits(
753    configuration: &configuration::Configuration,
754    params: GetAuditsParams,
755) -> Result<Vec<crate::openapi::models::Audit>, Error<GetAuditsError>> {
756    let local_var_configuration = configuration;
757
758    // unbox the parameters
759    let page = params.page;
760    let per_page = params.per_page;
761
762    let local_var_client = &local_var_configuration.client;
763
764    let local_var_uri_str = format!("{}/api/v4/audits", local_var_configuration.base_path);
765    let mut local_var_req_builder =
766        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
767
768    if let Some(ref local_var_str) = page {
769        local_var_req_builder =
770            local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
771    }
772    if let Some(ref local_var_str) = per_page {
773        local_var_req_builder =
774            local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
775    }
776    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
777        local_var_req_builder =
778            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
779    }
780    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
781        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
782    };
783
784    let local_var_req = local_var_req_builder.build()?;
785    let local_var_resp = local_var_client.execute(local_var_req).await?;
786
787    let local_var_status = local_var_resp.status();
788    let local_var_content = local_var_resp.text().await?;
789
790    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
791        serde_json::from_str(&local_var_content).map_err(Error::from)
792    } else {
793        let local_var_entity: Option<GetAuditsError> =
794            serde_json::from_str(&local_var_content).ok();
795        let local_var_error = ResponseContent {
796            status: local_var_status,
797            content: local_var_content,
798            entity: local_var_entity,
799        };
800        Err(Error::ResponseError(local_var_error))
801    }
802}
803
804/// Get a subset of the server configuration needed by the client. ##### Permissions No permission required.
805pub async fn get_client_config(
806    configuration: &configuration::Configuration,
807    params: GetClientConfigParams,
808) -> Result<(), Error<GetClientConfigError>> {
809    let local_var_configuration = configuration;
810
811    // unbox the parameters
812    let format = params.format;
813
814    let local_var_client = &local_var_configuration.client;
815
816    let local_var_uri_str = format!("{}/api/v4/config/client", local_var_configuration.base_path);
817    let mut local_var_req_builder =
818        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
819
820    local_var_req_builder = local_var_req_builder.query(&[("format", &format.to_string())]);
821    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
822        local_var_req_builder =
823            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
824    }
825    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
826        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
827    };
828
829    let local_var_req = local_var_req_builder.build()?;
830    let local_var_resp = local_var_client.execute(local_var_req).await?;
831
832    let local_var_status = local_var_resp.status();
833    let local_var_content = local_var_resp.text().await?;
834
835    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
836        Ok(())
837    } else {
838        let local_var_entity: Option<GetClientConfigError> =
839            serde_json::from_str(&local_var_content).ok();
840        let local_var_error = ResponseContent {
841            status: local_var_status,
842            content: local_var_content,
843            entity: local_var_entity,
844        };
845        Err(Error::ResponseError(local_var_error))
846    }
847}
848
849/// Get a subset of the server license needed by the client. ##### Permissions No permission required but having the `manage_system` permission returns more information.
850pub async fn get_client_license(
851    configuration: &configuration::Configuration,
852    params: GetClientLicenseParams,
853) -> Result<(), Error<GetClientLicenseError>> {
854    let local_var_configuration = configuration;
855
856    // unbox the parameters
857    let format = params.format;
858
859    let local_var_client = &local_var_configuration.client;
860
861    let local_var_uri_str = format!(
862        "{}/api/v4/license/client",
863        local_var_configuration.base_path
864    );
865    let mut local_var_req_builder =
866        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
867
868    local_var_req_builder = local_var_req_builder.query(&[("format", &format.to_string())]);
869    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
870        local_var_req_builder =
871            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
872    }
873    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
874        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
875    };
876
877    let local_var_req = local_var_req_builder.build()?;
878    let local_var_resp = local_var_client.execute(local_var_req).await?;
879
880    let local_var_status = local_var_resp.status();
881    let local_var_content = local_var_resp.text().await?;
882
883    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
884        Ok(())
885    } else {
886        let local_var_entity: Option<GetClientLicenseError> =
887            serde_json::from_str(&local_var_content).ok();
888        let local_var_error = ResponseContent {
889            status: local_var_status,
890            content: local_var_content,
891            entity: local_var_entity,
892        };
893        Err(Error::ResponseError(local_var_error))
894    }
895}
896
897/// Retrieve the current server configuration ##### Permissions Must have `manage_system` permission.
898pub async fn get_config(
899    configuration: &configuration::Configuration,
900) -> Result<crate::openapi::models::Config, Error<GetConfigError>> {
901    let local_var_configuration = configuration;
902
903    // unbox the parameters
904
905    let local_var_client = &local_var_configuration.client;
906
907    let local_var_uri_str = format!("{}/api/v4/config", local_var_configuration.base_path);
908    let mut local_var_req_builder =
909        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
910
911    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
912        local_var_req_builder =
913            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
914    }
915    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
916        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
917    };
918
919    let local_var_req = local_var_req_builder.build()?;
920    let local_var_resp = local_var_client.execute(local_var_req).await?;
921
922    let local_var_status = local_var_resp.status();
923    let local_var_content = local_var_resp.text().await?;
924
925    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
926        serde_json::from_str(&local_var_content).map_err(Error::from)
927    } else {
928        let local_var_entity: Option<GetConfigError> =
929            serde_json::from_str(&local_var_content).ok();
930        let local_var_error = ResponseContent {
931            status: local_var_status,
932            content: local_var_content,
933            entity: local_var_entity,
934        };
935        Err(Error::ResponseError(local_var_error))
936    }
937}
938
939/// 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.
940pub async fn get_environment_config(
941    configuration: &configuration::Configuration,
942) -> Result<crate::openapi::models::EnvironmentConfig, Error<GetEnvironmentConfigError>> {
943    let local_var_configuration = configuration;
944
945    // unbox the parameters
946
947    let local_var_client = &local_var_configuration.client;
948
949    let local_var_uri_str = format!(
950        "{}/api/v4/config/environment",
951        local_var_configuration.base_path
952    );
953    let mut local_var_req_builder =
954        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
955
956    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
957        local_var_req_builder =
958            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
959    }
960    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
961        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
962    };
963
964    let local_var_req = local_var_req_builder.build()?;
965    let local_var_resp = local_var_client.execute(local_var_req).await?;
966
967    let local_var_status = local_var_resp.status();
968    let local_var_content = local_var_resp.text().await?;
969
970    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
971        serde_json::from_str(&local_var_content).map_err(Error::from)
972    } else {
973        let local_var_entity: Option<GetEnvironmentConfigError> =
974            serde_json::from_str(&local_var_content).ok();
975        let local_var_error = ResponseContent {
976            status: local_var_status,
977            content: local_var_content,
978            entity: local_var_entity,
979        };
980        Err(Error::ResponseError(local_var_error))
981    }
982}
983
984/// Fetches an image via Mattermost image proxy. __Minimum server version__: 3.10 ##### Permissions Must be logged in.
985pub async fn get_image_by_url(
986    configuration: &configuration::Configuration,
987) -> Result<std::path::PathBuf, Error<GetImageByUrlError>> {
988    let local_var_configuration = configuration;
989
990    // unbox the parameters
991
992    let local_var_client = &local_var_configuration.client;
993
994    let local_var_uri_str = format!("{}/api/v4/image", local_var_configuration.base_path);
995    let mut local_var_req_builder =
996        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
997
998    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
999        local_var_req_builder =
1000            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1001    }
1002    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1003        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1004    };
1005
1006    let local_var_req = local_var_req_builder.build()?;
1007    let local_var_resp = local_var_client.execute(local_var_req).await?;
1008
1009    let local_var_status = local_var_resp.status();
1010    let local_var_content = local_var_resp.text().await?;
1011
1012    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1013        serde_json::from_str(&local_var_content).map_err(Error::from)
1014    } else {
1015        let local_var_entity: Option<GetImageByUrlError> =
1016            serde_json::from_str(&local_var_content).ok();
1017        let local_var_error = ResponseContent {
1018            status: local_var_status,
1019            content: local_var_content,
1020            entity: local_var_entity,
1021        };
1022        Err(Error::ResponseError(local_var_error))
1023    }
1024}
1025
1026/// Get a page of server logs, selected with `page` and `logs_per_page` query parameters. ##### Permissions Must have `manage_system` permission.
1027pub async fn get_logs(
1028    configuration: &configuration::Configuration,
1029    params: GetLogsParams,
1030) -> Result<Vec<String>, Error<GetLogsError>> {
1031    let local_var_configuration = configuration;
1032
1033    // unbox the parameters
1034    let page = params.page;
1035    let logs_per_page = params.logs_per_page;
1036
1037    let local_var_client = &local_var_configuration.client;
1038
1039    let local_var_uri_str = format!("{}/api/v4/logs", local_var_configuration.base_path);
1040    let mut local_var_req_builder =
1041        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1042
1043    if let Some(ref local_var_str) = page {
1044        local_var_req_builder =
1045            local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1046    }
1047    if let Some(ref local_var_str) = logs_per_page {
1048        local_var_req_builder =
1049            local_var_req_builder.query(&[("logs_per_page", &local_var_str.to_string())]);
1050    }
1051    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1052        local_var_req_builder =
1053            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1054    }
1055    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1056        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1057    };
1058
1059    let local_var_req = local_var_req_builder.build()?;
1060    let local_var_resp = local_var_client.execute(local_var_req).await?;
1061
1062    let local_var_status = local_var_resp.status();
1063    let local_var_content = local_var_resp.text().await?;
1064
1065    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1066        serde_json::from_str(&local_var_content).map_err(Error::from)
1067    } else {
1068        let local_var_entity: Option<GetLogsError> = serde_json::from_str(&local_var_content).ok();
1069        let local_var_error = ResponseContent {
1070            status: local_var_status,
1071            content: local_var_content,
1072            entity: local_var_entity,
1073        };
1074        Err(Error::ResponseError(local_var_error))
1075    }
1076}
1077
1078/// 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.
1079pub async fn get_notices(
1080    configuration: &configuration::Configuration,
1081    params: GetNoticesParams,
1082) -> Result<Vec<crate::openapi::models::Notice>, Error<GetNoticesError>> {
1083    let local_var_configuration = configuration;
1084
1085    // unbox the parameters
1086    let client_version = params.client_version;
1087    let client = params.client;
1088    let team_id = params.team_id;
1089    let locale = params.locale;
1090
1091    let local_var_client = &local_var_configuration.client;
1092
1093    let local_var_uri_str = format!(
1094        "{}/api/v4/system/notices/{teamId}",
1095        local_var_configuration.base_path,
1096        teamId = super::urlencode(team_id)
1097    );
1098    let mut local_var_req_builder =
1099        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1100
1101    local_var_req_builder =
1102        local_var_req_builder.query(&[("clientVersion", &client_version.to_string())]);
1103    if let Some(ref local_var_str) = locale {
1104        local_var_req_builder =
1105            local_var_req_builder.query(&[("locale", &local_var_str.to_string())]);
1106    }
1107    local_var_req_builder = local_var_req_builder.query(&[("client", &client.to_string())]);
1108    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1109        local_var_req_builder =
1110            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1111    }
1112    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1113        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1114    };
1115
1116    let local_var_req = local_var_req_builder.build()?;
1117    let local_var_resp = local_var_client.execute(local_var_req).await?;
1118
1119    let local_var_status = local_var_resp.status();
1120    let local_var_content = local_var_resp.text().await?;
1121
1122    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1123        serde_json::from_str(&local_var_content).map_err(Error::from)
1124    } else {
1125        let local_var_entity: Option<GetNoticesError> =
1126            serde_json::from_str(&local_var_content).ok();
1127        let local_var_error = ResponseContent {
1128            status: local_var_status,
1129            content: local_var_content,
1130            entity: local_var_entity,
1131        };
1132        Err(Error::ResponseError(local_var_error))
1133    }
1134}
1135
1136/// 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.
1137pub async fn get_ping(
1138    configuration: &configuration::Configuration,
1139    params: GetPingParams,
1140) -> Result<crate::openapi::models::SystemStatusResponse, Error<GetPingError>> {
1141    let local_var_configuration = configuration;
1142
1143    // unbox the parameters
1144    let get_server_status = params.get_server_status;
1145    let device_id = params.device_id;
1146
1147    let local_var_client = &local_var_configuration.client;
1148
1149    let local_var_uri_str = format!("{}/api/v4/system/ping", local_var_configuration.base_path);
1150    let mut local_var_req_builder =
1151        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1152
1153    if let Some(ref local_var_str) = get_server_status {
1154        local_var_req_builder =
1155            local_var_req_builder.query(&[("get_server_status", &local_var_str.to_string())]);
1156    }
1157    if let Some(ref local_var_str) = device_id {
1158        local_var_req_builder =
1159            local_var_req_builder.query(&[("device_id", &local_var_str.to_string())]);
1160    }
1161    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1162        local_var_req_builder =
1163            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1164    }
1165    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1166        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1167    };
1168
1169    let local_var_req = local_var_req_builder.build()?;
1170    let local_var_resp = local_var_client.execute(local_var_req).await?;
1171
1172    let local_var_status = local_var_resp.status();
1173    let local_var_content = local_var_resp.text().await?;
1174
1175    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1176        serde_json::from_str(&local_var_content).map_err(Error::from)
1177    } else {
1178        let local_var_entity: Option<GetPingError> = serde_json::from_str(&local_var_content).ok();
1179        let local_var_error = ResponseContent {
1180            status: local_var_status,
1181            content: local_var_content,
1182            entity: local_var_entity,
1183        };
1184        Err(Error::ResponseError(local_var_error))
1185    }
1186}
1187
1188/// Get the last trial license used on the sevrer __Minimum server version__: 5.36 ##### Permissions Must have `manage_systems` permissions.
1189pub async fn get_prev_trial_license(
1190    configuration: &configuration::Configuration,
1191) -> Result<(), Error<GetPrevTrialLicenseError>> {
1192    let local_var_configuration = configuration;
1193
1194    // unbox the parameters
1195
1196    let local_var_client = &local_var_configuration.client;
1197
1198    let local_var_uri_str = format!(
1199        "{}/api/v4/trial-license/prev",
1200        local_var_configuration.base_path
1201    );
1202    let mut local_var_req_builder =
1203        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1204
1205    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1206        local_var_req_builder =
1207            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1208    }
1209    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1210        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1211    };
1212
1213    let local_var_req = local_var_req_builder.build()?;
1214    let local_var_resp = local_var_client.execute(local_var_req).await?;
1215
1216    let local_var_status = local_var_resp.status();
1217    let local_var_content = local_var_resp.text().await?;
1218
1219    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1220        Ok(())
1221    } else {
1222        let local_var_entity: Option<GetPrevTrialLicenseError> =
1223            serde_json::from_str(&local_var_content).ok();
1224        let local_var_error = ResponseContent {
1225            status: local_var_status,
1226            content: local_var_content,
1227            entity: local_var_entity,
1228        };
1229        Err(Error::ResponseError(local_var_error))
1230    }
1231}
1232
1233/// __Minimum server version__: 3.10 ##### Permissions Must be logged in.
1234pub async fn get_redirect_location(
1235    configuration: &configuration::Configuration,
1236    params: GetRedirectLocationParams,
1237) -> Result<crate::openapi::models::GetRedirectLocation200Response, Error<GetRedirectLocationError>> {
1238    let local_var_configuration = configuration;
1239
1240    // unbox the parameters
1241    let url = params.url;
1242
1243    let local_var_client = &local_var_configuration.client;
1244
1245    let local_var_uri_str = format!(
1246        "{}/api/v4/redirect_location",
1247        local_var_configuration.base_path
1248    );
1249    let mut local_var_req_builder =
1250        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1251
1252    local_var_req_builder = local_var_req_builder.query(&[("url", &url.to_string())]);
1253    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1254        local_var_req_builder =
1255            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1256    }
1257    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1258        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1259    };
1260
1261    let local_var_req = local_var_req_builder.build()?;
1262    let local_var_resp = local_var_client.execute(local_var_req).await?;
1263
1264    let local_var_status = local_var_resp.status();
1265    let local_var_content = local_var_resp.text().await?;
1266
1267    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1268        serde_json::from_str(&local_var_content).map_err(Error::from)
1269    } else {
1270        let local_var_entity: Option<GetRedirectLocationError> =
1271            serde_json::from_str(&local_var_content).ok();
1272        let local_var_error = ResponseContent {
1273            status: local_var_status,
1274            content: local_var_content,
1275            entity: local_var_entity,
1276        };
1277        Err(Error::ResponseError(local_var_error))
1278    }
1279}
1280
1281/// 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.
1282pub async fn get_server_busy_expires(
1283    configuration: &configuration::Configuration,
1284) -> Result<crate::openapi::models::ServerBusy, Error<GetServerBusyExpiresError>> {
1285    let local_var_configuration = configuration;
1286
1287    // unbox the parameters
1288
1289    let local_var_client = &local_var_configuration.client;
1290
1291    let local_var_uri_str = format!("{}/api/v4/server_busy", local_var_configuration.base_path);
1292    let mut local_var_req_builder =
1293        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1294
1295    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1296        local_var_req_builder =
1297            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1298    }
1299    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1300        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1301    };
1302
1303    let local_var_req = local_var_req_builder.build()?;
1304    let local_var_resp = local_var_client.execute(local_var_req).await?;
1305
1306    let local_var_status = local_var_resp.status();
1307    let local_var_content = local_var_resp.text().await?;
1308
1309    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1310        serde_json::from_str(&local_var_content).map_err(Error::from)
1311    } else {
1312        let local_var_entity: Option<GetServerBusyExpiresError> =
1313            serde_json::from_str(&local_var_content).ok();
1314        let local_var_error = ResponseContent {
1315            status: local_var_status,
1316            content: local_var_content,
1317            entity: local_var_entity,
1318        };
1319        Err(Error::ResponseError(local_var_error))
1320    }
1321}
1322
1323/// __Minimum server version__: 3.10 ##### Permissions Must be logged in.
1324pub async fn get_supported_timezone(
1325    configuration: &configuration::Configuration,
1326) -> Result<Vec<String>, Error<GetSupportedTimezoneError>> {
1327    let local_var_configuration = configuration;
1328
1329    // unbox the parameters
1330
1331    let local_var_client = &local_var_configuration.client;
1332
1333    let local_var_uri_str = format!(
1334        "{}/api/v4/system/timezones",
1335        local_var_configuration.base_path
1336    );
1337    let mut local_var_req_builder =
1338        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1339
1340    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1341        local_var_req_builder =
1342            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1343    }
1344    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1345        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1346    };
1347
1348    let local_var_req = local_var_req_builder.build()?;
1349    let local_var_resp = local_var_client.execute(local_var_req).await?;
1350
1351    let local_var_status = local_var_resp.status();
1352    let local_var_content = local_var_resp.text().await?;
1353
1354    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1355        serde_json::from_str(&local_var_content).map_err(Error::from)
1356    } else {
1357        let local_var_entity: Option<GetSupportedTimezoneError> =
1358            serde_json::from_str(&local_var_content).ok();
1359        let local_var_error = ResponseContent {
1360            status: local_var_status,
1361            content: local_var_content,
1362            entity: local_var_entity,
1363        };
1364        Err(Error::ResponseError(local_var_error))
1365    }
1366}
1367
1368/// 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.
1369pub async fn get_warn_metrics_status(
1370    configuration: &configuration::Configuration,
1371) -> Result<crate::openapi::models::StatusOk, Error<GetWarnMetricsStatusError>> {
1372    let local_var_configuration = configuration;
1373
1374    // unbox the parameters
1375
1376    let local_var_client = &local_var_configuration.client;
1377
1378    let local_var_uri_str = format!(
1379        "{}/api/v4/warn_metrics/status",
1380        local_var_configuration.base_path
1381    );
1382    let mut local_var_req_builder =
1383        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1384
1385    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1386        local_var_req_builder =
1387            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1388    }
1389    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1390        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1391    };
1392
1393    let local_var_req = local_var_req_builder.build()?;
1394    let local_var_resp = local_var_client.execute(local_var_req).await?;
1395
1396    let local_var_status = local_var_resp.status();
1397    let local_var_content = local_var_resp.text().await?;
1398
1399    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1400        serde_json::from_str(&local_var_content).map_err(Error::from)
1401    } else {
1402        let local_var_entity: Option<GetWarnMetricsStatusError> =
1403            serde_json::from_str(&local_var_content).ok();
1404        let local_var_error = ResponseContent {
1405            status: local_var_status,
1406            content: local_var_content,
1407            entity: local_var_entity,
1408        };
1409        Err(Error::ResponseError(local_var_error))
1410    }
1411}
1412
1413/// 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.
1414pub async fn invalidate_caches(
1415    configuration: &configuration::Configuration,
1416) -> Result<crate::openapi::models::StatusOk, Error<InvalidateCachesError>> {
1417    let local_var_configuration = configuration;
1418
1419    // unbox the parameters
1420
1421    let local_var_client = &local_var_configuration.client;
1422
1423    let local_var_uri_str = format!(
1424        "{}/api/v4/caches/invalidate",
1425        local_var_configuration.base_path
1426    );
1427    let mut local_var_req_builder =
1428        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1429
1430    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1431        local_var_req_builder =
1432            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1433    }
1434    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1435        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1436    };
1437
1438    let local_var_req = local_var_req_builder.build()?;
1439    let local_var_resp = local_var_client.execute(local_var_req).await?;
1440
1441    let local_var_status = local_var_resp.status();
1442    let local_var_content = local_var_resp.text().await?;
1443
1444    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1445        serde_json::from_str(&local_var_content).map_err(Error::from)
1446    } else {
1447        let local_var_entity: Option<InvalidateCachesError> =
1448            serde_json::from_str(&local_var_content).ok();
1449        let local_var_error = ResponseContent {
1450            status: local_var_status,
1451            content: local_var_content,
1452            entity: local_var_entity,
1453        };
1454        Err(Error::ResponseError(local_var_error))
1455    }
1456}
1457
1458/// Will mark the specified notices as 'viewed' by the logged in user. __Minimum server version__: 5.26 ##### Permissions Must be logged in.
1459pub async fn mark_notices_viewed(
1460    configuration: &configuration::Configuration,
1461    params: MarkNoticesViewedParams,
1462) -> Result<crate::openapi::models::StatusOk, Error<MarkNoticesViewedError>> {
1463    let local_var_configuration = configuration;
1464
1465    // unbox the parameters
1466    let request_body = params.request_body;
1467
1468    let local_var_client = &local_var_configuration.client;
1469
1470    let local_var_uri_str = format!(
1471        "{}/api/v4/system/notices/view",
1472        local_var_configuration.base_path
1473    );
1474    let mut local_var_req_builder =
1475        local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
1476
1477    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1478        local_var_req_builder =
1479            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1480    }
1481    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1482        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1483    };
1484    local_var_req_builder = local_var_req_builder.json(&request_body);
1485
1486    let local_var_req = local_var_req_builder.build()?;
1487    let local_var_resp = local_var_client.execute(local_var_req).await?;
1488
1489    let local_var_status = local_var_resp.status();
1490    let local_var_content = local_var_resp.text().await?;
1491
1492    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1493        serde_json::from_str(&local_var_content).map_err(Error::from)
1494    } else {
1495        let local_var_entity: Option<MarkNoticesViewedError> =
1496            serde_json::from_str(&local_var_content).ok();
1497        let local_var_error = ResponseContent {
1498            status: local_var_status,
1499            content: local_var_content,
1500            entity: local_var_entity,
1501        };
1502        Err(Error::ResponseError(local_var_error))
1503    }
1504}
1505
1506/// 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.
1507pub async fn patch_config(
1508    configuration: &configuration::Configuration,
1509    params: PatchConfigParams,
1510) -> Result<crate::openapi::models::Config, Error<PatchConfigError>> {
1511    let local_var_configuration = configuration;
1512
1513    // unbox the parameters
1514    let config = params.config;
1515
1516    let local_var_client = &local_var_configuration.client;
1517
1518    let local_var_uri_str = format!("{}/api/v4/config/patch", local_var_configuration.base_path);
1519    let mut local_var_req_builder =
1520        local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
1521
1522    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1523        local_var_req_builder =
1524            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1525    }
1526    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1527        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1528    };
1529    local_var_req_builder = local_var_req_builder.json(&config);
1530
1531    let local_var_req = local_var_req_builder.build()?;
1532    let local_var_resp = local_var_client.execute(local_var_req).await?;
1533
1534    let local_var_status = local_var_resp.status();
1535    let local_var_content = local_var_resp.text().await?;
1536
1537    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1538        serde_json::from_str(&local_var_content).map_err(Error::from)
1539    } else {
1540        let local_var_entity: Option<PatchConfigError> =
1541            serde_json::from_str(&local_var_content).ok();
1542        let local_var_error = ResponseContent {
1543            status: local_var_status,
1544            content: local_var_content,
1545            entity: local_var_entity,
1546        };
1547        Err(Error::ResponseError(local_var_error))
1548    }
1549}
1550
1551/// 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`.
1552pub async fn post_log(
1553    configuration: &configuration::Configuration,
1554    params: PostLogParams,
1555) -> Result<Vec<String>, Error<PostLogError>> {
1556    let local_var_configuration = configuration;
1557
1558    // unbox the parameters
1559    let post_log_request = params.post_log_request;
1560
1561    let local_var_client = &local_var_configuration.client;
1562
1563    let local_var_uri_str = format!("{}/api/v4/logs", local_var_configuration.base_path);
1564    let mut local_var_req_builder =
1565        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1566
1567    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1568        local_var_req_builder =
1569            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    local_var_req_builder = local_var_req_builder.json(&post_log_request);
1575
1576    let local_var_req = local_var_req_builder.build()?;
1577    let local_var_resp = local_var_client.execute(local_var_req).await?;
1578
1579    let local_var_status = local_var_resp.status();
1580    let local_var_content = local_var_resp.text().await?;
1581
1582    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1583        serde_json::from_str(&local_var_content).map_err(Error::from)
1584    } else {
1585        let local_var_entity: Option<PostLogError> = serde_json::from_str(&local_var_content).ok();
1586        let local_var_error = ResponseContent {
1587            status: local_var_status,
1588            content: local_var_content,
1589            entity: local_var_entity,
1590        };
1591        Err(Error::ResponseError(local_var_error))
1592    }
1593}
1594
1595/// Reload the configuration file to pick up on any changes made to it. ##### Permissions Must have `manage_system` permission.
1596pub async fn reload_config(
1597    configuration: &configuration::Configuration,
1598) -> Result<crate::openapi::models::StatusOk, Error<ReloadConfigError>> {
1599    let local_var_configuration = configuration;
1600
1601    // unbox the parameters
1602
1603    let local_var_client = &local_var_configuration.client;
1604
1605    let local_var_uri_str = format!("{}/api/v4/config/reload", local_var_configuration.base_path);
1606    let mut local_var_req_builder =
1607        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1608
1609    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1610        local_var_req_builder =
1611            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1612    }
1613    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1614        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1615    };
1616
1617    let local_var_req = local_var_req_builder.build()?;
1618    let local_var_resp = local_var_client.execute(local_var_req).await?;
1619
1620    let local_var_status = local_var_resp.status();
1621    let local_var_content = local_var_resp.text().await?;
1622
1623    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1624        serde_json::from_str(&local_var_content).map_err(Error::from)
1625    } else {
1626        let local_var_entity: Option<ReloadConfigError> =
1627            serde_json::from_str(&local_var_content).ok();
1628        let local_var_error = ResponseContent {
1629            status: local_var_status,
1630            content: local_var_content,
1631            entity: local_var_entity,
1632        };
1633        Err(Error::ResponseError(local_var_error))
1634    }
1635}
1636
1637/// Remove the license file from the server. This will disable all enterprise features.  __Minimum server version__: 4.0  ##### Permissions Must have `manage_system` permission.
1638pub async fn remove_license_file(
1639    configuration: &configuration::Configuration,
1640) -> Result<(), Error<RemoveLicenseFileError>> {
1641    let local_var_configuration = configuration;
1642
1643    // unbox the parameters
1644
1645    let local_var_client = &local_var_configuration.client;
1646
1647    let local_var_uri_str = format!("{}/api/v4/license", local_var_configuration.base_path);
1648    let mut local_var_req_builder =
1649        local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
1650
1651    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1652        local_var_req_builder =
1653            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1654    }
1655    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1656        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1657    };
1658
1659    let local_var_req = local_var_req_builder.build()?;
1660    let local_var_resp = local_var_client.execute(local_var_req).await?;
1661
1662    let local_var_status = local_var_resp.status();
1663    let local_var_content = local_var_resp.text().await?;
1664
1665    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1666        Ok(())
1667    } else {
1668        let local_var_entity: Option<RemoveLicenseFileError> =
1669            serde_json::from_str(&local_var_content).ok();
1670        let local_var_error = ResponseContent {
1671            status: local_var_status,
1672            content: local_var_content,
1673            entity: local_var_entity,
1674        };
1675        Err(Error::ResponseError(local_var_error))
1676    }
1677}
1678
1679/// 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.
1680pub async fn request_license_renewal_link(
1681    configuration: &configuration::Configuration,
1682) -> Result<crate::openapi::models::LicenseRenewalLink, Error<RequestLicenseRenewalLinkError>> {
1683    let local_var_configuration = configuration;
1684
1685    // unbox the parameters
1686
1687    let local_var_client = &local_var_configuration.client;
1688
1689    let local_var_uri_str = format!(
1690        "{}/api/v4/license/renewal",
1691        local_var_configuration.base_path
1692    );
1693    let mut local_var_req_builder =
1694        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1695
1696    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1697        local_var_req_builder =
1698            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1699    }
1700    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1701        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1702    };
1703
1704    let local_var_req = local_var_req_builder.build()?;
1705    let local_var_resp = local_var_client.execute(local_var_req).await?;
1706
1707    let local_var_status = local_var_resp.status();
1708    let local_var_content = local_var_resp.text().await?;
1709
1710    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1711        serde_json::from_str(&local_var_content).map_err(Error::from)
1712    } else {
1713        let local_var_entity: Option<RequestLicenseRenewalLinkError> =
1714            serde_json::from_str(&local_var_content).ok();
1715        let local_var_error = ResponseContent {
1716            status: local_var_status,
1717            content: local_var_content,
1718            entity: local_var_entity,
1719        };
1720        Err(Error::ResponseError(local_var_error))
1721    }
1722}
1723
1724/// Request and install a trial license for your server __Minimum server version__: 5.25 ##### Permissions Must have `manage_system` permission.
1725pub async fn request_trial_license(
1726    configuration: &configuration::Configuration,
1727    params: RequestTrialLicenseParams,
1728) -> Result<(), Error<RequestTrialLicenseError>> {
1729    let local_var_configuration = configuration;
1730
1731    // unbox the parameters
1732    let request_trial_license_request = params.request_trial_license_request;
1733
1734    let local_var_client = &local_var_configuration.client;
1735
1736    let local_var_uri_str = format!("{}/api/v4/trial-license", local_var_configuration.base_path);
1737    let mut local_var_req_builder =
1738        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1739
1740    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1741        local_var_req_builder =
1742            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1743    }
1744    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1745        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1746    };
1747    local_var_req_builder = local_var_req_builder.json(&request_trial_license_request);
1748
1749    let local_var_req = local_var_req_builder.build()?;
1750    let local_var_resp = local_var_client.execute(local_var_req).await?;
1751
1752    let local_var_status = local_var_resp.status();
1753    let local_var_content = local_var_resp.text().await?;
1754
1755    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1756        Ok(())
1757    } else {
1758        let local_var_entity: Option<RequestTrialLicenseError> =
1759            serde_json::from_str(&local_var_content).ok();
1760        let local_var_error = ResponseContent {
1761            status: local_var_status,
1762            content: local_var_content,
1763            entity: local_var_entity,
1764        };
1765        Err(Error::ResponseError(local_var_error))
1766    }
1767}
1768
1769/// It restarts the current running mattermost instance to execute the new Enterprise binary. __Minimum server version__: 5.27 ##### Permissions Must have `manage_system` permission.
1770pub async fn restart_server(
1771    configuration: &configuration::Configuration,
1772) -> Result<crate::openapi::models::StatusOk, Error<RestartServerError>> {
1773    let local_var_configuration = configuration;
1774
1775    // unbox the parameters
1776
1777    let local_var_client = &local_var_configuration.client;
1778
1779    let local_var_uri_str = format!("{}/api/v4/restart", local_var_configuration.base_path);
1780    let mut local_var_req_builder =
1781        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1782
1783    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1784        local_var_req_builder =
1785            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1786    }
1787    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1788        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1789    };
1790
1791    let local_var_req = local_var_req_builder.build()?;
1792    let local_var_resp = local_var_client.execute(local_var_req).await?;
1793
1794    let local_var_status = local_var_resp.status();
1795    let local_var_content = local_var_resp.text().await?;
1796
1797    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1798        serde_json::from_str(&local_var_content).map_err(Error::from)
1799    } else {
1800        let local_var_entity: Option<RestartServerError> =
1801            serde_json::from_str(&local_var_content).ok();
1802        let local_var_error = ResponseContent {
1803            status: local_var_status,
1804            content: local_var_content,
1805            entity: local_var_entity,
1806        };
1807        Err(Error::ResponseError(local_var_error))
1808    }
1809}
1810
1811/// 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.
1812pub async fn send_trial_license_warn_metric_ack(
1813    configuration: &configuration::Configuration,
1814    params: SendTrialLicenseWarnMetricAckParams,
1815) -> Result<crate::openapi::models::StatusOk, Error<SendTrialLicenseWarnMetricAckError>> {
1816    let local_var_configuration = configuration;
1817
1818    // unbox the parameters
1819    let warn_metric_id = params.warn_metric_id;
1820
1821    let local_var_client = &local_var_configuration.client;
1822
1823    let local_var_uri_str = format!(
1824        "{}/api/v4/warn_metrics/trial-license-ack/{warn_metric_id}",
1825        local_var_configuration.base_path,
1826        warn_metric_id = super::urlencode(warn_metric_id)
1827    );
1828    let mut local_var_req_builder =
1829        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1830
1831    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1832        local_var_req_builder =
1833            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1834    }
1835    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1836        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1837    };
1838
1839    let local_var_req = local_var_req_builder.build()?;
1840    let local_var_resp = local_var_client.execute(local_var_req).await?;
1841
1842    let local_var_status = local_var_resp.status();
1843    let local_var_content = local_var_resp.text().await?;
1844
1845    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1846        serde_json::from_str(&local_var_content).map_err(Error::from)
1847    } else {
1848        let local_var_entity: Option<SendTrialLicenseWarnMetricAckError> =
1849            serde_json::from_str(&local_var_content).ok();
1850        let local_var_error = ResponseContent {
1851            status: local_var_status,
1852            content: local_var_content,
1853            entity: local_var_entity,
1854        };
1855        Err(Error::ResponseError(local_var_error))
1856    }
1857}
1858
1859/// 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.
1860pub async fn send_warn_metric_ack(
1861    configuration: &configuration::Configuration,
1862    params: SendWarnMetricAckParams,
1863) -> Result<crate::openapi::models::StatusOk, Error<SendWarnMetricAckError>> {
1864    let local_var_configuration = configuration;
1865
1866    // unbox the parameters
1867    let warn_metric_id = params.warn_metric_id;
1868    let send_warn_metric_ack_request = params.send_warn_metric_ack_request;
1869
1870    let local_var_client = &local_var_configuration.client;
1871
1872    let local_var_uri_str = format!(
1873        "{}/api/v4/warn_metrics/ack/{warn_metric_id}",
1874        local_var_configuration.base_path,
1875        warn_metric_id = super::urlencode(warn_metric_id)
1876    );
1877    let mut local_var_req_builder =
1878        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1879
1880    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1881        local_var_req_builder =
1882            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1883    }
1884    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1885        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1886    };
1887    local_var_req_builder = local_var_req_builder.json(&send_warn_metric_ack_request);
1888
1889    let local_var_req = local_var_req_builder.build()?;
1890    let local_var_resp = local_var_client.execute(local_var_req).await?;
1891
1892    let local_var_status = local_var_resp.status();
1893    let local_var_content = local_var_resp.text().await?;
1894
1895    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1896        serde_json::from_str(&local_var_content).map_err(Error::from)
1897    } else {
1898        let local_var_entity: Option<SendWarnMetricAckError> =
1899            serde_json::from_str(&local_var_content).ok();
1900        let local_var_error = ResponseContent {
1901            status: local_var_status,
1902            content: local_var_content,
1903            entity: local_var_entity,
1904        };
1905        Err(Error::ResponseError(local_var_error))
1906    }
1907}
1908
1909/// 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.
1910pub async fn set_server_busy(
1911    configuration: &configuration::Configuration,
1912    params: SetServerBusyParams,
1913) -> Result<crate::openapi::models::StatusOk, Error<SetServerBusyError>> {
1914    let local_var_configuration = configuration;
1915
1916    // unbox the parameters
1917    let seconds = params.seconds;
1918
1919    let local_var_client = &local_var_configuration.client;
1920
1921    let local_var_uri_str = format!("{}/api/v4/server_busy", local_var_configuration.base_path);
1922    let mut local_var_req_builder =
1923        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1924
1925    if let Some(ref local_var_str) = seconds {
1926        local_var_req_builder =
1927            local_var_req_builder.query(&[("seconds", &local_var_str.to_string())]);
1928    }
1929    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1930        local_var_req_builder =
1931            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1932    }
1933    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1934        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1935    };
1936
1937    let local_var_req = local_var_req_builder.build()?;
1938    let local_var_resp = local_var_client.execute(local_var_req).await?;
1939
1940    let local_var_status = local_var_resp.status();
1941    let local_var_content = local_var_resp.text().await?;
1942
1943    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1944        serde_json::from_str(&local_var_content).map_err(Error::from)
1945    } else {
1946        let local_var_entity: Option<SetServerBusyError> =
1947            serde_json::from_str(&local_var_content).ok();
1948        let local_var_error = ResponseContent {
1949            status: local_var_status,
1950            content: local_var_content,
1951            entity: local_var_entity,
1952        };
1953        Err(Error::ResponseError(local_var_error))
1954    }
1955}
1956
1957/// 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.
1958pub async fn test_email(
1959    configuration: &configuration::Configuration,
1960    params: TestEmailParams,
1961) -> Result<crate::openapi::models::StatusOk, Error<TestEmailError>> {
1962    let local_var_configuration = configuration;
1963
1964    // unbox the parameters
1965    let config = params.config;
1966
1967    let local_var_client = &local_var_configuration.client;
1968
1969    let local_var_uri_str = format!("{}/api/v4/email/test", local_var_configuration.base_path);
1970    let mut local_var_req_builder =
1971        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1972
1973    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1974        local_var_req_builder =
1975            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1976    }
1977    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1978        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1979    };
1980    local_var_req_builder = local_var_req_builder.json(&config);
1981
1982    let local_var_req = local_var_req_builder.build()?;
1983    let local_var_resp = local_var_client.execute(local_var_req).await?;
1984
1985    let local_var_status = local_var_resp.status();
1986    let local_var_content = local_var_resp.text().await?;
1987
1988    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1989        serde_json::from_str(&local_var_content).map_err(Error::from)
1990    } else {
1991        let local_var_entity: Option<TestEmailError> =
1992            serde_json::from_str(&local_var_content).ok();
1993        let local_var_error = ResponseContent {
1994            status: local_var_status,
1995            content: local_var_content,
1996            entity: local_var_entity,
1997        };
1998        Err(Error::ResponseError(local_var_error))
1999    }
2000}
2001
2002/// 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
2003pub async fn test_s3_connection(
2004    configuration: &configuration::Configuration,
2005    params: TestS3ConnectionParams,
2006) -> Result<crate::openapi::models::StatusOk, Error<TestS3ConnectionError>> {
2007    let local_var_configuration = configuration;
2008
2009    // unbox the parameters
2010    let config = params.config;
2011
2012    let local_var_client = &local_var_configuration.client;
2013
2014    let local_var_uri_str = format!("{}/api/v4/file/s3_test", local_var_configuration.base_path);
2015    let mut local_var_req_builder =
2016        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2017
2018    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2019        local_var_req_builder =
2020            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2021    }
2022    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2023        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2024    };
2025    local_var_req_builder = local_var_req_builder.json(&config);
2026
2027    let local_var_req = local_var_req_builder.build()?;
2028    let local_var_resp = local_var_client.execute(local_var_req).await?;
2029
2030    let local_var_status = local_var_resp.status();
2031    let local_var_content = local_var_resp.text().await?;
2032
2033    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2034        serde_json::from_str(&local_var_content).map_err(Error::from)
2035    } else {
2036        let local_var_entity: Option<TestS3ConnectionError> =
2037            serde_json::from_str(&local_var_content).ok();
2038        let local_var_error = ResponseContent {
2039            status: local_var_status,
2040            content: local_var_content,
2041            entity: local_var_entity,
2042        };
2043        Err(Error::ResponseError(local_var_error))
2044    }
2045}
2046
2047/// Sends a Ping request to the mattermost server using the specified Site URL.  ##### Permissions Must have `manage_system` permission.  __Minimum server version__: 5.16
2048pub async fn test_site_url(
2049    configuration: &configuration::Configuration,
2050    params: TestSiteUrlParams,
2051) -> Result<crate::openapi::models::StatusOk, Error<TestSiteUrlError>> {
2052    let local_var_configuration = configuration;
2053
2054    // unbox the parameters
2055    let test_site_url_request = params.test_site_url_request;
2056
2057    let local_var_client = &local_var_configuration.client;
2058
2059    let local_var_uri_str = format!("{}/api/v4/site_url/test", local_var_configuration.base_path);
2060    let mut local_var_req_builder =
2061        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2062
2063    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2064        local_var_req_builder =
2065            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2066    }
2067    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2068        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2069    };
2070    local_var_req_builder = local_var_req_builder.json(&test_site_url_request);
2071
2072    let local_var_req = local_var_req_builder.build()?;
2073    let local_var_resp = local_var_client.execute(local_var_req).await?;
2074
2075    let local_var_status = local_var_resp.status();
2076    let local_var_content = local_var_resp.text().await?;
2077
2078    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2079        serde_json::from_str(&local_var_content).map_err(Error::from)
2080    } else {
2081        let local_var_entity: Option<TestSiteUrlError> =
2082            serde_json::from_str(&local_var_content).ok();
2083        let local_var_error = ResponseContent {
2084            status: local_var_status,
2085            content: local_var_content,
2086            entity: local_var_entity,
2087        };
2088        Err(Error::ResponseError(local_var_error))
2089    }
2090}
2091
2092/// 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.
2093pub async fn update_config(
2094    configuration: &configuration::Configuration,
2095    params: UpdateConfigParams,
2096) -> Result<crate::openapi::models::Config, Error<UpdateConfigError>> {
2097    let local_var_configuration = configuration;
2098
2099    // unbox the parameters
2100    let config = params.config;
2101
2102    let local_var_client = &local_var_configuration.client;
2103
2104    let local_var_uri_str = format!("{}/api/v4/config", local_var_configuration.base_path);
2105    let mut local_var_req_builder =
2106        local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
2107
2108    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2109        local_var_req_builder =
2110            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2111    }
2112    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2113        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2114    };
2115    local_var_req_builder = local_var_req_builder.json(&config);
2116
2117    let local_var_req = local_var_req_builder.build()?;
2118    let local_var_resp = local_var_client.execute(local_var_req).await?;
2119
2120    let local_var_status = local_var_resp.status();
2121    let local_var_content = local_var_resp.text().await?;
2122
2123    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2124        serde_json::from_str(&local_var_content).map_err(Error::from)
2125    } else {
2126        let local_var_entity: Option<UpdateConfigError> =
2127            serde_json::from_str(&local_var_content).ok();
2128        let local_var_error = ResponseContent {
2129            status: local_var_status,
2130            content: local_var_content,
2131            entity: local_var_entity,
2132        };
2133        Err(Error::ResponseError(local_var_error))
2134    }
2135}
2136
2137/// 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.
2138pub async fn update_marketplace_visited_by_admin(
2139    configuration: &configuration::Configuration,
2140    params: UpdateMarketplaceVisitedByAdminParams,
2141) -> Result<crate::openapi::models::StatusOk, Error<UpdateMarketplaceVisitedByAdminError>> {
2142    let local_var_configuration = configuration;
2143
2144    // unbox the parameters
2145    let system = params.system;
2146
2147    let local_var_client = &local_var_configuration.client;
2148
2149    let local_var_uri_str = format!(
2150        "{}/api/v4/plugins/marketplace/first_admin_visit",
2151        local_var_configuration.base_path
2152    );
2153    let mut local_var_req_builder =
2154        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2155
2156    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2157        local_var_req_builder =
2158            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2159    }
2160    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2161        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2162    };
2163    local_var_req_builder = local_var_req_builder.json(&system);
2164
2165    let local_var_req = local_var_req_builder.build()?;
2166    let local_var_resp = local_var_client.execute(local_var_req).await?;
2167
2168    let local_var_status = local_var_resp.status();
2169    let local_var_content = local_var_resp.text().await?;
2170
2171    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2172        serde_json::from_str(&local_var_content).map_err(Error::from)
2173    } else {
2174        let local_var_entity: Option<UpdateMarketplaceVisitedByAdminError> =
2175            serde_json::from_str(&local_var_content).ok();
2176        let local_var_error = ResponseContent {
2177            status: local_var_status,
2178            content: local_var_content,
2179            entity: local_var_entity,
2180        };
2181        Err(Error::ResponseError(local_var_error))
2182    }
2183}
2184
2185/// 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.
2186pub async fn upgrade_to_enterprise(
2187    configuration: &configuration::Configuration,
2188) -> Result<crate::openapi::models::PushNotification, Error<UpgradeToEnterpriseError>> {
2189    let local_var_configuration = configuration;
2190
2191    // unbox the parameters
2192
2193    let local_var_client = &local_var_configuration.client;
2194
2195    let local_var_uri_str = format!(
2196        "{}/api/v4/upgrade_to_enterprise",
2197        local_var_configuration.base_path
2198    );
2199    let mut local_var_req_builder =
2200        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2201
2202    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2203        local_var_req_builder =
2204            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2205    }
2206    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2207        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2208    };
2209
2210    let local_var_req = local_var_req_builder.build()?;
2211    let local_var_resp = local_var_client.execute(local_var_req).await?;
2212
2213    let local_var_status = local_var_resp.status();
2214    let local_var_content = local_var_resp.text().await?;
2215
2216    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2217        serde_json::from_str(&local_var_content).map_err(Error::from)
2218    } else {
2219        let local_var_entity: Option<UpgradeToEnterpriseError> =
2220            serde_json::from_str(&local_var_content).ok();
2221        let local_var_error = ResponseContent {
2222            status: local_var_status,
2223            content: local_var_content,
2224            entity: local_var_entity,
2225        };
2226        Err(Error::ResponseError(local_var_error))
2227    }
2228}
2229
2230/// 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.
2231pub async fn upgrade_to_enterprise_status(
2232    configuration: &configuration::Configuration,
2233) -> Result<
2234    crate::openapi::models::UpgradeToEnterpriseStatus200Response,
2235    Error<UpgradeToEnterpriseStatusError>,
2236> {
2237    let local_var_configuration = configuration;
2238
2239    // unbox the parameters
2240
2241    let local_var_client = &local_var_configuration.client;
2242
2243    let local_var_uri_str = format!(
2244        "{}/api/v4/upgrade_to_enterprise/status",
2245        local_var_configuration.base_path
2246    );
2247    let mut local_var_req_builder =
2248        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2249
2250    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2251        local_var_req_builder =
2252            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2253    }
2254    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2255        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2256    };
2257
2258    let local_var_req = local_var_req_builder.build()?;
2259    let local_var_resp = local_var_client.execute(local_var_req).await?;
2260
2261    let local_var_status = local_var_resp.status();
2262    let local_var_content = local_var_resp.text().await?;
2263
2264    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2265        serde_json::from_str(&local_var_content).map_err(Error::from)
2266    } else {
2267        let local_var_entity: Option<UpgradeToEnterpriseStatusError> =
2268            serde_json::from_str(&local_var_content).ok();
2269        let local_var_error = ResponseContent {
2270            status: local_var_status,
2271            content: local_var_content,
2272            entity: local_var_entity,
2273        };
2274        Err(Error::ResponseError(local_var_error))
2275    }
2276}
2277
2278/// Upload a license to enable enterprise features.  __Minimum server version__: 4.0  ##### Permissions Must have `manage_system` permission.
2279pub async fn upload_license_file(
2280    configuration: &configuration::Configuration,
2281    params: UploadLicenseFileParams,
2282) -> Result<crate::openapi::models::StatusOk, Error<UploadLicenseFileError>> {
2283    let local_var_configuration = configuration;
2284
2285    // unbox the parameters
2286    let _license = params.license;
2287
2288    let local_var_client = &local_var_configuration.client;
2289
2290    let local_var_uri_str = format!("{}/api/v4/license", local_var_configuration.base_path);
2291    let mut local_var_req_builder =
2292        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2293
2294    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2295        local_var_req_builder =
2296            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2297    }
2298    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2299        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2300    };
2301    let mut local_var_form = reqwest::multipart::Form::new();
2302    // TODO: support file upload for 'license' parameter
2303    local_var_req_builder = local_var_req_builder.multipart(local_var_form);
2304
2305    let local_var_req = local_var_req_builder.build()?;
2306    let local_var_resp = local_var_client.execute(local_var_req).await?;
2307
2308    let local_var_status = local_var_resp.status();
2309    let local_var_content = local_var_resp.text().await?;
2310
2311    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2312        serde_json::from_str(&local_var_content).map_err(Error::from)
2313    } else {
2314        let local_var_entity: Option<UploadLicenseFileError> =
2315            serde_json::from_str(&local_var_content).ok();
2316        let local_var_error = ResponseContent {
2317            status: local_var_status,
2318            content: local_var_content,
2319            entity: local_var_entity,
2320        };
2321        Err(Error::ResponseError(local_var_error))
2322    }
2323}