slack_chat_api/
admin_emoji.rs

1use crate::Client;
2use crate::ClientResult;
3
4pub struct AdminEmoji {
5    pub client: Client,
6}
7
8impl AdminEmoji {
9    #[doc(hidden)]
10    pub fn new(client: Client) -> Self {
11        AdminEmoji { client }
12    }
13
14    /**
15     * This function performs a `POST` to the `/admin.emoji.add` endpoint.
16     *
17     * Add an emoji.
18     *
19     * FROM: <https://api.slack.com/methods/admin.emoji.add>
20     */
21    pub async fn add(&self) -> ClientResult<crate::Response<crate::types::DndEndSchema>> {
22        let url = self.client.url("/admin.emoji.add", None);
23        self.client
24            .post(
25                &url,
26                crate::Message {
27                    body: None,
28                    content_type: Some("application/x-www-form-urlencoded".to_string()),
29                },
30            )
31            .await
32    }
33    /**
34     * This function performs a `POST` to the `/admin.emoji.addAlias` endpoint.
35     *
36     * Add an emoji alias.
37     *
38     * FROM: <https://api.slack.com/methods/admin.emoji.addAlias>
39     */
40    pub async fn add_alias(&self) -> ClientResult<crate::Response<crate::types::DndEndSchema>> {
41        let url = self.client.url("/admin.emoji.addAlias", None);
42        self.client
43            .post(
44                &url,
45                crate::Message {
46                    body: None,
47                    content_type: Some("application/x-www-form-urlencoded".to_string()),
48                },
49            )
50            .await
51    }
52    /**
53     * This function performs a `GET` to the `/admin.emoji.list` endpoint.
54     *
55     * List emoji for an Enterprise Grid organization.
56     *
57     * FROM: <https://api.slack.com/methods/admin.emoji.list>
58     *
59     * **Parameters:**
60     *
61     * * `token: &str` -- Authentication token. Requires scope: `admin.teams:read`.
62     * * `cursor: &str` -- Set `cursor` to `next_cursor` returned by the previous call to list items in the next page.
63     * * `limit: i64` -- The maximum number of items to return. Must be between 1 - 1000 both inclusive.
64     */
65    pub async fn list(
66        &self,
67        cursor: &str,
68        limit: i64,
69    ) -> ClientResult<crate::Response<crate::types::DndEndSchema>> {
70        let mut query_args: Vec<(String, String)> = Default::default();
71        if !cursor.is_empty() {
72            query_args.push(("cursor".to_string(), cursor.to_string()));
73        }
74        if limit > 0 {
75            query_args.push(("limit".to_string(), limit.to_string()));
76        }
77        let query_ = serde_urlencoded::to_string(&query_args).unwrap();
78        let url = self
79            .client
80            .url(&format!("/admin.emoji.list?{}", query_), None);
81        self.client
82            .get(
83                &url,
84                crate::Message {
85                    body: None,
86                    content_type: None,
87                },
88            )
89            .await
90    }
91    /**
92     * This function performs a `POST` to the `/admin.emoji.remove` endpoint.
93     *
94     * Remove an emoji across an Enterprise Grid organization
95     *
96     * FROM: <https://api.slack.com/methods/admin.emoji.remove>
97     */
98    pub async fn remove(&self) -> ClientResult<crate::Response<crate::types::DndEndSchema>> {
99        let url = self.client.url("/admin.emoji.remove", None);
100        self.client
101            .post(
102                &url,
103                crate::Message {
104                    body: None,
105                    content_type: Some("application/x-www-form-urlencoded".to_string()),
106                },
107            )
108            .await
109    }
110    /**
111     * This function performs a `POST` to the `/admin.emoji.rename` endpoint.
112     *
113     * Rename an emoji.
114     *
115     * FROM: <https://api.slack.com/methods/admin.emoji.rename>
116     */
117    pub async fn rename(&self) -> ClientResult<crate::Response<crate::types::DndEndSchema>> {
118        let url = self.client.url("/admin.emoji.rename", None);
119        self.client
120            .post(
121                &url,
122                crate::Message {
123                    body: None,
124                    content_type: Some("application/x-www-form-urlencoded".to_string()),
125                },
126            )
127            .await
128    }
129}