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
use anyhow::Result;
use crate::Client;
pub struct AdminUsersSession {
pub client: Client,
}
impl AdminUsersSession {
#[doc(hidden)]
pub fn new(client: Client) -> Self {
AdminUsersSession { client }
}
/**
* This function performs a `POST` to the `/admin.users.session.invalidate` endpoint.
*
* Invalidate a single session for a user by session_id
*
* FROM: <https://api.slack.com/methods/admin.users.session.invalidate>
*
* **Parameters:**
*
* * `token: &str` -- Authentication token. Requires scope: `admin.users:write`.
*/
pub async fn invalidate(&self) -> Result<crate::types::DndEndSchema> {
let url = self.client.url("/admin.users.session.invalidate", None);
self.client
.post(
&url,
crate::Message {
body: None,
content_type: Some("application/x-www-form-urlencoded".to_string()),
},
)
.await
}
/**
* This function performs a `POST` to the `/admin.users.session.reset` endpoint.
*
* Wipes all valid sessions on all devices for a given user
*
* FROM: <https://api.slack.com/methods/admin.users.session.reset>
*
* **Parameters:**
*
* * `token: &str` -- Authentication token. Requires scope: `admin.users:write`.
*/
pub async fn reset(&self) -> Result<crate::types::DndEndSchema> {
let url = self.client.url("/admin.users.session.reset", None);
self.client
.post(
&url,
crate::Message {
body: None,
content_type: Some("application/x-www-form-urlencoded".to_string()),
},
)
.await
}
}