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 API
 *
 * task-automation engine to automate and customize web based integration processes
 *
 * The version of the OpenAPI document: 3.63.10
 * Contact: support@babelforce.com
 * Generated by: https://openapi-generator.tech
 */

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

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Task {
    /// a unique identifier
    #[serde(rename = "id")]
    pub id: uuid::Uuid,
    /// a unique identifier
    #[serde(rename = "queue_id", skip_serializing_if = "Option::is_none")]
    pub queue_id: Option<String>,
    /// a unique identifier
    #[serde(rename = "session_id", skip_serializing_if = "Option::is_none")]
    pub session_id: Option<String>,
    /// a unique identifier
    #[serde(rename = "customer_id")]
    pub customer_id: String,
    /// a unique identifier
    #[serde(rename = "agent_id", skip_serializing_if = "Option::is_none")]
    pub agent_id: Option<String>,
    /// Timestamp in milliseconds UTC
    #[serde(rename = "created_at")]
    pub created_at: i64,
    #[serde(rename = "body")]
    pub body: std::collections::HashMap<String, serde_json::Value>,
    #[serde(rename = "type")]
    pub r#type: String,
    #[serde(rename = "state")]
    pub state: models::TaskState,
    #[serde(rename = "actions", skip_serializing_if = "Option::is_none")]
    pub actions: Option<Box<models::Actions>>,
    #[serde(rename = "task_completion", skip_serializing_if = "Option::is_none")]
    pub task_completion: Option<Box<models::TaskCompletionSettings>>,
    #[serde(rename = "selection_settings", skip_serializing_if = "Option::is_none")]
    pub selection_settings: Option<Box<models::TaskSelectionSettings>>,
    /// defines when the task will be scheduled for execution. now - as soon as possible at 1654075565950 - at the given timestamp in 1w 3d 5h 10min 5sec  - in 1 week 3 days 5 hours 10 minutes and 5 seconds
    #[serde(rename = "scheduled_at")]
    pub scheduled_at: String,
    /// true - an error occured during task execution, false - no errors during execution
    #[serde(rename = "has_error", skip_serializing_if = "Option::is_none")]
    pub has_error: Option<bool>,
}

impl Task {
    pub fn new(
        id: uuid::Uuid,
        customer_id: String,
        created_at: i64,
        body: std::collections::HashMap<String, serde_json::Value>,
        r#type: String,
        state: models::TaskState,
        scheduled_at: String,
    ) -> Task {
        Task {
            id,
            queue_id: None,
            session_id: None,
            customer_id,
            agent_id: None,
            created_at,
            body,
            r#type,
            state,
            actions: None,
            task_completion: None,
            selection_settings: None,
            scheduled_at,
            has_error: None,
        }
    }
}