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