mattermost-client 0.2.0

A sane Rust interface to the Mattermost API
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
/*
 * Mattermost API Reference
 *
 * There is also a work-in-progress [Postman API reference](https://documenter.getpostman.com/view/4508214/RW8FERUn).
 *
 * The version of the OpenAPI document: 4.0.0
 * Contact: feedback@mattermost.com
 * Generated by: https://openapi-generator.tech
 */

use reqwest;

use super::ResponseContent;
use super::{Error, configuration};

/// struct for passing parameters to the method [`get_file`]
#[derive(Clone, Debug, Default)]
pub struct GetFileParams {
    /// The ID of the file to get
    pub file_id: String,
}

/// struct for passing parameters to the method [`get_file_info`]
#[derive(Clone, Debug, Default)]
pub struct GetFileInfoParams {
    /// The ID of the file info to get
    pub file_id: String,
}

/// struct for passing parameters to the method [`get_file_link`]
#[derive(Clone, Debug, Default)]
pub struct GetFileLinkParams {
    /// The ID of the file to get a link for
    pub file_id: String,
}

/// struct for passing parameters to the method [`get_file_preview`]
#[derive(Clone, Debug, Default)]
pub struct GetFilePreviewParams {
    /// The ID of the file to get
    pub file_id: String,
}

/// struct for passing parameters to the method [`get_file_public`]
#[derive(Clone, Debug, Default)]
pub struct GetFilePublicParams {
    /// The ID of the file to get
    pub file_id: String,
    /// File hash
    pub h: String,
}

/// struct for passing parameters to the method [`get_file_thumbnail`]
#[derive(Clone, Debug, Default)]
pub struct GetFileThumbnailParams {
    /// The ID of the file to get
    pub file_id: String,
}

/// struct for passing parameters to the method [`search_files`]
#[derive(Clone, Debug, Default)]
pub struct SearchFilesParams {
    /// Team GUID
    pub team_id: String,
    /// The search terms as inputed by the user. To search for files from a user include `from:someusername`, using a user's username. To search in a specific channel include `in:somechannel`, using the channel name (not the display name). To search for specific extensions included `ext:extension`.
    pub terms: String,
    /// Set to true if an Or search should be performed vs an And search.
    pub is_or_search: bool,
    /// Offset from UTC of user timezone for date searches.
    pub time_zone_offset: Option<i32>,
    /// Set to true if deleted channels should be included in the search. (archived channels)
    pub include_deleted_channels: Option<bool>,
    /// The page to select. (Only works with Elasticsearch)
    pub page: Option<i32>,
    /// The number of posts per page. (Only works with Elasticsearch)
    pub per_page: Option<i32>,
}

/// struct for passing parameters to the method [`upload_file`]
#[derive(Clone, Debug, Default)]
pub struct UploadFileParams {
    /// The ID of the channel that this file will be uploaded to
    pub channel_id: Option<String>,
    /// The name of the file to be uploaded
    pub filename: Option<String>,
    /// A file to be uploaded
    pub files: Option<std::path::PathBuf>,
    /// The ID of the channel that this file will be uploaded to
    pub channel_id2: Option<String>,
    /// A unique identifier for the file that will be returned in the response
    pub client_ids: Option<String>,
}

