babelforce-manager-sdk 0.46.0

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};

/// Lead : An outbound dialer lead — one record in a lead-list, holding the number(s) to dial, its dial status, and any custom per-lead data.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Lead {
    /// The unique Identifier (UUID) of the object
    #[serde(rename = "id")]
    pub id: uuid::Uuid,
    /// Customer-supplied lead identifier, unique within the lead-list.
    #[serde(rename = "uid", skip_serializing_if = "Option::is_none")]
    pub uid: Option<String>,
    /// The unique Identifier (UUID) of the object
    #[serde(rename = "listId", skip_serializing_if = "Option::is_none")]
    pub list_id: Option<uuid::Uuid>,
    /// The unique Identifier (UUID) of the object
    #[serde(rename = "campaignId", skip_serializing_if = "Option::is_none")]
    pub campaign_id: Option<uuid::Uuid>,
    /// Primary phone number to dial, in E.164 format.
    #[serde(rename = "number")]
    pub number: String,
    /// First fallback number, tried when the primary is unreachable.
    #[serde(rename = "number2", skip_serializing_if = "Option::is_none")]
    pub number2: Option<String>,
    /// Second fallback number.
    #[serde(rename = "number3", skip_serializing_if = "Option::is_none")]
    pub number3: Option<String>,
    /// Caller ID presented when dialling this lead, overriding the campaign default.
    #[serde(rename = "callerId", skip_serializing_if = "Option::is_none")]
    pub caller_id: Option<String>,
    #[serde(rename = "status", skip_serializing_if = "Option::is_none")]
    pub status: Option<models::DialStatus>,
    /// Dial priority within the list; higher-ranked leads are dialled first.
    #[serde(rename = "rank", skip_serializing_if = "Option::is_none")]
    pub rank: Option<i32>,
    /// Number of dial attempts made on this lead so far.
    #[serde(rename = "callCount", skip_serializing_if = "Option::is_none")]
    pub call_count: Option<i32>,
    /// Total talk time across all attempts, in seconds.
    #[serde(rename = "duration", skip_serializing_if = "Option::is_none")]
    pub duration: Option<i32>,
    /// Whether the lead has been dialled since the list's call counters were last reset.
    #[serde(rename = "calledSinceReset", skip_serializing_if = "Option::is_none")]
    pub called_since_reset: Option<bool>,
    #[serde(rename = "dateCreated", skip_serializing_if = "Option::is_none")]
    pub date_created: Option<chrono::DateTime<chrono::FixedOffset>>,
    #[serde(rename = "lastUpdated", skip_serializing_if = "Option::is_none")]
    pub last_updated: Option<chrono::DateTime<chrono::FixedOffset>>,
    #[serde(rename = "dateCalled", skip_serializing_if = "Option::is_none")]
    pub date_called: Option<chrono::DateTime<chrono::FixedOffset>>,
    /// Custom per-lead data
    #[serde(rename = "data", skip_serializing_if = "Option::is_none")]
    pub data: Option<std::collections::HashMap<String, serde_json::Value>>,
    /// Callback details, when scheduled
    #[serde(
        rename = "callback",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub callback: Option<Option<std::collections::HashMap<String, serde_json::Value>>>,
}

impl Lead {
    /// An outbound dialer lead — one record in a lead-list, holding the number(s) to dial, its dial status, and any custom per-lead data.
    pub fn new(id: uuid::Uuid, number: String) -> Lead {
        Lead {
            id,
            uid: None,
            list_id: None,
            campaign_id: None,
            number,
            number2: None,
            number3: None,
            caller_id: None,
            status: None,
            rank: None,
            call_count: None,
            duration: None,
            called_since_reset: None,
            date_created: None,
            last_updated: None,
            date_called: None,
            data: None,
            callback: None,
        }
    }
}