slack_chat_api/
admin_users_session.rs

1use crate::Client;
2use crate::ClientResult;
3
4pub struct AdminUsersSession {
5    pub client: Client,
6}
7
8impl AdminUsersSession {
9    #[doc(hidden)]
10    pub fn new(client: Client) -> Self {
11        AdminUsersSession { client }
12    }
13
14    /**
15     * This function performs a `POST` to the `/admin.users.session.invalidate` endpoint.
16     *
17     * Invalidate a single session for a user by session_id
18     *
19     * FROM: <https://api.slack.com/methods/admin.users.session.invalidate>
20     *
21     * **Parameters:**
22     *
23     * * `token: &str` -- Authentication token. Requires scope: `admin.users:write`.
24     */
25    pub async fn invalidate(&self) -> ClientResult<crate::Response<crate::types::DndEndSchema>> {
26        let url = self.client.url("/admin.users.session.invalidate", None);
27        self.client
28            .post(
29                &url,
30                crate::Message {
31                    body: None,
32                    content_type: Some("application/x-www-form-urlencoded".to_string()),
33                },
34            )
35            .await
36    }
37    /**
38     * This function performs a `POST` to the `/admin.users.session.reset` endpoint.
39     *
40     * Wipes all valid sessions on all devices for a given user
41     *
42     * FROM: <https://api.slack.com/methods/admin.users.session.reset>
43     *
44     * **Parameters:**
45     *
46     * * `token: &str` -- Authentication token. Requires scope: `admin.users:write`.
47     */
48    pub async fn reset(&self) -> ClientResult<crate::Response<crate::types::DndEndSchema>> {
49        let url = self.client.url("/admin.users.session.reset", None);
50        self.client
51            .post(
52                &url,
53                crate::Message {
54                    body: None,
55                    content_type: Some("application/x-www-form-urlencoded".to_string()),
56                },
57            )
58            .await
59    }
60}