1use reqwest;
13use serde::{Deserialize, Serialize, de::Error as _};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration, ContentType};
16
17
18#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum DeleteQueueOpeningsIdError {
22 Status400(),
23 Status404(),
24 UnknownValue(serde_json::Value),
25}
26
27#[derive(Debug, Clone, Serialize, Deserialize)]
29#[serde(untagged)]
30pub enum DeleteQueueQueueIdCallersQueueCallerIdError {
31 Status404(),
32 UnknownValue(serde_json::Value),
33}
34
35#[derive(Debug, Clone, Serialize, Deserialize)]
37#[serde(untagged)]
38pub enum DeleteQueuesQueueIdDestinationsQueueNumberIdError {
39 Status401(),
40 Status403(),
41 Status404(),
42 UnknownValue(serde_json::Value),
43}
44
45#[derive(Debug, Clone, Serialize, Deserialize)]
47#[serde(untagged)]
48pub enum DeleteQueuesQueueIdNumbersQueueNumberIdError {
49 Status401(),
50 Status403(),
51 Status404(),
52 UnknownValue(serde_json::Value),
53}
54
55#[derive(Debug, Clone, Serialize, Deserialize)]
57#[serde(untagged)]
58pub enum GetAllQueuesError {
59 Status403(),
60 UnknownValue(serde_json::Value),
61}
62
63#[derive(Debug, Clone, Serialize, Deserialize)]
65#[serde(untagged)]
66pub enum GetQueueOpeningError {
67 UnknownValue(serde_json::Value),
68}
69
70#[derive(Debug, Clone, Serialize, Deserialize)]
72#[serde(untagged)]
73pub enum GetQueueOpeningsIdError {
74 Status404(),
75 UnknownValue(serde_json::Value),
76}
77
78#[derive(Debug, Clone, Serialize, Deserialize)]
80#[serde(untagged)]
81pub enum GetQueueQidCurrentBlockError {
82 Status404(),
83 UnknownValue(serde_json::Value),
84}
85
86#[derive(Debug, Clone, Serialize, Deserialize)]
88#[serde(untagged)]
89pub enum GetQueueQueueIdCallersError {
90 Status403(),
91 Status404(),
92 UnknownValue(serde_json::Value),
93}
94
95#[derive(Debug, Clone, Serialize, Deserialize)]
97#[serde(untagged)]
98pub enum GetQueuesError {
99 UnknownValue(serde_json::Value),
100}
101
102#[derive(Debug, Clone, Serialize, Deserialize)]
104#[serde(untagged)]
105pub enum GetQueuesByNumberPhoneNumberError {
106 Status403(),
107 Status404(),
108 UnknownValue(serde_json::Value),
109}
110
111#[derive(Debug, Clone, Serialize, Deserialize)]
113#[serde(untagged)]
114pub enum GetQueuesQueueIdError {
115 Status403(),
116 Status404(),
117 UnknownValue(serde_json::Value),
118}
119
120#[derive(Debug, Clone, Serialize, Deserialize)]
122#[serde(untagged)]
123pub enum GetQueuesQueueIdCallersQueueCallerIdError {
124 Status403(),
125 Status404(),
126 UnknownValue(serde_json::Value),
127}
128
129#[derive(Debug, Clone, Serialize, Deserialize)]
131#[serde(untagged)]
132pub enum GetQueuesQueueIdDestinationsQueueDestinationIdError {
133 Status403(),
134 Status404(),
135 UnknownValue(serde_json::Value),
136}
137
138#[derive(Debug, Clone, Serialize, Deserialize)]
140#[serde(untagged)]
141pub enum GetQueuesQueueIdQueueNumberIdError {
142 Status403(),
143 Status404(),
144 UnknownValue(serde_json::Value),
145}
146
147#[derive(Debug, Clone, Serialize, Deserialize)]
149#[serde(untagged)]
150pub enum PostQueueOpeningsError {
151 Status404(),
152 UnknownValue(serde_json::Value),
153}
154
155#[derive(Debug, Clone, Serialize, Deserialize)]
157#[serde(untagged)]
158pub enum PostQueuesQueueIdCallersError {
159 Status403(),
160 Status404(),
161 UnknownValue(serde_json::Value),
162}
163
164#[derive(Debug, Clone, Serialize, Deserialize)]
166#[serde(untagged)]
167pub enum PostQueuesQueueIdDestinationsError {
168 Status400(),
169 Status401(),
170 Status403(),
171 Status404(),
172 UnknownValue(serde_json::Value),
173}
174
175#[derive(Debug, Clone, Serialize, Deserialize)]
177#[serde(untagged)]
178pub enum PostQueuesQueueIdNumberError {
179 Status400(),
180 Status401(),
181 Status403(),
182 Status404(),
183 UnknownValue(serde_json::Value),
184}
185
186#[derive(Debug, Clone, Serialize, Deserialize)]
188#[serde(untagged)]
189pub enum PutQueueOpeningsIdError {
190 Status400(),
191 Status404(),
192 UnknownValue(serde_json::Value),
193}
194
195#[derive(Debug, Clone, Serialize, Deserialize)]
197#[serde(untagged)]
198pub enum PutQueueQueueIdCallersQueueCallerIdError {
199 Status403(),
200 Status404(),
201 UnknownValue(serde_json::Value),
202}
203
204#[derive(Debug, Clone, Serialize, Deserialize)]
206#[serde(untagged)]
207pub enum PutQueuesQueueIdDestinationsQueueDestinationIdError {
208 Status400(),
209 Status403(),
210 Status404(),
211 UnknownValue(serde_json::Value),
212}
213
214#[derive(Debug, Clone, Serialize, Deserialize)]
216#[serde(untagged)]
217pub enum PutQueuesQueueIdNumbersQueueNumberIdError {
218 Status400(),
219 Status403(),
220 Status404(),
221 UnknownValue(serde_json::Value),
222}
223
224#[derive(Debug, Clone, Serialize, Deserialize)]
226#[serde(untagged)]
227pub enum QueueError {
228 UnknownValue(serde_json::Value),
229}
230
231
232pub async fn delete_queue_openings_id(configuration: &configuration::Configuration, qid: &str, qoid: &str) -> Result<(), Error<DeleteQueueOpeningsIdError>> {
233 let p_qid = qid;
235 let p_qoid = qoid;
236
237 let uri_str = format!("{}/queues/{qid}/openings/{qoid}", configuration.base_path, qid=crate::apis::urlencode(p_qid), qoid=crate::apis::urlencode(p_qoid));
238 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
239
240 if let Some(ref user_agent) = configuration.user_agent {
241 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
242 }
243 if let Some(ref token) = configuration.oauth_access_token {
244 req_builder = req_builder.bearer_auth(token.to_owned());
245 };
246
247 let req = req_builder.build()?;
248 let resp = configuration.client.execute(req).await?;
249
250 let status = resp.status();
251
252 if !status.is_client_error() && !status.is_server_error() {
253 Ok(())
254 } else {
255 let content = resp.text().await?;
256 let entity: Option<DeleteQueueOpeningsIdError> = serde_json::from_str(&content).ok();
257 Err(Error::ResponseError(ResponseContent { status, content, entity }))
258 }
259}
260
261pub async fn delete_queue_queue_id_callers_queue_caller_id(configuration: &configuration::Configuration, qid: &str, qcid: &str) -> Result<(), Error<DeleteQueueQueueIdCallersQueueCallerIdError>> {
262 let p_qid = qid;
264 let p_qcid = qcid;
265
266 let uri_str = format!("{}/queues/{qid}/callers/{qcid}", configuration.base_path, qid=crate::apis::urlencode(p_qid), qcid=crate::apis::urlencode(p_qcid));
267 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
268
269 if let Some(ref user_agent) = configuration.user_agent {
270 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
271 }
272 if let Some(ref token) = configuration.oauth_access_token {
273 req_builder = req_builder.bearer_auth(token.to_owned());
274 };
275
276 let req = req_builder.build()?;
277 let resp = configuration.client.execute(req).await?;
278
279 let status = resp.status();
280
281 if !status.is_client_error() && !status.is_server_error() {
282 Ok(())
283 } else {
284 let content = resp.text().await?;
285 let entity: Option<DeleteQueueQueueIdCallersQueueCallerIdError> = serde_json::from_str(&content).ok();
286 Err(Error::ResponseError(ResponseContent { status, content, entity }))
287 }
288}
289
290pub async fn delete_queues_queue_id_destinations_queue_number_id(configuration: &configuration::Configuration, qid: &str, qdid: &str) -> Result<(), Error<DeleteQueuesQueueIdDestinationsQueueNumberIdError>> {
291 let p_qid = qid;
293 let p_qdid = qdid;
294
295 let uri_str = format!("{}/queues/{qid}/destinations/{qdid}", configuration.base_path, qid=crate::apis::urlencode(p_qid), qdid=crate::apis::urlencode(p_qdid));
296 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
297
298 if let Some(ref user_agent) = configuration.user_agent {
299 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
300 }
301 if let Some(ref token) = configuration.oauth_access_token {
302 req_builder = req_builder.bearer_auth(token.to_owned());
303 };
304
305 let req = req_builder.build()?;
306 let resp = configuration.client.execute(req).await?;
307
308 let status = resp.status();
309
310 if !status.is_client_error() && !status.is_server_error() {
311 Ok(())
312 } else {
313 let content = resp.text().await?;
314 let entity: Option<DeleteQueuesQueueIdDestinationsQueueNumberIdError> = serde_json::from_str(&content).ok();
315 Err(Error::ResponseError(ResponseContent { status, content, entity }))
316 }
317}
318
319pub async fn delete_queues_queue_id_numbers_queue_number_id(configuration: &configuration::Configuration, qid: &str, qnid: &str) -> Result<(), Error<DeleteQueuesQueueIdNumbersQueueNumberIdError>> {
320 let p_qid = qid;
322 let p_qnid = qnid;
323
324 let uri_str = format!("{}/queues/{qid}/numbers/{qnid}", configuration.base_path, qid=crate::apis::urlencode(p_qid), qnid=crate::apis::urlencode(p_qnid));
325 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
326
327 if let Some(ref user_agent) = configuration.user_agent {
328 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
329 }
330 if let Some(ref token) = configuration.oauth_access_token {
331 req_builder = req_builder.bearer_auth(token.to_owned());
332 };
333
334 let req = req_builder.build()?;
335 let resp = configuration.client.execute(req).await?;
336
337 let status = resp.status();
338
339 if !status.is_client_error() && !status.is_server_error() {
340 Ok(())
341 } else {
342 let content = resp.text().await?;
343 let entity: Option<DeleteQueuesQueueIdNumbersQueueNumberIdError> = serde_json::from_str(&content).ok();
344 Err(Error::ResponseError(ResponseContent { status, content, entity }))
345 }
346}
347
348pub async fn get_all_queues(configuration: &configuration::Configuration, ) -> Result<Vec<models::Queue>, Error<GetAllQueuesError>> {
350
351 let uri_str = format!("{}/queues/all", configuration.base_path);
352 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
353
354 if let Some(ref user_agent) = configuration.user_agent {
355 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
356 }
357 if let Some(ref token) = configuration.oauth_access_token {
358 req_builder = req_builder.bearer_auth(token.to_owned());
359 };
360
361 let req = req_builder.build()?;
362 let resp = configuration.client.execute(req).await?;
363
364 let status = resp.status();
365 let content_type = resp
366 .headers()
367 .get("content-type")
368 .and_then(|v| v.to_str().ok())
369 .unwrap_or("application/octet-stream");
370 let content_type = super::ContentType::from(content_type);
371
372 if !status.is_client_error() && !status.is_server_error() {
373 let content = resp.text().await?;
374 match content_type {
375 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
376 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Queue>`"))),
377 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Queue>`")))),
378 }
379 } else {
380 let content = resp.text().await?;
381 let entity: Option<GetAllQueuesError> = serde_json::from_str(&content).ok();
382 Err(Error::ResponseError(ResponseContent { status, content, entity }))
383 }
384}
385
386pub async fn get_queue_opening(configuration: &configuration::Configuration, qid: &str) -> Result<models::ListWrapperQueueOpening, Error<GetQueueOpeningError>> {
387 let p_qid = qid;
389
390 let uri_str = format!("{}/queues/{qid}/openings", configuration.base_path, qid=crate::apis::urlencode(p_qid));
391 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
392
393 if let Some(ref user_agent) = configuration.user_agent {
394 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
395 }
396 if let Some(ref token) = configuration.oauth_access_token {
397 req_builder = req_builder.bearer_auth(token.to_owned());
398 };
399
400 let req = req_builder.build()?;
401 let resp = configuration.client.execute(req).await?;
402
403 let status = resp.status();
404 let content_type = resp
405 .headers()
406 .get("content-type")
407 .and_then(|v| v.to_str().ok())
408 .unwrap_or("application/octet-stream");
409 let content_type = super::ContentType::from(content_type);
410
411 if !status.is_client_error() && !status.is_server_error() {
412 let content = resp.text().await?;
413 match content_type {
414 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
415 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ListWrapperQueueOpening`"))),
416 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ListWrapperQueueOpening`")))),
417 }
418 } else {
419 let content = resp.text().await?;
420 let entity: Option<GetQueueOpeningError> = serde_json::from_str(&content).ok();
421 Err(Error::ResponseError(ResponseContent { status, content, entity }))
422 }
423}
424
425pub async fn get_queue_openings_id(configuration: &configuration::Configuration, qid: &str, qoid: &str) -> Result<models::QueueOpening, Error<GetQueueOpeningsIdError>> {
426 let p_qid = qid;
428 let p_qoid = qoid;
429
430 let uri_str = format!("{}/queues/{qid}/openings/{qoid}", configuration.base_path, qid=crate::apis::urlencode(p_qid), qoid=crate::apis::urlencode(p_qoid));
431 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
432
433 if let Some(ref user_agent) = configuration.user_agent {
434 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
435 }
436 if let Some(ref token) = configuration.oauth_access_token {
437 req_builder = req_builder.bearer_auth(token.to_owned());
438 };
439
440 let req = req_builder.build()?;
441 let resp = configuration.client.execute(req).await?;
442
443 let status = resp.status();
444 let content_type = resp
445 .headers()
446 .get("content-type")
447 .and_then(|v| v.to_str().ok())
448 .unwrap_or("application/octet-stream");
449 let content_type = super::ContentType::from(content_type);
450
451 if !status.is_client_error() && !status.is_server_error() {
452 let content = resp.text().await?;
453 match content_type {
454 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
455 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QueueOpening`"))),
456 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::QueueOpening`")))),
457 }
458 } else {
459 let content = resp.text().await?;
460 let entity: Option<GetQueueOpeningsIdError> = serde_json::from_str(&content).ok();
461 Err(Error::ResponseError(ResponseContent { status, content, entity }))
462 }
463}
464
465pub async fn get_queue_qid_current_block(configuration: &configuration::Configuration, qid: &str) -> Result<models::Block, Error<GetQueueQidCurrentBlockError>> {
466 let p_qid = qid;
468
469 let uri_str = format!("{}/queues/{qid}/current-block", configuration.base_path, qid=crate::apis::urlencode(p_qid));
470 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
471
472 if let Some(ref user_agent) = configuration.user_agent {
473 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
474 }
475 if let Some(ref token) = configuration.oauth_access_token {
476 req_builder = req_builder.bearer_auth(token.to_owned());
477 };
478
479 let req = req_builder.build()?;
480 let resp = configuration.client.execute(req).await?;
481
482 let status = resp.status();
483 let content_type = resp
484 .headers()
485 .get("content-type")
486 .and_then(|v| v.to_str().ok())
487 .unwrap_or("application/octet-stream");
488 let content_type = super::ContentType::from(content_type);
489
490 if !status.is_client_error() && !status.is_server_error() {
491 let content = resp.text().await?;
492 match content_type {
493 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
494 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Block`"))),
495 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Block`")))),
496 }
497 } else {
498 let content = resp.text().await?;
499 let entity: Option<GetQueueQidCurrentBlockError> = serde_json::from_str(&content).ok();
500 Err(Error::ResponseError(ResponseContent { status, content, entity }))
501 }
502}
503
504pub async fn get_queue_queue_id_callers(configuration: &configuration::Configuration, qid: &str) -> Result<models::ListWrapperQueueCaller, Error<GetQueueQueueIdCallersError>> {
505 let p_qid = qid;
507
508 let uri_str = format!("{}/queues/{qid}/callers", configuration.base_path, qid=crate::apis::urlencode(p_qid));
509 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
510
511 if let Some(ref user_agent) = configuration.user_agent {
512 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
513 }
514 if let Some(ref token) = configuration.oauth_access_token {
515 req_builder = req_builder.bearer_auth(token.to_owned());
516 };
517
518 let req = req_builder.build()?;
519 let resp = configuration.client.execute(req).await?;
520
521 let status = resp.status();
522 let content_type = resp
523 .headers()
524 .get("content-type")
525 .and_then(|v| v.to_str().ok())
526 .unwrap_or("application/octet-stream");
527 let content_type = super::ContentType::from(content_type);
528
529 if !status.is_client_error() && !status.is_server_error() {
530 let content = resp.text().await?;
531 match content_type {
532 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
533 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ListWrapperQueueCaller`"))),
534 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ListWrapperQueueCaller`")))),
535 }
536 } else {
537 let content = resp.text().await?;
538 let entity: Option<GetQueueQueueIdCallersError> = serde_json::from_str(&content).ok();
539 Err(Error::ResponseError(ResponseContent { status, content, entity }))
540 }
541}
542
543pub async fn get_queues(configuration: &configuration::Configuration, ) -> Result<Vec<models::Queue>, Error<GetQueuesError>> {
544
545 let uri_str = format!("{}/queues", configuration.base_path);
546 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
547
548 if let Some(ref user_agent) = configuration.user_agent {
549 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
550 }
551 if let Some(ref token) = configuration.oauth_access_token {
552 req_builder = req_builder.bearer_auth(token.to_owned());
553 };
554
555 let req = req_builder.build()?;
556 let resp = configuration.client.execute(req).await?;
557
558 let status = resp.status();
559 let content_type = resp
560 .headers()
561 .get("content-type")
562 .and_then(|v| v.to_str().ok())
563 .unwrap_or("application/octet-stream");
564 let content_type = super::ContentType::from(content_type);
565
566 if !status.is_client_error() && !status.is_server_error() {
567 let content = resp.text().await?;
568 match content_type {
569 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
570 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Queue>`"))),
571 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Queue>`")))),
572 }
573 } else {
574 let content = resp.text().await?;
575 let entity: Option<GetQueuesError> = serde_json::from_str(&content).ok();
576 Err(Error::ResponseError(ResponseContent { status, content, entity }))
577 }
578}
579
580pub async fn get_queues_by_number_phone_number(configuration: &configuration::Configuration, phone_number: &str) -> Result<models::Queue, Error<GetQueuesByNumberPhoneNumberError>> {
581 let p_phone_number = phone_number;
583
584 let uri_str = format!("{}/queues/bynumber/{phone_number}", configuration.base_path, phone_number=crate::apis::urlencode(p_phone_number));
585 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
586
587 if let Some(ref user_agent) = configuration.user_agent {
588 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
589 }
590 if let Some(ref token) = configuration.oauth_access_token {
591 req_builder = req_builder.bearer_auth(token.to_owned());
592 };
593
594 let req = req_builder.build()?;
595 let resp = configuration.client.execute(req).await?;
596
597 let status = resp.status();
598 let content_type = resp
599 .headers()
600 .get("content-type")
601 .and_then(|v| v.to_str().ok())
602 .unwrap_or("application/octet-stream");
603 let content_type = super::ContentType::from(content_type);
604
605 if !status.is_client_error() && !status.is_server_error() {
606 let content = resp.text().await?;
607 match content_type {
608 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
609 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Queue`"))),
610 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Queue`")))),
611 }
612 } else {
613 let content = resp.text().await?;
614 let entity: Option<GetQueuesByNumberPhoneNumberError> = serde_json::from_str(&content).ok();
615 Err(Error::ResponseError(ResponseContent { status, content, entity }))
616 }
617}
618
619pub async fn get_queues_queue_id(configuration: &configuration::Configuration, qid: &str) -> Result<models::Queue, Error<GetQueuesQueueIdError>> {
620 let p_qid = qid;
622
623 let uri_str = format!("{}/queues/{qid}", configuration.base_path, qid=crate::apis::urlencode(p_qid));
624 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
625
626 if let Some(ref user_agent) = configuration.user_agent {
627 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
628 }
629 if let Some(ref token) = configuration.oauth_access_token {
630 req_builder = req_builder.bearer_auth(token.to_owned());
631 };
632
633 let req = req_builder.build()?;
634 let resp = configuration.client.execute(req).await?;
635
636 let status = resp.status();
637 let content_type = resp
638 .headers()
639 .get("content-type")
640 .and_then(|v| v.to_str().ok())
641 .unwrap_or("application/octet-stream");
642 let content_type = super::ContentType::from(content_type);
643
644 if !status.is_client_error() && !status.is_server_error() {
645 let content = resp.text().await?;
646 match content_type {
647 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
648 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Queue`"))),
649 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Queue`")))),
650 }
651 } else {
652 let content = resp.text().await?;
653 let entity: Option<GetQueuesQueueIdError> = serde_json::from_str(&content).ok();
654 Err(Error::ResponseError(ResponseContent { status, content, entity }))
655 }
656}
657
658pub async fn get_queues_queue_id_callers_queue_caller_id(configuration: &configuration::Configuration, qid: &str, qcid: &str) -> Result<models::QueueCaller, Error<GetQueuesQueueIdCallersQueueCallerIdError>> {
659 let p_qid = qid;
661 let p_qcid = qcid;
662
663 let uri_str = format!("{}/queues/{qid}/callers/{qcid}", configuration.base_path, qid=crate::apis::urlencode(p_qid), qcid=crate::apis::urlencode(p_qcid));
664 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
665
666 if let Some(ref user_agent) = configuration.user_agent {
667 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
668 }
669 if let Some(ref token) = configuration.oauth_access_token {
670 req_builder = req_builder.bearer_auth(token.to_owned());
671 };
672
673 let req = req_builder.build()?;
674 let resp = configuration.client.execute(req).await?;
675
676 let status = resp.status();
677 let content_type = resp
678 .headers()
679 .get("content-type")
680 .and_then(|v| v.to_str().ok())
681 .unwrap_or("application/octet-stream");
682 let content_type = super::ContentType::from(content_type);
683
684 if !status.is_client_error() && !status.is_server_error() {
685 let content = resp.text().await?;
686 match content_type {
687 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
688 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QueueCaller`"))),
689 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::QueueCaller`")))),
690 }
691 } else {
692 let content = resp.text().await?;
693 let entity: Option<GetQueuesQueueIdCallersQueueCallerIdError> = serde_json::from_str(&content).ok();
694 Err(Error::ResponseError(ResponseContent { status, content, entity }))
695 }
696}
697
698pub async fn get_queues_queue_id_destinations_queue_destination_id(configuration: &configuration::Configuration, qid: &str, qdid: &str) -> Result<models::QueueDestination, Error<GetQueuesQueueIdDestinationsQueueDestinationIdError>> {
699 let p_qid = qid;
701 let p_qdid = qdid;
702
703 let uri_str = format!("{}/queues/{qid}/destinations/{qdid}", configuration.base_path, qid=crate::apis::urlencode(p_qid), qdid=crate::apis::urlencode(p_qdid));
704 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
705
706 if let Some(ref user_agent) = configuration.user_agent {
707 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
708 }
709 if let Some(ref token) = configuration.oauth_access_token {
710 req_builder = req_builder.bearer_auth(token.to_owned());
711 };
712
713 let req = req_builder.build()?;
714 let resp = configuration.client.execute(req).await?;
715
716 let status = resp.status();
717 let content_type = resp
718 .headers()
719 .get("content-type")
720 .and_then(|v| v.to_str().ok())
721 .unwrap_or("application/octet-stream");
722 let content_type = super::ContentType::from(content_type);
723
724 if !status.is_client_error() && !status.is_server_error() {
725 let content = resp.text().await?;
726 match content_type {
727 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
728 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QueueDestination`"))),
729 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::QueueDestination`")))),
730 }
731 } else {
732 let content = resp.text().await?;
733 let entity: Option<GetQueuesQueueIdDestinationsQueueDestinationIdError> = serde_json::from_str(&content).ok();
734 Err(Error::ResponseError(ResponseContent { status, content, entity }))
735 }
736}
737
738pub async fn get_queues_queue_id_queue_number_id(configuration: &configuration::Configuration, qid: &str, qnid: &str) -> Result<models::QueueNumber, Error<GetQueuesQueueIdQueueNumberIdError>> {
739 let p_qid = qid;
741 let p_qnid = qnid;
742
743 let uri_str = format!("{}/queues/{qid}/numbers/{qnid}", configuration.base_path, qid=crate::apis::urlencode(p_qid), qnid=crate::apis::urlencode(p_qnid));
744 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
745
746 if let Some(ref user_agent) = configuration.user_agent {
747 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
748 }
749 if let Some(ref token) = configuration.oauth_access_token {
750 req_builder = req_builder.bearer_auth(token.to_owned());
751 };
752
753 let req = req_builder.build()?;
754 let resp = configuration.client.execute(req).await?;
755
756 let status = resp.status();
757 let content_type = resp
758 .headers()
759 .get("content-type")
760 .and_then(|v| v.to_str().ok())
761 .unwrap_or("application/octet-stream");
762 let content_type = super::ContentType::from(content_type);
763
764 if !status.is_client_error() && !status.is_server_error() {
765 let content = resp.text().await?;
766 match content_type {
767 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
768 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QueueNumber`"))),
769 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::QueueNumber`")))),
770 }
771 } else {
772 let content = resp.text().await?;
773 let entity: Option<GetQueuesQueueIdQueueNumberIdError> = serde_json::from_str(&content).ok();
774 Err(Error::ResponseError(ResponseContent { status, content, entity }))
775 }
776}
777
778pub async fn post_queue_openings(configuration: &configuration::Configuration, qid: &str, new_queue_opening: models::NewQueueOpening) -> Result<models::QueueOpening, Error<PostQueueOpeningsError>> {
779 let p_qid = qid;
781 let p_new_queue_opening = new_queue_opening;
782
783 let uri_str = format!("{}/queues/{qid}/openings", configuration.base_path, qid=crate::apis::urlencode(p_qid));
784 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
785
786 if let Some(ref user_agent) = configuration.user_agent {
787 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
788 }
789 if let Some(ref token) = configuration.oauth_access_token {
790 req_builder = req_builder.bearer_auth(token.to_owned());
791 };
792 req_builder = req_builder.json(&p_new_queue_opening);
793
794 let req = req_builder.build()?;
795 let resp = configuration.client.execute(req).await?;
796
797 let status = resp.status();
798 let content_type = resp
799 .headers()
800 .get("content-type")
801 .and_then(|v| v.to_str().ok())
802 .unwrap_or("application/octet-stream");
803 let content_type = super::ContentType::from(content_type);
804
805 if !status.is_client_error() && !status.is_server_error() {
806 let content = resp.text().await?;
807 match content_type {
808 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
809 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QueueOpening`"))),
810 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::QueueOpening`")))),
811 }
812 } else {
813 let content = resp.text().await?;
814 let entity: Option<PostQueueOpeningsError> = serde_json::from_str(&content).ok();
815 Err(Error::ResponseError(ResponseContent { status, content, entity }))
816 }
817}
818
819pub async fn post_queues_queue_id_callers(configuration: &configuration::Configuration, qid: &str, new_queue_caller: models::NewQueueCaller) -> Result<models::QueueCaller, Error<PostQueuesQueueIdCallersError>> {
821 let p_qid = qid;
823 let p_new_queue_caller = new_queue_caller;
824
825 let uri_str = format!("{}/queues/{qid}/callers", configuration.base_path, qid=crate::apis::urlencode(p_qid));
826 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
827
828 if let Some(ref user_agent) = configuration.user_agent {
829 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
830 }
831 if let Some(ref token) = configuration.oauth_access_token {
832 req_builder = req_builder.bearer_auth(token.to_owned());
833 };
834 req_builder = req_builder.json(&p_new_queue_caller);
835
836 let req = req_builder.build()?;
837 let resp = configuration.client.execute(req).await?;
838
839 let status = resp.status();
840 let content_type = resp
841 .headers()
842 .get("content-type")
843 .and_then(|v| v.to_str().ok())
844 .unwrap_or("application/octet-stream");
845 let content_type = super::ContentType::from(content_type);
846
847 if !status.is_client_error() && !status.is_server_error() {
848 let content = resp.text().await?;
849 match content_type {
850 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
851 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QueueCaller`"))),
852 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::QueueCaller`")))),
853 }
854 } else {
855 let content = resp.text().await?;
856 let entity: Option<PostQueuesQueueIdCallersError> = serde_json::from_str(&content).ok();
857 Err(Error::ResponseError(ResponseContent { status, content, entity }))
858 }
859}
860
861pub async fn post_queues_queue_id_destinations(configuration: &configuration::Configuration, qid: &str, new_queue_destination: models::NewQueueDestination) -> Result<models::QueueDestination, Error<PostQueuesQueueIdDestinationsError>> {
862 let p_qid = qid;
864 let p_new_queue_destination = new_queue_destination;
865
866 let uri_str = format!("{}/queues/{qid}/destinations", configuration.base_path, qid=crate::apis::urlencode(p_qid));
867 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
868
869 if let Some(ref user_agent) = configuration.user_agent {
870 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
871 }
872 if let Some(ref token) = configuration.oauth_access_token {
873 req_builder = req_builder.bearer_auth(token.to_owned());
874 };
875 req_builder = req_builder.json(&p_new_queue_destination);
876
877 let req = req_builder.build()?;
878 let resp = configuration.client.execute(req).await?;
879
880 let status = resp.status();
881 let content_type = resp
882 .headers()
883 .get("content-type")
884 .and_then(|v| v.to_str().ok())
885 .unwrap_or("application/octet-stream");
886 let content_type = super::ContentType::from(content_type);
887
888 if !status.is_client_error() && !status.is_server_error() {
889 let content = resp.text().await?;
890 match content_type {
891 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
892 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QueueDestination`"))),
893 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::QueueDestination`")))),
894 }
895 } else {
896 let content = resp.text().await?;
897 let entity: Option<PostQueuesQueueIdDestinationsError> = serde_json::from_str(&content).ok();
898 Err(Error::ResponseError(ResponseContent { status, content, entity }))
899 }
900}
901
902pub async fn post_queues_queue_id_number(configuration: &configuration::Configuration, qid: &str, new_queue_number: models::NewQueueNumber) -> Result<models::QueueNumber, Error<PostQueuesQueueIdNumberError>> {
903 let p_qid = qid;
905 let p_new_queue_number = new_queue_number;
906
907 let uri_str = format!("{}/queues/{qid}/numbers", configuration.base_path, qid=crate::apis::urlencode(p_qid));
908 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
909
910 if let Some(ref user_agent) = configuration.user_agent {
911 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
912 }
913 if let Some(ref token) = configuration.oauth_access_token {
914 req_builder = req_builder.bearer_auth(token.to_owned());
915 };
916 req_builder = req_builder.json(&p_new_queue_number);
917
918 let req = req_builder.build()?;
919 let resp = configuration.client.execute(req).await?;
920
921 let status = resp.status();
922 let content_type = resp
923 .headers()
924 .get("content-type")
925 .and_then(|v| v.to_str().ok())
926 .unwrap_or("application/octet-stream");
927 let content_type = super::ContentType::from(content_type);
928
929 if !status.is_client_error() && !status.is_server_error() {
930 let content = resp.text().await?;
931 match content_type {
932 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
933 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QueueNumber`"))),
934 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::QueueNumber`")))),
935 }
936 } else {
937 let content = resp.text().await?;
938 let entity: Option<PostQueuesQueueIdNumberError> = serde_json::from_str(&content).ok();
939 Err(Error::ResponseError(ResponseContent { status, content, entity }))
940 }
941}
942
943pub async fn put_queue_openings_id(configuration: &configuration::Configuration, qid: &str, qoid: &str, new_queue_opening: models::NewQueueOpening) -> Result<models::QueueOpening, Error<PutQueueOpeningsIdError>> {
944 let p_qid = qid;
946 let p_qoid = qoid;
947 let p_new_queue_opening = new_queue_opening;
948
949 let uri_str = format!("{}/queues/{qid}/openings/{qoid}", configuration.base_path, qid=crate::apis::urlencode(p_qid), qoid=crate::apis::urlencode(p_qoid));
950 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
951
952 if let Some(ref user_agent) = configuration.user_agent {
953 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
954 }
955 if let Some(ref token) = configuration.oauth_access_token {
956 req_builder = req_builder.bearer_auth(token.to_owned());
957 };
958 req_builder = req_builder.json(&p_new_queue_opening);
959
960 let req = req_builder.build()?;
961 let resp = configuration.client.execute(req).await?;
962
963 let status = resp.status();
964 let content_type = resp
965 .headers()
966 .get("content-type")
967 .and_then(|v| v.to_str().ok())
968 .unwrap_or("application/octet-stream");
969 let content_type = super::ContentType::from(content_type);
970
971 if !status.is_client_error() && !status.is_server_error() {
972 let content = resp.text().await?;
973 match content_type {
974 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
975 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QueueOpening`"))),
976 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::QueueOpening`")))),
977 }
978 } else {
979 let content = resp.text().await?;
980 let entity: Option<PutQueueOpeningsIdError> = serde_json::from_str(&content).ok();
981 Err(Error::ResponseError(ResponseContent { status, content, entity }))
982 }
983}
984
985pub async fn put_queue_queue_id_callers_queue_caller_id(configuration: &configuration::Configuration, qid: &str, qcid: &str, queue_caller_update: models::QueueCallerUpdate) -> Result<models::QueueCaller, Error<PutQueueQueueIdCallersQueueCallerIdError>> {
986 let p_qid = qid;
988 let p_qcid = qcid;
989 let p_queue_caller_update = queue_caller_update;
990
991 let uri_str = format!("{}/queues/{qid}/callers/{qcid}", configuration.base_path, qid=crate::apis::urlencode(p_qid), qcid=crate::apis::urlencode(p_qcid));
992 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
993
994 if let Some(ref user_agent) = configuration.user_agent {
995 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
996 }
997 if let Some(ref token) = configuration.oauth_access_token {
998 req_builder = req_builder.bearer_auth(token.to_owned());
999 };
1000 req_builder = req_builder.json(&p_queue_caller_update);
1001
1002 let req = req_builder.build()?;
1003 let resp = configuration.client.execute(req).await?;
1004
1005 let status = resp.status();
1006 let content_type = resp
1007 .headers()
1008 .get("content-type")
1009 .and_then(|v| v.to_str().ok())
1010 .unwrap_or("application/octet-stream");
1011 let content_type = super::ContentType::from(content_type);
1012
1013 if !status.is_client_error() && !status.is_server_error() {
1014 let content = resp.text().await?;
1015 match content_type {
1016 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1017 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QueueCaller`"))),
1018 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::QueueCaller`")))),
1019 }
1020 } else {
1021 let content = resp.text().await?;
1022 let entity: Option<PutQueueQueueIdCallersQueueCallerIdError> = serde_json::from_str(&content).ok();
1023 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1024 }
1025}
1026
1027pub async fn put_queues_queue_id_destinations_queue_destination_id(configuration: &configuration::Configuration, qid: &str, qdid: &str, new_queue_destination: models::NewQueueDestination) -> Result<models::QueueDestination, Error<PutQueuesQueueIdDestinationsQueueDestinationIdError>> {
1028 let p_qid = qid;
1030 let p_qdid = qdid;
1031 let p_new_queue_destination = new_queue_destination;
1032
1033 let uri_str = format!("{}/queues/{qid}/destinations/{qdid}", configuration.base_path, qid=crate::apis::urlencode(p_qid), qdid=crate::apis::urlencode(p_qdid));
1034 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
1035
1036 if let Some(ref user_agent) = configuration.user_agent {
1037 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1038 }
1039 if let Some(ref token) = configuration.oauth_access_token {
1040 req_builder = req_builder.bearer_auth(token.to_owned());
1041 };
1042 req_builder = req_builder.json(&p_new_queue_destination);
1043
1044 let req = req_builder.build()?;
1045 let resp = configuration.client.execute(req).await?;
1046
1047 let status = resp.status();
1048 let content_type = resp
1049 .headers()
1050 .get("content-type")
1051 .and_then(|v| v.to_str().ok())
1052 .unwrap_or("application/octet-stream");
1053 let content_type = super::ContentType::from(content_type);
1054
1055 if !status.is_client_error() && !status.is_server_error() {
1056 let content = resp.text().await?;
1057 match content_type {
1058 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1059 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QueueDestination`"))),
1060 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::QueueDestination`")))),
1061 }
1062 } else {
1063 let content = resp.text().await?;
1064 let entity: Option<PutQueuesQueueIdDestinationsQueueDestinationIdError> = serde_json::from_str(&content).ok();
1065 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1066 }
1067}
1068
1069pub async fn put_queues_queue_id_numbers_queue_number_id(configuration: &configuration::Configuration, qid: &str, qnid: &str, new_queue_number: models::NewQueueNumber) -> Result<models::QueueNumber, Error<PutQueuesQueueIdNumbersQueueNumberIdError>> {
1070 let p_qid = qid;
1072 let p_qnid = qnid;
1073 let p_new_queue_number = new_queue_number;
1074
1075 let uri_str = format!("{}/queues/{qid}/numbers/{qnid}", configuration.base_path, qid=crate::apis::urlencode(p_qid), qnid=crate::apis::urlencode(p_qnid));
1076 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
1077
1078 if let Some(ref user_agent) = configuration.user_agent {
1079 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1080 }
1081 if let Some(ref token) = configuration.oauth_access_token {
1082 req_builder = req_builder.bearer_auth(token.to_owned());
1083 };
1084 req_builder = req_builder.json(&p_new_queue_number);
1085
1086 let req = req_builder.build()?;
1087 let resp = configuration.client.execute(req).await?;
1088
1089 let status = resp.status();
1090 let content_type = resp
1091 .headers()
1092 .get("content-type")
1093 .and_then(|v| v.to_str().ok())
1094 .unwrap_or("application/octet-stream");
1095 let content_type = super::ContentType::from(content_type);
1096
1097 if !status.is_client_error() && !status.is_server_error() {
1098 let content = resp.text().await?;
1099 match content_type {
1100 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1101 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QueueNumber`"))),
1102 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::QueueNumber`")))),
1103 }
1104 } else {
1105 let content = resp.text().await?;
1106 let entity: Option<PutQueuesQueueIdNumbersQueueNumberIdError> = serde_json::from_str(&content).ok();
1107 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1108 }
1109}
1110
1111pub async fn queue(configuration: &configuration::Configuration, ) -> Result<Vec<models::LegacyQueue>, Error<QueueError>> {
1112
1113 let uri_str = format!("{}/queue", configuration.base_path);
1114 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1115
1116 if let Some(ref user_agent) = configuration.user_agent {
1117 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1118 }
1119 if let Some(ref token) = configuration.oauth_access_token {
1120 req_builder = req_builder.bearer_auth(token.to_owned());
1121 };
1122
1123 let req = req_builder.build()?;
1124 let resp = configuration.client.execute(req).await?;
1125
1126 let status = resp.status();
1127 let content_type = resp
1128 .headers()
1129 .get("content-type")
1130 .and_then(|v| v.to_str().ok())
1131 .unwrap_or("application/octet-stream");
1132 let content_type = super::ContentType::from(content_type);
1133
1134 if !status.is_client_error() && !status.is_server_error() {
1135 let content = resp.text().await?;
1136 match content_type {
1137 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1138 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::LegacyQueue>`"))),
1139 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::LegacyQueue>`")))),
1140 }
1141 } else {
1142 let content = resp.text().await?;
1143 let entity: Option<QueueError> = serde_json::from_str(&content).ok();
1144 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1145 }
1146}
1147