/// struct for typed errors of method [`get_file`]
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
#[serde(untagged)]
pub enum GetFileError {
    Status400(crate::openapi::models::AppError),
    Status401(crate::openapi::models::AppError),
    Status403(crate::openapi::models::AppError),
    Status404(crate::openapi::models::AppError),
    Status501(crate::openapi::models::AppError),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`get_file_info`]
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
#[serde(untagged)]
pub enum GetFileInfoError {
    Status400(crate::openapi::models::AppError),
    Status401(crate::openapi::models::AppError),
    Status403(crate::openapi::models::AppError),
    Status404(crate::openapi::models::AppError),
    Status501(crate::openapi::models::AppError),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`get_file_link`]
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
#[serde(untagged)]
pub enum GetFileLinkError {
    Status400(crate::openapi::models::AppError),
    Status401(crate::openapi::models::AppError),
    Status403(crate::openapi::models::AppError),
    Status404(crate::openapi::models::AppError),
    Status501(crate::openapi::models::AppError),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`get_file_preview`]
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
#[serde(untagged)]
pub enum GetFilePreviewError {
    Status400(crate::openapi::models::AppError),
    Status401(crate::openapi::models::AppError),
    Status403(crate::openapi::models::AppError),
    Status404(crate::openapi::models::AppError),
    Status501(crate::openapi::models::AppError),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`get_file_public`]
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
#[serde(untagged)]
pub enum GetFilePublicError {
    Status400(crate::openapi::models::AppError),
    Status401(crate::openapi::models::AppError),
    Status403(crate::openapi::models::AppError),
    Status404(crate::openapi::models::AppError),
    Status501(crate::openapi::models::AppError),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`get_file_thumbnail`]
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
#[serde(untagged)]
pub enum GetFileThumbnailError {
    Status400(crate::openapi::models::AppError),
    Status401(crate::openapi::models::AppError),
    Status403(crate::openapi::models::AppError),
    Status404(crate::openapi::models::AppError),
    Status501(crate::openapi::models::AppError),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`search_files`]
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
#[serde(untagged)]
pub enum SearchFilesError {
    Status400(crate::openapi::models::AppError),
    Status401(crate::openapi::models::AppError),
    Status403(crate::openapi::models::AppError),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`upload_file`]
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
#[serde(untagged)]
pub enum UploadFileError {
    Status400(crate::openapi::models::AppError),
    Status401(crate::openapi::models::AppError),
    Status403(crate::openapi::models::AppError),
    Status413(crate::openapi::models::AppError),
    Status501(crate::openapi::models::AppError),
    UnknownValue(serde_json::Value),
}

/// Gets a file that has been uploaded previously. ##### Permissions Must have `read_channel` permission or be uploader of the file.
pub async fn get_file(
    configuration: &configuration::Configuration,
    params: GetFileParams,
) -> Result<(), Error<GetFileError>> {
    let local_var_configuration = configuration;

    // unbox the parameters
    let file_id = params.file_id;

    let local_var_client = &local_var_configuration.client;

    let local_var_uri_str = format!(
        "{}/api/v4/files/{file_id}",
        local_var_configuration.base_path,
        file_id = super::urlencode(file_id)
    );
    let mut local_var_req_builder =
        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());

    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
        local_var_req_builder =
            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
    };

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        Ok(())
    } else {
        let local_var_entity: Option<GetFileError> = serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent {
            status: local_var_status,
            content: local_var_content,
            entity: local_var_entity,
        };
        Err(Error::ResponseError(local_var_error))
    }
}

/// Gets a file's info. ##### Permissions Must have `read_channel` permission or be uploader of the file.
pub async fn get_file_info(
    configuration: &configuration::Configuration,
    params: GetFileInfoParams,
) -> Result<crate::openapi::models::FileInfo, Error<GetFileInfoError>> {
    let local_var_configuration = configuration;

    // unbox the parameters
    let file_id = params.file_id;

    let local_var_client = &local_var_configuration.client;

    let local_var_uri_str = format!(
        "{}/api/v4/files/{file_id}/info",
        local_var_configuration.base_path,
        file_id = super::urlencode(file_id)
    );
    let mut local_var_req_builder =
        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());

    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
        local_var_req_builder =
            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
    };

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        serde_json::from_str(&local_var_content).map_err(Error::from)
    } else {
        let local_var_entity: Option<GetFileInfoError> =
            serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent {
            status: local_var_status,
            content: local_var_content,
            entity: local_var_entity,
        };
        Err(Error::ResponseError(local_var_error))
    }
}

