1use super::{configuration, ContentType, Error};
12use crate::{apis::ResponseContent, models};
13use reqwest;
14use serde::{de::Error as _, Deserialize, Serialize};
15
16#[derive(Debug, Clone, Serialize, Deserialize)]
18#[serde(untagged)]
19pub enum AnnotationQueuesCreateQueueError {
20 Status400(serde_json::Value),
21 Status401(serde_json::Value),
22 Status403(serde_json::Value),
23 Status404(serde_json::Value),
24 Status405(serde_json::Value),
25 UnknownValue(serde_json::Value),
26}
27
28#[derive(Debug, Clone, Serialize, Deserialize)]
30#[serde(untagged)]
31pub enum AnnotationQueuesCreateQueueAssignmentError {
32 Status400(serde_json::Value),
33 Status401(serde_json::Value),
34 Status403(serde_json::Value),
35 Status404(serde_json::Value),
36 Status405(serde_json::Value),
37 UnknownValue(serde_json::Value),
38}
39
40#[derive(Debug, Clone, Serialize, Deserialize)]
42#[serde(untagged)]
43pub enum AnnotationQueuesCreateQueueItemError {
44 Status400(serde_json::Value),
45 Status401(serde_json::Value),
46 Status403(serde_json::Value),
47 Status404(serde_json::Value),
48 Status405(serde_json::Value),
49 UnknownValue(serde_json::Value),
50}
51
52#[derive(Debug, Clone, Serialize, Deserialize)]
54#[serde(untagged)]
55pub enum AnnotationQueuesDeleteQueueAssignmentError {
56 Status400(serde_json::Value),
57 Status401(serde_json::Value),
58 Status403(serde_json::Value),
59 Status404(serde_json::Value),
60 Status405(serde_json::Value),
61 UnknownValue(serde_json::Value),
62}
63
64#[derive(Debug, Clone, Serialize, Deserialize)]
66#[serde(untagged)]
67pub enum AnnotationQueuesDeleteQueueItemError {
68 Status400(serde_json::Value),
69 Status401(serde_json::Value),
70 Status403(serde_json::Value),
71 Status404(serde_json::Value),
72 Status405(serde_json::Value),
73 UnknownValue(serde_json::Value),
74}
75
76#[derive(Debug, Clone, Serialize, Deserialize)]
78#[serde(untagged)]
79pub enum AnnotationQueuesGetQueueError {
80 Status400(serde_json::Value),
81 Status401(serde_json::Value),
82 Status403(serde_json::Value),
83 Status404(serde_json::Value),
84 Status405(serde_json::Value),
85 UnknownValue(serde_json::Value),
86}
87
88#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum AnnotationQueuesGetQueueItemError {
92 Status400(serde_json::Value),
93 Status401(serde_json::Value),
94 Status403(serde_json::Value),
95 Status404(serde_json::Value),
96 Status405(serde_json::Value),
97 UnknownValue(serde_json::Value),
98}
99
100#[derive(Debug, Clone, Serialize, Deserialize)]
102#[serde(untagged)]
103pub enum AnnotationQueuesListQueueItemsError {
104 Status400(serde_json::Value),
105 Status401(serde_json::Value),
106 Status403(serde_json::Value),
107 Status404(serde_json::Value),
108 Status405(serde_json::Value),
109 UnknownValue(serde_json::Value),
110}
111
112#[derive(Debug, Clone, Serialize, Deserialize)]
114#[serde(untagged)]
115pub enum AnnotationQueuesListQueuesError {
116 Status400(serde_json::Value),
117 Status401(serde_json::Value),
118 Status403(serde_json::Value),
119 Status404(serde_json::Value),
120 Status405(serde_json::Value),
121 UnknownValue(serde_json::Value),
122}
123
124#[derive(Debug, Clone, Serialize, Deserialize)]
126#[serde(untagged)]
127pub enum AnnotationQueuesUpdateQueueItemError {
128 Status400(serde_json::Value),
129 Status401(serde_json::Value),
130 Status403(serde_json::Value),
131 Status404(serde_json::Value),
132 Status405(serde_json::Value),
133 UnknownValue(serde_json::Value),
134}
135
136pub async fn annotation_queues_create_queue(
138 configuration: &configuration::Configuration,
139 create_annotation_queue_request: models::CreateAnnotationQueueRequest,
140) -> Result<models::AnnotationQueue, Error<AnnotationQueuesCreateQueueError>> {
141 let p_body_create_annotation_queue_request = create_annotation_queue_request;
143
144 let uri_str = format!("{}/api/public/annotation-queues", configuration.base_path);
145 let mut req_builder = configuration
146 .client
147 .request(reqwest::Method::POST, &uri_str);
148
149 if let Some(ref user_agent) = configuration.user_agent {
150 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
151 }
152 if let Some(ref auth_conf) = configuration.basic_auth {
153 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
154 };
155 req_builder = req_builder.json(&p_body_create_annotation_queue_request);
156
157 let req = req_builder.build()?;
158 let resp = configuration.client.execute(req).await?;
159
160 let status = resp.status();
161 let content_type = resp
162 .headers()
163 .get("content-type")
164 .and_then(|v| v.to_str().ok())
165 .unwrap_or("application/octet-stream");
166 let content_type = super::ContentType::from(content_type);
167
168 if !status.is_client_error() && !status.is_server_error() {
169 let content = resp.text().await?;
170 match content_type {
171 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
172 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::AnnotationQueue`"))),
173 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::AnnotationQueue`")))),
174 }
175 } else {
176 let content = resp.text().await?;
177 let entity: Option<AnnotationQueuesCreateQueueError> = serde_json::from_str(&content).ok();
178 Err(Error::ResponseError(ResponseContent {
179 status,
180 content,
181 entity,
182 }))
183 }
184}
185
186pub async fn annotation_queues_create_queue_assignment(
188 configuration: &configuration::Configuration,
189 queue_id: &str,
190 annotation_queue_assignment_request: models::AnnotationQueueAssignmentRequest,
191) -> Result<
192 models::CreateAnnotationQueueAssignmentResponse,
193 Error<AnnotationQueuesCreateQueueAssignmentError>,
194> {
195 let p_path_queue_id = queue_id;
197 let p_body_annotation_queue_assignment_request = annotation_queue_assignment_request;
198
199 let uri_str = format!(
200 "{}/api/public/annotation-queues/{queueId}/assignments",
201 configuration.base_path,
202 queueId = crate::apis::urlencode(p_path_queue_id)
203 );
204 let mut req_builder = configuration
205 .client
206 .request(reqwest::Method::POST, &uri_str);
207
208 if let Some(ref user_agent) = configuration.user_agent {
209 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
210 }
211 if let Some(ref auth_conf) = configuration.basic_auth {
212 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
213 };
214 req_builder = req_builder.json(&p_body_annotation_queue_assignment_request);
215
216 let req = req_builder.build()?;
217 let resp = configuration.client.execute(req).await?;
218
219 let status = resp.status();
220 let content_type = resp
221 .headers()
222 .get("content-type")
223 .and_then(|v| v.to_str().ok())
224 .unwrap_or("application/octet-stream");
225 let content_type = super::ContentType::from(content_type);
226
227 if !status.is_client_error() && !status.is_server_error() {
228 let content = resp.text().await?;
229 match content_type {
230 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
231 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateAnnotationQueueAssignmentResponse`"))),
232 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::CreateAnnotationQueueAssignmentResponse`")))),
233 }
234 } else {
235 let content = resp.text().await?;
236 let entity: Option<AnnotationQueuesCreateQueueAssignmentError> =
237 serde_json::from_str(&content).ok();
238 Err(Error::ResponseError(ResponseContent {
239 status,
240 content,
241 entity,
242 }))
243 }
244}
245
246pub async fn annotation_queues_create_queue_item(
248 configuration: &configuration::Configuration,
249 queue_id: &str,
250 create_annotation_queue_item_request: models::CreateAnnotationQueueItemRequest,
251) -> Result<models::AnnotationQueueItem, Error<AnnotationQueuesCreateQueueItemError>> {
252 let p_path_queue_id = queue_id;
254 let p_body_create_annotation_queue_item_request = create_annotation_queue_item_request;
255
256 let uri_str = format!(
257 "{}/api/public/annotation-queues/{queueId}/items",
258 configuration.base_path,
259 queueId = crate::apis::urlencode(p_path_queue_id)
260 );
261 let mut req_builder = configuration
262 .client
263 .request(reqwest::Method::POST, &uri_str);
264
265 if let Some(ref user_agent) = configuration.user_agent {
266 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
267 }
268 if let Some(ref auth_conf) = configuration.basic_auth {
269 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
270 };
271 req_builder = req_builder.json(&p_body_create_annotation_queue_item_request);
272
273 let req = req_builder.build()?;
274 let resp = configuration.client.execute(req).await?;
275
276 let status = resp.status();
277 let content_type = resp
278 .headers()
279 .get("content-type")
280 .and_then(|v| v.to_str().ok())
281 .unwrap_or("application/octet-stream");
282 let content_type = super::ContentType::from(content_type);
283
284 if !status.is_client_error() && !status.is_server_error() {
285 let content = resp.text().await?;
286 match content_type {
287 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
288 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::AnnotationQueueItem`"))),
289 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::AnnotationQueueItem`")))),
290 }
291 } else {
292 let content = resp.text().await?;
293 let entity: Option<AnnotationQueuesCreateQueueItemError> =
294 serde_json::from_str(&content).ok();
295 Err(Error::ResponseError(ResponseContent {
296 status,
297 content,
298 entity,
299 }))
300 }
301}
302
303pub async fn annotation_queues_delete_queue_assignment(
305 configuration: &configuration::Configuration,
306 queue_id: &str,
307 annotation_queue_assignment_request: models::AnnotationQueueAssignmentRequest,
308) -> Result<
309 models::DeleteAnnotationQueueAssignmentResponse,
310 Error<AnnotationQueuesDeleteQueueAssignmentError>,
311> {
312 let p_path_queue_id = queue_id;
314 let p_body_annotation_queue_assignment_request = annotation_queue_assignment_request;
315
316 let uri_str = format!(
317 "{}/api/public/annotation-queues/{queueId}/assignments",
318 configuration.base_path,
319 queueId = crate::apis::urlencode(p_path_queue_id)
320 );
321 let mut req_builder = configuration
322 .client
323 .request(reqwest::Method::DELETE, &uri_str);
324
325 if let Some(ref user_agent) = configuration.user_agent {
326 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
327 }
328 if let Some(ref auth_conf) = configuration.basic_auth {
329 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
330 };
331 req_builder = req_builder.json(&p_body_annotation_queue_assignment_request);
332
333 let req = req_builder.build()?;
334 let resp = configuration.client.execute(req).await?;
335
336 let status = resp.status();
337 let content_type = resp
338 .headers()
339 .get("content-type")
340 .and_then(|v| v.to_str().ok())
341 .unwrap_or("application/octet-stream");
342 let content_type = super::ContentType::from(content_type);
343
344 if !status.is_client_error() && !status.is_server_error() {
345 let content = resp.text().await?;
346 match content_type {
347 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
348 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DeleteAnnotationQueueAssignmentResponse`"))),
349 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::DeleteAnnotationQueueAssignmentResponse`")))),
350 }
351 } else {
352 let content = resp.text().await?;
353 let entity: Option<AnnotationQueuesDeleteQueueAssignmentError> =
354 serde_json::from_str(&content).ok();
355 Err(Error::ResponseError(ResponseContent {
356 status,
357 content,
358 entity,
359 }))
360 }
361}
362
363pub async fn annotation_queues_delete_queue_item(
365 configuration: &configuration::Configuration,
366 queue_id: &str,
367 item_id: &str,
368) -> Result<models::DeleteAnnotationQueueItemResponse, Error<AnnotationQueuesDeleteQueueItemError>>
369{
370 let p_path_queue_id = queue_id;
372 let p_path_item_id = item_id;
373
374 let uri_str = format!(
375 "{}/api/public/annotation-queues/{queueId}/items/{itemId}",
376 configuration.base_path,
377 queueId = crate::apis::urlencode(p_path_queue_id),
378 itemId = crate::apis::urlencode(p_path_item_id)
379 );
380 let mut req_builder = configuration
381 .client
382 .request(reqwest::Method::DELETE, &uri_str);
383
384 if let Some(ref user_agent) = configuration.user_agent {
385 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
386 }
387 if let Some(ref auth_conf) = configuration.basic_auth {
388 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
389 };
390
391 let req = req_builder.build()?;
392 let resp = configuration.client.execute(req).await?;
393
394 let status = resp.status();
395 let content_type = resp
396 .headers()
397 .get("content-type")
398 .and_then(|v| v.to_str().ok())
399 .unwrap_or("application/octet-stream");
400 let content_type = super::ContentType::from(content_type);
401
402 if !status.is_client_error() && !status.is_server_error() {
403 let content = resp.text().await?;
404 match content_type {
405 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
406 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DeleteAnnotationQueueItemResponse`"))),
407 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::DeleteAnnotationQueueItemResponse`")))),
408 }
409 } else {
410 let content = resp.text().await?;
411 let entity: Option<AnnotationQueuesDeleteQueueItemError> =
412 serde_json::from_str(&content).ok();
413 Err(Error::ResponseError(ResponseContent {
414 status,
415 content,
416 entity,
417 }))
418 }
419}
420
421pub async fn annotation_queues_get_queue(
423 configuration: &configuration::Configuration,
424 queue_id: &str,
425) -> Result<models::AnnotationQueue, Error<AnnotationQueuesGetQueueError>> {
426 let p_path_queue_id = queue_id;
428
429 let uri_str = format!(
430 "{}/api/public/annotation-queues/{queueId}",
431 configuration.base_path,
432 queueId = crate::apis::urlencode(p_path_queue_id)
433 );
434 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
435
436 if let Some(ref user_agent) = configuration.user_agent {
437 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
438 }
439 if let Some(ref auth_conf) = configuration.basic_auth {
440 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
441 };
442
443 let req = req_builder.build()?;
444 let resp = configuration.client.execute(req).await?;
445
446 let status = resp.status();
447 let content_type = resp
448 .headers()
449 .get("content-type")
450 .and_then(|v| v.to_str().ok())
451 .unwrap_or("application/octet-stream");
452 let content_type = super::ContentType::from(content_type);
453
454 if !status.is_client_error() && !status.is_server_error() {
455 let content = resp.text().await?;
456 match content_type {
457 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
458 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::AnnotationQueue`"))),
459 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::AnnotationQueue`")))),
460 }
461 } else {
462 let content = resp.text().await?;
463 let entity: Option<AnnotationQueuesGetQueueError> = serde_json::from_str(&content).ok();
464 Err(Error::ResponseError(ResponseContent {
465 status,
466 content,
467 entity,
468 }))
469 }
470}
471
472pub async fn annotation_queues_get_queue_item(
474 configuration: &configuration::Configuration,
475 queue_id: &str,
476 item_id: &str,
477) -> Result<models::AnnotationQueueItem, Error<AnnotationQueuesGetQueueItemError>> {
478 let p_path_queue_id = queue_id;
480 let p_path_item_id = item_id;
481
482 let uri_str = format!(
483 "{}/api/public/annotation-queues/{queueId}/items/{itemId}",
484 configuration.base_path,
485 queueId = crate::apis::urlencode(p_path_queue_id),
486 itemId = crate::apis::urlencode(p_path_item_id)
487 );
488 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
489
490 if let Some(ref user_agent) = configuration.user_agent {
491 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
492 }
493 if let Some(ref auth_conf) = configuration.basic_auth {
494 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
495 };
496
497 let req = req_builder.build()?;
498 let resp = configuration.client.execute(req).await?;
499
500 let status = resp.status();
501 let content_type = resp
502 .headers()
503 .get("content-type")
504 .and_then(|v| v.to_str().ok())
505 .unwrap_or("application/octet-stream");
506 let content_type = super::ContentType::from(content_type);
507
508 if !status.is_client_error() && !status.is_server_error() {
509 let content = resp.text().await?;
510 match content_type {
511 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
512 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::AnnotationQueueItem`"))),
513 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::AnnotationQueueItem`")))),
514 }
515 } else {
516 let content = resp.text().await?;
517 let entity: Option<AnnotationQueuesGetQueueItemError> = serde_json::from_str(&content).ok();
518 Err(Error::ResponseError(ResponseContent {
519 status,
520 content,
521 entity,
522 }))
523 }
524}
525
526pub async fn annotation_queues_list_queue_items(
528 configuration: &configuration::Configuration,
529 queue_id: &str,
530 status: Option<models::AnnotationQueueStatus>,
531 page: Option<i32>,
532 limit: Option<i32>,
533) -> Result<models::PaginatedAnnotationQueueItems, Error<AnnotationQueuesListQueueItemsError>> {
534 let p_path_queue_id = queue_id;
536 let p_query_status = status;
537 let p_query_page = page;
538 let p_query_limit = limit;
539
540 let uri_str = format!(
541 "{}/api/public/annotation-queues/{queueId}/items",
542 configuration.base_path,
543 queueId = crate::apis::urlencode(p_path_queue_id)
544 );
545 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
546
547 if let Some(ref param_value) = p_query_status {
548 req_builder = req_builder.query(&[("status", ¶m_value.to_string())]);
549 }
550 if let Some(ref param_value) = p_query_page {
551 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
552 }
553 if let Some(ref param_value) = p_query_limit {
554 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
555 }
556 if let Some(ref user_agent) = configuration.user_agent {
557 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
558 }
559 if let Some(ref auth_conf) = configuration.basic_auth {
560 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
561 };
562
563 let req = req_builder.build()?;
564 let resp = configuration.client.execute(req).await?;
565
566 let status = resp.status();
567 let content_type = resp
568 .headers()
569 .get("content-type")
570 .and_then(|v| v.to_str().ok())
571 .unwrap_or("application/octet-stream");
572 let content_type = super::ContentType::from(content_type);
573
574 if !status.is_client_error() && !status.is_server_error() {
575 let content = resp.text().await?;
576 match content_type {
577 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
578 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaginatedAnnotationQueueItems`"))),
579 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::PaginatedAnnotationQueueItems`")))),
580 }
581 } else {
582 let content = resp.text().await?;
583 let entity: Option<AnnotationQueuesListQueueItemsError> =
584 serde_json::from_str(&content).ok();
585 Err(Error::ResponseError(ResponseContent {
586 status,
587 content,
588 entity,
589 }))
590 }
591}
592
593pub async fn annotation_queues_list_queues(
595 configuration: &configuration::Configuration,
596 page: Option<i32>,
597 limit: Option<i32>,
598) -> Result<models::PaginatedAnnotationQueues, Error<AnnotationQueuesListQueuesError>> {
599 let p_query_page = page;
601 let p_query_limit = limit;
602
603 let uri_str = format!("{}/api/public/annotation-queues", configuration.base_path);
604 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
605
606 if let Some(ref param_value) = p_query_page {
607 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
608 }
609 if let Some(ref param_value) = p_query_limit {
610 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
611 }
612 if let Some(ref user_agent) = configuration.user_agent {
613 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
614 }
615 if let Some(ref auth_conf) = configuration.basic_auth {
616 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
617 };
618
619 let req = req_builder.build()?;
620 let resp = configuration.client.execute(req).await?;
621
622 let status = resp.status();
623 let content_type = resp
624 .headers()
625 .get("content-type")
626 .and_then(|v| v.to_str().ok())
627 .unwrap_or("application/octet-stream");
628 let content_type = super::ContentType::from(content_type);
629
630 if !status.is_client_error() && !status.is_server_error() {
631 let content = resp.text().await?;
632 match content_type {
633 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
634 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaginatedAnnotationQueues`"))),
635 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::PaginatedAnnotationQueues`")))),
636 }
637 } else {
638 let content = resp.text().await?;
639 let entity: Option<AnnotationQueuesListQueuesError> = serde_json::from_str(&content).ok();
640 Err(Error::ResponseError(ResponseContent {
641 status,
642 content,
643 entity,
644 }))
645 }
646}
647
648pub async fn annotation_queues_update_queue_item(
650 configuration: &configuration::Configuration,
651 queue_id: &str,
652 item_id: &str,
653 update_annotation_queue_item_request: models::UpdateAnnotationQueueItemRequest,
654) -> Result<models::AnnotationQueueItem, Error<AnnotationQueuesUpdateQueueItemError>> {
655 let p_path_queue_id = queue_id;
657 let p_path_item_id = item_id;
658 let p_body_update_annotation_queue_item_request = update_annotation_queue_item_request;
659
660 let uri_str = format!(
661 "{}/api/public/annotation-queues/{queueId}/items/{itemId}",
662 configuration.base_path,
663 queueId = crate::apis::urlencode(p_path_queue_id),
664 itemId = crate::apis::urlencode(p_path_item_id)
665 );
666 let mut req_builder = configuration
667 .client
668 .request(reqwest::Method::PATCH, &uri_str);
669
670 if let Some(ref user_agent) = configuration.user_agent {
671 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
672 }
673 if let Some(ref auth_conf) = configuration.basic_auth {
674 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
675 };
676 req_builder = req_builder.json(&p_body_update_annotation_queue_item_request);
677
678 let req = req_builder.build()?;
679 let resp = configuration.client.execute(req).await?;
680
681 let status = resp.status();
682 let content_type = resp
683 .headers()
684 .get("content-type")
685 .and_then(|v| v.to_str().ok())
686 .unwrap_or("application/octet-stream");
687 let content_type = super::ContentType::from(content_type);
688
689 if !status.is_client_error() && !status.is_server_error() {
690 let content = resp.text().await?;
691 match content_type {
692 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
693 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::AnnotationQueueItem`"))),
694 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::AnnotationQueueItem`")))),
695 }
696 } else {
697 let content = resp.text().await?;
698 let entity: Option<AnnotationQueuesUpdateQueueItemError> =
699 serde_json::from_str(&content).ok();
700 Err(Error::ResponseError(ResponseContent {
701 status,
702 content,
703 entity,
704 }))
705 }
706}