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_application<'a>(
31 &self,
32 password_health_report_application_model: Option<
33 models::PasswordHealthReportApplicationModel,
34 >,
35 ) -> Result<models::PasswordHealthReportApplication, Error>;
36
37 async fn add_password_health_report_applications<'a>(
39 &self,
40 password_health_report_application_model: Option<
41 Vec<models::PasswordHealthReportApplicationModel>,
42 >,
43 ) -> Result<Vec<models::PasswordHealthReportApplication>, Error>;
44
45 async fn drop_password_health_report_application<'a>(
47 &self,
48 drop_password_health_report_application_request: Option<
49 models::DropPasswordHealthReportApplicationRequest,
50 >,
51 ) -> Result<(), Error>;
52
53 async fn get_member_access_report<'a>(
55 &self,
56 org_id: uuid::Uuid,
57 ) -> Result<Vec<models::MemberAccessDetailReportResponseModel>, Error>;
58
59 async fn get_member_cipher_details<'a>(
61 &self,
62 org_id: uuid::Uuid,
63 ) -> Result<Vec<models::MemberCipherDetailsResponseModel>, Error>;
64
65 async fn get_passkey_directory(
67 &self,
68 ) -> Result<Vec<models::PasskeyDirectoryResponseModel>, Error>;
69
70 async fn get_password_health_report_applications<'a>(
72 &self,
73 org_id: uuid::Uuid,
74 ) -> Result<Vec<models::PasswordHealthReportApplication>, Error>;
75}
76
77pub struct ReportsApiClient {
78 configuration: Arc<configuration::Configuration>,
79}
80
81impl ReportsApiClient {
82 pub fn new(configuration: Arc<configuration::Configuration>) -> Self {
83 Self { configuration }
84 }
85}
86
87#[cfg_attr(target_arch = "wasm32", async_trait(?Send))]
88#[cfg_attr(not(target_arch = "wasm32"), async_trait)]
89impl ReportsApi for ReportsApiClient {
90 async fn add_password_health_report_application<'a>(
91 &self,
92 password_health_report_application_model: Option<
93 models::PasswordHealthReportApplicationModel,
94 >,
95 ) -> Result<models::PasswordHealthReportApplication, Error> {
96 let local_var_configuration = &self.configuration;
97
98 let local_var_client = &local_var_configuration.client;
99
100 let local_var_uri_str = format!(
101 "{}/reports/password-health-report-application",
102 local_var_configuration.base_path
103 );
104 let mut local_var_req_builder =
105 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
106
107 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
108 local_var_req_builder =
109 local_var_req_builder.json(&password_health_report_application_model);
110
111 bitwarden_api_base::process_with_json_response(local_var_req_builder).await
112 }
113
114 async fn add_password_health_report_applications<'a>(
115 &self,
116 password_health_report_application_model: Option<
117 Vec<models::PasswordHealthReportApplicationModel>,
118 >,
119 ) -> Result<Vec<models::PasswordHealthReportApplication>, Error> {
120 let local_var_configuration = &self.configuration;
121
122 let local_var_client = &local_var_configuration.client;
123
124 let local_var_uri_str = format!(
125 "{}/reports/password-health-report-applications",
126 local_var_configuration.base_path
127 );
128 let mut local_var_req_builder =
129 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
130
131 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
132 local_var_req_builder =
133 local_var_req_builder.json(&password_health_report_application_model);
134
135 bitwarden_api_base::process_with_json_response(local_var_req_builder).await
136 }
137
138 async fn drop_password_health_report_application<'a>(
139 &self,
140 drop_password_health_report_application_request: Option<
141 models::DropPasswordHealthReportApplicationRequest,
142 >,
143 ) -> Result<(), Error> {
144 let local_var_configuration = &self.configuration;
145
146 let local_var_client = &local_var_configuration.client;
147
148 let local_var_uri_str = format!(
149 "{}/reports/password-health-report-application",
150 local_var_configuration.base_path
151 );
152 let mut local_var_req_builder =
153 local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
154
155 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
156 local_var_req_builder =
157 local_var_req_builder.json(&drop_password_health_report_application_request);
158
159 bitwarden_api_base::process_with_empty_response(local_var_req_builder).await
160 }
161
162 async fn get_member_access_report<'a>(
163 &self,
164 org_id: uuid::Uuid,
165 ) -> Result<Vec<models::MemberAccessDetailReportResponseModel>, Error> {
166 let local_var_configuration = &self.configuration;
167
168 let local_var_client = &local_var_configuration.client;
169
170 let local_var_uri_str = format!(
171 "{}/reports/member-access/{orgId}",
172 local_var_configuration.base_path,
173 orgId = org_id
174 );
175 let mut local_var_req_builder =
176 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
177
178 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
179
180 bitwarden_api_base::process_with_json_response(local_var_req_builder).await
181 }
182
183 async fn get_member_cipher_details<'a>(
184 &self,
185 org_id: uuid::Uuid,
186 ) -> Result<Vec<models::MemberCipherDetailsResponseModel>, Error> {
187 let local_var_configuration = &self.configuration;
188
189 let local_var_client = &local_var_configuration.client;
190
191 let local_var_uri_str = format!(
192 "{}/reports/member-cipher-details/{orgId}",
193 local_var_configuration.base_path,
194 orgId = org_id
195 );
196 let mut local_var_req_builder =
197 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
198
199 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
200
201 bitwarden_api_base::process_with_json_response(local_var_req_builder).await
202 }
203
204 async fn get_passkey_directory(
205 &self,
206 ) -> Result<Vec<models::PasskeyDirectoryResponseModel>, Error> {
207 let local_var_configuration = &self.configuration;
208
209 let local_var_client = &local_var_configuration.client;
210
211 let local_var_uri_str = format!(
212 "{}/reports/passkey-directory",
213 local_var_configuration.base_path
214 );
215 let mut local_var_req_builder =
216 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
217
218 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
219
220 bitwarden_api_base::process_with_json_response(local_var_req_builder).await
221 }
222
223 async fn get_password_health_report_applications<'a>(
224 &self,
225 org_id: uuid::Uuid,
226 ) -> Result<Vec<models::PasswordHealthReportApplication>, Error> {
227 let local_var_configuration = &self.configuration;
228
229 let local_var_client = &local_var_configuration.client;
230
231 let local_var_uri_str = format!(
232 "{}/reports/password-health-report-applications/{orgId}",
233 local_var_configuration.base_path,
234 orgId = org_id
235 );
236 let mut local_var_req_builder =
237 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
238
239 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
240
241 bitwarden_api_base::process_with_json_response(local_var_req_builder).await
242 }
243}