Skip to main content

bitwarden_api_api/apis/
organization_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 OrganizationReportsApi: Send + Sync {
29    /// POST /reports/organizations/file/validate/azure
30    async fn azure_validate_file(&self) -> Result<(), Error>;
31
32    /// POST /reports/organizations/{organizationId}
33    async fn create_organization_report<'a>(
34        &self,
35        organization_id: uuid::Uuid,
36        add_organization_report_request_model: Option<models::AddOrganizationReportRequestModel>,
37    ) -> Result<(), Error>;
38
39    /// DELETE /reports/organizations/{organizationId}/{reportId}
40    async fn delete_organization_report<'a>(
41        &self,
42        organization_id: uuid::Uuid,
43        report_id: uuid::Uuid,
44    ) -> Result<(), Error>;
45
46    /// GET /reports/organizations/{organizationId}/{reportId}/file/download
47    async fn download_report_file<'a>(
48        &self,
49        organization_id: uuid::Uuid,
50        report_id: uuid::Uuid,
51    ) -> Result<(), Error>;
52
53    /// GET /reports/organizations/{organizationId}/latest
54    async fn get_latest_organization_report<'a>(
55        &self,
56        organization_id: uuid::Uuid,
57    ) -> Result<(), Error>;
58
59    /// GET /reports/organizations/{organizationId}/{reportId}
60    async fn get_organization_report<'a>(
61        &self,
62        organization_id: uuid::Uuid,
63        report_id: uuid::Uuid,
64    ) -> Result<(), Error>;
65
66    /// GET /reports/organizations/{organizationId}/data/application/{reportId}
67    async fn get_organization_report_application_data<'a>(
68        &self,
69        organization_id: uuid::Uuid,
70        report_id: uuid::Uuid,
71    ) -> Result<(), Error>;
72
73    /// GET /reports/organizations/{organizationId}/data/summary/{reportId}
74    async fn get_organization_report_summary<'a>(
75        &self,
76        organization_id: uuid::Uuid,
77        report_id: uuid::Uuid,
78    ) -> Result<(), Error>;
79
80    /// GET /reports/organizations/{organizationId}/data/summary
81    async fn get_organization_report_summary_data_by_date_range<'a>(
82        &self,
83        organization_id: uuid::Uuid,
84        start_date: Option<String>,
85        end_date: Option<String>,
86    ) -> Result<Vec<models::OrganizationReportSummaryDataResponse>, Error>;
87
88    /// GET /reports/organizations/{organizationId}/{reportId}/file/renew
89    async fn renew_file_upload_url<'a>(
90        &self,
91        organization_id: uuid::Uuid,
92        report_id: uuid::Uuid,
93        report_file_id: Option<&'a str>,
94    ) -> Result<models::OrganizationReportFileResponseModel, Error>;
95
96    /// PATCH /reports/organizations/{organizationId}/{reportId}
97    async fn update_organization_report<'a>(
98        &self,
99        organization_id: uuid::Uuid,
100        report_id: uuid::Uuid,
101        update_organization_report_v2_request_model: Option<
102            models::UpdateOrganizationReportV2RequestModel,
103        >,
104    ) -> Result<(), Error>;
105
106    /// PATCH /reports/organizations/{organizationId}/data/application/{reportId}
107    async fn update_organization_report_application_data<'a>(
108        &self,
109        organization_id: uuid::Uuid,
110        report_id: uuid::Uuid,
111        update_organization_report_application_data_request_model: Option<
112            models::UpdateOrganizationReportApplicationDataRequestModel,
113        >,
114    ) -> Result<(), Error>;
115
116    /// PATCH /reports/organizations/{organizationId}/data/summary/{reportId}
117    async fn update_organization_report_summary<'a>(
118        &self,
119        organization_id: uuid::Uuid,
120        report_id: uuid::Uuid,
121        update_organization_report_summary_request_model: Option<
122            models::UpdateOrganizationReportSummaryRequestModel,
123        >,
124    ) -> Result<(), Error>;
125
126    /// POST /reports/organizations/{organizationId}/{reportId}/file
127    async fn upload_report_file<'a>(
128        &self,
129        organization_id: uuid::Uuid,
130        report_id: uuid::Uuid,
131        report_file_id: Option<&'a str>,
132    ) -> Result<(), Error>;
133}
134
135pub struct OrganizationReportsApiClient {
136    configuration: Arc<configuration::Configuration>,
137}
138
139impl OrganizationReportsApiClient {
140    pub fn new(configuration: Arc<configuration::Configuration>) -> Self {
141        Self { configuration }
142    }
143}
144
145#[cfg_attr(target_arch = "wasm32", async_trait(?Send))]
146#[cfg_attr(not(target_arch = "wasm32"), async_trait)]
147impl OrganizationReportsApi for OrganizationReportsApiClient {
148    async fn azure_validate_file(&self) -> Result<(), Error> {
149        let local_var_configuration = &self.configuration;
150
151        let local_var_client = &local_var_configuration.client;
152
153        let local_var_uri_str = format!(
154            "{}/reports/organizations/file/validate/azure",
155            local_var_configuration.base_path
156        );
157        let mut local_var_req_builder =
158            local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
159
160        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
161
162        bitwarden_api_base::process_with_empty_response(local_var_req_builder).await
163    }
164
165    async fn create_organization_report<'a>(
166        &self,
167        organization_id: uuid::Uuid,
168        add_organization_report_request_model: Option<models::AddOrganizationReportRequestModel>,
169    ) -> Result<(), Error> {
170        let local_var_configuration = &self.configuration;
171
172        let local_var_client = &local_var_configuration.client;
173
174        let local_var_uri_str = format!(
175            "{}/reports/organizations/{organizationId}",
176            local_var_configuration.base_path,
177            organizationId = organization_id
178        );
179        let mut local_var_req_builder =
180            local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
181
182        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
183        local_var_req_builder = local_var_req_builder.json(&add_organization_report_request_model);
184
185        bitwarden_api_base::process_with_empty_response(local_var_req_builder).await
186    }
187
188    async fn delete_organization_report<'a>(
189        &self,
190        organization_id: uuid::Uuid,
191        report_id: uuid::Uuid,
192    ) -> Result<(), Error> {
193        let local_var_configuration = &self.configuration;
194
195        let local_var_client = &local_var_configuration.client;
196
197        let local_var_uri_str = format!(
198            "{}/reports/organizations/{organizationId}/{reportId}",
199            local_var_configuration.base_path,
200            organizationId = organization_id,
201            reportId = report_id
202        );
203        let mut local_var_req_builder =
204            local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
205
206        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
207
208        bitwarden_api_base::process_with_empty_response(local_var_req_builder).await
209    }
210
211    async fn download_report_file<'a>(
212        &self,
213        organization_id: uuid::Uuid,
214        report_id: uuid::Uuid,
215    ) -> Result<(), Error> {
216        let local_var_configuration = &self.configuration;
217
218        let local_var_client = &local_var_configuration.client;
219
220        let local_var_uri_str = format!(
221            "{}/reports/organizations/{organizationId}/{reportId}/file/download",
222            local_var_configuration.base_path,
223            organizationId = organization_id,
224            reportId = report_id
225        );
226        let mut local_var_req_builder =
227            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
228
229        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
230
231        bitwarden_api_base::process_with_empty_response(local_var_req_builder).await
232    }
233
234    async fn get_latest_organization_report<'a>(
235        &self,
236        organization_id: uuid::Uuid,
237    ) -> Result<(), Error> {
238        let local_var_configuration = &self.configuration;
239
240        let local_var_client = &local_var_configuration.client;
241
242        let local_var_uri_str = format!(
243            "{}/reports/organizations/{organizationId}/latest",
244            local_var_configuration.base_path,
245            organizationId = organization_id
246        );
247        let mut local_var_req_builder =
248            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
249
250        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
251
252        bitwarden_api_base::process_with_empty_response(local_var_req_builder).await
253    }
254
255    async fn get_organization_report<'a>(
256        &self,
257        organization_id: uuid::Uuid,
258        report_id: uuid::Uuid,
259    ) -> Result<(), Error> {
260        let local_var_configuration = &self.configuration;
261
262        let local_var_client = &local_var_configuration.client;
263
264        let local_var_uri_str = format!(
265            "{}/reports/organizations/{organizationId}/{reportId}",
266            local_var_configuration.base_path,
267            organizationId = organization_id,
268            reportId = report_id
269        );
270        let mut local_var_req_builder =
271            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
272
273        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
274
275        bitwarden_api_base::process_with_empty_response(local_var_req_builder).await
276    }
277
278    async fn get_organization_report_application_data<'a>(
279        &self,
280        organization_id: uuid::Uuid,
281        report_id: uuid::Uuid,
282    ) -> Result<(), Error> {
283        let local_var_configuration = &self.configuration;
284
285        let local_var_client = &local_var_configuration.client;
286
287        let local_var_uri_str = format!(
288            "{}/reports/organizations/{organizationId}/data/application/{reportId}",
289            local_var_configuration.base_path,
290            organizationId = organization_id,
291            reportId = report_id
292        );
293        let mut local_var_req_builder =
294            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
295
296        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
297
298        bitwarden_api_base::process_with_empty_response(local_var_req_builder).await
299    }
300
301    async fn get_organization_report_summary<'a>(
302        &self,
303        organization_id: uuid::Uuid,
304        report_id: uuid::Uuid,
305    ) -> Result<(), Error> {
306        let local_var_configuration = &self.configuration;
307
308        let local_var_client = &local_var_configuration.client;
309
310        let local_var_uri_str = format!(
311            "{}/reports/organizations/{organizationId}/data/summary/{reportId}",
312            local_var_configuration.base_path,
313            organizationId = organization_id,
314            reportId = report_id
315        );
316        let mut local_var_req_builder =
317            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
318
319        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
320
321        bitwarden_api_base::process_with_empty_response(local_var_req_builder).await
322    }
323
324    async fn get_organization_report_summary_data_by_date_range<'a>(
325        &self,
326        organization_id: uuid::Uuid,
327        start_date: Option<String>,
328        end_date: Option<String>,
329    ) -> Result<Vec<models::OrganizationReportSummaryDataResponse>, Error> {
330        let local_var_configuration = &self.configuration;
331
332        let local_var_client = &local_var_configuration.client;
333
334        let local_var_uri_str = format!(
335            "{}/reports/organizations/{organizationId}/data/summary",
336            local_var_configuration.base_path,
337            organizationId = organization_id
338        );
339        let mut local_var_req_builder =
340            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
341
342        if let Some(ref param_value) = start_date {
343            local_var_req_builder =
344                local_var_req_builder.query(&[("startDate", &param_value.to_string())]);
345        }
346        if let Some(ref param_value) = end_date {
347            local_var_req_builder =
348                local_var_req_builder.query(&[("endDate", &param_value.to_string())]);
349        }
350        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
351
352        bitwarden_api_base::process_with_json_response(local_var_req_builder).await
353    }
354
355    async fn renew_file_upload_url<'a>(
356        &self,
357        organization_id: uuid::Uuid,
358        report_id: uuid::Uuid,
359        report_file_id: Option<&'a str>,
360    ) -> Result<models::OrganizationReportFileResponseModel, Error> {
361        let local_var_configuration = &self.configuration;
362
363        let local_var_client = &local_var_configuration.client;
364
365        let local_var_uri_str = format!(
366            "{}/reports/organizations/{organizationId}/{reportId}/file/renew",
367            local_var_configuration.base_path,
368            organizationId = organization_id,
369            reportId = report_id
370        );
371        let mut local_var_req_builder =
372            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
373
374        if let Some(ref param_value) = report_file_id {
375            local_var_req_builder =
376                local_var_req_builder.query(&[("reportFileId", &param_value.to_string())]);
377        }
378        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
379
380        bitwarden_api_base::process_with_json_response(local_var_req_builder).await
381    }
382
383    async fn update_organization_report<'a>(
384        &self,
385        organization_id: uuid::Uuid,
386        report_id: uuid::Uuid,
387        update_organization_report_v2_request_model: Option<
388            models::UpdateOrganizationReportV2RequestModel,
389        >,
390    ) -> Result<(), Error> {
391        let local_var_configuration = &self.configuration;
392
393        let local_var_client = &local_var_configuration.client;
394
395        let local_var_uri_str = format!(
396            "{}/reports/organizations/{organizationId}/{reportId}",
397            local_var_configuration.base_path,
398            organizationId = organization_id,
399            reportId = report_id
400        );
401        let mut local_var_req_builder =
402            local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
403
404        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
405        local_var_req_builder =
406            local_var_req_builder.json(&update_organization_report_v2_request_model);
407
408        bitwarden_api_base::process_with_empty_response(local_var_req_builder).await
409    }
410
411    async fn update_organization_report_application_data<'a>(
412        &self,
413        organization_id: uuid::Uuid,
414        report_id: uuid::Uuid,
415        update_organization_report_application_data_request_model: Option<
416            models::UpdateOrganizationReportApplicationDataRequestModel,
417        >,
418    ) -> Result<(), Error> {
419        let local_var_configuration = &self.configuration;
420
421        let local_var_client = &local_var_configuration.client;
422
423        let local_var_uri_str = format!(
424            "{}/reports/organizations/{organizationId}/data/application/{reportId}",
425            local_var_configuration.base_path,
426            organizationId = organization_id,
427            reportId = report_id
428        );
429        let mut local_var_req_builder =
430            local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
431
432        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
433        local_var_req_builder =
434            local_var_req_builder.json(&update_organization_report_application_data_request_model);
435
436        bitwarden_api_base::process_with_empty_response(local_var_req_builder).await
437    }
438
439    async fn update_organization_report_summary<'a>(
440        &self,
441        organization_id: uuid::Uuid,
442        report_id: uuid::Uuid,
443        update_organization_report_summary_request_model: Option<
444            models::UpdateOrganizationReportSummaryRequestModel,
445        >,
446    ) -> Result<(), Error> {
447        let local_var_configuration = &self.configuration;
448
449        let local_var_client = &local_var_configuration.client;
450
451        let local_var_uri_str = format!(
452            "{}/reports/organizations/{organizationId}/data/summary/{reportId}",
453            local_var_configuration.base_path,
454            organizationId = organization_id,
455            reportId = report_id
456        );
457        let mut local_var_req_builder =
458            local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
459
460        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
461        local_var_req_builder =
462            local_var_req_builder.json(&update_organization_report_summary_request_model);
463
464        bitwarden_api_base::process_with_empty_response(local_var_req_builder).await
465    }
466
467    async fn upload_report_file<'a>(
468        &self,
469        organization_id: uuid::Uuid,
470        report_id: uuid::Uuid,
471        report_file_id: Option<&'a str>,
472    ) -> Result<(), Error> {
473        let local_var_configuration = &self.configuration;
474
475        let local_var_client = &local_var_configuration.client;
476
477        let local_var_uri_str = format!(
478            "{}/reports/organizations/{organizationId}/{reportId}/file",
479            local_var_configuration.base_path,
480            organizationId = organization_id,
481            reportId = report_id
482        );
483        let mut local_var_req_builder =
484            local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
485
486        if let Some(ref param_value) = report_file_id {
487            local_var_req_builder =
488                local_var_req_builder.query(&[("reportFileId", &param_value.to_string())]);
489        }
490        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
491
492        bitwarden_api_base::process_with_empty_response(local_var_req_builder).await
493    }
494}