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