Skip to main content

zoom_api/
rooms_location.rs

1use crate::Client;
2use crate::ClientResult;
3
4pub struct RoomsLocation {
5    pub client: Client,
6}
7
8impl RoomsLocation {
9    #[doc(hidden)]
10    pub fn new(client: Client) -> Self {
11        RoomsLocation { client }
12    }
13
14    /**
15     * List Zoom Room locations.
16     *
17     * This function performs a `GET` to the `/rooms/locations` endpoint.
18     *
19     * A Zoom account owner or a Zoom Room administrator can establish a [location hierarchy](https://support.zoom.us/hc/en-us/articles/115000342983-Zoom-Rooms-Location-Hierarchy) to help manage Zoom Rooms that are spread among a variety of locations. Use this API to list the different location types used for Zoom Rooms in an account.<br><br>
20     * **Prerequisites:**
21     * * Account owner or admin permissions.
22     * * Zoom Rooms Version 4.0 or higher<br><br>
23     * **Scopes:** `room:read:admin`<br>
24     *  
25     *  **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Medium`
26     *
27     * **Parameters:**
28     *
29     * * `parent_location_id: &str` -- A unique identifier of the parent location. For instance, if a Zoom Room is located in Floor 1 of Building A, the location of Building A will be the parent location of Floor 1. Use this parameter to filter the response by a specific location hierarchy level.
30     * * `type_: &str` -- Use this field to filter the response by the type of location. The value can be one of the following:
31     *   `country`, `states`, `city`, `campus`, `building`, `floor`. .
32     * * `page_size: i64` -- The number of records returned within a single API call.
33     * * `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.
34     */
35    pub async fn list_zr_locations(
36        &self,
37        parent_location_id: &str,
38        type_: &str,
39        page_size: i64,
40        next_page_token: &str,
41    ) -> ClientResult<crate::Response<Vec<crate::types::AddAzrLocationResponse>>> {
42        let mut query_args: Vec<(String, String)> = Default::default();
43        if !next_page_token.is_empty() {
44            query_args.push(("next_page_token".to_string(), next_page_token.to_string()));
45        }
46        if page_size > 0 {
47            query_args.push(("page_size".to_string(), page_size.to_string()));
48        }
49        if !parent_location_id.is_empty() {
50            query_args.push((
51                "parent_location_id".to_string(),
52                parent_location_id.to_string(),
53            ));
54        }
55        if !type_.is_empty() {
56            query_args.push(("type".to_string(), type_.to_string()));
57        }
58        let query_ = serde_urlencoded::to_string(&query_args).unwrap();
59        let url = self
60            .client
61            .url(&format!("/rooms/locations?{}", query_), None);
62        let resp: crate::Response<crate::types::ListZrLocationsResponseData> = self
63            .client
64            .get(
65                &url,
66                crate::Message {
67                    body: None,
68                    content_type: None,
69                },
70            )
71            .await?;
72
73        // Return our response data.
74        Ok(crate::Response::new(
75            resp.status,
76            resp.headers,
77            resp.body.locations.to_vec(),
78        ))
79    }
80    /**
81     * List Zoom Room locations.
82     *
83     * This function performs a `GET` to the `/rooms/locations` endpoint.
84     *
85     * As opposed to `list_zr_locations`, this function returns all the pages of the request at once.
86     *
87     * A Zoom account owner or a Zoom Room administrator can establish a [location hierarchy](https://support.zoom.us/hc/en-us/articles/115000342983-Zoom-Rooms-Location-Hierarchy) to help manage Zoom Rooms that are spread among a variety of locations. Use this API to list the different location types used for Zoom Rooms in an account.<br><br>
88     * **Prerequisites:**
89     * * Account owner or admin permissions.
90     * * Zoom Rooms Version 4.0 or higher<br><br>
91     * **Scopes:** `room:read:admin`<br>
92     *  
93     *  **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Medium`
94     */
95    pub async fn list_all_zr_locations(
96        &self,
97        parent_location_id: &str,
98        type_: &str,
99    ) -> ClientResult<crate::Response<Vec<crate::types::AddAzrLocationResponse>>> {
100        let mut query_args: Vec<(String, String)> = Default::default();
101        if !parent_location_id.is_empty() {
102            query_args.push((
103                "parent_location_id".to_string(),
104                parent_location_id.to_string(),
105            ));
106        }
107        if !type_.is_empty() {
108            query_args.push(("type".to_string(), type_.to_string()));
109        }
110        let query_ = serde_urlencoded::to_string(&query_args).unwrap();
111        let url = self
112            .client
113            .url(&format!("/rooms/locations?{}", query_), None);
114        let crate::Response::<crate::types::ListZrLocationsResponseData> {
115            mut status,
116            mut headers,
117            mut body,
118        } = self
119            .client
120            .get(
121                &url,
122                crate::Message {
123                    body: None,
124                    content_type: None,
125                },
126            )
127            .await?;
128
129        let mut locations = body.locations;
130        let mut page = body.next_page_token;
131
132        // Paginate if we should.
133        while !page.is_empty() {
134            // Check if we already have URL params and need to concat the token.
135            if !url.contains('?') {
136                crate::Response::<crate::types::ListZrLocationsResponseData> {
137                    status,
138                    headers,
139                    body,
140                } = self
141                    .client
142                    .get(
143                        &format!("{}?next_page_token={}", url, page),
144                        crate::Message {
145                            body: None,
146                            content_type: None,
147                        },
148                    )
149                    .await?;
150            } else {
151                crate::Response::<crate::types::ListZrLocationsResponseData> {
152                    status,
153                    headers,
154                    body,
155                } = self
156                    .client
157                    .get(
158                        &format!("{}&next_page_token={}", url, page),
159                        crate::Message {
160                            body: None,
161                            content_type: None,
162                        },
163                    )
164                    .await?;
165            }
166
167            locations.append(&mut body.locations);
168
169            if !body.next_page_token.is_empty() && body.next_page_token != page {
170                page = body.next_page_token.to_string();
171            } else {
172                page = "".to_string();
173            }
174        }
175
176        // Return our response data.
177        Ok(crate::Response::new(status, headers, locations))
178    }
179    /**
180     * Add a location.
181     *
182     * This function performs a `POST` to the `/rooms/locations` endpoint.
183     *
184     * Add a location to the [location hierarchial structure(s)](https://support.zoom.us/hc/en-us/articles/115000342983-Zoom-Rooms-Location-Hierarchy) of Zoom Rooms in an account.
185     *
186     * **Prerequisites:**
187     * * Account owner or admin permissions.
188     * * Zoom Rooms Version 4.0 or higher<br><br>
189     * **Scopes:** `room:write:admin`<br>
190     *
191     *  
192     *  **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`
193     */
194    pub async fn add_azr_location(
195        &self,
196        body: &crate::types::AddAzrLocationRequest,
197    ) -> ClientResult<crate::Response<crate::types::AddAzrLocationResponse>> {
198        let url = self.client.url("/rooms/locations", None);
199        self.client
200            .post(
201                &url,
202                crate::Message {
203                    body: Some(reqwest::Body::from(serde_json::to_vec(body)?)),
204                    content_type: Some("application/json".to_string()),
205                },
206            )
207            .await
208    }
209    /**
210     * Get Zoom Room location profile.
211     *
212     * This function performs a `GET` to the `/rooms/locations/{locationId}` endpoint.
213     *
214     * Each location type of the [Zoom Rooms location hierarchy](https://support.zoom.us/hc/en-us/articles/115000342983-Zoom-Rooms-Location-Hierarchy) has a profile page that includes information such as name of the location, address, support email, etc. Use this API to retrieve information about a specific Zoom Rooms location type such as information about the city where the Zoom Rooms is located.
215     *
216     * **Prerequisite:**<br>
217     * * Account owner or admin permission
218     * * Zoom Rooms version 4.0 or higher<br>
219     * **Scopes:** `room:read:admin`<br>
220     *  
221     *  **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Medium`
222     *
223     * **Parameters:**
224     *
225     * * `location_id: &str` -- Unique identifier of the location type. This can be retrieved using the [List Zoom Room Location API](https://marketplace.zoom.us/docs/api-reference/zoom-api/rooms-location/listzrlocations) (Id property in the response).
226     */
227    pub async fn get_zr_location_profile(
228        &self,
229        location_id: &str,
230    ) -> ClientResult<crate::Response<crate::types::GetZrLocationProfileResponse>> {
231        let url = self.client.url(
232            &format!(
233                "/rooms/locations/{}",
234                crate::progenitor_support::encode_path(location_id),
235            ),
236            None,
237        );
238        self.client
239            .get(
240                &url,
241                crate::Message {
242                    body: None,
243                    content_type: None,
244                },
245            )
246            .await
247    }
248    /**
249     * Update Zoom Room location profile.
250     *
251     * This function performs a `PATCH` to the `/rooms/locations/{locationId}` endpoint.
252     *
253     * Each location type of the [Zoom Rooms location hierarchy](https://support.zoom.us/hc/en-us/articles/115000342983-Zoom-Rooms-Location-Hierarchy) has a profile page that includes information such as name of the location, address, support email, etc. Use this API to update information about a specific Zoom Rooms location type such as information about the city where the Zoom Rooms is located.
254     *
255     * **Prerequisite:**<br>
256     * * Account owner or admin permission
257     * * Zoom Rooms version 4.0 or higher<br>
258     * **Scopes:** `room:write:admin`<br>
259     *
260     *  
261     *  **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Medium`
262     *
263     * **Parameters:**
264     *
265     * * `location_id: &str` -- Unique Identifier of the location. This can be retrieved from the [List Zoom Room Locations](https://marketplace.zoom.us/docs/api-reference/zoom-api/rooms-location/listzrlocations) API.
266     */
267    pub async fn update_zr_location_profile(
268        &self,
269        location_id: &str,
270        body: &crate::types::GetZrLocationProfileResponse,
271    ) -> ClientResult<crate::Response<()>> {
272        let url = self.client.url(
273            &format!(
274                "/rooms/locations/{}",
275                crate::progenitor_support::encode_path(location_id),
276            ),
277            None,
278        );
279        self.client
280            .patch(
281                &url,
282                crate::Message {
283                    body: Some(reqwest::Body::from(serde_json::to_vec(body)?)),
284                    content_type: Some("application/json".to_string()),
285                },
286            )
287            .await
288    }
289    /**
290     * Get location settings.
291     *
292     * This function performs a `GET` to the `/rooms/locations/{locationId}/settings` endpoint.
293     *
294     * Get information on meeting or alert settings applied to Zoom Rooms located in a specific location. By default, only **Meeting Settings** are returned. To view only **Alert Settings**, specify `alert` as the value of the `setting_type` query parameter.<br><br>
295     * **Prerequisites:**<br>
296     * * Zoom Room licenses
297     * * Owner or Admin privileges on the Zoom Account.<br>
298     * **Scopes:** `room:read:admin`<br>
299     *  **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Medium`
300     *
301     * **Parameters:**
302     *
303     * * `setting_type: &str` -- The type of setting that you would like to retrieve.<br> `alert`: Alert Settings applied on the Zoom Rooms Account.<br>
304     *   `meeting`: Meeting settings of the Zoom Rooms Account.<br>
305     *   `signage`: Digital signage settings of the Zoom Rooms Account.
306     * * `location_id: &str` -- Unique identifier of the location type. This can be retrieved using the [List Zoom Room Location API](https://marketplace.zoom.us/docs/api-reference/zoom-api/rooms-location/listzrlocations) (Id property in the response).
307     */
308    pub async fn get_zr_location_setting(
309        &self,
310        location_id: &str,
311        setting_type: &str,
312    ) -> ClientResult<crate::Response<crate::types::Domains>> {
313        let mut query_args: Vec<(String, String)> = Default::default();
314        if !setting_type.is_empty() {
315            query_args.push(("setting_type".to_string(), setting_type.to_string()));
316        }
317        let query_ = serde_urlencoded::to_string(&query_args).unwrap();
318        let url = self.client.url(
319            &format!(
320                "/rooms/locations/{}/settings?{}",
321                crate::progenitor_support::encode_path(location_id),
322                query_
323            ),
324            None,
325        );
326        self.client
327            .get(
328                &url,
329                crate::Message {
330                    body: None,
331                    content_type: None,
332                },
333            )
334            .await
335    }
336    /**
337     * Update location settings.
338     *
339     * This function performs a `PATCH` to the `/rooms/locations/{locationId}/settings` endpoint.
340     *
341     * Update information on either meeting or alert settings applied to Zoom Rooms located in a specific location. To update **Alert Settings**, specify `alert` as the value of the `setting_type` query parameter. Similarly, to update **Meeting Settings**, specify `meeting` as the value of the `setting_type` query parameter.<br><br>
342     * **Prerequisites:**<br>
343     * * Zoom Room licenses
344     * * Owner or Admin privileges on the Zoom Account.<br>
345     * **Scopes:** `room:write:admin`<br>
346     *  **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Medium`
347     *
348     * **Parameters:**
349     *
350     * * `setting_type: &str` -- The type of setting that you would like to update.<br> `alert`: Alert Settings applied on the Zoom Rooms Account.<br>
351     *   `meeting`: Meeting settings of the Zoom Rooms Account.<br>
352     *   `signage`: Digital signage settings.
353     * * `location_id: &str` -- Unique identifier of the location type. This can be retrieved using the [List Zoom Room Location API](https://marketplace.zoom.us/docs/api-reference/zoom-api/rooms-location/listzrlocations) (Id property in the response).
354     */
355    pub async fn update_zr_location_settings(
356        &self,
357        location_id: &str,
358        setting_type: &str,
359    ) -> ClientResult<crate::Response<()>> {
360        let mut query_args: Vec<(String, String)> = Default::default();
361        if !setting_type.is_empty() {
362            query_args.push(("setting_type".to_string(), setting_type.to_string()));
363        }
364        let query_ = serde_urlencoded::to_string(&query_args).unwrap();
365        let url = self.client.url(
366            &format!(
367                "/rooms/locations/{}/settings?{}",
368                crate::progenitor_support::encode_path(location_id),
369                query_
370            ),
371            None,
372        );
373        self.client
374            .patch(
375                &url,
376                crate::Message {
377                    body: None,
378                    content_type: Some("application/json".to_string()),
379                },
380            )
381            .await
382    }
383    /**
384     * Get Zoom Room location structure.
385     *
386     * This function performs a `GET` to the `/rooms/locations/structure` endpoint.
387     *
388     * Get the [location hierarchial structure(s)](https://support.zoom.us/hc/en-us/articles/115000342983-Zoom-Rooms-Location-Hierarchy) applied on the Zoom Rooms in an account.<br><br>
389     * **Prerequisites:**<br>
390     * * Zoom Rooms version 4.0 or higher
391     * * Account owner or admin permissions<br>
392     * **Scopes:** `room:read:admin`<br>
393     *  **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`
394     */
395    pub async fn get_zr_location_structure(
396        &self,
397    ) -> ClientResult<crate::Response<crate::types::GetZrLocationStructureResponse>> {
398        let url = self.client.url("/rooms/locations/structure", None);
399        self.client
400            .get(
401                &url,
402                crate::Message {
403                    body: None,
404                    content_type: None,
405                },
406            )
407            .await
408    }
409    /**
410     * Update Zoom Rooms location structure.
411     *
412     * This function performs a `PATCH` to the `/rooms/locations/structure` endpoint.
413     *
414     * Update the [location hierarchial structure(s)](https://support.zoom.us/hc/en-us/articles/115000342983-Zoom-Rooms-Location-Hierarchy) applied on the Zoom Rooms in an account.<br><br>
415     * **Prerequisites:**<br>
416     * * Zoom Rooms version 4.0 or higher
417     * * Account owner or admin permissions<br>
418     * **Scopes:** `room:write:admin`<br>
419     *  **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Medium`
420     */
421    pub async fn update_zoom_structure(
422        &self,
423        body: &crate::types::GetZrLocationStructureResponse,
424    ) -> ClientResult<crate::Response<()>> {
425        let url = self.client.url("/rooms/locations/structure", None);
426        self.client
427            .patch(
428                &url,
429                crate::Message {
430                    body: Some(reqwest::Body::from(serde_json::to_vec(body)?)),
431                    content_type: Some("application/json".to_string()),
432                },
433            )
434            .await
435    }
436    /**
437     * Change the assigned parent location.
438     *
439     * This function performs a `PUT` to the `/rooms/locations/{locationId}/location` endpoint.
440     *
441     * An account owner of a Zoom account can establish a [Zoom Rooms Location Hierarchy](https://support.zoom.us/hc/en-us/articles/115000342983-Zoom-Rooms-Location-Hierarchy) to better organize Zoom Rooms spread accross various location. The location can be structured in a hierarchy with Country being the top-level location, followed by city, campus, building, and floor. The location in the lower level in the hierarchy is considered as a child of the location that is a level above in the hierarchy. Use this API to change the parent location of a child location. <br><br> For instance, if the location hierarchy is structured in a way where there are two campuses (Campus 1, and Campus 2) in a City and Campus 1 consists of a building named Building 1 with a floor where Zoom Rooms are located, and you would like to rearrange the structure so that Building 1 along with its child locations (floor and Zoom Rooms) are relocated directly under Campus 2 instead of Campus 1, you must provide the location ID of Building 1 in the path parameter of this request and the location ID of Campus 2 as the value of `parent_location_id` in the  request body.<br><br>
442     * **Prerequisite:**<br>
443     * * Account owner or admin permission
444     * * Zoom Rooms version 4.0 or higher<br>
445     * **Scopes:** `room:write:admin`<br><br>
446     *  **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Medium`
447     *
448     * **Parameters:**
449     *
450     * * `location_id: &str` -- User's first name.
451     */
452    pub async fn change_parent_location(
453        &self,
454        location_id: &str,
455        body: &crate::types::ChangeParentLocationRequest,
456    ) -> ClientResult<crate::Response<()>> {
457        let url = self.client.url(
458            &format!(
459                "/rooms/locations/{}/location",
460                crate::progenitor_support::encode_path(location_id),
461            ),
462            None,
463        );
464        self.client
465            .put(
466                &url,
467                crate::Message {
468                    body: Some(reqwest::Body::from(serde_json::to_vec(body)?)),
469                    content_type: Some("application/json".to_string()),
470                },
471            )
472            .await
473    }
474}