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