/// Gets a public link for a file that can be accessed without logging into Mattermost. ##### Permissions Must have `read_channel` permission or be uploader of the file.
pub async fn get_file_link(
    configuration: &configuration::Configuration,
    params: GetFileLinkParams,
) -> Result<crate::openapi::models::GetFileLink200Response, Error<GetFileLinkError>> {
    let local_var_configuration = configuration;

    // unbox the parameters
    let file_id = params.file_id;

    let local_var_client = &local_var_configuration.client;

    let local_var_uri_str = format!(
        "{}/api/v4/files/{file_id}/link",
        local_var_configuration.base_path,
        file_id = super::urlencode(file_id)
    );
    let mut local_var_req_builder =
        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());

    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
        local_var_req_builder =
            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
    };

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        serde_json::from_str(&local_var_content).map_err(Error::from)
    } else {
        let local_var_entity: Option<GetFileLinkError> =
            serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent {
            status: local_var_status,
            content: local_var_content,
            entity: local_var_entity,
        };
        Err(Error::ResponseError(local_var_error))
    }
}

/// Gets a file's preview. ##### Permissions Must have `read_channel` permission or be uploader of the file.
pub async fn get_file_preview(
    configuration: &configuration::Configuration,
    params: GetFilePreviewParams,
) -> Result<(), Error<GetFilePreviewError>> {
    let local_var_configuration = configuration;

    // unbox the parameters
    let file_id = params.file_id;

    let local_var_client = &local_var_configuration.client;

    let local_var_uri_str = format!(
        "{}/api/v4/files/{file_id}/preview",
        local_var_configuration.base_path,
        file_id = super::urlencode(file_id)
    );
    let mut local_var_req_builder =
        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());

    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
        local_var_req_builder =
            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
    };

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        Ok(())
    } else {
        let local_var_entity: Option<GetFilePreviewError> =
            serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent {
            status: local_var_status,
            content: local_var_content,
            entity: local_var_entity,
        };
        Err(Error::ResponseError(local_var_error))
    }
}

/// ##### Permissions No permissions required.
pub async fn get_file_public(
    configuration: &configuration::Configuration,
    params: GetFilePublicParams,
) -> Result<(), Error<GetFilePublicError>> {
    let local_var_configuration = configuration;

    // unbox the parameters
    let file_id = params.file_id;
    let h = params.h;

    let local_var_client = &local_var_configuration.client;

    let local_var_uri_str = format!(
        "{}/api/v4/files/{file_id}/public",
        local_var_configuration.base_path,
        file_id = super::urlencode(file_id)
    );
    let mut local_var_req_builder =
        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());

    local_var_req_builder = local_var_req_builder.query(&[("h", &h.to_string())]);
    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
        local_var_req_builder =
            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
    };

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        Ok(())
    } else {
        let local_var_entity: Option<GetFilePublicError> =
            serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent {
            status: local_var_status,
            content: local_var_content,
            entity: local_var_entity,
        };
        Err(Error::ResponseError(local_var_error))
    }
}

/// Gets a file's thumbnail. ##### Permissions Must have `read_channel` permission or be uploader of the file.
pub async fn get_file_thumbnail(
    configuration: &configuration::Configuration,
    params: GetFileThumbnailParams,
) -> Result<(), Error<GetFileThumbnailError>> {
    let local_var_configuration = configuration;

    // unbox the parameters
    let file_id = params.file_id;

    let local_var_client = &local_var_configuration.client;

    let local_var_uri_str = format!(
        "{}/api/v4/files/{file_id}/thumbnail",
        local_var_configuration.base_path,
        file_id = super::urlencode(file_id)
    );
    let mut local_var_req_builder =
        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());

    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
        local_var_req_builder =
            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
    };

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        Ok(())
    } else {
        let local_var_entity: Option<GetFileThumbnailError> =
            serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent {
            status: local_var_status,
            content: local_var_content,
            entity: local_var_entity,
        };
        Err(Error::ResponseError(local_var_error))
    }
}

