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
use anyhow::Result;
use crate::Client;
pub struct AppsPermissions {
pub client: Client,
}
impl AppsPermissions {
#[doc(hidden)]
pub fn new(client: Client) -> Self {
AppsPermissions { client }
}
/**
* This function performs a `GET` to the `/apps.permissions.info` endpoint.
*
* Returns list of permissions this app has on a team.
*
* FROM: <https://api.slack.com/methods/apps.permissions.info>
*
* **Parameters:**
*
* * `token: &str` -- Authentication token. Requires scope: `none`.
*/
pub async fn info(&self) -> Result<crate::types::AppsPermissionsInfoSchema> {
let url = self.client.url("/apps.permissions.info", None);
self.client
.get(
&url,
crate::Message {
body: None,
content_type: None,
},
)
.await
}
/**
* This function performs a `GET` to the `/apps.permissions.request` endpoint.
*
* Allows an app to request additional scopes
*
* FROM: <https://api.slack.com/methods/apps.permissions.request>
*
* **Parameters:**
*
* * `token: &str` -- Authentication token. Requires scope: `none`.
* * `scopes: &str` -- A comma separated list of scopes to request for.
* * `trigger_id: &str` -- Token used to trigger the permissions API.
*/
pub async fn request(
&self,
scopes: &str,
trigger_id: &str,
) -> Result<crate::types::DndEndSchema> {
let mut query_args: Vec<(String, String)> = Default::default();
if !scopes.is_empty() {
query_args.push(("scopes".to_string(), scopes.to_string()));
}
if !trigger_id.is_empty() {
query_args.push(("trigger_id".to_string(), trigger_id.to_string()));
}
let query_ = serde_urlencoded::to_string(&query_args).unwrap();
let url = self
.client
.url(&format!("/apps.permissions.request?{}", query_), None);
self.client
.get(
&url,
crate::Message {
body: None,
content_type: None,
},
)
.await
}
}