Skip to main content

bitwarden_api_api/apis/
reports_api.rs

1/*
2 * Bitwarden Internal API
3 *
4 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5 *
6 * The version of the OpenAPI document: latest
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11use 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    /// POST /reports/password-health-report-application
30    async fn add_password_health_report_application<'a>(
31        &self,
32        password_health_report_application_model: Option<
33            models::PasswordHealthReportApplicationModel,
34        >,
35    ) -> Result<
36        models::PasswordHealthReportApplication,
37        Error<AddPasswordHealthReportApplicationError>,
38    >;
39
40    /// POST /reports/password-health-report-applications
41    async fn add_password_health_report_applications<'a>(
42        &self,
43        password_health_report_application_model: Option<
44            Vec<models::PasswordHealthReportApplicationModel>,
45        >,
46    ) -> Result<
47        Vec<models::PasswordHealthReportApplication>,
48        Error<AddPasswordHealthReportApplicationsError>,
49    >;
50
51    /// DELETE /reports/password-health-report-application
52    async fn drop_password_health_report_application<'a>(
53        &self,
54        drop_password_health_report_application_request: Option<
55            models::DropPasswordHealthReportApplicationRequest,
56        >,
57    ) -> Result<(), Error<DropPasswordHealthReportApplicationError>>;
58
59    /// GET /reports/member-access/{orgId}
60    async fn get_member_access_report<'a>(
61        &self,
62        org_id: uuid::Uuid,
63    ) -> Result<Vec<models::MemberAccessDetailReportResponseModel>, Error<GetMemberAccessReportError>>;
64
65    /// GET /reports/member-cipher-details/{orgId}
66    async fn get_member_cipher_details<'a>(
67        &self,
68        org_id: uuid::Uuid,
69    ) -> Result<Vec<models::MemberCipherDetailsResponseModel>, Error<GetMemberCipherDetailsError>>;
70
71    /// GET /reports/password-health-report-applications/{orgId}
72    async fn get_password_health_report_applications<'a>(
73        &self,
74        org_id: uuid::Uuid,
75    ) -> Result<
76        Vec<models::PasswordHealthReportApplication>,
77        Error<GetPasswordHealthReportApplicationsError>,
78    >;
79}
80
81pub struct ReportsApiClient {
82    configuration: Arc<configuration::Configuration>,
83}
84
85impl ReportsApiClient {
86    pub fn new(configuration: Arc<configuration::Configuration>) -> Self {
87        Self { configuration }
88    }
89}
90
91#[cfg_attr(target_arch = "wasm32", async_trait(?Send))]
92#[cfg_attr(not(target_arch = "wasm32"), async_trait)]
93impl ReportsApi for ReportsApiClient {
94    async fn add_password_health_report_application<'a>(
95        &self,
96        password_health_report_application_model: Option<
97            models::PasswordHealthReportApplicationModel,
98        >,
99    ) -> Result<
100        models::PasswordHealthReportApplication,
101        Error<AddPasswordHealthReportApplicationError>,
102    > {
103        let local_var_configuration = &self.configuration;
104
105        let local_var_client = &local_var_configuration.client;
106
107        let local_var_uri_str = format!(
108            "{}/reports/password-health-report-application",
109            local_var_configuration.base_path
110        );
111        let mut local_var_req_builder =
112            local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
113
114        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
115        local_var_req_builder =
116            local_var_req_builder.json(&password_health_report_application_model);
117
118        bitwarden_api_base::process_with_json_response(local_var_req_builder).await
119    }
120
121    async fn add_password_health_report_applications<'a>(
122        &self,
123        password_health_report_application_model: Option<
124            Vec<models::PasswordHealthReportApplicationModel>,
125        >,
126    ) -> Result<
127        Vec<models::PasswordHealthReportApplication>,
128        Error<AddPasswordHealthReportApplicationsError>,
129    > {
130        let local_var_configuration = &self.configuration;
131
132        let local_var_client = &local_var_configuration.client;
133
134        let local_var_uri_str = format!(
135            "{}/reports/password-health-report-applications",
136            local_var_configuration.base_path
137        );
138        let mut local_var_req_builder =
139            local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
140
141        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
142        local_var_req_builder =
143            local_var_req_builder.json(&password_health_report_application_model);
144
145        bitwarden_api_base::process_with_json_response(local_var_req_builder).await
146    }
147
148    async fn drop_password_health_report_application<'a>(
149        &self,
150        drop_password_health_report_application_request: Option<
151            models::DropPasswordHealthReportApplicationRequest,
152        >,
153    ) -> Result<(), Error<DropPasswordHealthReportApplicationError>> {
154        let local_var_configuration = &self.configuration;
155
156        let local_var_client = &local_var_configuration.client;
157
158        let local_var_uri_str = format!(
159            "{}/reports/password-health-report-application",
160            local_var_configuration.base_path
161        );
162        let mut local_var_req_builder =
163            local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
164
165        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
166        local_var_req_builder =
167            local_var_req_builder.json(&drop_password_health_report_application_request);
168
169        bitwarden_api_base::process_with_empty_response(local_var_req_builder).await
170    }
171
172    async fn get_member_access_report<'a>(
173        &self,
174        org_id: uuid::Uuid,
175    ) -> Result<Vec<models::MemberAccessDetailReportResponseModel>, Error<GetMemberAccessReportError>>
176    {
177        let local_var_configuration = &self.configuration;
178
179        let local_var_client = &local_var_configuration.client;
180
181        let local_var_uri_str = format!(
182            "{}/reports/member-access/{orgId}",
183            local_var_configuration.base_path,
184            orgId = org_id
185        );
186        let mut local_var_req_builder =
187            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
188
189        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
190
191        bitwarden_api_base::process_with_json_response(local_var_req_builder).await
192    }
193
194    async fn get_member_cipher_details<'a>(
195        &self,
196        org_id: uuid::Uuid,
197    ) -> Result<Vec<models::MemberCipherDetailsResponseModel>, Error<GetMemberCipherDetailsError>>
198    {
199        let local_var_configuration = &self.configuration;
200
201        let local_var_client = &local_var_configuration.client;
202
203        let local_var_uri_str = format!(
204            "{}/reports/member-cipher-details/{orgId}",
205            local_var_configuration.base_path,
206            orgId = org_id
207        );
208        let mut local_var_req_builder =
209            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
210
211        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
212
213        bitwarden_api_base::process_with_json_response(local_var_req_builder).await
214    }
215
216    async fn get_password_health_report_applications<'a>(
217        &self,
218        org_id: uuid::Uuid,
219    ) -> Result<
220        Vec<models::PasswordHealthReportApplication>,
221        Error<GetPasswordHealthReportApplicationsError>,
222    > {
223        let local_var_configuration = &self.configuration;
224
225        let local_var_client = &local_var_configuration.client;
226
227        let local_var_uri_str = format!(
228            "{}/reports/password-health-report-applications/{orgId}",
229            local_var_configuration.base_path,
230            orgId = org_id
231        );
232        let mut local_var_req_builder =
233            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
234
235        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
236
237        bitwarden_api_base::process_with_json_response(local_var_req_builder).await
238    }
239}
240
241/// struct for typed errors of method [`ReportsApi::add_password_health_report_application`]
242#[derive(Debug, Clone, Serialize, Deserialize)]
243#[serde(untagged)]
244pub enum AddPasswordHealthReportApplicationError {
245    UnknownValue(serde_json::Value),
246}
247/// struct for typed errors of method [`ReportsApi::add_password_health_report_applications`]
248#[derive(Debug, Clone, Serialize, Deserialize)]
249#[serde(untagged)]
250pub enum AddPasswordHealthReportApplicationsError {
251    UnknownValue(serde_json::Value),
252}
253/// struct for typed errors of method [`ReportsApi::drop_password_health_report_application`]
254#[derive(Debug, Clone, Serialize, Deserialize)]
255#[serde(untagged)]
256pub enum DropPasswordHealthReportApplicationError {
257    UnknownValue(serde_json::Value),
258}
259/// struct for typed errors of method [`ReportsApi::get_member_access_report`]
260#[derive(Debug, Clone, Serialize, Deserialize)]
261#[serde(untagged)]
262pub enum GetMemberAccessReportError {
263    UnknownValue(serde_json::Value),
264}
265/// struct for typed errors of method [`ReportsApi::get_member_cipher_details`]
266#[derive(Debug, Clone, Serialize, Deserialize)]
267#[serde(untagged)]
268pub enum GetMemberCipherDetailsError {
269    UnknownValue(serde_json::Value),
270}
271/// struct for typed errors of method [`ReportsApi::get_password_health_report_applications`]
272#[derive(Debug, Clone, Serialize, Deserialize)]
273#[serde(untagged)]
274pub enum GetPasswordHealthReportApplicationsError {
275    UnknownValue(serde_json::Value),
276}