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 DeleteListingsItemError {
20 Status400(models::listings_items_2021_08_01::ErrorList),
21 Status403(models::listings_items_2021_08_01::ErrorList),
22 Status413(models::listings_items_2021_08_01::ErrorList),
23 Status415(models::listings_items_2021_08_01::ErrorList),
24 Status429(models::listings_items_2021_08_01::ErrorList),
25 Status500(models::listings_items_2021_08_01::ErrorList),
26 Status503(models::listings_items_2021_08_01::ErrorList),
27 UnknownValue(serde_json::Value),
28}
29
30#[derive(Debug, Clone, Serialize, Deserialize)]
32#[serde(untagged)]
33pub enum GetListingsItemError {
34 Status400(models::listings_items_2021_08_01::ErrorList),
35 Status403(models::listings_items_2021_08_01::ErrorList),
36 Status404(models::listings_items_2021_08_01::ErrorList),
37 Status413(models::listings_items_2021_08_01::ErrorList),
38 Status415(models::listings_items_2021_08_01::ErrorList),
39 Status429(models::listings_items_2021_08_01::ErrorList),
40 Status500(models::listings_items_2021_08_01::ErrorList),
41 Status503(models::listings_items_2021_08_01::ErrorList),
42 UnknownValue(serde_json::Value),
43}
44
45#[derive(Debug, Clone, Serialize, Deserialize)]
47#[serde(untagged)]
48pub enum PatchListingsItemError {
49 Status400(models::listings_items_2021_08_01::ErrorList),
50 Status403(models::listings_items_2021_08_01::ErrorList),
51 Status413(models::listings_items_2021_08_01::ErrorList),
52 Status415(models::listings_items_2021_08_01::ErrorList),
53 Status429(models::listings_items_2021_08_01::ErrorList),
54 Status500(models::listings_items_2021_08_01::ErrorList),
55 Status503(models::listings_items_2021_08_01::ErrorList),
56 UnknownValue(serde_json::Value),
57}
58
59#[derive(Debug, Clone, Serialize, Deserialize)]
61#[serde(untagged)]
62pub enum PutListingsItemError {
63 Status400(models::listings_items_2021_08_01::ErrorList),
64 Status403(models::listings_items_2021_08_01::ErrorList),
65 Status413(models::listings_items_2021_08_01::ErrorList),
66 Status415(models::listings_items_2021_08_01::ErrorList),
67 Status429(models::listings_items_2021_08_01::ErrorList),
68 Status500(models::listings_items_2021_08_01::ErrorList),
69 Status503(models::listings_items_2021_08_01::ErrorList),
70 UnknownValue(serde_json::Value),
71}
72
73#[derive(Debug, Clone, Serialize, Deserialize)]
75#[serde(untagged)]
76pub enum SearchListingsItemsError {
77 Status400(models::listings_items_2021_08_01::ErrorList),
78 Status403(models::listings_items_2021_08_01::ErrorList),
79 Status404(models::listings_items_2021_08_01::ErrorList),
80 Status413(models::listings_items_2021_08_01::ErrorList),
81 Status415(models::listings_items_2021_08_01::ErrorList),
82 Status429(models::listings_items_2021_08_01::ErrorList),
83 Status500(models::listings_items_2021_08_01::ErrorList),
84 Status503(models::listings_items_2021_08_01::ErrorList),
85 UnknownValue(serde_json::Value),
86}
87
88pub async fn delete_listings_item(
90 configuration: &configuration::Configuration,
91 seller_id: &str,
92 sku: &str,
93 marketplace_ids: Vec<String>,
94 issue_locale: Option<&str>,
95) -> Result<
96 models::listings_items_2021_08_01::ListingsItemSubmissionResponse,
97 Error<DeleteListingsItemError>,
98> {
99 let p_seller_id = seller_id;
101 let p_sku = sku;
102 let p_marketplace_ids = marketplace_ids;
103 let p_issue_locale = issue_locale;
104
105 let uri_str = format!(
106 "{}/listings/2021-08-01/items/{sellerId}/{sku}",
107 configuration.base_path,
108 sellerId = crate::apis::urlencode(p_seller_id),
109 sku = crate::apis::urlencode(p_sku)
110 );
111 let mut req_builder = configuration
112 .client
113 .request(reqwest::Method::DELETE, &uri_str);
114
115 req_builder = match "csv" {
116 "multi" => req_builder.query(
117 &p_marketplace_ids
118 .into_iter()
119 .map(|p| ("marketplaceIds".to_owned(), p.to_string()))
120 .collect::<Vec<(std::string::String, std::string::String)>>(),
121 ),
122 _ => req_builder.query(&[(
123 "marketplaceIds",
124 &p_marketplace_ids
125 .into_iter()
126 .map(|p| p.to_string())
127 .collect::<Vec<String>>()
128 .join(",")
129 .to_string(),
130 )]),
131 };
132 if let Some(ref param_value) = p_issue_locale {
133 req_builder = req_builder.query(&[("issueLocale", ¶m_value.to_string())]);
134 }
135 if let Some(ref user_agent) = configuration.user_agent {
136 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
137 }
138
139 let req = req_builder.build()?;
140 let resp = configuration.client.execute(req).await?;
141
142 let status = resp.status();
143 let content_type = resp
144 .headers()
145 .get("content-type")
146 .and_then(|v| v.to_str().ok())
147 .unwrap_or("application/octet-stream");
148 let content_type = super::ContentType::from(content_type);
149
150 if !status.is_client_error() && !status.is_server_error() {
151 let content = resp.text().await?;
152 match content_type {
153 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
154 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::listings_items_2021_08_01::ListingsItemSubmissionResponse`"))),
155 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::listings_items_2021_08_01::ListingsItemSubmissionResponse`")))),
156 }
157 } else {
158 let content = resp.text().await?;
159 let entity: Option<DeleteListingsItemError> = serde_json::from_str(&content).ok();
160 Err(Error::ResponseError(ResponseContent {
161 status,
162 content,
163 entity,
164 }))
165 }
166}
167
168pub async fn get_listings_item(
170 configuration: &configuration::Configuration,
171 seller_id: &str,
172 sku: &str,
173 marketplace_ids: Vec<String>,
174 issue_locale: Option<&str>,
175 included_data: Option<Vec<String>>,
176) -> Result<models::listings_items_2021_08_01::Item, Error<GetListingsItemError>> {
177 let p_seller_id = seller_id;
179 let p_sku = sku;
180 let p_marketplace_ids = marketplace_ids;
181 let p_issue_locale = issue_locale;
182 let p_included_data = included_data;
183
184 let uri_str = format!(
185 "{}/listings/2021-08-01/items/{sellerId}/{sku}",
186 configuration.base_path,
187 sellerId = crate::apis::urlencode(p_seller_id),
188 sku = crate::apis::urlencode(p_sku)
189 );
190 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
191
192 req_builder = match "csv" {
193 "multi" => req_builder.query(
194 &p_marketplace_ids
195 .into_iter()
196 .map(|p| ("marketplaceIds".to_owned(), p.to_string()))
197 .collect::<Vec<(std::string::String, std::string::String)>>(),
198 ),
199 _ => req_builder.query(&[(
200 "marketplaceIds",
201 &p_marketplace_ids
202 .into_iter()
203 .map(|p| p.to_string())
204 .collect::<Vec<String>>()
205 .join(",")
206 .to_string(),
207 )]),
208 };
209 if let Some(ref param_value) = p_issue_locale {
210 req_builder = req_builder.query(&[("issueLocale", ¶m_value.to_string())]);
211 }
212 if let Some(ref param_value) = p_included_data {
213 req_builder = match "csv" {
214 "multi" => req_builder.query(
215 ¶m_value
216 .into_iter()
217 .map(|p| ("includedData".to_owned(), p.to_string()))
218 .collect::<Vec<(std::string::String, std::string::String)>>(),
219 ),
220 _ => req_builder.query(&[(
221 "includedData",
222 ¶m_value
223 .into_iter()
224 .map(|p| p.to_string())
225 .collect::<Vec<String>>()
226 .join(",")
227 .to_string(),
228 )]),
229 };
230 }
231 if let Some(ref user_agent) = configuration.user_agent {
232 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
233 }
234
235 let req = req_builder.build()?;
236 let resp = configuration.client.execute(req).await?;
237
238 let status = resp.status();
239 let content_type = resp
240 .headers()
241 .get("content-type")
242 .and_then(|v| v.to_str().ok())
243 .unwrap_or("application/octet-stream");
244 let content_type = super::ContentType::from(content_type);
245
246 if !status.is_client_error() && !status.is_server_error() {
247 let content = resp.text().await?;
248 match content_type {
249 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
250 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::listings_items_2021_08_01::Item`"))),
251 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::listings_items_2021_08_01::Item`")))),
252 }
253 } else {
254 let content = resp.text().await?;
255 let entity: Option<GetListingsItemError> = serde_json::from_str(&content).ok();
256 Err(Error::ResponseError(ResponseContent {
257 status,
258 content,
259 entity,
260 }))
261 }
262}
263
264pub async fn patch_listings_item(
266 configuration: &configuration::Configuration,
267 seller_id: &str,
268 sku: &str,
269 marketplace_ids: Vec<String>,
270 body: models::listings_items_2021_08_01::ListingsItemPatchRequest,
271 included_data: Option<Vec<String>>,
272 mode: Option<&str>,
273 issue_locale: Option<&str>,
274) -> Result<
275 models::listings_items_2021_08_01::ListingsItemSubmissionResponse,
276 Error<PatchListingsItemError>,
277> {
278 let p_seller_id = seller_id;
280 let p_sku = sku;
281 let p_marketplace_ids = marketplace_ids;
282 let p_body = body;
283 let p_included_data = included_data;
284 let p_mode = mode;
285 let p_issue_locale = issue_locale;
286
287 let uri_str = format!(
288 "{}/listings/2021-08-01/items/{sellerId}/{sku}",
289 configuration.base_path,
290 sellerId = crate::apis::urlencode(p_seller_id),
291 sku = crate::apis::urlencode(p_sku)
292 );
293 let mut req_builder = configuration
294 .client
295 .request(reqwest::Method::PATCH, &uri_str);
296
297 req_builder = match "csv" {
298 "multi" => req_builder.query(
299 &p_marketplace_ids
300 .into_iter()
301 .map(|p| ("marketplaceIds".to_owned(), p.to_string()))
302 .collect::<Vec<(std::string::String, std::string::String)>>(),
303 ),
304 _ => req_builder.query(&[(
305 "marketplaceIds",
306 &p_marketplace_ids
307 .into_iter()
308 .map(|p| p.to_string())
309 .collect::<Vec<String>>()
310 .join(",")
311 .to_string(),
312 )]),
313 };
314 if let Some(ref param_value) = p_included_data {
315 req_builder = match "csv" {
316 "multi" => req_builder.query(
317 ¶m_value
318 .into_iter()
319 .map(|p| ("includedData".to_owned(), p.to_string()))
320 .collect::<Vec<(std::string::String, std::string::String)>>(),
321 ),
322 _ => req_builder.query(&[(
323 "includedData",
324 ¶m_value
325 .into_iter()
326 .map(|p| p.to_string())
327 .collect::<Vec<String>>()
328 .join(",")
329 .to_string(),
330 )]),
331 };
332 }
333 if let Some(ref param_value) = p_mode {
334 req_builder = req_builder.query(&[("mode", ¶m_value.to_string())]);
335 }
336 if let Some(ref param_value) = p_issue_locale {
337 req_builder = req_builder.query(&[("issueLocale", ¶m_value.to_string())]);
338 }
339 if let Some(ref user_agent) = configuration.user_agent {
340 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
341 }
342 req_builder = req_builder.json(&p_body);
343
344 let req = req_builder.build()?;
345 let resp = configuration.client.execute(req).await?;
346
347 let status = resp.status();
348 let content_type = resp
349 .headers()
350 .get("content-type")
351 .and_then(|v| v.to_str().ok())
352 .unwrap_or("application/octet-stream");
353 let content_type = super::ContentType::from(content_type);
354
355 if !status.is_client_error() && !status.is_server_error() {
356 let content = resp.text().await?;
357 match content_type {
358 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
359 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::listings_items_2021_08_01::ListingsItemSubmissionResponse`"))),
360 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::listings_items_2021_08_01::ListingsItemSubmissionResponse`")))),
361 }
362 } else {
363 let content = resp.text().await?;
364 let entity: Option<PatchListingsItemError> = serde_json::from_str(&content).ok();
365 Err(Error::ResponseError(ResponseContent {
366 status,
367 content,
368 entity,
369 }))
370 }
371}
372
373pub async fn put_listings_item(
375 configuration: &configuration::Configuration,
376 seller_id: &str,
377 sku: &str,
378 marketplace_ids: Vec<String>,
379 body: models::listings_items_2021_08_01::ListingsItemPutRequest,
380 included_data: Option<Vec<String>>,
381 mode: Option<&str>,
382 issue_locale: Option<&str>,
383) -> Result<
384 models::listings_items_2021_08_01::ListingsItemSubmissionResponse,
385 Error<PutListingsItemError>,
386> {
387 let p_seller_id = seller_id;
389 let p_sku = sku;
390 let p_marketplace_ids = marketplace_ids;
391 let p_body = body;
392 let p_included_data = included_data;
393 let p_mode = mode;
394 let p_issue_locale = issue_locale;
395
396 let uri_str = format!(
397 "{}/listings/2021-08-01/items/{sellerId}/{sku}",
398 configuration.base_path,
399 sellerId = crate::apis::urlencode(p_seller_id),
400 sku = crate::apis::urlencode(p_sku)
401 );
402 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
403
404 req_builder = match "csv" {
405 "multi" => req_builder.query(
406 &p_marketplace_ids
407 .into_iter()
408 .map(|p| ("marketplaceIds".to_owned(), p.to_string()))
409 .collect::<Vec<(std::string::String, std::string::String)>>(),
410 ),
411 _ => req_builder.query(&[(
412 "marketplaceIds",
413 &p_marketplace_ids
414 .into_iter()
415 .map(|p| p.to_string())
416 .collect::<Vec<String>>()
417 .join(",")
418 .to_string(),
419 )]),
420 };
421 if let Some(ref param_value) = p_included_data {
422 req_builder = match "csv" {
423 "multi" => req_builder.query(
424 ¶m_value
425 .into_iter()
426 .map(|p| ("includedData".to_owned(), p.to_string()))
427 .collect::<Vec<(std::string::String, std::string::String)>>(),
428 ),
429 _ => req_builder.query(&[(
430 "includedData",
431 ¶m_value
432 .into_iter()
433 .map(|p| p.to_string())
434 .collect::<Vec<String>>()
435 .join(",")
436 .to_string(),
437 )]),
438 };
439 }
440 if let Some(ref param_value) = p_mode {
441 req_builder = req_builder.query(&[("mode", ¶m_value.to_string())]);
442 }
443 if let Some(ref param_value) = p_issue_locale {
444 req_builder = req_builder.query(&[("issueLocale", ¶m_value.to_string())]);
445 }
446 if let Some(ref user_agent) = configuration.user_agent {
447 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
448 }
449 req_builder = req_builder.json(&p_body);
450
451 let req = req_builder.build()?;
452 let resp = configuration.client.execute(req).await?;
453
454 let status = resp.status();
455 let content_type = resp
456 .headers()
457 .get("content-type")
458 .and_then(|v| v.to_str().ok())
459 .unwrap_or("application/octet-stream");
460 let content_type = super::ContentType::from(content_type);
461
462 if !status.is_client_error() && !status.is_server_error() {
463 let content = resp.text().await?;
464 match content_type {
465 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
466 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::listings_items_2021_08_01::ListingsItemSubmissionResponse`"))),
467 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::listings_items_2021_08_01::ListingsItemSubmissionResponse`")))),
468 }
469 } else {
470 let content = resp.text().await?;
471 let entity: Option<PutListingsItemError> = serde_json::from_str(&content).ok();
472 Err(Error::ResponseError(ResponseContent {
473 status,
474 content,
475 entity,
476 }))
477 }
478}
479
480pub async fn search_listings_items(
482 configuration: &configuration::Configuration,
483 seller_id: &str,
484 marketplace_ids: Vec<String>,
485 issue_locale: Option<&str>,
486 included_data: Option<Vec<String>>,
487 identifiers: Option<Vec<String>>,
488 identifiers_type: Option<&str>,
489 variation_parent_sku: Option<&str>,
490 package_hierarchy_sku: Option<&str>,
491 created_after: Option<String>,
492 created_before: Option<String>,
493 last_updated_after: Option<String>,
494 last_updated_before: Option<String>,
495 with_issue_severity: Option<Vec<String>>,
496 with_status: Option<Vec<String>>,
497 without_status: Option<Vec<String>>,
498 sort_by: Option<&str>,
499 sort_order: Option<&str>,
500 page_size: Option<i32>,
501 page_token: Option<&str>,
502) -> Result<models::listings_items_2021_08_01::ItemSearchResults, Error<SearchListingsItemsError>> {
503 let p_seller_id = seller_id;
505 let p_marketplace_ids = marketplace_ids;
506 let p_issue_locale = issue_locale;
507 let p_included_data = included_data;
508 let p_identifiers = identifiers;
509 let p_identifiers_type = identifiers_type;
510 let p_variation_parent_sku = variation_parent_sku;
511 let p_package_hierarchy_sku = package_hierarchy_sku;
512 let p_created_after = created_after;
513 let p_created_before = created_before;
514 let p_last_updated_after = last_updated_after;
515 let p_last_updated_before = last_updated_before;
516 let p_with_issue_severity = with_issue_severity;
517 let p_with_status = with_status;
518 let p_without_status = without_status;
519 let p_sort_by = sort_by;
520 let p_sort_order = sort_order;
521 let p_page_size = page_size;
522 let p_page_token = page_token;
523
524 let uri_str = format!(
525 "{}/listings/2021-08-01/items/{sellerId}",
526 configuration.base_path,
527 sellerId = crate::apis::urlencode(p_seller_id)
528 );
529 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
530
531 req_builder = match "csv" {
532 "multi" => req_builder.query(
533 &p_marketplace_ids
534 .into_iter()
535 .map(|p| ("marketplaceIds".to_owned(), p.to_string()))
536 .collect::<Vec<(std::string::String, std::string::String)>>(),
537 ),
538 _ => req_builder.query(&[(
539 "marketplaceIds",
540 &p_marketplace_ids
541 .into_iter()
542 .map(|p| p.to_string())
543 .collect::<Vec<String>>()
544 .join(",")
545 .to_string(),
546 )]),
547 };
548 if let Some(ref param_value) = p_issue_locale {
549 req_builder = req_builder.query(&[("issueLocale", ¶m_value.to_string())]);
550 }
551 if let Some(ref param_value) = p_included_data {
552 req_builder = match "csv" {
553 "multi" => req_builder.query(
554 ¶m_value
555 .into_iter()
556 .map(|p| ("includedData".to_owned(), p.to_string()))
557 .collect::<Vec<(std::string::String, std::string::String)>>(),
558 ),
559 _ => req_builder.query(&[(
560 "includedData",
561 ¶m_value
562 .into_iter()
563 .map(|p| p.to_string())
564 .collect::<Vec<String>>()
565 .join(",")
566 .to_string(),
567 )]),
568 };
569 }
570 if let Some(ref param_value) = p_identifiers {
571 req_builder = match "csv" {
572 "multi" => req_builder.query(
573 ¶m_value
574 .into_iter()
575 .map(|p| ("identifiers".to_owned(), p.to_string()))
576 .collect::<Vec<(std::string::String, std::string::String)>>(),
577 ),
578 _ => req_builder.query(&[(
579 "identifiers",
580 ¶m_value
581 .into_iter()
582 .map(|p| p.to_string())
583 .collect::<Vec<String>>()
584 .join(",")
585 .to_string(),
586 )]),
587 };
588 }
589 if let Some(ref param_value) = p_identifiers_type {
590 req_builder = req_builder.query(&[("identifiersType", ¶m_value.to_string())]);
591 }
592 if let Some(ref param_value) = p_variation_parent_sku {
593 req_builder = req_builder.query(&[("variationParentSku", ¶m_value.to_string())]);
594 }
595 if let Some(ref param_value) = p_package_hierarchy_sku {
596 req_builder = req_builder.query(&[("packageHierarchySku", ¶m_value.to_string())]);
597 }
598 if let Some(ref param_value) = p_created_after {
599 req_builder = req_builder.query(&[("createdAfter", ¶m_value.to_string())]);
600 }
601 if let Some(ref param_value) = p_created_before {
602 req_builder = req_builder.query(&[("createdBefore", ¶m_value.to_string())]);
603 }
604 if let Some(ref param_value) = p_last_updated_after {
605 req_builder = req_builder.query(&[("lastUpdatedAfter", ¶m_value.to_string())]);
606 }
607 if let Some(ref param_value) = p_last_updated_before {
608 req_builder = req_builder.query(&[("lastUpdatedBefore", ¶m_value.to_string())]);
609 }
610 if let Some(ref param_value) = p_with_issue_severity {
611 req_builder = match "csv" {
612 "multi" => req_builder.query(
613 ¶m_value
614 .into_iter()
615 .map(|p| ("withIssueSeverity".to_owned(), p.to_string()))
616 .collect::<Vec<(std::string::String, std::string::String)>>(),
617 ),
618 _ => req_builder.query(&[(
619 "withIssueSeverity",
620 ¶m_value
621 .into_iter()
622 .map(|p| p.to_string())
623 .collect::<Vec<String>>()
624 .join(",")
625 .to_string(),
626 )]),
627 };
628 }
629 if let Some(ref param_value) = p_with_status {
630 req_builder = match "csv" {
631 "multi" => req_builder.query(
632 ¶m_value
633 .into_iter()
634 .map(|p| ("withStatus".to_owned(), p.to_string()))
635 .collect::<Vec<(std::string::String, std::string::String)>>(),
636 ),
637 _ => req_builder.query(&[(
638 "withStatus",
639 ¶m_value
640 .into_iter()
641 .map(|p| p.to_string())
642 .collect::<Vec<String>>()
643 .join(",")
644 .to_string(),
645 )]),
646 };
647 }
648 if let Some(ref param_value) = p_without_status {
649 req_builder = match "csv" {
650 "multi" => req_builder.query(
651 ¶m_value
652 .into_iter()
653 .map(|p| ("withoutStatus".to_owned(), p.to_string()))
654 .collect::<Vec<(std::string::String, std::string::String)>>(),
655 ),
656 _ => req_builder.query(&[(
657 "withoutStatus",
658 ¶m_value
659 .into_iter()
660 .map(|p| p.to_string())
661 .collect::<Vec<String>>()
662 .join(",")
663 .to_string(),
664 )]),
665 };
666 }
667 if let Some(ref param_value) = p_sort_by {
668 req_builder = req_builder.query(&[("sortBy", ¶m_value.to_string())]);
669 }
670 if let Some(ref param_value) = p_sort_order {
671 req_builder = req_builder.query(&[("sortOrder", ¶m_value.to_string())]);
672 }
673 if let Some(ref param_value) = p_page_size {
674 req_builder = req_builder.query(&[("pageSize", ¶m_value.to_string())]);
675 }
676 if let Some(ref param_value) = p_page_token {
677 req_builder = req_builder.query(&[("pageToken", ¶m_value.to_string())]);
678 }
679 if let Some(ref user_agent) = configuration.user_agent {
680 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
681 }
682
683 let req = req_builder.build()?;
684 let resp = configuration.client.execute(req).await?;
685
686 let status = resp.status();
687 let content_type = resp
688 .headers()
689 .get("content-type")
690 .and_then(|v| v.to_str().ok())
691 .unwrap_or("application/octet-stream");
692 let content_type = super::ContentType::from(content_type);
693
694 if !status.is_client_error() && !status.is_server_error() {
695 let content = resp.text().await?;
696 match content_type {
697 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
698 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::listings_items_2021_08_01::ItemSearchResults`"))),
699 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::listings_items_2021_08_01::ItemSearchResults`")))),
700 }
701 } else {
702 let content = resp.text().await?;
703 let entity: Option<SearchListingsItemsError> = serde_json::from_str(&content).ok();
704 Err(Error::ResponseError(ResponseContent {
705 status,
706 content,
707 entity,
708 }))
709 }
710}