zoom_api/phone.rs
1use crate::Client;
2use crate::ClientResult;
3
4pub struct Phone {
5 pub client: Client,
6}
7
8impl Phone {
9 #[doc(hidden)]
10 pub fn new(client: Client) -> Self {
11 Phone { client }
12 }
13
14 /**
15 * Set up a Zoom Phone account.
16 *
17 * This function performs a `POST` to the `/accounts/{accountId}/phone/setup` endpoint.
18 *
19 * After assigning a Zoom phone license to an account, an admin or account owner can proceed with the [initial Zoom phone set up](https://support.zoom.us/hc/en-us/articles/360001297663-Getting-started-with-Zoom-Phone-admin-#h_5ae26a3a-290c-4a8d-b3b0-6384ed267b13) using this API.
20 *
21 * **Scopes:** `phone:write:admin`, `phone:write`<br>**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`
22 *
23 * **Prerequisites:**
24 * * A Paid account
25 * * A Pro or a higher account plan
26 * * Master account option enabled
27 *
28 * **Parameters:**
29 *
30 * * `account_id: &str` -- Unique identifier of the account.
31 */
32 pub async fn set_up_account(
33 &self,
34 account_id: &str,
35 body: &crate::types::SetUpAccountRequest,
36 ) -> ClientResult<crate::Response<()>> {
37 let url = self.client.url(
38 &format!(
39 "/accounts/{}/phone/setup",
40 crate::progenitor_support::encode_path(account_id),
41 ),
42 None,
43 );
44 self.client
45 .post(
46 &url,
47 crate::Message {
48 body: Some(reqwest::Body::from(serde_json::to_vec(body)?)),
49 content_type: Some("application/json".to_string()),
50 },
51 )
52 .await
53 }
54 /**
55 * List phone numbers.
56 *
57 * This function performs a `GET` to the `/phone/numbers` endpoint.
58 *
59 * Use this API to list all Zoom Phone numbers in a Zoom account.
60 *
61 * **Scopes:** `phone:read:admin`<br>**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Medium`
62 *
63 * **Prerequisites:**
64 * * A Pro or higher account plan
65 * * A Zoom Phone license
66 *
67 * **Parameters:**
68 *
69 * * `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.
70 * * `type_: crate::types::ListAccountPhoneNumbersType` -- Query response by number assignment. The value can be one of the following:
71 * <br>
72 * `assigned`: The number has been assigned to either a user, a call queue, an auto-receptionist or a common area phone in an account. <br>`unassigned`: The number is not assigned to anyone.<br>
73 * `all`: Include both assigned and unassigned numbers in the response.<br>
74 * `byoc`: Include Bring Your Own Carrier (BYOC) numbers only in the response.
75 * * `extension_type: crate::types::ExtensionType` -- The type of assignee to whom the number is assigned. The value can be one of the following:<br>
76 * `user`<br> `callQueue`<br> `autoReceptionist`<br>
77 * `commonAreaPhone`.
78 * * `page_size: i64` -- The number of records returned within a single API call.
79 * * `number_type: crate::types::Type` -- The type of phone number. The value can be either `toll` or `tollfree`.
80 * * `pending_numbers: bool` -- Enable/disable the option for a sub account to use shared [Virtual Room Connector(s)](https://support.zoom.us/hc/en-us/articles/202134758-Getting-Started-With-Virtual-Room-Connector) that are set up by the master account. Virtual Room Connectors can only be used by On-prem users.
81 * * `site_id: &str` -- Unique identifier of the site. Use this query parameter if you have enabled multiple sites and would like to filter the response of this API call by a specific phone site. See [Managing multiple sites](https://support.zoom.us/hc/en-us/articles/360020809672-Managing-multiple-sites) or [Adding a site](https://support.zoom.us/hc/en-us/articles/360020809672-Managing-multiple-sites#h_05c88e35-1593-491f-b1a8-b7139a75dc15) for details.
82 */
83 pub async fn list_account_numbers(
84 &self,
85 next_page_token: &str,
86 type_: crate::types::ListAccountPhoneNumbersType,
87 extension_type: crate::types::ExtensionType,
88 page_size: i64,
89 number_type: crate::types::Type,
90 pending_numbers: bool,
91 site_id: &str,
92 ) -> ClientResult<crate::Response<Vec<crate::types::ListAccountPhoneNumbersResponse>>> {
93 let mut query_args: Vec<(String, String)> = Default::default();
94 if !extension_type.to_string().is_empty() {
95 query_args.push(("extension_type".to_string(), extension_type.to_string()));
96 }
97 if !next_page_token.is_empty() {
98 query_args.push(("next_page_token".to_string(), next_page_token.to_string()));
99 }
100 if !number_type.to_string().is_empty() {
101 query_args.push(("number_type".to_string(), number_type.to_string()));
102 }
103 if page_size > 0 {
104 query_args.push(("page_size".to_string(), page_size.to_string()));
105 }
106 if pending_numbers {
107 query_args.push(("pending_numbers".to_string(), pending_numbers.to_string()));
108 }
109 if !site_id.is_empty() {
110 query_args.push(("site_id".to_string(), site_id.to_string()));
111 }
112 if !type_.to_string().is_empty() {
113 query_args.push(("type".to_string(), type_.to_string()));
114 }
115 let query_ = serde_urlencoded::to_string(&query_args).unwrap();
116 let url = self.client.url(&format!("/phone/numbers?{}", query_), None);
117 let resp: crate::Response<crate::types::ListAccountPhoneNumbersResponseData> = self
118 .client
119 .get(
120 &url,
121 crate::Message {
122 body: None,
123 content_type: None,
124 },
125 )
126 .await?;
127
128 // Return our response data.
129 Ok(crate::Response::new(
130 resp.status,
131 resp.headers,
132 resp.body.phone_numbers.to_vec(),
133 ))
134 }
135 /**
136 * List phone numbers.
137 *
138 * This function performs a `GET` to the `/phone/numbers` endpoint.
139 *
140 * As opposed to `list_account_numbers`, this function returns all the pages of the request at once.
141 *
142 * Use this API to list all Zoom Phone numbers in a Zoom account.
143 *
144 * **Scopes:** `phone:read:admin`<br>**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Medium`
145 *
146 * **Prerequisites:**
147 * * A Pro or higher account plan
148 * * A Zoom Phone license
149 */
150 pub async fn list_all_account_numbers(
151 &self,
152 type_: crate::types::ListAccountPhoneNumbersType,
153 extension_type: crate::types::ExtensionType,
154 number_type: crate::types::Type,
155 pending_numbers: bool,
156 site_id: &str,
157 ) -> ClientResult<crate::Response<Vec<crate::types::ListAccountPhoneNumbersResponse>>> {
158 let mut query_args: Vec<(String, String)> = Default::default();
159 if !extension_type.to_string().is_empty() {
160 query_args.push(("extension_type".to_string(), extension_type.to_string()));
161 }
162 if !number_type.to_string().is_empty() {
163 query_args.push(("number_type".to_string(), number_type.to_string()));
164 }
165 if pending_numbers {
166 query_args.push(("pending_numbers".to_string(), pending_numbers.to_string()));
167 }
168 if !site_id.is_empty() {
169 query_args.push(("site_id".to_string(), site_id.to_string()));
170 }
171 if !type_.to_string().is_empty() {
172 query_args.push(("type".to_string(), type_.to_string()));
173 }
174 let query_ = serde_urlencoded::to_string(&query_args).unwrap();
175 let url = self.client.url(&format!("/phone/numbers?{}", query_), None);
176 let crate::Response::<crate::types::ListAccountPhoneNumbersResponseData> {
177 mut status,
178 mut headers,
179 mut body,
180 } = self
181 .client
182 .get(
183 &url,
184 crate::Message {
185 body: None,
186 content_type: None,
187 },
188 )
189 .await?;
190
191 let mut phone_numbers = body.phone_numbers;
192 let mut page = body.next_page_token;
193
194 // Paginate if we should.
195 while !page.is_empty() {
196 // Check if we already have URL params and need to concat the token.
197 if !url.contains('?') {
198 crate::Response::<crate::types::ListAccountPhoneNumbersResponseData> {
199 status,
200 headers,
201 body,
202 } = self
203 .client
204 .get(
205 &format!("{}?next_page_token={}", url, page),
206 crate::Message {
207 body: None,
208 content_type: None,
209 },
210 )
211 .await?;
212 } else {
213 crate::Response::<crate::types::ListAccountPhoneNumbersResponseData> {
214 status,
215 headers,
216 body,
217 } = self
218 .client
219 .get(
220 &format!("{}&next_page_token={}", url, page),
221 crate::Message {
222 body: None,
223 content_type: None,
224 },
225 )
226 .await?;
227 }
228
229 phone_numbers.append(&mut body.phone_numbers);
230
231 if !body.next_page_token.is_empty() && body.next_page_token != page {
232 page = body.next_page_token.to_string();
233 } else {
234 page = "".to_string();
235 }
236 }
237
238 // Return our response data.
239 Ok(crate::Response::new(status, headers, phone_numbers))
240 }
241 /**
242 * Get user's profile.
243 *
244 * This function performs a `GET` to the `/phone/users/{userId}` endpoint.
245 *
246 * Use this API to return a user's [Zoom phone](https://support.zoom.us/hc/en-us/articles/360001297663-Quickstart-Guide-for-Zoom-Phone-Administrators) profile. For user-level apps, pass [the `me` value](https://marketplace.zoom.us/docs/api-reference/using-zoom-apis#mekeyword) instead of the `userId` parameter.
247 *
248 * **Scopes:** `phone:read`, `phone:read:admin`<br>**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`
249 *
250 * **Prerequisites:**
251 * * A Business or Enterprise account
252 * * A Zoom Phone license
253 *
254 * **Parameters:**
255 *
256 * * `user_id: &str` -- The user ID or email address of the user. For user-level apps, pass `me` as the value for userId.
257 */
258 pub async fn user(
259 &self,
260 user_id: &str,
261 ) -> ClientResult<crate::Response<crate::types::PhoneUserResponse>> {
262 let url = self.client.url(
263 &format!(
264 "/phone/users/{}",
265 crate::progenitor_support::encode_path(user_id),
266 ),
267 None,
268 );
269 self.client
270 .get(
271 &url,
272 crate::Message {
273 body: None,
274 content_type: None,
275 },
276 )
277 .await
278 }
279 /**
280 * Update user's profile.
281 *
282 * This function performs a `PATCH` to the `/phone/users/{userId}` endpoint.
283 *
284 * Use this API to update a user's [Zoom Phone](https://support.zoom.us/hc/en-us/categories/360001370051-Zoom-Phone) profile. For user-level apps, pass [the `me` value](https://marketplace.zoom.us/docs/api-reference/using-zoom-apis#mekeyword) instead of the `userId` parameter.
285 *
286 * **Scopes:** `phone:write`, `phone:write:admin`<br>**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`
287 *
288 * **Prerequisites:**
289 * * A Business or Enterprise account
290 * * A Zoom Phone license
291 */
292 pub async fn update_user_profile(
293 &self,
294 user_id: &str,
295 body: &crate::types::UpdateUserProfileRequest,
296 ) -> ClientResult<crate::Response<()>> {
297 let url = self.client.url(
298 &format!(
299 "/phone/users/{}",
300 crate::progenitor_support::encode_path(user_id),
301 ),
302 None,
303 );
304 self.client
305 .patch(
306 &url,
307 crate::Message {
308 body: Some(reqwest::Body::from(serde_json::to_vec(body)?)),
309 content_type: Some("application/json".to_string()),
310 },
311 )
312 .await
313 }
314 /**
315 * Get account's setting.
316 *
317 * This function performs a `GET` to the `/phone/settings` endpoint.
318 *
319 * Use this API to return an account's settings.
320 *
321 * **Scopes:** `phone:read`, `phone:read:admin`<br>**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`
322 *
323 * **Prerequisites:**
324 * * A Business or Enterprise account
325 * * A Zoom Phone license
326 */
327 pub async fn setting(
328 &self,
329 account_id: &str,
330 ) -> ClientResult<crate::Response<crate::types::PhoneSettingResponse>> {
331 let url = self.client.url("/phone/settings", None);
332 self.client
333 .get(
334 &url,
335 crate::Message {
336 body: None,
337 content_type: None,
338 },
339 )
340 .await
341 }
342 /**
343 * Update BYOC settings.
344 *
345 * This function performs a `PATCH` to the `/phone/settings` endpoint.
346 *
347 * [Master account owners](https://marketplace.zoom.us/docs/api-reference/master-account-apis) can use this API to enable the BYOC (Bring Your Own Carrier) option for a subaccount.
348 *
349 * **Scopes:** `phone:master`
350 *
351 * **Prerequisites:**
352 * * A Business or Enterprise account
353 *
354 * **Parameters:**
355 *
356 * * `account_id: &str` -- Unique identifier of the sub account.
357 */
358 pub async fn update_settings(
359 &self,
360 account_id: &str,
361 body: &crate::types::UpdatePhoneSettingsRequest,
362 ) -> ClientResult<crate::Response<()>> {
363 let url = self.client.url("/phone/settings", None);
364 self.client
365 .patch(
366 &url,
367 crate::Message {
368 body: Some(reqwest::Body::from(serde_json::to_vec(body)?)),
369 content_type: Some("application/json".to_string()),
370 },
371 )
372 .await
373 }
374 /**
375 * Get user's settings.
376 *
377 * This function performs a `GET` to the `/phone/users/{userId}/settings` endpoint.
378 *
379 * Use this API to get a user's [Zoom Phone profile settings](https://support.zoom.us/hc/en-us/articles/360021325712-Configuring-Settings). For user-level apps, pass [the `me` value](https://marketplace.zoom.us/docs/api-reference/using-zoom-apis#mekeyword) instead of the `userId` parameter.
380 *
381 * **Scopes:** `phone:read`, `phone:read:admin`<br>**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`
382 *
383 * **Prerequisites:**
384 * * A Business or Enterprise account
385 * * A Zoom Phone license
386 *
387 * **Parameters:**
388 *
389 * * `user_id: &str` -- The user ID or email address of the user. For user-level apps, pass `me` as the value for userId.
390 */
391 pub async fn user_settings(
392 &self,
393 user_id: &str,
394 ) -> ClientResult<crate::Response<crate::types::PhoneUserSettingsResponse>> {
395 let url = self.client.url(
396 &format!(
397 "/phone/users/{}/settings",
398 crate::progenitor_support::encode_path(user_id),
399 ),
400 None,
401 );
402 self.client
403 .get(
404 &url,
405 crate::Message {
406 body: None,
407 content_type: None,
408 },
409 )
410 .await
411 }
412 /**
413 * List setting templates.
414 *
415 * This function performs a `GET` to the `/phone/setting_templates` endpoint.
416 *
417 * Use this API to get a list of all the created phone template settings.
418 *
419 * **Scopes:** `phone:read:admin` or `phone:read`<br>**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`
420 *
421 * **Prerequisites:**
422 * * A Business or Enterprise account
423 * * A Zoom Phone license
424 *
425 * **Parameters:**
426 *
427 * * `page_size: i64` -- Number of records returns within a single API call.
428 * * `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.
429 * * `site_id: &str` -- Unique identifier of the site. This field is required only if multiple sites have been enabled. of the site. Required only when multiple sites are enabled. See [Managing multiple sites](https://support.zoom.us/hc/en-us/articles/360020809672-Managing-multiple-sites) for details. If this is not provided, the response lists the account level setting templates.
430 */
431 pub async fn list_setting_templates(
432 &self,
433 page_size: i64,
434 next_page_token: &str,
435 site_id: &str,
436 ) -> ClientResult<crate::Response<Vec<crate::types::Templates>>> {
437 let mut query_args: Vec<(String, String)> = Default::default();
438 if !next_page_token.is_empty() {
439 query_args.push(("next_page_token".to_string(), next_page_token.to_string()));
440 }
441 if page_size > 0 {
442 query_args.push(("page_size".to_string(), page_size.to_string()));
443 }
444 if !site_id.is_empty() {
445 query_args.push(("site_id".to_string(), site_id.to_string()));
446 }
447 let query_ = serde_urlencoded::to_string(&query_args).unwrap();
448 let url = self
449 .client
450 .url(&format!("/phone/setting_templates?{}", query_), None);
451 let resp: crate::Response<crate::types::ListSettingTemplatesResponse> = self
452 .client
453 .get(
454 &url,
455 crate::Message {
456 body: None,
457 content_type: None,
458 },
459 )
460 .await?;
461
462 // Return our response data.
463 Ok(crate::Response::new(
464 resp.status,
465 resp.headers,
466 resp.body.templates.to_vec(),
467 ))
468 }
469 /**
470 * List setting templates.
471 *
472 * This function performs a `GET` to the `/phone/setting_templates` endpoint.
473 *
474 * As opposed to `list_setting_templates`, this function returns all the pages of the request at once.
475 *
476 * Use this API to get a list of all the created phone template settings.
477 *
478 * **Scopes:** `phone:read:admin` or `phone:read`<br>**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`
479 *
480 * **Prerequisites:**
481 * * A Business or Enterprise account
482 * * A Zoom Phone license
483 */
484 pub async fn list_all_setting_templates(
485 &self,
486 site_id: &str,
487 ) -> ClientResult<crate::Response<Vec<crate::types::Templates>>> {
488 let mut query_args: Vec<(String, String)> = Default::default();
489 if !site_id.is_empty() {
490 query_args.push(("site_id".to_string(), site_id.to_string()));
491 }
492 let query_ = serde_urlencoded::to_string(&query_args).unwrap();
493 let url = self
494 .client
495 .url(&format!("/phone/setting_templates?{}", query_), None);
496 let crate::Response::<crate::types::ListSettingTemplatesResponse> {
497 mut status,
498 mut headers,
499 mut body,
500 } = self
501 .client
502 .get(
503 &url,
504 crate::Message {
505 body: None,
506 content_type: None,
507 },
508 )
509 .await?;
510
511 let mut templates = body.templates;
512 let mut page = body.next_page_token;
513
514 // Paginate if we should.
515 while !page.is_empty() {
516 // Check if we already have URL params and need to concat the token.
517 if !url.contains('?') {
518 crate::Response::<crate::types::ListSettingTemplatesResponse> {
519 status,
520 headers,
521 body,
522 } = self
523 .client
524 .get(
525 &format!("{}?next_page_token={}", url, page),
526 crate::Message {
527 body: None,
528 content_type: None,
529 },
530 )
531 .await?;
532 } else {
533 crate::Response::<crate::types::ListSettingTemplatesResponse> {
534 status,
535 headers,
536 body,
537 } = self
538 .client
539 .get(
540 &format!("{}&next_page_token={}", url, page),
541 crate::Message {
542 body: None,
543 content_type: None,
544 },
545 )
546 .await?;
547 }
548
549 templates.append(&mut body.templates);
550
551 if !body.next_page_token.is_empty() && body.next_page_token != page {
552 page = body.next_page_token.to_string();
553 } else {
554 page = "".to_string();
555 }
556 }
557
558 // Return our response data.
559 Ok(crate::Response::new(status, headers, templates))
560 }
561 /**
562 * Add a setting template.
563 *
564 * This function performs a `POST` to the `/phone/setting_templates` endpoint.
565 *
566 * Use this API to create a Zoom Phone setting template for an account. After creating a phone template, the defined settings will become the default settings for an account.
567 *
568 * **Scopes:** `phone:write:admin`, `phone:write`<br>**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`
569 *
570 * **Prerequisites:**
571 * * A Business or enterprise Zoom account
572 * * A Zoom Phone license
573 */
574 pub async fn add_setting_template(
575 &self,
576 body: &crate::types::AddSettingTemplateRequest,
577 ) -> ClientResult<crate::Response<crate::types::AddSettingTemplateResponse>> {
578 let url = self.client.url("/phone/setting_templates", None);
579 self.client
580 .post(
581 &url,
582 crate::Message {
583 body: Some(reqwest::Body::from(serde_json::to_vec(body)?)),
584 content_type: Some("application/json".to_string()),
585 },
586 )
587 .await
588 }
589 /**
590 * Batch add emergency service locations.
591 *
592 * This function performs a `POST` to the `/phone/batch_locations` endpoint.
593 *
594 * Use this API to batch add emergency service locations.
595 */
596 pub async fn batch_add_locations(
597 &self,
598 body: &crate::types::BatchAddLocationsRequest,
599 ) -> ClientResult<crate::Response<Vec<crate::types::BatchAddLocationsResponse>>> {
600 let url = self.client.url("/phone/batch_locations", None);
601 self.client
602 .post(
603 &url,
604 crate::Message {
605 body: Some(reqwest::Body::from(serde_json::to_vec(body)?)),
606 content_type: Some("application/json".to_string()),
607 },
608 )
609 .await
610 }
611 /**
612 * List emergency service locations.
613 *
614 * This function performs a `GET` to the `/phone/locations` endpoint.
615 *
616 * Use this API to list emergency service locations.
617 *
618 * **Scopes:** `phone:read:admin`<br>**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`
619 *
620 * **Prerequisites:**
621 * * Pro or a higher account with Zoom Phone license
622 * * Account owner or admin permissions
623 *
624 * **Parameters:**
625 *
626 * * `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.
627 * * `page_size: i64` -- The number of records returned within a single API call.
628 */
629 pub async fn list_locations(
630 &self,
631 next_page_token: &str,
632 page_size: i64,
633 ) -> ClientResult<crate::Response<Vec<crate::types::ListLocationsResponse>>> {
634 let mut query_args: Vec<(String, String)> = Default::default();
635 if !next_page_token.is_empty() {
636 query_args.push(("next_page_token".to_string(), next_page_token.to_string()));
637 }
638 if page_size > 0 {
639 query_args.push(("page_size".to_string(), page_size.to_string()));
640 }
641 let query_ = serde_urlencoded::to_string(&query_args).unwrap();
642 let url = self
643 .client
644 .url(&format!("/phone/locations?{}", query_), None);
645 let resp: crate::Response<crate::types::ListLocationsResponseData> = self
646 .client
647 .get(
648 &url,
649 crate::Message {
650 body: None,
651 content_type: None,
652 },
653 )
654 .await?;
655
656 // Return our response data.
657 Ok(crate::Response::new(
658 resp.status,
659 resp.headers,
660 resp.body.locations.to_vec(),
661 ))
662 }
663 /**
664 * List emergency service locations.
665 *
666 * This function performs a `GET` to the `/phone/locations` endpoint.
667 *
668 * As opposed to `list_locations`, this function returns all the pages of the request at once.
669 *
670 * Use this API to list emergency service locations.
671 *
672 * **Scopes:** `phone:read:admin`<br>**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`
673 *
674 * **Prerequisites:**
675 * * Pro or a higher account with Zoom Phone license
676 * * Account owner or admin permissions
677 */
678 pub async fn list_all_locations(
679 &self,
680 ) -> ClientResult<crate::Response<Vec<crate::types::ListLocationsResponse>>> {
681 let url = self.client.url("/phone/locations", None);
682 let crate::Response::<crate::types::ListLocationsResponseData> {
683 mut status,
684 mut headers,
685 mut body,
686 } = self
687 .client
688 .get(
689 &url,
690 crate::Message {
691 body: None,
692 content_type: None,
693 },
694 )
695 .await?;
696
697 let mut locations = body.locations;
698 let mut page = body.next_page_token;
699
700 // Paginate if we should.
701 while !page.is_empty() {
702 // Check if we already have URL params and need to concat the token.
703 if !url.contains('?') {
704 crate::Response::<crate::types::ListLocationsResponseData> {
705 status,
706 headers,
707 body,
708 } = self
709 .client
710 .get(
711 &format!("{}?next_page_token={}", url, page),
712 crate::Message {
713 body: None,
714 content_type: None,
715 },
716 )
717 .await?;
718 } else {
719 crate::Response::<crate::types::ListLocationsResponseData> {
720 status,
721 headers,
722 body,
723 } = self
724 .client
725 .get(
726 &format!("{}&next_page_token={}", url, page),
727 crate::Message {
728 body: None,
729 content_type: None,
730 },
731 )
732 .await?;
733 }
734
735 locations.append(&mut body.locations);
736
737 if !body.next_page_token.is_empty() && body.next_page_token != page {
738 page = body.next_page_token.to_string();
739 } else {
740 page = "".to_string();
741 }
742 }
743
744 // Return our response data.
745 Ok(crate::Response::new(status, headers, locations))
746 }
747 /**
748 * Add emergency service location.
749 *
750 * This function performs a `POST` to the `/phone/locations` endpoint.
751 *
752 * Use this API to add an emergency service location.
753 *
754 * **Scopes:** `phone:write:adminRate`<br>**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`
755 *
756 * **Prerequisites:**
757 * * Pro or a higher account with Zoom Phone license
758 * * Account owner or admin permissions
759 */
760 pub async fn add_location(
761 &self,
762 body: &crate::types::AddLocationRequest,
763 ) -> ClientResult<crate::Response<Vec<crate::types::Site>>> {
764 let url = self.client.url("/phone/locations", None);
765 self.client
766 .post(
767 &url,
768 crate::Message {
769 body: Some(reqwest::Body::from(serde_json::to_vec(body)?)),
770 content_type: Some("application/json".to_string()),
771 },
772 )
773 .await
774 }
775 /**
776 * Get emergency service location details.
777 *
778 * This function performs a `GET` to the `/phone/locations/{locationId}` endpoint.
779 *
780 * Use this API to return an emergency service location's information.
781 *
782 * **Scopes:** `phone:write:admin`<br>**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`
783 *
784 * **Prerequisites:**
785 * * Pro or a higher account with Zoom Phone license
786 * * Account owner or admin permissions
787 *
788 * **Parameters:**
789 *
790 * * `location_id: &str` -- The emergency service location's ID.
791 */
792 pub async fn get_location(
793 &self,
794 location_id: &str,
795 ) -> ClientResult<crate::Response<crate::types::GetLocationResponse>> {
796 let url = self.client.url(
797 &format!(
798 "/phone/locations/{}",
799 crate::progenitor_support::encode_path(location_id),
800 ),
801 None,
802 );
803 self.client
804 .get(
805 &url,
806 crate::Message {
807 body: None,
808 content_type: None,
809 },
810 )
811 .await
812 }
813 /**
814 * Delete an emergency location.
815 *
816 * This function performs a `DELETE` to the `/phone/locations/{locationId}` endpoint.
817 *
818 * Use this API to remove an emergency location.
819 *
820 * **Scopes:** `phone:write:admin`<br>**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`
821 *
822 * **Prerequisites:**
823 * * Pro or a higher account with Zoom Phone license
824 * * Account owner or admin permissions
825 *
826 * **Parameters:**
827 *
828 * * `location_id: &str` -- The emergency service location's ID.
829 */
830 pub async fn delete_location(&self, location_id: &str) -> ClientResult<crate::Response<()>> {
831 let url = self.client.url(
832 &format!(
833 "/phone/locations/{}",
834 crate::progenitor_support::encode_path(location_id),
835 ),
836 None,
837 );
838 self.client
839 .delete(
840 &url,
841 crate::Message {
842 body: None,
843 content_type: None,
844 },
845 )
846 .await
847 }
848 /**
849 * Update emergency service location.
850 *
851 * This function performs a `PATCH` to the `/phone/locations/{locationId}` endpoint.
852 *
853 * Use this API to update an emergency location's information.
854 *
855 * **Scopes:** `phone:write:admin`<br>**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`
856 *
857 * **Prerequisites:**
858 * * Pro or a higher account with Zoom Phone license
859 * * Account owner or admin permissions
860 */
861 pub async fn update_location(
862 &self,
863 location_id: &str,
864 body: &crate::types::UpdateLocationRequest,
865 ) -> ClientResult<crate::Response<()>> {
866 let url = self.client.url(
867 &format!(
868 "/phone/locations/{}",
869 crate::progenitor_support::encode_path(location_id),
870 ),
871 None,
872 );
873 self.client
874 .patch(
875 &url,
876 crate::Message {
877 body: Some(reqwest::Body::from(serde_json::to_vec(body)?)),
878 content_type: Some("application/json".to_string()),
879 },
880 )
881 .await
882 }
883 /**
884 * List SIP groups.
885 *
886 * This function performs a `GET` to the `/phone/sip_groups` endpoint.
887 *
888 * Use this API to list SIP (Session Initiation Protocol) groups.
889 *
890 * **Scopes:** `phone:read:admin`<br>**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`
891 *
892 * **Prerequisites:**
893 * * Pro or a higher account with Zoom Phone license
894 * * Account owner or admin permissions
895 *
896 * **Parameters:**
897 *
898 * * `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.
899 * * `page_size: i64` -- The number of records returned within a single API call.
900 */
901 pub async fn list_sip_groups(
902 &self,
903 next_page_token: &str,
904 page_size: i64,
905 ) -> ClientResult<crate::Response<Vec<crate::types::SipGroups>>> {
906 let mut query_args: Vec<(String, String)> = Default::default();
907 if !next_page_token.is_empty() {
908 query_args.push(("next_page_token".to_string(), next_page_token.to_string()));
909 }
910 if page_size > 0 {
911 query_args.push(("page_size".to_string(), page_size.to_string()));
912 }
913 let query_ = serde_urlencoded::to_string(&query_args).unwrap();
914 let url = self
915 .client
916 .url(&format!("/phone/sip_groups?{}", query_), None);
917 let resp: crate::Response<crate::types::ListSipGroupsResponse> = self
918 .client
919 .get(
920 &url,
921 crate::Message {
922 body: None,
923 content_type: None,
924 },
925 )
926 .await?;
927
928 // Return our response data.
929 Ok(crate::Response::new(
930 resp.status,
931 resp.headers,
932 resp.body.sip_groups.to_vec(),
933 ))
934 }
935 /**
936 * List SIP groups.
937 *
938 * This function performs a `GET` to the `/phone/sip_groups` endpoint.
939 *
940 * As opposed to `list_sip_groups`, this function returns all the pages of the request at once.
941 *
942 * Use this API to list SIP (Session Initiation Protocol) groups.
943 *
944 * **Scopes:** `phone:read:admin`<br>**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`
945 *
946 * **Prerequisites:**
947 * * Pro or a higher account with Zoom Phone license
948 * * Account owner or admin permissions
949 */
950 pub async fn list_all_sip_groups(
951 &self,
952 ) -> ClientResult<crate::Response<Vec<crate::types::SipGroups>>> {
953 let url = self.client.url("/phone/sip_groups", None);
954 let crate::Response::<crate::types::ListSipGroupsResponse> {
955 mut status,
956 mut headers,
957 mut body,
958 } = self
959 .client
960 .get(
961 &url,
962 crate::Message {
963 body: None,
964 content_type: None,
965 },
966 )
967 .await?;
968
969 let mut sip_groups = body.sip_groups;
970 let mut page = body.next_page_token;
971
972 // Paginate if we should.
973 while !page.is_empty() {
974 // Check if we already have URL params and need to concat the token.
975 if !url.contains('?') {
976 crate::Response::<crate::types::ListSipGroupsResponse> {
977 status,
978 headers,
979 body,
980 } = self
981 .client
982 .get(
983 &format!("{}?next_page_token={}", url, page),
984 crate::Message {
985 body: None,
986 content_type: None,
987 },
988 )
989 .await?;
990 } else {
991 crate::Response::<crate::types::ListSipGroupsResponse> {
992 status,
993 headers,
994 body,
995 } = self
996 .client
997 .get(
998 &format!("{}&next_page_token={}", url, page),
999 crate::Message {
1000 body: None,
1001 content_type: None,
1002 },
1003 )
1004 .await?;
1005 }
1006
1007 sip_groups.append(&mut body.sip_groups);
1008
1009 if !body.next_page_token.is_empty() && body.next_page_token != page {
1010 page = body.next_page_token.to_string();
1011 } else {
1012 page = "".to_string();
1013 }
1014 }
1015
1016 // Return our response data.
1017 Ok(crate::Response::new(status, headers, sip_groups))
1018 }
1019 /**
1020 * Get setting template details.
1021 *
1022 * This function performs a `GET` to the `/phone/setting_templates/{templateId}` endpoint.
1023 *
1024 * Use this API to return information about an account's phone template.
1025 *
1026 * **Scopes:** `phone:write:admin` or `phone:write`<br>**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`
1027 *
1028 * **Prerequisites:**
1029 * * A Business or Enterprise account
1030 * * A Zoom Phone license
1031 *
1032 * **Parameters:**
1033 *
1034 * * `template_id: &str` -- Unique identifier of the template.
1035 * * `custom_query_fields: &str` -- Provide the name of the field to use to filter the response. For example, if you provide "description" as the value of the field, you will get a response similar to the following: {“description”: “template description”}.
1036 */
1037 pub async fn get_setting_template(
1038 &self,
1039 template_id: &str,
1040 custom_query_fields: &str,
1041 ) -> ClientResult<crate::Response<crate::types::GetSettingTemplateResponse>> {
1042 let mut query_args: Vec<(String, String)> = Default::default();
1043 if !custom_query_fields.is_empty() {
1044 query_args.push((
1045 "custom_query_fields".to_string(),
1046 custom_query_fields.to_string(),
1047 ));
1048 }
1049 let query_ = serde_urlencoded::to_string(&query_args).unwrap();
1050 let url = self.client.url(
1051 &format!(
1052 "/phone/setting_templates/{}?{}",
1053 crate::progenitor_support::encode_path(template_id),
1054 query_
1055 ),
1056 None,
1057 );
1058 self.client
1059 .get(
1060 &url,
1061 crate::Message {
1062 body: None,
1063 content_type: None,
1064 },
1065 )
1066 .await
1067 }
1068 /**
1069 * Update a setting template.
1070 *
1071 * This function performs a `PATCH` to the `/phone/setting_templates/{templateId}` endpoint.
1072 *
1073 * Use this API to update or modify a phone template's settings.
1074 *
1075 * **Scopes:** `phone:write:admin` or `phone:write`<br>**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`
1076 *
1077 * **Prerequisites:**
1078 * * A Business or Enterprise account
1079 * * A Zoom Phone license
1080 *
1081 * **Parameters:**
1082 *
1083 * * `template_id: &str` -- User's first name.
1084 */
1085 pub async fn update_setting_template(
1086 &self,
1087 template_id: &str,
1088 body: &crate::types::UpdateSettingTemplateRequest,
1089 ) -> ClientResult<crate::Response<()>> {
1090 let url = self.client.url(
1091 &format!(
1092 "/phone/setting_templates/{}",
1093 crate::progenitor_support::encode_path(template_id),
1094 ),
1095 None,
1096 );
1097 self.client
1098 .patch(
1099 &url,
1100 crate::Message {
1101 body: Some(reqwest::Body::from(serde_json::to_vec(body)?)),
1102 content_type: Some("application/json".to_string()),
1103 },
1104 )
1105 .await
1106 }
1107 /**
1108 * Get user's call logs.
1109 *
1110 * This function performs a `GET` to the `/phone/users/{userId}/call_logs` endpoint.
1111 *
1112 * Use this API to get a user's [Zoom phone](https://support.zoom.us/hc/en-us/articles/360001297663-Quickstart-Guide-for-Zoom-Phone-Administrators) call logs. For user-level apps, pass [the `me` value](https://marketplace.zoom.us/docs/api-reference/using-zoom-apis#mekeyword) instead of the `userId` parameter.
1113 *
1114 * **Scopes:** `phone:read`, `phone:read:admin`, `phone_call_log:read`, `phone_call_log:read:admin`<br>**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Heavy`
1115 *
1116 * **Prerequisites:**
1117 * * A Business or Enterprise account
1118 * * A Zoom Phone license
1119 *
1120 * **Parameters:**
1121 *
1122 * * `user_id: &str` -- The user ID or email address of the user. For user-level apps, pass `me` as the value for userId.
1123 * * `page_size: i64` -- The number of records returned within a single API call.
1124 * * `from: chrono::NaiveDate` -- Start date in 'yyyy-mm-dd' format. The date range defined by the "from" and "to" parameters should only be one month as the report includes only one month worth of data at once.
1125 * * `to: chrono::NaiveDate` -- Start Date.
1126 * * `type_: crate::types::PhoneUserCallLogsType`
1127 * * `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.
1128 * * `phone_number: &str` -- Filter API responses to include call logs of only the phone number defined in this field.
1129 * * `time_type: crate::types::TimeType` -- Enables you to sort call logs by start or end time. Choose the sort time value. Values include `startTime` or `endTime`.
1130 */
1131 pub async fn user_call_logs(
1132 &self,
1133 user_id: &str,
1134 page_size: i64,
1135 from: chrono::NaiveDate,
1136 to: chrono::NaiveDate,
1137 type_: crate::types::PhoneUserCallLogsType,
1138 next_page_token: &str,
1139 phone_number: &str,
1140 time_type: crate::types::TimeType,
1141 ) -> ClientResult<crate::Response<Vec<crate::types::CallLogs>>> {
1142 let mut query_args: Vec<(String, String)> = Default::default();
1143 if !from.to_string().is_empty() {
1144 query_args.push(("from".to_string(), from.to_string()));
1145 }
1146 if !next_page_token.is_empty() {
1147 query_args.push(("next_page_token".to_string(), next_page_token.to_string()));
1148 }
1149 if page_size > 0 {
1150 query_args.push(("page_size".to_string(), page_size.to_string()));
1151 }
1152 if !phone_number.is_empty() {
1153 query_args.push(("phone_number".to_string(), phone_number.to_string()));
1154 }
1155 if !time_type.to_string().is_empty() {
1156 query_args.push(("time_type".to_string(), time_type.to_string()));
1157 }
1158 if !to.to_string().is_empty() {
1159 query_args.push(("to".to_string(), to.to_string()));
1160 }
1161 if !type_.to_string().is_empty() {
1162 query_args.push(("type".to_string(), type_.to_string()));
1163 }
1164 let query_ = serde_urlencoded::to_string(&query_args).unwrap();
1165 let url = self.client.url(
1166 &format!(
1167 "/phone/users/{}/call_logs?{}",
1168 crate::progenitor_support::encode_path(user_id),
1169 query_
1170 ),
1171 None,
1172 );
1173 let resp: crate::Response<crate::types::PhoneUserCallLogsResponse> = self
1174 .client
1175 .get(
1176 &url,
1177 crate::Message {
1178 body: None,
1179 content_type: None,
1180 },
1181 )
1182 .await?;
1183
1184 // Return our response data.
1185 Ok(crate::Response::new(
1186 resp.status,
1187 resp.headers,
1188 resp.body.call_logs.to_vec(),
1189 ))
1190 }
1191 /**
1192 * Get user's call logs.
1193 *
1194 * This function performs a `GET` to the `/phone/users/{userId}/call_logs` endpoint.
1195 *
1196 * As opposed to `user_call_logs`, this function returns all the pages of the request at once.
1197 *
1198 * Use this API to get a user's [Zoom phone](https://support.zoom.us/hc/en-us/articles/360001297663-Quickstart-Guide-for-Zoom-Phone-Administrators) call logs. For user-level apps, pass [the `me` value](https://marketplace.zoom.us/docs/api-reference/using-zoom-apis#mekeyword) instead of the `userId` parameter.
1199 *
1200 * **Scopes:** `phone:read`, `phone:read:admin`, `phone_call_log:read`, `phone_call_log:read:admin`<br>**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Heavy`
1201 *
1202 * **Prerequisites:**
1203 * * A Business or Enterprise account
1204 * * A Zoom Phone license
1205 */
1206 pub async fn get_all_user_call_logs(
1207 &self,
1208 user_id: &str,
1209 from: chrono::NaiveDate,
1210 to: chrono::NaiveDate,
1211 type_: crate::types::PhoneUserCallLogsType,
1212 phone_number: &str,
1213 time_type: crate::types::TimeType,
1214 ) -> ClientResult<crate::Response<Vec<crate::types::CallLogs>>> {
1215 let mut query_args: Vec<(String, String)> = Default::default();
1216 if !from.to_string().is_empty() {
1217 query_args.push(("from".to_string(), from.to_string()));
1218 }
1219 if !phone_number.is_empty() {
1220 query_args.push(("phone_number".to_string(), phone_number.to_string()));
1221 }
1222 if !time_type.to_string().is_empty() {
1223 query_args.push(("time_type".to_string(), time_type.to_string()));
1224 }
1225 if !to.to_string().is_empty() {
1226 query_args.push(("to".to_string(), to.to_string()));
1227 }
1228 if !type_.to_string().is_empty() {
1229 query_args.push(("type".to_string(), type_.to_string()));
1230 }
1231 let query_ = serde_urlencoded::to_string(&query_args).unwrap();
1232 let url = self.client.url(
1233 &format!(
1234 "/phone/users/{}/call_logs?{}",
1235 crate::progenitor_support::encode_path(user_id),
1236 query_
1237 ),
1238 None,
1239 );
1240 let crate::Response::<crate::types::PhoneUserCallLogsResponse> {
1241 mut status,
1242 mut headers,
1243 mut body,
1244 } = self
1245 .client
1246 .get(
1247 &url,
1248 crate::Message {
1249 body: None,
1250 content_type: None,
1251 },
1252 )
1253 .await?;
1254
1255 let mut call_logs = body.call_logs;
1256 let mut page = body.next_page_token;
1257
1258 // Paginate if we should.
1259 while !page.is_empty() {
1260 // Check if we already have URL params and need to concat the token.
1261 if !url.contains('?') {
1262 crate::Response::<crate::types::PhoneUserCallLogsResponse> {
1263 status,
1264 headers,
1265 body,
1266 } = self
1267 .client
1268 .get(
1269 &format!("{}?next_page_token={}", url, page),
1270 crate::Message {
1271 body: None,
1272 content_type: None,
1273 },
1274 )
1275 .await?;
1276 } else {
1277 crate::Response::<crate::types::PhoneUserCallLogsResponse> {
1278 status,
1279 headers,
1280 body,
1281 } = self
1282 .client
1283 .get(
1284 &format!("{}&next_page_token={}", url, page),
1285 crate::Message {
1286 body: None,
1287 content_type: None,
1288 },
1289 )
1290 .await?;
1291 }
1292
1293 call_logs.append(&mut body.call_logs);
1294
1295 if !body.next_page_token.is_empty() && body.next_page_token != page {
1296 page = body.next_page_token.to_string();
1297 } else {
1298 page = "".to_string();
1299 }
1300 }
1301
1302 // Return our response data.
1303 Ok(crate::Response::new(status, headers, call_logs))
1304 }
1305 /**
1306 * Get user's recordings.
1307 *
1308 * This function performs a `GET` to the `/phone/users/{userId}/recordings` endpoint.
1309 *
1310 * Use this API to get a user's [Zoom Phone recordings](https://support.zoom.us/hc/en-us/articles/360021336671-Viewing-Call-History-and-Recordings). For user-level apps, pass [the `me` value](https://marketplace.zoom.us/docs/api-reference/using-zoom-apis#mekeyword) instead of the `userId` parameter.
1311 *
1312 * **Scopes:** `phone:read`, `phone:read:admin`, `phone_recording:read`, `phone_recording:read:admin`<br>**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Medium`
1313 *
1314 * **Prerequisites:**
1315 * * A Business or Enterprise account
1316 * * A Zoom Phone license
1317 *
1318 * **Parameters:**
1319 *
1320 * * `user_id: &str` -- The user ID or email address of the user. For user-level apps, pass `me` as the value for userId.
1321 * * `page_size: i64` -- The number of records returned within a single API call.
1322 * * `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.
1323 * * `from: chrono::NaiveDate` -- Start date for the query in 'yyyy-mm-dd' format. The date range defined by the "from" and "to" parameters should only be one month as the response includes only one month worth of recording data. The month defined should fall within the last six months.
1324 * * `to: chrono::NaiveDate` -- Start Date.
1325 */
1326 pub async fn user_recordings(
1327 &self,
1328 user_id: &str,
1329 page_size: i64,
1330 next_page_token: &str,
1331 from: chrono::NaiveDate,
1332 to: chrono::NaiveDate,
1333 ) -> ClientResult<crate::Response<Vec<crate::types::Recordings>>> {
1334 let mut query_args: Vec<(String, String)> = Default::default();
1335 if !from.to_string().is_empty() {
1336 query_args.push(("from".to_string(), from.to_string()));
1337 }
1338 if !next_page_token.is_empty() {
1339 query_args.push(("next_page_token".to_string(), next_page_token.to_string()));
1340 }
1341 if page_size > 0 {
1342 query_args.push(("page_size".to_string(), page_size.to_string()));
1343 }
1344 if !to.to_string().is_empty() {
1345 query_args.push(("to".to_string(), to.to_string()));
1346 }
1347 let query_ = serde_urlencoded::to_string(&query_args).unwrap();
1348 let url = self.client.url(
1349 &format!(
1350 "/phone/users/{}/recordings?{}",
1351 crate::progenitor_support::encode_path(user_id),
1352 query_
1353 ),
1354 None,
1355 );
1356 let resp: crate::Response<crate::types::PhoneUserRecordingsResponse> = self
1357 .client
1358 .get(
1359 &url,
1360 crate::Message {
1361 body: None,
1362 content_type: None,
1363 },
1364 )
1365 .await?;
1366
1367 // Return our response data.
1368 Ok(crate::Response::new(
1369 resp.status,
1370 resp.headers,
1371 resp.body.recordings.to_vec(),
1372 ))
1373 }
1374 /**
1375 * Get user's recordings.
1376 *
1377 * This function performs a `GET` to the `/phone/users/{userId}/recordings` endpoint.
1378 *
1379 * As opposed to `user_recordings`, this function returns all the pages of the request at once.
1380 *
1381 * Use this API to get a user's [Zoom Phone recordings](https://support.zoom.us/hc/en-us/articles/360021336671-Viewing-Call-History-and-Recordings). For user-level apps, pass [the `me` value](https://marketplace.zoom.us/docs/api-reference/using-zoom-apis#mekeyword) instead of the `userId` parameter.
1382 *
1383 * **Scopes:** `phone:read`, `phone:read:admin`, `phone_recording:read`, `phone_recording:read:admin`<br>**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Medium`
1384 *
1385 * **Prerequisites:**
1386 * * A Business or Enterprise account
1387 * * A Zoom Phone license
1388 */
1389 pub async fn get_all_user_recordings(
1390 &self,
1391 user_id: &str,
1392 from: chrono::NaiveDate,
1393 to: chrono::NaiveDate,
1394 ) -> ClientResult<crate::Response<Vec<crate::types::Recordings>>> {
1395 let mut query_args: Vec<(String, String)> = Default::default();
1396 if !from.to_string().is_empty() {
1397 query_args.push(("from".to_string(), from.to_string()));
1398 }
1399 if !to.to_string().is_empty() {
1400 query_args.push(("to".to_string(), to.to_string()));
1401 }
1402 let query_ = serde_urlencoded::to_string(&query_args).unwrap();
1403 let url = self.client.url(
1404 &format!(
1405 "/phone/users/{}/recordings?{}",
1406 crate::progenitor_support::encode_path(user_id),
1407 query_
1408 ),
1409 None,
1410 );
1411 let crate::Response::<crate::types::PhoneUserRecordingsResponse> {
1412 mut status,
1413 mut headers,
1414 mut body,
1415 } = self
1416 .client
1417 .get(
1418 &url,
1419 crate::Message {
1420 body: None,
1421 content_type: None,
1422 },
1423 )
1424 .await?;
1425
1426 let mut recordings = body.recordings;
1427 let mut page = body.next_page_token;
1428
1429 // Paginate if we should.
1430 while !page.is_empty() {
1431 // Check if we already have URL params and need to concat the token.
1432 if !url.contains('?') {
1433 crate::Response::<crate::types::PhoneUserRecordingsResponse> {
1434 status,
1435 headers,
1436 body,
1437 } = self
1438 .client
1439 .get(
1440 &format!("{}?next_page_token={}", url, page),
1441 crate::Message {
1442 body: None,
1443 content_type: None,
1444 },
1445 )
1446 .await?;
1447 } else {
1448 crate::Response::<crate::types::PhoneUserRecordingsResponse> {
1449 status,
1450 headers,
1451 body,
1452 } = self
1453 .client
1454 .get(
1455 &format!("{}&next_page_token={}", url, page),
1456 crate::Message {
1457 body: None,
1458 content_type: None,
1459 },
1460 )
1461 .await?;
1462 }
1463
1464 recordings.append(&mut body.recordings);
1465
1466 if !body.next_page_token.is_empty() && body.next_page_token != page {
1467 page = body.next_page_token.to_string();
1468 } else {
1469 page = "".to_string();
1470 }
1471 }
1472
1473 // Return our response data.
1474 Ok(crate::Response::new(status, headers, recordings))
1475 }
1476 /**
1477 * Get user's voicemails.
1478 *
1479 * This function performs a `GET` to the `/phone/users/{userId}/voice_mails` endpoint.
1480 *
1481 * Use this API to get a user's Zoom Phone voicemails. For user-level apps, pass [the `me` value](https://marketplace.zoom.us/docs/api-reference/using-zoom-apis#mekeyword) instead of the `userId` parameter.
1482 *
1483 * **Scopes:** `phone:read`, `phone:read:admin`, `phone_voicemail:read`, `phone_voicemail:read:admin`<br>**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Medium`
1484 *
1485 * **Prerequisites:**
1486 * * A Business or Enterprise account
1487 * * A Zoom Phone license
1488 *
1489 * **Parameters:**
1490 *
1491 * * `user_id: &str` -- The user ID or email address of the user. For user-level apps, pass `me` as the value for userId.
1492 * * `page_size: i64` -- The number of records returned within a single API call.
1493 * * `status: crate::types::PhoneUserVoiceMailsStatus` -- Status of the voice mail.
1494 * * `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.
1495 * * `from: chrono::NaiveDate` -- Start date for the query in 'yyyy-mm-dd' format. The date range defined by the "from" and "to" parameters should only be one month as the response includes only one month worth of voicemail data. The month defined should fall within the last six months.
1496 * * `to: chrono::NaiveDate` -- Start Date.
1497 */
1498 pub async fn user_voice_mails(
1499 &self,
1500 user_id: &str,
1501 page_size: i64,
1502 status: crate::types::PhoneUserVoiceMailsStatus,
1503 next_page_token: &str,
1504 from: chrono::NaiveDate,
1505 to: chrono::NaiveDate,
1506 ) -> ClientResult<crate::Response<Vec<crate::types::VoiceMails>>> {
1507 let mut query_args: Vec<(String, String)> = Default::default();
1508 if !from.to_string().is_empty() {
1509 query_args.push(("from".to_string(), from.to_string()));
1510 }
1511 if !next_page_token.is_empty() {
1512 query_args.push(("next_page_token".to_string(), next_page_token.to_string()));
1513 }
1514 if page_size > 0 {
1515 query_args.push(("page_size".to_string(), page_size.to_string()));
1516 }
1517 if !status.to_string().is_empty() {
1518 query_args.push(("status".to_string(), status.to_string()));
1519 }
1520 if !to.to_string().is_empty() {
1521 query_args.push(("to".to_string(), to.to_string()));
1522 }
1523 let query_ = serde_urlencoded::to_string(&query_args).unwrap();
1524 let url = self.client.url(
1525 &format!(
1526 "/phone/users/{}/voice_mails?{}",
1527 crate::progenitor_support::encode_path(user_id),
1528 query_
1529 ),
1530 None,
1531 );
1532 let resp: crate::Response<crate::types::PhoneUserVoiceMailsResponse> = self
1533 .client
1534 .get(
1535 &url,
1536 crate::Message {
1537 body: None,
1538 content_type: None,
1539 },
1540 )
1541 .await?;
1542
1543 // Return our response data.
1544 Ok(crate::Response::new(
1545 resp.status,
1546 resp.headers,
1547 resp.body.voice_mails.to_vec(),
1548 ))
1549 }
1550 /**
1551 * Get user's voicemails.
1552 *
1553 * This function performs a `GET` to the `/phone/users/{userId}/voice_mails` endpoint.
1554 *
1555 * As opposed to `user_voice_mails`, this function returns all the pages of the request at once.
1556 *
1557 * Use this API to get a user's Zoom Phone voicemails. For user-level apps, pass [the `me` value](https://marketplace.zoom.us/docs/api-reference/using-zoom-apis#mekeyword) instead of the `userId` parameter.
1558 *
1559 * **Scopes:** `phone:read`, `phone:read:admin`, `phone_voicemail:read`, `phone_voicemail:read:admin`<br>**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Medium`
1560 *
1561 * **Prerequisites:**
1562 * * A Business or Enterprise account
1563 * * A Zoom Phone license
1564 */
1565 pub async fn get_all_user_voice_mails(
1566 &self,
1567 user_id: &str,
1568 status: crate::types::PhoneUserVoiceMailsStatus,
1569 from: chrono::NaiveDate,
1570 to: chrono::NaiveDate,
1571 ) -> ClientResult<crate::Response<Vec<crate::types::VoiceMails>>> {
1572 let mut query_args: Vec<(String, String)> = Default::default();
1573 if !from.to_string().is_empty() {
1574 query_args.push(("from".to_string(), from.to_string()));
1575 }
1576 if !status.to_string().is_empty() {
1577 query_args.push(("status".to_string(), status.to_string()));
1578 }
1579 if !to.to_string().is_empty() {
1580 query_args.push(("to".to_string(), to.to_string()));
1581 }
1582 let query_ = serde_urlencoded::to_string(&query_args).unwrap();
1583 let url = self.client.url(
1584 &format!(
1585 "/phone/users/{}/voice_mails?{}",
1586 crate::progenitor_support::encode_path(user_id),
1587 query_
1588 ),
1589 None,
1590 );
1591 let crate::Response::<crate::types::PhoneUserVoiceMailsResponse> {
1592 mut status,
1593 mut headers,
1594 mut body,
1595 } = self
1596 .client
1597 .get(
1598 &url,
1599 crate::Message {
1600 body: None,
1601 content_type: None,
1602 },
1603 )
1604 .await?;
1605
1606 let mut voice_mails = body.voice_mails;
1607 let mut page = body.next_page_token;
1608
1609 // Paginate if we should.
1610 while !page.is_empty() {
1611 // Check if we already have URL params and need to concat the token.
1612 if !url.contains('?') {
1613 crate::Response::<crate::types::PhoneUserVoiceMailsResponse> {
1614 status,
1615 headers,
1616 body,
1617 } = self
1618 .client
1619 .get(
1620 &format!("{}?next_page_token={}", url, page),
1621 crate::Message {
1622 body: None,
1623 content_type: None,
1624 },
1625 )
1626 .await?;
1627 } else {
1628 crate::Response::<crate::types::PhoneUserVoiceMailsResponse> {
1629 status,
1630 headers,
1631 body,
1632 } = self
1633 .client
1634 .get(
1635 &format!("{}&next_page_token={}", url, page),
1636 crate::Message {
1637 body: None,
1638 content_type: None,
1639 },
1640 )
1641 .await?;
1642 }
1643
1644 voice_mails.append(&mut body.voice_mails);
1645
1646 if !body.next_page_token.is_empty() && body.next_page_token != page {
1647 page = body.next_page_token.to_string();
1648 } else {
1649 page = "".to_string();
1650 }
1651 }
1652
1653 // Return our response data.
1654 Ok(crate::Response::new(status, headers, voice_mails))
1655 }
1656 /**
1657 * Set up shared access.
1658 *
1659 * This function performs a `POST` to the `/phone/users/{userId}/settings/{settingType}` endpoint.
1660 *
1661 * Use this API to define the voicemail access permissions of a user. For user-level apps, pass [the `me` value](https://marketplace.zoom.us/docs/api-reference/using-zoom-apis#mekeyword) instead of the `userId` parameter.
1662 *
1663 * Phone users can access [shared voicemail inboxes](https://support.zoom.us/hc/en-us/articles/360033863991-Sharing-and-controlling-access-to-a-voicemail-inbox) in the Zoom desktop client, web portal, or provisioned desk phone.
1664 *
1665 * To view these settings in the Zoom web portal, navigate to the **Admin >> Phone System Management >> Users & Rooms** interface. Click the **Users** tab and select **User Settings**. Scroll down to **Voicemail & Call Recordings**.
1666 *
1667 * **Scopes:** `phone:write:admin`<br>**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`
1668 *
1669 * **Prerequisites:**
1670 * * A Business or Enterprise account
1671 *
1672 * **Parameters:**
1673 *
1674 * * `user_id: &str` -- Unique identifier of the user.
1675 * * `setting_type: &str` -- Corresponds to the setting item you wish to modify. Allowed values: `voice_mail`.
1676 */
1677 pub async fn add_user_setting(
1678 &self,
1679 user_id: &str,
1680 setting_type: &str,
1681 body: &crate::types::AddUserSettingRequest,
1682 ) -> ClientResult<crate::Response<crate::types::AddUserSettingResponse>> {
1683 let url = self.client.url(
1684 &format!(
1685 "/phone/users/{}/settings/{}",
1686 crate::progenitor_support::encode_path(user_id),
1687 crate::progenitor_support::encode_path(setting_type),
1688 ),
1689 None,
1690 );
1691 self.client
1692 .post(
1693 &url,
1694 crate::Message {
1695 body: Some(reqwest::Body::from(serde_json::to_vec(body)?)),
1696 content_type: Some("application/json".to_string()),
1697 },
1698 )
1699 .await
1700 }
1701 /**
1702 * Remove shared access.
1703 *
1704 * This function performs a `DELETE` to the `/phone/users/{userId}/settings/{settingType}` endpoint.
1705 *
1706 * Use this API to remove a user's shared voicemail access settings. For user-level apps, pass [the `me` value](https://marketplace.zoom.us/docs/api-reference/using-zoom-apis#mekeyword) instead of the `userId` parameter.
1707 *
1708 * To view these settings in your Zoom web portal, navigate to the **Admin >> Phone System Management >> Users & Rooms** interface. Click the **Users** tab and select **User Settings**. Scroll down to **Voicemail & Call Recordings**.
1709 *
1710 * **Scopes:** `phone:write:admin`<br>**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`
1711 *
1712 * **Prerequisites:**
1713 * * A Business or Enterprise account
1714 *
1715 * **Parameters:**
1716 *
1717 * * `user_id: &str` -- Unique identifier of the user.
1718 * * `setting_type: &str` -- Corresponds to the setting item you wish to remove. Allowed values: `voice_mail`.
1719 * * `shared_id: &str` -- Required only for voicemail setting type.
1720 */
1721 pub async fn delete_user_setting(
1722 &self,
1723 user_id: &str,
1724 setting_type: &str,
1725 shared_id: &str,
1726 ) -> ClientResult<crate::Response<()>> {
1727 let mut query_args: Vec<(String, String)> = Default::default();
1728 if !shared_id.is_empty() {
1729 query_args.push(("shared_id".to_string(), shared_id.to_string()));
1730 }
1731 let query_ = serde_urlencoded::to_string(&query_args).unwrap();
1732 let url = self.client.url(
1733 &format!(
1734 "/phone/users/{}/settings/{}?{}",
1735 crate::progenitor_support::encode_path(user_id),
1736 crate::progenitor_support::encode_path(setting_type),
1737 query_
1738 ),
1739 None,
1740 );
1741 self.client
1742 .delete(
1743 &url,
1744 crate::Message {
1745 body: None,
1746 content_type: None,
1747 },
1748 )
1749 .await
1750 }
1751 /**
1752 * Update shared access.
1753 *
1754 * This function performs a `PATCH` to the `/phone/users/{userId}/settings/{settingType}` endpoint.
1755 *
1756 * Use this API to update the voicemail access permissions of a user. For user-level apps, pass [the `me` value](https://marketplace.zoom.us/docs/api-reference/using-zoom-apis#mekeyword) instead of the `userId` parameter.
1757 *
1758 * Phone users can access [shared voicemail inboxes](https://support.zoom.us/hc/en-us/articles/360033863991-Sharing-and-controlling-access-to-a-voicemail-inbox) in the Zoom desktop client, web portal, or provisioned desk phone.
1759 *
1760 * To view these settings in the Zoom web portal, navigate to the **Admin >> Phone System Management >> Users & Rooms** interface. Click the **Users** tab and select **User Settings**. Scroll down to **Voicemail & Call Recordings**.
1761 *
1762 * **Scopes:** `phone:write:admin`<br>**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`
1763 *
1764 * **Prerequisites:**
1765 * * A Business or Enterprise account
1766 *
1767 * **Parameters:**
1768 *
1769 * * `setting_type: &str` -- Corresponds to the setting item you wish to modify. Allowed values: `voice_mail`.
1770 * * `user_id: &str` -- Unique identifier of the user.
1771 */
1772 pub async fn update_user_setting(
1773 &self,
1774 setting_type: &str,
1775 user_id: &str,
1776 body: &crate::types::UpdateUserSettingRequest,
1777 ) -> ClientResult<crate::Response<()>> {
1778 let url = self.client.url(
1779 &format!(
1780 "/phone/users/{}/settings/{}",
1781 crate::progenitor_support::encode_path(user_id),
1782 crate::progenitor_support::encode_path(setting_type),
1783 ),
1784 None,
1785 );
1786 self.client
1787 .patch(
1788 &url,
1789 crate::Message {
1790 body: Some(reqwest::Body::from(serde_json::to_vec(body)?)),
1791 content_type: Some("application/json".to_string()),
1792 },
1793 )
1794 .await
1795 }
1796 /**
1797 * Get account's call logs.
1798 *
1799 * This function performs a `GET` to the `/phone/call_logs` endpoint.
1800 *
1801 * Use this API to return an account's [call logs](https://support.zoom.us/hc/en-us/articles/360021114452-Viewing-Call-Logs).
1802 *
1803 * **Scopes:** `phone:read:admin`, `phone_call_log:read:admin`<br>**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Heavy`
1804 *
1805 * **Prerequisites:**
1806 * * A Business or Enterprise account
1807 * * A Zoom Phone license
1808 * * Account owner and a [role](https://support.zoom.us/hc/en-us/articles/115001078646-Role-Based-Access-Control) with Zoom Phone management
1809 *
1810 * **Parameters:**
1811 *
1812 * * `page_size: i64` -- The number of records returned within a single API call.
1813 * * `from: &str` -- Start date from which you would like to get the call logs. The start date should be within past six months. <br>
1814 *
1815 * The API only returns data pertaining to a month. Thus, the date range(defined using "from" and "to" fields) for which the call logs are to be returned must not exceed a month.
1816 * * `to: &str` -- The end date upto which you would like to get the call logs for. The end date should be within past six months.
1817 * * `type_: &str` -- The type of the call logs. The value can be either "all" or "missed".
1818 * * `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.
1819 * * `path: &str` -- Filter the API response by [path](https://support.zoom.us/hc/en-us/articles/360021114452-Viewing-and-identifying-logs#h_646b46c6-0623-4ab1-8b8b-ea5b8bcef679) of the call. The value of this field can be one of the following: `voiceMail`, `message`, `forward`, `extension`, `callQueue`, `ivrMenu`, `companyDirectory`, `autoReceptionist`, `contactCenter`, `disconnected`, `commonAreaPhone`,
1820 * `pstn`, `transfer`, `sharedLines`, `sharedLineGroup`, `tollFreeBilling`, `meetingService`, `parkPickup`,
1821 * `parkTimeout`, `monitor`, `takeover`, `sipGroup`.
1822 * * `time_type: crate::types::TimeType` -- Enables you to sort call logs by start or end time. Choose the sort time value. Values include `startTime` or `endTime`.
1823 * * `site_id: &str` -- Unique identifier of the [site](https://support.zoom.us/hc/en-us/articles/360020809672-Managing-multiple-sites). Use this query parameter if you have enabled multiple sites and would like to filter the response of this API call by call logs of a specific phone site.
1824 */
1825 pub async fn account_call_logs(
1826 &self,
1827 page_size: i64,
1828 from: &str,
1829 to: &str,
1830 type_: &str,
1831 next_page_token: &str,
1832 path: &str,
1833 time_type: crate::types::TimeType,
1834 site_id: &str,
1835 ) -> ClientResult<crate::Response<Vec<crate::types::AccountCallLogsResponse>>> {
1836 let mut query_args: Vec<(String, String)> = Default::default();
1837 if !from.is_empty() {
1838 query_args.push(("from".to_string(), from.to_string()));
1839 }
1840 if !next_page_token.is_empty() {
1841 query_args.push(("next_page_token".to_string(), next_page_token.to_string()));
1842 }
1843 if page_size > 0 {
1844 query_args.push(("page_size".to_string(), page_size.to_string()));
1845 }
1846 if !path.is_empty() {
1847 query_args.push(("path".to_string(), path.to_string()));
1848 }
1849 if !site_id.is_empty() {
1850 query_args.push(("site_id".to_string(), site_id.to_string()));
1851 }
1852 if !time_type.to_string().is_empty() {
1853 query_args.push(("time_type".to_string(), time_type.to_string()));
1854 }
1855 if !to.is_empty() {
1856 query_args.push(("to".to_string(), to.to_string()));
1857 }
1858 if !type_.is_empty() {
1859 query_args.push(("type".to_string(), type_.to_string()));
1860 }
1861 let query_ = serde_urlencoded::to_string(&query_args).unwrap();
1862 let url = self
1863 .client
1864 .url(&format!("/phone/call_logs?{}", query_), None);
1865 let resp: crate::Response<crate::types::AccountCallLogsResponseData> = self
1866 .client
1867 .get(
1868 &url,
1869 crate::Message {
1870 body: None,
1871 content_type: None,
1872 },
1873 )
1874 .await?;
1875
1876 // Return our response data.
1877 Ok(crate::Response::new(
1878 resp.status,
1879 resp.headers,
1880 resp.body.call_logs.to_vec(),
1881 ))
1882 }
1883 /**
1884 * Get account's call logs.
1885 *
1886 * This function performs a `GET` to the `/phone/call_logs` endpoint.
1887 *
1888 * As opposed to `account_call_logs`, this function returns all the pages of the request at once.
1889 *
1890 * Use this API to return an account's [call logs](https://support.zoom.us/hc/en-us/articles/360021114452-Viewing-Call-Logs).
1891 *
1892 * **Scopes:** `phone:read:admin`, `phone_call_log:read:admin`<br>**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Heavy`
1893 *
1894 * **Prerequisites:**
1895 * * A Business or Enterprise account
1896 * * A Zoom Phone license
1897 * * Account owner and a [role](https://support.zoom.us/hc/en-us/articles/115001078646-Role-Based-Access-Control) with Zoom Phone management
1898 */
1899 pub async fn get_all_account_call_logs(
1900 &self,
1901 from: &str,
1902 to: &str,
1903 type_: &str,
1904 path: &str,
1905 time_type: crate::types::TimeType,
1906 site_id: &str,
1907 ) -> ClientResult<crate::Response<Vec<crate::types::AccountCallLogsResponse>>> {
1908 let mut query_args: Vec<(String, String)> = Default::default();
1909 if !from.is_empty() {
1910 query_args.push(("from".to_string(), from.to_string()));
1911 }
1912 if !path.is_empty() {
1913 query_args.push(("path".to_string(), path.to_string()));
1914 }
1915 if !site_id.is_empty() {
1916 query_args.push(("site_id".to_string(), site_id.to_string()));
1917 }
1918 if !time_type.to_string().is_empty() {
1919 query_args.push(("time_type".to_string(), time_type.to_string()));
1920 }
1921 if !to.is_empty() {
1922 query_args.push(("to".to_string(), to.to_string()));
1923 }
1924 if !type_.is_empty() {
1925 query_args.push(("type".to_string(), type_.to_string()));
1926 }
1927 let query_ = serde_urlencoded::to_string(&query_args).unwrap();
1928 let url = self
1929 .client
1930 .url(&format!("/phone/call_logs?{}", query_), None);
1931 let crate::Response::<crate::types::AccountCallLogsResponseData> {
1932 mut status,
1933 mut headers,
1934 mut body,
1935 } = self
1936 .client
1937 .get(
1938 &url,
1939 crate::Message {
1940 body: None,
1941 content_type: None,
1942 },
1943 )
1944 .await?;
1945
1946 let mut call_logs = body.call_logs;
1947 let mut page = body.next_page_token;
1948
1949 // Paginate if we should.
1950 while !page.is_empty() {
1951 // Check if we already have URL params and need to concat the token.
1952 if !url.contains('?') {
1953 crate::Response::<crate::types::AccountCallLogsResponseData> {
1954 status,
1955 headers,
1956 body,
1957 } = self
1958 .client
1959 .get(
1960 &format!("{}?next_page_token={}", url, page),
1961 crate::Message {
1962 body: None,
1963 content_type: None,
1964 },
1965 )
1966 .await?;
1967 } else {
1968 crate::Response::<crate::types::AccountCallLogsResponseData> {
1969 status,
1970 headers,
1971 body,
1972 } = self
1973 .client
1974 .get(
1975 &format!("{}&next_page_token={}", url, page),
1976 crate::Message {
1977 body: None,
1978 content_type: None,
1979 },
1980 )
1981 .await?;
1982 }
1983
1984 call_logs.append(&mut body.call_logs);
1985
1986 if !body.next_page_token.is_empty() && body.next_page_token != page {
1987 page = body.next_page_token.to_string();
1988 } else {
1989 page = "".to_string();
1990 }
1991 }
1992
1993 // Return our response data.
1994 Ok(crate::Response::new(status, headers, call_logs))
1995 }
1996 /**
1997 * Assign phone number to user.
1998 *
1999 * This function performs a `POST` to the `/phone/users/{userId}/phone_numbers` endpoint.
2000 *
2001 * Use this API to assign a [phone number](https://support.zoom.us/hc/en-us/articles/360020808292-Managing-Phone-Numbers) to a user who has already enabled Zoom Phone. For user-level apps, pass [the `me` value](https://marketplace.zoom.us/docs/api-reference/using-zoom-apis#mekeyword) instead of the `userId` parameter.
2002 *
2003 * **Scopes:** `phone:write`, `phone:write:admin`<br>**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`
2004 *
2005 * **Prerequisites:**
2006 * * A Business or Enterprise account
2007 * * A Zoom Phone license
2008 */
2009 pub async fn assign_number(
2010 &self,
2011 user_id: &str,
2012 body: &crate::types::AddByocNumberResponse,
2013 ) -> ClientResult<crate::Response<crate::types::AddByocNumberResponse>> {
2014 let url = self.client.url(
2015 &format!(
2016 "/phone/users/{}/phone_numbers",
2017 crate::progenitor_support::encode_path(user_id),
2018 ),
2019 None,
2020 );
2021 self.client
2022 .post(
2023 &url,
2024 crate::Message {
2025 body: Some(reqwest::Body::from(serde_json::to_vec(body)?)),
2026 content_type: Some("application/json".to_string()),
2027 },
2028 )
2029 .await
2030 }
2031 /**
2032 * Unassign phone number.
2033 *
2034 * This function performs a `DELETE` to the `/phone/users/{userId}/phone_numbers/{phoneNumberId}` endpoint.
2035 *
2036 * Use this API to unassign Zoom Phone user's [phone number](https://support.zoom.us/hc/en-us/articles/360020808292-Managing-Phone-Numbers#h_38ba8b01-26e3-4b1b-a9b5-0717c00a7ca6). For user-level apps, pass [the `me` value](https://marketplace.zoom.us/docs/api-reference/using-zoom-apis#mekeyword) instead of the `userId` parameter.
2037 *
2038 * After assigning a phone number, you can remove it if you do not want it to be assigned to anyone.
2039 *
2040 * **Scopes:** `phone:write`, `phone:write:admin`<br>**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`
2041 *
2042 * **Prerequisites:**
2043 * * A Business or Enterprise account
2044 * * A Zoom Phone license
2045 * * The user must have been previously assigned a Zoom Phone number
2046 *
2047 * **Parameters:**
2048 *
2049 * * `user_id: &str` -- Provide either userId or email address of the user.
2050 * * `phone_number_id: &str` -- Provide either phone number or phoneNumberId of the user. .
2051 */
2052 pub async fn unassign_number(
2053 &self,
2054 user_id: &str,
2055 phone_number_id: &str,
2056 ) -> ClientResult<crate::Response<()>> {
2057 let url = self.client.url(
2058 &format!(
2059 "/phone/users/{}/phone_numbers/{}",
2060 crate::progenitor_support::encode_path(user_id),
2061 crate::progenitor_support::encode_path(phone_number_id),
2062 ),
2063 None,
2064 );
2065 self.client
2066 .delete(
2067 &url,
2068 crate::Message {
2069 body: None,
2070 content_type: None,
2071 },
2072 )
2073 .await
2074 }
2075 /**
2076 * Assign calling plan to a user.
2077 *
2078 * This function performs a `POST` to the `/phone/users/{userId}/calling_plans` endpoint.
2079 *
2080 * Use this API to assign a [calling plan](https://marketplace.zoom.us/docs/api-reference/other-references/plans#zoom-phone-calling-plans) to a [Zoom Phone](https://support.zoom.us/hc/en-us/categories/360001370051-Zoom-Phone) user. For user-level apps, pass [the `me` value](https://marketplace.zoom.us/docs/api-reference/using-zoom-apis#mekeyword) instead of the `userId` parameter.
2081 *
2082 * **Scopes:** `phone:write`, `phone:write:admin`<br>**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`
2083 *
2084 * **Prerequisites:**
2085 * * A Business or Enterprise account
2086 * * A Zoom Phone license
2087 */
2088 pub async fn assign_calling_plan(
2089 &self,
2090 user_id: &str,
2091 body: &crate::types::AssignCallingPlanRequest,
2092 ) -> ClientResult<crate::Response<()>> {
2093 let url = self.client.url(
2094 &format!(
2095 "/phone/users/{}/calling_plans",
2096 crate::progenitor_support::encode_path(user_id),
2097 ),
2098 None,
2099 );
2100 self.client
2101 .post(
2102 &url,
2103 crate::Message {
2104 body: Some(reqwest::Body::from(serde_json::to_vec(body)?)),
2105 content_type: Some("application/json".to_string()),
2106 },
2107 )
2108 .await
2109 }
2110 /**
2111 * Unassign user's calling plan.
2112 *
2113 * This function performs a `DELETE` to the `/phone/users/{userId}/calling_plans/{type}` endpoint.
2114 *
2115 * Use this API to unassign a a [Zoom Phone](https://support.zoom.us/hc/en-us/categories/360001370051) user's [calling plan](https://marketplace.zoom.us/docs/api-reference/other-references/plans#zoom-phone-calling-plans). For user-level apps, pass [the `me` value](https://marketplace.zoom.us/docs/api-reference/using-zoom-apis#mekeyword) instead of the `userId` parameter.
2116 *
2117 * **Scopes:** `phone:write`, `phone:write:admin`<br>**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`
2118 *
2119 * **Prerequisites:**
2120 * * A Business or Enterprise account
2121 * * A Zoom Phone license
2122 *
2123 * **Parameters:**
2124 *
2125 * * `type_: &str` -- The [type](https://marketplace.zoom.us/docs/api-reference/other-references/plans#zoom-phone-calling-plans) of the calling plan that was assigned to user. (e.g: The value of type would be "200" for Unlimited US/Canada calling plan.)
2126 * .
2127 */
2128 pub async fn unassign_calling_plan(
2129 &self,
2130 user_id: &str,
2131 type_: &str,
2132 ) -> ClientResult<crate::Response<()>> {
2133 let url = self.client.url(
2134 &format!(
2135 "/phone/users/{}/calling_plans/{}",
2136 crate::progenitor_support::encode_path(user_id),
2137 crate::progenitor_support::encode_path(type_),
2138 ),
2139 None,
2140 );
2141 self.client
2142 .delete(
2143 &url,
2144 crate::Message {
2145 body: None,
2146 content_type: None,
2147 },
2148 )
2149 .await
2150 }
2151 /**
2152 * Get call recordings.
2153 *
2154 * This function performs a `GET` to the `/phone/recordings` endpoint.
2155 *
2156 * Use this API to list an account's [call recordings](https://support.zoom.us/hc/en-us/articles/360038521091-Accessing-and-sharing-call-recordings)
2157 *
2158 * **Scopes:** `phone:read:admin`, `phone:write:admin`,`phone_recording:read:admin`
2159 *
2160 * **Prerequisties:**
2161 * * A Pro or higher account plan
2162 * * A Zoom Phone license
2163 * * Account owner or admin privileges
2164 *
2165 * **Parameters:**
2166 *
2167 * * `page_size: i64` -- The number of records returned within a single API call. The default is **30**, and the maximum is **100**.
2168 * * `next_page_token: &str` -- The current page number of returned records.
2169 * * `from: &str` -- Start date and time in **yyyy-mm-dd** format or **yyyy-MM-dd’T’HH:mm:ss’Z’** format. The date range defined by the from and to parameters should only be one month as the report includes only one month worth of data at once.
2170 * .
2171 * * `to: &str` -- End date and time in **yyyy-mm-dd** format or **yyyy-MM-dd’T’HH:mm:ss’Z’** format, the same formats supported by the `from` parameter.
2172 *
2173 * .
2174 * * `owner_type: &str` -- The owner type. The allowed values are null, `user`, or `callQueue`. The default is null. If null, returns all owner types.
2175 * .
2176 * * `recording_type: &str` -- The recording type. The allowed values are null, `OnDemand`, or `Automatic`. The default is null. If null, returns all recording types.
2177 * .
2178 * * `site_id: &str` -- The site ID. The default is `All sites`.
2179 * * `query_date_type: crate::types::QueryDateType` -- Date types:<br>`start_time` - Query by call start time.<br>`end_time` - Query by call end time.
2180 */
2181 pub async fn get_recordings(
2182 &self,
2183 page_size: i64,
2184 next_page_token: &str,
2185 from: &str,
2186 to: &str,
2187 owner_type: &str,
2188 recording_type: &str,
2189 site_id: &str,
2190 query_date_type: crate::types::QueryDateType,
2191 ) -> ClientResult<crate::Response<Vec<crate::types::GetPhoneRecordingsResponse>>> {
2192 let mut query_args: Vec<(String, String)> = Default::default();
2193 if !from.is_empty() {
2194 query_args.push(("from".to_string(), from.to_string()));
2195 }
2196 if !next_page_token.is_empty() {
2197 query_args.push(("next_page_token".to_string(), next_page_token.to_string()));
2198 }
2199 if !owner_type.is_empty() {
2200 query_args.push(("owner_type".to_string(), owner_type.to_string()));
2201 }
2202 if page_size > 0 {
2203 query_args.push(("page_size".to_string(), page_size.to_string()));
2204 }
2205 if !query_date_type.to_string().is_empty() {
2206 query_args.push(("query_date_type".to_string(), query_date_type.to_string()));
2207 }
2208 if !recording_type.is_empty() {
2209 query_args.push(("recording_type".to_string(), recording_type.to_string()));
2210 }
2211 if !site_id.is_empty() {
2212 query_args.push(("site_id".to_string(), site_id.to_string()));
2213 }
2214 if !to.is_empty() {
2215 query_args.push(("to".to_string(), to.to_string()));
2216 }
2217 let query_ = serde_urlencoded::to_string(&query_args).unwrap();
2218 let url = self
2219 .client
2220 .url(&format!("/phone/recordings?{}", query_), None);
2221 let resp: crate::Response<crate::types::GetPhoneRecordingsResponseData> = self
2222 .client
2223 .get(
2224 &url,
2225 crate::Message {
2226 body: None,
2227 content_type: None,
2228 },
2229 )
2230 .await?;
2231
2232 // Return our response data.
2233 Ok(crate::Response::new(
2234 resp.status,
2235 resp.headers,
2236 resp.body.recordings.to_vec(),
2237 ))
2238 }
2239 /**
2240 * Get call recordings.
2241 *
2242 * This function performs a `GET` to the `/phone/recordings` endpoint.
2243 *
2244 * As opposed to `get_recordings`, this function returns all the pages of the request at once.
2245 *
2246 * Use this API to list an account's [call recordings](https://support.zoom.us/hc/en-us/articles/360038521091-Accessing-and-sharing-call-recordings)
2247 *
2248 * **Scopes:** `phone:read:admin`, `phone:write:admin`,`phone_recording:read:admin`
2249 *
2250 * **Prerequisties:**
2251 * * A Pro or higher account plan
2252 * * A Zoom Phone license
2253 * * Account owner or admin privileges
2254 */
2255 pub async fn get_all_recordings(
2256 &self,
2257 from: &str,
2258 to: &str,
2259 owner_type: &str,
2260 recording_type: &str,
2261 site_id: &str,
2262 query_date_type: crate::types::QueryDateType,
2263 ) -> ClientResult<crate::Response<Vec<crate::types::GetPhoneRecordingsResponse>>> {
2264 let mut query_args: Vec<(String, String)> = Default::default();
2265 if !from.is_empty() {
2266 query_args.push(("from".to_string(), from.to_string()));
2267 }
2268 if !owner_type.is_empty() {
2269 query_args.push(("owner_type".to_string(), owner_type.to_string()));
2270 }
2271 if !query_date_type.to_string().is_empty() {
2272 query_args.push(("query_date_type".to_string(), query_date_type.to_string()));
2273 }
2274 if !recording_type.is_empty() {
2275 query_args.push(("recording_type".to_string(), recording_type.to_string()));
2276 }
2277 if !site_id.is_empty() {
2278 query_args.push(("site_id".to_string(), site_id.to_string()));
2279 }
2280 if !to.is_empty() {
2281 query_args.push(("to".to_string(), to.to_string()));
2282 }
2283 let query_ = serde_urlencoded::to_string(&query_args).unwrap();
2284 let url = self
2285 .client
2286 .url(&format!("/phone/recordings?{}", query_), None);
2287 let crate::Response::<crate::types::GetPhoneRecordingsResponseData> {
2288 mut status,
2289 mut headers,
2290 mut body,
2291 } = self
2292 .client
2293 .get(
2294 &url,
2295 crate::Message {
2296 body: None,
2297 content_type: None,
2298 },
2299 )
2300 .await?;
2301
2302 let mut recordings = body.recordings;
2303 let mut page = body.next_page_token;
2304
2305 // Paginate if we should.
2306 while !page.is_empty() {
2307 // Check if we already have URL params and need to concat the token.
2308 if !url.contains('?') {
2309 crate::Response::<crate::types::GetPhoneRecordingsResponseData> {
2310 status,
2311 headers,
2312 body,
2313 } = self
2314 .client
2315 .get(
2316 &format!("{}?next_page_token={}", url, page),
2317 crate::Message {
2318 body: None,
2319 content_type: None,
2320 },
2321 )
2322 .await?;
2323 } else {
2324 crate::Response::<crate::types::GetPhoneRecordingsResponseData> {
2325 status,
2326 headers,
2327 body,
2328 } = self
2329 .client
2330 .get(
2331 &format!("{}&next_page_token={}", url, page),
2332 crate::Message {
2333 body: None,
2334 content_type: None,
2335 },
2336 )
2337 .await?;
2338 }
2339
2340 recordings.append(&mut body.recordings);
2341
2342 if !body.next_page_token.is_empty() && body.next_page_token != page {
2343 page = body.next_page_token.to_string();
2344 } else {
2345 page = "".to_string();
2346 }
2347 }
2348
2349 // Return our response data.
2350 Ok(crate::Response::new(status, headers, recordings))
2351 }
2352 /**
2353 * List BYOC SIP trunks.
2354 *
2355 * This function performs a `GET` to the `/phone/sip_trunk/trunks` endpoint.
2356 *
2357 * Use this API to return a list of an account's assigned [BYOC (Bring Your Own Carrier) SIP (Session Initiation Protocol) trunks](https://zoom.us/docs/doc/Zoom-Bring%20Your%20Own%20Carrier.pdf).
2358 *
2359 * **Scopes:** `phone:write:admin` or `phone:master`<br>**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`
2360 *
2361 * **Prerequisites:**
2362 * * A Business or Enterprise account
2363 *
2364 * **Parameters:**
2365 *
2366 * * `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.
2367 * * `page_size: i64` -- The number of records returned within a single API call.
2368 */
2369 pub async fn list_byocsip_trunk(
2370 &self,
2371 next_page_token: &str,
2372 page_size: i64,
2373 ) -> ClientResult<crate::Response<Vec<crate::types::ByocSipTrunk>>> {
2374 let mut query_args: Vec<(String, String)> = Default::default();
2375 if !next_page_token.is_empty() {
2376 query_args.push(("next_page_token".to_string(), next_page_token.to_string()));
2377 }
2378 if page_size > 0 {
2379 query_args.push(("page_size".to_string(), page_size.to_string()));
2380 }
2381 let query_ = serde_urlencoded::to_string(&query_args).unwrap();
2382 let url = self
2383 .client
2384 .url(&format!("/phone/sip_trunk/trunks?{}", query_), None);
2385 let resp: crate::Response<crate::types::ListByocsipTrunkResponse> = self
2386 .client
2387 .get(
2388 &url,
2389 crate::Message {
2390 body: None,
2391 content_type: None,
2392 },
2393 )
2394 .await?;
2395
2396 // Return our response data.
2397 Ok(crate::Response::new(
2398 resp.status,
2399 resp.headers,
2400 resp.body.byoc_sip_trunk.to_vec(),
2401 ))
2402 }
2403 /**
2404 * List BYOC SIP trunks.
2405 *
2406 * This function performs a `GET` to the `/phone/sip_trunk/trunks` endpoint.
2407 *
2408 * As opposed to `list_byocsip_trunk`, this function returns all the pages of the request at once.
2409 *
2410 * Use this API to return a list of an account's assigned [BYOC (Bring Your Own Carrier) SIP (Session Initiation Protocol) trunks](https://zoom.us/docs/doc/Zoom-Bring%20Your%20Own%20Carrier.pdf).
2411 *
2412 * **Scopes:** `phone:write:admin` or `phone:master`<br>**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`
2413 *
2414 * **Prerequisites:**
2415 * * A Business or Enterprise account
2416 */
2417 pub async fn list_all_byocsip_trunk(
2418 &self,
2419 ) -> ClientResult<crate::Response<Vec<crate::types::ByocSipTrunk>>> {
2420 let url = self.client.url("/phone/sip_trunk/trunks", None);
2421 let crate::Response::<crate::types::ListByocsipTrunkResponse> {
2422 mut status,
2423 mut headers,
2424 mut body,
2425 } = self
2426 .client
2427 .get(
2428 &url,
2429 crate::Message {
2430 body: None,
2431 content_type: None,
2432 },
2433 )
2434 .await?;
2435
2436 let mut byoc_sip_trunk = body.byoc_sip_trunk;
2437 let mut page = body.next_page_token;
2438
2439 // Paginate if we should.
2440 while !page.is_empty() {
2441 // Check if we already have URL params and need to concat the token.
2442 if !url.contains('?') {
2443 crate::Response::<crate::types::ListByocsipTrunkResponse> {
2444 status,
2445 headers,
2446 body,
2447 } = self
2448 .client
2449 .get(
2450 &format!("{}?next_page_token={}", url, page),
2451 crate::Message {
2452 body: None,
2453 content_type: None,
2454 },
2455 )
2456 .await?;
2457 } else {
2458 crate::Response::<crate::types::ListByocsipTrunkResponse> {
2459 status,
2460 headers,
2461 body,
2462 } = self
2463 .client
2464 .get(
2465 &format!("{}&next_page_token={}", url, page),
2466 crate::Message {
2467 body: None,
2468 content_type: None,
2469 },
2470 )
2471 .await?;
2472 }
2473
2474 byoc_sip_trunk.append(&mut body.byoc_sip_trunk);
2475
2476 if !body.next_page_token.is_empty() && body.next_page_token != page {
2477 page = body.next_page_token.to_string();
2478 } else {
2479 page = "".to_string();
2480 }
2481 }
2482
2483 // Return our response data.
2484 Ok(crate::Response::new(status, headers, byoc_sip_trunk))
2485 }
2486 /**
2487 * Assign SIP trunks.
2488 *
2489 * This function performs a `POST` to the `/accounts/{accountId}/phone/sip_trunk/trunks` endpoint.
2490 *
2491 * A [Master account](https://marketplace.zoom.us/docs/api-reference/master-account-apis) owner can use this API to assign SIP (Session Initiation Protocol) trunks to a subaccount.
2492 *
2493 * **Scopes:** `phone:master`<br>**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`
2494 *
2495 * **Prerequisites:**
2496 * * A Business or Enterprise account
2497 *
2498 * **Parameters:**
2499 *
2500 * * `account_id: &str` -- Unique identifier of the account.
2501 */
2502 pub async fn post_sip_trunk(
2503 &self,
2504 account_id: &str,
2505 body: &crate::types::PostPhoneSipTrunkRequest,
2506 ) -> ClientResult<crate::Response<crate::types::PostPhoneSipTrunkRequest>> {
2507 let url = self.client.url(
2508 &format!(
2509 "/accounts/{}/phone/sip_trunk/trunks",
2510 crate::progenitor_support::encode_path(account_id),
2511 ),
2512 None,
2513 );
2514 self.client
2515 .post(
2516 &url,
2517 crate::Message {
2518 body: Some(reqwest::Body::from(serde_json::to_vec(body)?)),
2519 content_type: Some("application/json".to_string()),
2520 },
2521 )
2522 .await
2523 }
2524 /**
2525 * Update SIP trunk details.
2526 *
2527 * This function performs a `PATCH` to the `/accounts/{accountId}/phone/sip_trunk/trunks/{sipTrunkId}` endpoint.
2528 *
2529 * Use this API to update a subaccount's assigned SIP (Session Initiation Protocol) trunk information.
2530 *
2531 * **Scopes:** `phone:master` <br>**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`
2532 *
2533 * **Prerequisites:**
2534 * * A Business or Enterprise account
2535 *
2536 * **Parameters:**
2537 *
2538 * * `sip_trunk_id: &str` -- Unique identifier of the SIP trunk.
2539 * * `account_id: &str` -- Unique identifier of the sub account.
2540 */
2541 pub async fn update_sip_trunk(
2542 &self,
2543 sip_trunk_id: &str,
2544 account_id: &str,
2545 body: &crate::types::UpdatePhoneSipTrunkRequest,
2546 ) -> ClientResult<crate::Response<()>> {
2547 let url = self.client.url(
2548 &format!(
2549 "/accounts/{}/phone/sip_trunk/trunks/{}",
2550 crate::progenitor_support::encode_path(account_id),
2551 crate::progenitor_support::encode_path(sip_trunk_id),
2552 ),
2553 None,
2554 );
2555 self.client
2556 .patch(
2557 &url,
2558 crate::Message {
2559 body: Some(reqwest::Body::from(serde_json::to_vec(body)?)),
2560 content_type: Some("application/json".to_string()),
2561 },
2562 )
2563 .await
2564 }
2565 /**
2566 * List external contacts.
2567 *
2568 * This function performs a `GET` to the `/phone/external_contacts` endpoint.
2569 *
2570 * Use this API to list external contacts.
2571 *
2572 * **Scopes:** `phone:read:admin`<br>**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`
2573 *
2574 * **Prerequisites:**
2575 * * Pro or a higher account with Zoom Phone license
2576 * * Account owner or admin permissions
2577 *
2578 * **Parameters:**
2579 *
2580 * * `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.
2581 * * `page_size: i64` -- The number of records returned within a single API call.
2582 */
2583 pub async fn list_external_contacts(
2584 &self,
2585 next_page_token: &str,
2586 page_size: i64,
2587 ) -> ClientResult<crate::Response<Vec<crate::types::ExternalContacts>>> {
2588 let mut query_args: Vec<(String, String)> = Default::default();
2589 if !next_page_token.is_empty() {
2590 query_args.push(("next_page_token".to_string(), next_page_token.to_string()));
2591 }
2592 if page_size > 0 {
2593 query_args.push(("page_size".to_string(), page_size.to_string()));
2594 }
2595 let query_ = serde_urlencoded::to_string(&query_args).unwrap();
2596 let url = self
2597 .client
2598 .url(&format!("/phone/external_contacts?{}", query_), None);
2599 let resp: crate::Response<crate::types::ListExternalContactsResponse> = self
2600 .client
2601 .get(
2602 &url,
2603 crate::Message {
2604 body: None,
2605 content_type: None,
2606 },
2607 )
2608 .await?;
2609
2610 // Return our response data.
2611 Ok(crate::Response::new(
2612 resp.status,
2613 resp.headers,
2614 resp.body.external_contacts.to_vec(),
2615 ))
2616 }
2617 /**
2618 * List external contacts.
2619 *
2620 * This function performs a `GET` to the `/phone/external_contacts` endpoint.
2621 *
2622 * As opposed to `list_external_contacts`, this function returns all the pages of the request at once.
2623 *
2624 * Use this API to list external contacts.
2625 *
2626 * **Scopes:** `phone:read:admin`<br>**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`
2627 *
2628 * **Prerequisites:**
2629 * * Pro or a higher account with Zoom Phone license
2630 * * Account owner or admin permissions
2631 */
2632 pub async fn list_all_external_contacts(
2633 &self,
2634 ) -> ClientResult<crate::Response<Vec<crate::types::ExternalContacts>>> {
2635 let url = self.client.url("/phone/external_contacts", None);
2636 let crate::Response::<crate::types::ListExternalContactsResponse> {
2637 mut status,
2638 mut headers,
2639 mut body,
2640 } = self
2641 .client
2642 .get(
2643 &url,
2644 crate::Message {
2645 body: None,
2646 content_type: None,
2647 },
2648 )
2649 .await?;
2650
2651 let mut external_contacts = body.external_contacts;
2652 let mut page = body.next_page_token;
2653
2654 // Paginate if we should.
2655 while !page.is_empty() {
2656 // Check if we already have URL params and need to concat the token.
2657 if !url.contains('?') {
2658 crate::Response::<crate::types::ListExternalContactsResponse> {
2659 status,
2660 headers,
2661 body,
2662 } = self
2663 .client
2664 .get(
2665 &format!("{}?next_page_token={}", url, page),
2666 crate::Message {
2667 body: None,
2668 content_type: None,
2669 },
2670 )
2671 .await?;
2672 } else {
2673 crate::Response::<crate::types::ListExternalContactsResponse> {
2674 status,
2675 headers,
2676 body,
2677 } = self
2678 .client
2679 .get(
2680 &format!("{}&next_page_token={}", url, page),
2681 crate::Message {
2682 body: None,
2683 content_type: None,
2684 },
2685 )
2686 .await?;
2687 }
2688
2689 external_contacts.append(&mut body.external_contacts);
2690
2691 if !body.next_page_token.is_empty() && body.next_page_token != page {
2692 page = body.next_page_token.to_string();
2693 } else {
2694 page = "".to_string();
2695 }
2696 }
2697
2698 // Return our response data.
2699 Ok(crate::Response::new(status, headers, external_contacts))
2700 }
2701 /**
2702 * Add an external contact.
2703 *
2704 * This function performs a `POST` to the `/phone/external_contacts` endpoint.
2705 *
2706 * Use this API to add an external contact.
2707 *
2708 * **Scopes:** `phone:write:admin`<br>**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`
2709 *
2710 * **Prerequisites:**
2711 * * Pro or a higher account with Zoom Phone license
2712 * * Account owner or admin permissions
2713 */
2714 pub async fn add_external_contact(
2715 &self,
2716 body: &crate::types::AddExternalContactRequest,
2717 ) -> ClientResult<crate::Response<()>> {
2718 let url = self.client.url("/phone/external_contacts", None);
2719 self.client
2720 .post(
2721 &url,
2722 crate::Message {
2723 body: Some(reqwest::Body::from(serde_json::to_vec(body)?)),
2724 content_type: Some("application/json".to_string()),
2725 },
2726 )
2727 .await
2728 }
2729 /**
2730 * Get external contact details.
2731 *
2732 * This function performs a `GET` to the `/phone/external_contacts/{externalContactId}` endpoint.
2733 *
2734 * Use this API to get an external contact's information.
2735 *
2736 * **Scopes:** `phone:write:admin`<br>**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`
2737 *
2738 * **Prerequisites:**
2739 * * Pro or a higher account with Zoom Phone license
2740 * * Account owner or admin permissions<br>
2741 *
2742 * **Parameters:**
2743 *
2744 * * `external_contact_id: &str` -- The external contact's ID.
2745 */
2746 pub async fn get_external_contact(
2747 &self,
2748 external_contact_id: &str,
2749 ) -> ClientResult<crate::Response<crate::types::ExternalContacts>> {
2750 let url = self.client.url(
2751 &format!(
2752 "/phone/external_contacts/{}",
2753 crate::progenitor_support::encode_path(external_contact_id),
2754 ),
2755 None,
2756 );
2757 self.client
2758 .get(
2759 &url,
2760 crate::Message {
2761 body: None,
2762 content_type: None,
2763 },
2764 )
2765 .await
2766 }
2767 /**
2768 * Delete an external contact.
2769 *
2770 * This function performs a `DELETE` to the `/phone/external_contacts/{externalContactId}` endpoint.
2771 *
2772 * Use this API to remove an external contact.
2773 *
2774 * **Scopes:** `phone:write:admin`<br>**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`
2775 *
2776 * **Prerequisites:**
2777 * * Pro or a higher account with Zoom Phone license
2778 * * Account owner or admin permissions
2779 *
2780 * **Parameters:**
2781 *
2782 * * `external_contact_id: &str` -- The external contact's ID.
2783 */
2784 pub async fn delete_external_contact(
2785 &self,
2786 external_contact_id: &str,
2787 ) -> ClientResult<crate::Response<()>> {
2788 let url = self.client.url(
2789 &format!(
2790 "/phone/external_contacts/{}",
2791 crate::progenitor_support::encode_path(external_contact_id),
2792 ),
2793 None,
2794 );
2795 self.client
2796 .delete(
2797 &url,
2798 crate::Message {
2799 body: None,
2800 content_type: None,
2801 },
2802 )
2803 .await
2804 }
2805 /**
2806 * Update external contact.
2807 *
2808 * This function performs a `PATCH` to the `/phone/external_contacts/{externalContactId}` endpoint.
2809 *
2810 * Use this API to update an external contact's information.
2811 *
2812 * **Scopes:** `phone:write:admin`<br>**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`
2813 *
2814 * **Prerequisites:**
2815 * * Pro or a higher account with Zoom Phone license
2816 * * Account owner or admin permissions
2817 *
2818 * **Parameters:**
2819 *
2820 * * `external_contact_id: &str` -- User's first name.
2821 */
2822 pub async fn update_external_contact(
2823 &self,
2824 external_contact_id: &str,
2825 body: &crate::types::UpdateExternalContactRequest,
2826 ) -> ClientResult<crate::Response<()>> {
2827 let url = self.client.url(
2828 &format!(
2829 "/phone/external_contacts/{}",
2830 crate::progenitor_support::encode_path(external_contact_id),
2831 ),
2832 None,
2833 );
2834 self.client
2835 .patch(
2836 &url,
2837 crate::Message {
2838 body: Some(reqwest::Body::from(serde_json::to_vec(body)?)),
2839 content_type: Some("application/json".to_string()),
2840 },
2841 )
2842 .await
2843 }
2844 /**
2845 * Get phone number details.
2846 *
2847 * This function performs a `GET` to the `/phone/numbers/{numberId}` endpoint.
2848 *
2849 * Use this API to get information about an account's Zoom Phone number.
2850 *
2851 * **Scopes:** `phone:read:admin`<br>**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`
2852 *
2853 * **Prerequisites:**
2854 * * A Pro or higher account plan
2855 * * A Zoom phone license
2856 *
2857 * **Parameters:**
2858 *
2859 * * `number_id: &str` -- Unique Identifier of the Phone Number. This can be retrieved from the List Phone Numbers API.
2860 */
2861 pub async fn get_number_details(
2862 &self,
2863 number_id: &str,
2864 ) -> ClientResult<crate::Response<crate::types::GetPhoneNumberDetailsResponse>> {
2865 let url = self.client.url(
2866 &format!(
2867 "/phone/numbers/{}",
2868 crate::progenitor_support::encode_path(number_id),
2869 ),
2870 None,
2871 );
2872 self.client
2873 .get(
2874 &url,
2875 crate::Message {
2876 body: None,
2877 content_type: None,
2878 },
2879 )
2880 .await
2881 }
2882 /**
2883 * Update phone number details.
2884 *
2885 * This function performs a `PATCH` to the `/phone/numbers/{numberId}` endpoint.
2886 *
2887 * Use this API to update a Zoom Phone number's information.
2888 *
2889 * **Scopes:** `phone:write`, `phone:write:admin`, `phone:master`<br>**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`
2890 *
2891 * **Prerequisites:**
2892 * * A Paid account
2893 *
2894 * **Parameters:**
2895 *
2896 * * `number_id: &str` -- User's first name.
2897 */
2898 pub async fn update_number_details(
2899 &self,
2900 number_id: &str,
2901 body: &crate::types::UpdatePhoneNumberDetailsRequest,
2902 ) -> ClientResult<crate::Response<()>> {
2903 let url = self.client.url(
2904 &format!(
2905 "/phone/numbers/{}",
2906 crate::progenitor_support::encode_path(number_id),
2907 ),
2908 None,
2909 );
2910 self.client
2911 .patch(
2912 &url,
2913 crate::Message {
2914 body: Some(reqwest::Body::from(serde_json::to_vec(body)?)),
2915 content_type: Some("application/json".to_string()),
2916 },
2917 )
2918 .await
2919 }
2920 /**
2921 * Change main company number.
2922 *
2923 * This function performs a `PUT` to the `/phone/company_number` endpoint.
2924 *
2925 * Use this API to [change an account's main company number](https://support.zoom.us/hc/en-us/articles/360028553691#h_82414c34-9df2-428a-85a4-efcf7f9e0d72).
2926 *
2927 * External users can use the [main company number](https://support.zoom.us/hc/en-us/articles/360028553691) to reach your Zoom Phone users by dialing the main company number and the user's extension. It can also be used by your account's Zoom Phone users as their caller ID when making calls.
2928 *
2929 * **Scopes:** `phone:write:admin`<br>**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`
2930 *
2931 * **Prerequisites:**
2932 * * A Pro or higher account plan
2933 * * Account owner or admin permissions
2934 */
2935 pub async fn change_main_company_number(
2936 &self,
2937 body: &crate::types::ChangeMainCompanyNumberRequest,
2938 ) -> ClientResult<crate::Response<()>> {
2939 let url = self.client.url("/phone/company_number", None);
2940 self.client
2941 .put(
2942 &url,
2943 crate::Message {
2944 body: Some(reqwest::Body::from(serde_json::to_vec(body)?)),
2945 content_type: Some("application/json".to_string()),
2946 },
2947 )
2948 .await
2949 }
2950 /**
2951 * List calling plans.
2952 *
2953 * This function performs a `GET` to the `/phone/calling_plans` endpoint.
2954 *
2955 * Use this API to return all of an account's Zoom Phone [calling plans](https://marketplace.zoom.us/docs/api-reference/other-references/plans#zoom-phone-calling-plans).
2956 *
2957 * **Scopes:** `phone:read:admin`<br>**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Medium`
2958 *
2959 * **Prerequisites:**
2960 * * A Pro or a higher account
2961 * * A Zoom Phone license
2962 */
2963 pub async fn list_calling_plan(
2964 &self,
2965 ) -> ClientResult<crate::Response<crate::types::ListCallingPlansResponseData>> {
2966 let url = self.client.url("/phone/calling_plans", None);
2967 self.client
2968 .get(
2969 &url,
2970 crate::Message {
2971 body: None,
2972 content_type: None,
2973 },
2974 )
2975 .await
2976 }
2977 /**
2978 * List phone users.
2979 *
2980 * This function performs a `GET` to the `/phone/users` endpoint.
2981 *
2982 * Use this API to return a list of all of an account's users who are assigned a Zoom Phone license.
2983 *
2984 * **Scopes:** `phone:read:admin`<br>**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`
2985 *
2986 * **Prerequisites:**
2987 * * A Pro or higher account plan
2988 * * A Zoom Phone license
2989 *
2990 * **Parameters:**
2991 *
2992 * * `page_size: i64` -- The number of records returned from a single API call.
2993 * * `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.
2994 * * `site_id: &str` -- Unique Identifier of the site. This can be retrieved from the [List Phone Sites](https://marketplace.zoom.us/docs/api-reference/zoom-api/phone-site/listphonesites) API.
2995 */
2996 pub async fn list_users(
2997 &self,
2998 page_size: i64,
2999 next_page_token: &str,
3000 site_id: &str,
3001 ) -> ClientResult<crate::Response<Vec<crate::types::ListPhoneUsersResponse>>> {
3002 let mut query_args: Vec<(String, String)> = Default::default();
3003 if !next_page_token.is_empty() {
3004 query_args.push(("next_page_token".to_string(), next_page_token.to_string()));
3005 }
3006 if page_size > 0 {
3007 query_args.push(("page_size".to_string(), page_size.to_string()));
3008 }
3009 if !site_id.is_empty() {
3010 query_args.push(("site_id".to_string(), site_id.to_string()));
3011 }
3012 let query_ = serde_urlencoded::to_string(&query_args).unwrap();
3013 let url = self.client.url(&format!("/phone/users?{}", query_), None);
3014 let resp: crate::Response<crate::types::ListPhoneUsersResponseData> = self
3015 .client
3016 .get(
3017 &url,
3018 crate::Message {
3019 body: None,
3020 content_type: None,
3021 },
3022 )
3023 .await?;
3024
3025 // Return our response data.
3026 Ok(crate::Response::new(
3027 resp.status,
3028 resp.headers,
3029 resp.body.users.to_vec(),
3030 ))
3031 }
3032 /**
3033 * List phone users.
3034 *
3035 * This function performs a `GET` to the `/phone/users` endpoint.
3036 *
3037 * As opposed to `list_users`, this function returns all the pages of the request at once.
3038 *
3039 * Use this API to return a list of all of an account's users who are assigned a Zoom Phone license.
3040 *
3041 * **Scopes:** `phone:read:admin`<br>**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`
3042 *
3043 * **Prerequisites:**
3044 * * A Pro or higher account plan
3045 * * A Zoom Phone license
3046 */
3047 pub async fn list_all_users(
3048 &self,
3049 site_id: &str,
3050 ) -> ClientResult<crate::Response<Vec<crate::types::ListPhoneUsersResponse>>> {
3051 let mut query_args: Vec<(String, String)> = Default::default();
3052 if !site_id.is_empty() {
3053 query_args.push(("site_id".to_string(), site_id.to_string()));
3054 }
3055 let query_ = serde_urlencoded::to_string(&query_args).unwrap();
3056 let url = self.client.url(&format!("/phone/users?{}", query_), None);
3057 let crate::Response::<crate::types::ListPhoneUsersResponseData> {
3058 mut status,
3059 mut headers,
3060 mut body,
3061 } = self
3062 .client
3063 .get(
3064 &url,
3065 crate::Message {
3066 body: None,
3067 content_type: None,
3068 },
3069 )
3070 .await?;
3071
3072 let mut users = body.users;
3073 let mut page = body.next_page_token;
3074
3075 // Paginate if we should.
3076 while !page.is_empty() {
3077 // Check if we already have URL params and need to concat the token.
3078 if !url.contains('?') {
3079 crate::Response::<crate::types::ListPhoneUsersResponseData> {
3080 status,
3081 headers,
3082 body,
3083 } = self
3084 .client
3085 .get(
3086 &format!("{}?next_page_token={}", url, page),
3087 crate::Message {
3088 body: None,
3089 content_type: None,
3090 },
3091 )
3092 .await?;
3093 } else {
3094 crate::Response::<crate::types::ListPhoneUsersResponseData> {
3095 status,
3096 headers,
3097 body,
3098 } = self
3099 .client
3100 .get(
3101 &format!("{}&next_page_token={}", url, page),
3102 crate::Message {
3103 body: None,
3104 content_type: None,
3105 },
3106 )
3107 .await?;
3108 }
3109
3110 users.append(&mut body.users);
3111
3112 if !body.next_page_token.is_empty() && body.next_page_token != page {
3113 page = body.next_page_token.to_string();
3114 } else {
3115 page = "".to_string();
3116 }
3117 }
3118
3119 // Return our response data.
3120 Ok(crate::Response::new(status, headers, users))
3121 }
3122 /**
3123 * Get call log details.
3124 *
3125 * This function performs a `GET` to the `/phone/call_logs/{callLogId}` endpoint.
3126 *
3127 * Use this API to return information about a [call log](https://support.zoom.us/hc/en-us/articles/360021114452-Viewing-and-identifying-logs).
3128 *
3129 * **Scopes:** `phone:read`, `phone:read:admin`, `phone_call_log:read`, `phone_call_log:read:admin`<br>**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Heavy`
3130 *
3131 * **Prerequisites:**
3132 * * A Business or Enterprise account
3133 * * A Zoom Phone license
3134 *
3135 * **Parameters:**
3136 *
3137 * * `call_log_id: &str` -- Unique identifier of the call log. Both `callLogId` and `callId` can be used as path parameters. The value for this field can be retrieved from [account's call logs](https://marketplace.zoom.us/docs/api-reference/zoom-api/phone/accountcalllogs) or the [user's call logs](https://marketplace.zoom.us/docs/api-reference/zoom-api/phone/phoneusercalllogs).
3138 */
3139 pub async fn get_call_log_details(
3140 &self,
3141 call_log_id: &str,
3142 ) -> ClientResult<crate::Response<crate::types::GetCallLogDetailsResponse>> {
3143 let url = self.client.url(
3144 &format!(
3145 "/phone/call_logs/{}",
3146 crate::progenitor_support::encode_path(call_log_id),
3147 ),
3148 None,
3149 );
3150 self.client
3151 .get(
3152 &url,
3153 crate::Message {
3154 body: None,
3155 content_type: None,
3156 },
3157 )
3158 .await
3159 }
3160 /**
3161 * Delete a user's call log.
3162 *
3163 * This function performs a `DELETE` to the `/phone/users/{userId}/call_logs/{callLogId}` endpoint.
3164 *
3165 * Use this API to delete a user's [call log](https://support.zoom.us/hc/en-us/articles/360021114452-Viewing-and-identifying-logs). For user-level apps, pass [the `me` value](https://marketplace.zoom.us/docs/api-reference/using-zoom-apis#mekeyword) instead of the `userId` parameter.
3166 *
3167 * **Scopes:** `phone:write`, `phone:write:admin`, `phone_call_log:write`, `phone_call_log:write:admin`<br>**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`
3168 *
3169 * **Prerequisites:**
3170 * * User must belong to a Business or Enterprise account
3171 * * User must have a Zoom Phone license
3172 *
3173 * **Parameters:**
3174 *
3175 * * `user_id: &str` -- The user ID or email address of the user.
3176 * * `call_log_id: &str` -- Unique identifier of the call log. The value for this field can be retrieved from [account's call logs](https://marketplace.zoom.us/docs/api-reference/zoom-api/phone/accountcalllogs) or [user's call logs](https://marketplace.zoom.us/docs/api-reference/zoom-api/phone/phoneusercalllogs).
3177 */
3178 pub async fn delete_call_log(
3179 &self,
3180 user_id: &str,
3181 call_log_id: &str,
3182 ) -> ClientResult<crate::Response<()>> {
3183 let url = self.client.url(
3184 &format!(
3185 "/phone/users/{}/call_logs/{}",
3186 crate::progenitor_support::encode_path(user_id),
3187 crate::progenitor_support::encode_path(call_log_id),
3188 ),
3189 None,
3190 );
3191 self.client
3192 .delete(
3193 &url,
3194 crate::Message {
3195 body: None,
3196 content_type: None,
3197 },
3198 )
3199 .await
3200 }
3201 /**
3202 * Add BYOC phone numbers.
3203 *
3204 * This function performs a `POST` to the `/phone/byoc_numbers` endpoint.
3205 *
3206 * Use this API to add BYOC (Bring Your Own Carrier) phone numbers to Zoom Phone.
3207 *
3208 * **Scopes:** `phone:write:admin`, `phone:write`, or `phone:master`</br>**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`
3209 *
3210 * **Prerequisites:**
3211 * * A Business or Enterprise plan
3212 * * A Zoom Phone license
3213 */
3214 pub async fn add_byoc_number(
3215 &self,
3216 body: &crate::types::AddByocNumberRequest,
3217 ) -> ClientResult<crate::Response<crate::types::AddByocNumberResponse>> {
3218 let url = self.client.url("/phone/byoc_numbers", None);
3219 self.client
3220 .post(
3221 &url,
3222 crate::Message {
3223 body: Some(reqwest::Body::from(serde_json::to_vec(body)?)),
3224 content_type: Some("application/json".to_string()),
3225 },
3226 )
3227 .await
3228 }
3229 /**
3230 * Delete a voicemail.
3231 *
3232 * This function performs a `DELETE` to the `/phone/voice_mails/{voicemailId}` endpoint.
3233 *
3234 * Use this API to delete an account's [voicemail message](https://support.zoom.us/hc/en-us/articles/360021400211-Managing-voicemail-messages).
3235 *
3236 * **Scopes:** `phone:write:admin`, `phone:write`, `phone_voicemail:write`, `phone_voicemail:write:admin`<br>**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`
3237 *
3238 * **Prerequisites:**
3239 * * A Zoom Phone license
3240 *
3241 * **Parameters:**
3242 *
3243 * * `voicemail_id: &str` -- Unique identifier of the voicemail. Retrieve the value for this field by calling the [Get voicemails](https://marketplace.zoom.us/docs/api-reference/zoom-api/phone/phoneuservoicemails) API.
3244 */
3245 pub async fn delete_voicemail(&self, voicemail_id: &str) -> ClientResult<crate::Response<()>> {
3246 let url = self.client.url(
3247 &format!(
3248 "/phone/voice_mails/{}",
3249 crate::progenitor_support::encode_path(voicemail_id),
3250 ),
3251 None,
3252 );
3253 self.client
3254 .delete(
3255 &url,
3256 crate::Message {
3257 body: None,
3258 content_type: None,
3259 },
3260 )
3261 .await
3262 }
3263}