bitwarden_api_api/apis/
events_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 EventsApi: Send + Sync {
29    /// GET /ciphers/{id}/events
30    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    /// GET /organizations/{id}/events
39    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    /// GET /organizations/{orgId}/users/{id}/events
48    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    /// GET /organization/{orgId}/projects/{id}/events
58    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    /// GET /providers/{providerId}/events
68    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    /// GET /providers/{providerId}/users/{id}/events
77    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    /// GET /organization/{orgId}/secrets/{id}/events
87    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    /// GET /organization/{orgId}/service-account/{id}/events
97    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    /// GET /events
107    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", &param_value.to_string())]);
150        }
151        if let Some(ref param_value) = end {
152            local_var_req_builder =
153                local_var_req_builder.query(&[("end", &param_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", &param_value.to_string())]);
158        }
159        if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
160            local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
161        };
162        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
163
164        let local_var_req = local_var_req_builder.build()?;
165        let local_var_resp = local_var_client.execute(local_var_req).await?;
166
167        let local_var_status = local_var_resp.status();
168        let local_var_content_type = local_var_resp
169            .headers()
170            .get("content-type")
171            .and_then(|v| v.to_str().ok())
172            .unwrap_or("application/octet-stream");
173        let local_var_content_type = super::ContentType::from(local_var_content_type);
174        let local_var_content = local_var_resp.text().await?;
175
176        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
177            match local_var_content_type {
178                ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
179                ContentType::Text => {
180                    return Err(Error::from(serde_json::Error::custom(
181                        "Received `text/plain` content type response that cannot be converted to `models::EventResponseModelListResponseModel`",
182                    )));
183                }
184                ContentType::Unsupported(local_var_unknown_type) => {
185                    return Err(Error::from(serde_json::Error::custom(format!(
186                        "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::EventResponseModelListResponseModel`"
187                    ))));
188                }
189            }
190        } else {
191            let local_var_entity: Option<GetCipherError> =
192                serde_json::from_str(&local_var_content).ok();
193            let local_var_error = ResponseContent {
194                status: local_var_status,
195                content: local_var_content,
196                entity: local_var_entity,
197            };
198            Err(Error::ResponseError(local_var_error))
199        }
200    }
201
202    async fn get_organization<'a>(
203        &self,
204        id: &'a str,
205        start: Option<String>,
206        end: Option<String>,
207        continuation_token: Option<&'a str>,
208    ) -> Result<models::EventResponseModelListResponseModel, Error<GetOrganizationError>> {
209        let local_var_configuration = &self.configuration;
210
211        let local_var_client = &local_var_configuration.client;
212
213        let local_var_uri_str = format!(
214            "{}/organizations/{id}/events",
215            local_var_configuration.base_path,
216            id = crate::apis::urlencode(id)
217        );
218        let mut local_var_req_builder =
219            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
220
221        if let Some(ref param_value) = start {
222            local_var_req_builder =
223                local_var_req_builder.query(&[("start", &param_value.to_string())]);
224        }
225        if let Some(ref param_value) = end {
226            local_var_req_builder =
227                local_var_req_builder.query(&[("end", &param_value.to_string())]);
228        }
229        if let Some(ref param_value) = continuation_token {
230            local_var_req_builder =
231                local_var_req_builder.query(&[("continuationToken", &param_value.to_string())]);
232        }
233        if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
234            local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
235        };
236        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
237
238        let local_var_req = local_var_req_builder.build()?;
239        let local_var_resp = local_var_client.execute(local_var_req).await?;
240
241        let local_var_status = local_var_resp.status();
242        let local_var_content_type = local_var_resp
243            .headers()
244            .get("content-type")
245            .and_then(|v| v.to_str().ok())
246            .unwrap_or("application/octet-stream");
247        let local_var_content_type = super::ContentType::from(local_var_content_type);
248        let local_var_content = local_var_resp.text().await?;
249
250        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
251            match local_var_content_type {
252                ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
253                ContentType::Text => {
254                    return Err(Error::from(serde_json::Error::custom(
255                        "Received `text/plain` content type response that cannot be converted to `models::EventResponseModelListResponseModel`",
256                    )));
257                }
258                ContentType::Unsupported(local_var_unknown_type) => {
259                    return Err(Error::from(serde_json::Error::custom(format!(
260                        "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::EventResponseModelListResponseModel`"
261                    ))));
262                }
263            }
264        } else {
265            let local_var_entity: Option<GetOrganizationError> =
266                serde_json::from_str(&local_var_content).ok();
267            let local_var_error = ResponseContent {
268                status: local_var_status,
269                content: local_var_content,
270                entity: local_var_entity,
271            };
272            Err(Error::ResponseError(local_var_error))
273        }
274    }
275
276    async fn get_organization_user<'a>(
277        &self,
278        org_id: &'a str,
279        id: &'a str,
280        start: Option<String>,
281        end: Option<String>,
282        continuation_token: Option<&'a str>,
283    ) -> Result<models::EventResponseModelListResponseModel, Error<GetOrganizationUserError>> {
284        let local_var_configuration = &self.configuration;
285
286        let local_var_client = &local_var_configuration.client;
287
288        let local_var_uri_str = format!(
289            "{}/organizations/{orgId}/users/{id}/events",
290            local_var_configuration.base_path,
291            orgId = crate::apis::urlencode(org_id),
292            id = crate::apis::urlencode(id)
293        );
294        let mut local_var_req_builder =
295            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
296
297        if let Some(ref param_value) = start {
298            local_var_req_builder =
299                local_var_req_builder.query(&[("start", &param_value.to_string())]);
300        }
301        if let Some(ref param_value) = end {
302            local_var_req_builder =
303                local_var_req_builder.query(&[("end", &param_value.to_string())]);
304        }
305        if let Some(ref param_value) = continuation_token {
306            local_var_req_builder =
307                local_var_req_builder.query(&[("continuationToken", &param_value.to_string())]);
308        }
309        if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
310            local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
311        };
312        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
313
314        let local_var_req = local_var_req_builder.build()?;
315        let local_var_resp = local_var_client.execute(local_var_req).await?;
316
317        let local_var_status = local_var_resp.status();
318        let local_var_content_type = local_var_resp
319            .headers()
320            .get("content-type")
321            .and_then(|v| v.to_str().ok())
322            .unwrap_or("application/octet-stream");
323        let local_var_content_type = super::ContentType::from(local_var_content_type);
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            match local_var_content_type {
328                ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
329                ContentType::Text => {
330                    return Err(Error::from(serde_json::Error::custom(
331                        "Received `text/plain` content type response that cannot be converted to `models::EventResponseModelListResponseModel`",
332                    )));
333                }
334                ContentType::Unsupported(local_var_unknown_type) => {
335                    return Err(Error::from(serde_json::Error::custom(format!(
336                        "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::EventResponseModelListResponseModel`"
337                    ))));
338                }
339            }
340        } else {
341            let local_var_entity: Option<GetOrganizationUserError> =
342                serde_json::from_str(&local_var_content).ok();
343            let local_var_error = ResponseContent {
344                status: local_var_status,
345                content: local_var_content,
346                entity: local_var_entity,
347            };
348            Err(Error::ResponseError(local_var_error))
349        }
350    }
351
352    async fn get_projects<'a>(
353        &self,
354        id: uuid::Uuid,
355        org_id: uuid::Uuid,
356        start: Option<String>,
357        end: Option<String>,
358        continuation_token: Option<&'a str>,
359    ) -> Result<models::EventResponseModelListResponseModel, Error<GetProjectsError>> {
360        let local_var_configuration = &self.configuration;
361
362        let local_var_client = &local_var_configuration.client;
363
364        let local_var_uri_str = format!(
365            "{}/organization/{orgId}/projects/{id}/events",
366            local_var_configuration.base_path,
367            id = id,
368            orgId = org_id
369        );
370        let mut local_var_req_builder =
371            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
372
373        if let Some(ref param_value) = start {
374            local_var_req_builder =
375                local_var_req_builder.query(&[("start", &param_value.to_string())]);
376        }
377        if let Some(ref param_value) = end {
378            local_var_req_builder =
379                local_var_req_builder.query(&[("end", &param_value.to_string())]);
380        }
381        if let Some(ref param_value) = continuation_token {
382            local_var_req_builder =
383                local_var_req_builder.query(&[("continuationToken", &param_value.to_string())]);
384        }
385        if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
386            local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
387        };
388        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
389
390        let local_var_req = local_var_req_builder.build()?;
391        let local_var_resp = local_var_client.execute(local_var_req).await?;
392
393        let local_var_status = local_var_resp.status();
394        let local_var_content_type = local_var_resp
395            .headers()
396            .get("content-type")
397            .and_then(|v| v.to_str().ok())
398            .unwrap_or("application/octet-stream");
399        let local_var_content_type = super::ContentType::from(local_var_content_type);
400        let local_var_content = local_var_resp.text().await?;
401
402        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
403            match local_var_content_type {
404                ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
405                ContentType::Text => {
406                    return Err(Error::from(serde_json::Error::custom(
407                        "Received `text/plain` content type response that cannot be converted to `models::EventResponseModelListResponseModel`",
408                    )));
409                }
410                ContentType::Unsupported(local_var_unknown_type) => {
411                    return Err(Error::from(serde_json::Error::custom(format!(
412                        "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::EventResponseModelListResponseModel`"
413                    ))));
414                }
415            }
416        } else {
417            let local_var_entity: Option<GetProjectsError> =
418                serde_json::from_str(&local_var_content).ok();
419            let local_var_error = ResponseContent {
420                status: local_var_status,
421                content: local_var_content,
422                entity: local_var_entity,
423            };
424            Err(Error::ResponseError(local_var_error))
425        }
426    }
427
428    async fn get_provider<'a>(
429        &self,
430        provider_id: uuid::Uuid,
431        start: Option<String>,
432        end: Option<String>,
433        continuation_token: Option<&'a str>,
434    ) -> Result<models::EventResponseModelListResponseModel, Error<GetProviderError>> {
435        let local_var_configuration = &self.configuration;
436
437        let local_var_client = &local_var_configuration.client;
438
439        let local_var_uri_str = format!(
440            "{}/providers/{providerId}/events",
441            local_var_configuration.base_path,
442            providerId = provider_id
443        );
444        let mut local_var_req_builder =
445            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
446
447        if let Some(ref param_value) = start {
448            local_var_req_builder =
449                local_var_req_builder.query(&[("start", &param_value.to_string())]);
450        }
451        if let Some(ref param_value) = end {
452            local_var_req_builder =
453                local_var_req_builder.query(&[("end", &param_value.to_string())]);
454        }
455        if let Some(ref param_value) = continuation_token {
456            local_var_req_builder =
457                local_var_req_builder.query(&[("continuationToken", &param_value.to_string())]);
458        }
459        if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
460            local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
461        };
462        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
463
464        let local_var_req = local_var_req_builder.build()?;
465        let local_var_resp = local_var_client.execute(local_var_req).await?;
466
467        let local_var_status = local_var_resp.status();
468        let local_var_content_type = local_var_resp
469            .headers()
470            .get("content-type")
471            .and_then(|v| v.to_str().ok())
472            .unwrap_or("application/octet-stream");
473        let local_var_content_type = super::ContentType::from(local_var_content_type);
474        let local_var_content = local_var_resp.text().await?;
475
476        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
477            match local_var_content_type {
478                ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
479                ContentType::Text => {
480                    return Err(Error::from(serde_json::Error::custom(
481                        "Received `text/plain` content type response that cannot be converted to `models::EventResponseModelListResponseModel`",
482                    )));
483                }
484                ContentType::Unsupported(local_var_unknown_type) => {
485                    return Err(Error::from(serde_json::Error::custom(format!(
486                        "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::EventResponseModelListResponseModel`"
487                    ))));
488                }
489            }
490        } else {
491            let local_var_entity: Option<GetProviderError> =
492                serde_json::from_str(&local_var_content).ok();
493            let local_var_error = ResponseContent {
494                status: local_var_status,
495                content: local_var_content,
496                entity: local_var_entity,
497            };
498            Err(Error::ResponseError(local_var_error))
499        }
500    }
501
502    async fn get_provider_user<'a>(
503        &self,
504        provider_id: uuid::Uuid,
505        id: uuid::Uuid,
506        start: Option<String>,
507        end: Option<String>,
508        continuation_token: Option<&'a str>,
509    ) -> Result<models::EventResponseModelListResponseModel, Error<GetProviderUserError>> {
510        let local_var_configuration = &self.configuration;
511
512        let local_var_client = &local_var_configuration.client;
513
514        let local_var_uri_str = format!(
515            "{}/providers/{providerId}/users/{id}/events",
516            local_var_configuration.base_path,
517            providerId = provider_id,
518            id = id
519        );
520        let mut local_var_req_builder =
521            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
522
523        if let Some(ref param_value) = start {
524            local_var_req_builder =
525                local_var_req_builder.query(&[("start", &param_value.to_string())]);
526        }
527        if let Some(ref param_value) = end {
528            local_var_req_builder =
529                local_var_req_builder.query(&[("end", &param_value.to_string())]);
530        }
531        if let Some(ref param_value) = continuation_token {
532            local_var_req_builder =
533                local_var_req_builder.query(&[("continuationToken", &param_value.to_string())]);
534        }
535        if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
536            local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
537        };
538        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
539
540        let local_var_req = local_var_req_builder.build()?;
541        let local_var_resp = local_var_client.execute(local_var_req).await?;
542
543        let local_var_status = local_var_resp.status();
544        let local_var_content_type = local_var_resp
545            .headers()
546            .get("content-type")
547            .and_then(|v| v.to_str().ok())
548            .unwrap_or("application/octet-stream");
549        let local_var_content_type = super::ContentType::from(local_var_content_type);
550        let local_var_content = local_var_resp.text().await?;
551
552        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
553            match local_var_content_type {
554                ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
555                ContentType::Text => {
556                    return Err(Error::from(serde_json::Error::custom(
557                        "Received `text/plain` content type response that cannot be converted to `models::EventResponseModelListResponseModel`",
558                    )));
559                }
560                ContentType::Unsupported(local_var_unknown_type) => {
561                    return Err(Error::from(serde_json::Error::custom(format!(
562                        "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::EventResponseModelListResponseModel`"
563                    ))));
564                }
565            }
566        } else {
567            let local_var_entity: Option<GetProviderUserError> =
568                serde_json::from_str(&local_var_content).ok();
569            let local_var_error = ResponseContent {
570                status: local_var_status,
571                content: local_var_content,
572                entity: local_var_entity,
573            };
574            Err(Error::ResponseError(local_var_error))
575        }
576    }
577
578    async fn get_secrets<'a>(
579        &self,
580        id: uuid::Uuid,
581        org_id: uuid::Uuid,
582        start: Option<String>,
583        end: Option<String>,
584        continuation_token: Option<&'a str>,
585    ) -> Result<models::EventResponseModelListResponseModel, Error<GetSecretsError>> {
586        let local_var_configuration = &self.configuration;
587
588        let local_var_client = &local_var_configuration.client;
589
590        let local_var_uri_str = format!(
591            "{}/organization/{orgId}/secrets/{id}/events",
592            local_var_configuration.base_path,
593            id = id,
594            orgId = org_id
595        );
596        let mut local_var_req_builder =
597            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
598
599        if let Some(ref param_value) = start {
600            local_var_req_builder =
601                local_var_req_builder.query(&[("start", &param_value.to_string())]);
602        }
603        if let Some(ref param_value) = end {
604            local_var_req_builder =
605                local_var_req_builder.query(&[("end", &param_value.to_string())]);
606        }
607        if let Some(ref param_value) = continuation_token {
608            local_var_req_builder =
609                local_var_req_builder.query(&[("continuationToken", &param_value.to_string())]);
610        }
611        if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
612            local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
613        };
614        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
615
616        let local_var_req = local_var_req_builder.build()?;
617        let local_var_resp = local_var_client.execute(local_var_req).await?;
618
619        let local_var_status = local_var_resp.status();
620        let local_var_content_type = local_var_resp
621            .headers()
622            .get("content-type")
623            .and_then(|v| v.to_str().ok())
624            .unwrap_or("application/octet-stream");
625        let local_var_content_type = super::ContentType::from(local_var_content_type);
626        let local_var_content = local_var_resp.text().await?;
627
628        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
629            match local_var_content_type {
630                ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
631                ContentType::Text => {
632                    return Err(Error::from(serde_json::Error::custom(
633                        "Received `text/plain` content type response that cannot be converted to `models::EventResponseModelListResponseModel`",
634                    )));
635                }
636                ContentType::Unsupported(local_var_unknown_type) => {
637                    return Err(Error::from(serde_json::Error::custom(format!(
638                        "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::EventResponseModelListResponseModel`"
639                    ))));
640                }
641            }
642        } else {
643            let local_var_entity: Option<GetSecretsError> =
644                serde_json::from_str(&local_var_content).ok();
645            let local_var_error = ResponseContent {
646                status: local_var_status,
647                content: local_var_content,
648                entity: local_var_entity,
649            };
650            Err(Error::ResponseError(local_var_error))
651        }
652    }
653
654    async fn get_service_accounts<'a>(
655        &self,
656        org_id: uuid::Uuid,
657        id: uuid::Uuid,
658        start: Option<String>,
659        end: Option<String>,
660        continuation_token: Option<&'a str>,
661    ) -> Result<models::EventResponseModelListResponseModel, Error<GetServiceAccountsError>> {
662        let local_var_configuration = &self.configuration;
663
664        let local_var_client = &local_var_configuration.client;
665
666        let local_var_uri_str = format!(
667            "{}/organization/{orgId}/service-account/{id}/events",
668            local_var_configuration.base_path,
669            orgId = org_id,
670            id = id
671        );
672        let mut local_var_req_builder =
673            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
674
675        if let Some(ref param_value) = start {
676            local_var_req_builder =
677                local_var_req_builder.query(&[("start", &param_value.to_string())]);
678        }
679        if let Some(ref param_value) = end {
680            local_var_req_builder =
681                local_var_req_builder.query(&[("end", &param_value.to_string())]);
682        }
683        if let Some(ref param_value) = continuation_token {
684            local_var_req_builder =
685                local_var_req_builder.query(&[("continuationToken", &param_value.to_string())]);
686        }
687        if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
688            local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
689        };
690        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
691
692        let local_var_req = local_var_req_builder.build()?;
693        let local_var_resp = local_var_client.execute(local_var_req).await?;
694
695        let local_var_status = local_var_resp.status();
696        let local_var_content_type = local_var_resp
697            .headers()
698            .get("content-type")
699            .and_then(|v| v.to_str().ok())
700            .unwrap_or("application/octet-stream");
701        let local_var_content_type = super::ContentType::from(local_var_content_type);
702        let local_var_content = local_var_resp.text().await?;
703
704        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
705            match local_var_content_type {
706                ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
707                ContentType::Text => {
708                    return Err(Error::from(serde_json::Error::custom(
709                        "Received `text/plain` content type response that cannot be converted to `models::EventResponseModelListResponseModel`",
710                    )));
711                }
712                ContentType::Unsupported(local_var_unknown_type) => {
713                    return Err(Error::from(serde_json::Error::custom(format!(
714                        "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::EventResponseModelListResponseModel`"
715                    ))));
716                }
717            }
718        } else {
719            let local_var_entity: Option<GetServiceAccountsError> =
720                serde_json::from_str(&local_var_content).ok();
721            let local_var_error = ResponseContent {
722                status: local_var_status,
723                content: local_var_content,
724                entity: local_var_entity,
725            };
726            Err(Error::ResponseError(local_var_error))
727        }
728    }
729
730    async fn get_user<'a>(
731        &self,
732        start: Option<String>,
733        end: Option<String>,
734        continuation_token: Option<&'a str>,
735    ) -> Result<models::EventResponseModelListResponseModel, Error<GetUserError>> {
736        let local_var_configuration = &self.configuration;
737
738        let local_var_client = &local_var_configuration.client;
739
740        let local_var_uri_str = format!("{}/events", local_var_configuration.base_path);
741        let mut local_var_req_builder =
742            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
743
744        if let Some(ref param_value) = start {
745            local_var_req_builder =
746                local_var_req_builder.query(&[("start", &param_value.to_string())]);
747        }
748        if let Some(ref param_value) = end {
749            local_var_req_builder =
750                local_var_req_builder.query(&[("end", &param_value.to_string())]);
751        }
752        if let Some(ref param_value) = continuation_token {
753            local_var_req_builder =
754                local_var_req_builder.query(&[("continuationToken", &param_value.to_string())]);
755        }
756        if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
757            local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
758        };
759        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
760
761        let local_var_req = local_var_req_builder.build()?;
762        let local_var_resp = local_var_client.execute(local_var_req).await?;
763
764        let local_var_status = local_var_resp.status();
765        let local_var_content_type = local_var_resp
766            .headers()
767            .get("content-type")
768            .and_then(|v| v.to_str().ok())
769            .unwrap_or("application/octet-stream");
770        let local_var_content_type = super::ContentType::from(local_var_content_type);
771        let local_var_content = local_var_resp.text().await?;
772
773        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
774            match local_var_content_type {
775                ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
776                ContentType::Text => {
777                    return Err(Error::from(serde_json::Error::custom(
778                        "Received `text/plain` content type response that cannot be converted to `models::EventResponseModelListResponseModel`",
779                    )));
780                }
781                ContentType::Unsupported(local_var_unknown_type) => {
782                    return Err(Error::from(serde_json::Error::custom(format!(
783                        "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::EventResponseModelListResponseModel`"
784                    ))));
785                }
786            }
787        } else {
788            let local_var_entity: Option<GetUserError> =
789                serde_json::from_str(&local_var_content).ok();
790            let local_var_error = ResponseContent {
791                status: local_var_status,
792                content: local_var_content,
793                entity: local_var_entity,
794            };
795            Err(Error::ResponseError(local_var_error))
796        }
797    }
798}
799
800/// struct for typed errors of method [`EventsApi::get_cipher`]
801#[derive(Debug, Clone, Serialize, Deserialize)]
802#[serde(untagged)]
803pub enum GetCipherError {
804    UnknownValue(serde_json::Value),
805}
806/// struct for typed errors of method [`EventsApi::get_organization`]
807#[derive(Debug, Clone, Serialize, Deserialize)]
808#[serde(untagged)]
809pub enum GetOrganizationError {
810    UnknownValue(serde_json::Value),
811}
812/// struct for typed errors of method [`EventsApi::get_organization_user`]
813#[derive(Debug, Clone, Serialize, Deserialize)]
814#[serde(untagged)]
815pub enum GetOrganizationUserError {
816    UnknownValue(serde_json::Value),
817}
818/// struct for typed errors of method [`EventsApi::get_projects`]
819#[derive(Debug, Clone, Serialize, Deserialize)]
820#[serde(untagged)]
821pub enum GetProjectsError {
822    UnknownValue(serde_json::Value),
823}
824/// struct for typed errors of method [`EventsApi::get_provider`]
825#[derive(Debug, Clone, Serialize, Deserialize)]
826#[serde(untagged)]
827pub enum GetProviderError {
828    UnknownValue(serde_json::Value),
829}
830/// struct for typed errors of method [`EventsApi::get_provider_user`]
831#[derive(Debug, Clone, Serialize, Deserialize)]
832#[serde(untagged)]
833pub enum GetProviderUserError {
834    UnknownValue(serde_json::Value),
835}
836/// struct for typed errors of method [`EventsApi::get_secrets`]
837#[derive(Debug, Clone, Serialize, Deserialize)]
838#[serde(untagged)]
839pub enum GetSecretsError {
840    UnknownValue(serde_json::Value),
841}
842/// struct for typed errors of method [`EventsApi::get_service_accounts`]
843#[derive(Debug, Clone, Serialize, Deserialize)]
844#[serde(untagged)]
845pub enum GetServiceAccountsError {
846    UnknownValue(serde_json::Value),
847}
848/// struct for typed errors of method [`EventsApi::get_user`]
849#[derive(Debug, Clone, Serialize, Deserialize)]
850#[serde(untagged)]
851pub enum GetUserError {
852    UnknownValue(serde_json::Value),
853}