/// Search for files in a team based on file name, extention and file content (if file content extraction is enabled and supported for the files). __Minimum server version__: 5.34 ##### Permissions Must be authenticated and have the `view_team` permission.
pub async fn search_files(
    configuration: &configuration::Configuration,
    params: SearchFilesParams,
) -> Result<crate::openapi::models::FileInfoList, Error<SearchFilesError>> {
    let local_var_configuration = configuration;

    // unbox the parameters
    let team_id = params.team_id;
    let terms = params.terms;
    let is_or_search = params.is_or_search;
    let time_zone_offset = params.time_zone_offset;
    let include_deleted_channels = params.include_deleted_channels;
    let page = params.page;
    let per_page = params.per_page;

    let local_var_client = &local_var_configuration.client;

    let local_var_uri_str = format!(
        "{}/api/v4/teams/{team_id}/files/search",
        local_var_configuration.base_path,
        team_id = super::urlencode(team_id)
    );
    let mut local_var_req_builder =
        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());

    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
        local_var_req_builder =
            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
    };
    let mut local_var_form = reqwest::multipart::Form::new();
    local_var_form = local_var_form.text("terms", terms.to_string());
    local_var_form = local_var_form.text("is_or_search", is_or_search.to_string());
    if let Some(local_var_param_value) = time_zone_offset {
        local_var_form = local_var_form.text("time_zone_offset", local_var_param_value.to_string());
    }
    if let Some(local_var_param_value) = include_deleted_channels {
        local_var_form = local_var_form.text(
            "include_deleted_channels",
            local_var_param_value.to_string(),
        );
    }
    if let Some(local_var_param_value) = page {
        local_var_form = local_var_form.text("page", local_var_param_value.to_string());
    }
    if let Some(local_var_param_value) = per_page {
        local_var_form = local_var_form.text("per_page", local_var_param_value.to_string());
    }
    local_var_req_builder = local_var_req_builder.multipart(local_var_form);

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        serde_json::from_str(&local_var_content).map_err(Error::from)
    } else {
        let local_var_entity: Option<SearchFilesError> =
            serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent {
            status: local_var_status,
            content: local_var_content,
            entity: local_var_entity,
        };
        Err(Error::ResponseError(local_var_error))
    }
}

/// Uploads a file that can later be attached to a post.  This request can either be a multipart/form-data request with a channel_id, files and optional client_ids defined in the FormData, or it can be a request with the channel_id and filename defined as query parameters with the contents of a single file in the body of the request.  Only multipart/form-data requests are supported by server versions up to and including 4.7. Server versions 4.8 and higher support both types of requests.  ##### Permissions Must have `upload_file` permission.
pub async fn upload_file(
    configuration: &configuration::Configuration,
    params: UploadFileParams,
) -> Result<crate::openapi::models::UploadFile201Response, Error<UploadFileError>> {
    let local_var_configuration = configuration;

    // unbox the parameters
    let channel_id = params.channel_id;
    let filename = params.filename;
    let _files = params.files;
    let channel_id2 = params.channel_id2;
    let client_ids = params.client_ids;

    let local_var_client = &local_var_configuration.client;

    let local_var_uri_str = format!("{}/api/v4/files", local_var_configuration.base_path);
    let mut local_var_req_builder =
        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());

    if let Some(ref local_var_str) = channel_id {
        local_var_req_builder =
            local_var_req_builder.query(&[("channel_id", &local_var_str.to_string())]);
    }
    if let Some(ref local_var_str) = filename {
        local_var_req_builder =
            local_var_req_builder.query(&[("filename", &local_var_str.to_string())]);
    }
    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
        local_var_req_builder =
            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
    };
    let mut local_var_form = reqwest::multipart::Form::new();
    // TODO: support file upload for 'files' parameter
    if let Some(local_var_param_value) = channel_id2 {
        local_var_form = local_var_form.text("channel_id", local_var_param_value.to_string());
    }
    if let Some(local_var_param_value) = client_ids {
        local_var_form = local_var_form.text("client_ids", local_var_param_value.to_string());
    }
    local_var_req_builder = local_var_req_builder.multipart(local_var_form);

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        serde_json::from_str(&local_var_content).map_err(Error::from)
    } else {
        let local_var_entity: Option<UploadFileError> =
            serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent {
            status: local_var_status,
            content: local_var_content,
            entity: local_var_entity,
        };
        Err(Error::ResponseError(local_var_error))
    }
}