1use 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 EventsApi: Send + Sync {
29 async fn get_cipher<'a>(
31 &self,
32 id: &'a str,
33 start: Option<String>,
34 end: Option<String>,
35 continuation_token: Option<&'a str>,
36 ) -> Result<models::EventResponseModelListResponseModel, Error<GetCipherError>>;
37
38 async fn get_organization<'a>(
40 &self,
41 id: &'a str,
42 start: Option<String>,
43 end: Option<String>,
44 continuation_token: Option<&'a str>,
45 ) -> Result<models::EventResponseModelListResponseModel, Error<GetOrganizationError>>;
46
47 async fn get_organization_user<'a>(
49 &self,
50 org_id: &'a str,
51 id: &'a str,
52 start: Option<String>,
53 end: Option<String>,
54 continuation_token: Option<&'a str>,
55 ) -> Result<models::EventResponseModelListResponseModel, Error<GetOrganizationUserError>>;
56
57 async fn get_projects<'a>(
59 &self,
60 id: uuid::Uuid,
61 org_id: uuid::Uuid,
62 start: Option<String>,
63 end: Option<String>,
64 continuation_token: Option<&'a str>,
65 ) -> Result<models::EventResponseModelListResponseModel, Error<GetProjectsError>>;
66
67 async fn get_provider<'a>(
69 &self,
70 provider_id: uuid::Uuid,
71 start: Option<String>,
72 end: Option<String>,
73 continuation_token: Option<&'a str>,
74 ) -> Result<models::EventResponseModelListResponseModel, Error<GetProviderError>>;
75
76 async fn get_provider_user<'a>(
78 &self,
79 provider_id: uuid::Uuid,
80 id: uuid::Uuid,
81 start: Option<String>,
82 end: Option<String>,
83 continuation_token: Option<&'a str>,
84 ) -> Result<models::EventResponseModelListResponseModel, Error<GetProviderUserError>>;
85
86 async fn get_secrets<'a>(
88 &self,
89 id: uuid::Uuid,
90 org_id: uuid::Uuid,
91 start: Option<String>,
92 end: Option<String>,
93 continuation_token: Option<&'a str>,
94 ) -> Result<models::EventResponseModelListResponseModel, Error<GetSecretsError>>;
95
96 async fn get_service_accounts<'a>(
98 &self,
99 org_id: uuid::Uuid,
100 id: uuid::Uuid,
101 start: Option<String>,
102 end: Option<String>,
103 continuation_token: Option<&'a str>,
104 ) -> Result<models::EventResponseModelListResponseModel, Error<GetServiceAccountsError>>;
105
106 async fn get_user<'a>(
108 &self,
109 start: Option<String>,
110 end: Option<String>,
111 continuation_token: Option<&'a str>,
112 ) -> Result<models::EventResponseModelListResponseModel, Error<GetUserError>>;
113}
114
115pub struct EventsApiClient {
116 configuration: Arc<configuration::Configuration>,
117}
118
119impl EventsApiClient {
120 pub fn new(configuration: Arc<configuration::Configuration>) -> Self {
121 Self { configuration }
122 }
123}
124
125#[cfg_attr(target_arch = "wasm32", async_trait(?Send))]
126#[cfg_attr(not(target_arch = "wasm32"), async_trait)]
127impl EventsApi for EventsApiClient {
128 async fn get_cipher<'a>(
129 &self,
130 id: &'a str,
131 start: Option<String>,
132 end: Option<String>,
133 continuation_token: Option<&'a str>,
134 ) -> Result<models::EventResponseModelListResponseModel, Error<GetCipherError>> {
135 let local_var_configuration = &self.configuration;
136
137 let local_var_client = &local_var_configuration.client;
138
139 let local_var_uri_str = format!(
140 "{}/ciphers/{id}/events",
141 local_var_configuration.base_path,
142 id = crate::apis::urlencode(id)
143 );
144 let mut local_var_req_builder =
145 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
146
147 if let Some(ref param_value) = start {
148 local_var_req_builder =
149 local_var_req_builder.query(&[("start", ¶m_value.to_string())]);
150 }
151 if let Some(ref param_value) = end {
152 local_var_req_builder =
153 local_var_req_builder.query(&[("end", ¶m_value.to_string())]);
154 }
155 if let Some(ref param_value) = continuation_token {
156 local_var_req_builder =
157 local_var_req_builder.query(&[("continuationToken", ¶m_value.to_string())]);
158 }
159 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
160
161 let local_var_resp = local_var_req_builder.send().await?;
162
163 let local_var_status = local_var_resp.status();
164 let local_var_content_type = local_var_resp
165 .headers()
166 .get("content-type")
167 .and_then(|v| v.to_str().ok())
168 .unwrap_or("application/octet-stream");
169 let local_var_content_type = super::ContentType::from(local_var_content_type);
170 let local_var_content = local_var_resp.text().await?;
171
172 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
173 match local_var_content_type {
174 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
175 ContentType::Text => {
176 return Err(Error::from(serde_json::Error::custom(
177 "Received `text/plain` content type response that cannot be converted to `models::EventResponseModelListResponseModel`",
178 )));
179 }
180 ContentType::Unsupported(local_var_unknown_type) => {
181 return Err(Error::from(serde_json::Error::custom(format!(
182 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::EventResponseModelListResponseModel`"
183 ))));
184 }
185 }
186 } else {
187 let local_var_entity: Option<GetCipherError> =
188 serde_json::from_str(&local_var_content).ok();
189 let local_var_error = ResponseContent {
190 status: local_var_status,
191 content: local_var_content,
192 entity: local_var_entity,
193 };
194 Err(Error::ResponseError(local_var_error))
195 }
196 }
197
198 async fn get_organization<'a>(
199 &self,
200 id: &'a str,
201 start: Option<String>,
202 end: Option<String>,
203 continuation_token: Option<&'a str>,
204 ) -> Result<models::EventResponseModelListResponseModel, Error<GetOrganizationError>> {
205 let local_var_configuration = &self.configuration;
206
207 let local_var_client = &local_var_configuration.client;
208
209 let local_var_uri_str = format!(
210 "{}/organizations/{id}/events",
211 local_var_configuration.base_path,
212 id = crate::apis::urlencode(id)
213 );
214 let mut local_var_req_builder =
215 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
216
217 if let Some(ref param_value) = start {
218 local_var_req_builder =
219 local_var_req_builder.query(&[("start", ¶m_value.to_string())]);
220 }
221 if let Some(ref param_value) = end {
222 local_var_req_builder =
223 local_var_req_builder.query(&[("end", ¶m_value.to_string())]);
224 }
225 if let Some(ref param_value) = continuation_token {
226 local_var_req_builder =
227 local_var_req_builder.query(&[("continuationToken", ¶m_value.to_string())]);
228 }
229 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
230
231 let local_var_resp = local_var_req_builder.send().await?;
232
233 let local_var_status = local_var_resp.status();
234 let local_var_content_type = local_var_resp
235 .headers()
236 .get("content-type")
237 .and_then(|v| v.to_str().ok())
238 .unwrap_or("application/octet-stream");
239 let local_var_content_type = super::ContentType::from(local_var_content_type);
240 let local_var_content = local_var_resp.text().await?;
241
242 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
243 match local_var_content_type {
244 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
245 ContentType::Text => {
246 return Err(Error::from(serde_json::Error::custom(
247 "Received `text/plain` content type response that cannot be converted to `models::EventResponseModelListResponseModel`",
248 )));
249 }
250 ContentType::Unsupported(local_var_unknown_type) => {
251 return Err(Error::from(serde_json::Error::custom(format!(
252 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::EventResponseModelListResponseModel`"
253 ))));
254 }
255 }
256 } else {
257 let local_var_entity: Option<GetOrganizationError> =
258 serde_json::from_str(&local_var_content).ok();
259 let local_var_error = ResponseContent {
260 status: local_var_status,
261 content: local_var_content,
262 entity: local_var_entity,
263 };
264 Err(Error::ResponseError(local_var_error))
265 }
266 }
267
268 async fn get_organization_user<'a>(
269 &self,
270 org_id: &'a str,
271 id: &'a str,
272 start: Option<String>,
273 end: Option<String>,
274 continuation_token: Option<&'a str>,
275 ) -> Result<models::EventResponseModelListResponseModel, Error<GetOrganizationUserError>> {
276 let local_var_configuration = &self.configuration;
277
278 let local_var_client = &local_var_configuration.client;
279
280 let local_var_uri_str = format!(
281 "{}/organizations/{orgId}/users/{id}/events",
282 local_var_configuration.base_path,
283 orgId = crate::apis::urlencode(org_id),
284 id = crate::apis::urlencode(id)
285 );
286 let mut local_var_req_builder =
287 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
288
289 if let Some(ref param_value) = start {
290 local_var_req_builder =
291 local_var_req_builder.query(&[("start", ¶m_value.to_string())]);
292 }
293 if let Some(ref param_value) = end {
294 local_var_req_builder =
295 local_var_req_builder.query(&[("end", ¶m_value.to_string())]);
296 }
297 if let Some(ref param_value) = continuation_token {
298 local_var_req_builder =
299 local_var_req_builder.query(&[("continuationToken", ¶m_value.to_string())]);
300 }
301 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
302
303 let local_var_resp = local_var_req_builder.send().await?;
304
305 let local_var_status = local_var_resp.status();
306 let local_var_content_type = local_var_resp
307 .headers()
308 .get("content-type")
309 .and_then(|v| v.to_str().ok())
310 .unwrap_or("application/octet-stream");
311 let local_var_content_type = super::ContentType::from(local_var_content_type);
312 let local_var_content = local_var_resp.text().await?;
313
314 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
315 match local_var_content_type {
316 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
317 ContentType::Text => {
318 return Err(Error::from(serde_json::Error::custom(
319 "Received `text/plain` content type response that cannot be converted to `models::EventResponseModelListResponseModel`",
320 )));
321 }
322 ContentType::Unsupported(local_var_unknown_type) => {
323 return Err(Error::from(serde_json::Error::custom(format!(
324 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::EventResponseModelListResponseModel`"
325 ))));
326 }
327 }
328 } else {
329 let local_var_entity: Option<GetOrganizationUserError> =
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 }
339
340 async fn get_projects<'a>(
341 &self,
342 id: uuid::Uuid,
343 org_id: uuid::Uuid,
344 start: Option<String>,
345 end: Option<String>,
346 continuation_token: Option<&'a str>,
347 ) -> Result<models::EventResponseModelListResponseModel, Error<GetProjectsError>> {
348 let local_var_configuration = &self.configuration;
349
350 let local_var_client = &local_var_configuration.client;
351
352 let local_var_uri_str = format!(
353 "{}/organization/{orgId}/projects/{id}/events",
354 local_var_configuration.base_path,
355 id = id,
356 orgId = org_id
357 );
358 let mut local_var_req_builder =
359 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
360
361 if let Some(ref param_value) = start {
362 local_var_req_builder =
363 local_var_req_builder.query(&[("start", ¶m_value.to_string())]);
364 }
365 if let Some(ref param_value) = end {
366 local_var_req_builder =
367 local_var_req_builder.query(&[("end", ¶m_value.to_string())]);
368 }
369 if let Some(ref param_value) = continuation_token {
370 local_var_req_builder =
371 local_var_req_builder.query(&[("continuationToken", ¶m_value.to_string())]);
372 }
373 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
374
375 let local_var_resp = local_var_req_builder.send().await?;
376
377 let local_var_status = local_var_resp.status();
378 let local_var_content_type = local_var_resp
379 .headers()
380 .get("content-type")
381 .and_then(|v| v.to_str().ok())
382 .unwrap_or("application/octet-stream");
383 let local_var_content_type = super::ContentType::from(local_var_content_type);
384 let local_var_content = local_var_resp.text().await?;
385
386 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
387 match local_var_content_type {
388 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
389 ContentType::Text => {
390 return Err(Error::from(serde_json::Error::custom(
391 "Received `text/plain` content type response that cannot be converted to `models::EventResponseModelListResponseModel`",
392 )));
393 }
394 ContentType::Unsupported(local_var_unknown_type) => {
395 return Err(Error::from(serde_json::Error::custom(format!(
396 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::EventResponseModelListResponseModel`"
397 ))));
398 }
399 }
400 } else {
401 let local_var_entity: Option<GetProjectsError> =
402 serde_json::from_str(&local_var_content).ok();
403 let local_var_error = ResponseContent {
404 status: local_var_status,
405 content: local_var_content,
406 entity: local_var_entity,
407 };
408 Err(Error::ResponseError(local_var_error))
409 }
410 }
411
412 async fn get_provider<'a>(
413 &self,
414 provider_id: uuid::Uuid,
415 start: Option<String>,
416 end: Option<String>,
417 continuation_token: Option<&'a str>,
418 ) -> Result<models::EventResponseModelListResponseModel, Error<GetProviderError>> {
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 "{}/providers/{providerId}/events",
425 local_var_configuration.base_path,
426 providerId = provider_id
427 );
428 let mut local_var_req_builder =
429 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
430
431 if let Some(ref param_value) = start {
432 local_var_req_builder =
433 local_var_req_builder.query(&[("start", ¶m_value.to_string())]);
434 }
435 if let Some(ref param_value) = end {
436 local_var_req_builder =
437 local_var_req_builder.query(&[("end", ¶m_value.to_string())]);
438 }
439 if let Some(ref param_value) = continuation_token {
440 local_var_req_builder =
441 local_var_req_builder.query(&[("continuationToken", ¶m_value.to_string())]);
442 }
443 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
444
445 let local_var_resp = local_var_req_builder.send().await?;
446
447 let local_var_status = local_var_resp.status();
448 let local_var_content_type = local_var_resp
449 .headers()
450 .get("content-type")
451 .and_then(|v| v.to_str().ok())
452 .unwrap_or("application/octet-stream");
453 let local_var_content_type = super::ContentType::from(local_var_content_type);
454 let local_var_content = local_var_resp.text().await?;
455
456 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
457 match local_var_content_type {
458 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
459 ContentType::Text => {
460 return Err(Error::from(serde_json::Error::custom(
461 "Received `text/plain` content type response that cannot be converted to `models::EventResponseModelListResponseModel`",
462 )));
463 }
464 ContentType::Unsupported(local_var_unknown_type) => {
465 return Err(Error::from(serde_json::Error::custom(format!(
466 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::EventResponseModelListResponseModel`"
467 ))));
468 }
469 }
470 } else {
471 let local_var_entity: Option<GetProviderError> =
472 serde_json::from_str(&local_var_content).ok();
473 let local_var_error = ResponseContent {
474 status: local_var_status,
475 content: local_var_content,
476 entity: local_var_entity,
477 };
478 Err(Error::ResponseError(local_var_error))
479 }
480 }
481
482 async fn get_provider_user<'a>(
483 &self,
484 provider_id: uuid::Uuid,
485 id: uuid::Uuid,
486 start: Option<String>,
487 end: Option<String>,
488 continuation_token: Option<&'a str>,
489 ) -> Result<models::EventResponseModelListResponseModel, Error<GetProviderUserError>> {
490 let local_var_configuration = &self.configuration;
491
492 let local_var_client = &local_var_configuration.client;
493
494 let local_var_uri_str = format!(
495 "{}/providers/{providerId}/users/{id}/events",
496 local_var_configuration.base_path,
497 providerId = provider_id,
498 id = id
499 );
500 let mut local_var_req_builder =
501 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
502
503 if let Some(ref param_value) = start {
504 local_var_req_builder =
505 local_var_req_builder.query(&[("start", ¶m_value.to_string())]);
506 }
507 if let Some(ref param_value) = end {
508 local_var_req_builder =
509 local_var_req_builder.query(&[("end", ¶m_value.to_string())]);
510 }
511 if let Some(ref param_value) = continuation_token {
512 local_var_req_builder =
513 local_var_req_builder.query(&[("continuationToken", ¶m_value.to_string())]);
514 }
515 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
516
517 let local_var_resp = local_var_req_builder.send().await?;
518
519 let local_var_status = local_var_resp.status();
520 let local_var_content_type = local_var_resp
521 .headers()
522 .get("content-type")
523 .and_then(|v| v.to_str().ok())
524 .unwrap_or("application/octet-stream");
525 let local_var_content_type = super::ContentType::from(local_var_content_type);
526 let local_var_content = local_var_resp.text().await?;
527
528 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
529 match local_var_content_type {
530 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
531 ContentType::Text => {
532 return Err(Error::from(serde_json::Error::custom(
533 "Received `text/plain` content type response that cannot be converted to `models::EventResponseModelListResponseModel`",
534 )));
535 }
536 ContentType::Unsupported(local_var_unknown_type) => {
537 return Err(Error::from(serde_json::Error::custom(format!(
538 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::EventResponseModelListResponseModel`"
539 ))));
540 }
541 }
542 } else {
543 let local_var_entity: Option<GetProviderUserError> =
544 serde_json::from_str(&local_var_content).ok();
545 let local_var_error = ResponseContent {
546 status: local_var_status,
547 content: local_var_content,
548 entity: local_var_entity,
549 };
550 Err(Error::ResponseError(local_var_error))
551 }
552 }
553
554 async fn get_secrets<'a>(
555 &self,
556 id: uuid::Uuid,
557 org_id: uuid::Uuid,
558 start: Option<String>,
559 end: Option<String>,
560 continuation_token: Option<&'a str>,
561 ) -> Result<models::EventResponseModelListResponseModel, Error<GetSecretsError>> {
562 let local_var_configuration = &self.configuration;
563
564 let local_var_client = &local_var_configuration.client;
565
566 let local_var_uri_str = format!(
567 "{}/organization/{orgId}/secrets/{id}/events",
568 local_var_configuration.base_path,
569 id = id,
570 orgId = org_id
571 );
572 let mut local_var_req_builder =
573 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
574
575 if let Some(ref param_value) = start {
576 local_var_req_builder =
577 local_var_req_builder.query(&[("start", ¶m_value.to_string())]);
578 }
579 if let Some(ref param_value) = end {
580 local_var_req_builder =
581 local_var_req_builder.query(&[("end", ¶m_value.to_string())]);
582 }
583 if let Some(ref param_value) = continuation_token {
584 local_var_req_builder =
585 local_var_req_builder.query(&[("continuationToken", ¶m_value.to_string())]);
586 }
587 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
588
589 let local_var_resp = local_var_req_builder.send().await?;
590
591 let local_var_status = local_var_resp.status();
592 let local_var_content_type = local_var_resp
593 .headers()
594 .get("content-type")
595 .and_then(|v| v.to_str().ok())
596 .unwrap_or("application/octet-stream");
597 let local_var_content_type = super::ContentType::from(local_var_content_type);
598 let local_var_content = local_var_resp.text().await?;
599
600 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
601 match local_var_content_type {
602 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
603 ContentType::Text => {
604 return Err(Error::from(serde_json::Error::custom(
605 "Received `text/plain` content type response that cannot be converted to `models::EventResponseModelListResponseModel`",
606 )));
607 }
608 ContentType::Unsupported(local_var_unknown_type) => {
609 return Err(Error::from(serde_json::Error::custom(format!(
610 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::EventResponseModelListResponseModel`"
611 ))));
612 }
613 }
614 } else {
615 let local_var_entity: Option<GetSecretsError> =
616 serde_json::from_str(&local_var_content).ok();
617 let local_var_error = ResponseContent {
618 status: local_var_status,
619 content: local_var_content,
620 entity: local_var_entity,
621 };
622 Err(Error::ResponseError(local_var_error))
623 }
624 }
625
626 async fn get_service_accounts<'a>(
627 &self,
628 org_id: uuid::Uuid,
629 id: uuid::Uuid,
630 start: Option<String>,
631 end: Option<String>,
632 continuation_token: Option<&'a str>,
633 ) -> Result<models::EventResponseModelListResponseModel, Error<GetServiceAccountsError>> {
634 let local_var_configuration = &self.configuration;
635
636 let local_var_client = &local_var_configuration.client;
637
638 let local_var_uri_str = format!(
639 "{}/organization/{orgId}/service-account/{id}/events",
640 local_var_configuration.base_path,
641 orgId = org_id,
642 id = id
643 );
644 let mut local_var_req_builder =
645 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
646
647 if let Some(ref param_value) = start {
648 local_var_req_builder =
649 local_var_req_builder.query(&[("start", ¶m_value.to_string())]);
650 }
651 if let Some(ref param_value) = end {
652 local_var_req_builder =
653 local_var_req_builder.query(&[("end", ¶m_value.to_string())]);
654 }
655 if let Some(ref param_value) = continuation_token {
656 local_var_req_builder =
657 local_var_req_builder.query(&[("continuationToken", ¶m_value.to_string())]);
658 }
659 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
660
661 let local_var_resp = local_var_req_builder.send().await?;
662
663 let local_var_status = local_var_resp.status();
664 let local_var_content_type = local_var_resp
665 .headers()
666 .get("content-type")
667 .and_then(|v| v.to_str().ok())
668 .unwrap_or("application/octet-stream");
669 let local_var_content_type = super::ContentType::from(local_var_content_type);
670 let local_var_content = local_var_resp.text().await?;
671
672 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
673 match local_var_content_type {
674 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
675 ContentType::Text => {
676 return Err(Error::from(serde_json::Error::custom(
677 "Received `text/plain` content type response that cannot be converted to `models::EventResponseModelListResponseModel`",
678 )));
679 }
680 ContentType::Unsupported(local_var_unknown_type) => {
681 return Err(Error::from(serde_json::Error::custom(format!(
682 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::EventResponseModelListResponseModel`"
683 ))));
684 }
685 }
686 } else {
687 let local_var_entity: Option<GetServiceAccountsError> =
688 serde_json::from_str(&local_var_content).ok();
689 let local_var_error = ResponseContent {
690 status: local_var_status,
691 content: local_var_content,
692 entity: local_var_entity,
693 };
694 Err(Error::ResponseError(local_var_error))
695 }
696 }
697
698 async fn get_user<'a>(
699 &self,
700 start: Option<String>,
701 end: Option<String>,
702 continuation_token: Option<&'a str>,
703 ) -> Result<models::EventResponseModelListResponseModel, Error<GetUserError>> {
704 let local_var_configuration = &self.configuration;
705
706 let local_var_client = &local_var_configuration.client;
707
708 let local_var_uri_str = format!("{}/events", local_var_configuration.base_path);
709 let mut local_var_req_builder =
710 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
711
712 if let Some(ref param_value) = start {
713 local_var_req_builder =
714 local_var_req_builder.query(&[("start", ¶m_value.to_string())]);
715 }
716 if let Some(ref param_value) = end {
717 local_var_req_builder =
718 local_var_req_builder.query(&[("end", ¶m_value.to_string())]);
719 }
720 if let Some(ref param_value) = continuation_token {
721 local_var_req_builder =
722 local_var_req_builder.query(&[("continuationToken", ¶m_value.to_string())]);
723 }
724 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
725
726 let local_var_resp = local_var_req_builder.send().await?;
727
728 let local_var_status = local_var_resp.status();
729 let local_var_content_type = local_var_resp
730 .headers()
731 .get("content-type")
732 .and_then(|v| v.to_str().ok())
733 .unwrap_or("application/octet-stream");
734 let local_var_content_type = super::ContentType::from(local_var_content_type);
735 let local_var_content = local_var_resp.text().await?;
736
737 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
738 match local_var_content_type {
739 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
740 ContentType::Text => {
741 return Err(Error::from(serde_json::Error::custom(
742 "Received `text/plain` content type response that cannot be converted to `models::EventResponseModelListResponseModel`",
743 )));
744 }
745 ContentType::Unsupported(local_var_unknown_type) => {
746 return Err(Error::from(serde_json::Error::custom(format!(
747 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::EventResponseModelListResponseModel`"
748 ))));
749 }
750 }
751 } else {
752 let local_var_entity: Option<GetUserError> =
753 serde_json::from_str(&local_var_content).ok();
754 let local_var_error = ResponseContent {
755 status: local_var_status,
756 content: local_var_content,
757 entity: local_var_entity,
758 };
759 Err(Error::ResponseError(local_var_error))
760 }
761 }
762}
763
764#[derive(Debug, Clone, Serialize, Deserialize)]
766#[serde(untagged)]
767pub enum GetCipherError {
768 UnknownValue(serde_json::Value),
769}
770#[derive(Debug, Clone, Serialize, Deserialize)]
772#[serde(untagged)]
773pub enum GetOrganizationError {
774 UnknownValue(serde_json::Value),
775}
776#[derive(Debug, Clone, Serialize, Deserialize)]
778#[serde(untagged)]
779pub enum GetOrganizationUserError {
780 UnknownValue(serde_json::Value),
781}
782#[derive(Debug, Clone, Serialize, Deserialize)]
784#[serde(untagged)]
785pub enum GetProjectsError {
786 UnknownValue(serde_json::Value),
787}
788#[derive(Debug, Clone, Serialize, Deserialize)]
790#[serde(untagged)]
791pub enum GetProviderError {
792 UnknownValue(serde_json::Value),
793}
794#[derive(Debug, Clone, Serialize, Deserialize)]
796#[serde(untagged)]
797pub enum GetProviderUserError {
798 UnknownValue(serde_json::Value),
799}
800#[derive(Debug, Clone, Serialize, Deserialize)]
802#[serde(untagged)]
803pub enum GetSecretsError {
804 UnknownValue(serde_json::Value),
805}
806#[derive(Debug, Clone, Serialize, Deserialize)]
808#[serde(untagged)]
809pub enum GetServiceAccountsError {
810 UnknownValue(serde_json::Value),
811}
812#[derive(Debug, Clone, Serialize, Deserialize)]
814#[serde(untagged)]
815pub enum GetUserError {
816 UnknownValue(serde_json::Value),
817}