babelforce-manager-sdk 0.42.1

Rust SDK for the babelforce manager APIs — auth, user & agent management, call reporting, metrics, and task automations.
Documentation
/*
 * Manager API
 *
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: 0.0.0-dev
 * Contact: support@babelforce.com
 * Generated by: https://openapi-generator.tech
 */

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

/// Call : A single call leg handled by the platform — inbound, outbound or dialer. A call belongs to a call session and a conversation, and may have a parent call when it is a child leg (e.g. a transfer or bridge).
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Call {
    /// The unique Identifier (UUID) of the object
    #[serde(rename = "id")]
    pub id: uuid::Uuid,
    /// uuid of the parent call when this is a child leg (e.g. a transfer or bridged outbound leg); absent for top-level calls.
    #[serde(rename = "parentId", skip_serializing_if = "Option::is_none")]
    pub parent_id: Option<uuid::Uuid>,
    /// uuid of the call session this call belongs to.
    #[serde(rename = "sessionId")]
    pub session_id: uuid::Uuid,
    /// uuid of the conversation this call is part of.
    #[serde(rename = "conversationId", skip_serializing_if = "Option::is_none")]
    pub conversation_id: Option<uuid::Uuid>,
    /// When the call record was created (call initiated).
    #[serde(rename = "dateCreated", skip_serializing_if = "Option::is_none")]
    pub date_created: Option<chrono::DateTime<chrono::FixedOffset>>,
    /// When the call record was last modified.
    #[serde(rename = "lastUpdated", skip_serializing_if = "Option::is_none")]
    pub last_updated: Option<chrono::DateTime<chrono::FixedOffset>>,
    /// When the call was answered/connected; absent if it never connected.
    #[serde(rename = "dateEstablished", skip_serializing_if = "Option::is_none")]
    pub date_established: Option<chrono::DateTime<chrono::FixedOffset>>,
    /// When the call ended; absent while the call is still live.
    #[serde(rename = "dateFinished", skip_serializing_if = "Option::is_none")]
    pub date_finished: Option<chrono::DateTime<chrono::FixedOffset>>,
    #[serde(rename = "state")]
    pub state: models::CallState,
    #[serde(rename = "finishReason", skip_serializing_if = "Option::is_none")]
    pub finish_reason: Option<models::CallFinishReason>,
    #[serde(rename = "type")]
    pub r#type: models::CallType,
    /// The caller (origin) number in E.164 format.
    #[serde(rename = "from")]
    pub from: String,
    /// The called (destination) number in E.164 format.
    #[serde(rename = "to")]
    pub to: String,
    #[serde(rename = "source")]
    pub source: models::CallSource,
    #[serde(rename = "domain")]
    pub domain: models::CallDomain,
    /// Total call duration in seconds.
    #[serde(rename = "duration", skip_serializing_if = "Option::is_none")]
    pub duration: Option<i32>,
    /// Whether the caller id was withheld (anonymous call).
    #[serde(rename = "anonymous", skip_serializing_if = "Option::is_none")]
    pub anonymous: Option<bool>,
    /// Recordings captured during the call, if any.
    #[serde(rename = "recordings", skip_serializing_if = "Option::is_none")]
    pub recordings: Option<Vec<models::Recording>>,
    /// The agent/queue the call was bridged to, when applicable.
    #[serde(rename = "bridged", skip_serializing_if = "Option::is_none")]
    pub bridged: Option<Box<models::CallBridged>>,
}

impl Call {
    /// A single call leg handled by the platform — inbound, outbound or dialer. A call belongs to a call session and a conversation, and may have a parent call when it is a child leg (e.g. a transfer or bridge).
    pub fn new(
        id: uuid::Uuid,
        session_id: uuid::Uuid,
        state: models::CallState,
        r#type: models::CallType,
        from: String,
        to: String,
        source: models::CallSource,
        domain: models::CallDomain,
    ) -> Call {
        Call {
            id,
            parent_id: None,
            session_id,
            conversation_id: None,
            date_created: None,
            last_updated: None,
            date_established: None,
            date_finished: None,
            state,
            finish_reason: None,
            r#type,
            from,
            to,
            source,
            domain,
            duration: None,
            anonymous: None,
            recordings: None,
            bridged: None,
        }
    }
}