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 ReportsMemberAccessOrgIdGetError {
21 UnknownValue(serde_json::Value),
22}
23
24#[derive(Debug, Clone, Serialize, Deserialize)]
26#[serde(untagged)]
27pub enum ReportsMemberCipherDetailsOrgIdGetError {
28 UnknownValue(serde_json::Value),
29}
30
31#[derive(Debug, Clone, Serialize, Deserialize)]
33#[serde(untagged)]
34pub enum ReportsOrganizationReportSummaryOrgIdGetError {
35 UnknownValue(serde_json::Value),
36}
37
38#[derive(Debug, Clone, Serialize, Deserialize)]
40#[serde(untagged)]
41pub enum ReportsOrganizationReportSummaryPostError {
42 UnknownValue(serde_json::Value),
43}
44
45#[derive(Debug, Clone, Serialize, Deserialize)]
47#[serde(untagged)]
48pub enum ReportsOrganizationReportSummaryPutError {
49 UnknownValue(serde_json::Value),
50}
51
52#[derive(Debug, Clone, Serialize, Deserialize)]
54#[serde(untagged)]
55pub enum ReportsOrganizationReportsDeleteError {
56 UnknownValue(serde_json::Value),
57}
58
59#[derive(Debug, Clone, Serialize, Deserialize)]
61#[serde(untagged)]
62pub enum ReportsOrganizationReportsLatestOrgIdGetError {
63 UnknownValue(serde_json::Value),
64}
65
66#[derive(Debug, Clone, Serialize, Deserialize)]
68#[serde(untagged)]
69pub enum ReportsOrganizationReportsOrgIdGetError {
70 UnknownValue(serde_json::Value),
71}
72
73#[derive(Debug, Clone, Serialize, Deserialize)]
75#[serde(untagged)]
76pub enum ReportsOrganizationReportsPostError {
77 UnknownValue(serde_json::Value),
78}
79
80#[derive(Debug, Clone, Serialize, Deserialize)]
82#[serde(untagged)]
83pub enum ReportsPasswordHealthReportApplicationDeleteError {
84 UnknownValue(serde_json::Value),
85}
86
87#[derive(Debug, Clone, Serialize, Deserialize)]
89#[serde(untagged)]
90pub enum ReportsPasswordHealthReportApplicationPostError {
91 UnknownValue(serde_json::Value),
92}
93
94#[derive(Debug, Clone, Serialize, Deserialize)]
96#[serde(untagged)]
97pub enum ReportsPasswordHealthReportApplicationsOrgIdGetError {
98 UnknownValue(serde_json::Value),
99}
100
101#[derive(Debug, Clone, Serialize, Deserialize)]
103#[serde(untagged)]
104pub enum ReportsPasswordHealthReportApplicationsPostError {
105 UnknownValue(serde_json::Value),
106}
107
108pub async fn reports_member_access_org_id_get(
109 configuration: &configuration::Configuration,
110 org_id: uuid::Uuid,
111) -> Result<
112 Vec<models::MemberAccessDetailReportResponseModel>,
113 Error<ReportsMemberAccessOrgIdGetError>,
114> {
115 let p_org_id = org_id;
117
118 let uri_str = format!(
119 "{}/reports/member-access/{orgId}",
120 configuration.base_path,
121 orgId = crate::apis::urlencode(p_org_id.to_string())
122 );
123 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
124
125 if let Some(ref user_agent) = configuration.user_agent {
126 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
127 }
128 if let Some(ref token) = configuration.oauth_access_token {
129 req_builder = req_builder.bearer_auth(token.to_owned());
130 };
131
132 let req = req_builder.build()?;
133 let resp = configuration.client.execute(req).await?;
134
135 let status = resp.status();
136 let content_type = resp
137 .headers()
138 .get("content-type")
139 .and_then(|v| v.to_str().ok())
140 .unwrap_or("application/octet-stream");
141 let content_type = super::ContentType::from(content_type);
142
143 if !status.is_client_error() && !status.is_server_error() {
144 let content = resp.text().await?;
145 match content_type {
146 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
147 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::MemberAccessDetailReportResponseModel>`"))),
148 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::MemberAccessDetailReportResponseModel>`")))),
149 }
150 } else {
151 let content = resp.text().await?;
152 let entity: Option<ReportsMemberAccessOrgIdGetError> = serde_json::from_str(&content).ok();
153 Err(Error::ResponseError(ResponseContent {
154 status,
155 content,
156 entity,
157 }))
158 }
159}
160
161pub async fn reports_member_cipher_details_org_id_get(
162 configuration: &configuration::Configuration,
163 org_id: uuid::Uuid,
164) -> Result<
165 Vec<models::MemberCipherDetailsResponseModel>,
166 Error<ReportsMemberCipherDetailsOrgIdGetError>,
167> {
168 let p_org_id = org_id;
170
171 let uri_str = format!(
172 "{}/reports/member-cipher-details/{orgId}",
173 configuration.base_path,
174 orgId = crate::apis::urlencode(p_org_id.to_string())
175 );
176 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
177
178 if let Some(ref user_agent) = configuration.user_agent {
179 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
180 }
181 if let Some(ref token) = configuration.oauth_access_token {
182 req_builder = req_builder.bearer_auth(token.to_owned());
183 };
184
185 let req = req_builder.build()?;
186 let resp = configuration.client.execute(req).await?;
187
188 let status = resp.status();
189 let content_type = resp
190 .headers()
191 .get("content-type")
192 .and_then(|v| v.to_str().ok())
193 .unwrap_or("application/octet-stream");
194 let content_type = super::ContentType::from(content_type);
195
196 if !status.is_client_error() && !status.is_server_error() {
197 let content = resp.text().await?;
198 match content_type {
199 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
200 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::MemberCipherDetailsResponseModel>`"))),
201 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::MemberCipherDetailsResponseModel>`")))),
202 }
203 } else {
204 let content = resp.text().await?;
205 let entity: Option<ReportsMemberCipherDetailsOrgIdGetError> =
206 serde_json::from_str(&content).ok();
207 Err(Error::ResponseError(ResponseContent {
208 status,
209 content,
210 entity,
211 }))
212 }
213}
214
215pub async fn reports_organization_report_summary_org_id_get(
216 configuration: &configuration::Configuration,
217 org_id: uuid::Uuid,
218 from: Option<String>,
219 to: Option<String>,
220) -> Result<
221 Vec<models::OrganizationReportSummaryModel>,
222 Error<ReportsOrganizationReportSummaryOrgIdGetError>,
223> {
224 let p_org_id = org_id;
226 let p_from = from;
227 let p_to = to;
228
229 let uri_str = format!(
230 "{}/reports/organization-report-summary/{orgId}",
231 configuration.base_path,
232 orgId = crate::apis::urlencode(p_org_id.to_string())
233 );
234 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
235
236 if let Some(ref param_value) = p_from {
237 req_builder = req_builder.query(&[("from", ¶m_value.to_string())]);
238 }
239 if let Some(ref param_value) = p_to {
240 req_builder = req_builder.query(&[("to", ¶m_value.to_string())]);
241 }
242 if let Some(ref user_agent) = configuration.user_agent {
243 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
244 }
245 if let Some(ref token) = configuration.oauth_access_token {
246 req_builder = req_builder.bearer_auth(token.to_owned());
247 };
248
249 let req = req_builder.build()?;
250 let resp = configuration.client.execute(req).await?;
251
252 let status = resp.status();
253 let content_type = resp
254 .headers()
255 .get("content-type")
256 .and_then(|v| v.to_str().ok())
257 .unwrap_or("application/octet-stream");
258 let content_type = super::ContentType::from(content_type);
259
260 if !status.is_client_error() && !status.is_server_error() {
261 let content = resp.text().await?;
262 match content_type {
263 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
264 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::OrganizationReportSummaryModel>`"))),
265 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::OrganizationReportSummaryModel>`")))),
266 }
267 } else {
268 let content = resp.text().await?;
269 let entity: Option<ReportsOrganizationReportSummaryOrgIdGetError> =
270 serde_json::from_str(&content).ok();
271 Err(Error::ResponseError(ResponseContent {
272 status,
273 content,
274 entity,
275 }))
276 }
277}
278
279pub async fn reports_organization_report_summary_post(
280 configuration: &configuration::Configuration,
281 organization_report_summary_model: Option<models::OrganizationReportSummaryModel>,
282) -> Result<(), Error<ReportsOrganizationReportSummaryPostError>> {
283 let p_organization_report_summary_model = organization_report_summary_model;
285
286 let uri_str = format!(
287 "{}/reports/organization-report-summary",
288 configuration.base_path
289 );
290 let mut req_builder = configuration
291 .client
292 .request(reqwest::Method::POST, &uri_str);
293
294 if let Some(ref user_agent) = configuration.user_agent {
295 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
296 }
297 if let Some(ref token) = configuration.oauth_access_token {
298 req_builder = req_builder.bearer_auth(token.to_owned());
299 };
300 req_builder = req_builder.json(&p_organization_report_summary_model);
301
302 let req = req_builder.build()?;
303 let resp = configuration.client.execute(req).await?;
304
305 let status = resp.status();
306
307 if !status.is_client_error() && !status.is_server_error() {
308 Ok(())
309 } else {
310 let content = resp.text().await?;
311 let entity: Option<ReportsOrganizationReportSummaryPostError> =
312 serde_json::from_str(&content).ok();
313 Err(Error::ResponseError(ResponseContent {
314 status,
315 content,
316 entity,
317 }))
318 }
319}
320
321pub async fn reports_organization_report_summary_put(
322 configuration: &configuration::Configuration,
323 organization_report_summary_model: Option<models::OrganizationReportSummaryModel>,
324) -> Result<(), Error<ReportsOrganizationReportSummaryPutError>> {
325 let p_organization_report_summary_model = organization_report_summary_model;
327
328 let uri_str = format!(
329 "{}/reports/organization-report-summary",
330 configuration.base_path
331 );
332 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
333
334 if let Some(ref user_agent) = configuration.user_agent {
335 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
336 }
337 if let Some(ref token) = configuration.oauth_access_token {
338 req_builder = req_builder.bearer_auth(token.to_owned());
339 };
340 req_builder = req_builder.json(&p_organization_report_summary_model);
341
342 let req = req_builder.build()?;
343 let resp = configuration.client.execute(req).await?;
344
345 let status = resp.status();
346
347 if !status.is_client_error() && !status.is_server_error() {
348 Ok(())
349 } else {
350 let content = resp.text().await?;
351 let entity: Option<ReportsOrganizationReportSummaryPutError> =
352 serde_json::from_str(&content).ok();
353 Err(Error::ResponseError(ResponseContent {
354 status,
355 content,
356 entity,
357 }))
358 }
359}
360
361pub async fn reports_organization_reports_delete(
362 configuration: &configuration::Configuration,
363 drop_organization_report_request: Option<models::DropOrganizationReportRequest>,
364) -> Result<(), Error<ReportsOrganizationReportsDeleteError>> {
365 let p_drop_organization_report_request = drop_organization_report_request;
367
368 let uri_str = format!("{}/reports/organization-reports", configuration.base_path);
369 let mut req_builder = configuration
370 .client
371 .request(reqwest::Method::DELETE, &uri_str);
372
373 if let Some(ref user_agent) = configuration.user_agent {
374 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
375 }
376 if let Some(ref token) = configuration.oauth_access_token {
377 req_builder = req_builder.bearer_auth(token.to_owned());
378 };
379 req_builder = req_builder.json(&p_drop_organization_report_request);
380
381 let req = req_builder.build()?;
382 let resp = configuration.client.execute(req).await?;
383
384 let status = resp.status();
385
386 if !status.is_client_error() && !status.is_server_error() {
387 Ok(())
388 } else {
389 let content = resp.text().await?;
390 let entity: Option<ReportsOrganizationReportsDeleteError> =
391 serde_json::from_str(&content).ok();
392 Err(Error::ResponseError(ResponseContent {
393 status,
394 content,
395 entity,
396 }))
397 }
398}
399
400pub async fn reports_organization_reports_latest_org_id_get(
401 configuration: &configuration::Configuration,
402 org_id: uuid::Uuid,
403) -> Result<models::OrganizationReport, Error<ReportsOrganizationReportsLatestOrgIdGetError>> {
404 let p_org_id = org_id;
406
407 let uri_str = format!(
408 "{}/reports/organization-reports/latest/{orgId}",
409 configuration.base_path,
410 orgId = crate::apis::urlencode(p_org_id.to_string())
411 );
412 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
413
414 if let Some(ref user_agent) = configuration.user_agent {
415 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
416 }
417 if let Some(ref token) = configuration.oauth_access_token {
418 req_builder = req_builder.bearer_auth(token.to_owned());
419 };
420
421 let req = req_builder.build()?;
422 let resp = configuration.client.execute(req).await?;
423
424 let status = resp.status();
425 let content_type = resp
426 .headers()
427 .get("content-type")
428 .and_then(|v| v.to_str().ok())
429 .unwrap_or("application/octet-stream");
430 let content_type = super::ContentType::from(content_type);
431
432 if !status.is_client_error() && !status.is_server_error() {
433 let content = resp.text().await?;
434 match content_type {
435 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
436 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::OrganizationReport`"))),
437 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::OrganizationReport`")))),
438 }
439 } else {
440 let content = resp.text().await?;
441 let entity: Option<ReportsOrganizationReportsLatestOrgIdGetError> =
442 serde_json::from_str(&content).ok();
443 Err(Error::ResponseError(ResponseContent {
444 status,
445 content,
446 entity,
447 }))
448 }
449}
450
451pub async fn reports_organization_reports_org_id_get(
452 configuration: &configuration::Configuration,
453 org_id: uuid::Uuid,
454) -> Result<Vec<models::OrganizationReport>, Error<ReportsOrganizationReportsOrgIdGetError>> {
455 let p_org_id = org_id;
457
458 let uri_str = format!(
459 "{}/reports/organization-reports/{orgId}",
460 configuration.base_path,
461 orgId = crate::apis::urlencode(p_org_id.to_string())
462 );
463 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
464
465 if let Some(ref user_agent) = configuration.user_agent {
466 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
467 }
468 if let Some(ref token) = configuration.oauth_access_token {
469 req_builder = req_builder.bearer_auth(token.to_owned());
470 };
471
472 let req = req_builder.build()?;
473 let resp = configuration.client.execute(req).await?;
474
475 let status = resp.status();
476 let content_type = resp
477 .headers()
478 .get("content-type")
479 .and_then(|v| v.to_str().ok())
480 .unwrap_or("application/octet-stream");
481 let content_type = super::ContentType::from(content_type);
482
483 if !status.is_client_error() && !status.is_server_error() {
484 let content = resp.text().await?;
485 match content_type {
486 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
487 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::OrganizationReport>`"))),
488 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::OrganizationReport>`")))),
489 }
490 } else {
491 let content = resp.text().await?;
492 let entity: Option<ReportsOrganizationReportsOrgIdGetError> =
493 serde_json::from_str(&content).ok();
494 Err(Error::ResponseError(ResponseContent {
495 status,
496 content,
497 entity,
498 }))
499 }
500}
501
502pub async fn reports_organization_reports_post(
503 configuration: &configuration::Configuration,
504 add_organization_report_request: Option<models::AddOrganizationReportRequest>,
505) -> Result<models::OrganizationReport, Error<ReportsOrganizationReportsPostError>> {
506 let p_add_organization_report_request = add_organization_report_request;
508
509 let uri_str = format!("{}/reports/organization-reports", configuration.base_path);
510 let mut req_builder = configuration
511 .client
512 .request(reqwest::Method::POST, &uri_str);
513
514 if let Some(ref user_agent) = configuration.user_agent {
515 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
516 }
517 if let Some(ref token) = configuration.oauth_access_token {
518 req_builder = req_builder.bearer_auth(token.to_owned());
519 };
520 req_builder = req_builder.json(&p_add_organization_report_request);
521
522 let req = req_builder.build()?;
523 let resp = configuration.client.execute(req).await?;
524
525 let status = resp.status();
526 let content_type = resp
527 .headers()
528 .get("content-type")
529 .and_then(|v| v.to_str().ok())
530 .unwrap_or("application/octet-stream");
531 let content_type = super::ContentType::from(content_type);
532
533 if !status.is_client_error() && !status.is_server_error() {
534 let content = resp.text().await?;
535 match content_type {
536 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
537 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::OrganizationReport`"))),
538 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::OrganizationReport`")))),
539 }
540 } else {
541 let content = resp.text().await?;
542 let entity: Option<ReportsOrganizationReportsPostError> =
543 serde_json::from_str(&content).ok();
544 Err(Error::ResponseError(ResponseContent {
545 status,
546 content,
547 entity,
548 }))
549 }
550}
551
552pub async fn reports_password_health_report_application_delete(
553 configuration: &configuration::Configuration,
554 drop_password_health_report_application_request: Option<
555 models::DropPasswordHealthReportApplicationRequest,
556 >,
557) -> Result<(), Error<ReportsPasswordHealthReportApplicationDeleteError>> {
558 let p_drop_password_health_report_application_request =
560 drop_password_health_report_application_request;
561
562 let uri_str = format!(
563 "{}/reports/password-health-report-application",
564 configuration.base_path
565 );
566 let mut req_builder = configuration
567 .client
568 .request(reqwest::Method::DELETE, &uri_str);
569
570 if let Some(ref user_agent) = configuration.user_agent {
571 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
572 }
573 if let Some(ref token) = configuration.oauth_access_token {
574 req_builder = req_builder.bearer_auth(token.to_owned());
575 };
576 req_builder = req_builder.json(&p_drop_password_health_report_application_request);
577
578 let req = req_builder.build()?;
579 let resp = configuration.client.execute(req).await?;
580
581 let status = resp.status();
582
583 if !status.is_client_error() && !status.is_server_error() {
584 Ok(())
585 } else {
586 let content = resp.text().await?;
587 let entity: Option<ReportsPasswordHealthReportApplicationDeleteError> =
588 serde_json::from_str(&content).ok();
589 Err(Error::ResponseError(ResponseContent {
590 status,
591 content,
592 entity,
593 }))
594 }
595}
596
597pub async fn reports_password_health_report_application_post(
598 configuration: &configuration::Configuration,
599 password_health_report_application_model: Option<models::PasswordHealthReportApplicationModel>,
600) -> Result<
601 models::PasswordHealthReportApplication,
602 Error<ReportsPasswordHealthReportApplicationPostError>,
603> {
604 let p_password_health_report_application_model = password_health_report_application_model;
606
607 let uri_str = format!(
608 "{}/reports/password-health-report-application",
609 configuration.base_path
610 );
611 let mut req_builder = configuration
612 .client
613 .request(reqwest::Method::POST, &uri_str);
614
615 if let Some(ref user_agent) = configuration.user_agent {
616 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
617 }
618 if let Some(ref token) = configuration.oauth_access_token {
619 req_builder = req_builder.bearer_auth(token.to_owned());
620 };
621 req_builder = req_builder.json(&p_password_health_report_application_model);
622
623 let req = req_builder.build()?;
624 let resp = configuration.client.execute(req).await?;
625
626 let status = resp.status();
627 let content_type = resp
628 .headers()
629 .get("content-type")
630 .and_then(|v| v.to_str().ok())
631 .unwrap_or("application/octet-stream");
632 let content_type = super::ContentType::from(content_type);
633
634 if !status.is_client_error() && !status.is_server_error() {
635 let content = resp.text().await?;
636 match content_type {
637 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
638 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PasswordHealthReportApplication`"))),
639 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::PasswordHealthReportApplication`")))),
640 }
641 } else {
642 let content = resp.text().await?;
643 let entity: Option<ReportsPasswordHealthReportApplicationPostError> =
644 serde_json::from_str(&content).ok();
645 Err(Error::ResponseError(ResponseContent {
646 status,
647 content,
648 entity,
649 }))
650 }
651}
652
653pub async fn reports_password_health_report_applications_org_id_get(
654 configuration: &configuration::Configuration,
655 org_id: uuid::Uuid,
656) -> Result<
657 Vec<models::PasswordHealthReportApplication>,
658 Error<ReportsPasswordHealthReportApplicationsOrgIdGetError>,
659> {
660 let p_org_id = org_id;
662
663 let uri_str = format!(
664 "{}/reports/password-health-report-applications/{orgId}",
665 configuration.base_path,
666 orgId = crate::apis::urlencode(p_org_id.to_string())
667 );
668 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
669
670 if let Some(ref user_agent) = configuration.user_agent {
671 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
672 }
673 if let Some(ref token) = configuration.oauth_access_token {
674 req_builder = req_builder.bearer_auth(token.to_owned());
675 };
676
677 let req = req_builder.build()?;
678 let resp = configuration.client.execute(req).await?;
679
680 let status = resp.status();
681 let content_type = resp
682 .headers()
683 .get("content-type")
684 .and_then(|v| v.to_str().ok())
685 .unwrap_or("application/octet-stream");
686 let content_type = super::ContentType::from(content_type);
687
688 if !status.is_client_error() && !status.is_server_error() {
689 let content = resp.text().await?;
690 match content_type {
691 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
692 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::PasswordHealthReportApplication>`"))),
693 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::PasswordHealthReportApplication>`")))),
694 }
695 } else {
696 let content = resp.text().await?;
697 let entity: Option<ReportsPasswordHealthReportApplicationsOrgIdGetError> =
698 serde_json::from_str(&content).ok();
699 Err(Error::ResponseError(ResponseContent {
700 status,
701 content,
702 entity,
703 }))
704 }
705}
706
707pub async fn reports_password_health_report_applications_post(
708 configuration: &configuration::Configuration,
709 password_health_report_application_model: Option<
710 Vec<models::PasswordHealthReportApplicationModel>,
711 >,
712) -> Result<
713 Vec<models::PasswordHealthReportApplication>,
714 Error<ReportsPasswordHealthReportApplicationsPostError>,
715> {
716 let p_password_health_report_application_model = password_health_report_application_model;
718
719 let uri_str = format!(
720 "{}/reports/password-health-report-applications",
721 configuration.base_path
722 );
723 let mut req_builder = configuration
724 .client
725 .request(reqwest::Method::POST, &uri_str);
726
727 if let Some(ref user_agent) = configuration.user_agent {
728 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
729 }
730 if let Some(ref token) = configuration.oauth_access_token {
731 req_builder = req_builder.bearer_auth(token.to_owned());
732 };
733 req_builder = req_builder.json(&p_password_health_report_application_model);
734
735 let req = req_builder.build()?;
736 let resp = configuration.client.execute(req).await?;
737
738 let status = resp.status();
739 let content_type = resp
740 .headers()
741 .get("content-type")
742 .and_then(|v| v.to_str().ok())
743 .unwrap_or("application/octet-stream");
744 let content_type = super::ContentType::from(content_type);
745
746 if !status.is_client_error() && !status.is_server_error() {
747 let content = resp.text().await?;
748 match content_type {
749 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
750 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::PasswordHealthReportApplication>`"))),
751 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::PasswordHealthReportApplication>`")))),
752 }
753 } else {
754 let content = resp.text().await?;
755 let entity: Option<ReportsPasswordHealthReportApplicationsPostError> =
756 serde_json::from_str(&content).ok();
757 Err(Error::ResponseError(ResponseContent {
758 status,
759 content,
760 entity,
761 }))
762 }
763}