authentik_rust/apis/
events_api.rs

1/*
2 * authentik
3 *
4 * Making authentication simple.
5 *
6 * The version of the OpenAPI document: 2024.2.1
7 * Contact: hello@goauthentik.io
8 * Generated by: https://openapi-generator.tech
9 */
10
11
12use reqwest;
13
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration};
16
17
18/// struct for typed errors of method [`events_events_actions_list`]
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum EventsEventsActionsListError {
22    Status400(models::ValidationError),
23    Status403(models::GenericError),
24    UnknownValue(serde_json::Value),
25}
26
27/// struct for typed errors of method [`events_events_create`]
28#[derive(Debug, Clone, Serialize, Deserialize)]
29#[serde(untagged)]
30pub enum EventsEventsCreateError {
31    Status400(models::ValidationError),
32    Status403(models::GenericError),
33    UnknownValue(serde_json::Value),
34}
35
36/// struct for typed errors of method [`events_events_destroy`]
37#[derive(Debug, Clone, Serialize, Deserialize)]
38#[serde(untagged)]
39pub enum EventsEventsDestroyError {
40    Status400(models::ValidationError),
41    Status403(models::GenericError),
42    UnknownValue(serde_json::Value),
43}
44
45/// struct for typed errors of method [`events_events_list`]
46#[derive(Debug, Clone, Serialize, Deserialize)]
47#[serde(untagged)]
48pub enum EventsEventsListError {
49    Status400(models::ValidationError),
50    Status403(models::GenericError),
51    UnknownValue(serde_json::Value),
52}
53
54/// struct for typed errors of method [`events_events_partial_update`]
55#[derive(Debug, Clone, Serialize, Deserialize)]
56#[serde(untagged)]
57pub enum EventsEventsPartialUpdateError {
58    Status400(models::ValidationError),
59    Status403(models::GenericError),
60    UnknownValue(serde_json::Value),
61}
62
63/// struct for typed errors of method [`events_events_per_month_list`]
64#[derive(Debug, Clone, Serialize, Deserialize)]
65#[serde(untagged)]
66pub enum EventsEventsPerMonthListError {
67    Status400(models::ValidationError),
68    Status403(models::GenericError),
69    UnknownValue(serde_json::Value),
70}
71
72/// struct for typed errors of method [`events_events_retrieve`]
73#[derive(Debug, Clone, Serialize, Deserialize)]
74#[serde(untagged)]
75pub enum EventsEventsRetrieveError {
76    Status400(models::ValidationError),
77    Status403(models::GenericError),
78    UnknownValue(serde_json::Value),
79}
80
81/// struct for typed errors of method [`events_events_top_per_user_list`]
82#[derive(Debug, Clone, Serialize, Deserialize)]
83#[serde(untagged)]
84pub enum EventsEventsTopPerUserListError {
85    Status400(models::ValidationError),
86    Status403(models::GenericError),
87    UnknownValue(serde_json::Value),
88}
89
90/// struct for typed errors of method [`events_events_update`]
91#[derive(Debug, Clone, Serialize, Deserialize)]
92#[serde(untagged)]
93pub enum EventsEventsUpdateError {
94    Status400(models::ValidationError),
95    Status403(models::GenericError),
96    UnknownValue(serde_json::Value),
97}
98
99/// struct for typed errors of method [`events_events_volume_list`]
100#[derive(Debug, Clone, Serialize, Deserialize)]
101#[serde(untagged)]
102pub enum EventsEventsVolumeListError {
103    Status400(models::ValidationError),
104    Status403(models::GenericError),
105    UnknownValue(serde_json::Value),
106}
107
108/// struct for typed errors of method [`events_notifications_destroy`]
109#[derive(Debug, Clone, Serialize, Deserialize)]
110#[serde(untagged)]
111pub enum EventsNotificationsDestroyError {
112    Status400(models::ValidationError),
113    Status403(models::GenericError),
114    UnknownValue(serde_json::Value),
115}
116
117/// struct for typed errors of method [`events_notifications_list`]
118#[derive(Debug, Clone, Serialize, Deserialize)]
119#[serde(untagged)]
120pub enum EventsNotificationsListError {
121    Status400(models::ValidationError),
122    Status403(models::GenericError),
123    UnknownValue(serde_json::Value),
124}
125
126/// struct for typed errors of method [`events_notifications_mark_all_seen_create`]
127#[derive(Debug, Clone, Serialize, Deserialize)]
128#[serde(untagged)]
129pub enum EventsNotificationsMarkAllSeenCreateError {
130    Status400(models::ValidationError),
131    Status403(models::GenericError),
132    UnknownValue(serde_json::Value),
133}
134
135/// struct for typed errors of method [`events_notifications_partial_update`]
136#[derive(Debug, Clone, Serialize, Deserialize)]
137#[serde(untagged)]
138pub enum EventsNotificationsPartialUpdateError {
139    Status400(models::ValidationError),
140    Status403(models::GenericError),
141    UnknownValue(serde_json::Value),
142}
143
144/// struct for typed errors of method [`events_notifications_retrieve`]
145#[derive(Debug, Clone, Serialize, Deserialize)]
146#[serde(untagged)]
147pub enum EventsNotificationsRetrieveError {
148    Status400(models::ValidationError),
149    Status403(models::GenericError),
150    UnknownValue(serde_json::Value),
151}
152
153/// struct for typed errors of method [`events_notifications_update`]
154#[derive(Debug, Clone, Serialize, Deserialize)]
155#[serde(untagged)]
156pub enum EventsNotificationsUpdateError {
157    Status400(models::ValidationError),
158    Status403(models::GenericError),
159    UnknownValue(serde_json::Value),
160}
161
162/// struct for typed errors of method [`events_notifications_used_by_list`]
163#[derive(Debug, Clone, Serialize, Deserialize)]
164#[serde(untagged)]
165pub enum EventsNotificationsUsedByListError {
166    Status400(models::ValidationError),
167    Status403(models::GenericError),
168    UnknownValue(serde_json::Value),
169}
170
171/// struct for typed errors of method [`events_rules_create`]
172#[derive(Debug, Clone, Serialize, Deserialize)]
173#[serde(untagged)]
174pub enum EventsRulesCreateError {
175    Status400(models::ValidationError),
176    Status403(models::GenericError),
177    UnknownValue(serde_json::Value),
178}
179
180/// struct for typed errors of method [`events_rules_destroy`]
181#[derive(Debug, Clone, Serialize, Deserialize)]
182#[serde(untagged)]
183pub enum EventsRulesDestroyError {
184    Status400(models::ValidationError),
185    Status403(models::GenericError),
186    UnknownValue(serde_json::Value),
187}
188
189/// struct for typed errors of method [`events_rules_list`]
190#[derive(Debug, Clone, Serialize, Deserialize)]
191#[serde(untagged)]
192pub enum EventsRulesListError {
193    Status400(models::ValidationError),
194    Status403(models::GenericError),
195    UnknownValue(serde_json::Value),
196}
197
198/// struct for typed errors of method [`events_rules_partial_update`]
199#[derive(Debug, Clone, Serialize, Deserialize)]
200#[serde(untagged)]
201pub enum EventsRulesPartialUpdateError {
202    Status400(models::ValidationError),
203    Status403(models::GenericError),
204    UnknownValue(serde_json::Value),
205}
206
207/// struct for typed errors of method [`events_rules_retrieve`]
208#[derive(Debug, Clone, Serialize, Deserialize)]
209#[serde(untagged)]
210pub enum EventsRulesRetrieveError {
211    Status400(models::ValidationError),
212    Status403(models::GenericError),
213    UnknownValue(serde_json::Value),
214}
215
216/// struct for typed errors of method [`events_rules_update`]
217#[derive(Debug, Clone, Serialize, Deserialize)]
218#[serde(untagged)]
219pub enum EventsRulesUpdateError {
220    Status400(models::ValidationError),
221    Status403(models::GenericError),
222    UnknownValue(serde_json::Value),
223}
224
225/// struct for typed errors of method [`events_rules_used_by_list`]
226#[derive(Debug, Clone, Serialize, Deserialize)]
227#[serde(untagged)]
228pub enum EventsRulesUsedByListError {
229    Status400(models::ValidationError),
230    Status403(models::GenericError),
231    UnknownValue(serde_json::Value),
232}
233
234/// struct for typed errors of method [`events_system_tasks_list`]
235#[derive(Debug, Clone, Serialize, Deserialize)]
236#[serde(untagged)]
237pub enum EventsSystemTasksListError {
238    Status400(models::ValidationError),
239    Status403(models::GenericError),
240    UnknownValue(serde_json::Value),
241}
242
243/// struct for typed errors of method [`events_system_tasks_retrieve`]
244#[derive(Debug, Clone, Serialize, Deserialize)]
245#[serde(untagged)]
246pub enum EventsSystemTasksRetrieveError {
247    Status400(models::ValidationError),
248    Status403(models::GenericError),
249    UnknownValue(serde_json::Value),
250}
251
252/// struct for typed errors of method [`events_system_tasks_run_create`]
253#[derive(Debug, Clone, Serialize, Deserialize)]
254#[serde(untagged)]
255pub enum EventsSystemTasksRunCreateError {
256    Status404(),
257    Status500(),
258    Status400(models::ValidationError),
259    Status403(models::GenericError),
260    UnknownValue(serde_json::Value),
261}
262
263/// struct for typed errors of method [`events_transports_create`]
264#[derive(Debug, Clone, Serialize, Deserialize)]
265#[serde(untagged)]
266pub enum EventsTransportsCreateError {
267    Status400(models::ValidationError),
268    Status403(models::GenericError),
269    UnknownValue(serde_json::Value),
270}
271
272/// struct for typed errors of method [`events_transports_destroy`]
273#[derive(Debug, Clone, Serialize, Deserialize)]
274#[serde(untagged)]
275pub enum EventsTransportsDestroyError {
276    Status400(models::ValidationError),
277    Status403(models::GenericError),
278    UnknownValue(serde_json::Value),
279}
280
281/// struct for typed errors of method [`events_transports_list`]
282#[derive(Debug, Clone, Serialize, Deserialize)]
283#[serde(untagged)]
284pub enum EventsTransportsListError {
285    Status400(models::ValidationError),
286    Status403(models::GenericError),
287    UnknownValue(serde_json::Value),
288}
289
290/// struct for typed errors of method [`events_transports_partial_update`]
291#[derive(Debug, Clone, Serialize, Deserialize)]
292#[serde(untagged)]
293pub enum EventsTransportsPartialUpdateError {
294    Status400(models::ValidationError),
295    Status403(models::GenericError),
296    UnknownValue(serde_json::Value),
297}
298
299/// struct for typed errors of method [`events_transports_retrieve`]
300#[derive(Debug, Clone, Serialize, Deserialize)]
301#[serde(untagged)]
302pub enum EventsTransportsRetrieveError {
303    Status400(models::ValidationError),
304    Status403(models::GenericError),
305    UnknownValue(serde_json::Value),
306}
307
308/// struct for typed errors of method [`events_transports_test_create`]
309#[derive(Debug, Clone, Serialize, Deserialize)]
310#[serde(untagged)]
311pub enum EventsTransportsTestCreateError {
312    Status500(),
313    Status400(models::ValidationError),
314    Status403(models::GenericError),
315    UnknownValue(serde_json::Value),
316}
317
318/// struct for typed errors of method [`events_transports_update`]
319#[derive(Debug, Clone, Serialize, Deserialize)]
320#[serde(untagged)]
321pub enum EventsTransportsUpdateError {
322    Status400(models::ValidationError),
323    Status403(models::GenericError),
324    UnknownValue(serde_json::Value),
325}
326
327/// struct for typed errors of method [`events_transports_used_by_list`]
328#[derive(Debug, Clone, Serialize, Deserialize)]
329#[serde(untagged)]
330pub enum EventsTransportsUsedByListError {
331    Status400(models::ValidationError),
332    Status403(models::GenericError),
333    UnknownValue(serde_json::Value),
334}
335
336
337/// Get all actions
338pub async fn events_events_actions_list(configuration: &configuration::Configuration, ) -> Result<Vec<models::TypeCreate>, Error<EventsEventsActionsListError>> {
339    let local_var_configuration = configuration;
340
341    let local_var_client = &local_var_configuration.client;
342
343    let local_var_uri_str = format!("{}/events/events/actions/", local_var_configuration.base_path);
344    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
345
346    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
347        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
348    }
349    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
350        let local_var_key = local_var_apikey.key.clone();
351        let local_var_value = match local_var_apikey.prefix {
352            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
353            None => local_var_key,
354        };
355        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
356    };
357
358    let local_var_req = local_var_req_builder.build()?;
359    let local_var_resp = local_var_client.execute(local_var_req).await?;
360
361    let local_var_status = local_var_resp.status();
362    let local_var_content = local_var_resp.text().await?;
363
364    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
365        serde_json::from_str(&local_var_content).map_err(Error::from)
366    } else {
367        let local_var_entity: Option<EventsEventsActionsListError> = serde_json::from_str(&local_var_content).ok();
368        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
369        Err(Error::ResponseError(local_var_error))
370    }
371}
372
373/// Event Read-Only Viewset
374pub async fn events_events_create(configuration: &configuration::Configuration, event_request: models::EventRequest) -> Result<models::Event, Error<EventsEventsCreateError>> {
375    let local_var_configuration = configuration;
376
377    let local_var_client = &local_var_configuration.client;
378
379    let local_var_uri_str = format!("{}/events/events/", local_var_configuration.base_path);
380    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
381
382    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
383        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
384    }
385    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
386        let local_var_key = local_var_apikey.key.clone();
387        let local_var_value = match local_var_apikey.prefix {
388            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
389            None => local_var_key,
390        };
391        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
392    };
393    local_var_req_builder = local_var_req_builder.json(&event_request);
394
395    let local_var_req = local_var_req_builder.build()?;
396    let local_var_resp = local_var_client.execute(local_var_req).await?;
397
398    let local_var_status = local_var_resp.status();
399    let local_var_content = local_var_resp.text().await?;
400
401    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
402        serde_json::from_str(&local_var_content).map_err(Error::from)
403    } else {
404        let local_var_entity: Option<EventsEventsCreateError> = serde_json::from_str(&local_var_content).ok();
405        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
406        Err(Error::ResponseError(local_var_error))
407    }
408}
409
410/// Event Read-Only Viewset
411pub async fn events_events_destroy(configuration: &configuration::Configuration, event_uuid: &str) -> Result<(), Error<EventsEventsDestroyError>> {
412    let local_var_configuration = configuration;
413
414    let local_var_client = &local_var_configuration.client;
415
416    let local_var_uri_str = format!("{}/events/events/{event_uuid}/", local_var_configuration.base_path, event_uuid=crate::apis::urlencode(event_uuid));
417    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
418
419    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
420        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
421    }
422    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
423        let local_var_key = local_var_apikey.key.clone();
424        let local_var_value = match local_var_apikey.prefix {
425            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
426            None => local_var_key,
427        };
428        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
429    };
430
431    let local_var_req = local_var_req_builder.build()?;
432    let local_var_resp = local_var_client.execute(local_var_req).await?;
433
434    let local_var_status = local_var_resp.status();
435    let local_var_content = local_var_resp.text().await?;
436
437    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
438        Ok(())
439    } else {
440        let local_var_entity: Option<EventsEventsDestroyError> = serde_json::from_str(&local_var_content).ok();
441        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
442        Err(Error::ResponseError(local_var_error))
443    }
444}
445
446/// Event Read-Only Viewset
447pub async fn events_events_list(configuration: &configuration::Configuration, action: Option<&str>, brand_name: Option<&str>, client_ip: Option<&str>, context_authorized_app: Option<&str>, context_model_app: Option<&str>, context_model_name: Option<&str>, context_model_pk: Option<&str>, ordering: Option<&str>, page: Option<i32>, page_size: Option<i32>, search: Option<&str>, username: Option<&str>) -> Result<models::PaginatedEventList, Error<EventsEventsListError>> {
448    let local_var_configuration = configuration;
449
450    let local_var_client = &local_var_configuration.client;
451
452    let local_var_uri_str = format!("{}/events/events/", local_var_configuration.base_path);
453    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
454
455    if let Some(ref local_var_str) = action {
456        local_var_req_builder = local_var_req_builder.query(&[("action", &local_var_str.to_string())]);
457    }
458    if let Some(ref local_var_str) = brand_name {
459        local_var_req_builder = local_var_req_builder.query(&[("brand_name", &local_var_str.to_string())]);
460    }
461    if let Some(ref local_var_str) = client_ip {
462        local_var_req_builder = local_var_req_builder.query(&[("client_ip", &local_var_str.to_string())]);
463    }
464    if let Some(ref local_var_str) = context_authorized_app {
465        local_var_req_builder = local_var_req_builder.query(&[("context_authorized_app", &local_var_str.to_string())]);
466    }
467    if let Some(ref local_var_str) = context_model_app {
468        local_var_req_builder = local_var_req_builder.query(&[("context_model_app", &local_var_str.to_string())]);
469    }
470    if let Some(ref local_var_str) = context_model_name {
471        local_var_req_builder = local_var_req_builder.query(&[("context_model_name", &local_var_str.to_string())]);
472    }
473    if let Some(ref local_var_str) = context_model_pk {
474        local_var_req_builder = local_var_req_builder.query(&[("context_model_pk", &local_var_str.to_string())]);
475    }
476    if let Some(ref local_var_str) = ordering {
477        local_var_req_builder = local_var_req_builder.query(&[("ordering", &local_var_str.to_string())]);
478    }
479    if let Some(ref local_var_str) = page {
480        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
481    }
482    if let Some(ref local_var_str) = page_size {
483        local_var_req_builder = local_var_req_builder.query(&[("page_size", &local_var_str.to_string())]);
484    }
485    if let Some(ref local_var_str) = search {
486        local_var_req_builder = local_var_req_builder.query(&[("search", &local_var_str.to_string())]);
487    }
488    if let Some(ref local_var_str) = username {
489        local_var_req_builder = local_var_req_builder.query(&[("username", &local_var_str.to_string())]);
490    }
491    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
492        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
493    }
494    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
495        let local_var_key = local_var_apikey.key.clone();
496        let local_var_value = match local_var_apikey.prefix {
497            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
498            None => local_var_key,
499        };
500        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
501    };
502
503    let local_var_req = local_var_req_builder.build()?;
504    let local_var_resp = local_var_client.execute(local_var_req).await?;
505
506    let local_var_status = local_var_resp.status();
507    let local_var_content = local_var_resp.text().await?;
508
509    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
510        serde_json::from_str(&local_var_content).map_err(Error::from)
511    } else {
512        let local_var_entity: Option<EventsEventsListError> = serde_json::from_str(&local_var_content).ok();
513        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
514        Err(Error::ResponseError(local_var_error))
515    }
516}
517
518/// Event Read-Only Viewset
519pub async fn events_events_partial_update(configuration: &configuration::Configuration, event_uuid: &str, patched_event_request: Option<models::PatchedEventRequest>) -> Result<models::Event, Error<EventsEventsPartialUpdateError>> {
520    let local_var_configuration = configuration;
521
522    let local_var_client = &local_var_configuration.client;
523
524    let local_var_uri_str = format!("{}/events/events/{event_uuid}/", local_var_configuration.base_path, event_uuid=crate::apis::urlencode(event_uuid));
525    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
526
527    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
528        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
529    }
530    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
531        let local_var_key = local_var_apikey.key.clone();
532        let local_var_value = match local_var_apikey.prefix {
533            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
534            None => local_var_key,
535        };
536        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
537    };
538    local_var_req_builder = local_var_req_builder.json(&patched_event_request);
539
540    let local_var_req = local_var_req_builder.build()?;
541    let local_var_resp = local_var_client.execute(local_var_req).await?;
542
543    let local_var_status = local_var_resp.status();
544    let local_var_content = local_var_resp.text().await?;
545
546    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
547        serde_json::from_str(&local_var_content).map_err(Error::from)
548    } else {
549        let local_var_entity: Option<EventsEventsPartialUpdateError> = serde_json::from_str(&local_var_content).ok();
550        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
551        Err(Error::ResponseError(local_var_error))
552    }
553}
554
555/// Get the count of events per month
556pub async fn events_events_per_month_list(configuration: &configuration::Configuration, action: Option<&str>, query: Option<&str>) -> Result<Vec<models::Coordinate>, Error<EventsEventsPerMonthListError>> {
557    let local_var_configuration = configuration;
558
559    let local_var_client = &local_var_configuration.client;
560
561    let local_var_uri_str = format!("{}/events/events/per_month/", local_var_configuration.base_path);
562    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
563
564    if let Some(ref local_var_str) = action {
565        local_var_req_builder = local_var_req_builder.query(&[("action", &local_var_str.to_string())]);
566    }
567    if let Some(ref local_var_str) = query {
568        local_var_req_builder = local_var_req_builder.query(&[("query", &local_var_str.to_string())]);
569    }
570    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
571        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
572    }
573    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
574        let local_var_key = local_var_apikey.key.clone();
575        let local_var_value = match local_var_apikey.prefix {
576            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
577            None => local_var_key,
578        };
579        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
580    };
581
582    let local_var_req = local_var_req_builder.build()?;
583    let local_var_resp = local_var_client.execute(local_var_req).await?;
584
585    let local_var_status = local_var_resp.status();
586    let local_var_content = local_var_resp.text().await?;
587
588    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
589        serde_json::from_str(&local_var_content).map_err(Error::from)
590    } else {
591        let local_var_entity: Option<EventsEventsPerMonthListError> = serde_json::from_str(&local_var_content).ok();
592        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
593        Err(Error::ResponseError(local_var_error))
594    }
595}
596
597/// Event Read-Only Viewset
598pub async fn events_events_retrieve(configuration: &configuration::Configuration, event_uuid: &str) -> Result<models::Event, Error<EventsEventsRetrieveError>> {
599    let local_var_configuration = configuration;
600
601    let local_var_client = &local_var_configuration.client;
602
603    let local_var_uri_str = format!("{}/events/events/{event_uuid}/", local_var_configuration.base_path, event_uuid=crate::apis::urlencode(event_uuid));
604    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
605
606    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
607        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
608    }
609    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
610        let local_var_key = local_var_apikey.key.clone();
611        let local_var_value = match local_var_apikey.prefix {
612            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
613            None => local_var_key,
614        };
615        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
616    };
617
618    let local_var_req = local_var_req_builder.build()?;
619    let local_var_resp = local_var_client.execute(local_var_req).await?;
620
621    let local_var_status = local_var_resp.status();
622    let local_var_content = local_var_resp.text().await?;
623
624    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
625        serde_json::from_str(&local_var_content).map_err(Error::from)
626    } else {
627        let local_var_entity: Option<EventsEventsRetrieveError> = serde_json::from_str(&local_var_content).ok();
628        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
629        Err(Error::ResponseError(local_var_error))
630    }
631}
632
633/// Get the top_n events grouped by user count
634pub async fn events_events_top_per_user_list(configuration: &configuration::Configuration, action: Option<&str>, top_n: Option<i32>) -> Result<Vec<models::EventTopPerUser>, Error<EventsEventsTopPerUserListError>> {
635    let local_var_configuration = configuration;
636
637    let local_var_client = &local_var_configuration.client;
638
639    let local_var_uri_str = format!("{}/events/events/top_per_user/", local_var_configuration.base_path);
640    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
641
642    if let Some(ref local_var_str) = action {
643        local_var_req_builder = local_var_req_builder.query(&[("action", &local_var_str.to_string())]);
644    }
645    if let Some(ref local_var_str) = top_n {
646        local_var_req_builder = local_var_req_builder.query(&[("top_n", &local_var_str.to_string())]);
647    }
648    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
649        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
650    }
651    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
652        let local_var_key = local_var_apikey.key.clone();
653        let local_var_value = match local_var_apikey.prefix {
654            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
655            None => local_var_key,
656        };
657        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
658    };
659
660    let local_var_req = local_var_req_builder.build()?;
661    let local_var_resp = local_var_client.execute(local_var_req).await?;
662
663    let local_var_status = local_var_resp.status();
664    let local_var_content = local_var_resp.text().await?;
665
666    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
667        serde_json::from_str(&local_var_content).map_err(Error::from)
668    } else {
669        let local_var_entity: Option<EventsEventsTopPerUserListError> = serde_json::from_str(&local_var_content).ok();
670        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
671        Err(Error::ResponseError(local_var_error))
672    }
673}
674
675/// Event Read-Only Viewset
676pub async fn events_events_update(configuration: &configuration::Configuration, event_uuid: &str, event_request: models::EventRequest) -> Result<models::Event, Error<EventsEventsUpdateError>> {
677    let local_var_configuration = configuration;
678
679    let local_var_client = &local_var_configuration.client;
680
681    let local_var_uri_str = format!("{}/events/events/{event_uuid}/", local_var_configuration.base_path, event_uuid=crate::apis::urlencode(event_uuid));
682    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
683
684    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
685        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
686    }
687    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
688        let local_var_key = local_var_apikey.key.clone();
689        let local_var_value = match local_var_apikey.prefix {
690            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
691            None => local_var_key,
692        };
693        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
694    };
695    local_var_req_builder = local_var_req_builder.json(&event_request);
696
697    let local_var_req = local_var_req_builder.build()?;
698    let local_var_resp = local_var_client.execute(local_var_req).await?;
699
700    let local_var_status = local_var_resp.status();
701    let local_var_content = local_var_resp.text().await?;
702
703    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
704        serde_json::from_str(&local_var_content).map_err(Error::from)
705    } else {
706        let local_var_entity: Option<EventsEventsUpdateError> = serde_json::from_str(&local_var_content).ok();
707        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
708        Err(Error::ResponseError(local_var_error))
709    }
710}
711
712/// Get event volume for specified filters and timeframe
713pub async fn events_events_volume_list(configuration: &configuration::Configuration, action: Option<&str>, brand_name: Option<&str>, client_ip: Option<&str>, context_authorized_app: Option<&str>, context_model_app: Option<&str>, context_model_name: Option<&str>, context_model_pk: Option<&str>, ordering: Option<&str>, search: Option<&str>, username: Option<&str>) -> Result<Vec<models::Coordinate>, Error<EventsEventsVolumeListError>> {
714    let local_var_configuration = configuration;
715
716    let local_var_client = &local_var_configuration.client;
717
718    let local_var_uri_str = format!("{}/events/events/volume/", local_var_configuration.base_path);
719    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
720
721    if let Some(ref local_var_str) = action {
722        local_var_req_builder = local_var_req_builder.query(&[("action", &local_var_str.to_string())]);
723    }
724    if let Some(ref local_var_str) = brand_name {
725        local_var_req_builder = local_var_req_builder.query(&[("brand_name", &local_var_str.to_string())]);
726    }
727    if let Some(ref local_var_str) = client_ip {
728        local_var_req_builder = local_var_req_builder.query(&[("client_ip", &local_var_str.to_string())]);
729    }
730    if let Some(ref local_var_str) = context_authorized_app {
731        local_var_req_builder = local_var_req_builder.query(&[("context_authorized_app", &local_var_str.to_string())]);
732    }
733    if let Some(ref local_var_str) = context_model_app {
734        local_var_req_builder = local_var_req_builder.query(&[("context_model_app", &local_var_str.to_string())]);
735    }
736    if let Some(ref local_var_str) = context_model_name {
737        local_var_req_builder = local_var_req_builder.query(&[("context_model_name", &local_var_str.to_string())]);
738    }
739    if let Some(ref local_var_str) = context_model_pk {
740        local_var_req_builder = local_var_req_builder.query(&[("context_model_pk", &local_var_str.to_string())]);
741    }
742    if let Some(ref local_var_str) = ordering {
743        local_var_req_builder = local_var_req_builder.query(&[("ordering", &local_var_str.to_string())]);
744    }
745    if let Some(ref local_var_str) = search {
746        local_var_req_builder = local_var_req_builder.query(&[("search", &local_var_str.to_string())]);
747    }
748    if let Some(ref local_var_str) = username {
749        local_var_req_builder = local_var_req_builder.query(&[("username", &local_var_str.to_string())]);
750    }
751    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
752        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
753    }
754    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
755        let local_var_key = local_var_apikey.key.clone();
756        let local_var_value = match local_var_apikey.prefix {
757            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
758            None => local_var_key,
759        };
760        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
761    };
762
763    let local_var_req = local_var_req_builder.build()?;
764    let local_var_resp = local_var_client.execute(local_var_req).await?;
765
766    let local_var_status = local_var_resp.status();
767    let local_var_content = local_var_resp.text().await?;
768
769    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
770        serde_json::from_str(&local_var_content).map_err(Error::from)
771    } else {
772        let local_var_entity: Option<EventsEventsVolumeListError> = serde_json::from_str(&local_var_content).ok();
773        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
774        Err(Error::ResponseError(local_var_error))
775    }
776}
777
778/// Notification Viewset
779pub async fn events_notifications_destroy(configuration: &configuration::Configuration, uuid: &str) -> Result<(), Error<EventsNotificationsDestroyError>> {
780    let local_var_configuration = configuration;
781
782    let local_var_client = &local_var_configuration.client;
783
784    let local_var_uri_str = format!("{}/events/notifications/{uuid}/", local_var_configuration.base_path, uuid=crate::apis::urlencode(uuid));
785    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
786
787    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
788        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
789    }
790    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
791        let local_var_key = local_var_apikey.key.clone();
792        let local_var_value = match local_var_apikey.prefix {
793            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
794            None => local_var_key,
795        };
796        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
797    };
798
799    let local_var_req = local_var_req_builder.build()?;
800    let local_var_resp = local_var_client.execute(local_var_req).await?;
801
802    let local_var_status = local_var_resp.status();
803    let local_var_content = local_var_resp.text().await?;
804
805    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
806        Ok(())
807    } else {
808        let local_var_entity: Option<EventsNotificationsDestroyError> = serde_json::from_str(&local_var_content).ok();
809        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
810        Err(Error::ResponseError(local_var_error))
811    }
812}
813
814/// Notification Viewset
815pub async fn events_notifications_list(configuration: &configuration::Configuration, body: Option<&str>, created: Option<String>, event: Option<&str>, ordering: Option<&str>, page: Option<i32>, page_size: Option<i32>, search: Option<&str>, seen: Option<bool>, severity: Option<&str>, user: Option<i32>) -> Result<models::PaginatedNotificationList, Error<EventsNotificationsListError>> {
816    let local_var_configuration = configuration;
817
818    let local_var_client = &local_var_configuration.client;
819
820    let local_var_uri_str = format!("{}/events/notifications/", local_var_configuration.base_path);
821    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
822
823    if let Some(ref local_var_str) = body {
824        local_var_req_builder = local_var_req_builder.query(&[("body", &local_var_str.to_string())]);
825    }
826    if let Some(ref local_var_str) = created {
827        local_var_req_builder = local_var_req_builder.query(&[("created", &local_var_str.to_string())]);
828    }
829    if let Some(ref local_var_str) = event {
830        local_var_req_builder = local_var_req_builder.query(&[("event", &local_var_str.to_string())]);
831    }
832    if let Some(ref local_var_str) = ordering {
833        local_var_req_builder = local_var_req_builder.query(&[("ordering", &local_var_str.to_string())]);
834    }
835    if let Some(ref local_var_str) = page {
836        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
837    }
838    if let Some(ref local_var_str) = page_size {
839        local_var_req_builder = local_var_req_builder.query(&[("page_size", &local_var_str.to_string())]);
840    }
841    if let Some(ref local_var_str) = search {
842        local_var_req_builder = local_var_req_builder.query(&[("search", &local_var_str.to_string())]);
843    }
844    if let Some(ref local_var_str) = seen {
845        local_var_req_builder = local_var_req_builder.query(&[("seen", &local_var_str.to_string())]);
846    }
847    if let Some(ref local_var_str) = severity {
848        local_var_req_builder = local_var_req_builder.query(&[("severity", &local_var_str.to_string())]);
849    }
850    if let Some(ref local_var_str) = user {
851        local_var_req_builder = local_var_req_builder.query(&[("user", &local_var_str.to_string())]);
852    }
853    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
854        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
855    }
856    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
857        let local_var_key = local_var_apikey.key.clone();
858        let local_var_value = match local_var_apikey.prefix {
859            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
860            None => local_var_key,
861        };
862        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
863    };
864
865    let local_var_req = local_var_req_builder.build()?;
866    let local_var_resp = local_var_client.execute(local_var_req).await?;
867
868    let local_var_status = local_var_resp.status();
869    let local_var_content = local_var_resp.text().await?;
870
871    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
872        serde_json::from_str(&local_var_content).map_err(Error::from)
873    } else {
874        let local_var_entity: Option<EventsNotificationsListError> = serde_json::from_str(&local_var_content).ok();
875        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
876        Err(Error::ResponseError(local_var_error))
877    }
878}
879
880/// Mark all the user's notifications as seen
881pub async fn events_notifications_mark_all_seen_create(configuration: &configuration::Configuration, ) -> Result<(), Error<EventsNotificationsMarkAllSeenCreateError>> {
882    let local_var_configuration = configuration;
883
884    let local_var_client = &local_var_configuration.client;
885
886    let local_var_uri_str = format!("{}/events/notifications/mark_all_seen/", local_var_configuration.base_path);
887    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
888
889    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
890        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
891    }
892    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
893        let local_var_key = local_var_apikey.key.clone();
894        let local_var_value = match local_var_apikey.prefix {
895            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
896            None => local_var_key,
897        };
898        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
899    };
900
901    let local_var_req = local_var_req_builder.build()?;
902    let local_var_resp = local_var_client.execute(local_var_req).await?;
903
904    let local_var_status = local_var_resp.status();
905    let local_var_content = local_var_resp.text().await?;
906
907    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
908        Ok(())
909    } else {
910        let local_var_entity: Option<EventsNotificationsMarkAllSeenCreateError> = serde_json::from_str(&local_var_content).ok();
911        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
912        Err(Error::ResponseError(local_var_error))
913    }
914}
915
916/// Notification Viewset
917pub async fn events_notifications_partial_update(configuration: &configuration::Configuration, uuid: &str, patched_notification_request: Option<models::PatchedNotificationRequest>) -> Result<models::Notification, Error<EventsNotificationsPartialUpdateError>> {
918    let local_var_configuration = configuration;
919
920    let local_var_client = &local_var_configuration.client;
921
922    let local_var_uri_str = format!("{}/events/notifications/{uuid}/", local_var_configuration.base_path, uuid=crate::apis::urlencode(uuid));
923    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
924
925    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
926        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
927    }
928    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
929        let local_var_key = local_var_apikey.key.clone();
930        let local_var_value = match local_var_apikey.prefix {
931            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
932            None => local_var_key,
933        };
934        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
935    };
936    local_var_req_builder = local_var_req_builder.json(&patched_notification_request);
937
938    let local_var_req = local_var_req_builder.build()?;
939    let local_var_resp = local_var_client.execute(local_var_req).await?;
940
941    let local_var_status = local_var_resp.status();
942    let local_var_content = local_var_resp.text().await?;
943
944    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
945        serde_json::from_str(&local_var_content).map_err(Error::from)
946    } else {
947        let local_var_entity: Option<EventsNotificationsPartialUpdateError> = serde_json::from_str(&local_var_content).ok();
948        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
949        Err(Error::ResponseError(local_var_error))
950    }
951}
952
953/// Notification Viewset
954pub async fn events_notifications_retrieve(configuration: &configuration::Configuration, uuid: &str) -> Result<models::Notification, Error<EventsNotificationsRetrieveError>> {
955    let local_var_configuration = configuration;
956
957    let local_var_client = &local_var_configuration.client;
958
959    let local_var_uri_str = format!("{}/events/notifications/{uuid}/", local_var_configuration.base_path, uuid=crate::apis::urlencode(uuid));
960    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
961
962    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
963        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
964    }
965    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
966        let local_var_key = local_var_apikey.key.clone();
967        let local_var_value = match local_var_apikey.prefix {
968            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
969            None => local_var_key,
970        };
971        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
972    };
973
974    let local_var_req = local_var_req_builder.build()?;
975    let local_var_resp = local_var_client.execute(local_var_req).await?;
976
977    let local_var_status = local_var_resp.status();
978    let local_var_content = local_var_resp.text().await?;
979
980    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
981        serde_json::from_str(&local_var_content).map_err(Error::from)
982    } else {
983        let local_var_entity: Option<EventsNotificationsRetrieveError> = serde_json::from_str(&local_var_content).ok();
984        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
985        Err(Error::ResponseError(local_var_error))
986    }
987}
988
989/// Notification Viewset
990pub async fn events_notifications_update(configuration: &configuration::Configuration, uuid: &str, notification_request: Option<models::NotificationRequest>) -> Result<models::Notification, Error<EventsNotificationsUpdateError>> {
991    let local_var_configuration = configuration;
992
993    let local_var_client = &local_var_configuration.client;
994
995    let local_var_uri_str = format!("{}/events/notifications/{uuid}/", local_var_configuration.base_path, uuid=crate::apis::urlencode(uuid));
996    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
997
998    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
999        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1000    }
1001    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1002        let local_var_key = local_var_apikey.key.clone();
1003        let local_var_value = match local_var_apikey.prefix {
1004            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1005            None => local_var_key,
1006        };
1007        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1008    };
1009    local_var_req_builder = local_var_req_builder.json(&notification_request);
1010
1011    let local_var_req = local_var_req_builder.build()?;
1012    let local_var_resp = local_var_client.execute(local_var_req).await?;
1013
1014    let local_var_status = local_var_resp.status();
1015    let local_var_content = local_var_resp.text().await?;
1016
1017    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1018        serde_json::from_str(&local_var_content).map_err(Error::from)
1019    } else {
1020        let local_var_entity: Option<EventsNotificationsUpdateError> = serde_json::from_str(&local_var_content).ok();
1021        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1022        Err(Error::ResponseError(local_var_error))
1023    }
1024}
1025
1026/// Get a list of all objects that use this object
1027pub async fn events_notifications_used_by_list(configuration: &configuration::Configuration, uuid: &str) -> Result<Vec<models::UsedBy>, Error<EventsNotificationsUsedByListError>> {
1028    let local_var_configuration = configuration;
1029
1030    let local_var_client = &local_var_configuration.client;
1031
1032    let local_var_uri_str = format!("{}/events/notifications/{uuid}/used_by/", local_var_configuration.base_path, uuid=crate::apis::urlencode(uuid));
1033    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1034
1035    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1036        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1037    }
1038    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1039        let local_var_key = local_var_apikey.key.clone();
1040        let local_var_value = match local_var_apikey.prefix {
1041            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1042            None => local_var_key,
1043        };
1044        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1045    };
1046
1047    let local_var_req = local_var_req_builder.build()?;
1048    let local_var_resp = local_var_client.execute(local_var_req).await?;
1049
1050    let local_var_status = local_var_resp.status();
1051    let local_var_content = local_var_resp.text().await?;
1052
1053    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1054        serde_json::from_str(&local_var_content).map_err(Error::from)
1055    } else {
1056        let local_var_entity: Option<EventsNotificationsUsedByListError> = serde_json::from_str(&local_var_content).ok();
1057        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1058        Err(Error::ResponseError(local_var_error))
1059    }
1060}
1061
1062/// NotificationRule Viewset
1063pub async fn events_rules_create(configuration: &configuration::Configuration, notification_rule_request: models::NotificationRuleRequest) -> Result<models::NotificationRule, Error<EventsRulesCreateError>> {
1064    let local_var_configuration = configuration;
1065
1066    let local_var_client = &local_var_configuration.client;
1067
1068    let local_var_uri_str = format!("{}/events/rules/", local_var_configuration.base_path);
1069    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1070
1071    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1072        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1073    }
1074    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1075        let local_var_key = local_var_apikey.key.clone();
1076        let local_var_value = match local_var_apikey.prefix {
1077            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1078            None => local_var_key,
1079        };
1080        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1081    };
1082    local_var_req_builder = local_var_req_builder.json(&notification_rule_request);
1083
1084    let local_var_req = local_var_req_builder.build()?;
1085    let local_var_resp = local_var_client.execute(local_var_req).await?;
1086
1087    let local_var_status = local_var_resp.status();
1088    let local_var_content = local_var_resp.text().await?;
1089
1090    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1091        serde_json::from_str(&local_var_content).map_err(Error::from)
1092    } else {
1093        let local_var_entity: Option<EventsRulesCreateError> = serde_json::from_str(&local_var_content).ok();
1094        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1095        Err(Error::ResponseError(local_var_error))
1096    }
1097}
1098
1099/// NotificationRule Viewset
1100pub async fn events_rules_destroy(configuration: &configuration::Configuration, pbm_uuid: &str) -> Result<(), Error<EventsRulesDestroyError>> {
1101    let local_var_configuration = configuration;
1102
1103    let local_var_client = &local_var_configuration.client;
1104
1105    let local_var_uri_str = format!("{}/events/rules/{pbm_uuid}/", local_var_configuration.base_path, pbm_uuid=crate::apis::urlencode(pbm_uuid));
1106    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
1107
1108    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1109        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1110    }
1111    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1112        let local_var_key = local_var_apikey.key.clone();
1113        let local_var_value = match local_var_apikey.prefix {
1114            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1115            None => local_var_key,
1116        };
1117        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1118    };
1119
1120    let local_var_req = local_var_req_builder.build()?;
1121    let local_var_resp = local_var_client.execute(local_var_req).await?;
1122
1123    let local_var_status = local_var_resp.status();
1124    let local_var_content = local_var_resp.text().await?;
1125
1126    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1127        Ok(())
1128    } else {
1129        let local_var_entity: Option<EventsRulesDestroyError> = serde_json::from_str(&local_var_content).ok();
1130        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1131        Err(Error::ResponseError(local_var_error))
1132    }
1133}
1134
1135/// NotificationRule Viewset
1136pub async fn events_rules_list(configuration: &configuration::Configuration, group__name: Option<&str>, name: Option<&str>, ordering: Option<&str>, page: Option<i32>, page_size: Option<i32>, search: Option<&str>, severity: Option<&str>) -> Result<models::PaginatedNotificationRuleList, Error<EventsRulesListError>> {
1137    let local_var_configuration = configuration;
1138
1139    let local_var_client = &local_var_configuration.client;
1140
1141    let local_var_uri_str = format!("{}/events/rules/", local_var_configuration.base_path);
1142    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1143
1144    if let Some(ref local_var_str) = group__name {
1145        local_var_req_builder = local_var_req_builder.query(&[("group__name", &local_var_str.to_string())]);
1146    }
1147    if let Some(ref local_var_str) = name {
1148        local_var_req_builder = local_var_req_builder.query(&[("name", &local_var_str.to_string())]);
1149    }
1150    if let Some(ref local_var_str) = ordering {
1151        local_var_req_builder = local_var_req_builder.query(&[("ordering", &local_var_str.to_string())]);
1152    }
1153    if let Some(ref local_var_str) = page {
1154        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1155    }
1156    if let Some(ref local_var_str) = page_size {
1157        local_var_req_builder = local_var_req_builder.query(&[("page_size", &local_var_str.to_string())]);
1158    }
1159    if let Some(ref local_var_str) = search {
1160        local_var_req_builder = local_var_req_builder.query(&[("search", &local_var_str.to_string())]);
1161    }
1162    if let Some(ref local_var_str) = severity {
1163        local_var_req_builder = local_var_req_builder.query(&[("severity", &local_var_str.to_string())]);
1164    }
1165    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1166        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1167    }
1168    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1169        let local_var_key = local_var_apikey.key.clone();
1170        let local_var_value = match local_var_apikey.prefix {
1171            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1172            None => local_var_key,
1173        };
1174        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1175    };
1176
1177    let local_var_req = local_var_req_builder.build()?;
1178    let local_var_resp = local_var_client.execute(local_var_req).await?;
1179
1180    let local_var_status = local_var_resp.status();
1181    let local_var_content = local_var_resp.text().await?;
1182
1183    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1184        serde_json::from_str(&local_var_content).map_err(Error::from)
1185    } else {
1186        let local_var_entity: Option<EventsRulesListError> = serde_json::from_str(&local_var_content).ok();
1187        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1188        Err(Error::ResponseError(local_var_error))
1189    }
1190}
1191
1192/// NotificationRule Viewset
1193pub async fn events_rules_partial_update(configuration: &configuration::Configuration, pbm_uuid: &str, patched_notification_rule_request: Option<models::PatchedNotificationRuleRequest>) -> Result<models::NotificationRule, Error<EventsRulesPartialUpdateError>> {
1194    let local_var_configuration = configuration;
1195
1196    let local_var_client = &local_var_configuration.client;
1197
1198    let local_var_uri_str = format!("{}/events/rules/{pbm_uuid}/", local_var_configuration.base_path, pbm_uuid=crate::apis::urlencode(pbm_uuid));
1199    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
1200
1201    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1202        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1203    }
1204    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1205        let local_var_key = local_var_apikey.key.clone();
1206        let local_var_value = match local_var_apikey.prefix {
1207            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1208            None => local_var_key,
1209        };
1210        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1211    };
1212    local_var_req_builder = local_var_req_builder.json(&patched_notification_rule_request);
1213
1214    let local_var_req = local_var_req_builder.build()?;
1215    let local_var_resp = local_var_client.execute(local_var_req).await?;
1216
1217    let local_var_status = local_var_resp.status();
1218    let local_var_content = local_var_resp.text().await?;
1219
1220    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1221        serde_json::from_str(&local_var_content).map_err(Error::from)
1222    } else {
1223        let local_var_entity: Option<EventsRulesPartialUpdateError> = serde_json::from_str(&local_var_content).ok();
1224        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1225        Err(Error::ResponseError(local_var_error))
1226    }
1227}
1228
1229/// NotificationRule Viewset
1230pub async fn events_rules_retrieve(configuration: &configuration::Configuration, pbm_uuid: &str) -> Result<models::NotificationRule, Error<EventsRulesRetrieveError>> {
1231    let local_var_configuration = configuration;
1232
1233    let local_var_client = &local_var_configuration.client;
1234
1235    let local_var_uri_str = format!("{}/events/rules/{pbm_uuid}/", local_var_configuration.base_path, pbm_uuid=crate::apis::urlencode(pbm_uuid));
1236    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1237
1238    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1239        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1240    }
1241    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1242        let local_var_key = local_var_apikey.key.clone();
1243        let local_var_value = match local_var_apikey.prefix {
1244            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1245            None => local_var_key,
1246        };
1247        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1248    };
1249
1250    let local_var_req = local_var_req_builder.build()?;
1251    let local_var_resp = local_var_client.execute(local_var_req).await?;
1252
1253    let local_var_status = local_var_resp.status();
1254    let local_var_content = local_var_resp.text().await?;
1255
1256    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1257        serde_json::from_str(&local_var_content).map_err(Error::from)
1258    } else {
1259        let local_var_entity: Option<EventsRulesRetrieveError> = serde_json::from_str(&local_var_content).ok();
1260        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1261        Err(Error::ResponseError(local_var_error))
1262    }
1263}
1264
1265/// NotificationRule Viewset
1266pub async fn events_rules_update(configuration: &configuration::Configuration, pbm_uuid: &str, notification_rule_request: models::NotificationRuleRequest) -> Result<models::NotificationRule, Error<EventsRulesUpdateError>> {
1267    let local_var_configuration = configuration;
1268
1269    let local_var_client = &local_var_configuration.client;
1270
1271    let local_var_uri_str = format!("{}/events/rules/{pbm_uuid}/", local_var_configuration.base_path, pbm_uuid=crate::apis::urlencode(pbm_uuid));
1272    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
1273
1274    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1275        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1276    }
1277    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1278        let local_var_key = local_var_apikey.key.clone();
1279        let local_var_value = match local_var_apikey.prefix {
1280            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1281            None => local_var_key,
1282        };
1283        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1284    };
1285    local_var_req_builder = local_var_req_builder.json(&notification_rule_request);
1286
1287    let local_var_req = local_var_req_builder.build()?;
1288    let local_var_resp = local_var_client.execute(local_var_req).await?;
1289
1290    let local_var_status = local_var_resp.status();
1291    let local_var_content = local_var_resp.text().await?;
1292
1293    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1294        serde_json::from_str(&local_var_content).map_err(Error::from)
1295    } else {
1296        let local_var_entity: Option<EventsRulesUpdateError> = serde_json::from_str(&local_var_content).ok();
1297        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1298        Err(Error::ResponseError(local_var_error))
1299    }
1300}
1301
1302/// Get a list of all objects that use this object
1303pub async fn events_rules_used_by_list(configuration: &configuration::Configuration, pbm_uuid: &str) -> Result<Vec<models::UsedBy>, Error<EventsRulesUsedByListError>> {
1304    let local_var_configuration = configuration;
1305
1306    let local_var_client = &local_var_configuration.client;
1307
1308    let local_var_uri_str = format!("{}/events/rules/{pbm_uuid}/used_by/", local_var_configuration.base_path, pbm_uuid=crate::apis::urlencode(pbm_uuid));
1309    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1310
1311    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1312        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1313    }
1314    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1315        let local_var_key = local_var_apikey.key.clone();
1316        let local_var_value = match local_var_apikey.prefix {
1317            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1318            None => local_var_key,
1319        };
1320        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1321    };
1322
1323    let local_var_req = local_var_req_builder.build()?;
1324    let local_var_resp = local_var_client.execute(local_var_req).await?;
1325
1326    let local_var_status = local_var_resp.status();
1327    let local_var_content = local_var_resp.text().await?;
1328
1329    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1330        serde_json::from_str(&local_var_content).map_err(Error::from)
1331    } else {
1332        let local_var_entity: Option<EventsRulesUsedByListError> = serde_json::from_str(&local_var_content).ok();
1333        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1334        Err(Error::ResponseError(local_var_error))
1335    }
1336}
1337
1338/// Read-only view set that returns all background tasks
1339pub async fn events_system_tasks_list(configuration: &configuration::Configuration, name: Option<&str>, ordering: Option<&str>, page: Option<i32>, page_size: Option<i32>, search: Option<&str>, status: Option<&str>, uid: Option<&str>) -> Result<models::PaginatedSystemTaskList, Error<EventsSystemTasksListError>> {
1340    let local_var_configuration = configuration;
1341
1342    let local_var_client = &local_var_configuration.client;
1343
1344    let local_var_uri_str = format!("{}/events/system_tasks/", local_var_configuration.base_path);
1345    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1346
1347    if let Some(ref local_var_str) = name {
1348        local_var_req_builder = local_var_req_builder.query(&[("name", &local_var_str.to_string())]);
1349    }
1350    if let Some(ref local_var_str) = ordering {
1351        local_var_req_builder = local_var_req_builder.query(&[("ordering", &local_var_str.to_string())]);
1352    }
1353    if let Some(ref local_var_str) = page {
1354        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1355    }
1356    if let Some(ref local_var_str) = page_size {
1357        local_var_req_builder = local_var_req_builder.query(&[("page_size", &local_var_str.to_string())]);
1358    }
1359    if let Some(ref local_var_str) = search {
1360        local_var_req_builder = local_var_req_builder.query(&[("search", &local_var_str.to_string())]);
1361    }
1362    if let Some(ref local_var_str) = status {
1363        local_var_req_builder = local_var_req_builder.query(&[("status", &local_var_str.to_string())]);
1364    }
1365    if let Some(ref local_var_str) = uid {
1366        local_var_req_builder = local_var_req_builder.query(&[("uid", &local_var_str.to_string())]);
1367    }
1368    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1369        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1370    }
1371    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1372        let local_var_key = local_var_apikey.key.clone();
1373        let local_var_value = match local_var_apikey.prefix {
1374            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1375            None => local_var_key,
1376        };
1377        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1378    };
1379
1380    let local_var_req = local_var_req_builder.build()?;
1381    let local_var_resp = local_var_client.execute(local_var_req).await?;
1382
1383    let local_var_status = local_var_resp.status();
1384    let local_var_content = local_var_resp.text().await?;
1385
1386    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1387        serde_json::from_str(&local_var_content).map_err(Error::from)
1388    } else {
1389        let local_var_entity: Option<EventsSystemTasksListError> = serde_json::from_str(&local_var_content).ok();
1390        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1391        Err(Error::ResponseError(local_var_error))
1392    }
1393}
1394
1395/// Read-only view set that returns all background tasks
1396pub async fn events_system_tasks_retrieve(configuration: &configuration::Configuration, uuid: &str) -> Result<models::SystemTask, Error<EventsSystemTasksRetrieveError>> {
1397    let local_var_configuration = configuration;
1398
1399    let local_var_client = &local_var_configuration.client;
1400
1401    let local_var_uri_str = format!("{}/events/system_tasks/{uuid}/", local_var_configuration.base_path, uuid=crate::apis::urlencode(uuid));
1402    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1403
1404    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1405        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1406    }
1407    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1408        let local_var_key = local_var_apikey.key.clone();
1409        let local_var_value = match local_var_apikey.prefix {
1410            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1411            None => local_var_key,
1412        };
1413        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1414    };
1415
1416    let local_var_req = local_var_req_builder.build()?;
1417    let local_var_resp = local_var_client.execute(local_var_req).await?;
1418
1419    let local_var_status = local_var_resp.status();
1420    let local_var_content = local_var_resp.text().await?;
1421
1422    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1423        serde_json::from_str(&local_var_content).map_err(Error::from)
1424    } else {
1425        let local_var_entity: Option<EventsSystemTasksRetrieveError> = serde_json::from_str(&local_var_content).ok();
1426        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1427        Err(Error::ResponseError(local_var_error))
1428    }
1429}
1430
1431/// Run task
1432pub async fn events_system_tasks_run_create(configuration: &configuration::Configuration, uuid: &str) -> Result<(), Error<EventsSystemTasksRunCreateError>> {
1433    let local_var_configuration = configuration;
1434
1435    let local_var_client = &local_var_configuration.client;
1436
1437    let local_var_uri_str = format!("{}/events/system_tasks/{uuid}/run/", local_var_configuration.base_path, uuid=crate::apis::urlencode(uuid));
1438    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1439
1440    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1441        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1442    }
1443    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1444        let local_var_key = local_var_apikey.key.clone();
1445        let local_var_value = match local_var_apikey.prefix {
1446            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1447            None => local_var_key,
1448        };
1449        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1450    };
1451
1452    let local_var_req = local_var_req_builder.build()?;
1453    let local_var_resp = local_var_client.execute(local_var_req).await?;
1454
1455    let local_var_status = local_var_resp.status();
1456    let local_var_content = local_var_resp.text().await?;
1457
1458    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1459        Ok(())
1460    } else {
1461        let local_var_entity: Option<EventsSystemTasksRunCreateError> = serde_json::from_str(&local_var_content).ok();
1462        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1463        Err(Error::ResponseError(local_var_error))
1464    }
1465}
1466
1467/// NotificationTransport Viewset
1468pub async fn events_transports_create(configuration: &configuration::Configuration, notification_transport_request: models::NotificationTransportRequest) -> Result<models::NotificationTransport, Error<EventsTransportsCreateError>> {
1469    let local_var_configuration = configuration;
1470
1471    let local_var_client = &local_var_configuration.client;
1472
1473    let local_var_uri_str = format!("{}/events/transports/", local_var_configuration.base_path);
1474    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1475
1476    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1477        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1478    }
1479    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1480        let local_var_key = local_var_apikey.key.clone();
1481        let local_var_value = match local_var_apikey.prefix {
1482            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1483            None => local_var_key,
1484        };
1485        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1486    };
1487    local_var_req_builder = local_var_req_builder.json(&notification_transport_request);
1488
1489    let local_var_req = local_var_req_builder.build()?;
1490    let local_var_resp = local_var_client.execute(local_var_req).await?;
1491
1492    let local_var_status = local_var_resp.status();
1493    let local_var_content = local_var_resp.text().await?;
1494
1495    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1496        serde_json::from_str(&local_var_content).map_err(Error::from)
1497    } else {
1498        let local_var_entity: Option<EventsTransportsCreateError> = serde_json::from_str(&local_var_content).ok();
1499        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1500        Err(Error::ResponseError(local_var_error))
1501    }
1502}
1503
1504/// NotificationTransport Viewset
1505pub async fn events_transports_destroy(configuration: &configuration::Configuration, uuid: &str) -> Result<(), Error<EventsTransportsDestroyError>> {
1506    let local_var_configuration = configuration;
1507
1508    let local_var_client = &local_var_configuration.client;
1509
1510    let local_var_uri_str = format!("{}/events/transports/{uuid}/", local_var_configuration.base_path, uuid=crate::apis::urlencode(uuid));
1511    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
1512
1513    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1514        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1515    }
1516    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1517        let local_var_key = local_var_apikey.key.clone();
1518        let local_var_value = match local_var_apikey.prefix {
1519            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1520            None => local_var_key,
1521        };
1522        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1523    };
1524
1525    let local_var_req = local_var_req_builder.build()?;
1526    let local_var_resp = local_var_client.execute(local_var_req).await?;
1527
1528    let local_var_status = local_var_resp.status();
1529    let local_var_content = local_var_resp.text().await?;
1530
1531    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1532        Ok(())
1533    } else {
1534        let local_var_entity: Option<EventsTransportsDestroyError> = serde_json::from_str(&local_var_content).ok();
1535        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1536        Err(Error::ResponseError(local_var_error))
1537    }
1538}
1539
1540/// NotificationTransport Viewset
1541pub async fn events_transports_list(configuration: &configuration::Configuration, mode: Option<&str>, name: Option<&str>, ordering: Option<&str>, page: Option<i32>, page_size: Option<i32>, search: Option<&str>, send_once: Option<bool>, webhook_url: Option<&str>) -> Result<models::PaginatedNotificationTransportList, Error<EventsTransportsListError>> {
1542    let local_var_configuration = configuration;
1543
1544    let local_var_client = &local_var_configuration.client;
1545
1546    let local_var_uri_str = format!("{}/events/transports/", local_var_configuration.base_path);
1547    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1548
1549    if let Some(ref local_var_str) = mode {
1550        local_var_req_builder = local_var_req_builder.query(&[("mode", &local_var_str.to_string())]);
1551    }
1552    if let Some(ref local_var_str) = name {
1553        local_var_req_builder = local_var_req_builder.query(&[("name", &local_var_str.to_string())]);
1554    }
1555    if let Some(ref local_var_str) = ordering {
1556        local_var_req_builder = local_var_req_builder.query(&[("ordering", &local_var_str.to_string())]);
1557    }
1558    if let Some(ref local_var_str) = page {
1559        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1560    }
1561    if let Some(ref local_var_str) = page_size {
1562        local_var_req_builder = local_var_req_builder.query(&[("page_size", &local_var_str.to_string())]);
1563    }
1564    if let Some(ref local_var_str) = search {
1565        local_var_req_builder = local_var_req_builder.query(&[("search", &local_var_str.to_string())]);
1566    }
1567    if let Some(ref local_var_str) = send_once {
1568        local_var_req_builder = local_var_req_builder.query(&[("send_once", &local_var_str.to_string())]);
1569    }
1570    if let Some(ref local_var_str) = webhook_url {
1571        local_var_req_builder = local_var_req_builder.query(&[("webhook_url", &local_var_str.to_string())]);
1572    }
1573    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1574        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1575    }
1576    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1577        let local_var_key = local_var_apikey.key.clone();
1578        let local_var_value = match local_var_apikey.prefix {
1579            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1580            None => local_var_key,
1581        };
1582        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1583    };
1584
1585    let local_var_req = local_var_req_builder.build()?;
1586    let local_var_resp = local_var_client.execute(local_var_req).await?;
1587
1588    let local_var_status = local_var_resp.status();
1589    let local_var_content = local_var_resp.text().await?;
1590
1591    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1592        serde_json::from_str(&local_var_content).map_err(Error::from)
1593    } else {
1594        let local_var_entity: Option<EventsTransportsListError> = serde_json::from_str(&local_var_content).ok();
1595        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1596        Err(Error::ResponseError(local_var_error))
1597    }
1598}
1599
1600/// NotificationTransport Viewset
1601pub async fn events_transports_partial_update(configuration: &configuration::Configuration, uuid: &str, patched_notification_transport_request: Option<models::PatchedNotificationTransportRequest>) -> Result<models::NotificationTransport, Error<EventsTransportsPartialUpdateError>> {
1602    let local_var_configuration = configuration;
1603
1604    let local_var_client = &local_var_configuration.client;
1605
1606    let local_var_uri_str = format!("{}/events/transports/{uuid}/", local_var_configuration.base_path, uuid=crate::apis::urlencode(uuid));
1607    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
1608
1609    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1610        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1611    }
1612    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1613        let local_var_key = local_var_apikey.key.clone();
1614        let local_var_value = match local_var_apikey.prefix {
1615            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1616            None => local_var_key,
1617        };
1618        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1619    };
1620    local_var_req_builder = local_var_req_builder.json(&patched_notification_transport_request);
1621
1622    let local_var_req = local_var_req_builder.build()?;
1623    let local_var_resp = local_var_client.execute(local_var_req).await?;
1624
1625    let local_var_status = local_var_resp.status();
1626    let local_var_content = local_var_resp.text().await?;
1627
1628    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1629        serde_json::from_str(&local_var_content).map_err(Error::from)
1630    } else {
1631        let local_var_entity: Option<EventsTransportsPartialUpdateError> = serde_json::from_str(&local_var_content).ok();
1632        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1633        Err(Error::ResponseError(local_var_error))
1634    }
1635}
1636
1637/// NotificationTransport Viewset
1638pub async fn events_transports_retrieve(configuration: &configuration::Configuration, uuid: &str) -> Result<models::NotificationTransport, Error<EventsTransportsRetrieveError>> {
1639    let local_var_configuration = configuration;
1640
1641    let local_var_client = &local_var_configuration.client;
1642
1643    let local_var_uri_str = format!("{}/events/transports/{uuid}/", local_var_configuration.base_path, uuid=crate::apis::urlencode(uuid));
1644    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1645
1646    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1647        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1648    }
1649    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1650        let local_var_key = local_var_apikey.key.clone();
1651        let local_var_value = match local_var_apikey.prefix {
1652            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1653            None => local_var_key,
1654        };
1655        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1656    };
1657
1658    let local_var_req = local_var_req_builder.build()?;
1659    let local_var_resp = local_var_client.execute(local_var_req).await?;
1660
1661    let local_var_status = local_var_resp.status();
1662    let local_var_content = local_var_resp.text().await?;
1663
1664    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1665        serde_json::from_str(&local_var_content).map_err(Error::from)
1666    } else {
1667        let local_var_entity: Option<EventsTransportsRetrieveError> = serde_json::from_str(&local_var_content).ok();
1668        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1669        Err(Error::ResponseError(local_var_error))
1670    }
1671}
1672
1673/// Send example notification using selected transport. Requires Modify permissions.
1674pub async fn events_transports_test_create(configuration: &configuration::Configuration, uuid: &str) -> Result<models::NotificationTransportTest, Error<EventsTransportsTestCreateError>> {
1675    let local_var_configuration = configuration;
1676
1677    let local_var_client = &local_var_configuration.client;
1678
1679    let local_var_uri_str = format!("{}/events/transports/{uuid}/test/", local_var_configuration.base_path, uuid=crate::apis::urlencode(uuid));
1680    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1681
1682    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1683        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1684    }
1685    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1686        let local_var_key = local_var_apikey.key.clone();
1687        let local_var_value = match local_var_apikey.prefix {
1688            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1689            None => local_var_key,
1690        };
1691        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1692    };
1693
1694    let local_var_req = local_var_req_builder.build()?;
1695    let local_var_resp = local_var_client.execute(local_var_req).await?;
1696
1697    let local_var_status = local_var_resp.status();
1698    let local_var_content = local_var_resp.text().await?;
1699
1700    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1701        serde_json::from_str(&local_var_content).map_err(Error::from)
1702    } else {
1703        let local_var_entity: Option<EventsTransportsTestCreateError> = serde_json::from_str(&local_var_content).ok();
1704        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1705        Err(Error::ResponseError(local_var_error))
1706    }
1707}
1708
1709/// NotificationTransport Viewset
1710pub async fn events_transports_update(configuration: &configuration::Configuration, uuid: &str, notification_transport_request: models::NotificationTransportRequest) -> Result<models::NotificationTransport, Error<EventsTransportsUpdateError>> {
1711    let local_var_configuration = configuration;
1712
1713    let local_var_client = &local_var_configuration.client;
1714
1715    let local_var_uri_str = format!("{}/events/transports/{uuid}/", local_var_configuration.base_path, uuid=crate::apis::urlencode(uuid));
1716    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
1717
1718    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1719        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1720    }
1721    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1722        let local_var_key = local_var_apikey.key.clone();
1723        let local_var_value = match local_var_apikey.prefix {
1724            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1725            None => local_var_key,
1726        };
1727        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1728    };
1729    local_var_req_builder = local_var_req_builder.json(&notification_transport_request);
1730
1731    let local_var_req = local_var_req_builder.build()?;
1732    let local_var_resp = local_var_client.execute(local_var_req).await?;
1733
1734    let local_var_status = local_var_resp.status();
1735    let local_var_content = local_var_resp.text().await?;
1736
1737    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1738        serde_json::from_str(&local_var_content).map_err(Error::from)
1739    } else {
1740        let local_var_entity: Option<EventsTransportsUpdateError> = serde_json::from_str(&local_var_content).ok();
1741        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1742        Err(Error::ResponseError(local_var_error))
1743    }
1744}
1745
1746/// Get a list of all objects that use this object
1747pub async fn events_transports_used_by_list(configuration: &configuration::Configuration, uuid: &str) -> Result<Vec<models::UsedBy>, Error<EventsTransportsUsedByListError>> {
1748    let local_var_configuration = configuration;
1749
1750    let local_var_client = &local_var_configuration.client;
1751
1752    let local_var_uri_str = format!("{}/events/transports/{uuid}/used_by/", local_var_configuration.base_path, uuid=crate::apis::urlencode(uuid));
1753    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1754
1755    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1756        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1757    }
1758    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1759        let local_var_key = local_var_apikey.key.clone();
1760        let local_var_value = match local_var_apikey.prefix {
1761            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1762            None => local_var_key,
1763        };
1764        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1765    };
1766
1767    let local_var_req = local_var_req_builder.build()?;
1768    let local_var_resp = local_var_client.execute(local_var_req).await?;
1769
1770    let local_var_status = local_var_resp.status();
1771    let local_var_content = local_var_resp.text().await?;
1772
1773    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1774        serde_json::from_str(&local_var_content).map_err(Error::from)
1775    } else {
1776        let local_var_entity: Option<EventsTransportsUsedByListError> = serde_json::from_str(&local_var_content).ok();
1777        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1778        Err(Error::ResponseError(local_var_error))
1779    }
1780}
1781