1use super::{Error, configuration};
12use crate::apis::ContentType;
13use crate::{apis::ResponseContent, models};
14use async_trait::async_trait;
15#[cfg(feature = "mockall")]
16use mockall::automock;
17use reqwest;
18use serde::{Deserialize, Serialize, de::Error as _};
19use std::sync::Arc;
20
21#[cfg_attr(feature = "mockall", automock)]
22#[async_trait]
23pub trait RulesApi: Send + Sync {
24 async fn create_rule<'rule_dto>(
28 &self,
29 rule_dto: models::RuleDto,
30 ) -> Result<(), Error<CreateRuleError>>;
31
32 async fn delete_rule<'rule_uid>(
36 &self,
37 rule_uid: &'rule_uid str,
38 ) -> Result<(), Error<DeleteRuleError>>;
39
40 async fn enable_rule<'rule_uid, 'body>(
44 &self,
45 rule_uid: &'rule_uid str,
46 body: &'body str,
47 ) -> Result<(), Error<EnableRuleError>>;
48
49 async fn get_rule_actions<'rule_uid>(
53 &self,
54 rule_uid: &'rule_uid str,
55 ) -> Result<Vec<models::ActionDto>, Error<GetRuleActionsError>>;
56
57 async fn get_rule_by_id<'rule_uid>(
61 &self,
62 rule_uid: &'rule_uid str,
63 ) -> Result<models::EnrichedRuleDto, Error<GetRuleByIdError>>;
64
65 async fn get_rule_conditions<'rule_uid>(
69 &self,
70 rule_uid: &'rule_uid str,
71 ) -> Result<Vec<models::ConditionDto>, Error<GetRuleConditionsError>>;
72
73 async fn get_rule_configuration<'rule_uid>(
77 &self,
78 rule_uid: &'rule_uid str,
79 ) -> Result<String, Error<GetRuleConfigurationError>>;
80
81 async fn get_rule_module_by_id<'rule_uid, 'module_category, 'id>(
85 &self,
86 rule_uid: &'rule_uid str,
87 module_category: &'module_category str,
88 id: &'id str,
89 ) -> Result<models::ModuleDto, Error<GetRuleModuleByIdError>>;
90
91 async fn get_rule_module_config<'rule_uid, 'module_category, 'id>(
95 &self,
96 rule_uid: &'rule_uid str,
97 module_category: &'module_category str,
98 id: &'id str,
99 ) -> Result<String, Error<GetRuleModuleConfigError>>;
100
101 async fn get_rule_module_config_parameter<'rule_uid, 'module_category, 'id, 'param>(
105 &self,
106 rule_uid: &'rule_uid str,
107 module_category: &'module_category str,
108 id: &'id str,
109 param: &'param str,
110 ) -> Result<String, Error<GetRuleModuleConfigParameterError>>;
111
112 async fn get_rule_triggers<'rule_uid>(
116 &self,
117 rule_uid: &'rule_uid str,
118 ) -> Result<Vec<models::TriggerDto>, Error<GetRuleTriggersError>>;
119
120 async fn get_rules<'prefix, 'tags, 'summary, 'static_data_only>(
124 &self,
125 prefix: Option<&'prefix str>,
126 tags: Option<Vec<String>>,
127 summary: Option<bool>,
128 static_data_only: Option<bool>,
129 ) -> Result<Vec<models::EnrichedRuleDto>, Error<GetRulesError>>;
130
131 async fn get_schedule_rule_simulations<'from, 'until>(
135 &self,
136 from: Option<&'from str>,
137 until: Option<&'until str>,
138 ) -> Result<Vec<models::RuleExecution>, Error<GetScheduleRuleSimulationsError>>;
139
140 async fn run_rule_now1<'rule_uid, 'request_body>(
144 &self,
145 rule_uid: &'rule_uid str,
146 request_body: Option<std::collections::HashMap<String, serde_json::Value>>,
147 ) -> Result<(), Error<RunRuleNow1Error>>;
148
149 async fn set_rule_module_config_parameter<'rule_uid, 'module_category, 'id, 'param, 'body>(
153 &self,
154 rule_uid: &'rule_uid str,
155 module_category: &'module_category str,
156 id: &'id str,
157 param: &'param str,
158 body: &'body str,
159 ) -> Result<(), Error<SetRuleModuleConfigParameterError>>;
160
161 async fn update_rule<'rule_uid, 'rule_dto>(
165 &self,
166 rule_uid: &'rule_uid str,
167 rule_dto: models::RuleDto,
168 ) -> Result<(), Error<UpdateRuleError>>;
169
170 async fn update_rule_configuration<'rule_uid, 'request_body>(
174 &self,
175 rule_uid: &'rule_uid str,
176 request_body: Option<std::collections::HashMap<String, serde_json::Value>>,
177 ) -> Result<(), Error<UpdateRuleConfigurationError>>;
178}
179
180pub struct RulesApiClient {
181 configuration: Arc<configuration::Configuration>,
182}
183
184impl RulesApiClient {
185 pub fn new(configuration: Arc<configuration::Configuration>) -> Self {
186 Self { configuration }
187 }
188}
189
190#[async_trait]
191impl RulesApi for RulesApiClient {
192 async fn create_rule<'rule_dto>(
193 &self,
194 rule_dto: models::RuleDto,
195 ) -> Result<(), Error<CreateRuleError>> {
196 let local_var_configuration = &self.configuration;
197
198 let local_var_client = &local_var_configuration.client;
199
200 let local_var_uri_str = format!("{}/rules", local_var_configuration.base_path);
201 let mut local_var_req_builder =
202 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
203
204 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
205 local_var_req_builder = local_var_req_builder
206 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
207 }
208 if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
209 local_var_req_builder = local_var_req_builder.basic_auth(
210 local_var_auth_conf.0.to_owned(),
211 local_var_auth_conf.1.to_owned(),
212 );
213 };
214 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
215 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
216 };
217 local_var_req_builder = local_var_req_builder.json(&rule_dto);
218
219 let local_var_req = local_var_req_builder.build()?;
220 let local_var_resp = local_var_client.execute(local_var_req).await?;
221
222 let local_var_status = local_var_resp.status();
223 let local_var_content = local_var_resp.text().await?;
224
225 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
226 Ok(())
227 } else {
228 let local_var_entity: Option<CreateRuleError> =
229 serde_json::from_str(&local_var_content).ok();
230 let local_var_error = ResponseContent {
231 status: local_var_status,
232 content: local_var_content,
233 entity: local_var_entity,
234 };
235 Err(Error::ResponseError(local_var_error))
236 }
237 }
238
239 async fn delete_rule<'rule_uid>(
240 &self,
241 rule_uid: &'rule_uid str,
242 ) -> Result<(), Error<DeleteRuleError>> {
243 let local_var_configuration = &self.configuration;
244
245 let local_var_client = &local_var_configuration.client;
246
247 let local_var_uri_str = format!(
248 "{}/rules/{ruleUID}",
249 local_var_configuration.base_path,
250 ruleUID = crate::apis::urlencode(rule_uid)
251 );
252 let mut local_var_req_builder =
253 local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
254
255 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
256 local_var_req_builder = local_var_req_builder
257 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
258 }
259 if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
260 local_var_req_builder = local_var_req_builder.basic_auth(
261 local_var_auth_conf.0.to_owned(),
262 local_var_auth_conf.1.to_owned(),
263 );
264 };
265 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
266 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
267 };
268
269 let local_var_req = local_var_req_builder.build()?;
270 let local_var_resp = local_var_client.execute(local_var_req).await?;
271
272 let local_var_status = local_var_resp.status();
273 let local_var_content = local_var_resp.text().await?;
274
275 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
276 Ok(())
277 } else {
278 let local_var_entity: Option<DeleteRuleError> =
279 serde_json::from_str(&local_var_content).ok();
280 let local_var_error = ResponseContent {
281 status: local_var_status,
282 content: local_var_content,
283 entity: local_var_entity,
284 };
285 Err(Error::ResponseError(local_var_error))
286 }
287 }
288
289 async fn enable_rule<'rule_uid, 'body>(
290 &self,
291 rule_uid: &'rule_uid str,
292 body: &'body str,
293 ) -> Result<(), Error<EnableRuleError>> {
294 let local_var_configuration = &self.configuration;
295
296 let local_var_client = &local_var_configuration.client;
297
298 let local_var_uri_str = format!(
299 "{}/rules/{ruleUID}/enable",
300 local_var_configuration.base_path,
301 ruleUID = crate::apis::urlencode(rule_uid)
302 );
303 let mut local_var_req_builder =
304 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
305
306 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
307 local_var_req_builder = local_var_req_builder
308 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
309 }
310 if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
311 local_var_req_builder = local_var_req_builder.basic_auth(
312 local_var_auth_conf.0.to_owned(),
313 local_var_auth_conf.1.to_owned(),
314 );
315 };
316 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
317 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
318 };
319 local_var_req_builder = local_var_req_builder.body(body.to_string());
320 local_var_req_builder = local_var_req_builder.header(
321 reqwest::header::CONTENT_TYPE,
322 reqwest::header::HeaderValue::from_static("text/plain"),
323 );
324
325 let local_var_req = local_var_req_builder.build()?;
326 let local_var_resp = local_var_client.execute(local_var_req).await?;
327
328 let local_var_status = local_var_resp.status();
329 let local_var_content = local_var_resp.text().await?;
330
331 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
332 Ok(())
333 } else {
334 let local_var_entity: Option<EnableRuleError> =
335 serde_json::from_str(&local_var_content).ok();
336 let local_var_error = ResponseContent {
337 status: local_var_status,
338 content: local_var_content,
339 entity: local_var_entity,
340 };
341 Err(Error::ResponseError(local_var_error))
342 }
343 }
344
345 async fn get_rule_actions<'rule_uid>(
346 &self,
347 rule_uid: &'rule_uid str,
348 ) -> Result<Vec<models::ActionDto>, Error<GetRuleActionsError>> {
349 let local_var_configuration = &self.configuration;
350
351 let local_var_client = &local_var_configuration.client;
352
353 let local_var_uri_str = format!(
354 "{}/rules/{ruleUID}/actions",
355 local_var_configuration.base_path,
356 ruleUID = crate::apis::urlencode(rule_uid)
357 );
358 let mut local_var_req_builder =
359 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
360
361 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
362 local_var_req_builder = local_var_req_builder
363 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
364 }
365 if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
366 local_var_req_builder = local_var_req_builder.basic_auth(
367 local_var_auth_conf.0.to_owned(),
368 local_var_auth_conf.1.to_owned(),
369 );
370 };
371 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
372 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
373 };
374
375 let local_var_req = local_var_req_builder.build()?;
376 let local_var_resp = local_var_client.execute(local_var_req).await?;
377
378 let local_var_status = local_var_resp.status();
379 let local_var_content_type = local_var_resp
380 .headers()
381 .get("content-type")
382 .and_then(|v| v.to_str().ok())
383 .unwrap_or("application/octet-stream");
384 let local_var_content_type = super::ContentType::from(local_var_content_type);
385 let local_var_content = local_var_resp.text().await?;
386
387 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
388 match local_var_content_type {
389 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
390 ContentType::Text => {
391 return Err(Error::from(serde_json::Error::custom(
392 "Received `text/plain` content type response that cannot be converted to `Vec<models::ActionDto>`",
393 )));
394 }
395 ContentType::Unsupported(local_var_unknown_type) => {
396 return Err(Error::from(serde_json::Error::custom(format!(
397 "Received `{local_var_unknown_type}` content type response that cannot be converted to `Vec<models::ActionDto>`"
398 ))));
399 }
400 }
401 } else {
402 let local_var_entity: Option<GetRuleActionsError> =
403 serde_json::from_str(&local_var_content).ok();
404 let local_var_error = ResponseContent {
405 status: local_var_status,
406 content: local_var_content,
407 entity: local_var_entity,
408 };
409 Err(Error::ResponseError(local_var_error))
410 }
411 }
412
413 async fn get_rule_by_id<'rule_uid>(
414 &self,
415 rule_uid: &'rule_uid str,
416 ) -> Result<models::EnrichedRuleDto, Error<GetRuleByIdError>> {
417 let local_var_configuration = &self.configuration;
418
419 let local_var_client = &local_var_configuration.client;
420
421 let local_var_uri_str = format!(
422 "{}/rules/{ruleUID}",
423 local_var_configuration.base_path,
424 ruleUID = crate::apis::urlencode(rule_uid)
425 );
426 let mut local_var_req_builder =
427 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
428
429 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
430 local_var_req_builder = local_var_req_builder
431 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
432 }
433 if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
434 local_var_req_builder = local_var_req_builder.basic_auth(
435 local_var_auth_conf.0.to_owned(),
436 local_var_auth_conf.1.to_owned(),
437 );
438 };
439 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
440 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
441 };
442
443 let local_var_req = local_var_req_builder.build()?;
444 let local_var_resp = local_var_client.execute(local_var_req).await?;
445
446 let local_var_status = local_var_resp.status();
447 let local_var_content_type = local_var_resp
448 .headers()
449 .get("content-type")
450 .and_then(|v| v.to_str().ok())
451 .unwrap_or("application/octet-stream");
452 let local_var_content_type = super::ContentType::from(local_var_content_type);
453 let local_var_content = local_var_resp.text().await?;
454
455 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
456 match local_var_content_type {
457 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
458 ContentType::Text => {
459 return Err(Error::from(serde_json::Error::custom(
460 "Received `text/plain` content type response that cannot be converted to `models::EnrichedRuleDto`",
461 )));
462 }
463 ContentType::Unsupported(local_var_unknown_type) => {
464 return Err(Error::from(serde_json::Error::custom(format!(
465 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::EnrichedRuleDto`"
466 ))));
467 }
468 }
469 } else {
470 let local_var_entity: Option<GetRuleByIdError> =
471 serde_json::from_str(&local_var_content).ok();
472 let local_var_error = ResponseContent {
473 status: local_var_status,
474 content: local_var_content,
475 entity: local_var_entity,
476 };
477 Err(Error::ResponseError(local_var_error))
478 }
479 }
480
481 async fn get_rule_conditions<'rule_uid>(
482 &self,
483 rule_uid: &'rule_uid str,
484 ) -> Result<Vec<models::ConditionDto>, Error<GetRuleConditionsError>> {
485 let local_var_configuration = &self.configuration;
486
487 let local_var_client = &local_var_configuration.client;
488
489 let local_var_uri_str = format!(
490 "{}/rules/{ruleUID}/conditions",
491 local_var_configuration.base_path,
492 ruleUID = crate::apis::urlencode(rule_uid)
493 );
494 let mut local_var_req_builder =
495 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
496
497 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
498 local_var_req_builder = local_var_req_builder
499 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
500 }
501 if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
502 local_var_req_builder = local_var_req_builder.basic_auth(
503 local_var_auth_conf.0.to_owned(),
504 local_var_auth_conf.1.to_owned(),
505 );
506 };
507 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
508 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
509 };
510
511 let local_var_req = local_var_req_builder.build()?;
512 let local_var_resp = local_var_client.execute(local_var_req).await?;
513
514 let local_var_status = local_var_resp.status();
515 let local_var_content_type = local_var_resp
516 .headers()
517 .get("content-type")
518 .and_then(|v| v.to_str().ok())
519 .unwrap_or("application/octet-stream");
520 let local_var_content_type = super::ContentType::from(local_var_content_type);
521 let local_var_content = local_var_resp.text().await?;
522
523 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
524 match local_var_content_type {
525 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
526 ContentType::Text => {
527 return Err(Error::from(serde_json::Error::custom(
528 "Received `text/plain` content type response that cannot be converted to `Vec<models::ConditionDto>`",
529 )));
530 }
531 ContentType::Unsupported(local_var_unknown_type) => {
532 return Err(Error::from(serde_json::Error::custom(format!(
533 "Received `{local_var_unknown_type}` content type response that cannot be converted to `Vec<models::ConditionDto>`"
534 ))));
535 }
536 }
537 } else {
538 let local_var_entity: Option<GetRuleConditionsError> =
539 serde_json::from_str(&local_var_content).ok();
540 let local_var_error = ResponseContent {
541 status: local_var_status,
542 content: local_var_content,
543 entity: local_var_entity,
544 };
545 Err(Error::ResponseError(local_var_error))
546 }
547 }
548
549 async fn get_rule_configuration<'rule_uid>(
550 &self,
551 rule_uid: &'rule_uid str,
552 ) -> Result<String, Error<GetRuleConfigurationError>> {
553 let local_var_configuration = &self.configuration;
554
555 let local_var_client = &local_var_configuration.client;
556
557 let local_var_uri_str = format!(
558 "{}/rules/{ruleUID}/config",
559 local_var_configuration.base_path,
560 ruleUID = crate::apis::urlencode(rule_uid)
561 );
562 let mut local_var_req_builder =
563 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
564
565 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
566 local_var_req_builder = local_var_req_builder
567 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
568 }
569 if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
570 local_var_req_builder = local_var_req_builder.basic_auth(
571 local_var_auth_conf.0.to_owned(),
572 local_var_auth_conf.1.to_owned(),
573 );
574 };
575 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
576 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
577 };
578
579 let local_var_req = local_var_req_builder.build()?;
580 let local_var_resp = local_var_client.execute(local_var_req).await?;
581
582 let local_var_status = local_var_resp.status();
583 let local_var_content_type = local_var_resp
584 .headers()
585 .get("content-type")
586 .and_then(|v| v.to_str().ok())
587 .unwrap_or("application/octet-stream");
588 let local_var_content_type = super::ContentType::from(local_var_content_type);
589 let local_var_content = local_var_resp.text().await?;
590
591 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
592 match local_var_content_type {
593 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
594 ContentType::Text => {
595 return Err(Error::from(serde_json::Error::custom(
596 "Received `text/plain` content type response that cannot be converted to `String`",
597 )));
598 }
599 ContentType::Unsupported(local_var_unknown_type) => {
600 return Err(Error::from(serde_json::Error::custom(format!(
601 "Received `{local_var_unknown_type}` content type response that cannot be converted to `String`"
602 ))));
603 }
604 }
605 } else {
606 let local_var_entity: Option<GetRuleConfigurationError> =
607 serde_json::from_str(&local_var_content).ok();
608 let local_var_error = ResponseContent {
609 status: local_var_status,
610 content: local_var_content,
611 entity: local_var_entity,
612 };
613 Err(Error::ResponseError(local_var_error))
614 }
615 }
616
617 async fn get_rule_module_by_id<'rule_uid, 'module_category, 'id>(
618 &self,
619 rule_uid: &'rule_uid str,
620 module_category: &'module_category str,
621 id: &'id str,
622 ) -> Result<models::ModuleDto, Error<GetRuleModuleByIdError>> {
623 let local_var_configuration = &self.configuration;
624
625 let local_var_client = &local_var_configuration.client;
626
627 let local_var_uri_str = format!(
628 "{}/rules/{ruleUID}/{moduleCategory}/{id}",
629 local_var_configuration.base_path,
630 ruleUID = crate::apis::urlencode(rule_uid),
631 moduleCategory = crate::apis::urlencode(module_category),
632 id = crate::apis::urlencode(id)
633 );
634 let mut local_var_req_builder =
635 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
636
637 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
638 local_var_req_builder = local_var_req_builder
639 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
640 }
641 if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
642 local_var_req_builder = local_var_req_builder.basic_auth(
643 local_var_auth_conf.0.to_owned(),
644 local_var_auth_conf.1.to_owned(),
645 );
646 };
647 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
648 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
649 };
650
651 let local_var_req = local_var_req_builder.build()?;
652 let local_var_resp = local_var_client.execute(local_var_req).await?;
653
654 let local_var_status = local_var_resp.status();
655 let local_var_content_type = local_var_resp
656 .headers()
657 .get("content-type")
658 .and_then(|v| v.to_str().ok())
659 .unwrap_or("application/octet-stream");
660 let local_var_content_type = super::ContentType::from(local_var_content_type);
661 let local_var_content = local_var_resp.text().await?;
662
663 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
664 match local_var_content_type {
665 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
666 ContentType::Text => {
667 return Err(Error::from(serde_json::Error::custom(
668 "Received `text/plain` content type response that cannot be converted to `models::ModuleDto`",
669 )));
670 }
671 ContentType::Unsupported(local_var_unknown_type) => {
672 return Err(Error::from(serde_json::Error::custom(format!(
673 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::ModuleDto`"
674 ))));
675 }
676 }
677 } else {
678 let local_var_entity: Option<GetRuleModuleByIdError> =
679 serde_json::from_str(&local_var_content).ok();
680 let local_var_error = ResponseContent {
681 status: local_var_status,
682 content: local_var_content,
683 entity: local_var_entity,
684 };
685 Err(Error::ResponseError(local_var_error))
686 }
687 }
688
689 async fn get_rule_module_config<'rule_uid, 'module_category, 'id>(
690 &self,
691 rule_uid: &'rule_uid str,
692 module_category: &'module_category str,
693 id: &'id str,
694 ) -> Result<String, Error<GetRuleModuleConfigError>> {
695 let local_var_configuration = &self.configuration;
696
697 let local_var_client = &local_var_configuration.client;
698
699 let local_var_uri_str = format!(
700 "{}/rules/{ruleUID}/{moduleCategory}/{id}/config",
701 local_var_configuration.base_path,
702 ruleUID = crate::apis::urlencode(rule_uid),
703 moduleCategory = crate::apis::urlencode(module_category),
704 id = crate::apis::urlencode(id)
705 );
706 let mut local_var_req_builder =
707 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
708
709 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
710 local_var_req_builder = local_var_req_builder
711 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
712 }
713 if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
714 local_var_req_builder = local_var_req_builder.basic_auth(
715 local_var_auth_conf.0.to_owned(),
716 local_var_auth_conf.1.to_owned(),
717 );
718 };
719 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
720 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
721 };
722
723 let local_var_req = local_var_req_builder.build()?;
724 let local_var_resp = local_var_client.execute(local_var_req).await?;
725
726 let local_var_status = local_var_resp.status();
727 let local_var_content_type = local_var_resp
728 .headers()
729 .get("content-type")
730 .and_then(|v| v.to_str().ok())
731 .unwrap_or("application/octet-stream");
732 let local_var_content_type = super::ContentType::from(local_var_content_type);
733 let local_var_content = local_var_resp.text().await?;
734
735 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
736 match local_var_content_type {
737 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
738 ContentType::Text => {
739 return Err(Error::from(serde_json::Error::custom(
740 "Received `text/plain` content type response that cannot be converted to `String`",
741 )));
742 }
743 ContentType::Unsupported(local_var_unknown_type) => {
744 return Err(Error::from(serde_json::Error::custom(format!(
745 "Received `{local_var_unknown_type}` content type response that cannot be converted to `String`"
746 ))));
747 }
748 }
749 } else {
750 let local_var_entity: Option<GetRuleModuleConfigError> =
751 serde_json::from_str(&local_var_content).ok();
752 let local_var_error = ResponseContent {
753 status: local_var_status,
754 content: local_var_content,
755 entity: local_var_entity,
756 };
757 Err(Error::ResponseError(local_var_error))
758 }
759 }
760
761 async fn get_rule_module_config_parameter<'rule_uid, 'module_category, 'id, 'param>(
762 &self,
763 rule_uid: &'rule_uid str,
764 module_category: &'module_category str,
765 id: &'id str,
766 param: &'param str,
767 ) -> Result<String, Error<GetRuleModuleConfigParameterError>> {
768 let local_var_configuration = &self.configuration;
769
770 let local_var_client = &local_var_configuration.client;
771
772 let local_var_uri_str = format!(
773 "{}/rules/{ruleUID}/{moduleCategory}/{id}/config/{param}",
774 local_var_configuration.base_path,
775 ruleUID = crate::apis::urlencode(rule_uid),
776 moduleCategory = crate::apis::urlencode(module_category),
777 id = crate::apis::urlencode(id),
778 param = crate::apis::urlencode(param)
779 );
780 let mut local_var_req_builder =
781 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
782
783 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
784 local_var_req_builder = local_var_req_builder
785 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
786 }
787 if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
788 local_var_req_builder = local_var_req_builder.basic_auth(
789 local_var_auth_conf.0.to_owned(),
790 local_var_auth_conf.1.to_owned(),
791 );
792 };
793 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
794 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
795 };
796
797 let local_var_req = local_var_req_builder.build()?;
798 let local_var_resp = local_var_client.execute(local_var_req).await?;
799
800 let local_var_status = local_var_resp.status();
801 let local_var_content_type = local_var_resp
802 .headers()
803 .get("content-type")
804 .and_then(|v| v.to_str().ok())
805 .unwrap_or("application/octet-stream");
806 let local_var_content_type = super::ContentType::from(local_var_content_type);
807 let local_var_content = local_var_resp.text().await?;
808
809 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
810 match local_var_content_type {
811 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
812 ContentType::Text => return Ok(local_var_content),
813 ContentType::Unsupported(local_var_unknown_type) => {
814 return Err(Error::from(serde_json::Error::custom(format!(
815 "Received `{local_var_unknown_type}` content type response that cannot be converted to `String`"
816 ))));
817 }
818 }
819 } else {
820 let local_var_entity: Option<GetRuleModuleConfigParameterError> =
821 serde_json::from_str(&local_var_content).ok();
822 let local_var_error = ResponseContent {
823 status: local_var_status,
824 content: local_var_content,
825 entity: local_var_entity,
826 };
827 Err(Error::ResponseError(local_var_error))
828 }
829 }
830
831 async fn get_rule_triggers<'rule_uid>(
832 &self,
833 rule_uid: &'rule_uid str,
834 ) -> Result<Vec<models::TriggerDto>, Error<GetRuleTriggersError>> {
835 let local_var_configuration = &self.configuration;
836
837 let local_var_client = &local_var_configuration.client;
838
839 let local_var_uri_str = format!(
840 "{}/rules/{ruleUID}/triggers",
841 local_var_configuration.base_path,
842 ruleUID = crate::apis::urlencode(rule_uid)
843 );
844 let mut local_var_req_builder =
845 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
846
847 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
848 local_var_req_builder = local_var_req_builder
849 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
850 }
851 if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
852 local_var_req_builder = local_var_req_builder.basic_auth(
853 local_var_auth_conf.0.to_owned(),
854 local_var_auth_conf.1.to_owned(),
855 );
856 };
857 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
858 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
859 };
860
861 let local_var_req = local_var_req_builder.build()?;
862 let local_var_resp = local_var_client.execute(local_var_req).await?;
863
864 let local_var_status = local_var_resp.status();
865 let local_var_content_type = local_var_resp
866 .headers()
867 .get("content-type")
868 .and_then(|v| v.to_str().ok())
869 .unwrap_or("application/octet-stream");
870 let local_var_content_type = super::ContentType::from(local_var_content_type);
871 let local_var_content = local_var_resp.text().await?;
872
873 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
874 match local_var_content_type {
875 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
876 ContentType::Text => {
877 return Err(Error::from(serde_json::Error::custom(
878 "Received `text/plain` content type response that cannot be converted to `Vec<models::TriggerDto>`",
879 )));
880 }
881 ContentType::Unsupported(local_var_unknown_type) => {
882 return Err(Error::from(serde_json::Error::custom(format!(
883 "Received `{local_var_unknown_type}` content type response that cannot be converted to `Vec<models::TriggerDto>`"
884 ))));
885 }
886 }
887 } else {
888 let local_var_entity: Option<GetRuleTriggersError> =
889 serde_json::from_str(&local_var_content).ok();
890 let local_var_error = ResponseContent {
891 status: local_var_status,
892 content: local_var_content,
893 entity: local_var_entity,
894 };
895 Err(Error::ResponseError(local_var_error))
896 }
897 }
898
899 async fn get_rules<'prefix, 'tags, 'summary, 'static_data_only>(
900 &self,
901 prefix: Option<&'prefix str>,
902 tags: Option<Vec<String>>,
903 summary: Option<bool>,
904 static_data_only: Option<bool>,
905 ) -> Result<Vec<models::EnrichedRuleDto>, Error<GetRulesError>> {
906 let local_var_configuration = &self.configuration;
907
908 let local_var_client = &local_var_configuration.client;
909
910 let local_var_uri_str = format!("{}/rules", local_var_configuration.base_path);
911 let mut local_var_req_builder =
912 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
913
914 if let Some(ref local_var_str) = prefix {
915 local_var_req_builder =
916 local_var_req_builder.query(&[("prefix", &local_var_str.to_string())]);
917 }
918 if let Some(ref local_var_str) = tags {
919 local_var_req_builder = match "multi" {
920 "multi" => local_var_req_builder.query(
921 &local_var_str
922 .into_iter()
923 .map(|p| ("tags".to_owned(), p.to_string()))
924 .collect::<Vec<(std::string::String, std::string::String)>>(),
925 ),
926 _ => local_var_req_builder.query(&[(
927 "tags",
928 &local_var_str
929 .into_iter()
930 .map(|p| p.to_string())
931 .collect::<Vec<String>>()
932 .join(",")
933 .to_string(),
934 )]),
935 };
936 }
937 if let Some(ref local_var_str) = summary {
938 local_var_req_builder =
939 local_var_req_builder.query(&[("summary", &local_var_str.to_string())]);
940 }
941 if let Some(ref local_var_str) = static_data_only {
942 local_var_req_builder =
943 local_var_req_builder.query(&[("staticDataOnly", &local_var_str.to_string())]);
944 }
945 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
946 local_var_req_builder = local_var_req_builder
947 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
948 }
949 if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
950 local_var_req_builder = local_var_req_builder.basic_auth(
951 local_var_auth_conf.0.to_owned(),
952 local_var_auth_conf.1.to_owned(),
953 );
954 };
955 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
956 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
957 };
958
959 let local_var_req = local_var_req_builder.build()?;
960 let local_var_resp = local_var_client.execute(local_var_req).await?;
961
962 let local_var_status = local_var_resp.status();
963 let local_var_content_type = local_var_resp
964 .headers()
965 .get("content-type")
966 .and_then(|v| v.to_str().ok())
967 .unwrap_or("application/octet-stream");
968 let local_var_content_type = super::ContentType::from(local_var_content_type);
969 let local_var_content = local_var_resp.text().await?;
970
971 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
972 match local_var_content_type {
973 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
974 ContentType::Text => {
975 return Err(Error::from(serde_json::Error::custom(
976 "Received `text/plain` content type response that cannot be converted to `Vec<models::EnrichedRuleDto>`",
977 )));
978 }
979 ContentType::Unsupported(local_var_unknown_type) => {
980 return Err(Error::from(serde_json::Error::custom(format!(
981 "Received `{local_var_unknown_type}` content type response that cannot be converted to `Vec<models::EnrichedRuleDto>`"
982 ))));
983 }
984 }
985 } else {
986 let local_var_entity: Option<GetRulesError> =
987 serde_json::from_str(&local_var_content).ok();
988 let local_var_error = ResponseContent {
989 status: local_var_status,
990 content: local_var_content,
991 entity: local_var_entity,
992 };
993 Err(Error::ResponseError(local_var_error))
994 }
995 }
996
997 async fn get_schedule_rule_simulations<'from, 'until>(
998 &self,
999 from: Option<&'from str>,
1000 until: Option<&'until str>,
1001 ) -> Result<Vec<models::RuleExecution>, Error<GetScheduleRuleSimulationsError>> {
1002 let local_var_configuration = &self.configuration;
1003
1004 let local_var_client = &local_var_configuration.client;
1005
1006 let local_var_uri_str = format!(
1007 "{}/rules/schedule/simulations",
1008 local_var_configuration.base_path
1009 );
1010 let mut local_var_req_builder =
1011 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1012
1013 if let Some(ref local_var_str) = from {
1014 local_var_req_builder =
1015 local_var_req_builder.query(&[("from", &local_var_str.to_string())]);
1016 }
1017 if let Some(ref local_var_str) = until {
1018 local_var_req_builder =
1019 local_var_req_builder.query(&[("until", &local_var_str.to_string())]);
1020 }
1021 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1022 local_var_req_builder = local_var_req_builder
1023 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1024 }
1025 if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
1026 local_var_req_builder = local_var_req_builder.basic_auth(
1027 local_var_auth_conf.0.to_owned(),
1028 local_var_auth_conf.1.to_owned(),
1029 );
1030 };
1031 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
1032 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1033 };
1034
1035 let local_var_req = local_var_req_builder.build()?;
1036 let local_var_resp = local_var_client.execute(local_var_req).await?;
1037
1038 let local_var_status = local_var_resp.status();
1039 let local_var_content_type = local_var_resp
1040 .headers()
1041 .get("content-type")
1042 .and_then(|v| v.to_str().ok())
1043 .unwrap_or("application/octet-stream");
1044 let local_var_content_type = super::ContentType::from(local_var_content_type);
1045 let local_var_content = local_var_resp.text().await?;
1046
1047 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1048 match local_var_content_type {
1049 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
1050 ContentType::Text => {
1051 return Err(Error::from(serde_json::Error::custom(
1052 "Received `text/plain` content type response that cannot be converted to `Vec<models::RuleExecution>`",
1053 )));
1054 }
1055 ContentType::Unsupported(local_var_unknown_type) => {
1056 return Err(Error::from(serde_json::Error::custom(format!(
1057 "Received `{local_var_unknown_type}` content type response that cannot be converted to `Vec<models::RuleExecution>`"
1058 ))));
1059 }
1060 }
1061 } else {
1062 let local_var_entity: Option<GetScheduleRuleSimulationsError> =
1063 serde_json::from_str(&local_var_content).ok();
1064 let local_var_error = ResponseContent {
1065 status: local_var_status,
1066 content: local_var_content,
1067 entity: local_var_entity,
1068 };
1069 Err(Error::ResponseError(local_var_error))
1070 }
1071 }
1072
1073 async fn run_rule_now1<'rule_uid, 'request_body>(
1074 &self,
1075 rule_uid: &'rule_uid str,
1076 request_body: Option<std::collections::HashMap<String, serde_json::Value>>,
1077 ) -> Result<(), Error<RunRuleNow1Error>> {
1078 let local_var_configuration = &self.configuration;
1079
1080 let local_var_client = &local_var_configuration.client;
1081
1082 let local_var_uri_str = format!(
1083 "{}/rules/{ruleUID}/runnow",
1084 local_var_configuration.base_path,
1085 ruleUID = crate::apis::urlencode(rule_uid)
1086 );
1087 let mut local_var_req_builder =
1088 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1089
1090 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1091 local_var_req_builder = local_var_req_builder
1092 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1093 }
1094 if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
1095 local_var_req_builder = local_var_req_builder.basic_auth(
1096 local_var_auth_conf.0.to_owned(),
1097 local_var_auth_conf.1.to_owned(),
1098 );
1099 };
1100 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
1101 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1102 };
1103 local_var_req_builder = local_var_req_builder.json(&request_body);
1104
1105 let local_var_req = local_var_req_builder.build()?;
1106 let local_var_resp = local_var_client.execute(local_var_req).await?;
1107
1108 let local_var_status = local_var_resp.status();
1109 let local_var_content = local_var_resp.text().await?;
1110
1111 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1112 Ok(())
1113 } else {
1114 let local_var_entity: Option<RunRuleNow1Error> =
1115 serde_json::from_str(&local_var_content).ok();
1116 let local_var_error = ResponseContent {
1117 status: local_var_status,
1118 content: local_var_content,
1119 entity: local_var_entity,
1120 };
1121 Err(Error::ResponseError(local_var_error))
1122 }
1123 }
1124
1125 async fn set_rule_module_config_parameter<'rule_uid, 'module_category, 'id, 'param, 'body>(
1126 &self,
1127 rule_uid: &'rule_uid str,
1128 module_category: &'module_category str,
1129 id: &'id str,
1130 param: &'param str,
1131 body: &'body str,
1132 ) -> Result<(), Error<SetRuleModuleConfigParameterError>> {
1133 let local_var_configuration = &self.configuration;
1134
1135 let local_var_client = &local_var_configuration.client;
1136
1137 let local_var_uri_str = format!(
1138 "{}/rules/{ruleUID}/{moduleCategory}/{id}/config/{param}",
1139 local_var_configuration.base_path,
1140 ruleUID = crate::apis::urlencode(rule_uid),
1141 moduleCategory = crate::apis::urlencode(module_category),
1142 id = crate::apis::urlencode(id),
1143 param = crate::apis::urlencode(param)
1144 );
1145 let mut local_var_req_builder =
1146 local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
1147
1148 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1149 local_var_req_builder = local_var_req_builder
1150 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1151 }
1152 if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
1153 local_var_req_builder = local_var_req_builder.basic_auth(
1154 local_var_auth_conf.0.to_owned(),
1155 local_var_auth_conf.1.to_owned(),
1156 );
1157 };
1158 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
1159 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1160 };
1161 local_var_req_builder = local_var_req_builder.body(body.to_string());
1162 local_var_req_builder = local_var_req_builder.header(
1163 reqwest::header::CONTENT_TYPE,
1164 reqwest::header::HeaderValue::from_static("text/plain"),
1165 );
1166
1167 let local_var_req = local_var_req_builder.build()?;
1168 let local_var_resp = local_var_client.execute(local_var_req).await?;
1169
1170 let local_var_status = local_var_resp.status();
1171 let local_var_content = local_var_resp.text().await?;
1172
1173 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1174 Ok(())
1175 } else {
1176 let local_var_entity: Option<SetRuleModuleConfigParameterError> =
1177 serde_json::from_str(&local_var_content).ok();
1178 let local_var_error = ResponseContent {
1179 status: local_var_status,
1180 content: local_var_content,
1181 entity: local_var_entity,
1182 };
1183 Err(Error::ResponseError(local_var_error))
1184 }
1185 }
1186
1187 async fn update_rule<'rule_uid, 'rule_dto>(
1188 &self,
1189 rule_uid: &'rule_uid str,
1190 rule_dto: models::RuleDto,
1191 ) -> Result<(), Error<UpdateRuleError>> {
1192 let local_var_configuration = &self.configuration;
1193
1194 let local_var_client = &local_var_configuration.client;
1195
1196 let local_var_uri_str = format!(
1197 "{}/rules/{ruleUID}",
1198 local_var_configuration.base_path,
1199 ruleUID = crate::apis::urlencode(rule_uid)
1200 );
1201 let mut local_var_req_builder =
1202 local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
1203
1204 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1205 local_var_req_builder = local_var_req_builder
1206 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1207 }
1208 if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
1209 local_var_req_builder = local_var_req_builder.basic_auth(
1210 local_var_auth_conf.0.to_owned(),
1211 local_var_auth_conf.1.to_owned(),
1212 );
1213 };
1214 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
1215 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1216 };
1217 local_var_req_builder = local_var_req_builder.json(&rule_dto);
1218
1219 let local_var_req = local_var_req_builder.build()?;
1220 let local_var_resp = local_var_client.execute(local_var_req).await?;
1221
1222 let local_var_status = local_var_resp.status();
1223 let local_var_content = local_var_resp.text().await?;
1224
1225 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1226 Ok(())
1227 } else {
1228 let local_var_entity: Option<UpdateRuleError> =
1229 serde_json::from_str(&local_var_content).ok();
1230 let local_var_error = ResponseContent {
1231 status: local_var_status,
1232 content: local_var_content,
1233 entity: local_var_entity,
1234 };
1235 Err(Error::ResponseError(local_var_error))
1236 }
1237 }
1238
1239 async fn update_rule_configuration<'rule_uid, 'request_body>(
1240 &self,
1241 rule_uid: &'rule_uid str,
1242 request_body: Option<std::collections::HashMap<String, serde_json::Value>>,
1243 ) -> Result<(), Error<UpdateRuleConfigurationError>> {
1244 let local_var_configuration = &self.configuration;
1245
1246 let local_var_client = &local_var_configuration.client;
1247
1248 let local_var_uri_str = format!(
1249 "{}/rules/{ruleUID}/config",
1250 local_var_configuration.base_path,
1251 ruleUID = crate::apis::urlencode(rule_uid)
1252 );
1253 let mut local_var_req_builder =
1254 local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
1255
1256 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1257 local_var_req_builder = local_var_req_builder
1258 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1259 }
1260 if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
1261 local_var_req_builder = local_var_req_builder.basic_auth(
1262 local_var_auth_conf.0.to_owned(),
1263 local_var_auth_conf.1.to_owned(),
1264 );
1265 };
1266 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
1267 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1268 };
1269 local_var_req_builder = local_var_req_builder.json(&request_body);
1270
1271 let local_var_req = local_var_req_builder.build()?;
1272 let local_var_resp = local_var_client.execute(local_var_req).await?;
1273
1274 let local_var_status = local_var_resp.status();
1275 let local_var_content = local_var_resp.text().await?;
1276
1277 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1278 Ok(())
1279 } else {
1280 let local_var_entity: Option<UpdateRuleConfigurationError> =
1281 serde_json::from_str(&local_var_content).ok();
1282 let local_var_error = ResponseContent {
1283 status: local_var_status,
1284 content: local_var_content,
1285 entity: local_var_entity,
1286 };
1287 Err(Error::ResponseError(local_var_error))
1288 }
1289 }
1290}
1291
1292#[derive(Debug, Clone, Serialize, Deserialize)]
1294#[serde(untagged)]
1295pub enum CreateRuleError {
1296 Status400(),
1297 Status409(),
1298 UnknownValue(serde_json::Value),
1299}
1300
1301#[derive(Debug, Clone, Serialize, Deserialize)]
1303#[serde(untagged)]
1304pub enum DeleteRuleError {
1305 Status404(),
1306 UnknownValue(serde_json::Value),
1307}
1308
1309#[derive(Debug, Clone, Serialize, Deserialize)]
1311#[serde(untagged)]
1312pub enum EnableRuleError {
1313 Status404(),
1314 UnknownValue(serde_json::Value),
1315}
1316
1317#[derive(Debug, Clone, Serialize, Deserialize)]
1319#[serde(untagged)]
1320pub enum GetRuleActionsError {
1321 Status404(),
1322 UnknownValue(serde_json::Value),
1323}
1324
1325#[derive(Debug, Clone, Serialize, Deserialize)]
1327#[serde(untagged)]
1328pub enum GetRuleByIdError {
1329 Status404(),
1330 UnknownValue(serde_json::Value),
1331}
1332
1333#[derive(Debug, Clone, Serialize, Deserialize)]
1335#[serde(untagged)]
1336pub enum GetRuleConditionsError {
1337 Status404(),
1338 UnknownValue(serde_json::Value),
1339}
1340
1341#[derive(Debug, Clone, Serialize, Deserialize)]
1343#[serde(untagged)]
1344pub enum GetRuleConfigurationError {
1345 Status404(),
1346 UnknownValue(serde_json::Value),
1347}
1348
1349#[derive(Debug, Clone, Serialize, Deserialize)]
1351#[serde(untagged)]
1352pub enum GetRuleModuleByIdError {
1353 Status404(),
1354 UnknownValue(serde_json::Value),
1355}
1356
1357#[derive(Debug, Clone, Serialize, Deserialize)]
1359#[serde(untagged)]
1360pub enum GetRuleModuleConfigError {
1361 Status404(),
1362 UnknownValue(serde_json::Value),
1363}
1364
1365#[derive(Debug, Clone, Serialize, Deserialize)]
1367#[serde(untagged)]
1368pub enum GetRuleModuleConfigParameterError {
1369 Status404(),
1370 UnknownValue(serde_json::Value),
1371}
1372
1373#[derive(Debug, Clone, Serialize, Deserialize)]
1375#[serde(untagged)]
1376pub enum GetRuleTriggersError {
1377 Status404(),
1378 UnknownValue(serde_json::Value),
1379}
1380
1381#[derive(Debug, Clone, Serialize, Deserialize)]
1383#[serde(untagged)]
1384pub enum GetRulesError {
1385 UnknownValue(serde_json::Value),
1386}
1387
1388#[derive(Debug, Clone, Serialize, Deserialize)]
1390#[serde(untagged)]
1391pub enum GetScheduleRuleSimulationsError {
1392 Status400(),
1393 UnknownValue(serde_json::Value),
1394}
1395
1396#[derive(Debug, Clone, Serialize, Deserialize)]
1398#[serde(untagged)]
1399pub enum RunRuleNow1Error {
1400 Status404(),
1401 UnknownValue(serde_json::Value),
1402}
1403
1404#[derive(Debug, Clone, Serialize, Deserialize)]
1406#[serde(untagged)]
1407pub enum SetRuleModuleConfigParameterError {
1408 Status404(),
1409 UnknownValue(serde_json::Value),
1410}
1411
1412#[derive(Debug, Clone, Serialize, Deserialize)]
1414#[serde(untagged)]
1415pub enum UpdateRuleError {
1416 Status404(),
1417 UnknownValue(serde_json::Value),
1418}
1419
1420#[derive(Debug, Clone, Serialize, Deserialize)]
1422#[serde(untagged)]
1423pub enum UpdateRuleConfigurationError {
1424 Status404(),
1425 UnknownValue(serde_json::Value),
1426}