slack_chat_api/admin_conversations_restrict_access.rs
1use crate::Client;
2use crate::ClientResult;
3
4pub struct AdminConversationsRestrictAccess {
5 pub client: Client,
6}
7
8impl AdminConversationsRestrictAccess {
9 #[doc(hidden)]
10 pub fn new(client: Client) -> Self {
11 AdminConversationsRestrictAccess { client }
12 }
13
14 /**
15 * This function performs a `POST` to the `/admin.conversations.restrictAccess.addGroup` endpoint.
16 *
17 * Add an allowlist of IDP groups for accessing a channel
18 *
19 * FROM: <https://api.slack.com/methods/admin.conversations.restrictAccess.addGroup>
20 */
21 pub async fn add_group(&self) -> ClientResult<crate::Response<crate::types::DndEndSchema>> {
22 let url = self
23 .client
24 .url("/admin.conversations.restrictAccess.addGroup", None);
25 self.client
26 .post(
27 &url,
28 crate::Message {
29 body: None,
30 content_type: Some("application/x-www-form-urlencoded".to_string()),
31 },
32 )
33 .await
34 }
35 /**
36 * This function performs a `GET` to the `/admin.conversations.restrictAccess.listGroups` endpoint.
37 *
38 * List all IDP Groups linked to a channel
39 *
40 * FROM: <https://api.slack.com/methods/admin.conversations.restrictAccess.listGroups>
41 *
42 * **Parameters:**
43 *
44 * * `token: &str` -- Authentication token. Requires scope: `admin.conversations:read`.
45 * * `channel_id: &str`
46 * * `team_id: &str` -- The workspace where the channel exists. This argument is required for channels only tied to one workspace, and optional for channels that are shared across an organization.
47 */
48 pub async fn list_group(
49 &self,
50 channel_id: &str,
51 team_id: &str,
52 ) -> ClientResult<crate::Response<crate::types::DndEndSchema>> {
53 let mut query_args: Vec<(String, String)> = Default::default();
54 if !channel_id.is_empty() {
55 query_args.push(("channel_id".to_string(), channel_id.to_string()));
56 }
57 if !team_id.is_empty() {
58 query_args.push(("team_id".to_string(), team_id.to_string()));
59 }
60 let query_ = serde_urlencoded::to_string(&query_args).unwrap();
61 let url = self.client.url(
62 &format!("/admin.conversations.restrictAccess.listGroups?{}", query_),
63 None,
64 );
65 self.client
66 .get(
67 &url,
68 crate::Message {
69 body: None,
70 content_type: None,
71 },
72 )
73 .await
74 }
75 /**
76 * This function performs a `POST` to the `/admin.conversations.restrictAccess.removeGroup` endpoint.
77 *
78 * Remove a linked IDP group linked from a private channel
79 *
80 * FROM: <https://api.slack.com/methods/admin.conversations.restrictAccess.removeGroup>
81 */
82 pub async fn remove_group(&self) -> ClientResult<crate::Response<crate::types::DndEndSchema>> {
83 let url = self
84 .client
85 .url("/admin.conversations.restrictAccess.removeGroup", None);
86 self.client
87 .post(
88 &url,
89 crate::Message {
90 body: None,
91 content_type: Some("application/x-www-form-urlencoded".to_string()),
92 },
93 )
94 .await
95 }
96}