mattermost_rust_client/apis/
users_api.rs

1/*
2 * Mattermost API Reference
3 *
4 * There is also a work-in-progress [Postman API reference](https://documenter.getpostman.com/view/4508214/RW8FERUn). 
5 *
6 * The version of the OpenAPI document: 4.0.0
7 * Contact: feedback@mattermost.com
8 * Generated by: https://openapi-generator.tech
9 */
10
11
12use reqwest;
13
14use crate::apis::ResponseContent;
15use super::{Error, configuration};
16
17
18/// struct for typed errors of method [`attach_device_id`]
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum AttachDeviceIdError {
22    Status400(crate::models::AppError),
23    Status401(crate::models::AppError),
24    UnknownValue(serde_json::Value),
25}
26
27/// struct for typed errors of method [`autocomplete_users`]
28#[derive(Debug, Clone, Serialize, Deserialize)]
29#[serde(untagged)]
30pub enum AutocompleteUsersError {
31    Status400(crate::models::AppError),
32    Status401(crate::models::AppError),
33    Status403(crate::models::AppError),
34    UnknownValue(serde_json::Value),
35}
36
37/// struct for typed errors of method [`check_user_mfa`]
38#[derive(Debug, Clone, Serialize, Deserialize)]
39#[serde(untagged)]
40pub enum CheckUserMfaError {
41    Status400(crate::models::AppError),
42    UnknownValue(serde_json::Value),
43}
44
45/// struct for typed errors of method [`convert_bot_to_user`]
46#[derive(Debug, Clone, Serialize, Deserialize)]
47#[serde(untagged)]
48pub enum ConvertBotToUserError {
49    Status400(crate::models::AppError),
50    Status401(crate::models::AppError),
51    Status403(crate::models::AppError),
52    Status404(crate::models::AppError),
53    UnknownValue(serde_json::Value),
54}
55
56/// struct for typed errors of method [`convert_user_to_bot`]
57#[derive(Debug, Clone, Serialize, Deserialize)]
58#[serde(untagged)]
59pub enum ConvertUserToBotError {
60    Status400(crate::models::AppError),
61    Status401(crate::models::AppError),
62    Status403(crate::models::AppError),
63    Status404(crate::models::AppError),
64    UnknownValue(serde_json::Value),
65}
66
67/// struct for typed errors of method [`create_user`]
68#[derive(Debug, Clone, Serialize, Deserialize)]
69#[serde(untagged)]
70pub enum CreateUserError {
71    Status400(crate::models::AppError),
72    Status403(crate::models::AppError),
73    UnknownValue(serde_json::Value),
74}
75
76/// struct for typed errors of method [`create_user_access_token`]
77#[derive(Debug, Clone, Serialize, Deserialize)]
78#[serde(untagged)]
79pub enum CreateUserAccessTokenError {
80    Status400(crate::models::AppError),
81    Status401(crate::models::AppError),
82    Status403(crate::models::AppError),
83    UnknownValue(serde_json::Value),
84}
85
86/// struct for typed errors of method [`delete_user`]
87#[derive(Debug, Clone, Serialize, Deserialize)]
88#[serde(untagged)]
89pub enum DeleteUserError {
90    Status400(crate::models::AppError),
91    Status401(crate::models::AppError),
92    Status403(crate::models::AppError),
93    Status404(crate::models::AppError),
94    UnknownValue(serde_json::Value),
95}
96
97/// struct for typed errors of method [`demote_user_to_guest`]
98#[derive(Debug, Clone, Serialize, Deserialize)]
99#[serde(untagged)]
100pub enum DemoteUserToGuestError {
101    Status400(crate::models::AppError),
102    Status401(crate::models::AppError),
103    Status403(crate::models::AppError),
104    Status404(crate::models::AppError),
105    Status501(crate::models::AppError),
106    UnknownValue(serde_json::Value),
107}
108
109/// struct for typed errors of method [`disable_user_access_token`]
110#[derive(Debug, Clone, Serialize, Deserialize)]
111#[serde(untagged)]
112pub enum DisableUserAccessTokenError {
113    Status400(crate::models::AppError),
114    Status401(crate::models::AppError),
115    Status403(crate::models::AppError),
116    UnknownValue(serde_json::Value),
117}
118
119/// struct for typed errors of method [`enable_user_access_token`]
120#[derive(Debug, Clone, Serialize, Deserialize)]
121#[serde(untagged)]
122pub enum EnableUserAccessTokenError {
123    Status400(crate::models::AppError),
124    Status401(crate::models::AppError),
125    Status403(crate::models::AppError),
126    UnknownValue(serde_json::Value),
127}
128
129/// struct for typed errors of method [`generate_mfa_secret`]
130#[derive(Debug, Clone, Serialize, Deserialize)]
131#[serde(untagged)]
132pub enum GenerateMfaSecretError {
133    Status400(crate::models::AppError),
134    Status401(crate::models::AppError),
135    Status403(crate::models::AppError),
136    Status404(crate::models::AppError),
137    Status501(crate::models::AppError),
138    UnknownValue(serde_json::Value),
139}
140
141/// struct for typed errors of method [`get_channel_members_with_team_data_for_user`]
142#[derive(Debug, Clone, Serialize, Deserialize)]
143#[serde(untagged)]
144pub enum GetChannelMembersWithTeamDataForUserError {
145    Status400(crate::models::AppError),
146    Status401(crate::models::AppError),
147    Status404(crate::models::AppError),
148    UnknownValue(serde_json::Value),
149}
150
151/// struct for typed errors of method [`get_default_profile_image`]
152#[derive(Debug, Clone, Serialize, Deserialize)]
153#[serde(untagged)]
154pub enum GetDefaultProfileImageError {
155    Status400(crate::models::AppError),
156    Status401(crate::models::AppError),
157    Status403(crate::models::AppError),
158    Status404(crate::models::AppError),
159    Status501(crate::models::AppError),
160    UnknownValue(serde_json::Value),
161}
162
163/// struct for typed errors of method [`get_known_users`]
164#[derive(Debug, Clone, Serialize, Deserialize)]
165#[serde(untagged)]
166pub enum GetKnownUsersError {
167    Status401(crate::models::AppError),
168    UnknownValue(serde_json::Value),
169}
170
171/// struct for typed errors of method [`get_profile_image`]
172#[derive(Debug, Clone, Serialize, Deserialize)]
173#[serde(untagged)]
174pub enum GetProfileImageError {
175    Status400(crate::models::AppError),
176    Status401(crate::models::AppError),
177    Status403(crate::models::AppError),
178    Status404(crate::models::AppError),
179    Status501(crate::models::AppError),
180    UnknownValue(serde_json::Value),
181}
182
183/// struct for typed errors of method [`get_sessions`]
184#[derive(Debug, Clone, Serialize, Deserialize)]
185#[serde(untagged)]
186pub enum GetSessionsError {
187    Status400(crate::models::AppError),
188    Status401(crate::models::AppError),
189    Status403(crate::models::AppError),
190    UnknownValue(serde_json::Value),
191}
192
193/// struct for typed errors of method [`get_total_users_stats`]
194#[derive(Debug, Clone, Serialize, Deserialize)]
195#[serde(untagged)]
196pub enum GetTotalUsersStatsError {
197    Status400(crate::models::AppError),
198    Status401(crate::models::AppError),
199    Status403(crate::models::AppError),
200    Status404(crate::models::AppError),
201    UnknownValue(serde_json::Value),
202}
203
204/// struct for typed errors of method [`get_total_users_stats_filtered`]
205#[derive(Debug, Clone, Serialize, Deserialize)]
206#[serde(untagged)]
207pub enum GetTotalUsersStatsFilteredError {
208    Status400(crate::models::AppError),
209    Status401(crate::models::AppError),
210    Status403(crate::models::AppError),
211    Status404(crate::models::AppError),
212    UnknownValue(serde_json::Value),
213}
214
215/// struct for typed errors of method [`get_uploads_for_user`]
216#[derive(Debug, Clone, Serialize, Deserialize)]
217#[serde(untagged)]
218pub enum GetUploadsForUserError {
219    Status400(crate::models::AppError),
220    Status401(crate::models::AppError),
221    Status404(crate::models::AppError),
222    UnknownValue(serde_json::Value),
223}
224
225/// struct for typed errors of method [`get_user`]
226#[derive(Debug, Clone, Serialize, Deserialize)]
227#[serde(untagged)]
228pub enum GetUserError {
229    Status400(crate::models::AppError),
230    Status401(crate::models::AppError),
231    Status404(crate::models::AppError),
232    UnknownValue(serde_json::Value),
233}
234
235/// struct for typed errors of method [`get_user_access_token`]
236#[derive(Debug, Clone, Serialize, Deserialize)]
237#[serde(untagged)]
238pub enum GetUserAccessTokenError {
239    Status400(crate::models::AppError),
240    Status401(crate::models::AppError),
241    Status403(crate::models::AppError),
242    Status404(crate::models::AppError),
243    UnknownValue(serde_json::Value),
244}
245
246/// struct for typed errors of method [`get_user_access_tokens`]
247#[derive(Debug, Clone, Serialize, Deserialize)]
248#[serde(untagged)]
249pub enum GetUserAccessTokensError {
250    Status400(crate::models::AppError),
251    Status401(crate::models::AppError),
252    Status403(crate::models::AppError),
253    UnknownValue(serde_json::Value),
254}
255
256/// struct for typed errors of method [`get_user_access_tokens_for_user`]
257#[derive(Debug, Clone, Serialize, Deserialize)]
258#[serde(untagged)]
259pub enum GetUserAccessTokensForUserError {
260    Status400(crate::models::AppError),
261    Status401(crate::models::AppError),
262    Status403(crate::models::AppError),
263    UnknownValue(serde_json::Value),
264}
265
266/// struct for typed errors of method [`get_user_audits`]
267#[derive(Debug, Clone, Serialize, Deserialize)]
268#[serde(untagged)]
269pub enum GetUserAuditsError {
270    Status400(crate::models::AppError),
271    Status401(crate::models::AppError),
272    Status403(crate::models::AppError),
273    UnknownValue(serde_json::Value),
274}
275
276/// struct for typed errors of method [`get_user_by_email`]
277#[derive(Debug, Clone, Serialize, Deserialize)]
278#[serde(untagged)]
279pub enum GetUserByEmailError {
280    Status400(crate::models::AppError),
281    Status401(crate::models::AppError),
282    Status403(crate::models::AppError),
283    Status404(crate::models::AppError),
284    UnknownValue(serde_json::Value),
285}
286
287/// struct for typed errors of method [`get_user_by_username`]
288#[derive(Debug, Clone, Serialize, Deserialize)]
289#[serde(untagged)]
290pub enum GetUserByUsernameError {
291    Status400(crate::models::AppError),
292    Status401(crate::models::AppError),
293    Status404(crate::models::AppError),
294    UnknownValue(serde_json::Value),
295}
296
297/// struct for typed errors of method [`get_user_terms_of_service`]
298#[derive(Debug, Clone, Serialize, Deserialize)]
299#[serde(untagged)]
300pub enum GetUserTermsOfServiceError {
301    Status400(crate::models::AppError),
302    Status401(crate::models::AppError),
303    Status404(crate::models::AppError),
304    UnknownValue(serde_json::Value),
305}
306
307/// struct for typed errors of method [`get_users`]
308#[derive(Debug, Clone, Serialize, Deserialize)]
309#[serde(untagged)]
310pub enum GetUsersError {
311    Status400(crate::models::AppError),
312    Status401(crate::models::AppError),
313    Status403(crate::models::AppError),
314    UnknownValue(serde_json::Value),
315}
316
317/// struct for typed errors of method [`get_users_by_group_channel_ids`]
318#[derive(Debug, Clone, Serialize, Deserialize)]
319#[serde(untagged)]
320pub enum GetUsersByGroupChannelIdsError {
321    Status400(crate::models::AppError),
322    Status401(crate::models::AppError),
323    UnknownValue(serde_json::Value),
324}
325
326/// struct for typed errors of method [`get_users_by_ids`]
327#[derive(Debug, Clone, Serialize, Deserialize)]
328#[serde(untagged)]
329pub enum GetUsersByIdsError {
330    Status400(crate::models::AppError),
331    Status401(crate::models::AppError),
332    UnknownValue(serde_json::Value),
333}
334
335/// struct for typed errors of method [`get_users_by_usernames`]
336#[derive(Debug, Clone, Serialize, Deserialize)]
337#[serde(untagged)]
338pub enum GetUsersByUsernamesError {
339    Status400(crate::models::AppError),
340    Status401(crate::models::AppError),
341    UnknownValue(serde_json::Value),
342}
343
344/// struct for typed errors of method [`login`]
345#[derive(Debug, Clone, Serialize, Deserialize)]
346#[serde(untagged)]
347pub enum LoginError {
348    Status400(crate::models::AppError),
349    Status403(crate::models::AppError),
350    UnknownValue(serde_json::Value),
351}
352
353/// struct for typed errors of method [`login_by_cws_token`]
354#[derive(Debug, Clone, Serialize, Deserialize)]
355#[serde(untagged)]
356pub enum LoginByCwsTokenError {
357    Status400(crate::models::AppError),
358    Status401(crate::models::AppError),
359    Status403(crate::models::AppError),
360    UnknownValue(serde_json::Value),
361}
362
363/// struct for typed errors of method [`logout`]
364#[derive(Debug, Clone, Serialize, Deserialize)]
365#[serde(untagged)]
366pub enum LogoutError {
367    Status400(crate::models::AppError),
368    Status403(crate::models::AppError),
369    UnknownValue(serde_json::Value),
370}
371
372/// struct for typed errors of method [`migrate_auth_to_ldap`]
373#[derive(Debug, Clone, Serialize, Deserialize)]
374#[serde(untagged)]
375pub enum MigrateAuthToLdapError {
376    Status400(crate::models::AppError),
377    Status401(crate::models::AppError),
378    Status403(crate::models::AppError),
379    Status501(crate::models::AppError),
380    UnknownValue(serde_json::Value),
381}
382
383/// struct for typed errors of method [`migrate_auth_to_saml`]
384#[derive(Debug, Clone, Serialize, Deserialize)]
385#[serde(untagged)]
386pub enum MigrateAuthToSamlError {
387    Status400(crate::models::AppError),
388    Status401(crate::models::AppError),
389    Status403(crate::models::AppError),
390    Status501(crate::models::AppError),
391    UnknownValue(serde_json::Value),
392}
393
394/// struct for typed errors of method [`patch_user`]
395#[derive(Debug, Clone, Serialize, Deserialize)]
396#[serde(untagged)]
397pub enum PatchUserError {
398    Status400(crate::models::AppError),
399    Status401(crate::models::AppError),
400    Status403(crate::models::AppError),
401    UnknownValue(serde_json::Value),
402}
403
404/// struct for typed errors of method [`permanent_delete_all_users`]
405#[derive(Debug, Clone, Serialize, Deserialize)]
406#[serde(untagged)]
407pub enum PermanentDeleteAllUsersError {
408    UnknownValue(serde_json::Value),
409}
410
411/// struct for typed errors of method [`promote_guest_to_user`]
412#[derive(Debug, Clone, Serialize, Deserialize)]
413#[serde(untagged)]
414pub enum PromoteGuestToUserError {
415    Status400(crate::models::AppError),
416    Status401(crate::models::AppError),
417    Status403(crate::models::AppError),
418    Status404(crate::models::AppError),
419    Status501(crate::models::AppError),
420    UnknownValue(serde_json::Value),
421}
422
423/// struct for typed errors of method [`publish_user_typing`]
424#[derive(Debug, Clone, Serialize, Deserialize)]
425#[serde(untagged)]
426pub enum PublishUserTypingError {
427    Status400(crate::models::AppError),
428    Status401(crate::models::AppError),
429    Status403(crate::models::AppError),
430    UnknownValue(serde_json::Value),
431}
432
433/// struct for typed errors of method [`register_terms_of_service_action`]
434#[derive(Debug, Clone, Serialize, Deserialize)]
435#[serde(untagged)]
436pub enum RegisterTermsOfServiceActionError {
437    Status400(crate::models::AppError),
438    Status401(crate::models::AppError),
439    Status403(crate::models::AppError),
440    UnknownValue(serde_json::Value),
441}
442
443/// struct for typed errors of method [`reset_password`]
444#[derive(Debug, Clone, Serialize, Deserialize)]
445#[serde(untagged)]
446pub enum ResetPasswordError {
447    Status400(crate::models::AppError),
448    Status401(crate::models::AppError),
449    Status403(crate::models::AppError),
450    UnknownValue(serde_json::Value),
451}
452
453/// struct for typed errors of method [`revoke_all_sessions`]
454#[derive(Debug, Clone, Serialize, Deserialize)]
455#[serde(untagged)]
456pub enum RevokeAllSessionsError {
457    Status400(crate::models::AppError),
458    Status401(crate::models::AppError),
459    Status403(crate::models::AppError),
460    UnknownValue(serde_json::Value),
461}
462
463/// struct for typed errors of method [`revoke_session`]
464#[derive(Debug, Clone, Serialize, Deserialize)]
465#[serde(untagged)]
466pub enum RevokeSessionError {
467    Status400(crate::models::AppError),
468    Status401(crate::models::AppError),
469    Status403(crate::models::AppError),
470    UnknownValue(serde_json::Value),
471}
472
473/// struct for typed errors of method [`revoke_sessions_from_all_users`]
474#[derive(Debug, Clone, Serialize, Deserialize)]
475#[serde(untagged)]
476pub enum RevokeSessionsFromAllUsersError {
477    Status401(crate::models::AppError),
478    Status403(crate::models::AppError),
479    UnknownValue(serde_json::Value),
480}
481
482/// struct for typed errors of method [`revoke_user_access_token`]
483#[derive(Debug, Clone, Serialize, Deserialize)]
484#[serde(untagged)]
485pub enum RevokeUserAccessTokenError {
486    Status400(crate::models::AppError),
487    Status401(crate::models::AppError),
488    Status403(crate::models::AppError),
489    UnknownValue(serde_json::Value),
490}
491
492/// struct for typed errors of method [`search_user_access_tokens`]
493#[derive(Debug, Clone, Serialize, Deserialize)]
494#[serde(untagged)]
495pub enum SearchUserAccessTokensError {
496    UnknownValue(serde_json::Value),
497}
498
499/// struct for typed errors of method [`search_users`]
500#[derive(Debug, Clone, Serialize, Deserialize)]
501#[serde(untagged)]
502pub enum SearchUsersError {
503    Status400(crate::models::AppError),
504    Status401(crate::models::AppError),
505    Status403(crate::models::AppError),
506    UnknownValue(serde_json::Value),
507}
508
509/// struct for typed errors of method [`send_password_reset_email`]
510#[derive(Debug, Clone, Serialize, Deserialize)]
511#[serde(untagged)]
512pub enum SendPasswordResetEmailError {
513    Status400(crate::models::AppError),
514    Status401(crate::models::AppError),
515    Status403(crate::models::AppError),
516    UnknownValue(serde_json::Value),
517}
518
519/// struct for typed errors of method [`send_verification_email`]
520#[derive(Debug, Clone, Serialize, Deserialize)]
521#[serde(untagged)]
522pub enum SendVerificationEmailError {
523    Status400(crate::models::AppError),
524    UnknownValue(serde_json::Value),
525}
526
527/// struct for typed errors of method [`set_default_profile_image`]
528#[derive(Debug, Clone, Serialize, Deserialize)]
529#[serde(untagged)]
530pub enum SetDefaultProfileImageError {
531    Status400(crate::models::AppError),
532    Status401(crate::models::AppError),
533    Status403(crate::models::AppError),
534    Status404(crate::models::AppError),
535    Status501(crate::models::AppError),
536    UnknownValue(serde_json::Value),
537}
538
539/// struct for typed errors of method [`set_profile_image`]
540#[derive(Debug, Clone, Serialize, Deserialize)]
541#[serde(untagged)]
542pub enum SetProfileImageError {
543    Status400(crate::models::AppError),
544    Status401(crate::models::AppError),
545    Status403(crate::models::AppError),
546    Status404(crate::models::AppError),
547    Status501(crate::models::AppError),
548    UnknownValue(serde_json::Value),
549}
550
551/// struct for typed errors of method [`switch_account_type`]
552#[derive(Debug, Clone, Serialize, Deserialize)]
553#[serde(untagged)]
554pub enum SwitchAccountTypeError {
555    Status400(crate::models::AppError),
556    Status401(crate::models::AppError),
557    Status403(crate::models::AppError),
558    Status404(crate::models::AppError),
559    Status501(crate::models::AppError),
560    UnknownValue(serde_json::Value),
561}
562
563/// struct for typed errors of method [`update_user`]
564#[derive(Debug, Clone, Serialize, Deserialize)]
565#[serde(untagged)]
566pub enum UpdateUserError {
567    Status400(crate::models::AppError),
568    Status401(crate::models::AppError),
569    Status403(crate::models::AppError),
570    UnknownValue(serde_json::Value),
571}
572
573/// struct for typed errors of method [`update_user_active`]
574#[derive(Debug, Clone, Serialize, Deserialize)]
575#[serde(untagged)]
576pub enum UpdateUserActiveError {
577    Status400(crate::models::AppError),
578    Status401(crate::models::AppError),
579    Status403(crate::models::AppError),
580    UnknownValue(serde_json::Value),
581}
582
583/// struct for typed errors of method [`update_user_auth`]
584#[derive(Debug, Clone, Serialize, Deserialize)]
585#[serde(untagged)]
586pub enum UpdateUserAuthError {
587    Status400(crate::models::AppError),
588    Status401(crate::models::AppError),
589    Status403(crate::models::AppError),
590    Status501(crate::models::AppError),
591    UnknownValue(serde_json::Value),
592}
593
594/// struct for typed errors of method [`update_user_mfa`]
595#[derive(Debug, Clone, Serialize, Deserialize)]
596#[serde(untagged)]
597pub enum UpdateUserMfaError {
598    Status400(crate::models::AppError),
599    Status401(crate::models::AppError),
600    Status403(crate::models::AppError),
601    Status501(crate::models::AppError),
602    UnknownValue(serde_json::Value),
603}
604
605/// struct for typed errors of method [`update_user_password`]
606#[derive(Debug, Clone, Serialize, Deserialize)]
607#[serde(untagged)]
608pub enum UpdateUserPasswordError {
609    Status400(crate::models::AppError),
610    Status401(crate::models::AppError),
611    Status403(crate::models::AppError),
612    UnknownValue(serde_json::Value),
613}
614
615/// struct for typed errors of method [`update_user_roles`]
616#[derive(Debug, Clone, Serialize, Deserialize)]
617#[serde(untagged)]
618pub enum UpdateUserRolesError {
619    Status400(crate::models::AppError),
620    Status401(crate::models::AppError),
621    Status403(crate::models::AppError),
622    UnknownValue(serde_json::Value),
623}
624
625/// struct for typed errors of method [`verify_user_email`]
626#[derive(Debug, Clone, Serialize, Deserialize)]
627#[serde(untagged)]
628pub enum VerifyUserEmailError {
629    Status400(crate::models::AppError),
630    UnknownValue(serde_json::Value),
631}
632
633/// struct for typed errors of method [`verify_user_email_without_token`]
634#[derive(Debug, Clone, Serialize, Deserialize)]
635#[serde(untagged)]
636pub enum VerifyUserEmailWithoutTokenError {
637    Status400(crate::models::AppError),
638    Status401(crate::models::AppError),
639    Status404(crate::models::AppError),
640    UnknownValue(serde_json::Value),
641}
642
643
644/// Attach a mobile device id to the currently logged in session. This will enable push notifications for a user, if configured by the server. ##### Permissions Must be authenticated. 
645pub async fn attach_device_id(configuration: &configuration::Configuration, attach_device_id_request: crate::models::AttachDeviceIdRequest) -> Result<crate::models::StatusOk, Error<AttachDeviceIdError>> {
646    let local_var_configuration = configuration;
647
648    let local_var_client = &local_var_configuration.client;
649
650    let local_var_uri_str = format!("{}/users/sessions/device", local_var_configuration.base_path);
651    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
652
653    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
654        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
655    }
656    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
657        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
658    };
659    local_var_req_builder = local_var_req_builder.json(&attach_device_id_request);
660
661    let local_var_req = local_var_req_builder.build()?;
662    let local_var_resp = local_var_client.execute(local_var_req).await?;
663
664    let local_var_status = local_var_resp.status();
665    let local_var_content = local_var_resp.text().await?;
666
667    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
668        serde_json::from_str(&local_var_content).map_err(Error::from)
669    } else {
670        let local_var_entity: Option<AttachDeviceIdError> = serde_json::from_str(&local_var_content).ok();
671        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
672        Err(Error::ResponseError(local_var_error))
673    }
674}
675
676/// Get a list of users for the purpose of autocompleting based on the provided search term. Specify a combination of `team_id` and `channel_id` to filter results further. ##### Permissions Requires an active session and `view_team` and `read_channel` on any teams or channels used to filter the results further. 
677pub async fn autocomplete_users(configuration: &configuration::Configuration, name: &str, team_id: Option<&str>, channel_id: Option<&str>, limit: Option<i32>) -> Result<crate::models::UserAutocomplete, Error<AutocompleteUsersError>> {
678    let local_var_configuration = configuration;
679
680    let local_var_client = &local_var_configuration.client;
681
682    let local_var_uri_str = format!("{}/users/autocomplete", local_var_configuration.base_path);
683    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
684
685    if let Some(ref local_var_str) = team_id {
686        local_var_req_builder = local_var_req_builder.query(&[("team_id", &local_var_str.to_string())]);
687    }
688    if let Some(ref local_var_str) = channel_id {
689        local_var_req_builder = local_var_req_builder.query(&[("channel_id", &local_var_str.to_string())]);
690    }
691    local_var_req_builder = local_var_req_builder.query(&[("name", &name.to_string())]);
692    if let Some(ref local_var_str) = limit {
693        local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]);
694    }
695    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
696        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
697    }
698    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
699        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
700    };
701
702    let local_var_req = local_var_req_builder.build()?;
703    let local_var_resp = local_var_client.execute(local_var_req).await?;
704
705    let local_var_status = local_var_resp.status();
706    let local_var_content = local_var_resp.text().await?;
707
708    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
709        serde_json::from_str(&local_var_content).map_err(Error::from)
710    } else {
711        let local_var_entity: Option<AutocompleteUsersError> = serde_json::from_str(&local_var_content).ok();
712        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
713        Err(Error::ResponseError(local_var_error))
714    }
715}
716
717/// Check if a user has multi-factor authentication active on their account by providing a login id. Used to check whether an MFA code needs to be provided when logging in. ##### Permissions No permission required. 
718pub async fn check_user_mfa(configuration: &configuration::Configuration, check_user_mfa_request: crate::models::CheckUserMfaRequest) -> Result<crate::models::CheckUserMfa200Response, Error<CheckUserMfaError>> {
719    let local_var_configuration = configuration;
720
721    let local_var_client = &local_var_configuration.client;
722
723    let local_var_uri_str = format!("{}/users/mfa", local_var_configuration.base_path);
724    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
725
726    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
727        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
728    }
729    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
730        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
731    };
732    local_var_req_builder = local_var_req_builder.json(&check_user_mfa_request);
733
734    let local_var_req = local_var_req_builder.build()?;
735    let local_var_resp = local_var_client.execute(local_var_req).await?;
736
737    let local_var_status = local_var_resp.status();
738    let local_var_content = local_var_resp.text().await?;
739
740    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
741        serde_json::from_str(&local_var_content).map_err(Error::from)
742    } else {
743        let local_var_entity: Option<CheckUserMfaError> = serde_json::from_str(&local_var_content).ok();
744        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
745        Err(Error::ResponseError(local_var_error))
746    }
747}
748
749/// Convert a bot into a user.  __Minimum server version__: 5.26  ##### Permissions Must have `manage_system` permission. 
750pub async fn convert_bot_to_user(configuration: &configuration::Configuration, bot_user_id: &str, convert_bot_to_user_request: crate::models::ConvertBotToUserRequest, set_system_admin: Option<bool>) -> Result<crate::models::StatusOk, Error<ConvertBotToUserError>> {
751    let local_var_configuration = configuration;
752
753    let local_var_client = &local_var_configuration.client;
754
755    let local_var_uri_str = format!("{}/bots/{bot_user_id}/convert_to_user", local_var_configuration.base_path, bot_user_id=crate::apis::urlencode(bot_user_id));
756    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
757
758    if let Some(ref local_var_str) = set_system_admin {
759        local_var_req_builder = local_var_req_builder.query(&[("set_system_admin", &local_var_str.to_string())]);
760    }
761    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
762        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
763    }
764    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
765        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
766    };
767    local_var_req_builder = local_var_req_builder.json(&convert_bot_to_user_request);
768
769    let local_var_req = local_var_req_builder.build()?;
770    let local_var_resp = local_var_client.execute(local_var_req).await?;
771
772    let local_var_status = local_var_resp.status();
773    let local_var_content = local_var_resp.text().await?;
774
775    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
776        serde_json::from_str(&local_var_content).map_err(Error::from)
777    } else {
778        let local_var_entity: Option<ConvertBotToUserError> = serde_json::from_str(&local_var_content).ok();
779        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
780        Err(Error::ResponseError(local_var_error))
781    }
782}
783
784/// Convert a user into a bot.  __Minimum server version__: 5.26  ##### Permissions Must have `manage_system` permission. 
785pub async fn convert_user_to_bot(configuration: &configuration::Configuration, user_id: &str) -> Result<crate::models::StatusOk, Error<ConvertUserToBotError>> {
786    let local_var_configuration = configuration;
787
788    let local_var_client = &local_var_configuration.client;
789
790    let local_var_uri_str = format!("{}/users/{user_id}/convert_to_bot", local_var_configuration.base_path, user_id=crate::apis::urlencode(user_id));
791    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
792
793    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
794        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
795    }
796    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
797        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
798    };
799
800    let local_var_req = local_var_req_builder.build()?;
801    let local_var_resp = local_var_client.execute(local_var_req).await?;
802
803    let local_var_status = local_var_resp.status();
804    let local_var_content = local_var_resp.text().await?;
805
806    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
807        serde_json::from_str(&local_var_content).map_err(Error::from)
808    } else {
809        let local_var_entity: Option<ConvertUserToBotError> = serde_json::from_str(&local_var_content).ok();
810        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
811        Err(Error::ResponseError(local_var_error))
812    }
813}
814
815/// Create a new user on the system. Password is required for email login. For other authentication types such as LDAP or SAML, auth_data and auth_service fields are required. ##### Permissions No permission required for creating email/username accounts on an open server. Auth Token is required for other authentication types such as LDAP or SAML. 
816pub async fn create_user(configuration: &configuration::Configuration, create_user_request: crate::models::CreateUserRequest, t: Option<&str>, iid: Option<&str>) -> Result<crate::models::User, Error<CreateUserError>> {
817    let local_var_configuration = configuration;
818
819    let local_var_client = &local_var_configuration.client;
820
821    let local_var_uri_str = format!("{}/users", local_var_configuration.base_path);
822    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
823
824    if let Some(ref local_var_str) = t {
825        local_var_req_builder = local_var_req_builder.query(&[("t", &local_var_str.to_string())]);
826    }
827    if let Some(ref local_var_str) = iid {
828        local_var_req_builder = local_var_req_builder.query(&[("iid", &local_var_str.to_string())]);
829    }
830    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
831        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
832    }
833    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
834        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
835    };
836    local_var_req_builder = local_var_req_builder.json(&create_user_request);
837
838    let local_var_req = local_var_req_builder.build()?;
839    let local_var_resp = local_var_client.execute(local_var_req).await?;
840
841    let local_var_status = local_var_resp.status();
842    let local_var_content = local_var_resp.text().await?;
843
844    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
845        serde_json::from_str(&local_var_content).map_err(Error::from)
846    } else {
847        let local_var_entity: Option<CreateUserError> = serde_json::from_str(&local_var_content).ok();
848        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
849        Err(Error::ResponseError(local_var_error))
850    }
851}
852
853/// Generate a user access token that can be used to authenticate with the Mattermost REST API.  __Minimum server version__: 4.1  ##### Permissions Must have `create_user_access_token` permission. For non-self requests, must also have the `edit_other_users` permission. 
854pub async fn create_user_access_token(configuration: &configuration::Configuration, user_id: &str, create_user_access_token_request: crate::models::CreateUserAccessTokenRequest) -> Result<crate::models::UserAccessToken, Error<CreateUserAccessTokenError>> {
855    let local_var_configuration = configuration;
856
857    let local_var_client = &local_var_configuration.client;
858
859    let local_var_uri_str = format!("{}/users/{user_id}/tokens", local_var_configuration.base_path, user_id=crate::apis::urlencode(user_id));
860    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
861
862    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
863        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
864    }
865    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
866        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
867    };
868    local_var_req_builder = local_var_req_builder.json(&create_user_access_token_request);
869
870    let local_var_req = local_var_req_builder.build()?;
871    let local_var_resp = local_var_client.execute(local_var_req).await?;
872
873    let local_var_status = local_var_resp.status();
874    let local_var_content = local_var_resp.text().await?;
875
876    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
877        serde_json::from_str(&local_var_content).map_err(Error::from)
878    } else {
879        let local_var_entity: Option<CreateUserAccessTokenError> = serde_json::from_str(&local_var_content).ok();
880        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
881        Err(Error::ResponseError(local_var_error))
882    }
883}
884
885/// Deactivates the user and revokes all its sessions by archiving its user object.  As of server version 5.28, optionally use the `permanent=true` query parameter to permanently delete the user for compliance reasons. To use this feature `ServiceSettings.EnableAPIUserDeletion` must be set to `true` in the server's configuration. ##### Permissions Must be logged in as the user being deactivated or have the `edit_other_users` permission. 
886pub async fn delete_user(configuration: &configuration::Configuration, user_id: &str) -> Result<crate::models::StatusOk, Error<DeleteUserError>> {
887    let local_var_configuration = configuration;
888
889    let local_var_client = &local_var_configuration.client;
890
891    let local_var_uri_str = format!("{}/users/{user_id}", local_var_configuration.base_path, user_id=crate::apis::urlencode(user_id));
892    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
893
894    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
895        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
896    }
897    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
898        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
899    };
900
901    let local_var_req = local_var_req_builder.build()?;
902    let local_var_resp = local_var_client.execute(local_var_req).await?;
903
904    let local_var_status = local_var_resp.status();
905    let local_var_content = local_var_resp.text().await?;
906
907    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
908        serde_json::from_str(&local_var_content).map_err(Error::from)
909    } else {
910        let local_var_entity: Option<DeleteUserError> = serde_json::from_str(&local_var_content).ok();
911        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
912        Err(Error::ResponseError(local_var_error))
913    }
914}
915
916/// Convert a regular user into a guest. This will convert the user into a guest for the whole system while retaining their existing team and channel memberships.  __Minimum server version__: 5.16  ##### Permissions Must be logged in as the user or have the `demote_to_guest` permission. 
917pub async fn demote_user_to_guest(configuration: &configuration::Configuration, user_id: &str) -> Result<crate::models::StatusOk, Error<DemoteUserToGuestError>> {
918    let local_var_configuration = configuration;
919
920    let local_var_client = &local_var_configuration.client;
921
922    let local_var_uri_str = format!("{}/users/{user_id}/demote", local_var_configuration.base_path, user_id=crate::apis::urlencode(user_id));
923    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
924
925    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
926        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
927    }
928    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
929        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
930    };
931
932    let local_var_req = local_var_req_builder.build()?;
933    let local_var_resp = local_var_client.execute(local_var_req).await?;
934
935    let local_var_status = local_var_resp.status();
936    let local_var_content = local_var_resp.text().await?;
937
938    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
939        serde_json::from_str(&local_var_content).map_err(Error::from)
940    } else {
941        let local_var_entity: Option<DemoteUserToGuestError> = serde_json::from_str(&local_var_content).ok();
942        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
943        Err(Error::ResponseError(local_var_error))
944    }
945}
946
947/// Disable a personal access token and delete any sessions using the token. The token can be re-enabled using `/users/tokens/enable`.  __Minimum server version__: 4.4  ##### Permissions Must have `revoke_user_access_token` permission. For non-self requests, must also have the `edit_other_users` permission. 
948pub async fn disable_user_access_token(configuration: &configuration::Configuration, disable_user_access_token_request: crate::models::DisableUserAccessTokenRequest) -> Result<crate::models::StatusOk, Error<DisableUserAccessTokenError>> {
949    let local_var_configuration = configuration;
950
951    let local_var_client = &local_var_configuration.client;
952
953    let local_var_uri_str = format!("{}/users/tokens/disable", local_var_configuration.base_path);
954    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, 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 = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
958    }
959    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
960        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
961    };
962    local_var_req_builder = local_var_req_builder.json(&disable_user_access_token_request);
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<DisableUserAccessTokenError> = serde_json::from_str(&local_var_content).ok();
974        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
975        Err(Error::ResponseError(local_var_error))
976    }
977}
978
979/// Re-enable a personal access token that has been disabled.  __Minimum server version__: 4.4  ##### Permissions Must have `create_user_access_token` permission. For non-self requests, must also have the `edit_other_users` permission. 
980pub async fn enable_user_access_token(configuration: &configuration::Configuration, enable_user_access_token_request: crate::models::EnableUserAccessTokenRequest) -> Result<crate::models::StatusOk, Error<EnableUserAccessTokenError>> {
981    let local_var_configuration = configuration;
982
983    let local_var_client = &local_var_configuration.client;
984
985    let local_var_uri_str = format!("{}/users/tokens/enable", local_var_configuration.base_path);
986    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
987
988    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
989        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
990    }
991    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
992        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
993    };
994    local_var_req_builder = local_var_req_builder.json(&enable_user_access_token_request);
995
996    let local_var_req = local_var_req_builder.build()?;
997    let local_var_resp = local_var_client.execute(local_var_req).await?;
998
999    let local_var_status = local_var_resp.status();
1000    let local_var_content = local_var_resp.text().await?;
1001
1002    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1003        serde_json::from_str(&local_var_content).map_err(Error::from)
1004    } else {
1005        let local_var_entity: Option<EnableUserAccessTokenError> = serde_json::from_str(&local_var_content).ok();
1006        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1007        Err(Error::ResponseError(local_var_error))
1008    }
1009}
1010
1011/// Generates an multi-factor authentication secret for a user and returns it as a string and as base64 encoded QR code image. ##### Permissions Must be logged in as the user or have the `edit_other_users` permission. 
1012pub async fn generate_mfa_secret(configuration: &configuration::Configuration, user_id: &str) -> Result<crate::models::GenerateMfaSecret200Response, Error<GenerateMfaSecretError>> {
1013    let local_var_configuration = configuration;
1014
1015    let local_var_client = &local_var_configuration.client;
1016
1017    let local_var_uri_str = format!("{}/users/{user_id}/mfa/generate", local_var_configuration.base_path, user_id=crate::apis::urlencode(user_id));
1018    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1019
1020    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1021        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1022    }
1023    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1024        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1025    };
1026
1027    let local_var_req = local_var_req_builder.build()?;
1028    let local_var_resp = local_var_client.execute(local_var_req).await?;
1029
1030    let local_var_status = local_var_resp.status();
1031    let local_var_content = local_var_resp.text().await?;
1032
1033    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1034        serde_json::from_str(&local_var_content).map_err(Error::from)
1035    } else {
1036        let local_var_entity: Option<GenerateMfaSecretError> = serde_json::from_str(&local_var_content).ok();
1037        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1038        Err(Error::ResponseError(local_var_error))
1039    }
1040}
1041
1042/// Get all channel members from all teams for a user.  __Minimum server version__: 6.2.0  ##### Permissions Logged in as the user, or have `edit_other_users` permission. 
1043pub async fn get_channel_members_with_team_data_for_user(configuration: &configuration::Configuration, user_id: &str, page: Option<i32>, page_size: Option<i32>) -> Result<Vec<crate::models::ChannelMemberWithTeamData>, Error<GetChannelMembersWithTeamDataForUserError>> {
1044    let local_var_configuration = configuration;
1045
1046    let local_var_client = &local_var_configuration.client;
1047
1048    let local_var_uri_str = format!("{}/users/{user_id}/channel_members", local_var_configuration.base_path, user_id=crate::apis::urlencode(user_id));
1049    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1050
1051    if let Some(ref local_var_str) = page {
1052        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1053    }
1054    if let Some(ref local_var_str) = page_size {
1055        local_var_req_builder = local_var_req_builder.query(&[("pageSize", &local_var_str.to_string())]);
1056    }
1057    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1058        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1059    }
1060    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1061        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1062    };
1063
1064    let local_var_req = local_var_req_builder.build()?;
1065    let local_var_resp = local_var_client.execute(local_var_req).await?;
1066
1067    let local_var_status = local_var_resp.status();
1068    let local_var_content = local_var_resp.text().await?;
1069
1070    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1071        serde_json::from_str(&local_var_content).map_err(Error::from)
1072    } else {
1073        let local_var_entity: Option<GetChannelMembersWithTeamDataForUserError> = serde_json::from_str(&local_var_content).ok();
1074        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1075        Err(Error::ResponseError(local_var_error))
1076    }
1077}
1078
1079/// Returns the default (generated) user profile image based on user_id string parameter. ##### Permissions Must be logged in. __Minimum server version__: 5.5 
1080pub async fn get_default_profile_image(configuration: &configuration::Configuration, user_id: &str) -> Result<(), Error<GetDefaultProfileImageError>> {
1081    let local_var_configuration = configuration;
1082
1083    let local_var_client = &local_var_configuration.client;
1084
1085    let local_var_uri_str = format!("{}/users/{user_id}/image/default", local_var_configuration.base_path, user_id=crate::apis::urlencode(user_id));
1086    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1087
1088    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1089        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1090    }
1091    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1092        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1093    };
1094
1095    let local_var_req = local_var_req_builder.build()?;
1096    let local_var_resp = local_var_client.execute(local_var_req).await?;
1097
1098    let local_var_status = local_var_resp.status();
1099    let local_var_content = local_var_resp.text().await?;
1100
1101    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1102        Ok(())
1103    } else {
1104        let local_var_entity: Option<GetDefaultProfileImageError> = serde_json::from_str(&local_var_content).ok();
1105        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1106        Err(Error::ResponseError(local_var_error))
1107    }
1108}
1109
1110/// Get the list of user IDs of users with any direct relationship with a user. That means any user sharing any channel, including direct and group channels. ##### Permissions Must be authenticated.  __Minimum server version__: 5.23 
1111pub async fn get_known_users(configuration: &configuration::Configuration, ) -> Result<crate::models::UsersStats, Error<GetKnownUsersError>> {
1112    let local_var_configuration = configuration;
1113
1114    let local_var_client = &local_var_configuration.client;
1115
1116    let local_var_uri_str = format!("{}/users/known", local_var_configuration.base_path);
1117    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1118
1119    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1120        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1121    }
1122    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1123        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1124    };
1125
1126    let local_var_req = local_var_req_builder.build()?;
1127    let local_var_resp = local_var_client.execute(local_var_req).await?;
1128
1129    let local_var_status = local_var_resp.status();
1130    let local_var_content = local_var_resp.text().await?;
1131
1132    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1133        serde_json::from_str(&local_var_content).map_err(Error::from)
1134    } else {
1135        let local_var_entity: Option<GetKnownUsersError> = serde_json::from_str(&local_var_content).ok();
1136        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1137        Err(Error::ResponseError(local_var_error))
1138    }
1139}
1140
1141/// Get a user's profile image based on user_id string parameter. ##### Permissions Must be logged in. 
1142pub async fn get_profile_image(configuration: &configuration::Configuration, user_id: &str, _: Option<f32>) -> Result<(), Error<GetProfileImageError>> {
1143    let local_var_configuration = configuration;
1144
1145    let local_var_client = &local_var_configuration.client;
1146
1147    let local_var_uri_str = format!("{}/users/{user_id}/image", local_var_configuration.base_path, user_id=crate::apis::urlencode(user_id));
1148    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1149
1150    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1151        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1152    }
1153    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1154        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1155    };
1156
1157    let local_var_req = local_var_req_builder.build()?;
1158    let local_var_resp = local_var_client.execute(local_var_req).await?;
1159
1160    let local_var_status = local_var_resp.status();
1161    let local_var_content = local_var_resp.text().await?;
1162
1163    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1164        Ok(())
1165    } else {
1166        let local_var_entity: Option<GetProfileImageError> = serde_json::from_str(&local_var_content).ok();
1167        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1168        Err(Error::ResponseError(local_var_error))
1169    }
1170}
1171
1172/// Get a list of sessions by providing the user GUID. Sensitive information will be sanitized out. ##### Permissions Must be logged in as the user being updated or have the `edit_other_users` permission. 
1173pub async fn get_sessions(configuration: &configuration::Configuration, user_id: &str) -> Result<Vec<crate::models::Session>, Error<GetSessionsError>> {
1174    let local_var_configuration = configuration;
1175
1176    let local_var_client = &local_var_configuration.client;
1177
1178    let local_var_uri_str = format!("{}/users/{user_id}/sessions", local_var_configuration.base_path, user_id=crate::apis::urlencode(user_id));
1179    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1180
1181    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1182        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1183    }
1184    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1185        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1186    };
1187
1188    let local_var_req = local_var_req_builder.build()?;
1189    let local_var_resp = local_var_client.execute(local_var_req).await?;
1190
1191    let local_var_status = local_var_resp.status();
1192    let local_var_content = local_var_resp.text().await?;
1193
1194    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1195        serde_json::from_str(&local_var_content).map_err(Error::from)
1196    } else {
1197        let local_var_entity: Option<GetSessionsError> = serde_json::from_str(&local_var_content).ok();
1198        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1199        Err(Error::ResponseError(local_var_error))
1200    }
1201}
1202
1203/// Get a total count of users in the system. ##### Permissions Must be authenticated. 
1204pub async fn get_total_users_stats(configuration: &configuration::Configuration, ) -> Result<crate::models::UsersStats, Error<GetTotalUsersStatsError>> {
1205    let local_var_configuration = configuration;
1206
1207    let local_var_client = &local_var_configuration.client;
1208
1209    let local_var_uri_str = format!("{}/users/stats", local_var_configuration.base_path);
1210    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1211
1212    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1213        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1214    }
1215    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1216        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1217    };
1218
1219    let local_var_req = local_var_req_builder.build()?;
1220    let local_var_resp = local_var_client.execute(local_var_req).await?;
1221
1222    let local_var_status = local_var_resp.status();
1223    let local_var_content = local_var_resp.text().await?;
1224
1225    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1226        serde_json::from_str(&local_var_content).map_err(Error::from)
1227    } else {
1228        let local_var_entity: Option<GetTotalUsersStatsError> = serde_json::from_str(&local_var_content).ok();
1229        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1230        Err(Error::ResponseError(local_var_error))
1231    }
1232}
1233
1234/// Get a count of users in the system matching the specified filters.  __Minimum server version__: 5.26  ##### Permissions Must have `manage_system` permission. 
1235pub async fn get_total_users_stats_filtered(configuration: &configuration::Configuration, in_team: Option<&str>, in_channel: Option<&str>, include_deleted: Option<bool>, include_bots: Option<bool>, roles: Option<&str>, channel_roles: Option<&str>, team_roles: Option<&str>) -> Result<crate::models::UsersStats, Error<GetTotalUsersStatsFilteredError>> {
1236    let local_var_configuration = configuration;
1237
1238    let local_var_client = &local_var_configuration.client;
1239
1240    let local_var_uri_str = format!("{}/users/stats/filtered", local_var_configuration.base_path);
1241    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1242
1243    if let Some(ref local_var_str) = in_team {
1244        local_var_req_builder = local_var_req_builder.query(&[("in_team", &local_var_str.to_string())]);
1245    }
1246    if let Some(ref local_var_str) = in_channel {
1247        local_var_req_builder = local_var_req_builder.query(&[("in_channel", &local_var_str.to_string())]);
1248    }
1249    if let Some(ref local_var_str) = include_deleted {
1250        local_var_req_builder = local_var_req_builder.query(&[("include_deleted", &local_var_str.to_string())]);
1251    }
1252    if let Some(ref local_var_str) = include_bots {
1253        local_var_req_builder = local_var_req_builder.query(&[("include_bots", &local_var_str.to_string())]);
1254    }
1255    if let Some(ref local_var_str) = roles {
1256        local_var_req_builder = local_var_req_builder.query(&[("roles", &local_var_str.to_string())]);
1257    }
1258    if let Some(ref local_var_str) = channel_roles {
1259        local_var_req_builder = local_var_req_builder.query(&[("channel_roles", &local_var_str.to_string())]);
1260    }
1261    if let Some(ref local_var_str) = team_roles {
1262        local_var_req_builder = local_var_req_builder.query(&[("team_roles", &local_var_str.to_string())]);
1263    }
1264    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1265        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1266    }
1267    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1268        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1269    };
1270
1271    let local_var_req = local_var_req_builder.build()?;
1272    let local_var_resp = local_var_client.execute(local_var_req).await?;
1273
1274    let local_var_status = local_var_resp.status();
1275    let local_var_content = local_var_resp.text().await?;
1276
1277    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1278        serde_json::from_str(&local_var_content).map_err(Error::from)
1279    } else {
1280        let local_var_entity: Option<GetTotalUsersStatsFilteredError> = serde_json::from_str(&local_var_content).ok();
1281        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1282        Err(Error::ResponseError(local_var_error))
1283    }
1284}
1285
1286/// Gets all the upload sessions belonging to a user.  __Minimum server version__: 5.28  ##### Permissions Must be logged in as the user who created the upload sessions. 
1287pub async fn get_uploads_for_user(configuration: &configuration::Configuration, user_id: &str) -> Result<Vec<crate::models::UploadSession>, Error<GetUploadsForUserError>> {
1288    let local_var_configuration = configuration;
1289
1290    let local_var_client = &local_var_configuration.client;
1291
1292    let local_var_uri_str = format!("{}/users/{user_id}/uploads", local_var_configuration.base_path, user_id=crate::apis::urlencode(user_id));
1293    let mut local_var_req_builder = 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 = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1297    }
1298    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1299        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1300    };
1301
1302    let local_var_req = local_var_req_builder.build()?;
1303    let local_var_resp = local_var_client.execute(local_var_req).await?;
1304
1305    let local_var_status = local_var_resp.status();
1306    let local_var_content = local_var_resp.text().await?;
1307
1308    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1309        serde_json::from_str(&local_var_content).map_err(Error::from)
1310    } else {
1311        let local_var_entity: Option<GetUploadsForUserError> = serde_json::from_str(&local_var_content).ok();
1312        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1313        Err(Error::ResponseError(local_var_error))
1314    }
1315}
1316
1317/// Get a user a object. Sensitive information will be sanitized out. ##### Permissions Requires an active session but no other permissions. 
1318pub async fn get_user(configuration: &configuration::Configuration, user_id: &str) -> Result<crate::models::User, Error<GetUserError>> {
1319    let local_var_configuration = configuration;
1320
1321    let local_var_client = &local_var_configuration.client;
1322
1323    let local_var_uri_str = format!("{}/users/{user_id}", local_var_configuration.base_path, user_id=crate::apis::urlencode(user_id));
1324    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1325
1326    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1327        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1328    }
1329    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1330        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1331    };
1332
1333    let local_var_req = local_var_req_builder.build()?;
1334    let local_var_resp = local_var_client.execute(local_var_req).await?;
1335
1336    let local_var_status = local_var_resp.status();
1337    let local_var_content = local_var_resp.text().await?;
1338
1339    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1340        serde_json::from_str(&local_var_content).map_err(Error::from)
1341    } else {
1342        let local_var_entity: Option<GetUserError> = serde_json::from_str(&local_var_content).ok();
1343        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1344        Err(Error::ResponseError(local_var_error))
1345    }
1346}
1347
1348/// Get a user access token. Does not include the actual authentication token.  __Minimum server version__: 4.1  ##### Permissions Must have `read_user_access_token` permission. For non-self requests, must also have the `edit_other_users` permission. 
1349pub async fn get_user_access_token(configuration: &configuration::Configuration, token_id: &str) -> Result<crate::models::UserAccessTokenSanitized, Error<GetUserAccessTokenError>> {
1350    let local_var_configuration = configuration;
1351
1352    let local_var_client = &local_var_configuration.client;
1353
1354    let local_var_uri_str = format!("{}/users/tokens/{token_id}", local_var_configuration.base_path, token_id=crate::apis::urlencode(token_id));
1355    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1356
1357    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1358        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1359    }
1360    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1361        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1362    };
1363
1364    let local_var_req = local_var_req_builder.build()?;
1365    let local_var_resp = local_var_client.execute(local_var_req).await?;
1366
1367    let local_var_status = local_var_resp.status();
1368    let local_var_content = local_var_resp.text().await?;
1369
1370    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1371        serde_json::from_str(&local_var_content).map_err(Error::from)
1372    } else {
1373        let local_var_entity: Option<GetUserAccessTokenError> = serde_json::from_str(&local_var_content).ok();
1374        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1375        Err(Error::ResponseError(local_var_error))
1376    }
1377}
1378
1379/// Get a page of user access tokens for users on the system. Does not include the actual authentication tokens. Use query parameters for paging.  __Minimum server version__: 4.7  ##### Permissions Must have `manage_system` permission. 
1380pub async fn get_user_access_tokens(configuration: &configuration::Configuration, page: Option<i32>, per_page: Option<i32>) -> Result<Vec<crate::models::UserAccessTokenSanitized>, Error<GetUserAccessTokensError>> {
1381    let local_var_configuration = configuration;
1382
1383    let local_var_client = &local_var_configuration.client;
1384
1385    let local_var_uri_str = format!("{}/users/tokens", local_var_configuration.base_path);
1386    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1387
1388    if let Some(ref local_var_str) = page {
1389        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1390    }
1391    if let Some(ref local_var_str) = per_page {
1392        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
1393    }
1394    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1395        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1396    }
1397    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1398        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1399    };
1400
1401    let local_var_req = local_var_req_builder.build()?;
1402    let local_var_resp = local_var_client.execute(local_var_req).await?;
1403
1404    let local_var_status = local_var_resp.status();
1405    let local_var_content = local_var_resp.text().await?;
1406
1407    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1408        serde_json::from_str(&local_var_content).map_err(Error::from)
1409    } else {
1410        let local_var_entity: Option<GetUserAccessTokensError> = serde_json::from_str(&local_var_content).ok();
1411        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1412        Err(Error::ResponseError(local_var_error))
1413    }
1414}
1415
1416/// Get a list of user access tokens for a user. Does not include the actual authentication tokens. Use query parameters for paging.  __Minimum server version__: 4.1  ##### Permissions Must have `read_user_access_token` permission. For non-self requests, must also have the `edit_other_users` permission. 
1417pub async fn get_user_access_tokens_for_user(configuration: &configuration::Configuration, user_id: &str, page: Option<i32>, per_page: Option<i32>) -> Result<Vec<crate::models::UserAccessTokenSanitized>, Error<GetUserAccessTokensForUserError>> {
1418    let local_var_configuration = configuration;
1419
1420    let local_var_client = &local_var_configuration.client;
1421
1422    let local_var_uri_str = format!("{}/users/{user_id}/tokens", local_var_configuration.base_path, user_id=crate::apis::urlencode(user_id));
1423    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1424
1425    if let Some(ref local_var_str) = page {
1426        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1427    }
1428    if let Some(ref local_var_str) = per_page {
1429        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
1430    }
1431    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1432        local_var_req_builder = 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<GetUserAccessTokensForUserError> = serde_json::from_str(&local_var_content).ok();
1448        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1449        Err(Error::ResponseError(local_var_error))
1450    }
1451}
1452
1453/// Get a list of audit by providing the user GUID. ##### Permissions Must be logged in as the user or have the `edit_other_users` permission. 
1454pub async fn get_user_audits(configuration: &configuration::Configuration, user_id: &str) -> Result<Vec<crate::models::Audit>, Error<GetUserAuditsError>> {
1455    let local_var_configuration = configuration;
1456
1457    let local_var_client = &local_var_configuration.client;
1458
1459    let local_var_uri_str = format!("{}/users/{user_id}/audits", local_var_configuration.base_path, user_id=crate::apis::urlencode(user_id));
1460    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1461
1462    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1463        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1464    }
1465    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1466        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1467    };
1468
1469    let local_var_req = local_var_req_builder.build()?;
1470    let local_var_resp = local_var_client.execute(local_var_req).await?;
1471
1472    let local_var_status = local_var_resp.status();
1473    let local_var_content = local_var_resp.text().await?;
1474
1475    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1476        serde_json::from_str(&local_var_content).map_err(Error::from)
1477    } else {
1478        let local_var_entity: Option<GetUserAuditsError> = serde_json::from_str(&local_var_content).ok();
1479        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1480        Err(Error::ResponseError(local_var_error))
1481    }
1482}
1483
1484/// Get a user object by providing a user email. Sensitive information will be sanitized out. ##### Permissions Requires an active session and for the current session to be able to view another user's email based on the server's privacy settings. 
1485pub async fn get_user_by_email(configuration: &configuration::Configuration, email: &str) -> Result<crate::models::User, Error<GetUserByEmailError>> {
1486    let local_var_configuration = configuration;
1487
1488    let local_var_client = &local_var_configuration.client;
1489
1490    let local_var_uri_str = format!("{}/users/email/{email}", local_var_configuration.base_path, email=crate::apis::urlencode(email));
1491    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1492
1493    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1494        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1495    }
1496    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1497        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1498    };
1499
1500    let local_var_req = local_var_req_builder.build()?;
1501    let local_var_resp = local_var_client.execute(local_var_req).await?;
1502
1503    let local_var_status = local_var_resp.status();
1504    let local_var_content = local_var_resp.text().await?;
1505
1506    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1507        serde_json::from_str(&local_var_content).map_err(Error::from)
1508    } else {
1509        let local_var_entity: Option<GetUserByEmailError> = serde_json::from_str(&local_var_content).ok();
1510        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1511        Err(Error::ResponseError(local_var_error))
1512    }
1513}
1514
1515/// Get a user object by providing a username. Sensitive information will be sanitized out. ##### Permissions Requires an active session but no other permissions. 
1516pub async fn get_user_by_username(configuration: &configuration::Configuration, username: &str) -> Result<crate::models::User, Error<GetUserByUsernameError>> {
1517    let local_var_configuration = configuration;
1518
1519    let local_var_client = &local_var_configuration.client;
1520
1521    let local_var_uri_str = format!("{}/users/username/{username}", local_var_configuration.base_path, username=crate::apis::urlencode(username));
1522    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1523
1524    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1525        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1526    }
1527    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1528        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1529    };
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<GetUserByUsernameError> = serde_json::from_str(&local_var_content).ok();
1541        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1542        Err(Error::ResponseError(local_var_error))
1543    }
1544}
1545
1546/// Will be deprecated in v6.0 Fetches user's latest terms of service action if the latest action was for acceptance.  __Minimum server version__: 5.6 ##### Permissions Must be logged in as the user being acted on. 
1547pub async fn get_user_terms_of_service(configuration: &configuration::Configuration, user_id: &str) -> Result<crate::models::UserTermsOfService, Error<GetUserTermsOfServiceError>> {
1548    let local_var_configuration = configuration;
1549
1550    let local_var_client = &local_var_configuration.client;
1551
1552    let local_var_uri_str = format!("{}/users/{user_id}/terms_of_service", local_var_configuration.base_path, user_id=crate::apis::urlencode(user_id));
1553    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1554
1555    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1556        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1557    }
1558    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1559        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1560    };
1561
1562    let local_var_req = local_var_req_builder.build()?;
1563    let local_var_resp = local_var_client.execute(local_var_req).await?;
1564
1565    let local_var_status = local_var_resp.status();
1566    let local_var_content = local_var_resp.text().await?;
1567
1568    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1569        serde_json::from_str(&local_var_content).map_err(Error::from)
1570    } else {
1571        let local_var_entity: Option<GetUserTermsOfServiceError> = serde_json::from_str(&local_var_content).ok();
1572        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1573        Err(Error::ResponseError(local_var_error))
1574    }
1575}
1576
1577/// Get a page of a list of users. Based on query string parameters, select users from a team, channel, or select users not in a specific channel.  Since server version 4.0, some basic sorting is available using the `sort` query parameter. Sorting is currently only supported when selecting users on a team. ##### Permissions Requires an active session and (if specified) membership to the channel or team being selected from. 
1578pub async fn get_users(configuration: &configuration::Configuration, page: Option<i32>, per_page: Option<i32>, in_team: Option<&str>, not_in_team: Option<&str>, in_channel: Option<&str>, not_in_channel: Option<&str>, in_group: Option<&str>, group_constrained: Option<bool>, without_team: Option<bool>, active: Option<bool>, inactive: Option<bool>, role: Option<&str>, sort: Option<&str>, roles: Option<&str>, channel_roles: Option<&str>, team_roles: Option<&str>) -> Result<Vec<crate::models::User>, Error<GetUsersError>> {
1579    let local_var_configuration = configuration;
1580
1581    let local_var_client = &local_var_configuration.client;
1582
1583    let local_var_uri_str = format!("{}/users", local_var_configuration.base_path);
1584    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1585
1586    if let Some(ref local_var_str) = page {
1587        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1588    }
1589    if let Some(ref local_var_str) = per_page {
1590        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
1591    }
1592    if let Some(ref local_var_str) = in_team {
1593        local_var_req_builder = local_var_req_builder.query(&[("in_team", &local_var_str.to_string())]);
1594    }
1595    if let Some(ref local_var_str) = not_in_team {
1596        local_var_req_builder = local_var_req_builder.query(&[("not_in_team", &local_var_str.to_string())]);
1597    }
1598    if let Some(ref local_var_str) = in_channel {
1599        local_var_req_builder = local_var_req_builder.query(&[("in_channel", &local_var_str.to_string())]);
1600    }
1601    if let Some(ref local_var_str) = not_in_channel {
1602        local_var_req_builder = local_var_req_builder.query(&[("not_in_channel", &local_var_str.to_string())]);
1603    }
1604    if let Some(ref local_var_str) = in_group {
1605        local_var_req_builder = local_var_req_builder.query(&[("in_group", &local_var_str.to_string())]);
1606    }
1607    if let Some(ref local_var_str) = group_constrained {
1608        local_var_req_builder = local_var_req_builder.query(&[("group_constrained", &local_var_str.to_string())]);
1609    }
1610    if let Some(ref local_var_str) = without_team {
1611        local_var_req_builder = local_var_req_builder.query(&[("without_team", &local_var_str.to_string())]);
1612    }
1613    if let Some(ref local_var_str) = active {
1614        local_var_req_builder = local_var_req_builder.query(&[("active", &local_var_str.to_string())]);
1615    }
1616    if let Some(ref local_var_str) = inactive {
1617        local_var_req_builder = local_var_req_builder.query(&[("inactive", &local_var_str.to_string())]);
1618    }
1619    if let Some(ref local_var_str) = role {
1620        local_var_req_builder = local_var_req_builder.query(&[("role", &local_var_str.to_string())]);
1621    }
1622    if let Some(ref local_var_str) = sort {
1623        local_var_req_builder = local_var_req_builder.query(&[("sort", &local_var_str.to_string())]);
1624    }
1625    if let Some(ref local_var_str) = roles {
1626        local_var_req_builder = local_var_req_builder.query(&[("roles", &local_var_str.to_string())]);
1627    }
1628    if let Some(ref local_var_str) = channel_roles {
1629        local_var_req_builder = local_var_req_builder.query(&[("channel_roles", &local_var_str.to_string())]);
1630    }
1631    if let Some(ref local_var_str) = team_roles {
1632        local_var_req_builder = local_var_req_builder.query(&[("team_roles", &local_var_str.to_string())]);
1633    }
1634    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1635        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1636    }
1637    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1638        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1639    };
1640
1641    let local_var_req = local_var_req_builder.build()?;
1642    let local_var_resp = local_var_client.execute(local_var_req).await?;
1643
1644    let local_var_status = local_var_resp.status();
1645    let local_var_content = local_var_resp.text().await?;
1646
1647    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1648        serde_json::from_str(&local_var_content).map_err(Error::from)
1649    } else {
1650        let local_var_entity: Option<GetUsersError> = serde_json::from_str(&local_var_content).ok();
1651        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1652        Err(Error::ResponseError(local_var_error))
1653    }
1654}
1655
1656/// Get an object containing a key per group channel id in the query and its value as a list of users members of that group channel.  The user must be a member of the group ids in the query, or they will be omitted from the response. ##### Permissions Requires an active session but no other permissions.  __Minimum server version__: 5.14 
1657pub async fn get_users_by_group_channel_ids(configuration: &configuration::Configuration, request_body: Vec<String>) -> Result<crate::models::GetUsersByGroupChannelIds200Response, Error<GetUsersByGroupChannelIdsError>> {
1658    let local_var_configuration = configuration;
1659
1660    let local_var_client = &local_var_configuration.client;
1661
1662    let local_var_uri_str = format!("{}/users/group_channels", local_var_configuration.base_path);
1663    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1664
1665    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1666        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1667    }
1668    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1669        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1670    };
1671    local_var_req_builder = local_var_req_builder.json(&request_body);
1672
1673    let local_var_req = local_var_req_builder.build()?;
1674    let local_var_resp = local_var_client.execute(local_var_req).await?;
1675
1676    let local_var_status = local_var_resp.status();
1677    let local_var_content = local_var_resp.text().await?;
1678
1679    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1680        serde_json::from_str(&local_var_content).map_err(Error::from)
1681    } else {
1682        let local_var_entity: Option<GetUsersByGroupChannelIdsError> = serde_json::from_str(&local_var_content).ok();
1683        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1684        Err(Error::ResponseError(local_var_error))
1685    }
1686}
1687
1688/// Get a list of users based on a provided list of user ids. ##### Permissions Requires an active session but no other permissions. 
1689pub async fn get_users_by_ids(configuration: &configuration::Configuration, request_body: Vec<String>, since: Option<i32>) -> Result<Vec<crate::models::User>, Error<GetUsersByIdsError>> {
1690    let local_var_configuration = configuration;
1691
1692    let local_var_client = &local_var_configuration.client;
1693
1694    let local_var_uri_str = format!("{}/users/ids", local_var_configuration.base_path);
1695    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1696
1697    if let Some(ref local_var_str) = since {
1698        local_var_req_builder = local_var_req_builder.query(&[("since", &local_var_str.to_string())]);
1699    }
1700    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1701        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1702    }
1703    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1704        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1705    };
1706    local_var_req_builder = local_var_req_builder.json(&request_body);
1707
1708    let local_var_req = local_var_req_builder.build()?;
1709    let local_var_resp = local_var_client.execute(local_var_req).await?;
1710
1711    let local_var_status = local_var_resp.status();
1712    let local_var_content = local_var_resp.text().await?;
1713
1714    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1715        serde_json::from_str(&local_var_content).map_err(Error::from)
1716    } else {
1717        let local_var_entity: Option<GetUsersByIdsError> = serde_json::from_str(&local_var_content).ok();
1718        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1719        Err(Error::ResponseError(local_var_error))
1720    }
1721}
1722
1723/// Get a list of users based on a provided list of usernames. ##### Permissions Requires an active session but no other permissions. 
1724pub async fn get_users_by_usernames(configuration: &configuration::Configuration, request_body: Vec<String>) -> Result<Vec<crate::models::User>, Error<GetUsersByUsernamesError>> {
1725    let local_var_configuration = configuration;
1726
1727    let local_var_client = &local_var_configuration.client;
1728
1729    let local_var_uri_str = format!("{}/users/usernames", local_var_configuration.base_path);
1730    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1731
1732    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1733        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1734    }
1735    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1736        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1737    };
1738    local_var_req_builder = local_var_req_builder.json(&request_body);
1739
1740    let local_var_req = local_var_req_builder.build()?;
1741    let local_var_resp = local_var_client.execute(local_var_req).await?;
1742
1743    let local_var_status = local_var_resp.status();
1744    let local_var_content = local_var_resp.text().await?;
1745
1746    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1747        serde_json::from_str(&local_var_content).map_err(Error::from)
1748    } else {
1749        let local_var_entity: Option<GetUsersByUsernamesError> = serde_json::from_str(&local_var_content).ok();
1750        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1751        Err(Error::ResponseError(local_var_error))
1752    }
1753}
1754
1755/// ##### Permissions No permission required 
1756pub async fn login(configuration: &configuration::Configuration, login_request: crate::models::LoginRequest) -> Result<crate::models::User, Error<LoginError>> {
1757    let local_var_configuration = configuration;
1758
1759    let local_var_client = &local_var_configuration.client;
1760
1761    let local_var_uri_str = format!("{}/users/login", local_var_configuration.base_path);
1762    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1763
1764    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1765        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1766    }
1767    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1768        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1769    };
1770    local_var_req_builder = local_var_req_builder.json(&login_request);
1771
1772    let local_var_req = local_var_req_builder.build()?;
1773    let local_var_resp = local_var_client.execute(local_var_req).await?;
1774
1775    let local_var_status = local_var_resp.status();
1776    let local_var_content = local_var_resp.text().await?;
1777
1778    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1779        serde_json::from_str(&local_var_content).map_err(Error::from)
1780    } else {
1781        let local_var_entity: Option<LoginError> = serde_json::from_str(&local_var_content).ok();
1782        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1783        Err(Error::ResponseError(local_var_error))
1784    }
1785}
1786
1787/// CWS stands for Customer Web Server which is the cloud service used to manage cloud instances. ##### Permissions A Cloud license is required 
1788pub async fn login_by_cws_token(configuration: &configuration::Configuration, login_by_cws_token_request: crate::models::LoginByCwsTokenRequest) -> Result<(), Error<LoginByCwsTokenError>> {
1789    let local_var_configuration = configuration;
1790
1791    let local_var_client = &local_var_configuration.client;
1792
1793    let local_var_uri_str = format!("{}/users/login/cws", local_var_configuration.base_path);
1794    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1795
1796    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1797        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1798    }
1799    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1800        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1801    };
1802    local_var_req_builder = local_var_req_builder.json(&login_by_cws_token_request);
1803
1804    let local_var_req = local_var_req_builder.build()?;
1805    let local_var_resp = local_var_client.execute(local_var_req).await?;
1806
1807    let local_var_status = local_var_resp.status();
1808    let local_var_content = local_var_resp.text().await?;
1809
1810    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1811        Ok(())
1812    } else {
1813        let local_var_entity: Option<LoginByCwsTokenError> = serde_json::from_str(&local_var_content).ok();
1814        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1815        Err(Error::ResponseError(local_var_error))
1816    }
1817}
1818
1819/// ##### Permissions An active session is required 
1820pub async fn logout(configuration: &configuration::Configuration, ) -> Result<crate::models::StatusOk, Error<LogoutError>> {
1821    let local_var_configuration = configuration;
1822
1823    let local_var_client = &local_var_configuration.client;
1824
1825    let local_var_uri_str = format!("{}/users/logout", local_var_configuration.base_path);
1826    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1827
1828    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1829        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1830    }
1831    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1832        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1833    };
1834
1835    let local_var_req = local_var_req_builder.build()?;
1836    let local_var_resp = local_var_client.execute(local_var_req).await?;
1837
1838    let local_var_status = local_var_resp.status();
1839    let local_var_content = local_var_resp.text().await?;
1840
1841    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1842        serde_json::from_str(&local_var_content).map_err(Error::from)
1843    } else {
1844        let local_var_entity: Option<LogoutError> = serde_json::from_str(&local_var_content).ok();
1845        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1846        Err(Error::ResponseError(local_var_error))
1847    }
1848}
1849
1850/// Migrates accounts from one authentication provider to another. For example, you can upgrade your authentication provider from email to LDAP. __Minimum server version__: 5.28 ##### Permissions Must have `manage_system` permission. 
1851pub async fn migrate_auth_to_ldap(configuration: &configuration::Configuration, migrate_auth_to_ldap_request: Option<crate::models::MigrateAuthToLdapRequest>) -> Result<(), Error<MigrateAuthToLdapError>> {
1852    let local_var_configuration = configuration;
1853
1854    let local_var_client = &local_var_configuration.client;
1855
1856    let local_var_uri_str = format!("{}/users/migrate_auth/ldap", local_var_configuration.base_path);
1857    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1858
1859    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1860        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1861    }
1862    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1863        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1864    };
1865    local_var_req_builder = local_var_req_builder.json(&migrate_auth_to_ldap_request);
1866
1867    let local_var_req = local_var_req_builder.build()?;
1868    let local_var_resp = local_var_client.execute(local_var_req).await?;
1869
1870    let local_var_status = local_var_resp.status();
1871    let local_var_content = local_var_resp.text().await?;
1872
1873    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1874        Ok(())
1875    } else {
1876        let local_var_entity: Option<MigrateAuthToLdapError> = serde_json::from_str(&local_var_content).ok();
1877        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1878        Err(Error::ResponseError(local_var_error))
1879    }
1880}
1881
1882/// Migrates accounts from one authentication provider to another. For example, you can upgrade your authentication provider from email to SAML. __Minimum server version__: 5.28 ##### Permissions Must have `manage_system` permission. 
1883pub async fn migrate_auth_to_saml(configuration: &configuration::Configuration, migrate_auth_to_saml_request: Option<crate::models::MigrateAuthToSamlRequest>) -> Result<(), Error<MigrateAuthToSamlError>> {
1884    let local_var_configuration = configuration;
1885
1886    let local_var_client = &local_var_configuration.client;
1887
1888    let local_var_uri_str = format!("{}/users/migrate_auth/saml", local_var_configuration.base_path);
1889    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1890
1891    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1892        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1893    }
1894    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1895        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1896    };
1897    local_var_req_builder = local_var_req_builder.json(&migrate_auth_to_saml_request);
1898
1899    let local_var_req = local_var_req_builder.build()?;
1900    let local_var_resp = local_var_client.execute(local_var_req).await?;
1901
1902    let local_var_status = local_var_resp.status();
1903    let local_var_content = local_var_resp.text().await?;
1904
1905    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1906        Ok(())
1907    } else {
1908        let local_var_entity: Option<MigrateAuthToSamlError> = serde_json::from_str(&local_var_content).ok();
1909        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1910        Err(Error::ResponseError(local_var_error))
1911    }
1912}
1913
1914/// Partially update a user by providing only the fields you want to update. Omitted fields will not be updated. The fields that can be updated are defined in the request body, all other provided fields will be ignored. ##### Permissions Must be logged in as the user being updated or have the `edit_other_users` permission. 
1915pub async fn patch_user(configuration: &configuration::Configuration, user_id: &str, patch_user_request: crate::models::PatchUserRequest) -> Result<crate::models::User, Error<PatchUserError>> {
1916    let local_var_configuration = configuration;
1917
1918    let local_var_client = &local_var_configuration.client;
1919
1920    let local_var_uri_str = format!("{}/users/{user_id}/patch", local_var_configuration.base_path, user_id=crate::apis::urlencode(user_id));
1921    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
1922
1923    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1924        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1925    }
1926    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1927        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1928    };
1929    local_var_req_builder = local_var_req_builder.json(&patch_user_request);
1930
1931    let local_var_req = local_var_req_builder.build()?;
1932    let local_var_resp = local_var_client.execute(local_var_req).await?;
1933
1934    let local_var_status = local_var_resp.status();
1935    let local_var_content = local_var_resp.text().await?;
1936
1937    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1938        serde_json::from_str(&local_var_content).map_err(Error::from)
1939    } else {
1940        let local_var_entity: Option<PatchUserError> = serde_json::from_str(&local_var_content).ok();
1941        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1942        Err(Error::ResponseError(local_var_error))
1943    }
1944}
1945
1946/// Permanently deletes all users and all their related information, including posts.  __Minimum server version__: 5.26.0  __Local mode only__: This endpoint is only available through [local mode](https://docs.mattermost.com/administration/mmctl-cli-tool.html#local-mode). 
1947pub async fn permanent_delete_all_users(configuration: &configuration::Configuration, ) -> Result<(), Error<PermanentDeleteAllUsersError>> {
1948    let local_var_configuration = configuration;
1949
1950    let local_var_client = &local_var_configuration.client;
1951
1952    let local_var_uri_str = format!("{}/users", local_var_configuration.base_path);
1953    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
1954
1955    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1956        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1957    }
1958    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1959        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1960    };
1961
1962    let local_var_req = local_var_req_builder.build()?;
1963    let local_var_resp = local_var_client.execute(local_var_req).await?;
1964
1965    let local_var_status = local_var_resp.status();
1966    let local_var_content = local_var_resp.text().await?;
1967
1968    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1969        Ok(())
1970    } else {
1971        let local_var_entity: Option<PermanentDeleteAllUsersError> = serde_json::from_str(&local_var_content).ok();
1972        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1973        Err(Error::ResponseError(local_var_error))
1974    }
1975}
1976
1977/// Convert a guest into a regular user. This will convert the guest into a user for the whole system while retaining any team and channel memberships and automatically joining them to the default channels.  __Minimum server version__: 5.16  ##### Permissions Must be logged in as the user or have the `promote_guest` permission. 
1978pub async fn promote_guest_to_user(configuration: &configuration::Configuration, user_id: &str) -> Result<crate::models::StatusOk, Error<PromoteGuestToUserError>> {
1979    let local_var_configuration = configuration;
1980
1981    let local_var_client = &local_var_configuration.client;
1982
1983    let local_var_uri_str = format!("{}/users/{user_id}/promote", local_var_configuration.base_path, user_id=crate::apis::urlencode(user_id));
1984    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1985
1986    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1987        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1988    }
1989    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1990        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1991    };
1992
1993    let local_var_req = local_var_req_builder.build()?;
1994    let local_var_resp = local_var_client.execute(local_var_req).await?;
1995
1996    let local_var_status = local_var_resp.status();
1997    let local_var_content = local_var_resp.text().await?;
1998
1999    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2000        serde_json::from_str(&local_var_content).map_err(Error::from)
2001    } else {
2002        let local_var_entity: Option<PromoteGuestToUserError> = serde_json::from_str(&local_var_content).ok();
2003        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2004        Err(Error::ResponseError(local_var_error))
2005    }
2006}
2007
2008/// Notify users in the given channel via websocket that the given user is typing. __Minimum server version__: 5.26 ##### Permissions Must have `manage_system` permission to publish for any user other than oneself. 
2009pub async fn publish_user_typing(configuration: &configuration::Configuration, user_id: &str, publish_user_typing_request: Option<crate::models::PublishUserTypingRequest>) -> Result<(), Error<PublishUserTypingError>> {
2010    let local_var_configuration = configuration;
2011
2012    let local_var_client = &local_var_configuration.client;
2013
2014    let local_var_uri_str = format!("{}/users/{user_id}/typing", local_var_configuration.base_path, user_id=crate::apis::urlencode(user_id));
2015    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2016
2017    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2018        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2019    }
2020    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2021        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2022    };
2023    local_var_req_builder = local_var_req_builder.json(&publish_user_typing_request);
2024
2025    let local_var_req = local_var_req_builder.build()?;
2026    let local_var_resp = local_var_client.execute(local_var_req).await?;
2027
2028    let local_var_status = local_var_resp.status();
2029    let local_var_content = local_var_resp.text().await?;
2030
2031    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2032        Ok(())
2033    } else {
2034        let local_var_entity: Option<PublishUserTypingError> = serde_json::from_str(&local_var_content).ok();
2035        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2036        Err(Error::ResponseError(local_var_error))
2037    }
2038}
2039
2040/// Records user action when they accept or decline custom terms of service. Records the action in audit table. Updates user's last accepted terms of service ID if they accepted it.  __Minimum server version__: 5.4 ##### Permissions Must be logged in as the user being acted on. 
2041pub async fn register_terms_of_service_action(configuration: &configuration::Configuration, user_id: &str, register_terms_of_service_action_request: crate::models::RegisterTermsOfServiceActionRequest) -> Result<crate::models::StatusOk, Error<RegisterTermsOfServiceActionError>> {
2042    let local_var_configuration = configuration;
2043
2044    let local_var_client = &local_var_configuration.client;
2045
2046    let local_var_uri_str = format!("{}/users/{user_id}/terms_of_service", local_var_configuration.base_path, user_id=crate::apis::urlencode(user_id));
2047    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2048
2049    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2050        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2051    }
2052    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2053        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2054    };
2055    local_var_req_builder = local_var_req_builder.json(&register_terms_of_service_action_request);
2056
2057    let local_var_req = local_var_req_builder.build()?;
2058    let local_var_resp = local_var_client.execute(local_var_req).await?;
2059
2060    let local_var_status = local_var_resp.status();
2061    let local_var_content = local_var_resp.text().await?;
2062
2063    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2064        serde_json::from_str(&local_var_content).map_err(Error::from)
2065    } else {
2066        let local_var_entity: Option<RegisterTermsOfServiceActionError> = serde_json::from_str(&local_var_content).ok();
2067        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2068        Err(Error::ResponseError(local_var_error))
2069    }
2070}
2071
2072/// Update the password for a user using a one-use, timed recovery code tied to the user's account. Only works for non-SSO users. ##### Permissions No permissions required. 
2073pub async fn reset_password(configuration: &configuration::Configuration, reset_password_request: crate::models::ResetPasswordRequest) -> Result<crate::models::StatusOk, Error<ResetPasswordError>> {
2074    let local_var_configuration = configuration;
2075
2076    let local_var_client = &local_var_configuration.client;
2077
2078    let local_var_uri_str = format!("{}/users/password/reset", local_var_configuration.base_path);
2079    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2080
2081    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2082        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2083    }
2084    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2085        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2086    };
2087    local_var_req_builder = local_var_req_builder.json(&reset_password_request);
2088
2089    let local_var_req = local_var_req_builder.build()?;
2090    let local_var_resp = local_var_client.execute(local_var_req).await?;
2091
2092    let local_var_status = local_var_resp.status();
2093    let local_var_content = local_var_resp.text().await?;
2094
2095    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2096        serde_json::from_str(&local_var_content).map_err(Error::from)
2097    } else {
2098        let local_var_entity: Option<ResetPasswordError> = serde_json::from_str(&local_var_content).ok();
2099        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2100        Err(Error::ResponseError(local_var_error))
2101    }
2102}
2103
2104/// Revokes all user sessions from the provided user id and session id strings. ##### Permissions Must be logged in as the user being updated or have the `edit_other_users` permission. __Minimum server version__: 4.4 
2105pub async fn revoke_all_sessions(configuration: &configuration::Configuration, user_id: &str) -> Result<crate::models::StatusOk, Error<RevokeAllSessionsError>> {
2106    let local_var_configuration = configuration;
2107
2108    let local_var_client = &local_var_configuration.client;
2109
2110    let local_var_uri_str = format!("{}/users/{user_id}/sessions/revoke/all", local_var_configuration.base_path, user_id=crate::apis::urlencode(user_id));
2111    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2112
2113    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2114        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2115    }
2116    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2117        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2118    };
2119
2120    let local_var_req = local_var_req_builder.build()?;
2121    let local_var_resp = local_var_client.execute(local_var_req).await?;
2122
2123    let local_var_status = local_var_resp.status();
2124    let local_var_content = local_var_resp.text().await?;
2125
2126    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2127        serde_json::from_str(&local_var_content).map_err(Error::from)
2128    } else {
2129        let local_var_entity: Option<RevokeAllSessionsError> = serde_json::from_str(&local_var_content).ok();
2130        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2131        Err(Error::ResponseError(local_var_error))
2132    }
2133}
2134
2135/// Revokes a user session from the provided user id and session id strings. ##### Permissions Must be logged in as the user being updated or have the `edit_other_users` permission. 
2136pub async fn revoke_session(configuration: &configuration::Configuration, user_id: &str, revoke_session_request: crate::models::RevokeSessionRequest) -> Result<crate::models::StatusOk, Error<RevokeSessionError>> {
2137    let local_var_configuration = configuration;
2138
2139    let local_var_client = &local_var_configuration.client;
2140
2141    let local_var_uri_str = format!("{}/users/{user_id}/sessions/revoke", local_var_configuration.base_path, user_id=crate::apis::urlencode(user_id));
2142    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2143
2144    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2145        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2146    }
2147    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2148        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2149    };
2150    local_var_req_builder = local_var_req_builder.json(&revoke_session_request);
2151
2152    let local_var_req = local_var_req_builder.build()?;
2153    let local_var_resp = local_var_client.execute(local_var_req).await?;
2154
2155    let local_var_status = local_var_resp.status();
2156    let local_var_content = local_var_resp.text().await?;
2157
2158    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2159        serde_json::from_str(&local_var_content).map_err(Error::from)
2160    } else {
2161        let local_var_entity: Option<RevokeSessionError> = serde_json::from_str(&local_var_content).ok();
2162        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2163        Err(Error::ResponseError(local_var_error))
2164    }
2165}
2166
2167/// For any session currently on the server (including admin) it will be revoked. Clients will be notified to log out users.  __Minimum server version__: 5.14  ##### Permissions Must have `manage_system` permission. 
2168pub async fn revoke_sessions_from_all_users(configuration: &configuration::Configuration, ) -> Result<(), Error<RevokeSessionsFromAllUsersError>> {
2169    let local_var_configuration = configuration;
2170
2171    let local_var_client = &local_var_configuration.client;
2172
2173    let local_var_uri_str = format!("{}/users/sessions/revoke/all", local_var_configuration.base_path);
2174    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2175
2176    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2177        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2178    }
2179    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2180        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2181    };
2182
2183    let local_var_req = local_var_req_builder.build()?;
2184    let local_var_resp = local_var_client.execute(local_var_req).await?;
2185
2186    let local_var_status = local_var_resp.status();
2187    let local_var_content = local_var_resp.text().await?;
2188
2189    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2190        Ok(())
2191    } else {
2192        let local_var_entity: Option<RevokeSessionsFromAllUsersError> = serde_json::from_str(&local_var_content).ok();
2193        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2194        Err(Error::ResponseError(local_var_error))
2195    }
2196}
2197
2198/// Revoke a user access token and delete any sessions using the token.  __Minimum server version__: 4.1  ##### Permissions Must have `revoke_user_access_token` permission. For non-self requests, must also have the `edit_other_users` permission. 
2199pub async fn revoke_user_access_token(configuration: &configuration::Configuration, revoke_user_access_token_request: crate::models::RevokeUserAccessTokenRequest) -> Result<crate::models::StatusOk, Error<RevokeUserAccessTokenError>> {
2200    let local_var_configuration = configuration;
2201
2202    let local_var_client = &local_var_configuration.client;
2203
2204    let local_var_uri_str = format!("{}/users/tokens/revoke", local_var_configuration.base_path);
2205    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2206
2207    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2208        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2209    }
2210    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2211        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2212    };
2213    local_var_req_builder = local_var_req_builder.json(&revoke_user_access_token_request);
2214
2215    let local_var_req = local_var_req_builder.build()?;
2216    let local_var_resp = local_var_client.execute(local_var_req).await?;
2217
2218    let local_var_status = local_var_resp.status();
2219    let local_var_content = local_var_resp.text().await?;
2220
2221    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2222        serde_json::from_str(&local_var_content).map_err(Error::from)
2223    } else {
2224        let local_var_entity: Option<RevokeUserAccessTokenError> = serde_json::from_str(&local_var_content).ok();
2225        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2226        Err(Error::ResponseError(local_var_error))
2227    }
2228}
2229
2230/// Get a list of tokens based on search criteria provided in the request body. Searches are done against the token id, user id and username.  __Minimum server version__: 4.7  ##### Permissions Must have `manage_system` permission. 
2231pub async fn search_user_access_tokens(configuration: &configuration::Configuration, search_user_access_tokens_request: crate::models::SearchUserAccessTokensRequest) -> Result<Vec<crate::models::UserAccessTokenSanitized>, Error<SearchUserAccessTokensError>> {
2232    let local_var_configuration = configuration;
2233
2234    let local_var_client = &local_var_configuration.client;
2235
2236    let local_var_uri_str = format!("{}/users/tokens/search", local_var_configuration.base_path);
2237    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2238
2239    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2240        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2241    }
2242    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2243        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2244    };
2245    local_var_req_builder = local_var_req_builder.json(&search_user_access_tokens_request);
2246
2247    let local_var_req = local_var_req_builder.build()?;
2248    let local_var_resp = local_var_client.execute(local_var_req).await?;
2249
2250    let local_var_status = local_var_resp.status();
2251    let local_var_content = local_var_resp.text().await?;
2252
2253    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2254        serde_json::from_str(&local_var_content).map_err(Error::from)
2255    } else {
2256        let local_var_entity: Option<SearchUserAccessTokensError> = serde_json::from_str(&local_var_content).ok();
2257        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2258        Err(Error::ResponseError(local_var_error))
2259    }
2260}
2261
2262/// Get a list of users based on search criteria provided in the request body. Searches are typically done against username, full name, nickname and email unless otherwise configured by the server. ##### Permissions Requires an active session and `read_channel` and/or `view_team` permissions for any channels or teams specified in the request body. 
2263pub async fn search_users(configuration: &configuration::Configuration, search_users_request: crate::models::SearchUsersRequest) -> Result<Vec<crate::models::User>, Error<SearchUsersError>> {
2264    let local_var_configuration = configuration;
2265
2266    let local_var_client = &local_var_configuration.client;
2267
2268    let local_var_uri_str = format!("{}/users/search", local_var_configuration.base_path);
2269    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2270
2271    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2272        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2273    }
2274    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2275        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2276    };
2277    local_var_req_builder = local_var_req_builder.json(&search_users_request);
2278
2279    let local_var_req = local_var_req_builder.build()?;
2280    let local_var_resp = local_var_client.execute(local_var_req).await?;
2281
2282    let local_var_status = local_var_resp.status();
2283    let local_var_content = local_var_resp.text().await?;
2284
2285    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2286        serde_json::from_str(&local_var_content).map_err(Error::from)
2287    } else {
2288        let local_var_entity: Option<SearchUsersError> = serde_json::from_str(&local_var_content).ok();
2289        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2290        Err(Error::ResponseError(local_var_error))
2291    }
2292}
2293
2294/// Send an email containing a link for resetting the user's password. The link will contain a one-use, timed recovery code tied to the user's account. Only works for non-SSO users. ##### Permissions No permissions required. 
2295pub async fn send_password_reset_email(configuration: &configuration::Configuration, send_password_reset_email_request: crate::models::SendPasswordResetEmailRequest) -> Result<crate::models::StatusOk, Error<SendPasswordResetEmailError>> {
2296    let local_var_configuration = configuration;
2297
2298    let local_var_client = &local_var_configuration.client;
2299
2300    let local_var_uri_str = format!("{}/users/password/reset/send", local_var_configuration.base_path);
2301    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2302
2303    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2304        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2305    }
2306    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2307        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2308    };
2309    local_var_req_builder = local_var_req_builder.json(&send_password_reset_email_request);
2310
2311    let local_var_req = local_var_req_builder.build()?;
2312    let local_var_resp = local_var_client.execute(local_var_req).await?;
2313
2314    let local_var_status = local_var_resp.status();
2315    let local_var_content = local_var_resp.text().await?;
2316
2317    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2318        serde_json::from_str(&local_var_content).map_err(Error::from)
2319    } else {
2320        let local_var_entity: Option<SendPasswordResetEmailError> = serde_json::from_str(&local_var_content).ok();
2321        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2322        Err(Error::ResponseError(local_var_error))
2323    }
2324}
2325
2326/// Send an email with a verification link to a user that has an email matching the one in the request body. This endpoint will return success even if the email does not match any users on the system. ##### Permissions No permissions required. 
2327pub async fn send_verification_email(configuration: &configuration::Configuration, send_verification_email_request: crate::models::SendVerificationEmailRequest) -> Result<crate::models::StatusOk, Error<SendVerificationEmailError>> {
2328    let local_var_configuration = configuration;
2329
2330    let local_var_client = &local_var_configuration.client;
2331
2332    let local_var_uri_str = format!("{}/users/email/verify/send", local_var_configuration.base_path);
2333    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2334
2335    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2336        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2337    }
2338    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2339        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2340    };
2341    local_var_req_builder = local_var_req_builder.json(&send_verification_email_request);
2342
2343    let local_var_req = local_var_req_builder.build()?;
2344    let local_var_resp = local_var_client.execute(local_var_req).await?;
2345
2346    let local_var_status = local_var_resp.status();
2347    let local_var_content = local_var_resp.text().await?;
2348
2349    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2350        serde_json::from_str(&local_var_content).map_err(Error::from)
2351    } else {
2352        let local_var_entity: Option<SendVerificationEmailError> = serde_json::from_str(&local_var_content).ok();
2353        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2354        Err(Error::ResponseError(local_var_error))
2355    }
2356}
2357
2358/// Delete user's profile image and reset to default image based on user_id string parameter. ##### Permissions Must be logged in as the user being updated or have the `edit_other_users` permission. __Minimum server version__: 5.5 
2359pub async fn set_default_profile_image(configuration: &configuration::Configuration, user_id: &str) -> Result<crate::models::StatusOk, Error<SetDefaultProfileImageError>> {
2360    let local_var_configuration = configuration;
2361
2362    let local_var_client = &local_var_configuration.client;
2363
2364    let local_var_uri_str = format!("{}/users/{user_id}/image", local_var_configuration.base_path, user_id=crate::apis::urlencode(user_id));
2365    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
2366
2367    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2368        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2369    }
2370    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2371        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2372    };
2373
2374    let local_var_req = local_var_req_builder.build()?;
2375    let local_var_resp = local_var_client.execute(local_var_req).await?;
2376
2377    let local_var_status = local_var_resp.status();
2378    let local_var_content = local_var_resp.text().await?;
2379
2380    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2381        serde_json::from_str(&local_var_content).map_err(Error::from)
2382    } else {
2383        let local_var_entity: Option<SetDefaultProfileImageError> = serde_json::from_str(&local_var_content).ok();
2384        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2385        Err(Error::ResponseError(local_var_error))
2386    }
2387}
2388
2389/// Set a user's profile image based on user_id string parameter. ##### Permissions Must be logged in as the user being updated or have the `edit_other_users` permission. 
2390pub async fn set_profile_image(configuration: &configuration::Configuration, user_id: &str, image: std::path::PathBuf) -> Result<crate::models::StatusOk, Error<SetProfileImageError>> {
2391    let local_var_configuration = configuration;
2392
2393    let local_var_client = &local_var_configuration.client;
2394
2395    let local_var_uri_str = format!("{}/users/{user_id}/image", local_var_configuration.base_path, user_id=crate::apis::urlencode(user_id));
2396    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2397
2398    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2399        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2400    }
2401    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2402        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2403    };
2404    let mut local_var_form = reqwest::multipart::Form::new();
2405    // TODO: support file upload for 'image' parameter
2406    local_var_req_builder = local_var_req_builder.multipart(local_var_form);
2407
2408    let local_var_req = local_var_req_builder.build()?;
2409    let local_var_resp = local_var_client.execute(local_var_req).await?;
2410
2411    let local_var_status = local_var_resp.status();
2412    let local_var_content = local_var_resp.text().await?;
2413
2414    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2415        serde_json::from_str(&local_var_content).map_err(Error::from)
2416    } else {
2417        let local_var_entity: Option<SetProfileImageError> = serde_json::from_str(&local_var_content).ok();
2418        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2419        Err(Error::ResponseError(local_var_error))
2420    }
2421}
2422
2423/// Switch a user's login method from using email to OAuth2/SAML/LDAP or back to email. When switching to OAuth2/SAML, account switching is not complete until the user follows the returned link and completes any steps on the OAuth2/SAML service provider.  To switch from email to OAuth2/SAML, specify `current_service`, `new_service`, `email` and `password`.  To switch from OAuth2/SAML to email, specify `current_service`, `new_service`, `email` and `new_password`.  To switch from email to LDAP/AD, specify `current_service`, `new_service`, `email`, `password`, `ldap_ip` and `new_password` (this is the user's LDAP password).  To switch from LDAP/AD to email, specify `current_service`, `new_service`, `ldap_ip`, `password` (this is the user's LDAP password), `email`  and `new_password`.  Additionally, specify `mfa_code` when trying to switch an account on LDAP/AD or email that has MFA activated.  ##### Permissions No current authentication required except when switching from OAuth2/SAML to email. 
2424pub async fn switch_account_type(configuration: &configuration::Configuration, switch_account_type_request: crate::models::SwitchAccountTypeRequest) -> Result<crate::models::SwitchAccountType200Response, Error<SwitchAccountTypeError>> {
2425    let local_var_configuration = configuration;
2426
2427    let local_var_client = &local_var_configuration.client;
2428
2429    let local_var_uri_str = format!("{}/users/login/switch", local_var_configuration.base_path);
2430    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2431
2432    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2433        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2434    }
2435    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2436        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2437    };
2438    local_var_req_builder = local_var_req_builder.json(&switch_account_type_request);
2439
2440    let local_var_req = local_var_req_builder.build()?;
2441    let local_var_resp = local_var_client.execute(local_var_req).await?;
2442
2443    let local_var_status = local_var_resp.status();
2444    let local_var_content = local_var_resp.text().await?;
2445
2446    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2447        serde_json::from_str(&local_var_content).map_err(Error::from)
2448    } else {
2449        let local_var_entity: Option<SwitchAccountTypeError> = serde_json::from_str(&local_var_content).ok();
2450        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2451        Err(Error::ResponseError(local_var_error))
2452    }
2453}
2454
2455/// Update a user by providing the user object. The fields that can be updated are defined in the request body, all other provided fields will be ignored. Any fields not included in the request body will be set to null or reverted to default values. ##### Permissions Must be logged in as the user being updated or have the `edit_other_users` permission. 
2456pub async fn update_user(configuration: &configuration::Configuration, user_id: &str, update_user_request: crate::models::UpdateUserRequest) -> Result<crate::models::User, Error<UpdateUserError>> {
2457    let local_var_configuration = configuration;
2458
2459    let local_var_client = &local_var_configuration.client;
2460
2461    let local_var_uri_str = format!("{}/users/{user_id}", local_var_configuration.base_path, user_id=crate::apis::urlencode(user_id));
2462    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
2463
2464    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2465        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2466    }
2467    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2468        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2469    };
2470    local_var_req_builder = local_var_req_builder.json(&update_user_request);
2471
2472    let local_var_req = local_var_req_builder.build()?;
2473    let local_var_resp = local_var_client.execute(local_var_req).await?;
2474
2475    let local_var_status = local_var_resp.status();
2476    let local_var_content = local_var_resp.text().await?;
2477
2478    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2479        serde_json::from_str(&local_var_content).map_err(Error::from)
2480    } else {
2481        let local_var_entity: Option<UpdateUserError> = serde_json::from_str(&local_var_content).ok();
2482        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2483        Err(Error::ResponseError(local_var_error))
2484    }
2485}
2486
2487/// Update user active or inactive status.  __Since server version 4.6, users using a SSO provider to login can be activated or deactivated with this endpoint. However, if their activation status in Mattermost does not reflect their status in the SSO provider, the next synchronization or login by that user will reset the activation status to that of their account in the SSO provider. Server versions 4.5 and before do not allow activation or deactivation of SSO users from this endpoint.__ ##### Permissions User can deactivate themselves. User with `manage_system` permission can activate or deactivate a user. 
2488pub async fn update_user_active(configuration: &configuration::Configuration, user_id: &str, update_user_active_request: crate::models::UpdateUserActiveRequest) -> Result<crate::models::StatusOk, Error<UpdateUserActiveError>> {
2489    let local_var_configuration = configuration;
2490
2491    let local_var_client = &local_var_configuration.client;
2492
2493    let local_var_uri_str = format!("{}/users/{user_id}/active", local_var_configuration.base_path, user_id=crate::apis::urlencode(user_id));
2494    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
2495
2496    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2497        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2498    }
2499    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2500        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2501    };
2502    local_var_req_builder = local_var_req_builder.json(&update_user_active_request);
2503
2504    let local_var_req = local_var_req_builder.build()?;
2505    let local_var_resp = local_var_client.execute(local_var_req).await?;
2506
2507    let local_var_status = local_var_resp.status();
2508    let local_var_content = local_var_resp.text().await?;
2509
2510    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2511        serde_json::from_str(&local_var_content).map_err(Error::from)
2512    } else {
2513        let local_var_entity: Option<UpdateUserActiveError> = serde_json::from_str(&local_var_content).ok();
2514        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2515        Err(Error::ResponseError(local_var_error))
2516    }
2517}
2518
2519/// Updates a user's authentication method. This can be used to change them to/from LDAP authentication for example.  __Minimum server version__: 4.6 ##### Permissions Must have the `edit_other_users` permission. 
2520pub async fn update_user_auth(configuration: &configuration::Configuration, user_id: &str, user_auth_data: crate::models::UserAuthData) -> Result<crate::models::UserAuthData, Error<UpdateUserAuthError>> {
2521    let local_var_configuration = configuration;
2522
2523    let local_var_client = &local_var_configuration.client;
2524
2525    let local_var_uri_str = format!("{}/users/{user_id}/auth", local_var_configuration.base_path, user_id=crate::apis::urlencode(user_id));
2526    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
2527
2528    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2529        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2530    }
2531    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2532        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2533    };
2534    local_var_req_builder = local_var_req_builder.json(&user_auth_data);
2535
2536    let local_var_req = local_var_req_builder.build()?;
2537    let local_var_resp = local_var_client.execute(local_var_req).await?;
2538
2539    let local_var_status = local_var_resp.status();
2540    let local_var_content = local_var_resp.text().await?;
2541
2542    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2543        serde_json::from_str(&local_var_content).map_err(Error::from)
2544    } else {
2545        let local_var_entity: Option<UpdateUserAuthError> = serde_json::from_str(&local_var_content).ok();
2546        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2547        Err(Error::ResponseError(local_var_error))
2548    }
2549}
2550
2551/// Activates multi-factor authentication for the user if `activate` is true and a valid `code` is provided. If activate is false, then `code` is not required and multi-factor authentication is disabled for the user. ##### Permissions Must be logged in as the user being updated or have the `edit_other_users` permission. 
2552pub async fn update_user_mfa(configuration: &configuration::Configuration, user_id: &str, update_user_mfa_request: crate::models::UpdateUserMfaRequest) -> Result<crate::models::StatusOk, Error<UpdateUserMfaError>> {
2553    let local_var_configuration = configuration;
2554
2555    let local_var_client = &local_var_configuration.client;
2556
2557    let local_var_uri_str = format!("{}/users/{user_id}/mfa", local_var_configuration.base_path, user_id=crate::apis::urlencode(user_id));
2558    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
2559
2560    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2561        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2562    }
2563    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2564        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2565    };
2566    local_var_req_builder = local_var_req_builder.json(&update_user_mfa_request);
2567
2568    let local_var_req = local_var_req_builder.build()?;
2569    let local_var_resp = local_var_client.execute(local_var_req).await?;
2570
2571    let local_var_status = local_var_resp.status();
2572    let local_var_content = local_var_resp.text().await?;
2573
2574    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2575        serde_json::from_str(&local_var_content).map_err(Error::from)
2576    } else {
2577        let local_var_entity: Option<UpdateUserMfaError> = serde_json::from_str(&local_var_content).ok();
2578        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2579        Err(Error::ResponseError(local_var_error))
2580    }
2581}
2582
2583/// Update a user's password. New password must meet password policy set by server configuration. Current password is required if you're updating your own password. ##### Permissions Must be logged in as the user the password is being changed for or have `manage_system` permission. 
2584pub async fn update_user_password(configuration: &configuration::Configuration, user_id: &str, update_user_password_request: crate::models::UpdateUserPasswordRequest) -> Result<crate::models::StatusOk, Error<UpdateUserPasswordError>> {
2585    let local_var_configuration = configuration;
2586
2587    let local_var_client = &local_var_configuration.client;
2588
2589    let local_var_uri_str = format!("{}/users/{user_id}/password", local_var_configuration.base_path, user_id=crate::apis::urlencode(user_id));
2590    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
2591
2592    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2593        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2594    }
2595    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2596        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2597    };
2598    local_var_req_builder = local_var_req_builder.json(&update_user_password_request);
2599
2600    let local_var_req = local_var_req_builder.build()?;
2601    let local_var_resp = local_var_client.execute(local_var_req).await?;
2602
2603    let local_var_status = local_var_resp.status();
2604    let local_var_content = local_var_resp.text().await?;
2605
2606    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2607        serde_json::from_str(&local_var_content).map_err(Error::from)
2608    } else {
2609        let local_var_entity: Option<UpdateUserPasswordError> = serde_json::from_str(&local_var_content).ok();
2610        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2611        Err(Error::ResponseError(local_var_error))
2612    }
2613}
2614
2615/// Update a user's system-level roles. Valid user roles are \"system_user\", \"system_admin\" or both of them. Overwrites any previously assigned system-level roles. ##### Permissions Must have the `manage_roles` permission. 
2616pub async fn update_user_roles(configuration: &configuration::Configuration, user_id: &str, update_user_roles_request: crate::models::UpdateUserRolesRequest) -> Result<crate::models::StatusOk, Error<UpdateUserRolesError>> {
2617    let local_var_configuration = configuration;
2618
2619    let local_var_client = &local_var_configuration.client;
2620
2621    let local_var_uri_str = format!("{}/users/{user_id}/roles", local_var_configuration.base_path, user_id=crate::apis::urlencode(user_id));
2622    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
2623
2624    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2625        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2626    }
2627    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2628        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2629    };
2630    local_var_req_builder = local_var_req_builder.json(&update_user_roles_request);
2631
2632    let local_var_req = local_var_req_builder.build()?;
2633    let local_var_resp = local_var_client.execute(local_var_req).await?;
2634
2635    let local_var_status = local_var_resp.status();
2636    let local_var_content = local_var_resp.text().await?;
2637
2638    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2639        serde_json::from_str(&local_var_content).map_err(Error::from)
2640    } else {
2641        let local_var_entity: Option<UpdateUserRolesError> = serde_json::from_str(&local_var_content).ok();
2642        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2643        Err(Error::ResponseError(local_var_error))
2644    }
2645}
2646
2647/// Verify the email used by a user to sign-up their account with. ##### Permissions No permissions required. 
2648pub async fn verify_user_email(configuration: &configuration::Configuration, verify_user_email_request: crate::models::VerifyUserEmailRequest) -> Result<crate::models::StatusOk, Error<VerifyUserEmailError>> {
2649    let local_var_configuration = configuration;
2650
2651    let local_var_client = &local_var_configuration.client;
2652
2653    let local_var_uri_str = format!("{}/users/email/verify", local_var_configuration.base_path);
2654    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2655
2656    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2657        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2658    }
2659    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2660        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2661    };
2662    local_var_req_builder = local_var_req_builder.json(&verify_user_email_request);
2663
2664    let local_var_req = local_var_req_builder.build()?;
2665    let local_var_resp = local_var_client.execute(local_var_req).await?;
2666
2667    let local_var_status = local_var_resp.status();
2668    let local_var_content = local_var_resp.text().await?;
2669
2670    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2671        serde_json::from_str(&local_var_content).map_err(Error::from)
2672    } else {
2673        let local_var_entity: Option<VerifyUserEmailError> = serde_json::from_str(&local_var_content).ok();
2674        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2675        Err(Error::ResponseError(local_var_error))
2676    }
2677}
2678
2679/// Verify the email used by a user without a token.  __Minimum server version__: 5.24  ##### Permissions  Must have `manage_system` permission. 
2680pub async fn verify_user_email_without_token(configuration: &configuration::Configuration, user_id: &str) -> Result<crate::models::User, Error<VerifyUserEmailWithoutTokenError>> {
2681    let local_var_configuration = configuration;
2682
2683    let local_var_client = &local_var_configuration.client;
2684
2685    let local_var_uri_str = format!("{}/users/{user_id}/email/verify/member", local_var_configuration.base_path, user_id=crate::apis::urlencode(user_id));
2686    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2687
2688    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2689        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2690    }
2691    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2692        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2693    };
2694
2695    let local_var_req = local_var_req_builder.build()?;
2696    let local_var_resp = local_var_client.execute(local_var_req).await?;
2697
2698    let local_var_status = local_var_resp.status();
2699    let local_var_content = local_var_resp.text().await?;
2700
2701    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2702        serde_json::from_str(&local_var_content).map_err(Error::from)
2703    } else {
2704        let local_var_entity: Option<VerifyUserEmailWithoutTokenError> = serde_json::from_str(&local_var_content).ok();
2705        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2706        Err(Error::ResponseError(local_var_error))
2707    }
2708}
2709