1use reqwest;
12use serde::{Deserialize, Serialize};
13
14use super::{configuration, Error};
15use crate::{apis::ResponseContent, models};
16
17#[derive(Debug, Clone, Serialize, Deserialize)]
19#[serde(untagged)]
20pub enum ReportsMemberAccessOrgIdGetError {
21 UnknownValue(serde_json::Value),
22}
23
24#[derive(Debug, Clone, Serialize, Deserialize)]
26#[serde(untagged)]
27pub enum ReportsMemberCipherDetailsOrgIdGetError {
28 UnknownValue(serde_json::Value),
29}
30
31#[derive(Debug, Clone, Serialize, Deserialize)]
33#[serde(untagged)]
34pub enum ReportsPasswordHealthReportApplicationDeleteError {
35 UnknownValue(serde_json::Value),
36}
37
38#[derive(Debug, Clone, Serialize, Deserialize)]
40#[serde(untagged)]
41pub enum ReportsPasswordHealthReportApplicationPostError {
42 UnknownValue(serde_json::Value),
43}
44
45#[derive(Debug, Clone, Serialize, Deserialize)]
47#[serde(untagged)]
48pub enum ReportsPasswordHealthReportApplicationsOrgIdGetError {
49 UnknownValue(serde_json::Value),
50}
51
52#[derive(Debug, Clone, Serialize, Deserialize)]
54#[serde(untagged)]
55pub enum ReportsPasswordHealthReportApplicationsPostError {
56 UnknownValue(serde_json::Value),
57}
58
59pub async fn reports_member_access_org_id_get(
60 configuration: &configuration::Configuration,
61 org_id: uuid::Uuid,
62) -> Result<Vec<models::MemberAccessReportResponseModel>, Error<ReportsMemberAccessOrgIdGetError>> {
63 let local_var_configuration = configuration;
64
65 let local_var_client = &local_var_configuration.client;
66
67 let local_var_uri_str = format!(
68 "{}/reports/member-access/{orgId}",
69 local_var_configuration.base_path,
70 orgId = crate::apis::urlencode(org_id.to_string())
71 );
72 let mut local_var_req_builder =
73 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
74
75 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
76 local_var_req_builder =
77 local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
78 }
79 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
80 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
81 };
82
83 let local_var_req = local_var_req_builder.build()?;
84 let local_var_resp = local_var_client.execute(local_var_req).await?;
85
86 let local_var_status = local_var_resp.status();
87 let local_var_content = local_var_resp.text().await?;
88
89 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
90 serde_json::from_str(&local_var_content).map_err(Error::from)
91 } else {
92 let local_var_entity: Option<ReportsMemberAccessOrgIdGetError> =
93 serde_json::from_str(&local_var_content).ok();
94 let local_var_error = ResponseContent {
95 status: local_var_status,
96 content: local_var_content,
97 entity: local_var_entity,
98 };
99 Err(Error::ResponseError(local_var_error))
100 }
101}
102
103pub async fn reports_member_cipher_details_org_id_get(
104 configuration: &configuration::Configuration,
105 org_id: uuid::Uuid,
106) -> Result<
107 Vec<models::MemberCipherDetailsResponseModel>,
108 Error<ReportsMemberCipherDetailsOrgIdGetError>,
109> {
110 let local_var_configuration = configuration;
111
112 let local_var_client = &local_var_configuration.client;
113
114 let local_var_uri_str = format!(
115 "{}/reports/member-cipher-details/{orgId}",
116 local_var_configuration.base_path,
117 orgId = crate::apis::urlencode(org_id.to_string())
118 );
119 let mut local_var_req_builder =
120 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
121
122 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
123 local_var_req_builder =
124 local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
125 }
126 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
127 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
128 };
129
130 let local_var_req = local_var_req_builder.build()?;
131 let local_var_resp = local_var_client.execute(local_var_req).await?;
132
133 let local_var_status = local_var_resp.status();
134 let local_var_content = local_var_resp.text().await?;
135
136 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
137 serde_json::from_str(&local_var_content).map_err(Error::from)
138 } else {
139 let local_var_entity: Option<ReportsMemberCipherDetailsOrgIdGetError> =
140 serde_json::from_str(&local_var_content).ok();
141 let local_var_error = ResponseContent {
142 status: local_var_status,
143 content: local_var_content,
144 entity: local_var_entity,
145 };
146 Err(Error::ResponseError(local_var_error))
147 }
148}
149
150pub async fn reports_password_health_report_application_delete(
151 configuration: &configuration::Configuration,
152 drop_password_health_report_application_request: Option<
153 models::DropPasswordHealthReportApplicationRequest,
154 >,
155) -> Result<(), Error<ReportsPasswordHealthReportApplicationDeleteError>> {
156 let local_var_configuration = configuration;
157
158 let local_var_client = &local_var_configuration.client;
159
160 let local_var_uri_str = format!(
161 "{}/reports/password-health-report-application",
162 local_var_configuration.base_path
163 );
164 let mut local_var_req_builder =
165 local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
166
167 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
168 local_var_req_builder =
169 local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
170 }
171 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
172 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
173 };
174 local_var_req_builder =
175 local_var_req_builder.json(&drop_password_health_report_application_request);
176
177 let local_var_req = local_var_req_builder.build()?;
178 let local_var_resp = local_var_client.execute(local_var_req).await?;
179
180 let local_var_status = local_var_resp.status();
181 let local_var_content = local_var_resp.text().await?;
182
183 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
184 Ok(())
185 } else {
186 let local_var_entity: Option<ReportsPasswordHealthReportApplicationDeleteError> =
187 serde_json::from_str(&local_var_content).ok();
188 let local_var_error = ResponseContent {
189 status: local_var_status,
190 content: local_var_content,
191 entity: local_var_entity,
192 };
193 Err(Error::ResponseError(local_var_error))
194 }
195}
196
197pub async fn reports_password_health_report_application_post(
198 configuration: &configuration::Configuration,
199 password_health_report_application_model: Option<models::PasswordHealthReportApplicationModel>,
200) -> Result<
201 models::PasswordHealthReportApplication,
202 Error<ReportsPasswordHealthReportApplicationPostError>,
203> {
204 let local_var_configuration = configuration;
205
206 let local_var_client = &local_var_configuration.client;
207
208 let local_var_uri_str = format!(
209 "{}/reports/password-health-report-application",
210 local_var_configuration.base_path
211 );
212 let mut local_var_req_builder =
213 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
214
215 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
216 local_var_req_builder =
217 local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
218 }
219 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
220 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
221 };
222 local_var_req_builder = local_var_req_builder.json(&password_health_report_application_model);
223
224 let local_var_req = local_var_req_builder.build()?;
225 let local_var_resp = local_var_client.execute(local_var_req).await?;
226
227 let local_var_status = local_var_resp.status();
228 let local_var_content = local_var_resp.text().await?;
229
230 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
231 serde_json::from_str(&local_var_content).map_err(Error::from)
232 } else {
233 let local_var_entity: Option<ReportsPasswordHealthReportApplicationPostError> =
234 serde_json::from_str(&local_var_content).ok();
235 let local_var_error = ResponseContent {
236 status: local_var_status,
237 content: local_var_content,
238 entity: local_var_entity,
239 };
240 Err(Error::ResponseError(local_var_error))
241 }
242}
243
244pub async fn reports_password_health_report_applications_org_id_get(
245 configuration: &configuration::Configuration,
246 org_id: uuid::Uuid,
247) -> Result<
248 Vec<models::PasswordHealthReportApplication>,
249 Error<ReportsPasswordHealthReportApplicationsOrgIdGetError>,
250> {
251 let local_var_configuration = configuration;
252
253 let local_var_client = &local_var_configuration.client;
254
255 let local_var_uri_str = format!(
256 "{}/reports/password-health-report-applications/{orgId}",
257 local_var_configuration.base_path,
258 orgId = crate::apis::urlencode(org_id.to_string())
259 );
260 let mut local_var_req_builder =
261 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
262
263 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
264 local_var_req_builder =
265 local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
266 }
267 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
268 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
269 };
270
271 let local_var_req = local_var_req_builder.build()?;
272 let local_var_resp = local_var_client.execute(local_var_req).await?;
273
274 let local_var_status = local_var_resp.status();
275 let local_var_content = local_var_resp.text().await?;
276
277 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
278 serde_json::from_str(&local_var_content).map_err(Error::from)
279 } else {
280 let local_var_entity: Option<ReportsPasswordHealthReportApplicationsOrgIdGetError> =
281 serde_json::from_str(&local_var_content).ok();
282 let local_var_error = ResponseContent {
283 status: local_var_status,
284 content: local_var_content,
285 entity: local_var_entity,
286 };
287 Err(Error::ResponseError(local_var_error))
288 }
289}
290
291pub async fn reports_password_health_report_applications_post(
292 configuration: &configuration::Configuration,
293 password_health_report_application_model: Option<
294 Vec<models::PasswordHealthReportApplicationModel>,
295 >,
296) -> Result<
297 Vec<models::PasswordHealthReportApplication>,
298 Error<ReportsPasswordHealthReportApplicationsPostError>,
299> {
300 let local_var_configuration = configuration;
301
302 let local_var_client = &local_var_configuration.client;
303
304 let local_var_uri_str = format!(
305 "{}/reports/password-health-report-applications",
306 local_var_configuration.base_path
307 );
308 let mut local_var_req_builder =
309 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
310
311 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
312 local_var_req_builder =
313 local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
314 }
315 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
316 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
317 };
318 local_var_req_builder = local_var_req_builder.json(&password_health_report_application_model);
319
320 let local_var_req = local_var_req_builder.build()?;
321 let local_var_resp = local_var_client.execute(local_var_req).await?;
322
323 let local_var_status = local_var_resp.status();
324 let local_var_content = local_var_resp.text().await?;
325
326 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
327 serde_json::from_str(&local_var_content).map_err(Error::from)
328 } else {
329 let local_var_entity: Option<ReportsPasswordHealthReportApplicationsPostError> =
330 serde_json::from_str(&local_var_content).ok();
331 let local_var_error = ResponseContent {
332 status: local_var_status,
333 content: local_var_content,
334 entity: local_var_entity,
335 };
336 Err(Error::ResponseError(local_var_error))
337 }
338}