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