1use super::{configuration, ContentType, Error};
12use crate::{apis::ResponseContent, models};
13use reqwest;
14use serde::{de::Error as _, Deserialize, Serialize};
15
16#[derive(Debug, Clone, Serialize, Deserialize)]
18#[serde(untagged)]
19pub enum EventsEventsActionsListError {
20 Status400(models::ValidationError),
21 Status403(models::GenericError),
22 UnknownValue(serde_json::Value),
23}
24
25#[derive(Debug, Clone, Serialize, Deserialize)]
27#[serde(untagged)]
28pub enum EventsEventsCreateError {
29 Status400(models::ValidationError),
30 Status403(models::GenericError),
31 UnknownValue(serde_json::Value),
32}
33
34#[derive(Debug, Clone, Serialize, Deserialize)]
36#[serde(untagged)]
37pub enum EventsEventsDestroyError {
38 Status400(models::ValidationError),
39 Status403(models::GenericError),
40 UnknownValue(serde_json::Value),
41}
42
43#[derive(Debug, Clone, Serialize, Deserialize)]
45#[serde(untagged)]
46pub enum EventsEventsExportCreateError {
47 Status400(models::ValidationError),
48 Status403(models::GenericError),
49 UnknownValue(serde_json::Value),
50}
51
52#[derive(Debug, Clone, Serialize, Deserialize)]
54#[serde(untagged)]
55pub enum EventsEventsListError {
56 Status400(models::ValidationError),
57 Status403(models::GenericError),
58 UnknownValue(serde_json::Value),
59}
60
61#[derive(Debug, Clone, Serialize, Deserialize)]
63#[serde(untagged)]
64pub enum EventsEventsPartialUpdateError {
65 Status400(models::ValidationError),
66 Status403(models::GenericError),
67 UnknownValue(serde_json::Value),
68}
69
70#[derive(Debug, Clone, Serialize, Deserialize)]
72#[serde(untagged)]
73pub enum EventsEventsRetrieveError {
74 Status400(models::ValidationError),
75 Status403(models::GenericError),
76 UnknownValue(serde_json::Value),
77}
78
79#[derive(Debug, Clone, Serialize, Deserialize)]
81#[serde(untagged)]
82pub enum EventsEventsTopPerUserListError {
83 Status400(models::ValidationError),
84 Status403(models::GenericError),
85 UnknownValue(serde_json::Value),
86}
87
88#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum EventsEventsUpdateError {
92 Status400(models::ValidationError),
93 Status403(models::GenericError),
94 UnknownValue(serde_json::Value),
95}
96
97#[derive(Debug, Clone, Serialize, Deserialize)]
99#[serde(untagged)]
100pub enum EventsEventsVolumeListError {
101 Status400(models::ValidationError),
102 Status403(models::GenericError),
103 UnknownValue(serde_json::Value),
104}
105
106#[derive(Debug, Clone, Serialize, Deserialize)]
108#[serde(untagged)]
109pub enum EventsNotificationsDestroyError {
110 Status400(models::ValidationError),
111 Status403(models::GenericError),
112 UnknownValue(serde_json::Value),
113}
114
115#[derive(Debug, Clone, Serialize, Deserialize)]
117#[serde(untagged)]
118pub enum EventsNotificationsListError {
119 Status400(models::ValidationError),
120 Status403(models::GenericError),
121 UnknownValue(serde_json::Value),
122}
123
124#[derive(Debug, Clone, Serialize, Deserialize)]
126#[serde(untagged)]
127pub enum EventsNotificationsMarkAllSeenCreateError {
128 Status400(models::ValidationError),
129 Status403(models::GenericError),
130 UnknownValue(serde_json::Value),
131}
132
133#[derive(Debug, Clone, Serialize, Deserialize)]
135#[serde(untagged)]
136pub enum EventsNotificationsPartialUpdateError {
137 Status400(models::ValidationError),
138 Status403(models::GenericError),
139 UnknownValue(serde_json::Value),
140}
141
142#[derive(Debug, Clone, Serialize, Deserialize)]
144#[serde(untagged)]
145pub enum EventsNotificationsRetrieveError {
146 Status400(models::ValidationError),
147 Status403(models::GenericError),
148 UnknownValue(serde_json::Value),
149}
150
151#[derive(Debug, Clone, Serialize, Deserialize)]
153#[serde(untagged)]
154pub enum EventsNotificationsUpdateError {
155 Status400(models::ValidationError),
156 Status403(models::GenericError),
157 UnknownValue(serde_json::Value),
158}
159
160#[derive(Debug, Clone, Serialize, Deserialize)]
162#[serde(untagged)]
163pub enum EventsNotificationsUsedByListError {
164 Status400(models::ValidationError),
165 Status403(models::GenericError),
166 UnknownValue(serde_json::Value),
167}
168
169#[derive(Debug, Clone, Serialize, Deserialize)]
171#[serde(untagged)]
172pub enum EventsRulesCreateError {
173 Status400(models::ValidationError),
174 Status403(models::GenericError),
175 UnknownValue(serde_json::Value),
176}
177
178#[derive(Debug, Clone, Serialize, Deserialize)]
180#[serde(untagged)]
181pub enum EventsRulesDestroyError {
182 Status400(models::ValidationError),
183 Status403(models::GenericError),
184 UnknownValue(serde_json::Value),
185}
186
187#[derive(Debug, Clone, Serialize, Deserialize)]
189#[serde(untagged)]
190pub enum EventsRulesListError {
191 Status400(models::ValidationError),
192 Status403(models::GenericError),
193 UnknownValue(serde_json::Value),
194}
195
196#[derive(Debug, Clone, Serialize, Deserialize)]
198#[serde(untagged)]
199pub enum EventsRulesPartialUpdateError {
200 Status400(models::ValidationError),
201 Status403(models::GenericError),
202 UnknownValue(serde_json::Value),
203}
204
205#[derive(Debug, Clone, Serialize, Deserialize)]
207#[serde(untagged)]
208pub enum EventsRulesRetrieveError {
209 Status400(models::ValidationError),
210 Status403(models::GenericError),
211 UnknownValue(serde_json::Value),
212}
213
214#[derive(Debug, Clone, Serialize, Deserialize)]
216#[serde(untagged)]
217pub enum EventsRulesUpdateError {
218 Status400(models::ValidationError),
219 Status403(models::GenericError),
220 UnknownValue(serde_json::Value),
221}
222
223#[derive(Debug, Clone, Serialize, Deserialize)]
225#[serde(untagged)]
226pub enum EventsRulesUsedByListError {
227 Status400(models::ValidationError),
228 Status403(models::GenericError),
229 UnknownValue(serde_json::Value),
230}
231
232#[derive(Debug, Clone, Serialize, Deserialize)]
234#[serde(untagged)]
235pub enum EventsTransportsCreateError {
236 Status400(models::ValidationError),
237 Status403(models::GenericError),
238 UnknownValue(serde_json::Value),
239}
240
241#[derive(Debug, Clone, Serialize, Deserialize)]
243#[serde(untagged)]
244pub enum EventsTransportsDestroyError {
245 Status400(models::ValidationError),
246 Status403(models::GenericError),
247 UnknownValue(serde_json::Value),
248}
249
250#[derive(Debug, Clone, Serialize, Deserialize)]
252#[serde(untagged)]
253pub enum EventsTransportsListError {
254 Status400(models::ValidationError),
255 Status403(models::GenericError),
256 UnknownValue(serde_json::Value),
257}
258
259#[derive(Debug, Clone, Serialize, Deserialize)]
261#[serde(untagged)]
262pub enum EventsTransportsPartialUpdateError {
263 Status400(models::ValidationError),
264 Status403(models::GenericError),
265 UnknownValue(serde_json::Value),
266}
267
268#[derive(Debug, Clone, Serialize, Deserialize)]
270#[serde(untagged)]
271pub enum EventsTransportsRetrieveError {
272 Status400(models::ValidationError),
273 Status403(models::GenericError),
274 UnknownValue(serde_json::Value),
275}
276
277#[derive(Debug, Clone, Serialize, Deserialize)]
279#[serde(untagged)]
280pub enum EventsTransportsTestCreateError {
281 Status500(),
282 Status400(models::ValidationError),
283 Status403(models::GenericError),
284 UnknownValue(serde_json::Value),
285}
286
287#[derive(Debug, Clone, Serialize, Deserialize)]
289#[serde(untagged)]
290pub enum EventsTransportsUpdateError {
291 Status400(models::ValidationError),
292 Status403(models::GenericError),
293 UnknownValue(serde_json::Value),
294}
295
296#[derive(Debug, Clone, Serialize, Deserialize)]
298#[serde(untagged)]
299pub enum EventsTransportsUsedByListError {
300 Status400(models::ValidationError),
301 Status403(models::GenericError),
302 UnknownValue(serde_json::Value),
303}
304
305pub async fn events_events_actions_list(
307 configuration: &configuration::Configuration,
308) -> Result<Vec<models::TypeCreate>, Error<EventsEventsActionsListError>> {
309 let uri_str = format!("{}/events/events/actions/", configuration.base_path);
310 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
311
312 if let Some(ref user_agent) = configuration.user_agent {
313 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
314 }
315 if let Some(ref token) = configuration.bearer_access_token {
316 req_builder = req_builder.bearer_auth(token.to_owned());
317 };
318
319 let req = req_builder.build()?;
320 let resp = configuration.client.execute(req).await?;
321
322 let status = resp.status();
323 let content_type = resp
324 .headers()
325 .get("content-type")
326 .and_then(|v| v.to_str().ok())
327 .unwrap_or("application/octet-stream");
328 let content_type = super::ContentType::from(content_type);
329
330 if !status.is_client_error() && !status.is_server_error() {
331 let content = resp.text().await?;
332 match content_type {
333 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
334 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::TypeCreate>`"))),
335 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::TypeCreate>`")))),
336 }
337 } else {
338 let content = resp.text().await?;
339 let entity: Option<EventsEventsActionsListError> = serde_json::from_str(&content).ok();
340 Err(Error::ResponseError(ResponseContent {
341 status,
342 content,
343 entity,
344 }))
345 }
346}
347
348pub async fn events_events_create(
350 configuration: &configuration::Configuration,
351 event_request: models::EventRequest,
352) -> Result<models::Event, Error<EventsEventsCreateError>> {
353 let p_body_event_request = event_request;
355
356 let uri_str = format!("{}/events/events/", configuration.base_path);
357 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
358
359 if let Some(ref user_agent) = configuration.user_agent {
360 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
361 }
362 if let Some(ref token) = configuration.bearer_access_token {
363 req_builder = req_builder.bearer_auth(token.to_owned());
364 };
365 req_builder = req_builder.json(&p_body_event_request);
366
367 let req = req_builder.build()?;
368 let resp = configuration.client.execute(req).await?;
369
370 let status = resp.status();
371 let content_type = resp
372 .headers()
373 .get("content-type")
374 .and_then(|v| v.to_str().ok())
375 .unwrap_or("application/octet-stream");
376 let content_type = super::ContentType::from(content_type);
377
378 if !status.is_client_error() && !status.is_server_error() {
379 let content = resp.text().await?;
380 match content_type {
381 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
382 ContentType::Text => {
383 return Err(Error::from(serde_json::Error::custom(
384 "Received `text/plain` content type response that cannot be converted to `models::Event`",
385 )))
386 }
387 ContentType::Unsupported(unknown_type) => {
388 return Err(Error::from(serde_json::Error::custom(format!(
389 "Received `{unknown_type}` content type response that cannot be converted to `models::Event`"
390 ))))
391 }
392 }
393 } else {
394 let content = resp.text().await?;
395 let entity: Option<EventsEventsCreateError> = serde_json::from_str(&content).ok();
396 Err(Error::ResponseError(ResponseContent {
397 status,
398 content,
399 entity,
400 }))
401 }
402}
403
404pub async fn events_events_destroy(
406 configuration: &configuration::Configuration,
407 event_uuid: &str,
408) -> Result<(), Error<EventsEventsDestroyError>> {
409 let p_path_event_uuid = event_uuid;
411
412 let uri_str = format!(
413 "{}/events/events/{event_uuid}/",
414 configuration.base_path,
415 event_uuid = crate::apis::urlencode(p_path_event_uuid)
416 );
417 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
418
419 if let Some(ref user_agent) = configuration.user_agent {
420 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
421 }
422 if let Some(ref token) = configuration.bearer_access_token {
423 req_builder = req_builder.bearer_auth(token.to_owned());
424 };
425
426 let req = req_builder.build()?;
427 let resp = configuration.client.execute(req).await?;
428
429 let status = resp.status();
430
431 if !status.is_client_error() && !status.is_server_error() {
432 Ok(())
433 } else {
434 let content = resp.text().await?;
435 let entity: Option<EventsEventsDestroyError> = serde_json::from_str(&content).ok();
436 Err(Error::ResponseError(ResponseContent {
437 status,
438 content,
439 entity,
440 }))
441 }
442}
443
444pub async fn events_events_export_create(
446 configuration: &configuration::Configuration,
447 action: Option<&str>,
448 actions: Option<Vec<String>>,
449 brand_name: Option<&str>,
450 client_ip: Option<&str>,
451 context_authorized_app: Option<&str>,
452 context_model_app: Option<&str>,
453 context_model_name: Option<&str>,
454 context_model_pk: Option<&str>,
455 ordering: Option<&str>,
456 search: Option<&str>,
457 username: Option<&str>,
458) -> Result<models::DataExport, Error<EventsEventsExportCreateError>> {
459 let p_query_action = action;
461 let p_query_actions = actions;
462 let p_query_brand_name = brand_name;
463 let p_query_client_ip = client_ip;
464 let p_query_context_authorized_app = context_authorized_app;
465 let p_query_context_model_app = context_model_app;
466 let p_query_context_model_name = context_model_name;
467 let p_query_context_model_pk = context_model_pk;
468 let p_query_ordering = ordering;
469 let p_query_search = search;
470 let p_query_username = username;
471
472 let uri_str = format!("{}/events/events/export/", configuration.base_path);
473 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
474
475 if let Some(ref param_value) = p_query_action {
476 req_builder = req_builder.query(&[("action", ¶m_value.to_string())]);
477 }
478 if let Some(ref param_value) = p_query_actions {
479 req_builder = match "multi" {
480 "multi" => req_builder.query(
481 ¶m_value
482 .into_iter()
483 .map(|p| ("actions".to_owned(), p.to_string()))
484 .collect::<Vec<(std::string::String, std::string::String)>>(),
485 ),
486 _ => req_builder.query(&[(
487 "actions",
488 ¶m_value
489 .into_iter()
490 .map(|p| p.to_string())
491 .collect::<Vec<String>>()
492 .join(",")
493 .to_string(),
494 )]),
495 };
496 }
497 if let Some(ref param_value) = p_query_brand_name {
498 req_builder = req_builder.query(&[("brand_name", ¶m_value.to_string())]);
499 }
500 if let Some(ref param_value) = p_query_client_ip {
501 req_builder = req_builder.query(&[("client_ip", ¶m_value.to_string())]);
502 }
503 if let Some(ref param_value) = p_query_context_authorized_app {
504 req_builder = req_builder.query(&[("context_authorized_app", ¶m_value.to_string())]);
505 }
506 if let Some(ref param_value) = p_query_context_model_app {
507 req_builder = req_builder.query(&[("context_model_app", ¶m_value.to_string())]);
508 }
509 if let Some(ref param_value) = p_query_context_model_name {
510 req_builder = req_builder.query(&[("context_model_name", ¶m_value.to_string())]);
511 }
512 if let Some(ref param_value) = p_query_context_model_pk {
513 req_builder = req_builder.query(&[("context_model_pk", ¶m_value.to_string())]);
514 }
515 if let Some(ref param_value) = p_query_ordering {
516 req_builder = req_builder.query(&[("ordering", ¶m_value.to_string())]);
517 }
518 if let Some(ref param_value) = p_query_search {
519 req_builder = req_builder.query(&[("search", ¶m_value.to_string())]);
520 }
521 if let Some(ref param_value) = p_query_username {
522 req_builder = req_builder.query(&[("username", ¶m_value.to_string())]);
523 }
524 if let Some(ref user_agent) = configuration.user_agent {
525 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
526 }
527 if let Some(ref token) = configuration.bearer_access_token {
528 req_builder = req_builder.bearer_auth(token.to_owned());
529 };
530
531 let req = req_builder.build()?;
532 let resp = configuration.client.execute(req).await?;
533
534 let status = resp.status();
535 let content_type = resp
536 .headers()
537 .get("content-type")
538 .and_then(|v| v.to_str().ok())
539 .unwrap_or("application/octet-stream");
540 let content_type = super::ContentType::from(content_type);
541
542 if !status.is_client_error() && !status.is_server_error() {
543 let content = resp.text().await?;
544 match content_type {
545 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
546 ContentType::Text => {
547 return Err(Error::from(serde_json::Error::custom(
548 "Received `text/plain` content type response that cannot be converted to `models::DataExport`",
549 )))
550 }
551 ContentType::Unsupported(unknown_type) => {
552 return Err(Error::from(serde_json::Error::custom(format!(
553 "Received `{unknown_type}` content type response that cannot be converted to `models::DataExport`"
554 ))))
555 }
556 }
557 } else {
558 let content = resp.text().await?;
559 let entity: Option<EventsEventsExportCreateError> = serde_json::from_str(&content).ok();
560 Err(Error::ResponseError(ResponseContent {
561 status,
562 content,
563 entity,
564 }))
565 }
566}
567
568pub async fn events_events_list(
570 configuration: &configuration::Configuration,
571 action: Option<&str>,
572 actions: Option<Vec<String>>,
573 brand_name: Option<&str>,
574 client_ip: Option<&str>,
575 context_authorized_app: Option<&str>,
576 context_model_app: Option<&str>,
577 context_model_name: Option<&str>,
578 context_model_pk: Option<&str>,
579 ordering: Option<&str>,
580 page: Option<i32>,
581 page_size: Option<i32>,
582 search: Option<&str>,
583 username: Option<&str>,
584) -> Result<models::PaginatedEventList, Error<EventsEventsListError>> {
585 let p_query_action = action;
587 let p_query_actions = actions;
588 let p_query_brand_name = brand_name;
589 let p_query_client_ip = client_ip;
590 let p_query_context_authorized_app = context_authorized_app;
591 let p_query_context_model_app = context_model_app;
592 let p_query_context_model_name = context_model_name;
593 let p_query_context_model_pk = context_model_pk;
594 let p_query_ordering = ordering;
595 let p_query_page = page;
596 let p_query_page_size = page_size;
597 let p_query_search = search;
598 let p_query_username = username;
599
600 let uri_str = format!("{}/events/events/", configuration.base_path);
601 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
602
603 if let Some(ref param_value) = p_query_action {
604 req_builder = req_builder.query(&[("action", ¶m_value.to_string())]);
605 }
606 if let Some(ref param_value) = p_query_actions {
607 req_builder = match "multi" {
608 "multi" => req_builder.query(
609 ¶m_value
610 .into_iter()
611 .map(|p| ("actions".to_owned(), p.to_string()))
612 .collect::<Vec<(std::string::String, std::string::String)>>(),
613 ),
614 _ => req_builder.query(&[(
615 "actions",
616 ¶m_value
617 .into_iter()
618 .map(|p| p.to_string())
619 .collect::<Vec<String>>()
620 .join(",")
621 .to_string(),
622 )]),
623 };
624 }
625 if let Some(ref param_value) = p_query_brand_name {
626 req_builder = req_builder.query(&[("brand_name", ¶m_value.to_string())]);
627 }
628 if let Some(ref param_value) = p_query_client_ip {
629 req_builder = req_builder.query(&[("client_ip", ¶m_value.to_string())]);
630 }
631 if let Some(ref param_value) = p_query_context_authorized_app {
632 req_builder = req_builder.query(&[("context_authorized_app", ¶m_value.to_string())]);
633 }
634 if let Some(ref param_value) = p_query_context_model_app {
635 req_builder = req_builder.query(&[("context_model_app", ¶m_value.to_string())]);
636 }
637 if let Some(ref param_value) = p_query_context_model_name {
638 req_builder = req_builder.query(&[("context_model_name", ¶m_value.to_string())]);
639 }
640 if let Some(ref param_value) = p_query_context_model_pk {
641 req_builder = req_builder.query(&[("context_model_pk", ¶m_value.to_string())]);
642 }
643 if let Some(ref param_value) = p_query_ordering {
644 req_builder = req_builder.query(&[("ordering", ¶m_value.to_string())]);
645 }
646 if let Some(ref param_value) = p_query_page {
647 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
648 }
649 if let Some(ref param_value) = p_query_page_size {
650 req_builder = req_builder.query(&[("page_size", ¶m_value.to_string())]);
651 }
652 if let Some(ref param_value) = p_query_search {
653 req_builder = req_builder.query(&[("search", ¶m_value.to_string())]);
654 }
655 if let Some(ref param_value) = p_query_username {
656 req_builder = req_builder.query(&[("username", ¶m_value.to_string())]);
657 }
658 if let Some(ref user_agent) = configuration.user_agent {
659 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
660 }
661 if let Some(ref token) = configuration.bearer_access_token {
662 req_builder = req_builder.bearer_auth(token.to_owned());
663 };
664
665 let req = req_builder.build()?;
666 let resp = configuration.client.execute(req).await?;
667
668 let status = resp.status();
669 let content_type = resp
670 .headers()
671 .get("content-type")
672 .and_then(|v| v.to_str().ok())
673 .unwrap_or("application/octet-stream");
674 let content_type = super::ContentType::from(content_type);
675
676 if !status.is_client_error() && !status.is_server_error() {
677 let content = resp.text().await?;
678 match content_type {
679 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
680 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaginatedEventList`"))),
681 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PaginatedEventList`")))),
682 }
683 } else {
684 let content = resp.text().await?;
685 let entity: Option<EventsEventsListError> = serde_json::from_str(&content).ok();
686 Err(Error::ResponseError(ResponseContent {
687 status,
688 content,
689 entity,
690 }))
691 }
692}
693
694pub async fn events_events_partial_update(
696 configuration: &configuration::Configuration,
697 event_uuid: &str,
698 patched_event_request: Option<models::PatchedEventRequest>,
699) -> Result<models::Event, Error<EventsEventsPartialUpdateError>> {
700 let p_path_event_uuid = event_uuid;
702 let p_body_patched_event_request = patched_event_request;
703
704 let uri_str = format!(
705 "{}/events/events/{event_uuid}/",
706 configuration.base_path,
707 event_uuid = crate::apis::urlencode(p_path_event_uuid)
708 );
709 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
710
711 if let Some(ref user_agent) = configuration.user_agent {
712 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
713 }
714 if let Some(ref token) = configuration.bearer_access_token {
715 req_builder = req_builder.bearer_auth(token.to_owned());
716 };
717 req_builder = req_builder.json(&p_body_patched_event_request);
718
719 let req = req_builder.build()?;
720 let resp = configuration.client.execute(req).await?;
721
722 let status = resp.status();
723 let content_type = resp
724 .headers()
725 .get("content-type")
726 .and_then(|v| v.to_str().ok())
727 .unwrap_or("application/octet-stream");
728 let content_type = super::ContentType::from(content_type);
729
730 if !status.is_client_error() && !status.is_server_error() {
731 let content = resp.text().await?;
732 match content_type {
733 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
734 ContentType::Text => {
735 return Err(Error::from(serde_json::Error::custom(
736 "Received `text/plain` content type response that cannot be converted to `models::Event`",
737 )))
738 }
739 ContentType::Unsupported(unknown_type) => {
740 return Err(Error::from(serde_json::Error::custom(format!(
741 "Received `{unknown_type}` content type response that cannot be converted to `models::Event`"
742 ))))
743 }
744 }
745 } else {
746 let content = resp.text().await?;
747 let entity: Option<EventsEventsPartialUpdateError> = serde_json::from_str(&content).ok();
748 Err(Error::ResponseError(ResponseContent {
749 status,
750 content,
751 entity,
752 }))
753 }
754}
755
756pub async fn events_events_retrieve(
758 configuration: &configuration::Configuration,
759 event_uuid: &str,
760) -> Result<models::Event, Error<EventsEventsRetrieveError>> {
761 let p_path_event_uuid = event_uuid;
763
764 let uri_str = format!(
765 "{}/events/events/{event_uuid}/",
766 configuration.base_path,
767 event_uuid = crate::apis::urlencode(p_path_event_uuid)
768 );
769 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
770
771 if let Some(ref user_agent) = configuration.user_agent {
772 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
773 }
774 if let Some(ref token) = configuration.bearer_access_token {
775 req_builder = req_builder.bearer_auth(token.to_owned());
776 };
777
778 let req = req_builder.build()?;
779 let resp = configuration.client.execute(req).await?;
780
781 let status = resp.status();
782 let content_type = resp
783 .headers()
784 .get("content-type")
785 .and_then(|v| v.to_str().ok())
786 .unwrap_or("application/octet-stream");
787 let content_type = super::ContentType::from(content_type);
788
789 if !status.is_client_error() && !status.is_server_error() {
790 let content = resp.text().await?;
791 match content_type {
792 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
793 ContentType::Text => {
794 return Err(Error::from(serde_json::Error::custom(
795 "Received `text/plain` content type response that cannot be converted to `models::Event`",
796 )))
797 }
798 ContentType::Unsupported(unknown_type) => {
799 return Err(Error::from(serde_json::Error::custom(format!(
800 "Received `{unknown_type}` content type response that cannot be converted to `models::Event`"
801 ))))
802 }
803 }
804 } else {
805 let content = resp.text().await?;
806 let entity: Option<EventsEventsRetrieveError> = serde_json::from_str(&content).ok();
807 Err(Error::ResponseError(ResponseContent {
808 status,
809 content,
810 entity,
811 }))
812 }
813}
814
815pub async fn events_events_top_per_user_list(
817 configuration: &configuration::Configuration,
818 action: Option<&str>,
819 top_n: Option<i32>,
820) -> Result<Vec<models::EventTopPerUser>, Error<EventsEventsTopPerUserListError>> {
821 let p_query_action = action;
823 let p_query_top_n = top_n;
824
825 let uri_str = format!("{}/events/events/top_per_user/", configuration.base_path);
826 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
827
828 if let Some(ref param_value) = p_query_action {
829 req_builder = req_builder.query(&[("action", ¶m_value.to_string())]);
830 }
831 if let Some(ref param_value) = p_query_top_n {
832 req_builder = req_builder.query(&[("top_n", ¶m_value.to_string())]);
833 }
834 if let Some(ref user_agent) = configuration.user_agent {
835 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
836 }
837 if let Some(ref token) = configuration.bearer_access_token {
838 req_builder = req_builder.bearer_auth(token.to_owned());
839 };
840
841 let req = req_builder.build()?;
842 let resp = configuration.client.execute(req).await?;
843
844 let status = resp.status();
845 let content_type = resp
846 .headers()
847 .get("content-type")
848 .and_then(|v| v.to_str().ok())
849 .unwrap_or("application/octet-stream");
850 let content_type = super::ContentType::from(content_type);
851
852 if !status.is_client_error() && !status.is_server_error() {
853 let content = resp.text().await?;
854 match content_type {
855 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
856 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::EventTopPerUser>`"))),
857 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::EventTopPerUser>`")))),
858 }
859 } else {
860 let content = resp.text().await?;
861 let entity: Option<EventsEventsTopPerUserListError> = serde_json::from_str(&content).ok();
862 Err(Error::ResponseError(ResponseContent {
863 status,
864 content,
865 entity,
866 }))
867 }
868}
869
870pub async fn events_events_update(
872 configuration: &configuration::Configuration,
873 event_uuid: &str,
874 event_request: models::EventRequest,
875) -> Result<models::Event, Error<EventsEventsUpdateError>> {
876 let p_path_event_uuid = event_uuid;
878 let p_body_event_request = event_request;
879
880 let uri_str = format!(
881 "{}/events/events/{event_uuid}/",
882 configuration.base_path,
883 event_uuid = crate::apis::urlencode(p_path_event_uuid)
884 );
885 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
886
887 if let Some(ref user_agent) = configuration.user_agent {
888 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
889 }
890 if let Some(ref token) = configuration.bearer_access_token {
891 req_builder = req_builder.bearer_auth(token.to_owned());
892 };
893 req_builder = req_builder.json(&p_body_event_request);
894
895 let req = req_builder.build()?;
896 let resp = configuration.client.execute(req).await?;
897
898 let status = resp.status();
899 let content_type = resp
900 .headers()
901 .get("content-type")
902 .and_then(|v| v.to_str().ok())
903 .unwrap_or("application/octet-stream");
904 let content_type = super::ContentType::from(content_type);
905
906 if !status.is_client_error() && !status.is_server_error() {
907 let content = resp.text().await?;
908 match content_type {
909 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
910 ContentType::Text => {
911 return Err(Error::from(serde_json::Error::custom(
912 "Received `text/plain` content type response that cannot be converted to `models::Event`",
913 )))
914 }
915 ContentType::Unsupported(unknown_type) => {
916 return Err(Error::from(serde_json::Error::custom(format!(
917 "Received `{unknown_type}` content type response that cannot be converted to `models::Event`"
918 ))))
919 }
920 }
921 } else {
922 let content = resp.text().await?;
923 let entity: Option<EventsEventsUpdateError> = serde_json::from_str(&content).ok();
924 Err(Error::ResponseError(ResponseContent {
925 status,
926 content,
927 entity,
928 }))
929 }
930}
931
932pub async fn events_events_volume_list(
934 configuration: &configuration::Configuration,
935 action: Option<&str>,
936 actions: Option<Vec<String>>,
937 brand_name: Option<&str>,
938 client_ip: Option<&str>,
939 context_authorized_app: Option<&str>,
940 context_model_app: Option<&str>,
941 context_model_name: Option<&str>,
942 context_model_pk: Option<&str>,
943 history_days: Option<f64>,
944 ordering: Option<&str>,
945 search: Option<&str>,
946 username: Option<&str>,
947) -> Result<Vec<models::EventVolume>, Error<EventsEventsVolumeListError>> {
948 let p_query_action = action;
950 let p_query_actions = actions;
951 let p_query_brand_name = brand_name;
952 let p_query_client_ip = client_ip;
953 let p_query_context_authorized_app = context_authorized_app;
954 let p_query_context_model_app = context_model_app;
955 let p_query_context_model_name = context_model_name;
956 let p_query_context_model_pk = context_model_pk;
957 let p_query_history_days = history_days;
958 let p_query_ordering = ordering;
959 let p_query_search = search;
960 let p_query_username = username;
961
962 let uri_str = format!("{}/events/events/volume/", configuration.base_path);
963 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
964
965 if let Some(ref param_value) = p_query_action {
966 req_builder = req_builder.query(&[("action", ¶m_value.to_string())]);
967 }
968 if let Some(ref param_value) = p_query_actions {
969 req_builder = match "multi" {
970 "multi" => req_builder.query(
971 ¶m_value
972 .into_iter()
973 .map(|p| ("actions".to_owned(), p.to_string()))
974 .collect::<Vec<(std::string::String, std::string::String)>>(),
975 ),
976 _ => req_builder.query(&[(
977 "actions",
978 ¶m_value
979 .into_iter()
980 .map(|p| p.to_string())
981 .collect::<Vec<String>>()
982 .join(",")
983 .to_string(),
984 )]),
985 };
986 }
987 if let Some(ref param_value) = p_query_brand_name {
988 req_builder = req_builder.query(&[("brand_name", ¶m_value.to_string())]);
989 }
990 if let Some(ref param_value) = p_query_client_ip {
991 req_builder = req_builder.query(&[("client_ip", ¶m_value.to_string())]);
992 }
993 if let Some(ref param_value) = p_query_context_authorized_app {
994 req_builder = req_builder.query(&[("context_authorized_app", ¶m_value.to_string())]);
995 }
996 if let Some(ref param_value) = p_query_context_model_app {
997 req_builder = req_builder.query(&[("context_model_app", ¶m_value.to_string())]);
998 }
999 if let Some(ref param_value) = p_query_context_model_name {
1000 req_builder = req_builder.query(&[("context_model_name", ¶m_value.to_string())]);
1001 }
1002 if let Some(ref param_value) = p_query_context_model_pk {
1003 req_builder = req_builder.query(&[("context_model_pk", ¶m_value.to_string())]);
1004 }
1005 if let Some(ref param_value) = p_query_history_days {
1006 req_builder = req_builder.query(&[("history_days", ¶m_value.to_string())]);
1007 }
1008 if let Some(ref param_value) = p_query_ordering {
1009 req_builder = req_builder.query(&[("ordering", ¶m_value.to_string())]);
1010 }
1011 if let Some(ref param_value) = p_query_search {
1012 req_builder = req_builder.query(&[("search", ¶m_value.to_string())]);
1013 }
1014 if let Some(ref param_value) = p_query_username {
1015 req_builder = req_builder.query(&[("username", ¶m_value.to_string())]);
1016 }
1017 if let Some(ref user_agent) = configuration.user_agent {
1018 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1019 }
1020 if let Some(ref token) = configuration.bearer_access_token {
1021 req_builder = req_builder.bearer_auth(token.to_owned());
1022 };
1023
1024 let req = req_builder.build()?;
1025 let resp = configuration.client.execute(req).await?;
1026
1027 let status = resp.status();
1028 let content_type = resp
1029 .headers()
1030 .get("content-type")
1031 .and_then(|v| v.to_str().ok())
1032 .unwrap_or("application/octet-stream");
1033 let content_type = super::ContentType::from(content_type);
1034
1035 if !status.is_client_error() && !status.is_server_error() {
1036 let content = resp.text().await?;
1037 match content_type {
1038 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1039 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::EventVolume>`"))),
1040 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::EventVolume>`")))),
1041 }
1042 } else {
1043 let content = resp.text().await?;
1044 let entity: Option<EventsEventsVolumeListError> = serde_json::from_str(&content).ok();
1045 Err(Error::ResponseError(ResponseContent {
1046 status,
1047 content,
1048 entity,
1049 }))
1050 }
1051}
1052
1053pub async fn events_notifications_destroy(
1055 configuration: &configuration::Configuration,
1056 uuid: &str,
1057) -> Result<(), Error<EventsNotificationsDestroyError>> {
1058 let p_path_uuid = uuid;
1060
1061 let uri_str = format!(
1062 "{}/events/notifications/{uuid}/",
1063 configuration.base_path,
1064 uuid = crate::apis::urlencode(p_path_uuid)
1065 );
1066 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
1067
1068 if let Some(ref user_agent) = configuration.user_agent {
1069 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1070 }
1071 if let Some(ref token) = configuration.bearer_access_token {
1072 req_builder = req_builder.bearer_auth(token.to_owned());
1073 };
1074
1075 let req = req_builder.build()?;
1076 let resp = configuration.client.execute(req).await?;
1077
1078 let status = resp.status();
1079
1080 if !status.is_client_error() && !status.is_server_error() {
1081 Ok(())
1082 } else {
1083 let content = resp.text().await?;
1084 let entity: Option<EventsNotificationsDestroyError> = serde_json::from_str(&content).ok();
1085 Err(Error::ResponseError(ResponseContent {
1086 status,
1087 content,
1088 entity,
1089 }))
1090 }
1091}
1092
1093pub async fn events_notifications_list(
1095 configuration: &configuration::Configuration,
1096 body: Option<&str>,
1097 created: Option<String>,
1098 event: Option<&str>,
1099 ordering: Option<&str>,
1100 page: Option<i32>,
1101 page_size: Option<i32>,
1102 search: Option<&str>,
1103 seen: Option<bool>,
1104 severity: Option<&str>,
1105 user: Option<i32>,
1106) -> Result<models::PaginatedNotificationList, Error<EventsNotificationsListError>> {
1107 let p_query_body = body;
1109 let p_query_created = created;
1110 let p_query_event = event;
1111 let p_query_ordering = ordering;
1112 let p_query_page = page;
1113 let p_query_page_size = page_size;
1114 let p_query_search = search;
1115 let p_query_seen = seen;
1116 let p_query_severity = severity;
1117 let p_query_user = user;
1118
1119 let uri_str = format!("{}/events/notifications/", configuration.base_path);
1120 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1121
1122 if let Some(ref param_value) = p_query_body {
1123 req_builder = req_builder.query(&[("body", ¶m_value.to_string())]);
1124 }
1125 if let Some(ref param_value) = p_query_created {
1126 req_builder = req_builder.query(&[("created", ¶m_value.to_string())]);
1127 }
1128 if let Some(ref param_value) = p_query_event {
1129 req_builder = req_builder.query(&[("event", ¶m_value.to_string())]);
1130 }
1131 if let Some(ref param_value) = p_query_ordering {
1132 req_builder = req_builder.query(&[("ordering", ¶m_value.to_string())]);
1133 }
1134 if let Some(ref param_value) = p_query_page {
1135 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
1136 }
1137 if let Some(ref param_value) = p_query_page_size {
1138 req_builder = req_builder.query(&[("page_size", ¶m_value.to_string())]);
1139 }
1140 if let Some(ref param_value) = p_query_search {
1141 req_builder = req_builder.query(&[("search", ¶m_value.to_string())]);
1142 }
1143 if let Some(ref param_value) = p_query_seen {
1144 req_builder = req_builder.query(&[("seen", ¶m_value.to_string())]);
1145 }
1146 if let Some(ref param_value) = p_query_severity {
1147 req_builder = req_builder.query(&[("severity", ¶m_value.to_string())]);
1148 }
1149 if let Some(ref param_value) = p_query_user {
1150 req_builder = req_builder.query(&[("user", ¶m_value.to_string())]);
1151 }
1152 if let Some(ref user_agent) = configuration.user_agent {
1153 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1154 }
1155 if let Some(ref token) = configuration.bearer_access_token {
1156 req_builder = req_builder.bearer_auth(token.to_owned());
1157 };
1158
1159 let req = req_builder.build()?;
1160 let resp = configuration.client.execute(req).await?;
1161
1162 let status = resp.status();
1163 let content_type = resp
1164 .headers()
1165 .get("content-type")
1166 .and_then(|v| v.to_str().ok())
1167 .unwrap_or("application/octet-stream");
1168 let content_type = super::ContentType::from(content_type);
1169
1170 if !status.is_client_error() && !status.is_server_error() {
1171 let content = resp.text().await?;
1172 match content_type {
1173 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1174 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaginatedNotificationList`"))),
1175 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PaginatedNotificationList`")))),
1176 }
1177 } else {
1178 let content = resp.text().await?;
1179 let entity: Option<EventsNotificationsListError> = serde_json::from_str(&content).ok();
1180 Err(Error::ResponseError(ResponseContent {
1181 status,
1182 content,
1183 entity,
1184 }))
1185 }
1186}
1187
1188pub async fn events_notifications_mark_all_seen_create(
1190 configuration: &configuration::Configuration,
1191) -> Result<(), Error<EventsNotificationsMarkAllSeenCreateError>> {
1192 let uri_str = format!("{}/events/notifications/mark_all_seen/", configuration.base_path);
1193 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1194
1195 if let Some(ref user_agent) = configuration.user_agent {
1196 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1197 }
1198 if let Some(ref token) = configuration.bearer_access_token {
1199 req_builder = req_builder.bearer_auth(token.to_owned());
1200 };
1201
1202 let req = req_builder.build()?;
1203 let resp = configuration.client.execute(req).await?;
1204
1205 let status = resp.status();
1206
1207 if !status.is_client_error() && !status.is_server_error() {
1208 Ok(())
1209 } else {
1210 let content = resp.text().await?;
1211 let entity: Option<EventsNotificationsMarkAllSeenCreateError> = serde_json::from_str(&content).ok();
1212 Err(Error::ResponseError(ResponseContent {
1213 status,
1214 content,
1215 entity,
1216 }))
1217 }
1218}
1219
1220pub async fn events_notifications_partial_update(
1222 configuration: &configuration::Configuration,
1223 uuid: &str,
1224 patched_notification_request: Option<models::PatchedNotificationRequest>,
1225) -> Result<models::Notification, Error<EventsNotificationsPartialUpdateError>> {
1226 let p_path_uuid = uuid;
1228 let p_body_patched_notification_request = patched_notification_request;
1229
1230 let uri_str = format!(
1231 "{}/events/notifications/{uuid}/",
1232 configuration.base_path,
1233 uuid = crate::apis::urlencode(p_path_uuid)
1234 );
1235 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
1236
1237 if let Some(ref user_agent) = configuration.user_agent {
1238 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1239 }
1240 if let Some(ref token) = configuration.bearer_access_token {
1241 req_builder = req_builder.bearer_auth(token.to_owned());
1242 };
1243 req_builder = req_builder.json(&p_body_patched_notification_request);
1244
1245 let req = req_builder.build()?;
1246 let resp = configuration.client.execute(req).await?;
1247
1248 let status = resp.status();
1249 let content_type = resp
1250 .headers()
1251 .get("content-type")
1252 .and_then(|v| v.to_str().ok())
1253 .unwrap_or("application/octet-stream");
1254 let content_type = super::ContentType::from(content_type);
1255
1256 if !status.is_client_error() && !status.is_server_error() {
1257 let content = resp.text().await?;
1258 match content_type {
1259 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1260 ContentType::Text => {
1261 return Err(Error::from(serde_json::Error::custom(
1262 "Received `text/plain` content type response that cannot be converted to `models::Notification`",
1263 )))
1264 }
1265 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
1266 "Received `{unknown_type}` content type response that cannot be converted to `models::Notification`"
1267 )))),
1268 }
1269 } else {
1270 let content = resp.text().await?;
1271 let entity: Option<EventsNotificationsPartialUpdateError> = serde_json::from_str(&content).ok();
1272 Err(Error::ResponseError(ResponseContent {
1273 status,
1274 content,
1275 entity,
1276 }))
1277 }
1278}
1279
1280pub async fn events_notifications_retrieve(
1282 configuration: &configuration::Configuration,
1283 uuid: &str,
1284) -> Result<models::Notification, Error<EventsNotificationsRetrieveError>> {
1285 let p_path_uuid = uuid;
1287
1288 let uri_str = format!(
1289 "{}/events/notifications/{uuid}/",
1290 configuration.base_path,
1291 uuid = crate::apis::urlencode(p_path_uuid)
1292 );
1293 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1294
1295 if let Some(ref user_agent) = configuration.user_agent {
1296 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1297 }
1298 if let Some(ref token) = configuration.bearer_access_token {
1299 req_builder = req_builder.bearer_auth(token.to_owned());
1300 };
1301
1302 let req = req_builder.build()?;
1303 let resp = configuration.client.execute(req).await?;
1304
1305 let status = resp.status();
1306 let content_type = resp
1307 .headers()
1308 .get("content-type")
1309 .and_then(|v| v.to_str().ok())
1310 .unwrap_or("application/octet-stream");
1311 let content_type = super::ContentType::from(content_type);
1312
1313 if !status.is_client_error() && !status.is_server_error() {
1314 let content = resp.text().await?;
1315 match content_type {
1316 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1317 ContentType::Text => {
1318 return Err(Error::from(serde_json::Error::custom(
1319 "Received `text/plain` content type response that cannot be converted to `models::Notification`",
1320 )))
1321 }
1322 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
1323 "Received `{unknown_type}` content type response that cannot be converted to `models::Notification`"
1324 )))),
1325 }
1326 } else {
1327 let content = resp.text().await?;
1328 let entity: Option<EventsNotificationsRetrieveError> = serde_json::from_str(&content).ok();
1329 Err(Error::ResponseError(ResponseContent {
1330 status,
1331 content,
1332 entity,
1333 }))
1334 }
1335}
1336
1337pub async fn events_notifications_update(
1339 configuration: &configuration::Configuration,
1340 uuid: &str,
1341 notification_request: Option<models::NotificationRequest>,
1342) -> Result<models::Notification, Error<EventsNotificationsUpdateError>> {
1343 let p_path_uuid = uuid;
1345 let p_body_notification_request = notification_request;
1346
1347 let uri_str = format!(
1348 "{}/events/notifications/{uuid}/",
1349 configuration.base_path,
1350 uuid = crate::apis::urlencode(p_path_uuid)
1351 );
1352 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
1353
1354 if let Some(ref user_agent) = configuration.user_agent {
1355 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1356 }
1357 if let Some(ref token) = configuration.bearer_access_token {
1358 req_builder = req_builder.bearer_auth(token.to_owned());
1359 };
1360 req_builder = req_builder.json(&p_body_notification_request);
1361
1362 let req = req_builder.build()?;
1363 let resp = configuration.client.execute(req).await?;
1364
1365 let status = resp.status();
1366 let content_type = resp
1367 .headers()
1368 .get("content-type")
1369 .and_then(|v| v.to_str().ok())
1370 .unwrap_or("application/octet-stream");
1371 let content_type = super::ContentType::from(content_type);
1372
1373 if !status.is_client_error() && !status.is_server_error() {
1374 let content = resp.text().await?;
1375 match content_type {
1376 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1377 ContentType::Text => {
1378 return Err(Error::from(serde_json::Error::custom(
1379 "Received `text/plain` content type response that cannot be converted to `models::Notification`",
1380 )))
1381 }
1382 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
1383 "Received `{unknown_type}` content type response that cannot be converted to `models::Notification`"
1384 )))),
1385 }
1386 } else {
1387 let content = resp.text().await?;
1388 let entity: Option<EventsNotificationsUpdateError> = serde_json::from_str(&content).ok();
1389 Err(Error::ResponseError(ResponseContent {
1390 status,
1391 content,
1392 entity,
1393 }))
1394 }
1395}
1396
1397pub async fn events_notifications_used_by_list(
1399 configuration: &configuration::Configuration,
1400 uuid: &str,
1401) -> Result<Vec<models::UsedBy>, Error<EventsNotificationsUsedByListError>> {
1402 let p_path_uuid = uuid;
1404
1405 let uri_str = format!(
1406 "{}/events/notifications/{uuid}/used_by/",
1407 configuration.base_path,
1408 uuid = crate::apis::urlencode(p_path_uuid)
1409 );
1410 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1411
1412 if let Some(ref user_agent) = configuration.user_agent {
1413 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1414 }
1415 if let Some(ref token) = configuration.bearer_access_token {
1416 req_builder = req_builder.bearer_auth(token.to_owned());
1417 };
1418
1419 let req = req_builder.build()?;
1420 let resp = configuration.client.execute(req).await?;
1421
1422 let status = resp.status();
1423 let content_type = resp
1424 .headers()
1425 .get("content-type")
1426 .and_then(|v| v.to_str().ok())
1427 .unwrap_or("application/octet-stream");
1428 let content_type = super::ContentType::from(content_type);
1429
1430 if !status.is_client_error() && !status.is_server_error() {
1431 let content = resp.text().await?;
1432 match content_type {
1433 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1434 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::UsedBy>`"))),
1435 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::UsedBy>`")))),
1436 }
1437 } else {
1438 let content = resp.text().await?;
1439 let entity: Option<EventsNotificationsUsedByListError> = serde_json::from_str(&content).ok();
1440 Err(Error::ResponseError(ResponseContent {
1441 status,
1442 content,
1443 entity,
1444 }))
1445 }
1446}
1447
1448pub async fn events_rules_create(
1450 configuration: &configuration::Configuration,
1451 notification_rule_request: models::NotificationRuleRequest,
1452) -> Result<models::NotificationRule, Error<EventsRulesCreateError>> {
1453 let p_body_notification_rule_request = notification_rule_request;
1455
1456 let uri_str = format!("{}/events/rules/", configuration.base_path);
1457 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1458
1459 if let Some(ref user_agent) = configuration.user_agent {
1460 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1461 }
1462 if let Some(ref token) = configuration.bearer_access_token {
1463 req_builder = req_builder.bearer_auth(token.to_owned());
1464 };
1465 req_builder = req_builder.json(&p_body_notification_rule_request);
1466
1467 let req = req_builder.build()?;
1468 let resp = configuration.client.execute(req).await?;
1469
1470 let status = resp.status();
1471 let content_type = resp
1472 .headers()
1473 .get("content-type")
1474 .and_then(|v| v.to_str().ok())
1475 .unwrap_or("application/octet-stream");
1476 let content_type = super::ContentType::from(content_type);
1477
1478 if !status.is_client_error() && !status.is_server_error() {
1479 let content = resp.text().await?;
1480 match content_type {
1481 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1482 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::NotificationRule`"))),
1483 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::NotificationRule`")))),
1484 }
1485 } else {
1486 let content = resp.text().await?;
1487 let entity: Option<EventsRulesCreateError> = serde_json::from_str(&content).ok();
1488 Err(Error::ResponseError(ResponseContent {
1489 status,
1490 content,
1491 entity,
1492 }))
1493 }
1494}
1495
1496pub async fn events_rules_destroy(
1498 configuration: &configuration::Configuration,
1499 pbm_uuid: &str,
1500) -> Result<(), Error<EventsRulesDestroyError>> {
1501 let p_path_pbm_uuid = pbm_uuid;
1503
1504 let uri_str = format!(
1505 "{}/events/rules/{pbm_uuid}/",
1506 configuration.base_path,
1507 pbm_uuid = crate::apis::urlencode(p_path_pbm_uuid)
1508 );
1509 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
1510
1511 if let Some(ref user_agent) = configuration.user_agent {
1512 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1513 }
1514 if let Some(ref token) = configuration.bearer_access_token {
1515 req_builder = req_builder.bearer_auth(token.to_owned());
1516 };
1517
1518 let req = req_builder.build()?;
1519 let resp = configuration.client.execute(req).await?;
1520
1521 let status = resp.status();
1522
1523 if !status.is_client_error() && !status.is_server_error() {
1524 Ok(())
1525 } else {
1526 let content = resp.text().await?;
1527 let entity: Option<EventsRulesDestroyError> = serde_json::from_str(&content).ok();
1528 Err(Error::ResponseError(ResponseContent {
1529 status,
1530 content,
1531 entity,
1532 }))
1533 }
1534}
1535
1536pub async fn events_rules_list(
1538 configuration: &configuration::Configuration,
1539 destination_group__name: Option<&str>,
1540 name: Option<&str>,
1541 ordering: Option<&str>,
1542 page: Option<i32>,
1543 page_size: Option<i32>,
1544 search: Option<&str>,
1545 severity: Option<&str>,
1546) -> Result<models::PaginatedNotificationRuleList, Error<EventsRulesListError>> {
1547 let p_query_destination_group__name = destination_group__name;
1549 let p_query_name = name;
1550 let p_query_ordering = ordering;
1551 let p_query_page = page;
1552 let p_query_page_size = page_size;
1553 let p_query_search = search;
1554 let p_query_severity = severity;
1555
1556 let uri_str = format!("{}/events/rules/", configuration.base_path);
1557 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1558
1559 if let Some(ref param_value) = p_query_destination_group__name {
1560 req_builder = req_builder.query(&[("destination_group__name", ¶m_value.to_string())]);
1561 }
1562 if let Some(ref param_value) = p_query_name {
1563 req_builder = req_builder.query(&[("name", ¶m_value.to_string())]);
1564 }
1565 if let Some(ref param_value) = p_query_ordering {
1566 req_builder = req_builder.query(&[("ordering", ¶m_value.to_string())]);
1567 }
1568 if let Some(ref param_value) = p_query_page {
1569 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
1570 }
1571 if let Some(ref param_value) = p_query_page_size {
1572 req_builder = req_builder.query(&[("page_size", ¶m_value.to_string())]);
1573 }
1574 if let Some(ref param_value) = p_query_search {
1575 req_builder = req_builder.query(&[("search", ¶m_value.to_string())]);
1576 }
1577 if let Some(ref param_value) = p_query_severity {
1578 req_builder = req_builder.query(&[("severity", ¶m_value.to_string())]);
1579 }
1580 if let Some(ref user_agent) = configuration.user_agent {
1581 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1582 }
1583 if let Some(ref token) = configuration.bearer_access_token {
1584 req_builder = req_builder.bearer_auth(token.to_owned());
1585 };
1586
1587 let req = req_builder.build()?;
1588 let resp = configuration.client.execute(req).await?;
1589
1590 let status = resp.status();
1591 let content_type = resp
1592 .headers()
1593 .get("content-type")
1594 .and_then(|v| v.to_str().ok())
1595 .unwrap_or("application/octet-stream");
1596 let content_type = super::ContentType::from(content_type);
1597
1598 if !status.is_client_error() && !status.is_server_error() {
1599 let content = resp.text().await?;
1600 match content_type {
1601 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1602 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaginatedNotificationRuleList`"))),
1603 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PaginatedNotificationRuleList`")))),
1604 }
1605 } else {
1606 let content = resp.text().await?;
1607 let entity: Option<EventsRulesListError> = serde_json::from_str(&content).ok();
1608 Err(Error::ResponseError(ResponseContent {
1609 status,
1610 content,
1611 entity,
1612 }))
1613 }
1614}
1615
1616pub async fn events_rules_partial_update(
1618 configuration: &configuration::Configuration,
1619 pbm_uuid: &str,
1620 patched_notification_rule_request: Option<models::PatchedNotificationRuleRequest>,
1621) -> Result<models::NotificationRule, Error<EventsRulesPartialUpdateError>> {
1622 let p_path_pbm_uuid = pbm_uuid;
1624 let p_body_patched_notification_rule_request = patched_notification_rule_request;
1625
1626 let uri_str = format!(
1627 "{}/events/rules/{pbm_uuid}/",
1628 configuration.base_path,
1629 pbm_uuid = crate::apis::urlencode(p_path_pbm_uuid)
1630 );
1631 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
1632
1633 if let Some(ref user_agent) = configuration.user_agent {
1634 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1635 }
1636 if let Some(ref token) = configuration.bearer_access_token {
1637 req_builder = req_builder.bearer_auth(token.to_owned());
1638 };
1639 req_builder = req_builder.json(&p_body_patched_notification_rule_request);
1640
1641 let req = req_builder.build()?;
1642 let resp = configuration.client.execute(req).await?;
1643
1644 let status = resp.status();
1645 let content_type = resp
1646 .headers()
1647 .get("content-type")
1648 .and_then(|v| v.to_str().ok())
1649 .unwrap_or("application/octet-stream");
1650 let content_type = super::ContentType::from(content_type);
1651
1652 if !status.is_client_error() && !status.is_server_error() {
1653 let content = resp.text().await?;
1654 match content_type {
1655 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1656 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::NotificationRule`"))),
1657 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::NotificationRule`")))),
1658 }
1659 } else {
1660 let content = resp.text().await?;
1661 let entity: Option<EventsRulesPartialUpdateError> = serde_json::from_str(&content).ok();
1662 Err(Error::ResponseError(ResponseContent {
1663 status,
1664 content,
1665 entity,
1666 }))
1667 }
1668}
1669
1670pub async fn events_rules_retrieve(
1672 configuration: &configuration::Configuration,
1673 pbm_uuid: &str,
1674) -> Result<models::NotificationRule, Error<EventsRulesRetrieveError>> {
1675 let p_path_pbm_uuid = pbm_uuid;
1677
1678 let uri_str = format!(
1679 "{}/events/rules/{pbm_uuid}/",
1680 configuration.base_path,
1681 pbm_uuid = crate::apis::urlencode(p_path_pbm_uuid)
1682 );
1683 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1684
1685 if let Some(ref user_agent) = configuration.user_agent {
1686 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1687 }
1688 if let Some(ref token) = configuration.bearer_access_token {
1689 req_builder = req_builder.bearer_auth(token.to_owned());
1690 };
1691
1692 let req = req_builder.build()?;
1693 let resp = configuration.client.execute(req).await?;
1694
1695 let status = resp.status();
1696 let content_type = resp
1697 .headers()
1698 .get("content-type")
1699 .and_then(|v| v.to_str().ok())
1700 .unwrap_or("application/octet-stream");
1701 let content_type = super::ContentType::from(content_type);
1702
1703 if !status.is_client_error() && !status.is_server_error() {
1704 let content = resp.text().await?;
1705 match content_type {
1706 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1707 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::NotificationRule`"))),
1708 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::NotificationRule`")))),
1709 }
1710 } else {
1711 let content = resp.text().await?;
1712 let entity: Option<EventsRulesRetrieveError> = serde_json::from_str(&content).ok();
1713 Err(Error::ResponseError(ResponseContent {
1714 status,
1715 content,
1716 entity,
1717 }))
1718 }
1719}
1720
1721pub async fn events_rules_update(
1723 configuration: &configuration::Configuration,
1724 pbm_uuid: &str,
1725 notification_rule_request: models::NotificationRuleRequest,
1726) -> Result<models::NotificationRule, Error<EventsRulesUpdateError>> {
1727 let p_path_pbm_uuid = pbm_uuid;
1729 let p_body_notification_rule_request = notification_rule_request;
1730
1731 let uri_str = format!(
1732 "{}/events/rules/{pbm_uuid}/",
1733 configuration.base_path,
1734 pbm_uuid = crate::apis::urlencode(p_path_pbm_uuid)
1735 );
1736 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
1737
1738 if let Some(ref user_agent) = configuration.user_agent {
1739 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1740 }
1741 if let Some(ref token) = configuration.bearer_access_token {
1742 req_builder = req_builder.bearer_auth(token.to_owned());
1743 };
1744 req_builder = req_builder.json(&p_body_notification_rule_request);
1745
1746 let req = req_builder.build()?;
1747 let resp = configuration.client.execute(req).await?;
1748
1749 let status = resp.status();
1750 let content_type = resp
1751 .headers()
1752 .get("content-type")
1753 .and_then(|v| v.to_str().ok())
1754 .unwrap_or("application/octet-stream");
1755 let content_type = super::ContentType::from(content_type);
1756
1757 if !status.is_client_error() && !status.is_server_error() {
1758 let content = resp.text().await?;
1759 match content_type {
1760 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1761 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::NotificationRule`"))),
1762 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::NotificationRule`")))),
1763 }
1764 } else {
1765 let content = resp.text().await?;
1766 let entity: Option<EventsRulesUpdateError> = serde_json::from_str(&content).ok();
1767 Err(Error::ResponseError(ResponseContent {
1768 status,
1769 content,
1770 entity,
1771 }))
1772 }
1773}
1774
1775pub async fn events_rules_used_by_list(
1777 configuration: &configuration::Configuration,
1778 pbm_uuid: &str,
1779) -> Result<Vec<models::UsedBy>, Error<EventsRulesUsedByListError>> {
1780 let p_path_pbm_uuid = pbm_uuid;
1782
1783 let uri_str = format!(
1784 "{}/events/rules/{pbm_uuid}/used_by/",
1785 configuration.base_path,
1786 pbm_uuid = crate::apis::urlencode(p_path_pbm_uuid)
1787 );
1788 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1789
1790 if let Some(ref user_agent) = configuration.user_agent {
1791 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1792 }
1793 if let Some(ref token) = configuration.bearer_access_token {
1794 req_builder = req_builder.bearer_auth(token.to_owned());
1795 };
1796
1797 let req = req_builder.build()?;
1798 let resp = configuration.client.execute(req).await?;
1799
1800 let status = resp.status();
1801 let content_type = resp
1802 .headers()
1803 .get("content-type")
1804 .and_then(|v| v.to_str().ok())
1805 .unwrap_or("application/octet-stream");
1806 let content_type = super::ContentType::from(content_type);
1807
1808 if !status.is_client_error() && !status.is_server_error() {
1809 let content = resp.text().await?;
1810 match content_type {
1811 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1812 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::UsedBy>`"))),
1813 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::UsedBy>`")))),
1814 }
1815 } else {
1816 let content = resp.text().await?;
1817 let entity: Option<EventsRulesUsedByListError> = serde_json::from_str(&content).ok();
1818 Err(Error::ResponseError(ResponseContent {
1819 status,
1820 content,
1821 entity,
1822 }))
1823 }
1824}
1825
1826pub async fn events_transports_create(
1828 configuration: &configuration::Configuration,
1829 notification_transport_request: models::NotificationTransportRequest,
1830) -> Result<models::NotificationTransport, Error<EventsTransportsCreateError>> {
1831 let p_body_notification_transport_request = notification_transport_request;
1833
1834 let uri_str = format!("{}/events/transports/", configuration.base_path);
1835 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1836
1837 if let Some(ref user_agent) = configuration.user_agent {
1838 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1839 }
1840 if let Some(ref token) = configuration.bearer_access_token {
1841 req_builder = req_builder.bearer_auth(token.to_owned());
1842 };
1843 req_builder = req_builder.json(&p_body_notification_transport_request);
1844
1845 let req = req_builder.build()?;
1846 let resp = configuration.client.execute(req).await?;
1847
1848 let status = resp.status();
1849 let content_type = resp
1850 .headers()
1851 .get("content-type")
1852 .and_then(|v| v.to_str().ok())
1853 .unwrap_or("application/octet-stream");
1854 let content_type = super::ContentType::from(content_type);
1855
1856 if !status.is_client_error() && !status.is_server_error() {
1857 let content = resp.text().await?;
1858 match content_type {
1859 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1860 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::NotificationTransport`"))),
1861 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::NotificationTransport`")))),
1862 }
1863 } else {
1864 let content = resp.text().await?;
1865 let entity: Option<EventsTransportsCreateError> = serde_json::from_str(&content).ok();
1866 Err(Error::ResponseError(ResponseContent {
1867 status,
1868 content,
1869 entity,
1870 }))
1871 }
1872}
1873
1874pub async fn events_transports_destroy(
1876 configuration: &configuration::Configuration,
1877 uuid: &str,
1878) -> Result<(), Error<EventsTransportsDestroyError>> {
1879 let p_path_uuid = uuid;
1881
1882 let uri_str = format!(
1883 "{}/events/transports/{uuid}/",
1884 configuration.base_path,
1885 uuid = crate::apis::urlencode(p_path_uuid)
1886 );
1887 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
1888
1889 if let Some(ref user_agent) = configuration.user_agent {
1890 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1891 }
1892 if let Some(ref token) = configuration.bearer_access_token {
1893 req_builder = req_builder.bearer_auth(token.to_owned());
1894 };
1895
1896 let req = req_builder.build()?;
1897 let resp = configuration.client.execute(req).await?;
1898
1899 let status = resp.status();
1900
1901 if !status.is_client_error() && !status.is_server_error() {
1902 Ok(())
1903 } else {
1904 let content = resp.text().await?;
1905 let entity: Option<EventsTransportsDestroyError> = serde_json::from_str(&content).ok();
1906 Err(Error::ResponseError(ResponseContent {
1907 status,
1908 content,
1909 entity,
1910 }))
1911 }
1912}
1913
1914pub async fn events_transports_list(
1916 configuration: &configuration::Configuration,
1917 mode: Option<&str>,
1918 name: Option<&str>,
1919 ordering: Option<&str>,
1920 page: Option<i32>,
1921 page_size: Option<i32>,
1922 search: Option<&str>,
1923 send_once: Option<bool>,
1924 webhook_url: Option<&str>,
1925) -> Result<models::PaginatedNotificationTransportList, Error<EventsTransportsListError>> {
1926 let p_query_mode = mode;
1928 let p_query_name = name;
1929 let p_query_ordering = ordering;
1930 let p_query_page = page;
1931 let p_query_page_size = page_size;
1932 let p_query_search = search;
1933 let p_query_send_once = send_once;
1934 let p_query_webhook_url = webhook_url;
1935
1936 let uri_str = format!("{}/events/transports/", configuration.base_path);
1937 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1938
1939 if let Some(ref param_value) = p_query_mode {
1940 req_builder = req_builder.query(&[("mode", ¶m_value.to_string())]);
1941 }
1942 if let Some(ref param_value) = p_query_name {
1943 req_builder = req_builder.query(&[("name", ¶m_value.to_string())]);
1944 }
1945 if let Some(ref param_value) = p_query_ordering {
1946 req_builder = req_builder.query(&[("ordering", ¶m_value.to_string())]);
1947 }
1948 if let Some(ref param_value) = p_query_page {
1949 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
1950 }
1951 if let Some(ref param_value) = p_query_page_size {
1952 req_builder = req_builder.query(&[("page_size", ¶m_value.to_string())]);
1953 }
1954 if let Some(ref param_value) = p_query_search {
1955 req_builder = req_builder.query(&[("search", ¶m_value.to_string())]);
1956 }
1957 if let Some(ref param_value) = p_query_send_once {
1958 req_builder = req_builder.query(&[("send_once", ¶m_value.to_string())]);
1959 }
1960 if let Some(ref param_value) = p_query_webhook_url {
1961 req_builder = req_builder.query(&[("webhook_url", ¶m_value.to_string())]);
1962 }
1963 if let Some(ref user_agent) = configuration.user_agent {
1964 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1965 }
1966 if let Some(ref token) = configuration.bearer_access_token {
1967 req_builder = req_builder.bearer_auth(token.to_owned());
1968 };
1969
1970 let req = req_builder.build()?;
1971 let resp = configuration.client.execute(req).await?;
1972
1973 let status = resp.status();
1974 let content_type = resp
1975 .headers()
1976 .get("content-type")
1977 .and_then(|v| v.to_str().ok())
1978 .unwrap_or("application/octet-stream");
1979 let content_type = super::ContentType::from(content_type);
1980
1981 if !status.is_client_error() && !status.is_server_error() {
1982 let content = resp.text().await?;
1983 match content_type {
1984 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1985 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaginatedNotificationTransportList`"))),
1986 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PaginatedNotificationTransportList`")))),
1987 }
1988 } else {
1989 let content = resp.text().await?;
1990 let entity: Option<EventsTransportsListError> = serde_json::from_str(&content).ok();
1991 Err(Error::ResponseError(ResponseContent {
1992 status,
1993 content,
1994 entity,
1995 }))
1996 }
1997}
1998
1999pub async fn events_transports_partial_update(
2001 configuration: &configuration::Configuration,
2002 uuid: &str,
2003 patched_notification_transport_request: Option<models::PatchedNotificationTransportRequest>,
2004) -> Result<models::NotificationTransport, Error<EventsTransportsPartialUpdateError>> {
2005 let p_path_uuid = uuid;
2007 let p_body_patched_notification_transport_request = patched_notification_transport_request;
2008
2009 let uri_str = format!(
2010 "{}/events/transports/{uuid}/",
2011 configuration.base_path,
2012 uuid = crate::apis::urlencode(p_path_uuid)
2013 );
2014 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
2015
2016 if let Some(ref user_agent) = configuration.user_agent {
2017 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2018 }
2019 if let Some(ref token) = configuration.bearer_access_token {
2020 req_builder = req_builder.bearer_auth(token.to_owned());
2021 };
2022 req_builder = req_builder.json(&p_body_patched_notification_transport_request);
2023
2024 let req = req_builder.build()?;
2025 let resp = configuration.client.execute(req).await?;
2026
2027 let status = resp.status();
2028 let content_type = resp
2029 .headers()
2030 .get("content-type")
2031 .and_then(|v| v.to_str().ok())
2032 .unwrap_or("application/octet-stream");
2033 let content_type = super::ContentType::from(content_type);
2034
2035 if !status.is_client_error() && !status.is_server_error() {
2036 let content = resp.text().await?;
2037 match content_type {
2038 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2039 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::NotificationTransport`"))),
2040 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::NotificationTransport`")))),
2041 }
2042 } else {
2043 let content = resp.text().await?;
2044 let entity: Option<EventsTransportsPartialUpdateError> = serde_json::from_str(&content).ok();
2045 Err(Error::ResponseError(ResponseContent {
2046 status,
2047 content,
2048 entity,
2049 }))
2050 }
2051}
2052
2053pub async fn events_transports_retrieve(
2055 configuration: &configuration::Configuration,
2056 uuid: &str,
2057) -> Result<models::NotificationTransport, Error<EventsTransportsRetrieveError>> {
2058 let p_path_uuid = uuid;
2060
2061 let uri_str = format!(
2062 "{}/events/transports/{uuid}/",
2063 configuration.base_path,
2064 uuid = crate::apis::urlencode(p_path_uuid)
2065 );
2066 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2067
2068 if let Some(ref user_agent) = configuration.user_agent {
2069 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2070 }
2071 if let Some(ref token) = configuration.bearer_access_token {
2072 req_builder = req_builder.bearer_auth(token.to_owned());
2073 };
2074
2075 let req = req_builder.build()?;
2076 let resp = configuration.client.execute(req).await?;
2077
2078 let status = resp.status();
2079 let content_type = resp
2080 .headers()
2081 .get("content-type")
2082 .and_then(|v| v.to_str().ok())
2083 .unwrap_or("application/octet-stream");
2084 let content_type = super::ContentType::from(content_type);
2085
2086 if !status.is_client_error() && !status.is_server_error() {
2087 let content = resp.text().await?;
2088 match content_type {
2089 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2090 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::NotificationTransport`"))),
2091 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::NotificationTransport`")))),
2092 }
2093 } else {
2094 let content = resp.text().await?;
2095 let entity: Option<EventsTransportsRetrieveError> = serde_json::from_str(&content).ok();
2096 Err(Error::ResponseError(ResponseContent {
2097 status,
2098 content,
2099 entity,
2100 }))
2101 }
2102}
2103
2104pub async fn events_transports_test_create(
2106 configuration: &configuration::Configuration,
2107 uuid: &str,
2108) -> Result<models::NotificationTransportTest, Error<EventsTransportsTestCreateError>> {
2109 let p_path_uuid = uuid;
2111
2112 let uri_str = format!(
2113 "{}/events/transports/{uuid}/test/",
2114 configuration.base_path,
2115 uuid = crate::apis::urlencode(p_path_uuid)
2116 );
2117 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
2118
2119 if let Some(ref user_agent) = configuration.user_agent {
2120 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2121 }
2122 if let Some(ref token) = configuration.bearer_access_token {
2123 req_builder = req_builder.bearer_auth(token.to_owned());
2124 };
2125
2126 let req = req_builder.build()?;
2127 let resp = configuration.client.execute(req).await?;
2128
2129 let status = resp.status();
2130 let content_type = resp
2131 .headers()
2132 .get("content-type")
2133 .and_then(|v| v.to_str().ok())
2134 .unwrap_or("application/octet-stream");
2135 let content_type = super::ContentType::from(content_type);
2136
2137 if !status.is_client_error() && !status.is_server_error() {
2138 let content = resp.text().await?;
2139 match content_type {
2140 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2141 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::NotificationTransportTest`"))),
2142 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::NotificationTransportTest`")))),
2143 }
2144 } else {
2145 let content = resp.text().await?;
2146 let entity: Option<EventsTransportsTestCreateError> = serde_json::from_str(&content).ok();
2147 Err(Error::ResponseError(ResponseContent {
2148 status,
2149 content,
2150 entity,
2151 }))
2152 }
2153}
2154
2155pub async fn events_transports_update(
2157 configuration: &configuration::Configuration,
2158 uuid: &str,
2159 notification_transport_request: models::NotificationTransportRequest,
2160) -> Result<models::NotificationTransport, Error<EventsTransportsUpdateError>> {
2161 let p_path_uuid = uuid;
2163 let p_body_notification_transport_request = notification_transport_request;
2164
2165 let uri_str = format!(
2166 "{}/events/transports/{uuid}/",
2167 configuration.base_path,
2168 uuid = crate::apis::urlencode(p_path_uuid)
2169 );
2170 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
2171
2172 if let Some(ref user_agent) = configuration.user_agent {
2173 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2174 }
2175 if let Some(ref token) = configuration.bearer_access_token {
2176 req_builder = req_builder.bearer_auth(token.to_owned());
2177 };
2178 req_builder = req_builder.json(&p_body_notification_transport_request);
2179
2180 let req = req_builder.build()?;
2181 let resp = configuration.client.execute(req).await?;
2182
2183 let status = resp.status();
2184 let content_type = resp
2185 .headers()
2186 .get("content-type")
2187 .and_then(|v| v.to_str().ok())
2188 .unwrap_or("application/octet-stream");
2189 let content_type = super::ContentType::from(content_type);
2190
2191 if !status.is_client_error() && !status.is_server_error() {
2192 let content = resp.text().await?;
2193 match content_type {
2194 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2195 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::NotificationTransport`"))),
2196 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::NotificationTransport`")))),
2197 }
2198 } else {
2199 let content = resp.text().await?;
2200 let entity: Option<EventsTransportsUpdateError> = serde_json::from_str(&content).ok();
2201 Err(Error::ResponseError(ResponseContent {
2202 status,
2203 content,
2204 entity,
2205 }))
2206 }
2207}
2208
2209pub async fn events_transports_used_by_list(
2211 configuration: &configuration::Configuration,
2212 uuid: &str,
2213) -> Result<Vec<models::UsedBy>, Error<EventsTransportsUsedByListError>> {
2214 let p_path_uuid = uuid;
2216
2217 let uri_str = format!(
2218 "{}/events/transports/{uuid}/used_by/",
2219 configuration.base_path,
2220 uuid = crate::apis::urlencode(p_path_uuid)
2221 );
2222 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2223
2224 if let Some(ref user_agent) = configuration.user_agent {
2225 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2226 }
2227 if let Some(ref token) = configuration.bearer_access_token {
2228 req_builder = req_builder.bearer_auth(token.to_owned());
2229 };
2230
2231 let req = req_builder.build()?;
2232 let resp = configuration.client.execute(req).await?;
2233
2234 let status = resp.status();
2235 let content_type = resp
2236 .headers()
2237 .get("content-type")
2238 .and_then(|v| v.to_str().ok())
2239 .unwrap_or("application/octet-stream");
2240 let content_type = super::ContentType::from(content_type);
2241
2242 if !status.is_client_error() && !status.is_server_error() {
2243 let content = resp.text().await?;
2244 match content_type {
2245 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2246 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::UsedBy>`"))),
2247 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::UsedBy>`")))),
2248 }
2249 } else {
2250 let content = resp.text().await?;
2251 let entity: Option<EventsTransportsUsedByListError> = serde_json::from_str(&content).ok();
2252 Err(Error::ResponseError(ResponseContent {
2253 status,
2254 content,
2255 entity,
2256 }))
2257 }
2258}