zoom_api/im_groups.rs
1use crate::Client;
2use crate::ClientResult;
3
4pub struct ImGroups {
5 pub client: Client,
6}
7
8impl ImGroups {
9 #[doc(hidden)]
10 pub fn new(client: Client) -> Self {
11 ImGroups { client }
12 }
13
14 /**
15 * List IM directory groups.
16 *
17 * This function performs a `GET` to the `/im/groups` endpoint.
18 *
19 * List [IM directory groups](https://support.zoom.us/hc/en-us/articles/203749815-IM-Management).<br><br>
20 * **Scopes**: `imgroup:read:admin`<br>
21 *
22 * **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Medium`
23 */
24 pub async fn get(&self) -> ClientResult<crate::Response<crate::types::Domains>> {
25 let url = self.client.url("/im/groups", None);
26 self.client
27 .get(
28 &url,
29 crate::Message {
30 body: None,
31 content_type: None,
32 },
33 )
34 .await
35 }
36 /**
37 * Create an IM directory group.
38 *
39 * This function performs a `POST` to the `/im/groups` endpoint.
40 *
41 * Create an [IM directory group](https://support.zoom.us/hc/en-us/articles/203749815-IM-Management) under your account.<br><br>
42 * **Scopes**: `imgroup:write:admin`<br>
43 *
44 * **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`
45 */
46 pub async fn create(
47 &self,
48 body: &crate::types::ImGroupCreateRequest,
49 ) -> ClientResult<crate::Response<()>> {
50 let url = self.client.url("/im/groups", None);
51 self.client
52 .post(
53 &url,
54 crate::Message {
55 body: Some(reqwest::Body::from(serde_json::to_vec(body)?)),
56 content_type: Some("application/json".to_string()),
57 },
58 )
59 .await
60 }
61 /**
62 * Retrieve an IM directory group.
63 *
64 * This function performs a `GET` to the `/im/groups/{groupId}` endpoint.
65 *
66 * Retrieve an [IM directory group](https://support.zoom.us/hc/en-us/articles/203749815-IM-Management) under your account.<br><br>
67 * Scopes: `imgroup:read:admin`<br>
68 *
69 * **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`
70 *
71 * **Parameters:**
72 *
73 * * `group_id: &str` -- The group ID.<br>
74 * Can be retrieved by calling [GET /groups](https://marketplace.zoom.us/docs/api-reference/zoom-api/groups/groups).
75 */
76 pub async fn im_group(
77 &self,
78 group_id: &str,
79 ) -> ClientResult<crate::Response<crate::types::ImGroupResponseAllOf>> {
80 let url = self.client.url(
81 &format!(
82 "/im/groups/{}",
83 crate::progenitor_support::encode_path(group_id),
84 ),
85 None,
86 );
87 self.client
88 .get(
89 &url,
90 crate::Message {
91 body: None,
92 content_type: None,
93 },
94 )
95 .await
96 }
97 /**
98 * Delete an IM directory group.
99 *
100 * This function performs a `DELETE` to the `/im/groups/{groupId}` endpoint.
101 *
102 * Delete an [IM directory group](https://support.zoom.us/hc/en-us/articles/203749815-IM-Management) under your account.<br><br>
103 * Scopes: `imgroup:write:admin`<br>
104 *
105 * **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`
106 *
107 * **Parameters:**
108 *
109 * * `group_id: &str` -- The group ID.<br>
110 * Can be retrieved by calling [GET /groups](https://marketplace.zoom.us/docs/api-reference/zoom-api/groups/groups).
111 */
112 pub async fn delete(&self, group_id: &str) -> ClientResult<crate::Response<()>> {
113 let url = self.client.url(
114 &format!(
115 "/im/groups/{}",
116 crate::progenitor_support::encode_path(group_id),
117 ),
118 None,
119 );
120 self.client
121 .delete(
122 &url,
123 crate::Message {
124 body: None,
125 content_type: None,
126 },
127 )
128 .await
129 }
130 /**
131 * Update an IM directory group.
132 *
133 * This function performs a `PATCH` to the `/im/groups/{groupId}` endpoint.
134 *
135 * Update an [IM directory group](https://support.zoom.us/hc/en-us/articles/203749815-IM-Management) under your account.<br><br>
136 * **Scopes**: `imgroup:write:admin`<br>
137 *
138 * **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`
139 *
140 * **Parameters:**
141 *
142 * * `group_id: &str` -- The group ID.<br>
143 * Can be retrieved by calling [GET /groups](https://marketplace.zoom.us/docs/api-reference/zoom-api/groups/groups).
144 */
145 pub async fn update(
146 &self,
147 group_id: &str,
148 body: &crate::types::ImGroupCreateRequest,
149 ) -> ClientResult<crate::Response<()>> {
150 let url = self.client.url(
151 &format!(
152 "/im/groups/{}",
153 crate::progenitor_support::encode_path(group_id),
154 ),
155 None,
156 );
157 self.client
158 .patch(
159 &url,
160 crate::Message {
161 body: Some(reqwest::Body::from(serde_json::to_vec(body)?)),
162 content_type: Some("application/json".to_string()),
163 },
164 )
165 .await
166 }
167 /**
168 * List IM directory group members.
169 *
170 * This function performs a `GET` to the `/im/groups/{groupId}/members` endpoint.
171 *
172 * List the members of an [IM directory group](https://support.zoom.us/hc/en-us/articles/203749815-IM-Management).<br><br>
173 * **Scope:** `imgroup:read:admin`<br>
174 *
175 * **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Medium`
176 *
177 * **Parameters:**
178 *
179 * * `group_id: &str` -- The group ID.<br>
180 * Can be retrieved by calling [GET /groups](https://marketplace.zoom.us/docs/api-reference/zoom-api/groups/groups).
181 * * `page_size: i64` -- The number of records returned within a single API call.
182 * * `page_number: i64` --
183 * **Deprecated** - This field has been deprecated and we will stop supporting it completely in a future release. Please use "next_page_token" for pagination instead of this field.
184 *
185 * The page number of the current page in the returned records.
186 * * `next_page_token: &str` -- The next page token is used to paginate through large result sets. A next page token will be returned whenever the set of available results exceeds the current page size. The expiration period for this token is 15 minutes.
187 */
188 pub async fn member(
189 &self,
190 group_id: &str,
191 page_size: i64,
192 page_number: i64,
193 next_page_token: &str,
194 ) -> ClientResult<crate::Response<crate::types::Domains>> {
195 let mut query_args: Vec<(String, String)> = Default::default();
196 if !next_page_token.is_empty() {
197 query_args.push(("next_page_token".to_string(), next_page_token.to_string()));
198 }
199 if page_number > 0 {
200 query_args.push(("page_number".to_string(), page_number.to_string()));
201 }
202 if page_size > 0 {
203 query_args.push(("page_size".to_string(), page_size.to_string()));
204 }
205 let query_ = serde_urlencoded::to_string(&query_args).unwrap();
206 let url = self.client.url(
207 &format!(
208 "/im/groups/{}/members?{}",
209 crate::progenitor_support::encode_path(group_id),
210 query_
211 ),
212 None,
213 );
214 self.client
215 .get(
216 &url,
217 crate::Message {
218 body: None,
219 content_type: None,
220 },
221 )
222 .await
223 }
224 /**
225 * Add IM directory group members.
226 *
227 * This function performs a `POST` to the `/im/groups/{groupId}/members` endpoint.
228 *
229 * Add members to an [IM directory group](https://support.zoom.us/hc/en-us/articles/203749815-IM-Management) under an account.<br><br>
230 * **Scope:** `imgroup:write:admin`<br>
231 *
232 * **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Medium`
233 *
234 * **Parameters:**
235 *
236 * * `group_id: &str` -- The group ID.<br>
237 * Can be retrieved by calling [GET /groups](https://marketplace.zoom.us/docs/api-reference/zoom-api/groups/groups).
238 */
239 pub async fn members_create(
240 &self,
241 group_id: &str,
242 body: &crate::types::AddRoleMembersRequest,
243 ) -> ClientResult<crate::Response<()>> {
244 let url = self.client.url(
245 &format!(
246 "/im/groups/{}/members",
247 crate::progenitor_support::encode_path(group_id),
248 ),
249 None,
250 );
251 self.client
252 .post(
253 &url,
254 crate::Message {
255 body: Some(reqwest::Body::from(serde_json::to_vec(body)?)),
256 content_type: Some("application/json".to_string()),
257 },
258 )
259 .await
260 }
261 /**
262 * Delete IM directory group member.
263 *
264 * This function performs a `DELETE` to the `/im/groups/{groupId}/members/{memberId}` endpoint.
265 *
266 * Delete a member from an [IM directory group](https://support.zoom.us/hc/en-us/articles/203749815-IM-Management) under an account.<br><br>
267 * Scopes: `imgroup:write:admin`<br>
268 *
269 * **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`
270 *
271 * **Parameters:**
272 *
273 * * `group_id: &str` -- The group ID.<br>
274 * Can be retrieved by calling [GET /groups](https://marketplace.zoom.us/docs/api-reference/zoom-api/groups/groups).
275 * * `member_id: &str` -- User's first name.
276 */
277 pub async fn members_delete(
278 &self,
279 group_id: &str,
280 member_id: &str,
281 ) -> ClientResult<crate::Response<()>> {
282 let url = self.client.url(
283 &format!(
284 "/im/groups/{}/members/{}",
285 crate::progenitor_support::encode_path(group_id),
286 crate::progenitor_support::encode_path(member_id),
287 ),
288 None,
289 );
290 self.client
291 .delete(
292 &url,
293 crate::Message {
294 body: None,
295 content_type: None,
296 },
297 )
298 .await
299 }
300}