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 AddAppointmentForServiceJobByServiceJobIdError {
22 Status400(models::services::SetAppointmentResponse),
23 Status403(models::services::SetAppointmentResponse),
24 Status404(models::services::SetAppointmentResponse),
25 Status413(models::services::SetAppointmentResponse),
26 Status415(models::services::SetAppointmentResponse),
27 Status422(models::services::SetAppointmentResponse),
28 Status429(models::services::SetAppointmentResponse),
29 Status500(models::services::SetAppointmentResponse),
30 Status503(models::services::SetAppointmentResponse),
31 UnknownValue(serde_json::Value),
32}
33
34#[derive(Debug, Clone, Serialize, Deserialize)]
36#[serde(untagged)]
37pub enum AssignAppointmentResourcesError {
38 Status400(models::services::AssignAppointmentResourcesResponse),
39 Status403(models::services::AssignAppointmentResourcesResponse),
40 Status404(models::services::AssignAppointmentResourcesResponse),
41 Status413(models::services::AssignAppointmentResourcesResponse),
42 Status415(models::services::AssignAppointmentResourcesResponse),
43 Status422(models::services::AssignAppointmentResourcesResponse),
44 Status429(models::services::AssignAppointmentResourcesResponse),
45 Status500(models::services::AssignAppointmentResourcesResponse),
46 Status503(models::services::AssignAppointmentResourcesResponse),
47 UnknownValue(serde_json::Value),
48}
49
50#[derive(Debug, Clone, Serialize, Deserialize)]
52#[serde(untagged)]
53pub enum CancelReservationError {
54 Status400(models::services::CancelReservationResponse),
55 Status403(models::services::CancelReservationResponse),
56 Status404(models::services::CancelReservationResponse),
57 Status413(models::services::CancelReservationResponse),
58 Status415(models::services::CancelReservationResponse),
59 Status429(models::services::CancelReservationResponse),
60 Status500(models::services::CancelReservationResponse),
61 Status503(models::services::CancelReservationResponse),
62 UnknownValue(serde_json::Value),
63}
64
65#[derive(Debug, Clone, Serialize, Deserialize)]
67#[serde(untagged)]
68pub enum CancelServiceJobByServiceJobIdError {
69 Status400(models::services::CancelServiceJobByServiceJobIdResponse),
70 Status403(models::services::CancelServiceJobByServiceJobIdResponse),
71 Status404(models::services::CancelServiceJobByServiceJobIdResponse),
72 Status413(models::services::CancelServiceJobByServiceJobIdResponse),
73 Status415(models::services::CancelServiceJobByServiceJobIdResponse),
74 Status422(models::services::CancelServiceJobByServiceJobIdResponse),
75 Status429(models::services::CancelServiceJobByServiceJobIdResponse),
76 Status500(models::services::CancelServiceJobByServiceJobIdResponse),
77 Status503(models::services::CancelServiceJobByServiceJobIdResponse),
78 UnknownValue(serde_json::Value),
79}
80
81#[derive(Debug, Clone, Serialize, Deserialize)]
83#[serde(untagged)]
84pub enum CompleteServiceJobByServiceJobIdError {
85 Status400(models::services::CompleteServiceJobByServiceJobIdResponse),
86 Status403(models::services::CompleteServiceJobByServiceJobIdResponse),
87 Status404(models::services::CompleteServiceJobByServiceJobIdResponse),
88 Status413(models::services::CompleteServiceJobByServiceJobIdResponse),
89 Status415(models::services::CompleteServiceJobByServiceJobIdResponse),
90 Status422(models::services::CompleteServiceJobByServiceJobIdResponse),
91 Status429(models::services::CompleteServiceJobByServiceJobIdResponse),
92 Status500(models::services::CompleteServiceJobByServiceJobIdResponse),
93 Status503(models::services::CompleteServiceJobByServiceJobIdResponse),
94 UnknownValue(serde_json::Value),
95}
96
97#[derive(Debug, Clone, Serialize, Deserialize)]
99#[serde(untagged)]
100pub enum CreateReservationError {
101 Status400(models::services::CreateReservationResponse),
102 Status403(models::services::CreateReservationResponse),
103 Status404(models::services::CreateReservationResponse),
104 Status413(models::services::CreateReservationResponse),
105 Status415(models::services::CreateReservationResponse),
106 Status429(models::services::CreateReservationResponse),
107 Status500(models::services::CreateReservationResponse),
108 Status503(models::services::CreateReservationResponse),
109 UnknownValue(serde_json::Value),
110}
111
112#[derive(Debug, Clone, Serialize, Deserialize)]
114#[serde(untagged)]
115pub enum CreateServiceDocumentUploadDestinationError {
116 Status400(models::services::CreateServiceDocumentUploadDestination),
117 Status403(models::services::CreateServiceDocumentUploadDestination),
118 Status404(models::services::CreateServiceDocumentUploadDestination),
119 Status413(models::services::CreateServiceDocumentUploadDestination),
120 Status415(models::services::CreateServiceDocumentUploadDestination),
121 Status422(models::services::CreateServiceDocumentUploadDestination),
122 Status429(models::services::CreateServiceDocumentUploadDestination),
123 Status500(models::services::CreateServiceDocumentUploadDestination),
124 Status503(models::services::CreateServiceDocumentUploadDestination),
125 UnknownValue(serde_json::Value),
126}
127
128#[derive(Debug, Clone, Serialize, Deserialize)]
130#[serde(untagged)]
131pub enum GetAppointmentSlotsError {
132 Status400(models::services::GetAppointmentSlotsResponse),
133 Status403(models::services::GetAppointmentSlotsResponse),
134 Status404(models::services::GetAppointmentSlotsResponse),
135 Status415(models::services::GetAppointmentSlotsResponse),
136 Status422(models::services::GetAppointmentSlotsResponse),
137 Status429(models::services::GetAppointmentSlotsResponse),
138 Status500(models::services::GetAppointmentSlotsResponse),
139 Status503(models::services::GetAppointmentSlotsResponse),
140 UnknownValue(serde_json::Value),
141}
142
143#[derive(Debug, Clone, Serialize, Deserialize)]
145#[serde(untagged)]
146pub enum GetAppointmmentSlotsByJobIdError {
147 Status400(models::services::GetAppointmentSlotsResponse),
148 Status403(models::services::GetAppointmentSlotsResponse),
149 Status404(models::services::GetAppointmentSlotsResponse),
150 Status415(models::services::GetAppointmentSlotsResponse),
151 Status422(models::services::GetAppointmentSlotsResponse),
152 Status429(models::services::GetAppointmentSlotsResponse),
153 Status500(models::services::GetAppointmentSlotsResponse),
154 Status503(models::services::GetAppointmentSlotsResponse),
155 UnknownValue(serde_json::Value),
156}
157
158#[derive(Debug, Clone, Serialize, Deserialize)]
160#[serde(untagged)]
161pub enum GetFixedSlotCapacityError {
162 Status400(models::services::FixedSlotCapacityErrors),
163 Status401(models::services::FixedSlotCapacityErrors),
164 Status403(models::services::FixedSlotCapacityErrors),
165 Status404(models::services::FixedSlotCapacityErrors),
166 Status413(models::services::FixedSlotCapacityErrors),
167 Status415(models::services::FixedSlotCapacityErrors),
168 Status429(models::services::FixedSlotCapacityErrors),
169 Status500(models::services::FixedSlotCapacityErrors),
170 Status503(models::services::FixedSlotCapacityErrors),
171 UnknownValue(serde_json::Value),
172}
173
174#[derive(Debug, Clone, Serialize, Deserialize)]
176#[serde(untagged)]
177pub enum GetRangeSlotCapacityError {
178 Status400(models::services::RangeSlotCapacityErrors),
179 Status401(models::services::RangeSlotCapacityErrors),
180 Status403(models::services::RangeSlotCapacityErrors),
181 Status404(models::services::RangeSlotCapacityErrors),
182 Status413(models::services::RangeSlotCapacityErrors),
183 Status415(models::services::RangeSlotCapacityErrors),
184 Status429(models::services::RangeSlotCapacityErrors),
185 Status500(models::services::RangeSlotCapacityErrors),
186 Status503(models::services::RangeSlotCapacityErrors),
187 UnknownValue(serde_json::Value),
188}
189
190#[derive(Debug, Clone, Serialize, Deserialize)]
192#[serde(untagged)]
193pub enum GetServiceJobByServiceJobIdError {
194 Status400(models::services::GetServiceJobByServiceJobIdResponse),
195 Status403(models::services::GetServiceJobByServiceJobIdResponse),
196 Status404(models::services::GetServiceJobByServiceJobIdResponse),
197 Status413(models::services::GetServiceJobByServiceJobIdResponse),
198 Status415(models::services::GetServiceJobByServiceJobIdResponse),
199 Status422(models::services::GetServiceJobByServiceJobIdResponse),
200 Status429(models::services::GetServiceJobByServiceJobIdResponse),
201 Status500(models::services::GetServiceJobByServiceJobIdResponse),
202 Status503(models::services::GetServiceJobByServiceJobIdResponse),
203 UnknownValue(serde_json::Value),
204}
205
206#[derive(Debug, Clone, Serialize, Deserialize)]
208#[serde(untagged)]
209pub enum GetServiceJobsError {
210 Status400(models::services::GetServiceJobsResponse),
211 Status403(models::services::GetServiceJobsResponse),
212 Status404(models::services::GetServiceJobsResponse),
213 Status413(models::services::GetServiceJobsResponse),
214 Status415(models::services::GetServiceJobsResponse),
215 Status429(models::services::GetServiceJobsResponse),
216 Status500(models::services::GetServiceJobsResponse),
217 Status503(models::services::GetServiceJobsResponse),
218 UnknownValue(serde_json::Value),
219}
220
221#[derive(Debug, Clone, Serialize, Deserialize)]
223#[serde(untagged)]
224pub enum RescheduleAppointmentForServiceJobByServiceJobIdError {
225 Status400(models::services::SetAppointmentResponse),
226 Status403(models::services::SetAppointmentResponse),
227 Status404(models::services::SetAppointmentResponse),
228 Status413(models::services::SetAppointmentResponse),
229 Status415(models::services::SetAppointmentResponse),
230 Status422(models::services::SetAppointmentResponse),
231 Status429(models::services::SetAppointmentResponse),
232 Status500(models::services::SetAppointmentResponse),
233 Status503(models::services::SetAppointmentResponse),
234 UnknownValue(serde_json::Value),
235}
236
237#[derive(Debug, Clone, Serialize, Deserialize)]
239#[serde(untagged)]
240pub enum SetAppointmentFulfillmentDataError {
241 Status400(Vec<models::services::Error>),
242 Status403(Vec<models::services::Error>),
243 Status404(Vec<models::services::Error>),
244 Status413(Vec<models::services::Error>),
245 Status415(Vec<models::services::Error>),
246 Status422(Vec<models::services::Error>),
247 Status429(Vec<models::services::Error>),
248 Status500(Vec<models::services::Error>),
249 Status503(Vec<models::services::Error>),
250 UnknownValue(serde_json::Value),
251}
252
253#[derive(Debug, Clone, Serialize, Deserialize)]
255#[serde(untagged)]
256pub enum UpdateReservationError {
257 Status400(models::services::UpdateReservationResponse),
258 Status403(models::services::UpdateReservationResponse),
259 Status404(models::services::UpdateReservationResponse),
260 Status413(models::services::UpdateReservationResponse),
261 Status415(models::services::UpdateReservationResponse),
262 Status429(models::services::UpdateReservationResponse),
263 Status500(models::services::UpdateReservationResponse),
264 Status503(models::services::UpdateReservationResponse),
265 UnknownValue(serde_json::Value),
266}
267
268#[derive(Debug, Clone, Serialize, Deserialize)]
270#[serde(untagged)]
271pub enum UpdateScheduleError {
272 Status400(models::services::UpdateScheduleResponse),
273 Status403(models::services::UpdateScheduleResponse),
274 Status404(models::services::UpdateScheduleResponse),
275 Status413(models::services::UpdateScheduleResponse),
276 Status415(models::services::UpdateScheduleResponse),
277 Status429(models::services::UpdateScheduleResponse),
278 Status500(models::services::UpdateScheduleResponse),
279 Status503(models::services::UpdateScheduleResponse),
280 UnknownValue(serde_json::Value),
281}
282
283
284pub async fn add_appointment_for_service_job_by_service_job_id(configuration: &configuration::Configuration, service_job_id: &str, body: models::services::AddAppointmentRequest) -> Result<models::services::SetAppointmentResponse, Error<AddAppointmentForServiceJobByServiceJobIdError>> {
286 let p_service_job_id = service_job_id;
288 let p_body = body;
289
290 let uri_str = format!("{}/service/v1/serviceJobs/{serviceJobId}/appointments", configuration.base_path, serviceJobId=crate::apis::urlencode(p_service_job_id));
291 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
292
293 if let Some(ref user_agent) = configuration.user_agent {
294 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
295 }
296 req_builder = req_builder.json(&p_body);
297
298 let req = req_builder.build()?;
299 let resp = configuration.client.execute(req).await?;
300
301 let status = resp.status();
302 let content_type = resp
303 .headers()
304 .get("content-type")
305 .and_then(|v| v.to_str().ok())
306 .unwrap_or("application/octet-stream");
307 let content_type = super::ContentType::from(content_type);
308
309 if !status.is_client_error() && !status.is_server_error() {
310 let content = resp.text().await?;
311 match content_type {
312 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
313 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::services::SetAppointmentResponse`"))),
314 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::services::SetAppointmentResponse`")))),
315 }
316 } else {
317 let content = resp.text().await?;
318 let entity: Option<AddAppointmentForServiceJobByServiceJobIdError> = serde_json::from_str(&content).ok();
319 Err(Error::ResponseError(ResponseContent { status, content, entity }))
320 }
321}
322
323pub async fn assign_appointment_resources(configuration: &configuration::Configuration, service_job_id: &str, appointment_id: &str, body: models::services::AssignAppointmentResourcesRequest) -> Result<models::services::AssignAppointmentResourcesResponse, Error<AssignAppointmentResourcesError>> {
325 let p_service_job_id = service_job_id;
327 let p_appointment_id = appointment_id;
328 let p_body = body;
329
330 let uri_str = format!("{}/service/v1/serviceJobs/{serviceJobId}/appointments/{appointmentId}/resources", configuration.base_path, serviceJobId=crate::apis::urlencode(p_service_job_id), appointmentId=crate::apis::urlencode(p_appointment_id));
331 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
332
333 if let Some(ref user_agent) = configuration.user_agent {
334 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
335 }
336 req_builder = req_builder.json(&p_body);
337
338 let req = req_builder.build()?;
339 let resp = configuration.client.execute(req).await?;
340
341 let status = resp.status();
342 let content_type = resp
343 .headers()
344 .get("content-type")
345 .and_then(|v| v.to_str().ok())
346 .unwrap_or("application/octet-stream");
347 let content_type = super::ContentType::from(content_type);
348
349 if !status.is_client_error() && !status.is_server_error() {
350 let content = resp.text().await?;
351 match content_type {
352 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
353 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::services::AssignAppointmentResourcesResponse`"))),
354 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::services::AssignAppointmentResourcesResponse`")))),
355 }
356 } else {
357 let content = resp.text().await?;
358 let entity: Option<AssignAppointmentResourcesError> = serde_json::from_str(&content).ok();
359 Err(Error::ResponseError(ResponseContent { status, content, entity }))
360 }
361}
362
363pub async fn cancel_reservation(configuration: &configuration::Configuration, reservation_id: &str, marketplace_ids: Vec<String>) -> Result<models::services::CancelReservationResponse, Error<CancelReservationError>> {
365 let p_reservation_id = reservation_id;
367 let p_marketplace_ids = marketplace_ids;
368
369 let uri_str = format!("{}/service/v1/reservation/{reservationId}", configuration.base_path, reservationId=crate::apis::urlencode(p_reservation_id));
370 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
371
372 req_builder = match "csv" {
373 "multi" => req_builder.query(&p_marketplace_ids.into_iter().map(|p| ("marketplaceIds".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
374 _ => req_builder.query(&[("marketplaceIds", &p_marketplace_ids.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
375 };
376 if let Some(ref user_agent) = configuration.user_agent {
377 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
378 }
379
380 let req = req_builder.build()?;
381 let resp = configuration.client.execute(req).await?;
382
383 let status = resp.status();
384 let content_type = resp
385 .headers()
386 .get("content-type")
387 .and_then(|v| v.to_str().ok())
388 .unwrap_or("application/octet-stream");
389 let content_type = super::ContentType::from(content_type);
390
391 if !status.is_client_error() && !status.is_server_error() {
392 let content = resp.text().await?;
393 match content_type {
394 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
395 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::services::CancelReservationResponse`"))),
396 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::services::CancelReservationResponse`")))),
397 }
398 } else {
399 let content = resp.text().await?;
400 let entity: Option<CancelReservationError> = serde_json::from_str(&content).ok();
401 Err(Error::ResponseError(ResponseContent { status, content, entity }))
402 }
403}
404
405pub async fn cancel_service_job_by_service_job_id(configuration: &configuration::Configuration, service_job_id: &str, cancellation_reason_code: &str) -> Result<models::services::CancelServiceJobByServiceJobIdResponse, Error<CancelServiceJobByServiceJobIdError>> {
407 let p_service_job_id = service_job_id;
409 let p_cancellation_reason_code = cancellation_reason_code;
410
411 let uri_str = format!("{}/service/v1/serviceJobs/{serviceJobId}/cancellations", configuration.base_path, serviceJobId=crate::apis::urlencode(p_service_job_id));
412 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
413
414 req_builder = req_builder.query(&[("cancellationReasonCode", &p_cancellation_reason_code.to_string())]);
415 if let Some(ref user_agent) = configuration.user_agent {
416 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
417 }
418
419 let req = req_builder.build()?;
420 let resp = configuration.client.execute(req).await?;
421
422 let status = resp.status();
423 let content_type = resp
424 .headers()
425 .get("content-type")
426 .and_then(|v| v.to_str().ok())
427 .unwrap_or("application/octet-stream");
428 let content_type = super::ContentType::from(content_type);
429
430 if !status.is_client_error() && !status.is_server_error() {
431 let content = resp.text().await?;
432 match content_type {
433 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
434 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::services::CancelServiceJobByServiceJobIdResponse`"))),
435 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::services::CancelServiceJobByServiceJobIdResponse`")))),
436 }
437 } else {
438 let content = resp.text().await?;
439 let entity: Option<CancelServiceJobByServiceJobIdError> = serde_json::from_str(&content).ok();
440 Err(Error::ResponseError(ResponseContent { status, content, entity }))
441 }
442}
443
444pub async fn complete_service_job_by_service_job_id(configuration: &configuration::Configuration, service_job_id: &str) -> Result<models::services::CompleteServiceJobByServiceJobIdResponse, Error<CompleteServiceJobByServiceJobIdError>> {
446 let p_service_job_id = service_job_id;
448
449 let uri_str = format!("{}/service/v1/serviceJobs/{serviceJobId}/completions", configuration.base_path, serviceJobId=crate::apis::urlencode(p_service_job_id));
450 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
451
452 if let Some(ref user_agent) = configuration.user_agent {
453 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
454 }
455
456 let req = req_builder.build()?;
457 let resp = configuration.client.execute(req).await?;
458
459 let status = resp.status();
460 let content_type = resp
461 .headers()
462 .get("content-type")
463 .and_then(|v| v.to_str().ok())
464 .unwrap_or("application/octet-stream");
465 let content_type = super::ContentType::from(content_type);
466
467 if !status.is_client_error() && !status.is_server_error() {
468 let content = resp.text().await?;
469 match content_type {
470 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
471 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::services::CompleteServiceJobByServiceJobIdResponse`"))),
472 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::services::CompleteServiceJobByServiceJobIdResponse`")))),
473 }
474 } else {
475 let content = resp.text().await?;
476 let entity: Option<CompleteServiceJobByServiceJobIdError> = serde_json::from_str(&content).ok();
477 Err(Error::ResponseError(ResponseContent { status, content, entity }))
478 }
479}
480
481pub async fn create_reservation(configuration: &configuration::Configuration, marketplace_ids: Vec<String>, body: models::services::CreateReservationRequest) -> Result<models::services::CreateReservationResponse, Error<CreateReservationError>> {
483 let p_marketplace_ids = marketplace_ids;
485 let p_body = body;
486
487 let uri_str = format!("{}/service/v1/reservation", configuration.base_path);
488 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
489
490 req_builder = match "csv" {
491 "multi" => req_builder.query(&p_marketplace_ids.into_iter().map(|p| ("marketplaceIds".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
492 _ => req_builder.query(&[("marketplaceIds", &p_marketplace_ids.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
493 };
494 if let Some(ref user_agent) = configuration.user_agent {
495 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
496 }
497 req_builder = req_builder.json(&p_body);
498
499 let req = req_builder.build()?;
500 let resp = configuration.client.execute(req).await?;
501
502 let status = resp.status();
503 let content_type = resp
504 .headers()
505 .get("content-type")
506 .and_then(|v| v.to_str().ok())
507 .unwrap_or("application/octet-stream");
508 let content_type = super::ContentType::from(content_type);
509
510 if !status.is_client_error() && !status.is_server_error() {
511 let content = resp.text().await?;
512 match content_type {
513 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
514 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::services::CreateReservationResponse`"))),
515 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::services::CreateReservationResponse`")))),
516 }
517 } else {
518 let content = resp.text().await?;
519 let entity: Option<CreateReservationError> = serde_json::from_str(&content).ok();
520 Err(Error::ResponseError(ResponseContent { status, content, entity }))
521 }
522}
523
524pub async fn create_service_document_upload_destination(configuration: &configuration::Configuration, body: models::services::ServiceUploadDocument) -> Result<models::services::CreateServiceDocumentUploadDestination, Error<CreateServiceDocumentUploadDestinationError>> {
526 let p_body = body;
528
529 let uri_str = format!("{}/service/v1/documents", configuration.base_path);
530 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
531
532 if let Some(ref user_agent) = configuration.user_agent {
533 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
534 }
535 req_builder = req_builder.json(&p_body);
536
537 let req = req_builder.build()?;
538 let resp = configuration.client.execute(req).await?;
539
540 let status = resp.status();
541 let content_type = resp
542 .headers()
543 .get("content-type")
544 .and_then(|v| v.to_str().ok())
545 .unwrap_or("application/octet-stream");
546 let content_type = super::ContentType::from(content_type);
547
548 if !status.is_client_error() && !status.is_server_error() {
549 let content = resp.text().await?;
550 match content_type {
551 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
552 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::services::CreateServiceDocumentUploadDestination`"))),
553 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::services::CreateServiceDocumentUploadDestination`")))),
554 }
555 } else {
556 let content = resp.text().await?;
557 let entity: Option<CreateServiceDocumentUploadDestinationError> = serde_json::from_str(&content).ok();
558 Err(Error::ResponseError(ResponseContent { status, content, entity }))
559 }
560}
561
562pub async fn get_appointment_slots(configuration: &configuration::Configuration, asin: &str, store_id: &str, marketplace_ids: Vec<String>, start_time: Option<&str>, end_time: Option<&str>) -> Result<models::services::GetAppointmentSlotsResponse, Error<GetAppointmentSlotsError>> {
564 let p_asin = asin;
566 let p_store_id = store_id;
567 let p_marketplace_ids = marketplace_ids;
568 let p_start_time = start_time;
569 let p_end_time = end_time;
570
571 let uri_str = format!("{}/service/v1/appointmentSlots", configuration.base_path);
572 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
573
574 req_builder = req_builder.query(&[("asin", &p_asin.to_string())]);
575 req_builder = req_builder.query(&[("storeId", &p_store_id.to_string())]);
576 req_builder = match "csv" {
577 "multi" => req_builder.query(&p_marketplace_ids.into_iter().map(|p| ("marketplaceIds".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
578 _ => req_builder.query(&[("marketplaceIds", &p_marketplace_ids.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
579 };
580 if let Some(ref param_value) = p_start_time {
581 req_builder = req_builder.query(&[("startTime", ¶m_value.to_string())]);
582 }
583 if let Some(ref param_value) = p_end_time {
584 req_builder = req_builder.query(&[("endTime", ¶m_value.to_string())]);
585 }
586 if let Some(ref user_agent) = configuration.user_agent {
587 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
588 }
589
590 let req = req_builder.build()?;
591 let resp = configuration.client.execute(req).await?;
592
593 let status = resp.status();
594 let content_type = resp
595 .headers()
596 .get("content-type")
597 .and_then(|v| v.to_str().ok())
598 .unwrap_or("application/octet-stream");
599 let content_type = super::ContentType::from(content_type);
600
601 if !status.is_client_error() && !status.is_server_error() {
602 let content = resp.text().await?;
603 match content_type {
604 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
605 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::services::GetAppointmentSlotsResponse`"))),
606 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::services::GetAppointmentSlotsResponse`")))),
607 }
608 } else {
609 let content = resp.text().await?;
610 let entity: Option<GetAppointmentSlotsError> = serde_json::from_str(&content).ok();
611 Err(Error::ResponseError(ResponseContent { status, content, entity }))
612 }
613}
614
615pub async fn get_appointmment_slots_by_job_id(configuration: &configuration::Configuration, service_job_id: &str, marketplace_ids: Vec<String>, start_time: Option<&str>, end_time: Option<&str>) -> Result<models::services::GetAppointmentSlotsResponse, Error<GetAppointmmentSlotsByJobIdError>> {
617 let p_service_job_id = service_job_id;
619 let p_marketplace_ids = marketplace_ids;
620 let p_start_time = start_time;
621 let p_end_time = end_time;
622
623 let uri_str = format!("{}/service/v1/serviceJobs/{serviceJobId}/appointmentSlots", configuration.base_path, serviceJobId=crate::apis::urlencode(p_service_job_id));
624 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
625
626 req_builder = match "csv" {
627 "multi" => req_builder.query(&p_marketplace_ids.into_iter().map(|p| ("marketplaceIds".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
628 _ => req_builder.query(&[("marketplaceIds", &p_marketplace_ids.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
629 };
630 if let Some(ref param_value) = p_start_time {
631 req_builder = req_builder.query(&[("startTime", ¶m_value.to_string())]);
632 }
633 if let Some(ref param_value) = p_end_time {
634 req_builder = req_builder.query(&[("endTime", ¶m_value.to_string())]);
635 }
636 if let Some(ref user_agent) = configuration.user_agent {
637 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
638 }
639
640 let req = req_builder.build()?;
641 let resp = configuration.client.execute(req).await?;
642
643 let status = resp.status();
644 let content_type = resp
645 .headers()
646 .get("content-type")
647 .and_then(|v| v.to_str().ok())
648 .unwrap_or("application/octet-stream");
649 let content_type = super::ContentType::from(content_type);
650
651 if !status.is_client_error() && !status.is_server_error() {
652 let content = resp.text().await?;
653 match content_type {
654 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
655 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::services::GetAppointmentSlotsResponse`"))),
656 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::services::GetAppointmentSlotsResponse`")))),
657 }
658 } else {
659 let content = resp.text().await?;
660 let entity: Option<GetAppointmmentSlotsByJobIdError> = serde_json::from_str(&content).ok();
661 Err(Error::ResponseError(ResponseContent { status, content, entity }))
662 }
663}
664
665pub async fn get_fixed_slot_capacity(configuration: &configuration::Configuration, resource_id: &str, marketplace_ids: Vec<String>, body: models::services::FixedSlotCapacityQuery, next_page_token: Option<&str>) -> Result<models::services::FixedSlotCapacity, Error<GetFixedSlotCapacityError>> {
667 let p_resource_id = resource_id;
669 let p_marketplace_ids = marketplace_ids;
670 let p_body = body;
671 let p_next_page_token = next_page_token;
672
673 let uri_str = format!("{}/service/v1/serviceResources/{resourceId}/capacity/fixed", configuration.base_path, resourceId=crate::apis::urlencode(p_resource_id));
674 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
675
676 req_builder = match "csv" {
677 "multi" => req_builder.query(&p_marketplace_ids.into_iter().map(|p| ("marketplaceIds".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
678 _ => req_builder.query(&[("marketplaceIds", &p_marketplace_ids.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
679 };
680 if let Some(ref param_value) = p_next_page_token {
681 req_builder = req_builder.query(&[("nextPageToken", ¶m_value.to_string())]);
682 }
683 if let Some(ref user_agent) = configuration.user_agent {
684 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
685 }
686 req_builder = req_builder.json(&p_body);
687
688 let req = req_builder.build()?;
689 let resp = configuration.client.execute(req).await?;
690
691 let status = resp.status();
692 let content_type = resp
693 .headers()
694 .get("content-type")
695 .and_then(|v| v.to_str().ok())
696 .unwrap_or("application/octet-stream");
697 let content_type = super::ContentType::from(content_type);
698
699 if !status.is_client_error() && !status.is_server_error() {
700 let content = resp.text().await?;
701 match content_type {
702 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
703 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::services::FixedSlotCapacity`"))),
704 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::services::FixedSlotCapacity`")))),
705 }
706 } else {
707 let content = resp.text().await?;
708 let entity: Option<GetFixedSlotCapacityError> = serde_json::from_str(&content).ok();
709 Err(Error::ResponseError(ResponseContent { status, content, entity }))
710 }
711}
712
713pub async fn get_range_slot_capacity(configuration: &configuration::Configuration, resource_id: &str, marketplace_ids: Vec<String>, body: models::services::RangeSlotCapacityQuery, next_page_token: Option<&str>) -> Result<models::services::RangeSlotCapacity, Error<GetRangeSlotCapacityError>> {
715 let p_resource_id = resource_id;
717 let p_marketplace_ids = marketplace_ids;
718 let p_body = body;
719 let p_next_page_token = next_page_token;
720
721 let uri_str = format!("{}/service/v1/serviceResources/{resourceId}/capacity/range", configuration.base_path, resourceId=crate::apis::urlencode(p_resource_id));
722 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
723
724 req_builder = match "csv" {
725 "multi" => req_builder.query(&p_marketplace_ids.into_iter().map(|p| ("marketplaceIds".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
726 _ => req_builder.query(&[("marketplaceIds", &p_marketplace_ids.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
727 };
728 if let Some(ref param_value) = p_next_page_token {
729 req_builder = req_builder.query(&[("nextPageToken", ¶m_value.to_string())]);
730 }
731 if let Some(ref user_agent) = configuration.user_agent {
732 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
733 }
734 req_builder = req_builder.json(&p_body);
735
736 let req = req_builder.build()?;
737 let resp = configuration.client.execute(req).await?;
738
739 let status = resp.status();
740 let content_type = resp
741 .headers()
742 .get("content-type")
743 .and_then(|v| v.to_str().ok())
744 .unwrap_or("application/octet-stream");
745 let content_type = super::ContentType::from(content_type);
746
747 if !status.is_client_error() && !status.is_server_error() {
748 let content = resp.text().await?;
749 match content_type {
750 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
751 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::services::RangeSlotCapacity`"))),
752 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::services::RangeSlotCapacity`")))),
753 }
754 } else {
755 let content = resp.text().await?;
756 let entity: Option<GetRangeSlotCapacityError> = serde_json::from_str(&content).ok();
757 Err(Error::ResponseError(ResponseContent { status, content, entity }))
758 }
759}
760
761pub async fn get_service_job_by_service_job_id(configuration: &configuration::Configuration, service_job_id: &str) -> Result<models::services::GetServiceJobByServiceJobIdResponse, Error<GetServiceJobByServiceJobIdError>> {
763 let p_service_job_id = service_job_id;
765
766 let uri_str = format!("{}/service/v1/serviceJobs/{serviceJobId}", configuration.base_path, serviceJobId=crate::apis::urlencode(p_service_job_id));
767 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
768
769 if let Some(ref user_agent) = configuration.user_agent {
770 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
771 }
772
773 let req = req_builder.build()?;
774 let resp = configuration.client.execute(req).await?;
775
776 let status = resp.status();
777 let content_type = resp
778 .headers()
779 .get("content-type")
780 .and_then(|v| v.to_str().ok())
781 .unwrap_or("application/octet-stream");
782 let content_type = super::ContentType::from(content_type);
783
784 if !status.is_client_error() && !status.is_server_error() {
785 let content = resp.text().await?;
786 match content_type {
787 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
788 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::services::GetServiceJobByServiceJobIdResponse`"))),
789 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::services::GetServiceJobByServiceJobIdResponse`")))),
790 }
791 } else {
792 let content = resp.text().await?;
793 let entity: Option<GetServiceJobByServiceJobIdError> = serde_json::from_str(&content).ok();
794 Err(Error::ResponseError(ResponseContent { status, content, entity }))
795 }
796}
797
798pub async fn get_service_jobs(configuration: &configuration::Configuration, marketplace_ids: Vec<String>, service_order_ids: Option<Vec<String>>, service_job_status: Option<Vec<String>>, page_token: Option<&str>, page_size: Option<i32>, sort_field: Option<&str>, sort_order: Option<&str>, created_after: Option<&str>, created_before: Option<&str>, last_updated_after: Option<&str>, last_updated_before: Option<&str>, schedule_start_date: Option<&str>, schedule_end_date: Option<&str>, asins: Option<Vec<String>>, required_skills: Option<Vec<String>>, store_ids: Option<Vec<String>>) -> Result<models::services::GetServiceJobsResponse, Error<GetServiceJobsError>> {
800 let p_marketplace_ids = marketplace_ids;
802 let p_service_order_ids = service_order_ids;
803 let p_service_job_status = service_job_status;
804 let p_page_token = page_token;
805 let p_page_size = page_size;
806 let p_sort_field = sort_field;
807 let p_sort_order = sort_order;
808 let p_created_after = created_after;
809 let p_created_before = created_before;
810 let p_last_updated_after = last_updated_after;
811 let p_last_updated_before = last_updated_before;
812 let p_schedule_start_date = schedule_start_date;
813 let p_schedule_end_date = schedule_end_date;
814 let p_asins = asins;
815 let p_required_skills = required_skills;
816 let p_store_ids = store_ids;
817
818 let uri_str = format!("{}/service/v1/serviceJobs", configuration.base_path);
819 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
820
821 if let Some(ref param_value) = p_service_order_ids {
822 req_builder = match "csv" {
823 "multi" => req_builder.query(¶m_value.into_iter().map(|p| ("serviceOrderIds".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
824 _ => req_builder.query(&[("serviceOrderIds", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
825 };
826 }
827 if let Some(ref param_value) = p_service_job_status {
828 req_builder = match "csv" {
829 "multi" => req_builder.query(¶m_value.into_iter().map(|p| ("serviceJobStatus".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
830 _ => req_builder.query(&[("serviceJobStatus", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
831 };
832 }
833 if let Some(ref param_value) = p_page_token {
834 req_builder = req_builder.query(&[("pageToken", ¶m_value.to_string())]);
835 }
836 if let Some(ref param_value) = p_page_size {
837 req_builder = req_builder.query(&[("pageSize", ¶m_value.to_string())]);
838 }
839 if let Some(ref param_value) = p_sort_field {
840 req_builder = req_builder.query(&[("sortField", ¶m_value.to_string())]);
841 }
842 if let Some(ref param_value) = p_sort_order {
843 req_builder = req_builder.query(&[("sortOrder", ¶m_value.to_string())]);
844 }
845 if let Some(ref param_value) = p_created_after {
846 req_builder = req_builder.query(&[("createdAfter", ¶m_value.to_string())]);
847 }
848 if let Some(ref param_value) = p_created_before {
849 req_builder = req_builder.query(&[("createdBefore", ¶m_value.to_string())]);
850 }
851 if let Some(ref param_value) = p_last_updated_after {
852 req_builder = req_builder.query(&[("lastUpdatedAfter", ¶m_value.to_string())]);
853 }
854 if let Some(ref param_value) = p_last_updated_before {
855 req_builder = req_builder.query(&[("lastUpdatedBefore", ¶m_value.to_string())]);
856 }
857 if let Some(ref param_value) = p_schedule_start_date {
858 req_builder = req_builder.query(&[("scheduleStartDate", ¶m_value.to_string())]);
859 }
860 if let Some(ref param_value) = p_schedule_end_date {
861 req_builder = req_builder.query(&[("scheduleEndDate", ¶m_value.to_string())]);
862 }
863 req_builder = match "csv" {
864 "multi" => req_builder.query(&p_marketplace_ids.into_iter().map(|p| ("marketplaceIds".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
865 _ => req_builder.query(&[("marketplaceIds", &p_marketplace_ids.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
866 };
867 if let Some(ref param_value) = p_asins {
868 req_builder = match "csv" {
869 "multi" => req_builder.query(¶m_value.into_iter().map(|p| ("asins".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
870 _ => req_builder.query(&[("asins", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
871 };
872 }
873 if let Some(ref param_value) = p_required_skills {
874 req_builder = match "csv" {
875 "multi" => req_builder.query(¶m_value.into_iter().map(|p| ("requiredSkills".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
876 _ => req_builder.query(&[("requiredSkills", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
877 };
878 }
879 if let Some(ref param_value) = p_store_ids {
880 req_builder = match "csv" {
881 "multi" => req_builder.query(¶m_value.into_iter().map(|p| ("storeIds".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
882 _ => req_builder.query(&[("storeIds", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
883 };
884 }
885 if let Some(ref user_agent) = configuration.user_agent {
886 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
887 }
888
889 let req = req_builder.build()?;
890 let resp = configuration.client.execute(req).await?;
891
892 let status = resp.status();
893 let content_type = resp
894 .headers()
895 .get("content-type")
896 .and_then(|v| v.to_str().ok())
897 .unwrap_or("application/octet-stream");
898 let content_type = super::ContentType::from(content_type);
899
900 if !status.is_client_error() && !status.is_server_error() {
901 let content = resp.text().await?;
902 match content_type {
903 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
904 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::services::GetServiceJobsResponse`"))),
905 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::services::GetServiceJobsResponse`")))),
906 }
907 } else {
908 let content = resp.text().await?;
909 let entity: Option<GetServiceJobsError> = serde_json::from_str(&content).ok();
910 Err(Error::ResponseError(ResponseContent { status, content, entity }))
911 }
912}
913
914pub async fn reschedule_appointment_for_service_job_by_service_job_id(configuration: &configuration::Configuration, service_job_id: &str, appointment_id: &str, body: models::services::RescheduleAppointmentRequest) -> Result<models::services::SetAppointmentResponse, Error<RescheduleAppointmentForServiceJobByServiceJobIdError>> {
916 let p_service_job_id = service_job_id;
918 let p_appointment_id = appointment_id;
919 let p_body = body;
920
921 let uri_str = format!("{}/service/v1/serviceJobs/{serviceJobId}/appointments/{appointmentId}", configuration.base_path, serviceJobId=crate::apis::urlencode(p_service_job_id), appointmentId=crate::apis::urlencode(p_appointment_id));
922 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
923
924 if let Some(ref user_agent) = configuration.user_agent {
925 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
926 }
927 req_builder = req_builder.json(&p_body);
928
929 let req = req_builder.build()?;
930 let resp = configuration.client.execute(req).await?;
931
932 let status = resp.status();
933 let content_type = resp
934 .headers()
935 .get("content-type")
936 .and_then(|v| v.to_str().ok())
937 .unwrap_or("application/octet-stream");
938 let content_type = super::ContentType::from(content_type);
939
940 if !status.is_client_error() && !status.is_server_error() {
941 let content = resp.text().await?;
942 match content_type {
943 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
944 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::services::SetAppointmentResponse`"))),
945 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::services::SetAppointmentResponse`")))),
946 }
947 } else {
948 let content = resp.text().await?;
949 let entity: Option<RescheduleAppointmentForServiceJobByServiceJobIdError> = serde_json::from_str(&content).ok();
950 Err(Error::ResponseError(ResponseContent { status, content, entity }))
951 }
952}
953
954pub async fn set_appointment_fulfillment_data(configuration: &configuration::Configuration, service_job_id: &str, appointment_id: &str, body: models::services::SetAppointmentFulfillmentDataRequest) -> Result<String, Error<SetAppointmentFulfillmentDataError>> {
956 let p_service_job_id = service_job_id;
958 let p_appointment_id = appointment_id;
959 let p_body = body;
960
961 let uri_str = format!("{}/service/v1/serviceJobs/{serviceJobId}/appointments/{appointmentId}/fulfillment", configuration.base_path, serviceJobId=crate::apis::urlencode(p_service_job_id), appointmentId=crate::apis::urlencode(p_appointment_id));
962 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
963
964 if let Some(ref user_agent) = configuration.user_agent {
965 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
966 }
967 req_builder = req_builder.json(&p_body);
968
969 let req = req_builder.build()?;
970 let resp = configuration.client.execute(req).await?;
971
972 let status = resp.status();
973 let content_type = resp
974 .headers()
975 .get("content-type")
976 .and_then(|v| v.to_str().ok())
977 .unwrap_or("application/octet-stream");
978 let content_type = super::ContentType::from(content_type);
979
980 if !status.is_client_error() && !status.is_server_error() {
981 let content = resp.text().await?;
982 match content_type {
983 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
984 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `String`"))),
985 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `String`")))),
986 }
987 } else {
988 let content = resp.text().await?;
989 let entity: Option<SetAppointmentFulfillmentDataError> = serde_json::from_str(&content).ok();
990 Err(Error::ResponseError(ResponseContent { status, content, entity }))
991 }
992}
993
994pub async fn update_reservation(configuration: &configuration::Configuration, reservation_id: &str, marketplace_ids: Vec<String>, body: models::services::UpdateReservationRequest) -> Result<models::services::UpdateReservationResponse, Error<UpdateReservationError>> {
996 let p_reservation_id = reservation_id;
998 let p_marketplace_ids = marketplace_ids;
999 let p_body = body;
1000
1001 let uri_str = format!("{}/service/v1/reservation/{reservationId}", configuration.base_path, reservationId=crate::apis::urlencode(p_reservation_id));
1002 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
1003
1004 req_builder = match "csv" {
1005 "multi" => req_builder.query(&p_marketplace_ids.into_iter().map(|p| ("marketplaceIds".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
1006 _ => req_builder.query(&[("marketplaceIds", &p_marketplace_ids.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
1007 };
1008 if let Some(ref user_agent) = configuration.user_agent {
1009 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1010 }
1011 req_builder = req_builder.json(&p_body);
1012
1013 let req = req_builder.build()?;
1014 let resp = configuration.client.execute(req).await?;
1015
1016 let status = resp.status();
1017 let content_type = resp
1018 .headers()
1019 .get("content-type")
1020 .and_then(|v| v.to_str().ok())
1021 .unwrap_or("application/octet-stream");
1022 let content_type = super::ContentType::from(content_type);
1023
1024 if !status.is_client_error() && !status.is_server_error() {
1025 let content = resp.text().await?;
1026 match content_type {
1027 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1028 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::services::UpdateReservationResponse`"))),
1029 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::services::UpdateReservationResponse`")))),
1030 }
1031 } else {
1032 let content = resp.text().await?;
1033 let entity: Option<UpdateReservationError> = serde_json::from_str(&content).ok();
1034 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1035 }
1036}
1037
1038pub async fn update_schedule(configuration: &configuration::Configuration, resource_id: &str, marketplace_ids: Vec<String>, body: models::services::UpdateScheduleRequest) -> Result<models::services::UpdateScheduleResponse, Error<UpdateScheduleError>> {
1040 let p_resource_id = resource_id;
1042 let p_marketplace_ids = marketplace_ids;
1043 let p_body = body;
1044
1045 let uri_str = format!("{}/service/v1/serviceResources/{resourceId}/schedules", configuration.base_path, resourceId=crate::apis::urlencode(p_resource_id));
1046 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
1047
1048 req_builder = match "csv" {
1049 "multi" => req_builder.query(&p_marketplace_ids.into_iter().map(|p| ("marketplaceIds".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
1050 _ => req_builder.query(&[("marketplaceIds", &p_marketplace_ids.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
1051 };
1052 if let Some(ref user_agent) = configuration.user_agent {
1053 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1054 }
1055 req_builder = req_builder.json(&p_body);
1056
1057 let req = req_builder.build()?;
1058 let resp = configuration.client.execute(req).await?;
1059
1060 let status = resp.status();
1061 let content_type = resp
1062 .headers()
1063 .get("content-type")
1064 .and_then(|v| v.to_str().ok())
1065 .unwrap_or("application/octet-stream");
1066 let content_type = super::ContentType::from(content_type);
1067
1068 if !status.is_client_error() && !status.is_server_error() {
1069 let content = resp.text().await?;
1070 match content_type {
1071 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1072 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::services::UpdateScheduleResponse`"))),
1073 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::services::UpdateScheduleResponse`")))),
1074 }
1075 } else {
1076 let content = resp.text().await?;
1077 let entity: Option<UpdateScheduleError> = serde_json::from_str(&content).ok();
1078 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1079 }
1080}
1081