bitwarden_api_api/apis/
reports_api.rs1use std::sync::Arc;
12
13use async_trait::async_trait;
14#[cfg(feature = "mockall")]
15use mockall::automock;
16use reqwest;
17use serde::{Deserialize, Serialize, de::Error as _};
18
19use super::{Error, configuration};
20use crate::{
21 apis::{AuthRequired, ContentType, ResponseContent},
22 models,
23};
24
25#[cfg_attr(feature = "mockall", automock)]
26#[cfg_attr(target_arch = "wasm32", async_trait(?Send))]
27#[cfg_attr(not(target_arch = "wasm32"), async_trait)]
28pub trait ReportsApi: Send + Sync {
29 async fn add_password_health_report_applications<'a>(
31 &self,
32 password_health_report_application_model: Option<
33 Vec<models::PasswordHealthReportApplicationModel>,
34 >,
35 ) -> Result<Vec<models::PasswordHealthReportApplication>, Error>;
36
37 async fn drop_password_health_report_application<'a>(
39 &self,
40 drop_password_health_report_application_request: Option<
41 models::DropPasswordHealthReportApplicationRequest,
42 >,
43 ) -> Result<(), Error>;
44
45 async fn get_member_access_report<'a>(
47 &self,
48 org_id: uuid::Uuid,
49 ) -> Result<Vec<models::MemberAccessDetailReportResponseModel>, Error>;
50
51 async fn get_member_cipher_details<'a>(
53 &self,
54 org_id: uuid::Uuid,
55 ) -> Result<Vec<models::MemberCipherDetailsResponseModel>, Error>;
56
57 async fn get_passkey_directory(
59 &self,
60 ) -> Result<Vec<models::PasskeyDirectoryResponseModel>, Error>;
61
62 async fn get_password_health_report_applications<'a>(
64 &self,
65 org_id: uuid::Uuid,
66 ) -> Result<Vec<models::PasswordHealthReportApplication>, Error>;
67}
68
69pub struct ReportsApiClient {
70 configuration: Arc<configuration::Configuration>,
71}
72
73impl ReportsApiClient {
74 pub fn new(configuration: Arc<configuration::Configuration>) -> Self {
75 Self { configuration }
76 }
77}
78
79#[cfg_attr(target_arch = "wasm32", async_trait(?Send))]
80#[cfg_attr(not(target_arch = "wasm32"), async_trait)]
81impl ReportsApi for ReportsApiClient {
82 async fn add_password_health_report_applications<'a>(
83 &self,
84 password_health_report_application_model: Option<
85 Vec<models::PasswordHealthReportApplicationModel>,
86 >,
87 ) -> Result<Vec<models::PasswordHealthReportApplication>, Error> {
88 let local_var_configuration = &self.configuration;
89
90 let local_var_client = &local_var_configuration.client;
91
92 let local_var_uri_str = format!(
93 "{}/reports/password-health-report-applications",
94 local_var_configuration.base_path
95 );
96 let mut local_var_req_builder =
97 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
98
99 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
100 local_var_req_builder =
101 local_var_req_builder.json(&password_health_report_application_model);
102
103 bitwarden_api_base::process_with_json_response(local_var_req_builder).await
104 }
105
106 async fn drop_password_health_report_application<'a>(
107 &self,
108 drop_password_health_report_application_request: Option<
109 models::DropPasswordHealthReportApplicationRequest,
110 >,
111 ) -> Result<(), Error> {
112 let local_var_configuration = &self.configuration;
113
114 let local_var_client = &local_var_configuration.client;
115
116 let local_var_uri_str = format!(
117 "{}/reports/password-health-report-application",
118 local_var_configuration.base_path
119 );
120 let mut local_var_req_builder =
121 local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
122
123 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
124 local_var_req_builder =
125 local_var_req_builder.json(&drop_password_health_report_application_request);
126
127 bitwarden_api_base::process_with_empty_response(local_var_req_builder).await
128 }
129
130 async fn get_member_access_report<'a>(
131 &self,
132 org_id: uuid::Uuid,
133 ) -> Result<Vec<models::MemberAccessDetailReportResponseModel>, Error> {
134 let local_var_configuration = &self.configuration;
135
136 let local_var_client = &local_var_configuration.client;
137
138 let local_var_uri_str = format!(
139 "{}/reports/member-access/{orgId}",
140 local_var_configuration.base_path,
141 orgId = org_id
142 );
143 let mut local_var_req_builder =
144 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
145
146 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
147
148 bitwarden_api_base::process_with_json_response(local_var_req_builder).await
149 }
150
151 async fn get_member_cipher_details<'a>(
152 &self,
153 org_id: uuid::Uuid,
154 ) -> Result<Vec<models::MemberCipherDetailsResponseModel>, Error> {
155 let local_var_configuration = &self.configuration;
156
157 let local_var_client = &local_var_configuration.client;
158
159 let local_var_uri_str = format!(
160 "{}/reports/member-cipher-details/{orgId}",
161 local_var_configuration.base_path,
162 orgId = org_id
163 );
164 let mut local_var_req_builder =
165 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
166
167 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
168
169 bitwarden_api_base::process_with_json_response(local_var_req_builder).await
170 }
171
172 async fn get_passkey_directory(
173 &self,
174 ) -> Result<Vec<models::PasskeyDirectoryResponseModel>, Error> {
175 let local_var_configuration = &self.configuration;
176
177 let local_var_client = &local_var_configuration.client;
178
179 let local_var_uri_str = format!(
180 "{}/reports/passkey-directory",
181 local_var_configuration.base_path
182 );
183 let mut local_var_req_builder =
184 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
185
186 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
187
188 bitwarden_api_base::process_with_json_response(local_var_req_builder).await
189 }
190
191 async fn get_password_health_report_applications<'a>(
192 &self,
193 org_id: uuid::Uuid,
194 ) -> Result<Vec<models::PasswordHealthReportApplication>, Error> {
195 let local_var_configuration = &self.configuration;
196
197 let local_var_client = &local_var_configuration.client;
198
199 let local_var_uri_str = format!(
200 "{}/reports/password-health-report-applications/{orgId}",
201 local_var_configuration.base_path,
202 orgId = org_id
203 );
204 let mut local_var_req_builder =
205 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
206
207 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
208
209 bitwarden_api_base::process_with_json_response(local_var_req_builder).await
210 }
211}