mattermost_client/openapi/apis/
channels_api.rs

1/*
2 * Mattermost API Reference
3 *
4 * There is also a work-in-progress [Postman API reference](https://documenter.getpostman.com/view/4508214/RW8FERUn).
5 *
6 * The version of the OpenAPI document: 4.0.0
7 * Contact: feedback@mattermost.com
8 * Generated by: https://openapi-generator.tech
9 */
10
11use reqwest;
12
13use super::{configuration, Error};
14use super::ResponseContent;
15
16/// struct for passing parameters to the method [`add_channel_member`]
17#[derive(Clone, Debug, Default)]
18pub struct AddChannelMemberParams {
19    /// The channel ID
20    pub channel_id: String,
21    pub add_channel_member_request: crate::openapi::models::AddChannelMemberRequest,
22}
23
24/// struct for passing parameters to the method [`autocomplete_channels_for_team`]
25#[derive(Clone, Debug, Default)]
26pub struct AutocompleteChannelsForTeamParams {
27    /// Team GUID
28    pub team_id: String,
29    /// Name or display name
30    pub name: String,
31}
32
33/// struct for passing parameters to the method [`autocomplete_channels_for_team_for_search`]
34#[derive(Clone, Debug, Default)]
35pub struct AutocompleteChannelsForTeamForSearchParams {
36    /// Team GUID
37    pub team_id: String,
38    /// Name or display name
39    pub name: String,
40}
41
42/// struct for passing parameters to the method [`channel_members_minus_group_members`]
43#[derive(Clone, Debug, Default)]
44pub struct ChannelMembersMinusGroupMembersParams {
45    /// Channel GUID
46    pub channel_id: String,
47    /// A comma-separated list of group ids.
48    pub group_ids: String,
49    /// The page to select.
50    pub page: Option<i32>,
51    /// The number of users per page.
52    pub per_page: Option<i32>,
53}
54
55/// struct for passing parameters to the method [`create_channel`]
56#[derive(Clone, Debug, Default)]
57pub struct CreateChannelParams {
58    /// Channel object to be created
59    pub create_channel_request: crate::openapi::models::CreateChannelRequest,
60}
61
62/// struct for passing parameters to the method [`create_direct_channel`]
63#[derive(Clone, Debug, Default)]
64pub struct CreateDirectChannelParams {
65    /// The two user ids to be in the direct message
66    pub request_body: Vec<String>,
67}
68
69/// struct for passing parameters to the method [`create_group_channel`]
70#[derive(Clone, Debug, Default)]
71pub struct CreateGroupChannelParams {
72    /// User ids to be in the group message channel
73    pub request_body: Vec<String>,
74}
75
76/// struct for passing parameters to the method [`create_sidebar_category_for_team_for_user`]
77#[derive(Clone, Debug, Default)]
78pub struct CreateSidebarCategoryForTeamForUserParams {
79    /// Team GUID
80    pub team_id: String,
81    /// User GUID
82    pub user_id: String,
83    pub sidebar_category: crate::openapi::models::SidebarCategory,
84}
85
86/// struct for passing parameters to the method [`delete_channel`]
87#[derive(Clone, Debug, Default)]
88pub struct DeleteChannelParams {
89    /// Channel GUID
90    pub channel_id: String,
91}
92
93/// struct for passing parameters to the method [`get_all_channels`]
94#[derive(Clone, Debug, Default)]
95pub struct GetAllChannelsParams {
96    /// A group id to exclude channels that are associated with that group via GroupChannel records. This can also be left blank with `not_associated_to_group=`.
97    pub not_associated_to_group: Option<String>,
98    /// The page to select.
99    pub page: Option<i32>,
100    /// The number of channels per page.
101    pub per_page: Option<i32>,
102    /// Whether to exclude default channels (ex Town Square, Off-Topic) from the results.
103    pub exclude_default_channels: Option<bool>,
104    /// Include channels that have been archived. This correlates to the `DeleteAt` flag being set in the database.
105    pub include_deleted: Option<bool>,
106    /// Appends a total count of returned channels inside the response object - ex: `{ \"channels\": [], \"total_count\" : 0 }`.      
107    pub include_total_count: Option<bool>,
108    /// If set to true, channels which are part of a data retention policy will be excluded. The `sysconsole_read_compliance` permission is required to use this parameter. __Minimum server version__: 5.35
109    pub exclude_policy_constrained: Option<bool>,
110}
111
112/// struct for passing parameters to the method [`get_channel`]
113#[derive(Clone, Debug, Default)]
114pub struct GetChannelParams {
115    /// Channel GUID
116    pub channel_id: String,
117}
118
119/// struct for passing parameters to the method [`get_channel_by_name`]
120#[derive(Clone, Debug, Default)]
121pub struct GetChannelByNameParams {
122    /// Team GUID
123    pub team_id: String,
124    /// Channel Name
125    pub channel_name: String,
126    /// Defines if deleted channels should be returned or not (Mattermost Server 5.26.0+)
127    pub include_deleted: Option<bool>,
128}
129
130/// struct for passing parameters to the method [`get_channel_by_name_for_team_name`]
131#[derive(Clone, Debug, Default)]
132pub struct GetChannelByNameForTeamNameParams {
133    /// Team Name
134    pub team_name: String,
135    /// Channel Name
136    pub channel_name: String,
137    /// Defines if deleted channels should be returned or not (Mattermost Server 5.26.0+)
138    pub include_deleted: Option<bool>,
139}
140
141/// struct for passing parameters to the method [`get_channel_member`]
142#[derive(Clone, Debug, Default)]
143pub struct GetChannelMemberParams {
144    /// Channel GUID
145    pub channel_id: String,
146    /// User GUID
147    pub user_id: String,
148}
149
150/// struct for passing parameters to the method [`get_channel_member_counts_by_group`]
151#[derive(Clone, Debug, Default)]
152pub struct GetChannelMemberCountsByGroupParams {
153    /// Channel GUID
154    pub channel_id: String,
155    /// Defines if member timezone counts should be returned or not
156    pub include_timezones: Option<bool>,
157}
158
159/// struct for passing parameters to the method [`get_channel_members`]
160#[derive(Clone, Debug, Default)]
161pub struct GetChannelMembersParams {
162    /// Channel GUID
163    pub channel_id: String,
164    /// The page to select.
165    pub page: Option<i32>,
166    /// The number of members per page. There is a maximum limit of 200 members.
167    pub per_page: Option<i32>,
168}
169
170/// struct for passing parameters to the method [`get_channel_members_by_ids`]
171#[derive(Clone, Debug, Default)]
172pub struct GetChannelMembersByIdsParams {
173    /// Channel GUID
174    pub channel_id: String,
175    /// List of user ids
176    pub request_body: Vec<String>,
177}
178
179/// struct for passing parameters to the method [`get_channel_members_for_user`]
180#[derive(Clone, Debug, Default)]
181pub struct GetChannelMembersForUserParams {
182    /// User GUID
183    pub user_id: String,
184    /// Team GUID
185    pub team_id: String,
186}
187
188/// struct for passing parameters to the method [`get_channel_members_timezones`]
189#[derive(Clone, Debug, Default)]
190pub struct GetChannelMembersTimezonesParams {
191    /// Channel GUID
192    pub channel_id: String,
193}
194
195/// struct for passing parameters to the method [`get_channel_moderations`]
196#[derive(Clone, Debug, Default)]
197pub struct GetChannelModerationsParams {
198    /// Channel GUID
199    pub channel_id: String,
200}
201
202/// struct for passing parameters to the method [`get_channel_stats`]
203#[derive(Clone, Debug, Default)]
204pub struct GetChannelStatsParams {
205    /// Channel GUID
206    pub channel_id: String,
207}
208
209/// struct for passing parameters to the method [`get_channel_unread`]
210#[derive(Clone, Debug, Default)]
211pub struct GetChannelUnreadParams {
212    /// User GUID
213    pub user_id: String,
214    /// Channel GUID
215    pub channel_id: String,
216}
217
218/// struct for passing parameters to the method [`get_channels_for_team_for_user`]
219#[derive(Clone, Debug, Default)]
220pub struct GetChannelsForTeamForUserParams {
221    /// User GUID
222    pub user_id: String,
223    /// Team GUID
224    pub team_id: String,
225    /// Defines if deleted channels should be returned or not
226    pub include_deleted: Option<bool>,
227    /// Filters the deleted channels by this time in epoch format. Does not have any effect if include_deleted is set to false.
228    pub last_delete_at: Option<i32>,
229}
230
231/// struct for passing parameters to the method [`get_channels_for_user`]
232#[derive(Clone, Debug, Default)]
233pub struct GetChannelsForUserParams {
234    /// The ID of the user. This can also be \"me\" which will point to the current user.
235    pub user_id: String,
236    /// Filters the deleted channels by this time in epoch format. Does not have any effect if include_deleted is set to false.
237    pub last_delete_at: Option<i32>,
238    /// Defines if deleted channels should be returned or not
239    pub include_deleted: Option<bool>,
240}
241
242/// struct for passing parameters to the method [`get_deleted_channels_for_team`]
243#[derive(Clone, Debug, Default)]
244pub struct GetDeletedChannelsForTeamParams {
245    /// Team GUID
246    pub team_id: String,
247    /// The page to select.
248    pub page: Option<i32>,
249    /// The number of public channels per page.
250    pub per_page: Option<i32>,
251}
252
253/// struct for passing parameters to the method [`get_pinned_posts`]
254#[derive(Clone, Debug, Default)]
255pub struct GetPinnedPostsParams {
256    /// Channel GUID
257    pub channel_id: String,
258}
259
260/// struct for passing parameters to the method [`get_private_channels_for_team`]
261#[derive(Clone, Debug, Default)]
262pub struct GetPrivateChannelsForTeamParams {
263    /// Team GUID
264    pub team_id: String,
265    /// The page to select.
266    pub page: Option<i32>,
267    /// The number of private channels per page.
268    pub per_page: Option<i32>,
269}
270
271/// struct for passing parameters to the method [`get_public_channels_by_ids_for_team`]
272#[derive(Clone, Debug, Default)]
273pub struct GetPublicChannelsByIdsForTeamParams {
274    /// Team GUID
275    pub team_id: String,
276    /// List of channel ids
277    pub request_body: Vec<String>,
278}
279
280/// struct for passing parameters to the method [`get_public_channels_for_team`]
281#[derive(Clone, Debug, Default)]
282pub struct GetPublicChannelsForTeamParams {
283    /// Team GUID
284    pub team_id: String,
285    /// The page to select.
286    pub page: Option<i32>,
287    /// The number of public channels per page.
288    pub per_page: Option<i32>,
289}
290
291/// struct for passing parameters to the method [`get_sidebar_categories_for_team_for_user`]
292#[derive(Clone, Debug, Default)]
293pub struct GetSidebarCategoriesForTeamForUserParams {
294    /// Team GUID
295    pub team_id: String,
296    /// User GUID
297    pub user_id: String,
298}
299
300/// struct for passing parameters to the method [`get_sidebar_category_for_team_for_user`]
301#[derive(Clone, Debug, Default)]
302pub struct GetSidebarCategoryForTeamForUserParams {
303    /// Team GUID
304    pub team_id: String,
305    /// User GUID
306    pub user_id: String,
307    /// Category GUID
308    pub category_id: String,
309}
310
311/// struct for passing parameters to the method [`get_sidebar_category_order_for_team_for_user`]
312#[derive(Clone, Debug, Default)]
313pub struct GetSidebarCategoryOrderForTeamForUserParams {
314    /// Team GUID
315    pub team_id: String,
316    /// User GUID
317    pub user_id: String,
318}
319
320/// struct for passing parameters to the method [`move_channel`]
321#[derive(Clone, Debug, Default)]
322pub struct MoveChannelParams {
323    /// Channel GUID
324    pub channel_id: String,
325    pub move_channel_request: crate::openapi::models::MoveChannelRequest,
326}
327
328/// struct for passing parameters to the method [`patch_channel`]
329#[derive(Clone, Debug, Default)]
330pub struct PatchChannelParams {
331    /// Channel GUID
332    pub channel_id: String,
333    /// Channel object to be updated
334    pub patch_channel_request: crate::openapi::models::PatchChannelRequest,
335}
336
337/// struct for passing parameters to the method [`patch_channel_moderations`]
338#[derive(Clone, Debug, Default)]
339pub struct PatchChannelModerationsParams {
340    /// Channel GUID
341    pub channel_id: String,
342    pub channel_moderation_patch: crate::openapi::models::ChannelModerationPatch,
343}
344
345/// struct for passing parameters to the method [`remove_sidebar_category_for_team_for_user`]
346#[derive(Clone, Debug, Default)]
347pub struct RemoveSidebarCategoryForTeamForUserParams {
348    /// Team GUID
349    pub team_id: String,
350    /// User GUID
351    pub user_id: String,
352    /// Category GUID
353    pub category_id: String,
354}
355
356/// struct for passing parameters to the method [`remove_user_from_channel`]
357#[derive(Clone, Debug, Default)]
358pub struct RemoveUserFromChannelParams {
359    /// Channel GUID
360    pub channel_id: String,
361    /// User GUID
362    pub user_id: String,
363}
364
365/// struct for passing parameters to the method [`restore_channel`]
366#[derive(Clone, Debug, Default)]
367pub struct RestoreChannelParams {
368    /// Channel GUID
369    pub channel_id: String,
370}
371
372/// struct for passing parameters to the method [`search_all_channels`]
373#[derive(Clone, Debug, Default)]
374pub struct SearchAllChannelsParams {
375    /// The search terms and logic to use in the search.
376    pub search_all_channels_request: crate::openapi::models::SearchAllChannelsRequest,
377    /// Is the request from system_console. If this is set to true, it filters channels by the logged in user.
378    pub system_console: Option<bool>,
379}
380
381/// struct for passing parameters to the method [`search_archived_channels`]
382#[derive(Clone, Debug, Default)]
383pub struct SearchArchivedChannelsParams {
384    /// Team GUID
385    pub team_id: String,
386    /// Search criteria
387    pub search_archived_channels_request: crate::openapi::models::SearchArchivedChannelsRequest,
388}
389
390/// struct for passing parameters to the method [`search_channels`]
391#[derive(Clone, Debug, Default)]
392pub struct SearchChannelsParams {
393    /// Team GUID
394    pub team_id: String,
395    /// Search criteria
396    pub search_channels_request: crate::openapi::models::SearchChannelsRequest,
397}
398
399/// struct for passing parameters to the method [`search_group_channels`]
400#[derive(Clone, Debug, Default)]
401pub struct SearchGroupChannelsParams {
402    /// Search criteria
403    pub search_group_channels_request: crate::openapi::models::SearchGroupChannelsRequest,
404}
405
406/// struct for passing parameters to the method [`update_channel`]
407#[derive(Clone, Debug, Default)]
408pub struct UpdateChannelParams {
409    /// Channel GUID
410    pub channel_id: String,
411    /// Channel object to be updated
412    pub update_channel_request: crate::openapi::models::UpdateChannelRequest,
413}
414
415/// struct for passing parameters to the method [`update_channel_member_scheme_roles`]
416#[derive(Clone, Debug, Default)]
417pub struct UpdateChannelMemberSchemeRolesParams {
418    /// Channel GUID
419    pub channel_id: String,
420    /// User GUID
421    pub user_id: String,
422    /// Scheme properties.
423    pub update_team_member_scheme_roles_request: crate::openapi::models::UpdateTeamMemberSchemeRolesRequest,
424}
425
426/// struct for passing parameters to the method [`update_channel_notify_props`]
427#[derive(Clone, Debug, Default)]
428pub struct UpdateChannelNotifyPropsParams {
429    /// Channel GUID
430    pub channel_id: String,
431    /// User GUID
432    pub user_id: String,
433    pub channel_notify_props: crate::openapi::models::ChannelNotifyProps,
434}
435
436/// struct for passing parameters to the method [`update_channel_privacy`]
437#[derive(Clone, Debug, Default)]
438pub struct UpdateChannelPrivacyParams {
439    /// Channel GUID
440    pub channel_id: String,
441    pub update_channel_privacy_request: crate::openapi::models::UpdateChannelPrivacyRequest,
442}
443
444/// struct for passing parameters to the method [`update_channel_roles`]
445#[derive(Clone, Debug, Default)]
446pub struct UpdateChannelRolesParams {
447    /// Channel GUID
448    pub channel_id: String,
449    /// User GUID
450    pub user_id: String,
451    /// Space-delimited channel roles to assign to the user
452    pub update_user_roles_request: crate::openapi::models::UpdateUserRolesRequest,
453}
454
455/// struct for passing parameters to the method [`update_channel_scheme`]
456#[derive(Clone, Debug, Default)]
457pub struct UpdateChannelSchemeParams {
458    /// Channel GUID
459    pub channel_id: String,
460    /// Scheme GUID
461    pub update_team_scheme_request: crate::openapi::models::UpdateTeamSchemeRequest,
462}
463
464/// struct for passing parameters to the method [`update_sidebar_categories_for_team_for_user`]
465#[derive(Clone, Debug, Default)]
466pub struct UpdateSidebarCategoriesForTeamForUserParams {
467    /// Team GUID
468    pub team_id: String,
469    /// User GUID
470    pub user_id: String,
471    pub sidebar_category: Vec<crate::openapi::models::SidebarCategory>,
472}
473
474/// struct for passing parameters to the method [`update_sidebar_category_for_team_for_user`]
475#[derive(Clone, Debug, Default)]
476pub struct UpdateSidebarCategoryForTeamForUserParams {
477    /// Team GUID
478    pub team_id: String,
479    /// User GUID
480    pub user_id: String,
481    /// Category GUID
482    pub category_id: String,
483    pub sidebar_category: crate::openapi::models::SidebarCategory,
484}
485
486/// struct for passing parameters to the method [`update_sidebar_category_order_for_team_for_user`]
487#[derive(Clone, Debug, Default)]
488pub struct UpdateSidebarCategoryOrderForTeamForUserParams {
489    /// Team GUID
490    pub team_id: String,
491    /// User GUID
492    pub user_id: String,
493    pub request_body: Vec<String>,
494}
495
496/// struct for passing parameters to the method [`view_channel`]
497#[derive(Clone, Debug, Default)]
498pub struct ViewChannelParams {
499    /// User ID to perform the view action for
500    pub user_id: String,
501    /// Paremeters affecting how and which channels to view
502    pub view_channel_request: crate::openapi::models::ViewChannelRequest,
503}
504
505/// struct for typed errors of method [`add_channel_member`]
506#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
507#[serde(untagged)]
508pub enum AddChannelMemberError {
509    Status400(crate::openapi::models::AppError),
510    Status401(crate::openapi::models::AppError),
511    Status403(crate::openapi::models::AppError),
512    UnknownValue(serde_json::Value),
513}
514
515/// struct for typed errors of method [`autocomplete_channels_for_team`]
516#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
517#[serde(untagged)]
518pub enum AutocompleteChannelsForTeamError {
519    Status400(crate::openapi::models::AppError),
520    Status401(crate::openapi::models::AppError),
521    Status403(crate::openapi::models::AppError),
522    Status404(crate::openapi::models::AppError),
523    UnknownValue(serde_json::Value),
524}
525
526/// struct for typed errors of method [`autocomplete_channels_for_team_for_search`]
527#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
528#[serde(untagged)]
529pub enum AutocompleteChannelsForTeamForSearchError {
530    Status400(crate::openapi::models::AppError),
531    Status401(crate::openapi::models::AppError),
532    Status403(crate::openapi::models::AppError),
533    Status404(crate::openapi::models::AppError),
534    UnknownValue(serde_json::Value),
535}
536
537/// struct for typed errors of method [`channel_members_minus_group_members`]
538#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
539#[serde(untagged)]
540pub enum ChannelMembersMinusGroupMembersError {
541    Status400(crate::openapi::models::AppError),
542    Status401(crate::openapi::models::AppError),
543    Status403(crate::openapi::models::AppError),
544    UnknownValue(serde_json::Value),
545}
546
547/// struct for typed errors of method [`create_channel`]
548#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
549#[serde(untagged)]
550pub enum CreateChannelError {
551    Status400(crate::openapi::models::AppError),
552    Status401(crate::openapi::models::AppError),
553    Status403(crate::openapi::models::AppError),
554    UnknownValue(serde_json::Value),
555}
556
557/// struct for typed errors of method [`create_direct_channel`]
558#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
559#[serde(untagged)]
560pub enum CreateDirectChannelError {
561    Status400(crate::openapi::models::AppError),
562    Status401(crate::openapi::models::AppError),
563    Status403(crate::openapi::models::AppError),
564    UnknownValue(serde_json::Value),
565}
566
567/// struct for typed errors of method [`create_group_channel`]
568#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
569#[serde(untagged)]
570pub enum CreateGroupChannelError {
571    Status400(crate::openapi::models::AppError),
572    Status401(crate::openapi::models::AppError),
573    Status403(crate::openapi::models::AppError),
574    UnknownValue(serde_json::Value),
575}
576
577/// struct for typed errors of method [`create_sidebar_category_for_team_for_user`]
578#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
579#[serde(untagged)]
580pub enum CreateSidebarCategoryForTeamForUserError {
581    Status400(crate::openapi::models::AppError),
582    Status401(crate::openapi::models::AppError),
583    Status403(crate::openapi::models::AppError),
584    Status404(crate::openapi::models::AppError),
585    UnknownValue(serde_json::Value),
586}
587
588/// struct for typed errors of method [`delete_channel`]
589#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
590#[serde(untagged)]
591pub enum DeleteChannelError {
592    Status400(crate::openapi::models::AppError),
593    Status401(crate::openapi::models::AppError),
594    Status403(crate::openapi::models::AppError),
595    UnknownValue(serde_json::Value),
596}
597
598/// struct for typed errors of method [`get_all_channels`]
599#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
600#[serde(untagged)]
601pub enum GetAllChannelsError {
602    Status400(crate::openapi::models::AppError),
603    Status401(crate::openapi::models::AppError),
604    Status404(crate::openapi::models::AppError),
605    UnknownValue(serde_json::Value),
606}
607
608/// struct for typed errors of method [`get_channel`]
609#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
610#[serde(untagged)]
611pub enum GetChannelError {
612    Status401(crate::openapi::models::AppError),
613    Status403(crate::openapi::models::AppError),
614    Status404(crate::openapi::models::AppError),
615    UnknownValue(serde_json::Value),
616}
617
618/// struct for typed errors of method [`get_channel_by_name`]
619#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
620#[serde(untagged)]
621pub enum GetChannelByNameError {
622    Status401(crate::openapi::models::AppError),
623    Status403(crate::openapi::models::AppError),
624    Status404(crate::openapi::models::AppError),
625    UnknownValue(serde_json::Value),
626}
627
628/// struct for typed errors of method [`get_channel_by_name_for_team_name`]
629#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
630#[serde(untagged)]
631pub enum GetChannelByNameForTeamNameError {
632    Status401(crate::openapi::models::AppError),
633    Status403(crate::openapi::models::AppError),
634    Status404(crate::openapi::models::AppError),
635    UnknownValue(serde_json::Value),
636}
637
638/// struct for typed errors of method [`get_channel_member`]
639#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
640#[serde(untagged)]
641pub enum GetChannelMemberError {
642    Status400(crate::openapi::models::AppError),
643    Status401(crate::openapi::models::AppError),
644    Status403(crate::openapi::models::AppError),
645    UnknownValue(serde_json::Value),
646}
647
648/// struct for typed errors of method [`get_channel_member_counts_by_group`]
649#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
650#[serde(untagged)]
651pub enum GetChannelMemberCountsByGroupError {
652    Status400(crate::openapi::models::AppError),
653    Status401(crate::openapi::models::AppError),
654    Status403(crate::openapi::models::AppError),
655    UnknownValue(serde_json::Value),
656}
657
658/// struct for typed errors of method [`get_channel_members`]
659#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
660#[serde(untagged)]
661pub enum GetChannelMembersError {
662    Status400(crate::openapi::models::AppError),
663    Status401(crate::openapi::models::AppError),
664    Status403(crate::openapi::models::AppError),
665    UnknownValue(serde_json::Value),
666}
667
668/// struct for typed errors of method [`get_channel_members_by_ids`]
669#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
670#[serde(untagged)]
671pub enum GetChannelMembersByIdsError {
672    Status400(crate::openapi::models::AppError),
673    Status401(crate::openapi::models::AppError),
674    Status403(crate::openapi::models::AppError),
675    Status404(crate::openapi::models::AppError),
676    UnknownValue(serde_json::Value),
677}
678
679/// struct for typed errors of method [`get_channel_members_for_user`]
680#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
681#[serde(untagged)]
682pub enum GetChannelMembersForUserError {
683    Status400(crate::openapi::models::AppError),
684    Status401(crate::openapi::models::AppError),
685    Status403(crate::openapi::models::AppError),
686    UnknownValue(serde_json::Value),
687}
688
689/// struct for typed errors of method [`get_channel_members_timezones`]
690#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
691#[serde(untagged)]
692pub enum GetChannelMembersTimezonesError {
693    Status400(crate::openapi::models::AppError),
694    Status401(crate::openapi::models::AppError),
695    Status403(crate::openapi::models::AppError),
696    UnknownValue(serde_json::Value),
697}
698
699/// struct for typed errors of method [`get_channel_moderations`]
700#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
701#[serde(untagged)]
702pub enum GetChannelModerationsError {
703    Status400(crate::openapi::models::AppError),
704    Status401(crate::openapi::models::AppError),
705    Status403(crate::openapi::models::AppError),
706    UnknownValue(serde_json::Value),
707}
708
709/// struct for typed errors of method [`get_channel_stats`]
710#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
711#[serde(untagged)]
712pub enum GetChannelStatsError {
713    Status400(crate::openapi::models::AppError),
714    Status401(crate::openapi::models::AppError),
715    Status403(crate::openapi::models::AppError),
716    UnknownValue(serde_json::Value),
717}
718
719/// struct for typed errors of method [`get_channel_unread`]
720#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
721#[serde(untagged)]
722pub enum GetChannelUnreadError {
723    Status400(crate::openapi::models::AppError),
724    Status401(crate::openapi::models::AppError),
725    Status403(crate::openapi::models::AppError),
726    Status404(crate::openapi::models::AppError),
727    UnknownValue(serde_json::Value),
728}
729
730/// struct for typed errors of method [`get_channels_for_team_for_user`]
731#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
732#[serde(untagged)]
733pub enum GetChannelsForTeamForUserError {
734    Status400(crate::openapi::models::AppError),
735    Status401(crate::openapi::models::AppError),
736    Status403(crate::openapi::models::AppError),
737    Status404(crate::openapi::models::AppError),
738    UnknownValue(serde_json::Value),
739}
740
741/// struct for typed errors of method [`get_channels_for_user`]
742#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
743#[serde(untagged)]
744pub enum GetChannelsForUserError {
745    Status400(crate::openapi::models::AppError),
746    Status401(crate::openapi::models::AppError),
747    Status403(crate::openapi::models::AppError),
748    Status404(crate::openapi::models::AppError),
749    UnknownValue(serde_json::Value),
750}
751
752/// struct for typed errors of method [`get_deleted_channels_for_team`]
753#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
754#[serde(untagged)]
755pub enum GetDeletedChannelsForTeamError {
756    Status400(crate::openapi::models::AppError),
757    Status401(crate::openapi::models::AppError),
758    Status403(crate::openapi::models::AppError),
759    Status404(crate::openapi::models::AppError),
760    UnknownValue(serde_json::Value),
761}
762
763/// struct for typed errors of method [`get_pinned_posts`]
764#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
765#[serde(untagged)]
766pub enum GetPinnedPostsError {
767    Status400(crate::openapi::models::AppError),
768    Status401(crate::openapi::models::AppError),
769    Status403(crate::openapi::models::AppError),
770    UnknownValue(serde_json::Value),
771}
772
773/// struct for typed errors of method [`get_private_channels_for_team`]
774#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
775#[serde(untagged)]
776pub enum GetPrivateChannelsForTeamError {
777    Status400(crate::openapi::models::AppError),
778    Status401(crate::openapi::models::AppError),
779    Status403(crate::openapi::models::AppError),
780    Status404(crate::openapi::models::AppError),
781    UnknownValue(serde_json::Value),
782}
783
784/// struct for typed errors of method [`get_public_channels_by_ids_for_team`]
785#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
786#[serde(untagged)]
787pub enum GetPublicChannelsByIdsForTeamError {
788    Status400(crate::openapi::models::AppError),
789    Status401(crate::openapi::models::AppError),
790    Status404(crate::openapi::models::AppError),
791    UnknownValue(serde_json::Value),
792}
793
794/// struct for typed errors of method [`get_public_channels_for_team`]
795#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
796#[serde(untagged)]
797pub enum GetPublicChannelsForTeamError {
798    Status400(crate::openapi::models::AppError),
799    Status401(crate::openapi::models::AppError),
800    Status403(crate::openapi::models::AppError),
801    Status404(crate::openapi::models::AppError),
802    UnknownValue(serde_json::Value),
803}
804
805/// struct for typed errors of method [`get_sidebar_categories_for_team_for_user`]
806#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
807#[serde(untagged)]
808pub enum GetSidebarCategoriesForTeamForUserError {
809    Status400(crate::openapi::models::AppError),
810    Status401(crate::openapi::models::AppError),
811    Status403(crate::openapi::models::AppError),
812    Status404(crate::openapi::models::AppError),
813    UnknownValue(serde_json::Value),
814}
815
816/// struct for typed errors of method [`get_sidebar_category_for_team_for_user`]
817#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
818#[serde(untagged)]
819pub enum GetSidebarCategoryForTeamForUserError {
820    Status400(crate::openapi::models::AppError),
821    Status401(crate::openapi::models::AppError),
822    Status403(crate::openapi::models::AppError),
823    Status404(crate::openapi::models::AppError),
824    UnknownValue(serde_json::Value),
825}
826
827/// struct for typed errors of method [`get_sidebar_category_order_for_team_for_user`]
828#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
829#[serde(untagged)]
830pub enum GetSidebarCategoryOrderForTeamForUserError {
831    Status400(crate::openapi::models::AppError),
832    Status401(crate::openapi::models::AppError),
833    Status403(crate::openapi::models::AppError),
834    Status404(crate::openapi::models::AppError),
835    UnknownValue(serde_json::Value),
836}
837
838/// struct for typed errors of method [`move_channel`]
839#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
840#[serde(untagged)]
841pub enum MoveChannelError {
842    Status400(crate::openapi::models::AppError),
843    Status401(crate::openapi::models::AppError),
844    Status403(crate::openapi::models::AppError),
845    Status404(crate::openapi::models::AppError),
846    UnknownValue(serde_json::Value),
847}
848
849/// struct for typed errors of method [`patch_channel`]
850#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
851#[serde(untagged)]
852pub enum PatchChannelError {
853    Status400(crate::openapi::models::AppError),
854    Status401(crate::openapi::models::AppError),
855    Status403(crate::openapi::models::AppError),
856    Status404(crate::openapi::models::AppError),
857    UnknownValue(serde_json::Value),
858}
859
860/// struct for typed errors of method [`patch_channel_moderations`]
861#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
862#[serde(untagged)]
863pub enum PatchChannelModerationsError {
864    Status400(crate::openapi::models::AppError),
865    Status401(crate::openapi::models::AppError),
866    Status403(crate::openapi::models::AppError),
867    UnknownValue(serde_json::Value),
868}
869
870/// struct for typed errors of method [`remove_sidebar_category_for_team_for_user`]
871#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
872#[serde(untagged)]
873pub enum RemoveSidebarCategoryForTeamForUserError {
874    Status400(crate::openapi::models::AppError),
875    Status401(crate::openapi::models::AppError),
876    Status403(crate::openapi::models::AppError),
877    Status404(crate::openapi::models::AppError),
878    UnknownValue(serde_json::Value),
879}
880
881/// struct for typed errors of method [`remove_user_from_channel`]
882#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
883#[serde(untagged)]
884pub enum RemoveUserFromChannelError {
885    Status400(crate::openapi::models::AppError),
886    Status401(crate::openapi::models::AppError),
887    Status403(crate::openapi::models::AppError),
888    UnknownValue(serde_json::Value),
889}
890
891/// struct for typed errors of method [`restore_channel`]
892#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
893#[serde(untagged)]
894pub enum RestoreChannelError {
895    Status401(crate::openapi::models::AppError),
896    Status403(crate::openapi::models::AppError),
897    Status404(crate::openapi::models::AppError),
898    UnknownValue(serde_json::Value),
899}
900
901/// struct for typed errors of method [`search_all_channels`]
902#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
903#[serde(untagged)]
904pub enum SearchAllChannelsError {
905    Status400(crate::openapi::models::AppError),
906    Status401(crate::openapi::models::AppError),
907    UnknownValue(serde_json::Value),
908}
909
910/// struct for typed errors of method [`search_archived_channels`]
911#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
912#[serde(untagged)]
913pub enum SearchArchivedChannelsError {
914    Status400(crate::openapi::models::AppError),
915    Status401(crate::openapi::models::AppError),
916    Status403(crate::openapi::models::AppError),
917    Status404(crate::openapi::models::AppError),
918    UnknownValue(serde_json::Value),
919}
920
921/// struct for typed errors of method [`search_channels`]
922#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
923#[serde(untagged)]
924pub enum SearchChannelsError {
925    Status400(crate::openapi::models::AppError),
926    Status401(crate::openapi::models::AppError),
927    Status403(crate::openapi::models::AppError),
928    Status404(crate::openapi::models::AppError),
929    UnknownValue(serde_json::Value),
930}
931
932/// struct for typed errors of method [`search_group_channels`]
933#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
934#[serde(untagged)]
935pub enum SearchGroupChannelsError {
936    Status400(crate::openapi::models::AppError),
937    Status401(crate::openapi::models::AppError),
938    UnknownValue(serde_json::Value),
939}
940
941/// struct for typed errors of method [`update_channel`]
942#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
943#[serde(untagged)]
944pub enum UpdateChannelError {
945    Status400(crate::openapi::models::AppError),
946    Status401(crate::openapi::models::AppError),
947    Status403(crate::openapi::models::AppError),
948    Status404(crate::openapi::models::AppError),
949    UnknownValue(serde_json::Value),
950}
951
952/// struct for typed errors of method [`update_channel_member_scheme_roles`]
953#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
954#[serde(untagged)]
955pub enum UpdateChannelMemberSchemeRolesError {
956    Status400(crate::openapi::models::AppError),
957    Status401(crate::openapi::models::AppError),
958    Status403(crate::openapi::models::AppError),
959    Status404(crate::openapi::models::AppError),
960    UnknownValue(serde_json::Value),
961}
962
963/// struct for typed errors of method [`update_channel_notify_props`]
964#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
965#[serde(untagged)]
966pub enum UpdateChannelNotifyPropsError {
967    Status400(crate::openapi::models::AppError),
968    Status401(crate::openapi::models::AppError),
969    Status403(crate::openapi::models::AppError),
970    Status404(crate::openapi::models::AppError),
971    UnknownValue(serde_json::Value),
972}
973
974/// struct for typed errors of method [`update_channel_privacy`]
975#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
976#[serde(untagged)]
977pub enum UpdateChannelPrivacyError {
978    Status400(crate::openapi::models::AppError),
979    Status401(crate::openapi::models::AppError),
980    Status403(crate::openapi::models::AppError),
981    Status404(crate::openapi::models::AppError),
982    UnknownValue(serde_json::Value),
983}
984
985/// struct for typed errors of method [`update_channel_roles`]
986#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
987#[serde(untagged)]
988pub enum UpdateChannelRolesError {
989    Status400(crate::openapi::models::AppError),
990    Status401(crate::openapi::models::AppError),
991    Status403(crate::openapi::models::AppError),
992    UnknownValue(serde_json::Value),
993}
994
995/// struct for typed errors of method [`update_channel_scheme`]
996#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
997#[serde(untagged)]
998pub enum UpdateChannelSchemeError {
999    Status400(crate::openapi::models::AppError),
1000    Status401(crate::openapi::models::AppError),
1001    Status403(crate::openapi::models::AppError),
1002    Status501(crate::openapi::models::AppError),
1003    UnknownValue(serde_json::Value),
1004}
1005
1006/// struct for typed errors of method [`update_sidebar_categories_for_team_for_user`]
1007#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
1008#[serde(untagged)]
1009pub enum UpdateSidebarCategoriesForTeamForUserError {
1010    Status400(crate::openapi::models::AppError),
1011    Status401(crate::openapi::models::AppError),
1012    Status403(crate::openapi::models::AppError),
1013    Status404(crate::openapi::models::AppError),
1014    UnknownValue(serde_json::Value),
1015}
1016
1017/// struct for typed errors of method [`update_sidebar_category_for_team_for_user`]
1018#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
1019#[serde(untagged)]
1020pub enum UpdateSidebarCategoryForTeamForUserError {
1021    Status400(crate::openapi::models::AppError),
1022    Status401(crate::openapi::models::AppError),
1023    Status403(crate::openapi::models::AppError),
1024    Status404(crate::openapi::models::AppError),
1025    UnknownValue(serde_json::Value),
1026}
1027
1028/// struct for typed errors of method [`update_sidebar_category_order_for_team_for_user`]
1029#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
1030#[serde(untagged)]
1031pub enum UpdateSidebarCategoryOrderForTeamForUserError {
1032    Status400(crate::openapi::models::AppError),
1033    Status401(crate::openapi::models::AppError),
1034    Status403(crate::openapi::models::AppError),
1035    Status404(crate::openapi::models::AppError),
1036    UnknownValue(serde_json::Value),
1037}
1038
1039/// struct for typed errors of method [`view_channel`]
1040#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
1041#[serde(untagged)]
1042pub enum ViewChannelError {
1043    Status400(crate::openapi::models::AppError),
1044    Status401(crate::openapi::models::AppError),
1045    Status403(crate::openapi::models::AppError),
1046    UnknownValue(serde_json::Value),
1047}
1048
1049/// Add a user to a channel by creating a channel member object.
1050pub async fn add_channel_member(
1051    configuration: &configuration::Configuration,
1052    params: AddChannelMemberParams,
1053) -> Result<crate::openapi::models::ChannelMember, Error<AddChannelMemberError>> {
1054    let local_var_configuration = configuration;
1055
1056    // unbox the parameters
1057    let channel_id = params.channel_id;
1058    let add_channel_member_request = params.add_channel_member_request;
1059
1060    let local_var_client = &local_var_configuration.client;
1061
1062    let local_var_uri_str = format!(
1063        "{}/api/v4/channels/{channel_id}/members",
1064        local_var_configuration.base_path,
1065        channel_id = super::urlencode(channel_id)
1066    );
1067    let mut local_var_req_builder =
1068        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1069
1070    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1071        local_var_req_builder =
1072            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1073    }
1074    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1075        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1076    };
1077    local_var_req_builder = local_var_req_builder.json(&add_channel_member_request);
1078
1079    let local_var_req = local_var_req_builder.build()?;
1080    let local_var_resp = local_var_client.execute(local_var_req).await?;
1081
1082    let local_var_status = local_var_resp.status();
1083    let local_var_content = local_var_resp.text().await?;
1084
1085    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1086        serde_json::from_str(&local_var_content).map_err(Error::from)
1087    } else {
1088        let local_var_entity: Option<AddChannelMemberError> =
1089            serde_json::from_str(&local_var_content).ok();
1090        let local_var_error = ResponseContent {
1091            status: local_var_status,
1092            content: local_var_content,
1093            entity: local_var_entity,
1094        };
1095        Err(Error::ResponseError(local_var_error))
1096    }
1097}
1098
1099/// Autocomplete public channels on a team based on the search term provided in the request URL.  __Minimum server version__: 4.7  ##### Permissions Must have the `list_team_channels` permission.
1100pub async fn autocomplete_channels_for_team(
1101    configuration: &configuration::Configuration,
1102    params: AutocompleteChannelsForTeamParams,
1103) -> Result<Vec<crate::openapi::models::Channel>, Error<AutocompleteChannelsForTeamError>> {
1104    let local_var_configuration = configuration;
1105
1106    // unbox the parameters
1107    let team_id = params.team_id;
1108    let name = params.name;
1109
1110    let local_var_client = &local_var_configuration.client;
1111
1112    let local_var_uri_str = format!(
1113        "{}/api/v4/teams/{team_id}/channels/autocomplete",
1114        local_var_configuration.base_path,
1115        team_id = super::urlencode(team_id)
1116    );
1117    let mut local_var_req_builder =
1118        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1119
1120    local_var_req_builder = local_var_req_builder.query(&[("name", &name.to_string())]);
1121    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1122        local_var_req_builder =
1123            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1124    }
1125    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1126        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1127    };
1128
1129    let local_var_req = local_var_req_builder.build()?;
1130    let local_var_resp = local_var_client.execute(local_var_req).await?;
1131
1132    let local_var_status = local_var_resp.status();
1133    let local_var_content = local_var_resp.text().await?;
1134
1135    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1136        serde_json::from_str(&local_var_content).map_err(Error::from)
1137    } else {
1138        let local_var_entity: Option<AutocompleteChannelsForTeamError> =
1139            serde_json::from_str(&local_var_content).ok();
1140        let local_var_error = ResponseContent {
1141            status: local_var_status,
1142            content: local_var_content,
1143            entity: local_var_entity,
1144        };
1145        Err(Error::ResponseError(local_var_error))
1146    }
1147}
1148
1149/// Autocomplete your channels on a team based on the search term provided in the request URL.  __Minimum server version__: 5.4  ##### Permissions Must have the `list_team_channels` permission.
1150pub async fn autocomplete_channels_for_team_for_search(
1151    configuration: &configuration::Configuration,
1152    params: AutocompleteChannelsForTeamForSearchParams,
1153) -> Result<Vec<crate::openapi::models::Channel>, Error<AutocompleteChannelsForTeamForSearchError>> {
1154    let local_var_configuration = configuration;
1155
1156    // unbox the parameters
1157    let team_id = params.team_id;
1158    let name = params.name;
1159
1160    let local_var_client = &local_var_configuration.client;
1161
1162    let local_var_uri_str = format!(
1163        "{}/api/v4/teams/{team_id}/channels/search_autocomplete",
1164        local_var_configuration.base_path,
1165        team_id = super::urlencode(team_id)
1166    );
1167    let mut local_var_req_builder =
1168        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1169
1170    local_var_req_builder = local_var_req_builder.query(&[("name", &name.to_string())]);
1171    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1172        local_var_req_builder =
1173            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1174    }
1175    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1176        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1177    };
1178
1179    let local_var_req = local_var_req_builder.build()?;
1180    let local_var_resp = local_var_client.execute(local_var_req).await?;
1181
1182    let local_var_status = local_var_resp.status();
1183    let local_var_content = local_var_resp.text().await?;
1184
1185    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1186        serde_json::from_str(&local_var_content).map_err(Error::from)
1187    } else {
1188        let local_var_entity: Option<AutocompleteChannelsForTeamForSearchError> =
1189            serde_json::from_str(&local_var_content).ok();
1190        let local_var_error = ResponseContent {
1191            status: local_var_status,
1192            content: local_var_content,
1193            entity: local_var_entity,
1194        };
1195        Err(Error::ResponseError(local_var_error))
1196    }
1197}
1198
1199/// Get the set of users who are members of the channel minus the set of users who are members of the given groups. Each user object contains an array of group objects representing the group memberships for that user. Each user object contains the boolean fields `scheme_guest`, `scheme_user`, and `scheme_admin` representing the roles that user has for the given channel.  ##### Permissions Must have `manage_system` permission.  __Minimum server version__: 5.14
1200pub async fn channel_members_minus_group_members(
1201    configuration: &configuration::Configuration,
1202    params: ChannelMembersMinusGroupMembersParams,
1203) -> Result<(), Error<ChannelMembersMinusGroupMembersError>> {
1204    let local_var_configuration = configuration;
1205
1206    // unbox the parameters
1207    let channel_id = params.channel_id;
1208    let group_ids = params.group_ids;
1209    let page = params.page;
1210    let per_page = params.per_page;
1211
1212    let local_var_client = &local_var_configuration.client;
1213
1214    let local_var_uri_str = format!(
1215        "{}/api/v4/channels/{channel_id}/members_minus_group_members",
1216        local_var_configuration.base_path,
1217        channel_id = super::urlencode(channel_id)
1218    );
1219    let mut local_var_req_builder =
1220        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1221
1222    local_var_req_builder = local_var_req_builder.query(&[("group_ids", &group_ids.to_string())]);
1223    if let Some(ref local_var_str) = page {
1224        local_var_req_builder =
1225            local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1226    }
1227    if let Some(ref local_var_str) = per_page {
1228        local_var_req_builder =
1229            local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
1230    }
1231    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1232        local_var_req_builder =
1233            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1234    }
1235    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1236        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1237    };
1238
1239    let local_var_req = local_var_req_builder.build()?;
1240    let local_var_resp = local_var_client.execute(local_var_req).await?;
1241
1242    let local_var_status = local_var_resp.status();
1243    let local_var_content = local_var_resp.text().await?;
1244
1245    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1246        Ok(())
1247    } else {
1248        let local_var_entity: Option<ChannelMembersMinusGroupMembersError> =
1249            serde_json::from_str(&local_var_content).ok();
1250        let local_var_error = ResponseContent {
1251            status: local_var_status,
1252            content: local_var_content,
1253            entity: local_var_entity,
1254        };
1255        Err(Error::ResponseError(local_var_error))
1256    }
1257}
1258
1259/// Create a new channel. ##### Permissions If creating a public channel, `create_public_channel` permission is required. If creating a private channel, `create_private_channel` permission is required.
1260pub async fn create_channel(
1261    configuration: &configuration::Configuration,
1262    params: CreateChannelParams,
1263) -> Result<crate::openapi::models::Channel, Error<CreateChannelError>> {
1264    let local_var_configuration = configuration;
1265
1266    // unbox the parameters
1267    let create_channel_request = params.create_channel_request;
1268
1269    let local_var_client = &local_var_configuration.client;
1270
1271    let local_var_uri_str = format!("{}/api/v4/channels", local_var_configuration.base_path);
1272    let mut local_var_req_builder =
1273        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1274
1275    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1276        local_var_req_builder =
1277            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1278    }
1279    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1280        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1281    };
1282    local_var_req_builder = local_var_req_builder.json(&create_channel_request);
1283
1284    let local_var_req = local_var_req_builder.build()?;
1285    let local_var_resp = local_var_client.execute(local_var_req).await?;
1286
1287    let local_var_status = local_var_resp.status();
1288    let local_var_content = local_var_resp.text().await?;
1289
1290    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1291        serde_json::from_str(&local_var_content).map_err(Error::from)
1292    } else {
1293        let local_var_entity: Option<CreateChannelError> =
1294            serde_json::from_str(&local_var_content).ok();
1295        let local_var_error = ResponseContent {
1296            status: local_var_status,
1297            content: local_var_content,
1298            entity: local_var_entity,
1299        };
1300        Err(Error::ResponseError(local_var_error))
1301    }
1302}
1303
1304/// Create a new direct message channel between two users. ##### Permissions Must be one of the two users and have `create_direct_channel` permission. Having the `manage_system` permission voids the previous requirements.
1305pub async fn create_direct_channel(
1306    configuration: &configuration::Configuration,
1307    params: CreateDirectChannelParams,
1308) -> Result<crate::openapi::models::Channel, Error<CreateDirectChannelError>> {
1309    let local_var_configuration = configuration;
1310
1311    // unbox the parameters
1312    let request_body = params.request_body;
1313
1314    let local_var_client = &local_var_configuration.client;
1315
1316    let local_var_uri_str = format!(
1317        "{}/api/v4/channels/direct",
1318        local_var_configuration.base_path
1319    );
1320    let mut local_var_req_builder =
1321        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1322
1323    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1324        local_var_req_builder =
1325            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1326    }
1327    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1328        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1329    };
1330    local_var_req_builder = local_var_req_builder.json(&request_body);
1331
1332    let local_var_req = local_var_req_builder.build()?;
1333    let local_var_resp = local_var_client.execute(local_var_req).await?;
1334
1335    let local_var_status = local_var_resp.status();
1336    let local_var_content = local_var_resp.text().await?;
1337
1338    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1339        serde_json::from_str(&local_var_content).map_err(Error::from)
1340    } else {
1341        let local_var_entity: Option<CreateDirectChannelError> =
1342            serde_json::from_str(&local_var_content).ok();
1343        let local_var_error = ResponseContent {
1344            status: local_var_status,
1345            content: local_var_content,
1346            entity: local_var_entity,
1347        };
1348        Err(Error::ResponseError(local_var_error))
1349    }
1350}
1351
1352/// Create a new group message channel to group of users. If the logged in user's id is not included in the list, it will be appended to the end. ##### Permissions Must have `create_group_channel` permission.
1353pub async fn create_group_channel(
1354    configuration: &configuration::Configuration,
1355    params: CreateGroupChannelParams,
1356) -> Result<crate::openapi::models::Channel, Error<CreateGroupChannelError>> {
1357    let local_var_configuration = configuration;
1358
1359    // unbox the parameters
1360    let request_body = params.request_body;
1361
1362    let local_var_client = &local_var_configuration.client;
1363
1364    let local_var_uri_str = format!(
1365        "{}/api/v4/channels/group",
1366        local_var_configuration.base_path
1367    );
1368    let mut local_var_req_builder =
1369        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1370
1371    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1372        local_var_req_builder =
1373            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1374    }
1375    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1376        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1377    };
1378    local_var_req_builder = local_var_req_builder.json(&request_body);
1379
1380    let local_var_req = local_var_req_builder.build()?;
1381    let local_var_resp = local_var_client.execute(local_var_req).await?;
1382
1383    let local_var_status = local_var_resp.status();
1384    let local_var_content = local_var_resp.text().await?;
1385
1386    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1387        serde_json::from_str(&local_var_content).map_err(Error::from)
1388    } else {
1389        let local_var_entity: Option<CreateGroupChannelError> =
1390            serde_json::from_str(&local_var_content).ok();
1391        let local_var_error = ResponseContent {
1392            status: local_var_status,
1393            content: local_var_content,
1394            entity: local_var_entity,
1395        };
1396        Err(Error::ResponseError(local_var_error))
1397    }
1398}
1399
1400/// Create a custom sidebar category for the user on the given team. __Minimum server version__: 5.26 ##### Permissions Must be authenticated and have the `list_team_channels` permission.
1401pub async fn create_sidebar_category_for_team_for_user(
1402    configuration: &configuration::Configuration,
1403    params: CreateSidebarCategoryForTeamForUserParams,
1404) -> Result<crate::openapi::models::SidebarCategory, Error<CreateSidebarCategoryForTeamForUserError>> {
1405    let local_var_configuration = configuration;
1406
1407    // unbox the parameters
1408    let team_id = params.team_id;
1409    let user_id = params.user_id;
1410    let sidebar_category = params.sidebar_category;
1411
1412    let local_var_client = &local_var_configuration.client;
1413
1414    let local_var_uri_str = format!(
1415        "{}/api/v4/users/{user_id}/teams/{team_id}/channels/categories",
1416        local_var_configuration.base_path,
1417        team_id = super::urlencode(team_id),
1418        user_id = super::urlencode(user_id)
1419    );
1420    let mut local_var_req_builder =
1421        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1422
1423    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1424        local_var_req_builder =
1425            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1426    }
1427    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1428        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1429    };
1430    local_var_req_builder = local_var_req_builder.json(&sidebar_category);
1431
1432    let local_var_req = local_var_req_builder.build()?;
1433    let local_var_resp = local_var_client.execute(local_var_req).await?;
1434
1435    let local_var_status = local_var_resp.status();
1436    let local_var_content = local_var_resp.text().await?;
1437
1438    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1439        serde_json::from_str(&local_var_content).map_err(Error::from)
1440    } else {
1441        let local_var_entity: Option<CreateSidebarCategoryForTeamForUserError> =
1442            serde_json::from_str(&local_var_content).ok();
1443        let local_var_error = ResponseContent {
1444            status: local_var_status,
1445            content: local_var_content,
1446            entity: local_var_entity,
1447        };
1448        Err(Error::ResponseError(local_var_error))
1449    }
1450}
1451
1452/// Archives a channel. This will set the `deleteAt` to the current timestamp in the database. Soft deleted channels may not be accessible in the user interface. They can be viewed and unarchived in the **System Console > User Management > Channels** based on your license. Direct and group message channels cannot be deleted.  As of server version 5.28, optionally use the `permanent=true` query parameter to permanently delete the channel for compliance reasons. To use this feature `ServiceSettings.EnableAPIChannelDeletion` must be set to `true` in the server's configuration.  If you permanently delete a channel this action is not recoverable outside of a database backup.  ##### Permissions `delete_public_channel` permission if the channel is public, `delete_private_channel` permission if the channel is private, or have `manage_system` permission.
1453pub async fn delete_channel(
1454    configuration: &configuration::Configuration,
1455    params: DeleteChannelParams,
1456) -> Result<crate::openapi::models::StatusOk, Error<DeleteChannelError>> {
1457    let local_var_configuration = configuration;
1458
1459    // unbox the parameters
1460    let channel_id = params.channel_id;
1461
1462    let local_var_client = &local_var_configuration.client;
1463
1464    let local_var_uri_str = format!(
1465        "{}/api/v4/channels/{channel_id}",
1466        local_var_configuration.base_path,
1467        channel_id = super::urlencode(channel_id)
1468    );
1469    let mut local_var_req_builder =
1470        local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
1471
1472    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1473        local_var_req_builder =
1474            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1475    }
1476    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1477        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1478    };
1479
1480    let local_var_req = local_var_req_builder.build()?;
1481    let local_var_resp = local_var_client.execute(local_var_req).await?;
1482
1483    let local_var_status = local_var_resp.status();
1484    let local_var_content = local_var_resp.text().await?;
1485
1486    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1487        serde_json::from_str(&local_var_content).map_err(Error::from)
1488    } else {
1489        let local_var_entity: Option<DeleteChannelError> =
1490            serde_json::from_str(&local_var_content).ok();
1491        let local_var_error = ResponseContent {
1492            status: local_var_status,
1493            content: local_var_content,
1494            entity: local_var_entity,
1495        };
1496        Err(Error::ResponseError(local_var_error))
1497    }
1498}
1499
1500/// ##### Permissions `manage_system`
1501pub async fn get_all_channels(
1502    configuration: &configuration::Configuration,
1503    params: GetAllChannelsParams,
1504) -> Result<Vec<crate::openapi::models::ChannelWithTeamData>, Error<GetAllChannelsError>> {
1505    let local_var_configuration = configuration;
1506
1507    // unbox the parameters
1508    let not_associated_to_group = params.not_associated_to_group;
1509    let page = params.page;
1510    let per_page = params.per_page;
1511    let exclude_default_channels = params.exclude_default_channels;
1512    let include_deleted = params.include_deleted;
1513    let include_total_count = params.include_total_count;
1514    let exclude_policy_constrained = params.exclude_policy_constrained;
1515
1516    let local_var_client = &local_var_configuration.client;
1517
1518    let local_var_uri_str = format!("{}/api/v4/channels", local_var_configuration.base_path);
1519    let mut local_var_req_builder =
1520        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1521
1522    if let Some(ref local_var_str) = not_associated_to_group {
1523        local_var_req_builder =
1524            local_var_req_builder.query(&[("not_associated_to_group", &local_var_str.to_string())]);
1525    }
1526    if let Some(ref local_var_str) = page {
1527        local_var_req_builder =
1528            local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1529    }
1530    if let Some(ref local_var_str) = per_page {
1531        local_var_req_builder =
1532            local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
1533    }
1534    if let Some(ref local_var_str) = exclude_default_channels {
1535        local_var_req_builder = local_var_req_builder
1536            .query(&[("exclude_default_channels", &local_var_str.to_string())]);
1537    }
1538    if let Some(ref local_var_str) = include_deleted {
1539        local_var_req_builder =
1540            local_var_req_builder.query(&[("include_deleted", &local_var_str.to_string())]);
1541    }
1542    if let Some(ref local_var_str) = include_total_count {
1543        local_var_req_builder =
1544            local_var_req_builder.query(&[("include_total_count", &local_var_str.to_string())]);
1545    }
1546    if let Some(ref local_var_str) = exclude_policy_constrained {
1547        local_var_req_builder = local_var_req_builder
1548            .query(&[("exclude_policy_constrained", &local_var_str.to_string())]);
1549    }
1550    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1551        local_var_req_builder =
1552            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1553    }
1554    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1555        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1556    };
1557
1558    let local_var_req = local_var_req_builder.build()?;
1559    let local_var_resp = local_var_client.execute(local_var_req).await?;
1560
1561    let local_var_status = local_var_resp.status();
1562    let local_var_content = local_var_resp.text().await?;
1563
1564    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1565        serde_json::from_str(&local_var_content).map_err(Error::from)
1566    } else {
1567        let local_var_entity: Option<GetAllChannelsError> =
1568            serde_json::from_str(&local_var_content).ok();
1569        let local_var_error = ResponseContent {
1570            status: local_var_status,
1571            content: local_var_content,
1572            entity: local_var_entity,
1573        };
1574        Err(Error::ResponseError(local_var_error))
1575    }
1576}
1577
1578/// Get channel from the provided channel id string. ##### Permissions `read_channel` permission for the channel.
1579pub async fn get_channel(
1580    configuration: &configuration::Configuration,
1581    params: GetChannelParams,
1582) -> Result<crate::openapi::models::Channel, Error<GetChannelError>> {
1583    let local_var_configuration = configuration;
1584
1585    // unbox the parameters
1586    let channel_id = params.channel_id;
1587
1588    let local_var_client = &local_var_configuration.client;
1589
1590    let local_var_uri_str = format!(
1591        "{}/api/v4/channels/{channel_id}",
1592        local_var_configuration.base_path,
1593        channel_id = super::urlencode(channel_id)
1594    );
1595    let mut local_var_req_builder =
1596        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1597
1598    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1599        local_var_req_builder =
1600            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1601    }
1602    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1603        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1604    };
1605
1606    let local_var_req = local_var_req_builder.build()?;
1607    let local_var_resp = local_var_client.execute(local_var_req).await?;
1608
1609    let local_var_status = local_var_resp.status();
1610    let local_var_content = local_var_resp.text().await?;
1611
1612    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1613        serde_json::from_str(&local_var_content).map_err(Error::from)
1614    } else {
1615        let local_var_entity: Option<GetChannelError> =
1616            serde_json::from_str(&local_var_content).ok();
1617        let local_var_error = ResponseContent {
1618            status: local_var_status,
1619            content: local_var_content,
1620            entity: local_var_entity,
1621        };
1622        Err(Error::ResponseError(local_var_error))
1623    }
1624}
1625
1626/// Gets channel from the provided team id and channel name strings. ##### Permissions `read_channel` permission for the channel.
1627pub async fn get_channel_by_name(
1628    configuration: &configuration::Configuration,
1629    params: GetChannelByNameParams,
1630) -> Result<crate::openapi::models::Channel, Error<GetChannelByNameError>> {
1631    let local_var_configuration = configuration;
1632
1633    // unbox the parameters
1634    let team_id = params.team_id;
1635    let channel_name = params.channel_name;
1636    let include_deleted = params.include_deleted;
1637
1638    let local_var_client = &local_var_configuration.client;
1639
1640    let local_var_uri_str = format!(
1641        "{}/api/v4/teams/{team_id}/channels/name/{channel_name}",
1642        local_var_configuration.base_path,
1643        team_id = super::urlencode(team_id),
1644        channel_name = super::urlencode(channel_name)
1645    );
1646    let mut local_var_req_builder =
1647        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1648
1649    if let Some(ref local_var_str) = include_deleted {
1650        local_var_req_builder =
1651            local_var_req_builder.query(&[("include_deleted", &local_var_str.to_string())]);
1652    }
1653    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1654        local_var_req_builder =
1655            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1656    }
1657    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1658        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1659    };
1660
1661    let local_var_req = local_var_req_builder.build()?;
1662    let local_var_resp = local_var_client.execute(local_var_req).await?;
1663
1664    let local_var_status = local_var_resp.status();
1665    let local_var_content = local_var_resp.text().await?;
1666
1667    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1668        serde_json::from_str(&local_var_content).map_err(Error::from)
1669    } else {
1670        let local_var_entity: Option<GetChannelByNameError> =
1671            serde_json::from_str(&local_var_content).ok();
1672        let local_var_error = ResponseContent {
1673            status: local_var_status,
1674            content: local_var_content,
1675            entity: local_var_entity,
1676        };
1677        Err(Error::ResponseError(local_var_error))
1678    }
1679}
1680
1681/// Gets a channel from the provided team name and channel name strings. ##### Permissions `read_channel` permission for the channel.
1682pub async fn get_channel_by_name_for_team_name(
1683    configuration: &configuration::Configuration,
1684    params: GetChannelByNameForTeamNameParams,
1685) -> Result<crate::openapi::models::Channel, Error<GetChannelByNameForTeamNameError>> {
1686    let local_var_configuration = configuration;
1687
1688    // unbox the parameters
1689    let team_name = params.team_name;
1690    let channel_name = params.channel_name;
1691    let include_deleted = params.include_deleted;
1692
1693    let local_var_client = &local_var_configuration.client;
1694
1695    let local_var_uri_str = format!(
1696        "{}/api/v4/teams/name/{team_name}/channels/name/{channel_name}",
1697        local_var_configuration.base_path,
1698        team_name = super::urlencode(team_name),
1699        channel_name = super::urlencode(channel_name)
1700    );
1701    let mut local_var_req_builder =
1702        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1703
1704    if let Some(ref local_var_str) = include_deleted {
1705        local_var_req_builder =
1706            local_var_req_builder.query(&[("include_deleted", &local_var_str.to_string())]);
1707    }
1708    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1709        local_var_req_builder =
1710            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1711    }
1712    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1713        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1714    };
1715
1716    let local_var_req = local_var_req_builder.build()?;
1717    let local_var_resp = local_var_client.execute(local_var_req).await?;
1718
1719    let local_var_status = local_var_resp.status();
1720    let local_var_content = local_var_resp.text().await?;
1721
1722    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1723        serde_json::from_str(&local_var_content).map_err(Error::from)
1724    } else {
1725        let local_var_entity: Option<GetChannelByNameForTeamNameError> =
1726            serde_json::from_str(&local_var_content).ok();
1727        let local_var_error = ResponseContent {
1728            status: local_var_status,
1729            content: local_var_content,
1730            entity: local_var_entity,
1731        };
1732        Err(Error::ResponseError(local_var_error))
1733    }
1734}
1735
1736/// Get a channel member. ##### Permissions `read_channel` permission for the channel.
1737pub async fn get_channel_member(
1738    configuration: &configuration::Configuration,
1739    params: GetChannelMemberParams,
1740) -> Result<crate::openapi::models::ChannelMember, Error<GetChannelMemberError>> {
1741    let local_var_configuration = configuration;
1742
1743    // unbox the parameters
1744    let channel_id = params.channel_id;
1745    let user_id = params.user_id;
1746
1747    let local_var_client = &local_var_configuration.client;
1748
1749    let local_var_uri_str = format!(
1750        "{}/api/v4/channels/{channel_id}/members/{user_id}",
1751        local_var_configuration.base_path,
1752        channel_id = super::urlencode(channel_id),
1753        user_id = super::urlencode(user_id)
1754    );
1755    let mut local_var_req_builder =
1756        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1757
1758    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1759        local_var_req_builder =
1760            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1761    }
1762    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1763        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1764    };
1765
1766    let local_var_req = local_var_req_builder.build()?;
1767    let local_var_resp = local_var_client.execute(local_var_req).await?;
1768
1769    let local_var_status = local_var_resp.status();
1770    let local_var_content = local_var_resp.text().await?;
1771
1772    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1773        serde_json::from_str(&local_var_content).map_err(Error::from)
1774    } else {
1775        let local_var_entity: Option<GetChannelMemberError> =
1776            serde_json::from_str(&local_var_content).ok();
1777        let local_var_error = ResponseContent {
1778            status: local_var_status,
1779            content: local_var_content,
1780            entity: local_var_entity,
1781        };
1782        Err(Error::ResponseError(local_var_error))
1783    }
1784}
1785
1786/// Returns a set of ChannelMemberCountByGroup objects which contain a `group_id`, `channel_member_count` and a `channel_member_timezones_count`. ##### Permissions Must have `read_channel` permission for the given channel. __Minimum server version__: 5.24
1787pub async fn get_channel_member_counts_by_group(
1788    configuration: &configuration::Configuration,
1789    params: GetChannelMemberCountsByGroupParams,
1790) -> Result<(), Error<GetChannelMemberCountsByGroupError>> {
1791    let local_var_configuration = configuration;
1792
1793    // unbox the parameters
1794    let channel_id = params.channel_id;
1795    let include_timezones = params.include_timezones;
1796
1797    let local_var_client = &local_var_configuration.client;
1798
1799    let local_var_uri_str = format!(
1800        "{}/api/v4/channels/{channel_id}/member_counts_by_group",
1801        local_var_configuration.base_path,
1802        channel_id = super::urlencode(channel_id)
1803    );
1804    let mut local_var_req_builder =
1805        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1806
1807    if let Some(ref local_var_str) = include_timezones {
1808        local_var_req_builder =
1809            local_var_req_builder.query(&[("include_timezones", &local_var_str.to_string())]);
1810    }
1811    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1812        local_var_req_builder =
1813            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1814    }
1815    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1816        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1817    };
1818
1819    let local_var_req = local_var_req_builder.build()?;
1820    let local_var_resp = local_var_client.execute(local_var_req).await?;
1821
1822    let local_var_status = local_var_resp.status();
1823    let local_var_content = local_var_resp.text().await?;
1824
1825    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1826        Ok(())
1827    } else {
1828        let local_var_entity: Option<GetChannelMemberCountsByGroupError> =
1829            serde_json::from_str(&local_var_content).ok();
1830        let local_var_error = ResponseContent {
1831            status: local_var_status,
1832            content: local_var_content,
1833            entity: local_var_entity,
1834        };
1835        Err(Error::ResponseError(local_var_error))
1836    }
1837}
1838
1839/// Get a page of members for a channel. ##### Permissions `read_channel` permission for the channel.
1840pub async fn get_channel_members(
1841    configuration: &configuration::Configuration,
1842    params: GetChannelMembersParams,
1843) -> Result<Vec<crate::openapi::models::ChannelMember>, Error<GetChannelMembersError>> {
1844    let local_var_configuration = configuration;
1845
1846    // unbox the parameters
1847    let channel_id = params.channel_id;
1848    let page = params.page;
1849    let per_page = params.per_page;
1850
1851    let local_var_client = &local_var_configuration.client;
1852
1853    let local_var_uri_str = format!(
1854        "{}/api/v4/channels/{channel_id}/members",
1855        local_var_configuration.base_path,
1856        channel_id = super::urlencode(channel_id)
1857    );
1858    let mut local_var_req_builder =
1859        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1860
1861    if let Some(ref local_var_str) = page {
1862        local_var_req_builder =
1863            local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1864    }
1865    if let Some(ref local_var_str) = per_page {
1866        local_var_req_builder =
1867            local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
1868    }
1869    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1870        local_var_req_builder =
1871            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1872    }
1873    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1874        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1875    };
1876
1877    let local_var_req = local_var_req_builder.build()?;
1878    let local_var_resp = local_var_client.execute(local_var_req).await?;
1879
1880    let local_var_status = local_var_resp.status();
1881    let local_var_content = local_var_resp.text().await?;
1882
1883    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1884        serde_json::from_str(&local_var_content).map_err(Error::from)
1885    } else {
1886        let local_var_entity: Option<GetChannelMembersError> =
1887            serde_json::from_str(&local_var_content).ok();
1888        let local_var_error = ResponseContent {
1889            status: local_var_status,
1890            content: local_var_content,
1891            entity: local_var_entity,
1892        };
1893        Err(Error::ResponseError(local_var_error))
1894    }
1895}
1896
1897/// Get a list of channel members based on the provided user ids. ##### Permissions Must have the `read_channel` permission.
1898pub async fn get_channel_members_by_ids(
1899    configuration: &configuration::Configuration,
1900    params: GetChannelMembersByIdsParams,
1901) -> Result<Vec<crate::openapi::models::ChannelMember>, Error<GetChannelMembersByIdsError>> {
1902    let local_var_configuration = configuration;
1903
1904    // unbox the parameters
1905    let channel_id = params.channel_id;
1906    let request_body = params.request_body;
1907
1908    let local_var_client = &local_var_configuration.client;
1909
1910    let local_var_uri_str = format!(
1911        "{}/api/v4/channels/{channel_id}/members/ids",
1912        local_var_configuration.base_path,
1913        channel_id = super::urlencode(channel_id)
1914    );
1915    let mut local_var_req_builder =
1916        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1917
1918    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1919        local_var_req_builder =
1920            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1921    }
1922    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1923        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1924    };
1925    local_var_req_builder = local_var_req_builder.json(&request_body);
1926
1927    let local_var_req = local_var_req_builder.build()?;
1928    let local_var_resp = local_var_client.execute(local_var_req).await?;
1929
1930    let local_var_status = local_var_resp.status();
1931    let local_var_content = local_var_resp.text().await?;
1932
1933    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1934        serde_json::from_str(&local_var_content).map_err(Error::from)
1935    } else {
1936        let local_var_entity: Option<GetChannelMembersByIdsError> =
1937            serde_json::from_str(&local_var_content).ok();
1938        let local_var_error = ResponseContent {
1939            status: local_var_status,
1940            content: local_var_content,
1941            entity: local_var_entity,
1942        };
1943        Err(Error::ResponseError(local_var_error))
1944    }
1945}
1946
1947/// Get all channel memberships and associated membership roles (i.e. `channel_user`, `channel_admin`) for a user on a specific team. ##### Permissions Logged in as the user and `view_team` permission for the team. Having `manage_system` permission voids the previous requirements.
1948pub async fn get_channel_members_for_user(
1949    configuration: &configuration::Configuration,
1950    params: GetChannelMembersForUserParams,
1951) -> Result<Vec<crate::openapi::models::ChannelMember>, Error<GetChannelMembersForUserError>> {
1952    let local_var_configuration = configuration;
1953
1954    // unbox the parameters
1955    let user_id = params.user_id;
1956    let team_id = params.team_id;
1957
1958    let local_var_client = &local_var_configuration.client;
1959
1960    let local_var_uri_str = format!(
1961        "{}/api/v4/users/{user_id}/teams/{team_id}/channels/members",
1962        local_var_configuration.base_path,
1963        user_id = super::urlencode(user_id),
1964        team_id = super::urlencode(team_id)
1965    );
1966    let mut local_var_req_builder =
1967        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1968
1969    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1970        local_var_req_builder =
1971            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1972    }
1973    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1974        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1975    };
1976
1977    let local_var_req = local_var_req_builder.build()?;
1978    let local_var_resp = local_var_client.execute(local_var_req).await?;
1979
1980    let local_var_status = local_var_resp.status();
1981    let local_var_content = local_var_resp.text().await?;
1982
1983    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1984        serde_json::from_str(&local_var_content).map_err(Error::from)
1985    } else {
1986        let local_var_entity: Option<GetChannelMembersForUserError> =
1987            serde_json::from_str(&local_var_content).ok();
1988        let local_var_error = ResponseContent {
1989            status: local_var_status,
1990            content: local_var_content,
1991            entity: local_var_entity,
1992        };
1993        Err(Error::ResponseError(local_var_error))
1994    }
1995}
1996
1997/// Get a list of timezones for the users who are in this channel.  __Minimum server version__: 5.6  ##### Permissions Must have the `read_channel` permission.
1998pub async fn get_channel_members_timezones(
1999    configuration: &configuration::Configuration,
2000    params: GetChannelMembersTimezonesParams,
2001) -> Result<Vec<String>, Error<GetChannelMembersTimezonesError>> {
2002    let local_var_configuration = configuration;
2003
2004    // unbox the parameters
2005    let channel_id = params.channel_id;
2006
2007    let local_var_client = &local_var_configuration.client;
2008
2009    let local_var_uri_str = format!(
2010        "{}/api/v4/channels/{channel_id}/timezones",
2011        local_var_configuration.base_path,
2012        channel_id = super::urlencode(channel_id)
2013    );
2014    let mut local_var_req_builder =
2015        local_var_client.request(reqwest::Method::GET, 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 =
2019            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2020    }
2021    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2022        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2023    };
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        serde_json::from_str(&local_var_content).map_err(Error::from)
2033    } else {
2034        let local_var_entity: Option<GetChannelMembersTimezonesError> =
2035            serde_json::from_str(&local_var_content).ok();
2036        let local_var_error = ResponseContent {
2037            status: local_var_status,
2038            content: local_var_content,
2039            entity: local_var_entity,
2040        };
2041        Err(Error::ResponseError(local_var_error))
2042    }
2043}
2044
2045/// ##### Permissions Must have `manage_system` permission.  __Minimum server version__: 5.22
2046pub async fn get_channel_moderations(
2047    configuration: &configuration::Configuration,
2048    params: GetChannelModerationsParams,
2049) -> Result<Vec<crate::openapi::models::ChannelModeration>, Error<GetChannelModerationsError>> {
2050    let local_var_configuration = configuration;
2051
2052    // unbox the parameters
2053    let channel_id = params.channel_id;
2054
2055    let local_var_client = &local_var_configuration.client;
2056
2057    let local_var_uri_str = format!(
2058        "{}/api/v4/channels/{channel_id}/moderations",
2059        local_var_configuration.base_path,
2060        channel_id = super::urlencode(channel_id)
2061    );
2062    let mut local_var_req_builder =
2063        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2064
2065    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2066        local_var_req_builder =
2067            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2068    }
2069    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2070        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2071    };
2072
2073    let local_var_req = local_var_req_builder.build()?;
2074    let local_var_resp = local_var_client.execute(local_var_req).await?;
2075
2076    let local_var_status = local_var_resp.status();
2077    let local_var_content = local_var_resp.text().await?;
2078
2079    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2080        serde_json::from_str(&local_var_content).map_err(Error::from)
2081    } else {
2082        let local_var_entity: Option<GetChannelModerationsError> =
2083            serde_json::from_str(&local_var_content).ok();
2084        let local_var_error = ResponseContent {
2085            status: local_var_status,
2086            content: local_var_content,
2087            entity: local_var_entity,
2088        };
2089        Err(Error::ResponseError(local_var_error))
2090    }
2091}
2092
2093/// Get statistics for a channel. ##### Permissions Must have the `read_channel` permission.
2094pub async fn get_channel_stats(
2095    configuration: &configuration::Configuration,
2096    params: GetChannelStatsParams,
2097) -> Result<crate::openapi::models::ChannelStats, Error<GetChannelStatsError>> {
2098    let local_var_configuration = configuration;
2099
2100    // unbox the parameters
2101    let channel_id = params.channel_id;
2102
2103    let local_var_client = &local_var_configuration.client;
2104
2105    let local_var_uri_str = format!(
2106        "{}/api/v4/channels/{channel_id}/stats",
2107        local_var_configuration.base_path,
2108        channel_id = super::urlencode(channel_id)
2109    );
2110    let mut local_var_req_builder =
2111        local_var_client.request(reqwest::Method::GET, 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 =
2115            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2116    }
2117    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2118        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2119    };
2120
2121    let local_var_req = local_var_req_builder.build()?;
2122    let local_var_resp = local_var_client.execute(local_var_req).await?;
2123
2124    let local_var_status = local_var_resp.status();
2125    let local_var_content = local_var_resp.text().await?;
2126
2127    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2128        serde_json::from_str(&local_var_content).map_err(Error::from)
2129    } else {
2130        let local_var_entity: Option<GetChannelStatsError> =
2131            serde_json::from_str(&local_var_content).ok();
2132        let local_var_error = ResponseContent {
2133            status: local_var_status,
2134            content: local_var_content,
2135            entity: local_var_entity,
2136        };
2137        Err(Error::ResponseError(local_var_error))
2138    }
2139}
2140
2141/// Get the total unread messages and mentions for a channel for a user. ##### Permissions Must be logged in as user and have the `read_channel` permission, or have `edit_other_usrs` permission.
2142pub async fn get_channel_unread(
2143    configuration: &configuration::Configuration,
2144    params: GetChannelUnreadParams,
2145) -> Result<crate::openapi::models::ChannelUnread, Error<GetChannelUnreadError>> {
2146    let local_var_configuration = configuration;
2147
2148    // unbox the parameters
2149    let user_id = params.user_id;
2150    let channel_id = params.channel_id;
2151
2152    let local_var_client = &local_var_configuration.client;
2153
2154    let local_var_uri_str = format!(
2155        "{}/api/v4/users/{user_id}/channels/{channel_id}/unread",
2156        local_var_configuration.base_path,
2157        user_id = super::urlencode(user_id),
2158        channel_id = super::urlencode(channel_id)
2159    );
2160    let mut local_var_req_builder =
2161        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2162
2163    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2164        local_var_req_builder =
2165            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2166    }
2167    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2168        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2169    };
2170
2171    let local_var_req = local_var_req_builder.build()?;
2172    let local_var_resp = local_var_client.execute(local_var_req).await?;
2173
2174    let local_var_status = local_var_resp.status();
2175    let local_var_content = local_var_resp.text().await?;
2176
2177    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2178        serde_json::from_str(&local_var_content).map_err(Error::from)
2179    } else {
2180        let local_var_entity: Option<GetChannelUnreadError> =
2181            serde_json::from_str(&local_var_content).ok();
2182        let local_var_error = ResponseContent {
2183            status: local_var_status,
2184            content: local_var_content,
2185            entity: local_var_entity,
2186        };
2187        Err(Error::ResponseError(local_var_error))
2188    }
2189}
2190
2191/// Get all the channels on a team for a user. ##### Permissions Logged in as the user, or have `edit_other_users` permission, and `view_team` permission for the team.
2192pub async fn get_channels_for_team_for_user(
2193    configuration: &configuration::Configuration,
2194    params: GetChannelsForTeamForUserParams,
2195) -> Result<Vec<crate::openapi::models::Channel>, Error<GetChannelsForTeamForUserError>> {
2196    let local_var_configuration = configuration;
2197
2198    // unbox the parameters
2199    let user_id = params.user_id;
2200    let team_id = params.team_id;
2201    let include_deleted = params.include_deleted;
2202    let last_delete_at = params.last_delete_at;
2203
2204    let local_var_client = &local_var_configuration.client;
2205
2206    let local_var_uri_str = format!(
2207        "{}/api/v4/users/{user_id}/teams/{team_id}/channels",
2208        local_var_configuration.base_path,
2209        user_id = super::urlencode(user_id),
2210        team_id = super::urlencode(team_id)
2211    );
2212    let mut local_var_req_builder =
2213        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2214
2215    if let Some(ref local_var_str) = include_deleted {
2216        local_var_req_builder =
2217            local_var_req_builder.query(&[("include_deleted", &local_var_str.to_string())]);
2218    }
2219    if let Some(ref local_var_str) = last_delete_at {
2220        local_var_req_builder =
2221            local_var_req_builder.query(&[("last_delete_at", &local_var_str.to_string())]);
2222    }
2223    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2224        local_var_req_builder =
2225            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2226    }
2227    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2228        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2229    };
2230
2231    let local_var_req = local_var_req_builder.build()?;
2232    let local_var_resp = local_var_client.execute(local_var_req).await?;
2233
2234    let local_var_status = local_var_resp.status();
2235    let local_var_content = local_var_resp.text().await?;
2236
2237    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2238        serde_json::from_str(&local_var_content).map_err(Error::from)
2239    } else {
2240        let local_var_entity: Option<GetChannelsForTeamForUserError> =
2241            serde_json::from_str(&local_var_content).ok();
2242        let local_var_error = ResponseContent {
2243            status: local_var_status,
2244            content: local_var_content,
2245            entity: local_var_entity,
2246        };
2247        Err(Error::ResponseError(local_var_error))
2248    }
2249}
2250
2251/// Get all channels from all teams that a user is a member of.  __Minimum server version__: 6.1  ##### Permissions  Logged in as the user, or have `edit_other_users` permission.
2252pub async fn get_channels_for_user(
2253    configuration: &configuration::Configuration,
2254    params: GetChannelsForUserParams,
2255) -> Result<Vec<crate::openapi::models::Channel>, Error<GetChannelsForUserError>> {
2256    let local_var_configuration = configuration;
2257
2258    // unbox the parameters
2259    let user_id = params.user_id;
2260    let last_delete_at = params.last_delete_at;
2261    let include_deleted = params.include_deleted;
2262
2263    let local_var_client = &local_var_configuration.client;
2264
2265    let local_var_uri_str = format!(
2266        "{}/api/v4/users/{user_id}/channels",
2267        local_var_configuration.base_path,
2268        user_id = super::urlencode(user_id)
2269    );
2270    let mut local_var_req_builder =
2271        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2272
2273    if let Some(ref local_var_str) = last_delete_at {
2274        local_var_req_builder =
2275            local_var_req_builder.query(&[("last_delete_at", &local_var_str.to_string())]);
2276    }
2277    if let Some(ref local_var_str) = include_deleted {
2278        local_var_req_builder =
2279            local_var_req_builder.query(&[("include_deleted", &local_var_str.to_string())]);
2280    }
2281    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2282        local_var_req_builder =
2283            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2284    }
2285    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2286        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2287    };
2288
2289    let local_var_req = local_var_req_builder.build()?;
2290    let local_var_resp = local_var_client.execute(local_var_req).await?;
2291
2292    let local_var_status = local_var_resp.status();
2293    let local_var_content = local_var_resp.text().await?;
2294
2295    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2296        serde_json::from_str(&local_var_content).map_err(Error::from)
2297    } else {
2298        let local_var_entity: Option<GetChannelsForUserError> =
2299            serde_json::from_str(&local_var_content).ok();
2300        let local_var_error = ResponseContent {
2301            status: local_var_status,
2302            content: local_var_content,
2303            entity: local_var_entity,
2304        };
2305        Err(Error::ResponseError(local_var_error))
2306    }
2307}
2308
2309/// Get a page of deleted channels on a team based on query string parameters - team_id, page and per_page.  __Minimum server version__: 3.10
2310pub async fn get_deleted_channels_for_team(
2311    configuration: &configuration::Configuration,
2312    params: GetDeletedChannelsForTeamParams,
2313) -> Result<Vec<crate::openapi::models::Channel>, Error<GetDeletedChannelsForTeamError>> {
2314    let local_var_configuration = configuration;
2315
2316    // unbox the parameters
2317    let team_id = params.team_id;
2318    let page = params.page;
2319    let per_page = params.per_page;
2320
2321    let local_var_client = &local_var_configuration.client;
2322
2323    let local_var_uri_str = format!(
2324        "{}/api/v4/teams/{team_id}/channels/deleted",
2325        local_var_configuration.base_path,
2326        team_id = super::urlencode(team_id)
2327    );
2328    let mut local_var_req_builder =
2329        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2330
2331    if let Some(ref local_var_str) = page {
2332        local_var_req_builder =
2333            local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
2334    }
2335    if let Some(ref local_var_str) = per_page {
2336        local_var_req_builder =
2337            local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
2338    }
2339    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2340        local_var_req_builder =
2341            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2342    }
2343    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2344        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2345    };
2346
2347    let local_var_req = local_var_req_builder.build()?;
2348    let local_var_resp = local_var_client.execute(local_var_req).await?;
2349
2350    let local_var_status = local_var_resp.status();
2351    let local_var_content = local_var_resp.text().await?;
2352
2353    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2354        serde_json::from_str(&local_var_content).map_err(Error::from)
2355    } else {
2356        let local_var_entity: Option<GetDeletedChannelsForTeamError> =
2357            serde_json::from_str(&local_var_content).ok();
2358        let local_var_error = ResponseContent {
2359            status: local_var_status,
2360            content: local_var_content,
2361            entity: local_var_entity,
2362        };
2363        Err(Error::ResponseError(local_var_error))
2364    }
2365}
2366
2367/// Get a list of pinned posts for channel.
2368pub async fn get_pinned_posts(
2369    configuration: &configuration::Configuration,
2370    params: GetPinnedPostsParams,
2371) -> Result<crate::openapi::models::PostList, Error<GetPinnedPostsError>> {
2372    let local_var_configuration = configuration;
2373
2374    // unbox the parameters
2375    let channel_id = params.channel_id;
2376
2377    let local_var_client = &local_var_configuration.client;
2378
2379    let local_var_uri_str = format!(
2380        "{}/api/v4/channels/{channel_id}/pinned",
2381        local_var_configuration.base_path,
2382        channel_id = super::urlencode(channel_id)
2383    );
2384    let mut local_var_req_builder =
2385        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2386
2387    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2388        local_var_req_builder =
2389            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2390    }
2391    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2392        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2393    };
2394
2395    let local_var_req = local_var_req_builder.build()?;
2396    let local_var_resp = local_var_client.execute(local_var_req).await?;
2397
2398    let local_var_status = local_var_resp.status();
2399    let local_var_content = local_var_resp.text().await?;
2400
2401    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2402        serde_json::from_str(&local_var_content).map_err(Error::from)
2403    } else {
2404        let local_var_entity: Option<GetPinnedPostsError> =
2405            serde_json::from_str(&local_var_content).ok();
2406        let local_var_error = ResponseContent {
2407            status: local_var_status,
2408            content: local_var_content,
2409            entity: local_var_entity,
2410        };
2411        Err(Error::ResponseError(local_var_error))
2412    }
2413}
2414
2415/// Get a page of private channels on a team based on query string parameters - team_id, page and per_page.  __Minimum server version__: 5.26  ##### Permissions Must have `manage_system` permission.
2416pub async fn get_private_channels_for_team(
2417    configuration: &configuration::Configuration,
2418    params: GetPrivateChannelsForTeamParams,
2419) -> Result<Vec<crate::openapi::models::Channel>, Error<GetPrivateChannelsForTeamError>> {
2420    let local_var_configuration = configuration;
2421
2422    // unbox the parameters
2423    let team_id = params.team_id;
2424    let page = params.page;
2425    let per_page = params.per_page;
2426
2427    let local_var_client = &local_var_configuration.client;
2428
2429    let local_var_uri_str = format!(
2430        "{}/api/v4/teams/{team_id}/channels/private",
2431        local_var_configuration.base_path,
2432        team_id = super::urlencode(team_id)
2433    );
2434    let mut local_var_req_builder =
2435        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2436
2437    if let Some(ref local_var_str) = page {
2438        local_var_req_builder =
2439            local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
2440    }
2441    if let Some(ref local_var_str) = per_page {
2442        local_var_req_builder =
2443            local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
2444    }
2445    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2446        local_var_req_builder =
2447            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2448    }
2449    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2450        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2451    };
2452
2453    let local_var_req = local_var_req_builder.build()?;
2454    let local_var_resp = local_var_client.execute(local_var_req).await?;
2455
2456    let local_var_status = local_var_resp.status();
2457    let local_var_content = local_var_resp.text().await?;
2458
2459    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2460        serde_json::from_str(&local_var_content).map_err(Error::from)
2461    } else {
2462        let local_var_entity: Option<GetPrivateChannelsForTeamError> =
2463            serde_json::from_str(&local_var_content).ok();
2464        let local_var_error = ResponseContent {
2465            status: local_var_status,
2466            content: local_var_content,
2467            entity: local_var_entity,
2468        };
2469        Err(Error::ResponseError(local_var_error))
2470    }
2471}
2472
2473/// Get a list of public channels on a team by id. ##### Permissions `view_team` for the team the channels are on.
2474pub async fn get_public_channels_by_ids_for_team(
2475    configuration: &configuration::Configuration,
2476    params: GetPublicChannelsByIdsForTeamParams,
2477) -> Result<Vec<crate::openapi::models::Channel>, Error<GetPublicChannelsByIdsForTeamError>> {
2478    let local_var_configuration = configuration;
2479
2480    // unbox the parameters
2481    let team_id = params.team_id;
2482    let request_body = params.request_body;
2483
2484    let local_var_client = &local_var_configuration.client;
2485
2486    let local_var_uri_str = format!(
2487        "{}/api/v4/teams/{team_id}/channels/ids",
2488        local_var_configuration.base_path,
2489        team_id = super::urlencode(team_id)
2490    );
2491    let mut local_var_req_builder =
2492        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2493
2494    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2495        local_var_req_builder =
2496            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2497    }
2498    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2499        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2500    };
2501    local_var_req_builder = local_var_req_builder.json(&request_body);
2502
2503    let local_var_req = local_var_req_builder.build()?;
2504    let local_var_resp = local_var_client.execute(local_var_req).await?;
2505
2506    let local_var_status = local_var_resp.status();
2507    let local_var_content = local_var_resp.text().await?;
2508
2509    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2510        serde_json::from_str(&local_var_content).map_err(Error::from)
2511    } else {
2512        let local_var_entity: Option<GetPublicChannelsByIdsForTeamError> =
2513            serde_json::from_str(&local_var_content).ok();
2514        let local_var_error = ResponseContent {
2515            status: local_var_status,
2516            content: local_var_content,
2517            entity: local_var_entity,
2518        };
2519        Err(Error::ResponseError(local_var_error))
2520    }
2521}
2522
2523/// Get a page of public channels on a team based on query string parameters - page and per_page. ##### Permissions Must be authenticated and have the `list_team_channels` permission.
2524pub async fn get_public_channels_for_team(
2525    configuration: &configuration::Configuration,
2526    params: GetPublicChannelsForTeamParams,
2527) -> Result<Vec<crate::openapi::models::Channel>, Error<GetPublicChannelsForTeamError>> {
2528    let local_var_configuration = configuration;
2529
2530    // unbox the parameters
2531    let team_id = params.team_id;
2532    let page = params.page;
2533    let per_page = params.per_page;
2534
2535    let local_var_client = &local_var_configuration.client;
2536
2537    let local_var_uri_str = format!(
2538        "{}/api/v4/teams/{team_id}/channels",
2539        local_var_configuration.base_path,
2540        team_id = super::urlencode(team_id)
2541    );
2542    let mut local_var_req_builder =
2543        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2544
2545    if let Some(ref local_var_str) = page {
2546        local_var_req_builder =
2547            local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
2548    }
2549    if let Some(ref local_var_str) = per_page {
2550        local_var_req_builder =
2551            local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
2552    }
2553    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2554        local_var_req_builder =
2555            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2556    }
2557    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2558        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2559    };
2560
2561    let local_var_req = local_var_req_builder.build()?;
2562    let local_var_resp = local_var_client.execute(local_var_req).await?;
2563
2564    let local_var_status = local_var_resp.status();
2565    let local_var_content = local_var_resp.text().await?;
2566
2567    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2568        serde_json::from_str(&local_var_content).map_err(Error::from)
2569    } else {
2570        let local_var_entity: Option<GetPublicChannelsForTeamError> =
2571            serde_json::from_str(&local_var_content).ok();
2572        let local_var_error = ResponseContent {
2573            status: local_var_status,
2574            content: local_var_content,
2575            entity: local_var_entity,
2576        };
2577        Err(Error::ResponseError(local_var_error))
2578    }
2579}
2580
2581/// Get a list of sidebar categories that will appear in the user's sidebar on the given team, including a list of channel IDs in each category. __Minimum server version__: 5.26 ##### Permissions Must be authenticated and have the `list_team_channels` permission.
2582pub async fn get_sidebar_categories_for_team_for_user(
2583    configuration: &configuration::Configuration,
2584    params: GetSidebarCategoriesForTeamForUserParams,
2585) -> Result<
2586    Vec<crate::openapi::models::OrderedSidebarCategories>,
2587    Error<GetSidebarCategoriesForTeamForUserError>,
2588> {
2589    let local_var_configuration = configuration;
2590
2591    // unbox the parameters
2592    let team_id = params.team_id;
2593    let user_id = params.user_id;
2594
2595    let local_var_client = &local_var_configuration.client;
2596
2597    let local_var_uri_str = format!(
2598        "{}/api/v4/users/{user_id}/teams/{team_id}/channels/categories",
2599        local_var_configuration.base_path,
2600        team_id = super::urlencode(team_id),
2601        user_id = super::urlencode(user_id)
2602    );
2603    let mut local_var_req_builder =
2604        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2605
2606    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2607        local_var_req_builder =
2608            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2609    }
2610    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2611        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2612    };
2613
2614    let local_var_req = local_var_req_builder.build()?;
2615    let local_var_resp = local_var_client.execute(local_var_req).await?;
2616
2617    let local_var_status = local_var_resp.status();
2618    let local_var_content = local_var_resp.text().await?;
2619
2620    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2621        serde_json::from_str(&local_var_content).map_err(Error::from)
2622    } else {
2623        let local_var_entity: Option<GetSidebarCategoriesForTeamForUserError> =
2624            serde_json::from_str(&local_var_content).ok();
2625        let local_var_error = ResponseContent {
2626            status: local_var_status,
2627            content: local_var_content,
2628            entity: local_var_entity,
2629        };
2630        Err(Error::ResponseError(local_var_error))
2631    }
2632}
2633
2634/// Returns a single sidebar category for the user on the given team. __Minimum server version__: 5.26 ##### Permissions Must be authenticated and have the `list_team_channels` permission.
2635pub async fn get_sidebar_category_for_team_for_user(
2636    configuration: &configuration::Configuration,
2637    params: GetSidebarCategoryForTeamForUserParams,
2638) -> Result<crate::openapi::models::SidebarCategory, Error<GetSidebarCategoryForTeamForUserError>> {
2639    let local_var_configuration = configuration;
2640
2641    // unbox the parameters
2642    let team_id = params.team_id;
2643    let user_id = params.user_id;
2644    let category_id = params.category_id;
2645
2646    let local_var_client = &local_var_configuration.client;
2647
2648    let local_var_uri_str = format!(
2649        "{}/api/v4/users/{user_id}/teams/{team_id}/channels/categories/{category_id}",
2650        local_var_configuration.base_path,
2651        team_id = super::urlencode(team_id),
2652        user_id = super::urlencode(user_id),
2653        category_id = super::urlencode(category_id)
2654    );
2655    let mut local_var_req_builder =
2656        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2657
2658    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2659        local_var_req_builder =
2660            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2661    }
2662    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2663        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2664    };
2665
2666    let local_var_req = local_var_req_builder.build()?;
2667    let local_var_resp = local_var_client.execute(local_var_req).await?;
2668
2669    let local_var_status = local_var_resp.status();
2670    let local_var_content = local_var_resp.text().await?;
2671
2672    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2673        serde_json::from_str(&local_var_content).map_err(Error::from)
2674    } else {
2675        let local_var_entity: Option<GetSidebarCategoryForTeamForUserError> =
2676            serde_json::from_str(&local_var_content).ok();
2677        let local_var_error = ResponseContent {
2678            status: local_var_status,
2679            content: local_var_content,
2680            entity: local_var_entity,
2681        };
2682        Err(Error::ResponseError(local_var_error))
2683    }
2684}
2685
2686/// Returns the order of the sidebar categories for a user on the given team as an array of IDs. __Minimum server version__: 5.26 ##### Permissions Must be authenticated and have the `list_team_channels` permission.
2687pub async fn get_sidebar_category_order_for_team_for_user(
2688    configuration: &configuration::Configuration,
2689    params: GetSidebarCategoryOrderForTeamForUserParams,
2690) -> Result<Vec<String>, Error<GetSidebarCategoryOrderForTeamForUserError>> {
2691    let local_var_configuration = configuration;
2692
2693    // unbox the parameters
2694    let team_id = params.team_id;
2695    let user_id = params.user_id;
2696
2697    let local_var_client = &local_var_configuration.client;
2698
2699    let local_var_uri_str = format!(
2700        "{}/api/v4/users/{user_id}/teams/{team_id}/channels/categories/order",
2701        local_var_configuration.base_path,
2702        team_id = super::urlencode(team_id),
2703        user_id = super::urlencode(user_id)
2704    );
2705    let mut local_var_req_builder =
2706        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2707
2708    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2709        local_var_req_builder =
2710            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2711    }
2712    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2713        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2714    };
2715
2716    let local_var_req = local_var_req_builder.build()?;
2717    let local_var_resp = local_var_client.execute(local_var_req).await?;
2718
2719    let local_var_status = local_var_resp.status();
2720    let local_var_content = local_var_resp.text().await?;
2721
2722    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2723        serde_json::from_str(&local_var_content).map_err(Error::from)
2724    } else {
2725        let local_var_entity: Option<GetSidebarCategoryOrderForTeamForUserError> =
2726            serde_json::from_str(&local_var_content).ok();
2727        let local_var_error = ResponseContent {
2728            status: local_var_status,
2729            content: local_var_content,
2730            entity: local_var_entity,
2731        };
2732        Err(Error::ResponseError(local_var_error))
2733    }
2734}
2735
2736/// Move a channel to another team.  __Minimum server version__: 5.26  ##### Permissions  Must have `manage_system` permission.
2737pub async fn move_channel(
2738    configuration: &configuration::Configuration,
2739    params: MoveChannelParams,
2740) -> Result<crate::openapi::models::Channel, Error<MoveChannelError>> {
2741    let local_var_configuration = configuration;
2742
2743    // unbox the parameters
2744    let channel_id = params.channel_id;
2745    let move_channel_request = params.move_channel_request;
2746
2747    let local_var_client = &local_var_configuration.client;
2748
2749    let local_var_uri_str = format!(
2750        "{}/api/v4/channels/{channel_id}/move",
2751        local_var_configuration.base_path,
2752        channel_id = super::urlencode(channel_id)
2753    );
2754    let mut local_var_req_builder =
2755        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2756
2757    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2758        local_var_req_builder =
2759            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2760    }
2761    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2762        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2763    };
2764    local_var_req_builder = local_var_req_builder.json(&move_channel_request);
2765
2766    let local_var_req = local_var_req_builder.build()?;
2767    let local_var_resp = local_var_client.execute(local_var_req).await?;
2768
2769    let local_var_status = local_var_resp.status();
2770    let local_var_content = local_var_resp.text().await?;
2771
2772    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2773        serde_json::from_str(&local_var_content).map_err(Error::from)
2774    } else {
2775        let local_var_entity: Option<MoveChannelError> =
2776            serde_json::from_str(&local_var_content).ok();
2777        let local_var_error = ResponseContent {
2778            status: local_var_status,
2779            content: local_var_content,
2780            entity: local_var_entity,
2781        };
2782        Err(Error::ResponseError(local_var_error))
2783    }
2784}
2785
2786/// Partially update a channel 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 If updating a public channel, `manage_public_channel_members` permission is required. If updating a private channel, `manage_private_channel_members` permission is required.
2787pub async fn patch_channel(
2788    configuration: &configuration::Configuration,
2789    params: PatchChannelParams,
2790) -> Result<crate::openapi::models::Channel, Error<PatchChannelError>> {
2791    let local_var_configuration = configuration;
2792
2793    // unbox the parameters
2794    let channel_id = params.channel_id;
2795    let patch_channel_request = params.patch_channel_request;
2796
2797    let local_var_client = &local_var_configuration.client;
2798
2799    let local_var_uri_str = format!(
2800        "{}/api/v4/channels/{channel_id}/patch",
2801        local_var_configuration.base_path,
2802        channel_id = super::urlencode(channel_id)
2803    );
2804    let mut local_var_req_builder =
2805        local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
2806
2807    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2808        local_var_req_builder =
2809            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2810    }
2811    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2812        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2813    };
2814    local_var_req_builder = local_var_req_builder.json(&patch_channel_request);
2815
2816    let local_var_req = local_var_req_builder.build()?;
2817    let local_var_resp = local_var_client.execute(local_var_req).await?;
2818
2819    let local_var_status = local_var_resp.status();
2820    let local_var_content = local_var_resp.text().await?;
2821
2822    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2823        serde_json::from_str(&local_var_content).map_err(Error::from)
2824    } else {
2825        let local_var_entity: Option<PatchChannelError> =
2826            serde_json::from_str(&local_var_content).ok();
2827        let local_var_error = ResponseContent {
2828            status: local_var_status,
2829            content: local_var_content,
2830            entity: local_var_entity,
2831        };
2832        Err(Error::ResponseError(local_var_error))
2833    }
2834}
2835
2836/// ##### Permissions Must have `manage_system` permission.  __Minimum server version__: 5.22
2837pub async fn patch_channel_moderations(
2838    configuration: &configuration::Configuration,
2839    params: PatchChannelModerationsParams,
2840) -> Result<Vec<crate::openapi::models::ChannelModeration>, Error<PatchChannelModerationsError>> {
2841    let local_var_configuration = configuration;
2842
2843    // unbox the parameters
2844    let channel_id = params.channel_id;
2845    let channel_moderation_patch = params.channel_moderation_patch;
2846
2847    let local_var_client = &local_var_configuration.client;
2848
2849    let local_var_uri_str = format!(
2850        "{}/api/v4/channels/{channel_id}/moderations/patch",
2851        local_var_configuration.base_path,
2852        channel_id = super::urlencode(channel_id)
2853    );
2854    let mut local_var_req_builder =
2855        local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
2856
2857    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2858        local_var_req_builder =
2859            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2860    }
2861    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2862        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2863    };
2864    local_var_req_builder = local_var_req_builder.json(&channel_moderation_patch);
2865
2866    let local_var_req = local_var_req_builder.build()?;
2867    let local_var_resp = local_var_client.execute(local_var_req).await?;
2868
2869    let local_var_status = local_var_resp.status();
2870    let local_var_content = local_var_resp.text().await?;
2871
2872    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2873        serde_json::from_str(&local_var_content).map_err(Error::from)
2874    } else {
2875        let local_var_entity: Option<PatchChannelModerationsError> =
2876            serde_json::from_str(&local_var_content).ok();
2877        let local_var_error = ResponseContent {
2878            status: local_var_status,
2879            content: local_var_content,
2880            entity: local_var_entity,
2881        };
2882        Err(Error::ResponseError(local_var_error))
2883    }
2884}
2885
2886/// Deletes a single sidebar category for the user on the given team. Only custom categories can be deleted. __Minimum server version__: 5.26 ##### Permissions Must be authenticated and have the `list_team_channels` permission.
2887pub async fn remove_sidebar_category_for_team_for_user(
2888    configuration: &configuration::Configuration,
2889    params: RemoveSidebarCategoryForTeamForUserParams,
2890) -> Result<crate::openapi::models::SidebarCategory, Error<RemoveSidebarCategoryForTeamForUserError>> {
2891    let local_var_configuration = configuration;
2892
2893    // unbox the parameters
2894    let team_id = params.team_id;
2895    let user_id = params.user_id;
2896    let category_id = params.category_id;
2897
2898    let local_var_client = &local_var_configuration.client;
2899
2900    let local_var_uri_str = format!(
2901        "{}/api/v4/users/{user_id}/teams/{team_id}/channels/categories/{category_id}",
2902        local_var_configuration.base_path,
2903        team_id = super::urlencode(team_id),
2904        user_id = super::urlencode(user_id),
2905        category_id = super::urlencode(category_id)
2906    );
2907    let mut local_var_req_builder =
2908        local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
2909
2910    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2911        local_var_req_builder =
2912            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2913    }
2914    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2915        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2916    };
2917
2918    let local_var_req = local_var_req_builder.build()?;
2919    let local_var_resp = local_var_client.execute(local_var_req).await?;
2920
2921    let local_var_status = local_var_resp.status();
2922    let local_var_content = local_var_resp.text().await?;
2923
2924    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2925        serde_json::from_str(&local_var_content).map_err(Error::from)
2926    } else {
2927        let local_var_entity: Option<RemoveSidebarCategoryForTeamForUserError> =
2928            serde_json::from_str(&local_var_content).ok();
2929        let local_var_error = ResponseContent {
2930            status: local_var_status,
2931            content: local_var_content,
2932            entity: local_var_entity,
2933        };
2934        Err(Error::ResponseError(local_var_error))
2935    }
2936}
2937
2938/// Delete a channel member, effectively removing them from a channel.  In server version 5.3 and later, channel members can only be deleted from public or private channels. ##### Permissions `manage_public_channel_members` permission if the channel is public. `manage_private_channel_members` permission if the channel is private.
2939pub async fn remove_user_from_channel(
2940    configuration: &configuration::Configuration,
2941    params: RemoveUserFromChannelParams,
2942) -> Result<crate::openapi::models::StatusOk, Error<RemoveUserFromChannelError>> {
2943    let local_var_configuration = configuration;
2944
2945    // unbox the parameters
2946    let channel_id = params.channel_id;
2947    let user_id = params.user_id;
2948
2949    let local_var_client = &local_var_configuration.client;
2950
2951    let local_var_uri_str = format!(
2952        "{}/api/v4/channels/{channel_id}/members/{user_id}",
2953        local_var_configuration.base_path,
2954        channel_id = super::urlencode(channel_id),
2955        user_id = super::urlencode(user_id)
2956    );
2957    let mut local_var_req_builder =
2958        local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
2959
2960    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2961        local_var_req_builder =
2962            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2963    }
2964    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2965        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2966    };
2967
2968    let local_var_req = local_var_req_builder.build()?;
2969    let local_var_resp = local_var_client.execute(local_var_req).await?;
2970
2971    let local_var_status = local_var_resp.status();
2972    let local_var_content = local_var_resp.text().await?;
2973
2974    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2975        serde_json::from_str(&local_var_content).map_err(Error::from)
2976    } else {
2977        let local_var_entity: Option<RemoveUserFromChannelError> =
2978            serde_json::from_str(&local_var_content).ok();
2979        let local_var_error = ResponseContent {
2980            status: local_var_status,
2981            content: local_var_content,
2982            entity: local_var_entity,
2983        };
2984        Err(Error::ResponseError(local_var_error))
2985    }
2986}
2987
2988/// Restore channel from the provided channel id string.  __Minimum server version__: 3.10  ##### Permissions `manage_team` permission for the team of the channel.
2989pub async fn restore_channel(
2990    configuration: &configuration::Configuration,
2991    params: RestoreChannelParams,
2992) -> Result<crate::openapi::models::Channel, Error<RestoreChannelError>> {
2993    let local_var_configuration = configuration;
2994
2995    // unbox the parameters
2996    let channel_id = params.channel_id;
2997
2998    let local_var_client = &local_var_configuration.client;
2999
3000    let local_var_uri_str = format!(
3001        "{}/api/v4/channels/{channel_id}/restore",
3002        local_var_configuration.base_path,
3003        channel_id = super::urlencode(channel_id)
3004    );
3005    let mut local_var_req_builder =
3006        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
3007
3008    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3009        local_var_req_builder =
3010            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
3011    }
3012    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
3013        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
3014    };
3015
3016    let local_var_req = local_var_req_builder.build()?;
3017    let local_var_resp = local_var_client.execute(local_var_req).await?;
3018
3019    let local_var_status = local_var_resp.status();
3020    let local_var_content = local_var_resp.text().await?;
3021
3022    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
3023        serde_json::from_str(&local_var_content).map_err(Error::from)
3024    } else {
3025        let local_var_entity: Option<RestoreChannelError> =
3026            serde_json::from_str(&local_var_content).ok();
3027        let local_var_error = ResponseContent {
3028            status: local_var_status,
3029            content: local_var_content,
3030            entity: local_var_entity,
3031        };
3032        Err(Error::ResponseError(local_var_error))
3033    }
3034}
3035
3036/// Returns all private and open type channels where 'term' matches on the name, display name, or purpose of the channel.  Configured 'default' channels (ex Town Square and Off-Topic) can be excluded from the results with the `exclude_default_channels` boolean parameter.  Channels that are associated (via GroupChannel records) to a given group can be excluded from the results with the `not_associated_to_group` parameter and a group id string.
3037pub async fn search_all_channels(
3038    configuration: &configuration::Configuration,
3039    params: SearchAllChannelsParams,
3040) -> Result<crate::openapi::models::SearchAllChannels200Response, Error<SearchAllChannelsError>> {
3041    let local_var_configuration = configuration;
3042
3043    // unbox the parameters
3044    let search_all_channels_request = params.search_all_channels_request;
3045    let system_console = params.system_console;
3046
3047    let local_var_client = &local_var_configuration.client;
3048
3049    let local_var_uri_str = format!(
3050        "{}/api/v4/channels/search",
3051        local_var_configuration.base_path
3052    );
3053    let mut local_var_req_builder =
3054        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
3055
3056    if let Some(ref local_var_str) = system_console {
3057        local_var_req_builder =
3058            local_var_req_builder.query(&[("system_console", &local_var_str.to_string())]);
3059    }
3060    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3061        local_var_req_builder =
3062            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
3063    }
3064    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
3065        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
3066    };
3067    local_var_req_builder = local_var_req_builder.json(&search_all_channels_request);
3068
3069    let local_var_req = local_var_req_builder.build()?;
3070    let local_var_resp = local_var_client.execute(local_var_req).await?;
3071
3072    let local_var_status = local_var_resp.status();
3073    let local_var_content = local_var_resp.text().await?;
3074
3075    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
3076        serde_json::from_str(&local_var_content).map_err(Error::from)
3077    } else {
3078        let local_var_entity: Option<SearchAllChannelsError> =
3079            serde_json::from_str(&local_var_content).ok();
3080        let local_var_error = ResponseContent {
3081            status: local_var_status,
3082            content: local_var_content,
3083            entity: local_var_entity,
3084        };
3085        Err(Error::ResponseError(local_var_error))
3086    }
3087}
3088
3089/// Search archived channels on a team based on the search term provided in the request body.  __Minimum server version__: 5.18  ##### Permissions Must have the `list_team_channels` permission.  In server version 5.18 and later, a user without the `list_team_channels` permission will be able to use this endpoint, with the search results limited to the channels that the user is a member of.
3090pub async fn search_archived_channels(
3091    configuration: &configuration::Configuration,
3092    params: SearchArchivedChannelsParams,
3093) -> Result<Vec<crate::openapi::models::Channel>, Error<SearchArchivedChannelsError>> {
3094    let local_var_configuration = configuration;
3095
3096    // unbox the parameters
3097    let team_id = params.team_id;
3098    let search_archived_channels_request = params.search_archived_channels_request;
3099
3100    let local_var_client = &local_var_configuration.client;
3101
3102    let local_var_uri_str = format!(
3103        "{}/api/v4/teams/{team_id}/channels/search_archived",
3104        local_var_configuration.base_path,
3105        team_id = super::urlencode(team_id)
3106    );
3107    let mut local_var_req_builder =
3108        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
3109
3110    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3111        local_var_req_builder =
3112            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
3113    }
3114    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
3115        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
3116    };
3117    local_var_req_builder = local_var_req_builder.json(&search_archived_channels_request);
3118
3119    let local_var_req = local_var_req_builder.build()?;
3120    let local_var_resp = local_var_client.execute(local_var_req).await?;
3121
3122    let local_var_status = local_var_resp.status();
3123    let local_var_content = local_var_resp.text().await?;
3124
3125    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
3126        serde_json::from_str(&local_var_content).map_err(Error::from)
3127    } else {
3128        let local_var_entity: Option<SearchArchivedChannelsError> =
3129            serde_json::from_str(&local_var_content).ok();
3130        let local_var_error = ResponseContent {
3131            status: local_var_status,
3132            content: local_var_content,
3133            entity: local_var_entity,
3134        };
3135        Err(Error::ResponseError(local_var_error))
3136    }
3137}
3138
3139/// Search public channels on a team based on the search term provided in the request body. ##### Permissions Must have the `list_team_channels` permission.  In server version 5.16 and later, a user without the `list_team_channels` permission will be able to use this endpoint, with the search results limited to the channels that the user is a member of.
3140pub async fn search_channels(
3141    configuration: &configuration::Configuration,
3142    params: SearchChannelsParams,
3143) -> Result<Vec<crate::openapi::models::Channel>, Error<SearchChannelsError>> {
3144    let local_var_configuration = configuration;
3145
3146    // unbox the parameters
3147    let team_id = params.team_id;
3148    let search_channels_request = params.search_channels_request;
3149
3150    let local_var_client = &local_var_configuration.client;
3151
3152    let local_var_uri_str = format!(
3153        "{}/api/v4/teams/{team_id}/channels/search",
3154        local_var_configuration.base_path,
3155        team_id = super::urlencode(team_id)
3156    );
3157    let mut local_var_req_builder =
3158        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
3159
3160    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3161        local_var_req_builder =
3162            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
3163    }
3164    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
3165        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
3166    };
3167    local_var_req_builder = local_var_req_builder.json(&search_channels_request);
3168
3169    let local_var_req = local_var_req_builder.build()?;
3170    let local_var_resp = local_var_client.execute(local_var_req).await?;
3171
3172    let local_var_status = local_var_resp.status();
3173    let local_var_content = local_var_resp.text().await?;
3174
3175    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
3176        serde_json::from_str(&local_var_content).map_err(Error::from)
3177    } else {
3178        let local_var_entity: Option<SearchChannelsError> =
3179            serde_json::from_str(&local_var_content).ok();
3180        let local_var_error = ResponseContent {
3181            status: local_var_status,
3182            content: local_var_content,
3183            entity: local_var_entity,
3184        };
3185        Err(Error::ResponseError(local_var_error))
3186    }
3187}
3188
3189/// Get a list of group channels for a user which members' usernames match the search term.  __Minimum server version__: 5.14
3190pub async fn search_group_channels(
3191    configuration: &configuration::Configuration,
3192    params: SearchGroupChannelsParams,
3193) -> Result<Vec<crate::openapi::models::Channel>, Error<SearchGroupChannelsError>> {
3194    let local_var_configuration = configuration;
3195
3196    // unbox the parameters
3197    let search_group_channels_request = params.search_group_channels_request;
3198
3199    let local_var_client = &local_var_configuration.client;
3200
3201    let local_var_uri_str = format!(
3202        "{}/api/v4/channels/group/search",
3203        local_var_configuration.base_path
3204    );
3205    let mut local_var_req_builder =
3206        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
3207
3208    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3209        local_var_req_builder =
3210            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
3211    }
3212    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
3213        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
3214    };
3215    local_var_req_builder = local_var_req_builder.json(&search_group_channels_request);
3216
3217    let local_var_req = local_var_req_builder.build()?;
3218    let local_var_resp = local_var_client.execute(local_var_req).await?;
3219
3220    let local_var_status = local_var_resp.status();
3221    let local_var_content = local_var_resp.text().await?;
3222
3223    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
3224        serde_json::from_str(&local_var_content).map_err(Error::from)
3225    } else {
3226        let local_var_entity: Option<SearchGroupChannelsError> =
3227            serde_json::from_str(&local_var_content).ok();
3228        let local_var_error = ResponseContent {
3229            status: local_var_status,
3230            content: local_var_content,
3231            entity: local_var_entity,
3232        };
3233        Err(Error::ResponseError(local_var_error))
3234    }
3235}
3236
3237/// Update a channel. The fields that can be updated are listed as parameters. Omitted fields will be treated as blanks. ##### Permissions If updating a public channel, `manage_public_channel_members` permission is required. If updating a private channel, `manage_private_channel_members` permission is required.
3238pub async fn update_channel(
3239    configuration: &configuration::Configuration,
3240    params: UpdateChannelParams,
3241) -> Result<crate::openapi::models::Channel, Error<UpdateChannelError>> {
3242    let local_var_configuration = configuration;
3243
3244    // unbox the parameters
3245    let channel_id = params.channel_id;
3246    let update_channel_request = params.update_channel_request;
3247
3248    let local_var_client = &local_var_configuration.client;
3249
3250    let local_var_uri_str = format!(
3251        "{}/api/v4/channels/{channel_id}",
3252        local_var_configuration.base_path,
3253        channel_id = super::urlencode(channel_id)
3254    );
3255    let mut local_var_req_builder =
3256        local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
3257
3258    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3259        local_var_req_builder =
3260            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
3261    }
3262    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
3263        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
3264    };
3265    local_var_req_builder = local_var_req_builder.json(&update_channel_request);
3266
3267    let local_var_req = local_var_req_builder.build()?;
3268    let local_var_resp = local_var_client.execute(local_var_req).await?;
3269
3270    let local_var_status = local_var_resp.status();
3271    let local_var_content = local_var_resp.text().await?;
3272
3273    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
3274        serde_json::from_str(&local_var_content).map_err(Error::from)
3275    } else {
3276        let local_var_entity: Option<UpdateChannelError> =
3277            serde_json::from_str(&local_var_content).ok();
3278        let local_var_error = ResponseContent {
3279            status: local_var_status,
3280            content: local_var_content,
3281            entity: local_var_entity,
3282        };
3283        Err(Error::ResponseError(local_var_error))
3284    }
3285}
3286
3287/// Update a channel member's scheme_admin/scheme_user properties. Typically this should either be `scheme_admin=false, scheme_user=true` for ordinary channel member, or `scheme_admin=true, scheme_user=true` for a channel admin. __Minimum server version__: 5.0 ##### Permissions Must be authenticated and have the `manage_channel_roles` permission.
3288pub async fn update_channel_member_scheme_roles(
3289    configuration: &configuration::Configuration,
3290    params: UpdateChannelMemberSchemeRolesParams,
3291) -> Result<crate::openapi::models::StatusOk, Error<UpdateChannelMemberSchemeRolesError>> {
3292    let local_var_configuration = configuration;
3293
3294    // unbox the parameters
3295    let channel_id = params.channel_id;
3296    let user_id = params.user_id;
3297    let update_team_member_scheme_roles_request = params.update_team_member_scheme_roles_request;
3298
3299    let local_var_client = &local_var_configuration.client;
3300
3301    let local_var_uri_str = format!(
3302        "{}/api/v4/channels/{channel_id}/members/{user_id}/schemeRoles",
3303        local_var_configuration.base_path,
3304        channel_id = super::urlencode(channel_id),
3305        user_id = super::urlencode(user_id)
3306    );
3307    let mut local_var_req_builder =
3308        local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
3309
3310    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3311        local_var_req_builder =
3312            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
3313    }
3314    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
3315        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
3316    };
3317    local_var_req_builder = local_var_req_builder.json(&update_team_member_scheme_roles_request);
3318
3319    let local_var_req = local_var_req_builder.build()?;
3320    let local_var_resp = local_var_client.execute(local_var_req).await?;
3321
3322    let local_var_status = local_var_resp.status();
3323    let local_var_content = local_var_resp.text().await?;
3324
3325    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
3326        serde_json::from_str(&local_var_content).map_err(Error::from)
3327    } else {
3328        let local_var_entity: Option<UpdateChannelMemberSchemeRolesError> =
3329            serde_json::from_str(&local_var_content).ok();
3330        let local_var_error = ResponseContent {
3331            status: local_var_status,
3332            content: local_var_content,
3333            entity: local_var_entity,
3334        };
3335        Err(Error::ResponseError(local_var_error))
3336    }
3337}
3338
3339/// Update a user's notification properties for a channel. Only the provided fields are updated. ##### Permissions Must be logged in as the user or have `edit_other_users` permission.
3340pub async fn update_channel_notify_props(
3341    configuration: &configuration::Configuration,
3342    params: UpdateChannelNotifyPropsParams,
3343) -> Result<crate::openapi::models::StatusOk, Error<UpdateChannelNotifyPropsError>> {
3344    let local_var_configuration = configuration;
3345
3346    // unbox the parameters
3347    let channel_id = params.channel_id;
3348    let user_id = params.user_id;
3349    let channel_notify_props = params.channel_notify_props;
3350
3351    let local_var_client = &local_var_configuration.client;
3352
3353    let local_var_uri_str = format!(
3354        "{}/api/v4/channels/{channel_id}/members/{user_id}/notify_props",
3355        local_var_configuration.base_path,
3356        channel_id = super::urlencode(channel_id),
3357        user_id = super::urlencode(user_id)
3358    );
3359    let mut local_var_req_builder =
3360        local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
3361
3362    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3363        local_var_req_builder =
3364            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
3365    }
3366    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
3367        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
3368    };
3369    local_var_req_builder = local_var_req_builder.json(&channel_notify_props);
3370
3371    let local_var_req = local_var_req_builder.build()?;
3372    let local_var_resp = local_var_client.execute(local_var_req).await?;
3373
3374    let local_var_status = local_var_resp.status();
3375    let local_var_content = local_var_resp.text().await?;
3376
3377    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
3378        serde_json::from_str(&local_var_content).map_err(Error::from)
3379    } else {
3380        let local_var_entity: Option<UpdateChannelNotifyPropsError> =
3381            serde_json::from_str(&local_var_content).ok();
3382        let local_var_error = ResponseContent {
3383            status: local_var_status,
3384            content: local_var_content,
3385            entity: local_var_entity,
3386        };
3387        Err(Error::ResponseError(local_var_error))
3388    }
3389}
3390
3391/// Updates channel's privacy allowing changing a channel from Public to Private and back.  __Minimum server version__: 5.16  ##### Permissions `manage_team` permission for the channels team on version < 5.28. `convert_public_channel_to_private` permission for the channel if updating privacy to 'P' on version >= 5.28. `convert_private_channel_to_public` permission for the channel if updating privacy to 'O' on version >= 5.28.
3392pub async fn update_channel_privacy(
3393    configuration: &configuration::Configuration,
3394    params: UpdateChannelPrivacyParams,
3395) -> Result<crate::openapi::models::Channel, Error<UpdateChannelPrivacyError>> {
3396    let local_var_configuration = configuration;
3397
3398    // unbox the parameters
3399    let channel_id = params.channel_id;
3400    let update_channel_privacy_request = params.update_channel_privacy_request;
3401
3402    let local_var_client = &local_var_configuration.client;
3403
3404    let local_var_uri_str = format!(
3405        "{}/api/v4/channels/{channel_id}/privacy",
3406        local_var_configuration.base_path,
3407        channel_id = super::urlencode(channel_id)
3408    );
3409    let mut local_var_req_builder =
3410        local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
3411
3412    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3413        local_var_req_builder =
3414            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
3415    }
3416    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
3417        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
3418    };
3419    local_var_req_builder = local_var_req_builder.json(&update_channel_privacy_request);
3420
3421    let local_var_req = local_var_req_builder.build()?;
3422    let local_var_resp = local_var_client.execute(local_var_req).await?;
3423
3424    let local_var_status = local_var_resp.status();
3425    let local_var_content = local_var_resp.text().await?;
3426
3427    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
3428        serde_json::from_str(&local_var_content).map_err(Error::from)
3429    } else {
3430        let local_var_entity: Option<UpdateChannelPrivacyError> =
3431            serde_json::from_str(&local_var_content).ok();
3432        let local_var_error = ResponseContent {
3433            status: local_var_status,
3434            content: local_var_content,
3435            entity: local_var_entity,
3436        };
3437        Err(Error::ResponseError(local_var_error))
3438    }
3439}
3440
3441/// Update a user's roles for a channel. ##### Permissions Must have `manage_channel_roles` permission for the channel.
3442pub async fn update_channel_roles(
3443    configuration: &configuration::Configuration,
3444    params: UpdateChannelRolesParams,
3445) -> Result<crate::openapi::models::StatusOk, Error<UpdateChannelRolesError>> {
3446    let local_var_configuration = configuration;
3447
3448    // unbox the parameters
3449    let channel_id = params.channel_id;
3450    let user_id = params.user_id;
3451    let update_user_roles_request = params.update_user_roles_request;
3452
3453    let local_var_client = &local_var_configuration.client;
3454
3455    let local_var_uri_str = format!(
3456        "{}/api/v4/channels/{channel_id}/members/{user_id}/roles",
3457        local_var_configuration.base_path,
3458        channel_id = super::urlencode(channel_id),
3459        user_id = super::urlencode(user_id)
3460    );
3461    let mut local_var_req_builder =
3462        local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
3463
3464    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3465        local_var_req_builder =
3466            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
3467    }
3468    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
3469        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
3470    };
3471    local_var_req_builder = local_var_req_builder.json(&update_user_roles_request);
3472
3473    let local_var_req = local_var_req_builder.build()?;
3474    let local_var_resp = local_var_client.execute(local_var_req).await?;
3475
3476    let local_var_status = local_var_resp.status();
3477    let local_var_content = local_var_resp.text().await?;
3478
3479    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
3480        serde_json::from_str(&local_var_content).map_err(Error::from)
3481    } else {
3482        let local_var_entity: Option<UpdateChannelRolesError> =
3483            serde_json::from_str(&local_var_content).ok();
3484        let local_var_error = ResponseContent {
3485            status: local_var_status,
3486            content: local_var_content,
3487            entity: local_var_entity,
3488        };
3489        Err(Error::ResponseError(local_var_error))
3490    }
3491}
3492
3493/// Set a channel's scheme, more specifically sets the scheme_id value of a channel record.  ##### Permissions Must have `manage_system` permission.  __Minimum server version__: 4.10
3494pub async fn update_channel_scheme(
3495    configuration: &configuration::Configuration,
3496    params: UpdateChannelSchemeParams,
3497) -> Result<crate::openapi::models::StatusOk, Error<UpdateChannelSchemeError>> {
3498    let local_var_configuration = configuration;
3499
3500    // unbox the parameters
3501    let channel_id = params.channel_id;
3502    let update_team_scheme_request = params.update_team_scheme_request;
3503
3504    let local_var_client = &local_var_configuration.client;
3505
3506    let local_var_uri_str = format!(
3507        "{}/api/v4/channels/{channel_id}/scheme",
3508        local_var_configuration.base_path,
3509        channel_id = super::urlencode(channel_id)
3510    );
3511    let mut local_var_req_builder =
3512        local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
3513
3514    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3515        local_var_req_builder =
3516            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
3517    }
3518    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
3519        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
3520    };
3521    local_var_req_builder = local_var_req_builder.json(&update_team_scheme_request);
3522
3523    let local_var_req = local_var_req_builder.build()?;
3524    let local_var_resp = local_var_client.execute(local_var_req).await?;
3525
3526    let local_var_status = local_var_resp.status();
3527    let local_var_content = local_var_resp.text().await?;
3528
3529    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
3530        serde_json::from_str(&local_var_content).map_err(Error::from)
3531    } else {
3532        let local_var_entity: Option<UpdateChannelSchemeError> =
3533            serde_json::from_str(&local_var_content).ok();
3534        let local_var_error = ResponseContent {
3535            status: local_var_status,
3536            content: local_var_content,
3537            entity: local_var_entity,
3538        };
3539        Err(Error::ResponseError(local_var_error))
3540    }
3541}
3542
3543/// Update any number of sidebar categories for the user on the given team. This can be used to reorder the channels in these categories. __Minimum server version__: 5.26 ##### Permissions Must be authenticated and have the `list_team_channels` permission.
3544pub async fn update_sidebar_categories_for_team_for_user(
3545    configuration: &configuration::Configuration,
3546    params: UpdateSidebarCategoriesForTeamForUserParams,
3547) -> Result<crate::openapi::models::SidebarCategory, Error<UpdateSidebarCategoriesForTeamForUserError>> {
3548    let local_var_configuration = configuration;
3549
3550    // unbox the parameters
3551    let team_id = params.team_id;
3552    let user_id = params.user_id;
3553    let sidebar_category = params.sidebar_category;
3554
3555    let local_var_client = &local_var_configuration.client;
3556
3557    let local_var_uri_str = format!(
3558        "{}/api/v4/users/{user_id}/teams/{team_id}/channels/categories",
3559        local_var_configuration.base_path,
3560        team_id = super::urlencode(team_id),
3561        user_id = super::urlencode(user_id)
3562    );
3563    let mut local_var_req_builder =
3564        local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
3565
3566    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3567        local_var_req_builder =
3568            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
3569    }
3570    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
3571        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
3572    };
3573    local_var_req_builder = local_var_req_builder.json(&sidebar_category);
3574
3575    let local_var_req = local_var_req_builder.build()?;
3576    let local_var_resp = local_var_client.execute(local_var_req).await?;
3577
3578    let local_var_status = local_var_resp.status();
3579    let local_var_content = local_var_resp.text().await?;
3580
3581    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
3582        serde_json::from_str(&local_var_content).map_err(Error::from)
3583    } else {
3584        let local_var_entity: Option<UpdateSidebarCategoriesForTeamForUserError> =
3585            serde_json::from_str(&local_var_content).ok();
3586        let local_var_error = ResponseContent {
3587            status: local_var_status,
3588            content: local_var_content,
3589            entity: local_var_entity,
3590        };
3591        Err(Error::ResponseError(local_var_error))
3592    }
3593}
3594
3595/// Updates a single sidebar category for the user on the given team. __Minimum server version__: 5.26 ##### Permissions Must be authenticated and have the `list_team_channels` permission.
3596pub async fn update_sidebar_category_for_team_for_user(
3597    configuration: &configuration::Configuration,
3598    params: UpdateSidebarCategoryForTeamForUserParams,
3599) -> Result<crate::openapi::models::SidebarCategory, Error<UpdateSidebarCategoryForTeamForUserError>> {
3600    let local_var_configuration = configuration;
3601
3602    // unbox the parameters
3603    let team_id = params.team_id;
3604    let user_id = params.user_id;
3605    let category_id = params.category_id;
3606    let sidebar_category = params.sidebar_category;
3607
3608    let local_var_client = &local_var_configuration.client;
3609
3610    let local_var_uri_str = format!(
3611        "{}/api/v4/users/{user_id}/teams/{team_id}/channels/categories/{category_id}",
3612        local_var_configuration.base_path,
3613        team_id = super::urlencode(team_id),
3614        user_id = super::urlencode(user_id),
3615        category_id = super::urlencode(category_id)
3616    );
3617    let mut local_var_req_builder =
3618        local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
3619
3620    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3621        local_var_req_builder =
3622            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
3623    }
3624    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
3625        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
3626    };
3627    local_var_req_builder = local_var_req_builder.json(&sidebar_category);
3628
3629    let local_var_req = local_var_req_builder.build()?;
3630    let local_var_resp = local_var_client.execute(local_var_req).await?;
3631
3632    let local_var_status = local_var_resp.status();
3633    let local_var_content = local_var_resp.text().await?;
3634
3635    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
3636        serde_json::from_str(&local_var_content).map_err(Error::from)
3637    } else {
3638        let local_var_entity: Option<UpdateSidebarCategoryForTeamForUserError> =
3639            serde_json::from_str(&local_var_content).ok();
3640        let local_var_error = ResponseContent {
3641            status: local_var_status,
3642            content: local_var_content,
3643            entity: local_var_entity,
3644        };
3645        Err(Error::ResponseError(local_var_error))
3646    }
3647}
3648
3649/// Updates the order of the sidebar categories for a user on the given team. The provided array must include the IDs of all categories on the team. __Minimum server version__: 5.26 ##### Permissions Must be authenticated and have the `list_team_channels` permission.
3650pub async fn update_sidebar_category_order_for_team_for_user(
3651    configuration: &configuration::Configuration,
3652    params: UpdateSidebarCategoryOrderForTeamForUserParams,
3653) -> Result<Vec<String>, Error<UpdateSidebarCategoryOrderForTeamForUserError>> {
3654    let local_var_configuration = configuration;
3655
3656    // unbox the parameters
3657    let team_id = params.team_id;
3658    let user_id = params.user_id;
3659    let request_body = params.request_body;
3660
3661    let local_var_client = &local_var_configuration.client;
3662
3663    let local_var_uri_str = format!(
3664        "{}/api/v4/users/{user_id}/teams/{team_id}/channels/categories/order",
3665        local_var_configuration.base_path,
3666        team_id = super::urlencode(team_id),
3667        user_id = super::urlencode(user_id)
3668    );
3669    let mut local_var_req_builder =
3670        local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
3671
3672    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3673        local_var_req_builder =
3674            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
3675    }
3676    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
3677        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
3678    };
3679    local_var_req_builder = local_var_req_builder.json(&request_body);
3680
3681    let local_var_req = local_var_req_builder.build()?;
3682    let local_var_resp = local_var_client.execute(local_var_req).await?;
3683
3684    let local_var_status = local_var_resp.status();
3685    let local_var_content = local_var_resp.text().await?;
3686
3687    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
3688        serde_json::from_str(&local_var_content).map_err(Error::from)
3689    } else {
3690        let local_var_entity: Option<UpdateSidebarCategoryOrderForTeamForUserError> =
3691            serde_json::from_str(&local_var_content).ok();
3692        let local_var_error = ResponseContent {
3693            status: local_var_status,
3694            content: local_var_content,
3695            entity: local_var_entity,
3696        };
3697        Err(Error::ResponseError(local_var_error))
3698    }
3699}
3700
3701/// Perform all the actions involved in viewing a channel. This includes marking channels as read, clearing push notifications, and updating the active channel. ##### Permissions Must be logged in as user or have `edit_other_users` permission.  __Response only includes `last_viewed_at_times` in Mattermost server 4.3 and newer.__
3702pub async fn view_channel(
3703    configuration: &configuration::Configuration,
3704    params: ViewChannelParams,
3705) -> Result<crate::openapi::models::ViewChannel200Response, Error<ViewChannelError>> {
3706    let local_var_configuration = configuration;
3707
3708    // unbox the parameters
3709    let user_id = params.user_id;
3710    let view_channel_request = params.view_channel_request;
3711
3712    let local_var_client = &local_var_configuration.client;
3713
3714    let local_var_uri_str = format!(
3715        "{}/api/v4/channels/members/{user_id}/view",
3716        local_var_configuration.base_path,
3717        user_id = super::urlencode(user_id)
3718    );
3719    let mut local_var_req_builder =
3720        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
3721
3722    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3723        local_var_req_builder =
3724            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
3725    }
3726    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
3727        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
3728    };
3729    local_var_req_builder = local_var_req_builder.json(&view_channel_request);
3730
3731    let local_var_req = local_var_req_builder.build()?;
3732    let local_var_resp = local_var_client.execute(local_var_req).await?;
3733
3734    let local_var_status = local_var_resp.status();
3735    let local_var_content = local_var_resp.text().await?;
3736
3737    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
3738        serde_json::from_str(&local_var_content).map_err(Error::from)
3739    } else {
3740        let local_var_entity: Option<ViewChannelError> =
3741            serde_json::from_str(&local_var_content).ok();
3742        let local_var_error = ResponseContent {
3743            status: local_var_status,
3744            content: local_var_content,
3745            entity: local_var_entity,
3746        };
3747        Err(Error::ResponseError(local_var_error))
3748    }
3749}