1use reqwest;
12use serde::{de::Error as _, Deserialize, Serialize};
13
14use super::{configuration, ContentType, Error};
15use crate::{apis::ResponseContent, models};
16
17#[derive(Debug, Clone, Serialize, Deserialize)]
19#[serde(untagged)]
20pub enum DevicesGetError {
21 UnknownValue(serde_json::Value),
22}
23
24#[derive(Debug, Clone, Serialize, Deserialize)]
26#[serde(untagged)]
27pub enum DevicesIdDeactivatePostError {
28 UnknownValue(serde_json::Value),
29}
30
31#[derive(Debug, Clone, Serialize, Deserialize)]
33#[serde(untagged)]
34pub enum DevicesIdDeleteError {
35 UnknownValue(serde_json::Value),
36}
37
38#[derive(Debug, Clone, Serialize, Deserialize)]
40#[serde(untagged)]
41pub enum DevicesIdGetError {
42 UnknownValue(serde_json::Value),
43}
44
45#[derive(Debug, Clone, Serialize, Deserialize)]
47#[serde(untagged)]
48pub enum DevicesIdPostError {
49 UnknownValue(serde_json::Value),
50}
51
52#[derive(Debug, Clone, Serialize, Deserialize)]
54#[serde(untagged)]
55pub enum DevicesIdPutError {
56 UnknownValue(serde_json::Value),
57}
58
59#[derive(Debug, Clone, Serialize, Deserialize)]
61#[serde(untagged)]
62pub enum DevicesIdentifierIdentifierClearTokenPostError {
63 UnknownValue(serde_json::Value),
64}
65
66#[derive(Debug, Clone, Serialize, Deserialize)]
68#[serde(untagged)]
69pub enum DevicesIdentifierIdentifierClearTokenPutError {
70 UnknownValue(serde_json::Value),
71}
72
73#[derive(Debug, Clone, Serialize, Deserialize)]
75#[serde(untagged)]
76pub enum DevicesIdentifierIdentifierGetError {
77 UnknownValue(serde_json::Value),
78}
79
80#[derive(Debug, Clone, Serialize, Deserialize)]
82#[serde(untagged)]
83pub enum DevicesIdentifierIdentifierTokenPostError {
84 UnknownValue(serde_json::Value),
85}
86
87#[derive(Debug, Clone, Serialize, Deserialize)]
89#[serde(untagged)]
90pub enum DevicesIdentifierIdentifierTokenPutError {
91 UnknownValue(serde_json::Value),
92}
93
94#[derive(Debug, Clone, Serialize, Deserialize)]
96#[serde(untagged)]
97pub enum DevicesIdentifierIdentifierWebPushAuthPostError {
98 UnknownValue(serde_json::Value),
99}
100
101#[derive(Debug, Clone, Serialize, Deserialize)]
103#[serde(untagged)]
104pub enum DevicesIdentifierIdentifierWebPushAuthPutError {
105 UnknownValue(serde_json::Value),
106}
107
108#[derive(Debug, Clone, Serialize, Deserialize)]
110#[serde(untagged)]
111pub enum DevicesIdentifierKeysPostError {
112 UnknownValue(serde_json::Value),
113}
114
115#[derive(Debug, Clone, Serialize, Deserialize)]
117#[serde(untagged)]
118pub enum DevicesIdentifierKeysPutError {
119 UnknownValue(serde_json::Value),
120}
121
122#[derive(Debug, Clone, Serialize, Deserialize)]
124#[serde(untagged)]
125pub enum DevicesIdentifierRetrieveKeysPostError {
126 UnknownValue(serde_json::Value),
127}
128
129#[derive(Debug, Clone, Serialize, Deserialize)]
131#[serde(untagged)]
132pub enum DevicesKnowndeviceEmailIdentifierGetError {
133 UnknownValue(serde_json::Value),
134}
135
136#[derive(Debug, Clone, Serialize, Deserialize)]
138#[serde(untagged)]
139pub enum DevicesKnowndeviceGetError {
140 UnknownValue(serde_json::Value),
141}
142
143#[derive(Debug, Clone, Serialize, Deserialize)]
145#[serde(untagged)]
146pub enum DevicesLostTrustPostError {
147 UnknownValue(serde_json::Value),
148}
149
150#[derive(Debug, Clone, Serialize, Deserialize)]
152#[serde(untagged)]
153pub enum DevicesPostError {
154 UnknownValue(serde_json::Value),
155}
156
157#[derive(Debug, Clone, Serialize, Deserialize)]
159#[serde(untagged)]
160pub enum DevicesUpdateTrustPostError {
161 UnknownValue(serde_json::Value),
162}
163
164pub async fn devices_get(
165 configuration: &configuration::Configuration,
166) -> Result<models::DeviceAuthRequestResponseModelListResponseModel, Error<DevicesGetError>> {
167 let uri_str = format!("{}/devices", configuration.base_path);
168 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
169
170 if let Some(ref user_agent) = configuration.user_agent {
171 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
172 }
173 if let Some(ref token) = configuration.oauth_access_token {
174 req_builder = req_builder.bearer_auth(token.to_owned());
175 };
176
177 let req = req_builder.build()?;
178 let resp = configuration.client.execute(req).await?;
179
180 let status = resp.status();
181 let content_type = resp
182 .headers()
183 .get("content-type")
184 .and_then(|v| v.to_str().ok())
185 .unwrap_or("application/octet-stream");
186 let content_type = super::ContentType::from(content_type);
187
188 if !status.is_client_error() && !status.is_server_error() {
189 let content = resp.text().await?;
190 match content_type {
191 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
192 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DeviceAuthRequestResponseModelListResponseModel`"))),
193 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::DeviceAuthRequestResponseModelListResponseModel`")))),
194 }
195 } else {
196 let content = resp.text().await?;
197 let entity: Option<DevicesGetError> = serde_json::from_str(&content).ok();
198 Err(Error::ResponseError(ResponseContent {
199 status,
200 content,
201 entity,
202 }))
203 }
204}
205
206pub async fn devices_id_deactivate_post(
207 configuration: &configuration::Configuration,
208 id: &str,
209) -> Result<(), Error<DevicesIdDeactivatePostError>> {
210 let p_id = id;
212
213 let uri_str = format!(
214 "{}/devices/{id}/deactivate",
215 configuration.base_path,
216 id = crate::apis::urlencode(p_id)
217 );
218 let mut req_builder = configuration
219 .client
220 .request(reqwest::Method::POST, &uri_str);
221
222 if let Some(ref user_agent) = configuration.user_agent {
223 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
224 }
225 if let Some(ref token) = configuration.oauth_access_token {
226 req_builder = req_builder.bearer_auth(token.to_owned());
227 };
228
229 let req = req_builder.build()?;
230 let resp = configuration.client.execute(req).await?;
231
232 let status = resp.status();
233
234 if !status.is_client_error() && !status.is_server_error() {
235 Ok(())
236 } else {
237 let content = resp.text().await?;
238 let entity: Option<DevicesIdDeactivatePostError> = serde_json::from_str(&content).ok();
239 Err(Error::ResponseError(ResponseContent {
240 status,
241 content,
242 entity,
243 }))
244 }
245}
246
247pub async fn devices_id_delete(
248 configuration: &configuration::Configuration,
249 id: &str,
250) -> Result<(), Error<DevicesIdDeleteError>> {
251 let p_id = id;
253
254 let uri_str = format!(
255 "{}/devices/{id}",
256 configuration.base_path,
257 id = crate::apis::urlencode(p_id)
258 );
259 let mut req_builder = configuration
260 .client
261 .request(reqwest::Method::DELETE, &uri_str);
262
263 if let Some(ref user_agent) = configuration.user_agent {
264 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
265 }
266 if let Some(ref token) = configuration.oauth_access_token {
267 req_builder = req_builder.bearer_auth(token.to_owned());
268 };
269
270 let req = req_builder.build()?;
271 let resp = configuration.client.execute(req).await?;
272
273 let status = resp.status();
274
275 if !status.is_client_error() && !status.is_server_error() {
276 Ok(())
277 } else {
278 let content = resp.text().await?;
279 let entity: Option<DevicesIdDeleteError> = serde_json::from_str(&content).ok();
280 Err(Error::ResponseError(ResponseContent {
281 status,
282 content,
283 entity,
284 }))
285 }
286}
287
288pub async fn devices_id_get(
289 configuration: &configuration::Configuration,
290 id: &str,
291) -> Result<models::DeviceResponseModel, Error<DevicesIdGetError>> {
292 let p_id = id;
294
295 let uri_str = format!(
296 "{}/devices/{id}",
297 configuration.base_path,
298 id = crate::apis::urlencode(p_id)
299 );
300 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
301
302 if let Some(ref user_agent) = configuration.user_agent {
303 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
304 }
305 if let Some(ref token) = configuration.oauth_access_token {
306 req_builder = req_builder.bearer_auth(token.to_owned());
307 };
308
309 let req = req_builder.build()?;
310 let resp = configuration.client.execute(req).await?;
311
312 let status = resp.status();
313 let content_type = resp
314 .headers()
315 .get("content-type")
316 .and_then(|v| v.to_str().ok())
317 .unwrap_or("application/octet-stream");
318 let content_type = super::ContentType::from(content_type);
319
320 if !status.is_client_error() && !status.is_server_error() {
321 let content = resp.text().await?;
322 match content_type {
323 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
324 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DeviceResponseModel`"))),
325 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::DeviceResponseModel`")))),
326 }
327 } else {
328 let content = resp.text().await?;
329 let entity: Option<DevicesIdGetError> = serde_json::from_str(&content).ok();
330 Err(Error::ResponseError(ResponseContent {
331 status,
332 content,
333 entity,
334 }))
335 }
336}
337
338pub async fn devices_id_post(
339 configuration: &configuration::Configuration,
340 id: &str,
341 device_request_model: Option<models::DeviceRequestModel>,
342) -> Result<models::DeviceResponseModel, Error<DevicesIdPostError>> {
343 let p_id = id;
345 let p_device_request_model = device_request_model;
346
347 let uri_str = format!(
348 "{}/devices/{id}",
349 configuration.base_path,
350 id = crate::apis::urlencode(p_id)
351 );
352 let mut req_builder = configuration
353 .client
354 .request(reqwest::Method::POST, &uri_str);
355
356 if let Some(ref user_agent) = configuration.user_agent {
357 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
358 }
359 if let Some(ref token) = configuration.oauth_access_token {
360 req_builder = req_builder.bearer_auth(token.to_owned());
361 };
362 req_builder = req_builder.json(&p_device_request_model);
363
364 let req = req_builder.build()?;
365 let resp = configuration.client.execute(req).await?;
366
367 let status = resp.status();
368 let content_type = resp
369 .headers()
370 .get("content-type")
371 .and_then(|v| v.to_str().ok())
372 .unwrap_or("application/octet-stream");
373 let content_type = super::ContentType::from(content_type);
374
375 if !status.is_client_error() && !status.is_server_error() {
376 let content = resp.text().await?;
377 match content_type {
378 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
379 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DeviceResponseModel`"))),
380 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::DeviceResponseModel`")))),
381 }
382 } else {
383 let content = resp.text().await?;
384 let entity: Option<DevicesIdPostError> = serde_json::from_str(&content).ok();
385 Err(Error::ResponseError(ResponseContent {
386 status,
387 content,
388 entity,
389 }))
390 }
391}
392
393pub async fn devices_id_put(
394 configuration: &configuration::Configuration,
395 id: &str,
396 device_request_model: Option<models::DeviceRequestModel>,
397) -> Result<models::DeviceResponseModel, Error<DevicesIdPutError>> {
398 let p_id = id;
400 let p_device_request_model = device_request_model;
401
402 let uri_str = format!(
403 "{}/devices/{id}",
404 configuration.base_path,
405 id = crate::apis::urlencode(p_id)
406 );
407 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
408
409 if let Some(ref user_agent) = configuration.user_agent {
410 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
411 }
412 if let Some(ref token) = configuration.oauth_access_token {
413 req_builder = req_builder.bearer_auth(token.to_owned());
414 };
415 req_builder = req_builder.json(&p_device_request_model);
416
417 let req = req_builder.build()?;
418 let resp = configuration.client.execute(req).await?;
419
420 let status = resp.status();
421 let content_type = resp
422 .headers()
423 .get("content-type")
424 .and_then(|v| v.to_str().ok())
425 .unwrap_or("application/octet-stream");
426 let content_type = super::ContentType::from(content_type);
427
428 if !status.is_client_error() && !status.is_server_error() {
429 let content = resp.text().await?;
430 match content_type {
431 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
432 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DeviceResponseModel`"))),
433 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::DeviceResponseModel`")))),
434 }
435 } else {
436 let content = resp.text().await?;
437 let entity: Option<DevicesIdPutError> = serde_json::from_str(&content).ok();
438 Err(Error::ResponseError(ResponseContent {
439 status,
440 content,
441 entity,
442 }))
443 }
444}
445
446pub async fn devices_identifier_identifier_clear_token_post(
447 configuration: &configuration::Configuration,
448 identifier: &str,
449) -> Result<(), Error<DevicesIdentifierIdentifierClearTokenPostError>> {
450 let p_identifier = identifier;
452
453 let uri_str = format!(
454 "{}/devices/identifier/{identifier}/clear-token",
455 configuration.base_path,
456 identifier = crate::apis::urlencode(p_identifier)
457 );
458 let mut req_builder = configuration
459 .client
460 .request(reqwest::Method::POST, &uri_str);
461
462 if let Some(ref user_agent) = configuration.user_agent {
463 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
464 }
465 if let Some(ref token) = configuration.oauth_access_token {
466 req_builder = req_builder.bearer_auth(token.to_owned());
467 };
468
469 let req = req_builder.build()?;
470 let resp = configuration.client.execute(req).await?;
471
472 let status = resp.status();
473
474 if !status.is_client_error() && !status.is_server_error() {
475 Ok(())
476 } else {
477 let content = resp.text().await?;
478 let entity: Option<DevicesIdentifierIdentifierClearTokenPostError> =
479 serde_json::from_str(&content).ok();
480 Err(Error::ResponseError(ResponseContent {
481 status,
482 content,
483 entity,
484 }))
485 }
486}
487
488pub async fn devices_identifier_identifier_clear_token_put(
489 configuration: &configuration::Configuration,
490 identifier: &str,
491) -> Result<(), Error<DevicesIdentifierIdentifierClearTokenPutError>> {
492 let p_identifier = identifier;
494
495 let uri_str = format!(
496 "{}/devices/identifier/{identifier}/clear-token",
497 configuration.base_path,
498 identifier = crate::apis::urlencode(p_identifier)
499 );
500 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
501
502 if let Some(ref user_agent) = configuration.user_agent {
503 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
504 }
505 if let Some(ref token) = configuration.oauth_access_token {
506 req_builder = req_builder.bearer_auth(token.to_owned());
507 };
508
509 let req = req_builder.build()?;
510 let resp = configuration.client.execute(req).await?;
511
512 let status = resp.status();
513
514 if !status.is_client_error() && !status.is_server_error() {
515 Ok(())
516 } else {
517 let content = resp.text().await?;
518 let entity: Option<DevicesIdentifierIdentifierClearTokenPutError> =
519 serde_json::from_str(&content).ok();
520 Err(Error::ResponseError(ResponseContent {
521 status,
522 content,
523 entity,
524 }))
525 }
526}
527
528pub async fn devices_identifier_identifier_get(
529 configuration: &configuration::Configuration,
530 identifier: &str,
531) -> Result<models::DeviceResponseModel, Error<DevicesIdentifierIdentifierGetError>> {
532 let p_identifier = identifier;
534
535 let uri_str = format!(
536 "{}/devices/identifier/{identifier}",
537 configuration.base_path,
538 identifier = crate::apis::urlencode(p_identifier)
539 );
540 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
541
542 if let Some(ref user_agent) = configuration.user_agent {
543 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
544 }
545 if let Some(ref token) = configuration.oauth_access_token {
546 req_builder = req_builder.bearer_auth(token.to_owned());
547 };
548
549 let req = req_builder.build()?;
550 let resp = configuration.client.execute(req).await?;
551
552 let status = resp.status();
553 let content_type = resp
554 .headers()
555 .get("content-type")
556 .and_then(|v| v.to_str().ok())
557 .unwrap_or("application/octet-stream");
558 let content_type = super::ContentType::from(content_type);
559
560 if !status.is_client_error() && !status.is_server_error() {
561 let content = resp.text().await?;
562 match content_type {
563 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
564 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DeviceResponseModel`"))),
565 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::DeviceResponseModel`")))),
566 }
567 } else {
568 let content = resp.text().await?;
569 let entity: Option<DevicesIdentifierIdentifierGetError> =
570 serde_json::from_str(&content).ok();
571 Err(Error::ResponseError(ResponseContent {
572 status,
573 content,
574 entity,
575 }))
576 }
577}
578
579pub async fn devices_identifier_identifier_token_post(
580 configuration: &configuration::Configuration,
581 identifier: &str,
582 device_token_request_model: Option<models::DeviceTokenRequestModel>,
583) -> Result<(), Error<DevicesIdentifierIdentifierTokenPostError>> {
584 let p_identifier = identifier;
586 let p_device_token_request_model = device_token_request_model;
587
588 let uri_str = format!(
589 "{}/devices/identifier/{identifier}/token",
590 configuration.base_path,
591 identifier = crate::apis::urlencode(p_identifier)
592 );
593 let mut req_builder = configuration
594 .client
595 .request(reqwest::Method::POST, &uri_str);
596
597 if let Some(ref user_agent) = configuration.user_agent {
598 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
599 }
600 if let Some(ref token) = configuration.oauth_access_token {
601 req_builder = req_builder.bearer_auth(token.to_owned());
602 };
603 req_builder = req_builder.json(&p_device_token_request_model);
604
605 let req = req_builder.build()?;
606 let resp = configuration.client.execute(req).await?;
607
608 let status = resp.status();
609
610 if !status.is_client_error() && !status.is_server_error() {
611 Ok(())
612 } else {
613 let content = resp.text().await?;
614 let entity: Option<DevicesIdentifierIdentifierTokenPostError> =
615 serde_json::from_str(&content).ok();
616 Err(Error::ResponseError(ResponseContent {
617 status,
618 content,
619 entity,
620 }))
621 }
622}
623
624pub async fn devices_identifier_identifier_token_put(
625 configuration: &configuration::Configuration,
626 identifier: &str,
627 device_token_request_model: Option<models::DeviceTokenRequestModel>,
628) -> Result<(), Error<DevicesIdentifierIdentifierTokenPutError>> {
629 let p_identifier = identifier;
631 let p_device_token_request_model = device_token_request_model;
632
633 let uri_str = format!(
634 "{}/devices/identifier/{identifier}/token",
635 configuration.base_path,
636 identifier = crate::apis::urlencode(p_identifier)
637 );
638 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
639
640 if let Some(ref user_agent) = configuration.user_agent {
641 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
642 }
643 if let Some(ref token) = configuration.oauth_access_token {
644 req_builder = req_builder.bearer_auth(token.to_owned());
645 };
646 req_builder = req_builder.json(&p_device_token_request_model);
647
648 let req = req_builder.build()?;
649 let resp = configuration.client.execute(req).await?;
650
651 let status = resp.status();
652
653 if !status.is_client_error() && !status.is_server_error() {
654 Ok(())
655 } else {
656 let content = resp.text().await?;
657 let entity: Option<DevicesIdentifierIdentifierTokenPutError> =
658 serde_json::from_str(&content).ok();
659 Err(Error::ResponseError(ResponseContent {
660 status,
661 content,
662 entity,
663 }))
664 }
665}
666
667pub async fn devices_identifier_identifier_web_push_auth_post(
668 configuration: &configuration::Configuration,
669 identifier: &str,
670 web_push_auth_request_model: Option<models::WebPushAuthRequestModel>,
671) -> Result<(), Error<DevicesIdentifierIdentifierWebPushAuthPostError>> {
672 let p_identifier = identifier;
674 let p_web_push_auth_request_model = web_push_auth_request_model;
675
676 let uri_str = format!(
677 "{}/devices/identifier/{identifier}/web-push-auth",
678 configuration.base_path,
679 identifier = crate::apis::urlencode(p_identifier)
680 );
681 let mut req_builder = configuration
682 .client
683 .request(reqwest::Method::POST, &uri_str);
684
685 if let Some(ref user_agent) = configuration.user_agent {
686 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
687 }
688 if let Some(ref token) = configuration.oauth_access_token {
689 req_builder = req_builder.bearer_auth(token.to_owned());
690 };
691 req_builder = req_builder.json(&p_web_push_auth_request_model);
692
693 let req = req_builder.build()?;
694 let resp = configuration.client.execute(req).await?;
695
696 let status = resp.status();
697
698 if !status.is_client_error() && !status.is_server_error() {
699 Ok(())
700 } else {
701 let content = resp.text().await?;
702 let entity: Option<DevicesIdentifierIdentifierWebPushAuthPostError> =
703 serde_json::from_str(&content).ok();
704 Err(Error::ResponseError(ResponseContent {
705 status,
706 content,
707 entity,
708 }))
709 }
710}
711
712pub async fn devices_identifier_identifier_web_push_auth_put(
713 configuration: &configuration::Configuration,
714 identifier: &str,
715 web_push_auth_request_model: Option<models::WebPushAuthRequestModel>,
716) -> Result<(), Error<DevicesIdentifierIdentifierWebPushAuthPutError>> {
717 let p_identifier = identifier;
719 let p_web_push_auth_request_model = web_push_auth_request_model;
720
721 let uri_str = format!(
722 "{}/devices/identifier/{identifier}/web-push-auth",
723 configuration.base_path,
724 identifier = crate::apis::urlencode(p_identifier)
725 );
726 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
727
728 if let Some(ref user_agent) = configuration.user_agent {
729 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
730 }
731 if let Some(ref token) = configuration.oauth_access_token {
732 req_builder = req_builder.bearer_auth(token.to_owned());
733 };
734 req_builder = req_builder.json(&p_web_push_auth_request_model);
735
736 let req = req_builder.build()?;
737 let resp = configuration.client.execute(req).await?;
738
739 let status = resp.status();
740
741 if !status.is_client_error() && !status.is_server_error() {
742 Ok(())
743 } else {
744 let content = resp.text().await?;
745 let entity: Option<DevicesIdentifierIdentifierWebPushAuthPutError> =
746 serde_json::from_str(&content).ok();
747 Err(Error::ResponseError(ResponseContent {
748 status,
749 content,
750 entity,
751 }))
752 }
753}
754
755pub async fn devices_identifier_keys_post(
756 configuration: &configuration::Configuration,
757 identifier: &str,
758 device_keys_request_model: Option<models::DeviceKeysRequestModel>,
759) -> Result<models::DeviceResponseModel, Error<DevicesIdentifierKeysPostError>> {
760 let p_identifier = identifier;
762 let p_device_keys_request_model = device_keys_request_model;
763
764 let uri_str = format!(
765 "{}/devices/{identifier}/keys",
766 configuration.base_path,
767 identifier = crate::apis::urlencode(p_identifier)
768 );
769 let mut req_builder = configuration
770 .client
771 .request(reqwest::Method::POST, &uri_str);
772
773 if let Some(ref user_agent) = configuration.user_agent {
774 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
775 }
776 if let Some(ref token) = configuration.oauth_access_token {
777 req_builder = req_builder.bearer_auth(token.to_owned());
778 };
779 req_builder = req_builder.json(&p_device_keys_request_model);
780
781 let req = req_builder.build()?;
782 let resp = configuration.client.execute(req).await?;
783
784 let status = resp.status();
785 let content_type = resp
786 .headers()
787 .get("content-type")
788 .and_then(|v| v.to_str().ok())
789 .unwrap_or("application/octet-stream");
790 let content_type = super::ContentType::from(content_type);
791
792 if !status.is_client_error() && !status.is_server_error() {
793 let content = resp.text().await?;
794 match content_type {
795 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
796 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DeviceResponseModel`"))),
797 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::DeviceResponseModel`")))),
798 }
799 } else {
800 let content = resp.text().await?;
801 let entity: Option<DevicesIdentifierKeysPostError> = serde_json::from_str(&content).ok();
802 Err(Error::ResponseError(ResponseContent {
803 status,
804 content,
805 entity,
806 }))
807 }
808}
809
810pub async fn devices_identifier_keys_put(
811 configuration: &configuration::Configuration,
812 identifier: &str,
813 device_keys_request_model: Option<models::DeviceKeysRequestModel>,
814) -> Result<models::DeviceResponseModel, Error<DevicesIdentifierKeysPutError>> {
815 let p_identifier = identifier;
817 let p_device_keys_request_model = device_keys_request_model;
818
819 let uri_str = format!(
820 "{}/devices/{identifier}/keys",
821 configuration.base_path,
822 identifier = crate::apis::urlencode(p_identifier)
823 );
824 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
825
826 if let Some(ref user_agent) = configuration.user_agent {
827 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
828 }
829 if let Some(ref token) = configuration.oauth_access_token {
830 req_builder = req_builder.bearer_auth(token.to_owned());
831 };
832 req_builder = req_builder.json(&p_device_keys_request_model);
833
834 let req = req_builder.build()?;
835 let resp = configuration.client.execute(req).await?;
836
837 let status = resp.status();
838 let content_type = resp
839 .headers()
840 .get("content-type")
841 .and_then(|v| v.to_str().ok())
842 .unwrap_or("application/octet-stream");
843 let content_type = super::ContentType::from(content_type);
844
845 if !status.is_client_error() && !status.is_server_error() {
846 let content = resp.text().await?;
847 match content_type {
848 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
849 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DeviceResponseModel`"))),
850 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::DeviceResponseModel`")))),
851 }
852 } else {
853 let content = resp.text().await?;
854 let entity: Option<DevicesIdentifierKeysPutError> = serde_json::from_str(&content).ok();
855 Err(Error::ResponseError(ResponseContent {
856 status,
857 content,
858 entity,
859 }))
860 }
861}
862
863pub async fn devices_identifier_retrieve_keys_post(
864 configuration: &configuration::Configuration,
865 identifier: &str,
866 secret_verification_request_model: Option<models::SecretVerificationRequestModel>,
867) -> Result<models::ProtectedDeviceResponseModel, Error<DevicesIdentifierRetrieveKeysPostError>> {
868 let p_identifier = identifier;
870 let p_secret_verification_request_model = secret_verification_request_model;
871
872 let uri_str = format!(
873 "{}/devices/{identifier}/retrieve-keys",
874 configuration.base_path,
875 identifier = crate::apis::urlencode(p_identifier)
876 );
877 let mut req_builder = configuration
878 .client
879 .request(reqwest::Method::POST, &uri_str);
880
881 if let Some(ref user_agent) = configuration.user_agent {
882 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
883 }
884 if let Some(ref token) = configuration.oauth_access_token {
885 req_builder = req_builder.bearer_auth(token.to_owned());
886 };
887 req_builder = req_builder.json(&p_secret_verification_request_model);
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::ProtectedDeviceResponseModel`"))),
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::ProtectedDeviceResponseModel`")))),
906 }
907 } else {
908 let content = resp.text().await?;
909 let entity: Option<DevicesIdentifierRetrieveKeysPostError> =
910 serde_json::from_str(&content).ok();
911 Err(Error::ResponseError(ResponseContent {
912 status,
913 content,
914 entity,
915 }))
916 }
917}
918
919pub async fn devices_knowndevice_email_identifier_get(
920 configuration: &configuration::Configuration,
921 email: &str,
922 identifier: &str,
923) -> Result<bool, Error<DevicesKnowndeviceEmailIdentifierGetError>> {
924 let p_email = email;
926 let p_identifier = identifier;
927
928 let uri_str = format!(
929 "{}/devices/knowndevice/{email}/{identifier}",
930 configuration.base_path,
931 email = crate::apis::urlencode(p_email),
932 identifier = crate::apis::urlencode(p_identifier)
933 );
934 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
935
936 if let Some(ref user_agent) = configuration.user_agent {
937 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
938 }
939 if let Some(ref token) = configuration.oauth_access_token {
940 req_builder = req_builder.bearer_auth(token.to_owned());
941 };
942
943 let req = req_builder.build()?;
944 let resp = configuration.client.execute(req).await?;
945
946 let status = resp.status();
947 let content_type = resp
948 .headers()
949 .get("content-type")
950 .and_then(|v| v.to_str().ok())
951 .unwrap_or("application/octet-stream");
952 let content_type = super::ContentType::from(content_type);
953
954 if !status.is_client_error() && !status.is_server_error() {
955 let content = resp.text().await?;
956 match content_type {
957 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
958 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `bool`"))),
959 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `bool`")))),
960 }
961 } else {
962 let content = resp.text().await?;
963 let entity: Option<DevicesKnowndeviceEmailIdentifierGetError> =
964 serde_json::from_str(&content).ok();
965 Err(Error::ResponseError(ResponseContent {
966 status,
967 content,
968 entity,
969 }))
970 }
971}
972
973pub async fn devices_knowndevice_get(
974 configuration: &configuration::Configuration,
975 x_request_email: &str,
976 x_device_identifier: &str,
977) -> Result<bool, Error<DevicesKnowndeviceGetError>> {
978 let p_x_request_email = x_request_email;
980 let p_x_device_identifier = x_device_identifier;
981
982 let uri_str = format!("{}/devices/knowndevice", configuration.base_path);
983 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
984
985 if let Some(ref user_agent) = configuration.user_agent {
986 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
987 }
988 req_builder = req_builder.header("x-Request-Email", p_x_request_email.to_string());
989 req_builder = req_builder.header("x-Device-Identifier", p_x_device_identifier.to_string());
990 if let Some(ref token) = configuration.oauth_access_token {
991 req_builder = req_builder.bearer_auth(token.to_owned());
992 };
993
994 let req = req_builder.build()?;
995 let resp = configuration.client.execute(req).await?;
996
997 let status = resp.status();
998 let content_type = resp
999 .headers()
1000 .get("content-type")
1001 .and_then(|v| v.to_str().ok())
1002 .unwrap_or("application/octet-stream");
1003 let content_type = super::ContentType::from(content_type);
1004
1005 if !status.is_client_error() && !status.is_server_error() {
1006 let content = resp.text().await?;
1007 match content_type {
1008 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1009 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `bool`"))),
1010 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `bool`")))),
1011 }
1012 } else {
1013 let content = resp.text().await?;
1014 let entity: Option<DevicesKnowndeviceGetError> = serde_json::from_str(&content).ok();
1015 Err(Error::ResponseError(ResponseContent {
1016 status,
1017 content,
1018 entity,
1019 }))
1020 }
1021}
1022
1023pub async fn devices_lost_trust_post(
1024 configuration: &configuration::Configuration,
1025) -> Result<(), Error<DevicesLostTrustPostError>> {
1026 let uri_str = format!("{}/devices/lost-trust", configuration.base_path);
1027 let mut req_builder = configuration
1028 .client
1029 .request(reqwest::Method::POST, &uri_str);
1030
1031 if let Some(ref user_agent) = configuration.user_agent {
1032 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1033 }
1034 if let Some(ref token) = configuration.oauth_access_token {
1035 req_builder = req_builder.bearer_auth(token.to_owned());
1036 };
1037
1038 let req = req_builder.build()?;
1039 let resp = configuration.client.execute(req).await?;
1040
1041 let status = resp.status();
1042
1043 if !status.is_client_error() && !status.is_server_error() {
1044 Ok(())
1045 } else {
1046 let content = resp.text().await?;
1047 let entity: Option<DevicesLostTrustPostError> = serde_json::from_str(&content).ok();
1048 Err(Error::ResponseError(ResponseContent {
1049 status,
1050 content,
1051 entity,
1052 }))
1053 }
1054}
1055
1056pub async fn devices_post(
1057 configuration: &configuration::Configuration,
1058 device_request_model: Option<models::DeviceRequestModel>,
1059) -> Result<models::DeviceResponseModel, Error<DevicesPostError>> {
1060 let p_device_request_model = device_request_model;
1062
1063 let uri_str = format!("{}/devices", configuration.base_path);
1064 let mut req_builder = configuration
1065 .client
1066 .request(reqwest::Method::POST, &uri_str);
1067
1068 if let Some(ref user_agent) = configuration.user_agent {
1069 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1070 }
1071 if let Some(ref token) = configuration.oauth_access_token {
1072 req_builder = req_builder.bearer_auth(token.to_owned());
1073 };
1074 req_builder = req_builder.json(&p_device_request_model);
1075
1076 let req = req_builder.build()?;
1077 let resp = configuration.client.execute(req).await?;
1078
1079 let status = resp.status();
1080 let content_type = resp
1081 .headers()
1082 .get("content-type")
1083 .and_then(|v| v.to_str().ok())
1084 .unwrap_or("application/octet-stream");
1085 let content_type = super::ContentType::from(content_type);
1086
1087 if !status.is_client_error() && !status.is_server_error() {
1088 let content = resp.text().await?;
1089 match content_type {
1090 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1091 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DeviceResponseModel`"))),
1092 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::DeviceResponseModel`")))),
1093 }
1094 } else {
1095 let content = resp.text().await?;
1096 let entity: Option<DevicesPostError> = serde_json::from_str(&content).ok();
1097 Err(Error::ResponseError(ResponseContent {
1098 status,
1099 content,
1100 entity,
1101 }))
1102 }
1103}
1104
1105pub async fn devices_update_trust_post(
1106 configuration: &configuration::Configuration,
1107 update_devices_trust_request_model: Option<models::UpdateDevicesTrustRequestModel>,
1108) -> Result<(), Error<DevicesUpdateTrustPostError>> {
1109 let p_update_devices_trust_request_model = update_devices_trust_request_model;
1111
1112 let uri_str = format!("{}/devices/update-trust", configuration.base_path);
1113 let mut req_builder = configuration
1114 .client
1115 .request(reqwest::Method::POST, &uri_str);
1116
1117 if let Some(ref user_agent) = configuration.user_agent {
1118 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1119 }
1120 if let Some(ref token) = configuration.oauth_access_token {
1121 req_builder = req_builder.bearer_auth(token.to_owned());
1122 };
1123 req_builder = req_builder.json(&p_update_devices_trust_request_model);
1124
1125 let req = req_builder.build()?;
1126 let resp = configuration.client.execute(req).await?;
1127
1128 let status = resp.status();
1129
1130 if !status.is_client_error() && !status.is_server_error() {
1131 Ok(())
1132 } else {
1133 let content = resp.text().await?;
1134 let entity: Option<DevicesUpdateTrustPostError> = serde_json::from_str(&content).ok();
1135 Err(Error::ResponseError(ResponseContent {
1136 status,
1137 content,
1138 entity,
1139 }))
1140 }
1141}