babelforce-manager-sdk 0.42.3

Rust SDK for the babelforce manager APIs — auth, user & agent management, call reporting, metrics, and task automations.
Documentation
/*
 * task-automation task schedule API
 *
 * execution of recurring time based tasks
 *
 * The version of the OpenAPI document: 3.63.10
 * Contact: support@babelforce.com
 * Generated by: https://openapi-generator.tech
 */

use crate::gen::task_schedule::models;
use serde::{Deserialize, Serialize};

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct IterationActionIteration {
    /// a javascript if not set or if it returns true then the action is executed
    #[serde(rename = "condition", skip_serializing_if = "Option::is_none")]
    pub condition: Option<String>,
    #[serde(rename = "var", skip_serializing_if = "Option::is_none")]
    pub var: Option<String>,
    #[serde(rename = "timeout", skip_serializing_if = "Option::is_none")]
    pub timeout: Option<i64>,
    #[serde(rename = "arguments", skip_serializing_if = "Option::is_none")]
    pub arguments: Option<Vec<serde_json::Value>>,
    #[serde(rename = "error", skip_serializing_if = "Option::is_none")]
    pub error: Option<Box<models::ErrorHandlingConfig>>,
    ///  The number of items specified for iteration. If you supply more elements, a runtime error will occur. Additionally, when increasing this limit beyond the default, consider setting the timeout property on both the state, parents and iteration.
    #[serde(rename = "items_max", skip_serializing_if = "Option::is_none")]
    pub items_max: Option<i32>,
    #[serde(rename = "result")]
    pub result: Result,
    /// on child error continue or fail the iteration
    #[serde(rename = "onError", skip_serializing_if = "Option::is_none")]
    pub on_error: Option<OnError>,
    #[serde(rename = "items")]
    pub items: Vec<serde_json::Value>,
    #[serde(rename = "actions", skip_serializing_if = "Option::is_none")]
    pub actions: Option<Vec<models::TypedAction>>,
}

impl IterationActionIteration {
    pub fn new(result: Result, items: Vec<serde_json::Value>) -> IterationActionIteration {
        IterationActionIteration {
            condition: None,
            var: None,
            timeout: None,
            arguments: None,
            error: None,
            items_max: None,
            result,
            on_error: None,
            items,
            actions: None,
        }
    }
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Result {
    #[serde(rename = "single")]
    Single,
    #[serde(rename = "full")]
    Full,
}

impl Default for Result {
    fn default() -> Result {
        Self::Single
    }
}
/// on child error continue or fail the iteration
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum OnError {
    #[serde(rename = "fail")]
    Fail,
    #[serde(rename = "continue")]
    Continue,
}

impl Default for OnError {
    fn default() -> OnError {
        Self::Fail
    }
}