1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582
use anyhow::Result;
use crate::Client;
pub struct PhoneCallQueues {
pub client: Client,
}
impl PhoneCallQueues {
#[doc(hidden)]
pub fn new(client: Client) -> Self {
PhoneCallQueues { client }
}
/**
* List call queues.
*
* This function performs a `GET` to the `/phone/call_queues` endpoint.
*
* Call queues allow you to route incoming calls to a group of users. For instance, you can use call queues to route calls to various departments in your organization such as sales, engineering, billing, customer service etc.<br> Use this API to list Call queues.<br><br>
* **Prerequisites:**<br>
* * Pro, Business, or Education account
* * Account owner or admin permissions
* * Zoom Phone license<br>
* **Scopes:** `phone:read:admin`<br>
*
*
* **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Medium`
*
*
* **Parameters:**
*
* * `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.
* * `page_size: i64` -- The number of records returned from a single API call.
*/
pub async fn list_call_queues(
&self,
next_page_token: &str,
page_size: i64,
) -> Result<Vec<crate::types::CallQueues>> {
let mut query_args: Vec<(String, String)> = Default::default();
if !next_page_token.is_empty() {
query_args.push(("next_page_token".to_string(), next_page_token.to_string()));
}
if page_size > 0 {
query_args.push(("page_size".to_string(), page_size.to_string()));
}
let query_ = serde_urlencoded::to_string(&query_args).unwrap();
let url = format!("/phone/call_queues?{}", query_);
let resp: crate::types::ListCallQueuesResponse = self.client.get(&url, None).await?;
// Return our response data.
Ok(resp.call_queues.to_vec())
}
/**
* List call queues.
*
* This function performs a `GET` to the `/phone/call_queues` endpoint.
*
* As opposed to `list_call_queues`, this function returns all the pages of the request at once.
*
* Call queues allow you to route incoming calls to a group of users. For instance, you can use call queues to route calls to various departments in your organization such as sales, engineering, billing, customer service etc.<br> Use this API to list Call queues.<br><br>
* **Prerequisites:**<br>
* * Pro, Business, or Education account
* * Account owner or admin permissions
* * Zoom Phone license<br>
* **Scopes:** `phone:read:admin`<br>
*
*
* **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Medium`
*
*/
pub async fn list_all_call_queues(&self) -> Result<Vec<crate::types::CallQueues>> {
let url = "/phone/call_queues".to_string();
let mut resp: crate::types::ListCallQueuesResponse = self.client.get(&url, None).await?;
let mut call_queues = resp.call_queues;
let mut page = resp.next_page_token;
// Paginate if we should.
while !page.is_empty() {
// Check if we already have URL params and need to concat the token.
if !url.contains('?') {
resp = self
.client
.get(&format!("{}?next_page_token={}", url, page), None)
.await?;
} else {
resp = self
.client
.get(&format!("{}&next_page_token={}", url, page), None)
.await?;
}
call_queues.append(&mut resp.call_queues);
if !resp.next_page_token.is_empty() && resp.next_page_token != page {
page = resp.next_page_token.to_string();
} else {
page = "".to_string();
}
}
// Return our response data.
Ok(call_queues)
}
/**
* Create a call queue.
*
* This function performs a `POST` to the `/phone/call_queues` endpoint.
*
* Call queues allow you to route incoming calls to a group of users. For instance, you can use call queues to route calls to various departments in your organization such as sales, engineering, billing, customer service etc.<br> Use this API to [create a call queue](https://support.zoom.us/hc/en-us/articles/360021524831-Managing-Call-Queues#h_e81faeeb-9184-429a-aaea-df49ff5ff413).<br> You can add phone users or common area phones to call queues.
*
* **Prerequisites:**<br>
* * Pro, Business, or Education account
* * Account owner or admin permissions
* * Zoom Phone license<br>
* **Scopes:** `phone:write:admin`<br>
*
*
* **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`
*/
pub async fn create_call_queue(
&self,
body: &crate::types::CreateCallQueueRequest,
) -> Result<crate::types::CreateCallQueueResponse> {
let url = "/phone/call_queues".to_string();
self.client
.post(&url, Some(reqwest::Body::from(serde_json::to_vec(body)?)))
.await
}
/**
* Get call queue details.
*
* This function performs a `GET` to the `/phone/call_queues/{callQueueId}` endpoint.
*
* Call queues allow you to route incoming calls to a group of users. For instance, you can use call queues to route calls to various departments in your organization such as sales, engineering, billing, customer service etc.<br> Use this API to get information on a specific Call Queue.<br><br>
* **Prerequisites:**<br>
* * Pro, Business, or Education account
* * Account owner or admin permissions
* * Zoom Phone license<br>
* **Scopes:** `phone:read:admin`<br>
*
*
* **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`
*
* **Parameters:**
*
* * `call_queue_id: &str` -- Unique Identifier of the Call Queue. This can be retrieved from [List Call Queues API](https://marketplace.zoom.us/docs/api-reference/zoom-api/phone-call-queues/listcallqueues).
*/
pub async fn get_call_queue(
&self,
call_queue_id: &str,
) -> Result<crate::types::GetCallQueueResponse> {
let url = format!(
"/phone/call_queues/{}",
crate::progenitor_support::encode_path(call_queue_id),
);
self.client.get(&url, None).await
}
/**
* Delete a call queue.
*
* This function performs a `DELETE` to the `/phone/call_queues/{callQueueId}` endpoint.
*
* Call queues allow you to route incoming calls to a group of users. For instance, you can use call queues to route calls to various departments in your organization such as sales, engineering, billing, customer service etc.<br> Use this API to delete a Call Queue.<br>
* **Prerequisites:**<br>
* * Pro, Business, or Education account
* * Account owner or admin permissions
* * Zoom Phone license<br>
* **Scopes:** `phone:write:admin`<br>
*
*
* **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`
*
*
*
* **Parameters:**
*
* * `call_queue_id: &str` -- Unique Identifier of the call queue.
*/
pub async fn delete_call_queue(&self, call_queue_id: &str) -> Result<()> {
let url = format!(
"/phone/call_queues/{}",
crate::progenitor_support::encode_path(call_queue_id),
);
self.client.delete(&url, None).await
}
/**
* Update call queue details.
*
* This function performs a `PATCH` to the `/phone/call_queues/{callQueueId}` endpoint.
*
* Call queues allow you to route incoming calls to a group of users. For instance, you can use call queues to route calls to various departments in your organization such as sales, engineering, billing, customer service etc.<br> Use this API to update information of a specific Call Queue.<br>
* **Prerequisites:**<br>
* * Pro, Business, or Education account
* * Account owner or admin permissions
* * Zoom Phone license<br>
* **Scopes:** `phone:write:admin`<br>
*
* **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`
*
*
* **Parameters:**
*
* * `call_queue_id: &str` -- Unique Identifier of the Call Queue.
*/
pub async fn update_call_queue(
&self,
call_queue_id: &str,
body: &crate::types::UpdateCallQueueRequest,
) -> Result<()> {
let url = format!(
"/phone/call_queues/{}",
crate::progenitor_support::encode_path(call_queue_id),
);
self.client
.patch(&url, Some(reqwest::Body::from(serde_json::to_vec(body)?)))
.await
}
/**
* Assign numbers to a call queue.
*
* This function performs a `POST` to the `/phone/call_queues/{callQueueId}/phone_numbers` endpoint.
*
* After [buying phone number(s)](https://support.zoom.us/hc/en-us/articles/360020808292#h_007ec8c2-0914-4265-8351-96ab23efa3ad), you can assign it, allowing callers to directly dial a number to reach a [call queue](https://support.zoom.us/hc/en-us/articles/360021524831-Managing-Call-Queues).<br><br>
* **Prerequisites:**<br>
* * Pro or higher account plan.
* * Account owner or admin permissions
* * Zoom Phone license<br>
* **Scopes:** `phone:write:admin`<br>
* **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`
*
*
*
* **Parameters:**
*
* * `call_queue_id: &str` -- Unique Identifier of the Call Queue.
*/
pub async fn assign(
&self,
call_queue_id: &str,
body: &crate::types::AddByocNumberResponse,
) -> Result<crate::types::Domains> {
let url = format!(
"/phone/call_queues/{}/phone_numbers",
crate::progenitor_support::encode_path(call_queue_id),
);
self.client
.post(&url, Some(reqwest::Body::from(serde_json::to_vec(body)?)))
.await
}
/**
* Unassign all phone numbers.
*
* This function performs a `DELETE` to the `/phone/call_queues/{callQueueId}/phone_numbers` endpoint.
*
* Use this API to unbind all phone numbers that are assigned to a [Call Queue](https://support.zoom.us/hc/en-us/articles/360021524831-Managing-Call-Queues) After successful unbinding, the numbers will appear in the [Unassigned tab](https://zoom.us/signin#/numbers/unassigned).<br> If you only need to unassign a specific phone number, use the Unassign a Phone Number API instead. <br>
* **Prerequisites:**
* * Pro or higher account palan
* * Account owner or admin permissions
* * Zoom Phone license <br> **Scopes:** `phone:write:admin`<br>
* **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`
*
*
*
* **Parameters:**
*
* * `call_queue_id: &str` -- Unique Identifier of the Call Queue. This can be retrieved from List Call Queues API.
*/
pub async fn unassign_phone_num_call_queue(
&self,
call_queue_id: &str,
) -> Result<crate::types::Domains> {
let url = format!(
"/phone/call_queues/{}/phone_numbers",
crate::progenitor_support::encode_path(call_queue_id),
);
self.client.delete(&url, None).await
}
/**
* Unassign a phone number.
*
* This function performs a `DELETE` to the `/phone/call_queues/{callQueueId}/phone_numbers/{phoneNumberId}` endpoint.
*
* After assigning a phone number, you can unbind it if you don't want it to be assigned to a [Call Queue](https://support.zoom.us/hc/en-us/articles/360021524831-Managing-Call-Queues). Use this API to unbind a phone number from a Call Queue. After successful unbinding, the number will appear in the [Unassigned tab](https://zoom.us/signin#/numbers/unassigned).<br><br>
* **Prerequisites:**
* * Pro or higher account palan
* * Account owner or admin permissions
* * Zoom Phone license <br> **Scopes:** `phone:write:admin`<br>
* **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`
*
*
*
* **Parameters:**
*
* * `call_queue_id: &str` -- Unique Identifier of the Call Queue. This can be retrieved from the List Call Queues API.
* * `phone_number_id: &str` -- Unique Identifier of the Phone Number. .
*/
pub async fn un_assign_phone_num_call_queue(
&self,
call_queue_id: &str,
phone_number_id: &str,
) -> Result<crate::types::Domains> {
let url = format!(
"/phone/call_queues/{}/phone_numbers/{}",
crate::progenitor_support::encode_path(call_queue_id),
crate::progenitor_support::encode_path(phone_number_id),
);
self.client.delete(&url, None).await
}
/**
* Add members to a call queue.
*
* This function performs a `POST` to the `/phone/call_queues/{callQueueId}/members` endpoint.
*
* Add phone users and/or [common area phones](https://support.zoom.us/hc/en-us/articles/360028516231-Managing-Common-Area-Phones) as members to a specific Call Queue.<br><br>
* **Prerequisites:**<br>
* * Pro or higher account plan.
* * Zoom Phone license<br>
* **Scopes:** `phone:write:admin`<br>
*
*
* **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`
*
* **Parameters:**
*
* * `call_queue_id: &str` -- Unique Identifier of the Call Queue.
*/
pub async fn add_members_call_queue(
&self,
call_queue_id: &str,
body: &crate::types::AddMembersCallQueueRequestData,
) -> Result<crate::types::Domains> {
let url = format!(
"/phone/call_queues/{}/members",
crate::progenitor_support::encode_path(call_queue_id),
);
self.client
.post(&url, Some(reqwest::Body::from(serde_json::to_vec(body)?)))
.await
}
/**
* Unassign all members.
*
* This function performs a `DELETE` to the `/phone/call_queues/{callQueueId}/members` endpoint.
*
* Use this API to remove all members from a Call Queue who were previously assigned to that Call Queue. The members could be phone users or [common area phones](https://support.zoom.us/hc/en-us/articles/360028516231-Managing-Common-Area-Phones).
* **Prerequisites:**<br>
* * Pro or higher account plan.
* * Zoom Phone license<br>
* **Scopes:** `phone:write:admin`<br>
*
*
* **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`
*
* **Parameters:**
*
* * `call_queue_id: &str` -- User's first name.
*/
pub async fn unassign_all_members(&self, call_queue_id: &str) -> Result<()> {
let url = format!(
"/phone/call_queues/{}/members",
crate::progenitor_support::encode_path(call_queue_id),
);
self.client.delete(&url, None).await
}
/**
* Unassign a member.
*
* This function performs a `DELETE` to the `/phone/call_queues/{callQueueId}/members/{memberId}` endpoint.
*
* Use this API to remove a member from a Call Queue who was previously added to that Call Queue. The member could be a phone user or a [common area phone](https://support.zoom.us/hc/en-us/articles/360028516231-Managing-Common-Area-Phones). A member who is a Call Queue Manager cannot be unassigned from the Call Queue using this API.
* **Prerequisites:**<br>
* * Pro or higher account plan.
* * Zoom Phone license<br>
* **Scopes:** `phone:write:admin`<br>
* **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`
*
*
*
* **Parameters:**
*
* * `call_queue_id: &str` -- Unique Identifier of the Call Queue from which the member needs to be unassigned.
* * `member_id: &str` -- Unique Identifier of the member who needs to be unassigned.
*/
pub async fn unassign_member_from_call_queue(
&self,
call_queue_id: &str,
member_id: &str,
) -> Result<()> {
let url = format!(
"/phone/call_queues/{}/members/{}",
crate::progenitor_support::encode_path(call_queue_id),
crate::progenitor_support::encode_path(member_id),
);
self.client.delete(&url, None).await
}
/**
* Change call queue manager.
*
* This function performs a `PUT` to the `/phone/call_queues/{callQueueId}/manager` endpoint.
*
* A call queue manager has the privileges to maanage the call queue's voicemail inbox and recordings, change all call queue settings and call queue policy settings.<br><br> Use this API to to set another phone user as the [call queue manager](https://support.zoom.us/hc/en-us/articles/360021524831-Managing-Call-Queues#h_db06854b-e6a3-4afe-ba15-baf58f31f90c).
* **Prerequisites:**<br>
* * Pro or higher account plan.
* * Account owner or admin permissions
* * Zoom Phone license<br>
* **Scopes:** `phone:write:admin`<br>
*
* **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`
*
*
*
* **Parameters:**
*
* * `call_queue_id: &str` -- Unique Identifier of the Call Queue.
*/
pub async fn change_call_queue_manager(
&self,
call_queue_id: &str,
body: &crate::types::ChangeCallQueueManagerRequest,
) -> Result<()> {
let url = format!(
"/phone/call_queues/{}/manager",
crate::progenitor_support::encode_path(call_queue_id),
);
self.client
.put(&url, Some(reqwest::Body::from(serde_json::to_vec(body)?)))
.await
}
/**
* Get call queue recordings.
*
* This function performs a `GET` to the `/phone/call_queues/{callQueueId}/recordings` endpoint.
*
* Use this API to view [call recordings](https://support.zoom.us/hc/en-us/articles/360038521091#h_cbc9f2a3-e06c-4daa-83d4-ddbceef9c77b) from the call queue.<br><br>
* **Prerequisites:**<br>
* * Pro or higher account with Zoom Phone license.
* * [Automatic call recordings](https://support.zoom.us/hc/en-us/articles/360033511872#h_fcb297bb-14e8-4094-91ca-dc61e1a18734) must be enabled in the Policy Settings for call queues. <br> **Scope:** `phone:read:admin`<br> **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Medium`
*
*
*
*
*
* **Parameters:**
*
* * `call_queue_id: &str` -- Unique Identifier of the Call Queue.
* * `page_size: i64` -- The number of records returned within a single API call.
* * `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.
* * `from: chrono::NaiveDate` -- Start date (within a 6 month range).
* * `to: chrono::NaiveDate` -- End date (within a 6 month range).
*/
pub async fn get_call_queue_recordings(
&self,
call_queue_id: &str,
page_size: i64,
next_page_token: &str,
from: chrono::NaiveDate,
to: chrono::NaiveDate,
) -> Result<Vec<crate::types::GetCallQueueRecordingsResponse>> {
let mut query_args: Vec<(String, String)> = Default::default();
if !from.to_string().is_empty() {
query_args.push(("from".to_string(), from.to_string()));
}
if !next_page_token.is_empty() {
query_args.push(("next_page_token".to_string(), next_page_token.to_string()));
}
if page_size > 0 {
query_args.push(("page_size".to_string(), page_size.to_string()));
}
if !to.to_string().is_empty() {
query_args.push(("to".to_string(), to.to_string()));
}
let query_ = serde_urlencoded::to_string(&query_args).unwrap();
let url = format!(
"/phone/call_queues/{}/recordings?{}",
crate::progenitor_support::encode_path(call_queue_id),
query_
);
let resp: crate::types::GetCallQueueRecordingsResponseData =
self.client.get(&url, None).await?;
// Return our response data.
Ok(resp.recordings.to_vec())
}
/**
* Get call queue recordings.
*
* This function performs a `GET` to the `/phone/call_queues/{callQueueId}/recordings` endpoint.
*
* As opposed to `get_call_queue_recordings`, this function returns all the pages of the request at once.
*
* Use this API to view [call recordings](https://support.zoom.us/hc/en-us/articles/360038521091#h_cbc9f2a3-e06c-4daa-83d4-ddbceef9c77b) from the call queue.<br><br>
* **Prerequisites:**<br>
* * Pro or higher account with Zoom Phone license.
* * [Automatic call recordings](https://support.zoom.us/hc/en-us/articles/360033511872#h_fcb297bb-14e8-4094-91ca-dc61e1a18734) must be enabled in the Policy Settings for call queues. <br> **Scope:** `phone:read:admin`<br> **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Medium`
*
*
*
*
*/
pub async fn get_all_call_queue_recordings(
&self,
call_queue_id: &str,
from: chrono::NaiveDate,
to: chrono::NaiveDate,
) -> Result<Vec<crate::types::GetCallQueueRecordingsResponse>> {
let mut query_args: Vec<(String, String)> = Default::default();
if !from.to_string().is_empty() {
query_args.push(("from".to_string(), from.to_string()));
}
if !to.to_string().is_empty() {
query_args.push(("to".to_string(), to.to_string()));
}
let query_ = serde_urlencoded::to_string(&query_args).unwrap();
let url = format!(
"/phone/call_queues/{}/recordings?{}",
crate::progenitor_support::encode_path(call_queue_id),
query_
);
let mut resp: crate::types::GetCallQueueRecordingsResponseData =
self.client.get(&url, None).await?;
let mut recordings = resp.recordings;
let mut page = resp.next_page_token;
// Paginate if we should.
while !page.is_empty() {
// Check if we already have URL params and need to concat the token.
if !url.contains('?') {
resp = self
.client
.get(&format!("{}?next_page_token={}", url, page), None)
.await?;
} else {
resp = self
.client
.get(&format!("{}&next_page_token={}", url, page), None)
.await?;
}
recordings.append(&mut resp.recordings);
if !resp.next_page_token.is_empty() && resp.next_page_token != page {
page = resp.next_page_token.to_string();
} else {
page = "".to_string();
}
}
// Return our response data.
Ok(recordings)
}
}