zernio 0.0.444

API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api
Documentation
/*
 * Zernio API
 *
 * API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api
 *
 * The version of the OpenAPI document: 1.0.4
 * Contact: support@zernio.com
 * Generated by: https://openapi-generator.tech
 */

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

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct ListCalls200ResponseCallsInner {
    #[serde(rename = "_id", skip_serializing_if = "Option::is_none")]
    pub _id: Option<String>,
    /// Owning social account. The unified /v1/calls/{id} detail + recording endpoints work for any channel; the channel-specific endpoints remain for account-scoped access.
    #[serde(rename = "accountId", skip_serializing_if = "Option::is_none")]
    pub account_id: Option<String>,
    /// Inbox conversation with the counterparty, when one exists.
    #[serde(rename = "conversationId", skip_serializing_if = "Option::is_none")]
    pub conversation_id: Option<String>,
    /// CRM Contact for the counterparty, when resolved.
    #[serde(rename = "contactId", skip_serializing_if = "Option::is_none")]
    pub contact_id: Option<String>,
    #[serde(rename = "channel", skip_serializing_if = "Option::is_none")]
    pub channel: Option<Channel>,
    #[serde(rename = "direction", skip_serializing_if = "Option::is_none")]
    pub direction: Option<Direction>,
    /// Caller number (E.164).
    #[serde(rename = "from", skip_serializing_if = "Option::is_none")]
    pub from: Option<String>,
    /// Callee number (E.164).
    #[serde(rename = "to", skip_serializing_if = "Option::is_none")]
    pub to: Option<String>,
    /// Destination the call was routed to (tel:/sip:/wss:), snapshotted at routing time.
    #[serde(rename = "forwardTo", skip_serializing_if = "Option::is_none")]
    pub forward_to: Option<String>,
    /// Outbound PSTN only. Message spoken to the callee on answer, before the bridge.
    #[serde(rename = "greeting", skip_serializing_if = "Option::is_none")]
    pub greeting: Option<String>,
    #[serde(rename = "status", skip_serializing_if = "Option::is_none")]
    pub status: Option<Status>,
    /// True when an inbound call went to voicemail.
    #[serde(rename = "isVoicemail", skip_serializing_if = "Option::is_none")]
    pub is_voicemail: Option<bool>,
    /// Outbound answering-machine detection was requested for this call.
    #[serde(rename = "amd", skip_serializing_if = "Option::is_none")]
    pub amd: Option<bool>,
    /// With `amd`, whether a machine (vs a human) answered.
    #[serde(rename = "answeredMachine", skip_serializing_if = "Option::is_none")]
    pub answered_machine: Option<bool>,
    /// Caller ID presented on the forwarded leg.
    #[serde(rename = "forwardCallerId", skip_serializing_if = "Option::is_none")]
    pub forward_caller_id: Option<ForwardCallerId>,
    /// Effective flag for THIS call (number default + per-call override, resolved at create time).
    #[serde(rename = "recordingEnabled", skip_serializing_if = "Option::is_none")]
    pub recording_enabled: Option<bool>,
    #[serde(
        rename = "transcriptionEnabled",
        skip_serializing_if = "Option::is_none"
    )]
    pub transcription_enabled: Option<bool>,
    #[serde(
        rename = "transcriptionLanguage",
        skip_serializing_if = "Option::is_none"
    )]
    pub transcription_language: Option<TranscriptionLanguage>,
    #[serde(rename = "startedAt", skip_serializing_if = "Option::is_none")]
    pub started_at: Option<String>,
    #[serde(rename = "answeredAt", skip_serializing_if = "Option::is_none")]
    pub answered_at: Option<String>,
    #[serde(rename = "endedAt", skip_serializing_if = "Option::is_none")]
    pub ended_at: Option<String>,
    /// When the call was blind-transferred (POST /v1/voice/calls/{id}/transfer).
    #[serde(rename = "transferredAt", skip_serializing_if = "Option::is_none")]
    pub transferred_at: Option<String>,
    #[serde(rename = "durationSeconds", skip_serializing_if = "Option::is_none")]
    pub duration_seconds: Option<i32>,
    #[serde(rename = "endReason", skip_serializing_if = "Option::is_none")]
    pub end_reason: Option<EndReason>,
    /// Raw carrier hangup cause behind endReason (e.g. normal_clearing, not_found, time_limit) — the actual motive when endReason is a coarse bucket.
    #[serde(rename = "hangupCause", skip_serializing_if = "Option::is_none")]
    pub hangup_cause: Option<String>,
    /// SIP response code that ended the call, when SIP-signalled (e.g. '403', '488'). The real failure reason for SIP legs.
    #[serde(rename = "sipHangupCause", skip_serializing_if = "Option::is_none")]
    pub sip_hangup_cause: Option<String>,
    /// Per-call failure log (dial failed, bridge failed, recording error).
    #[serde(rename = "callErrors", skip_serializing_if = "Option::is_none")]
    pub call_errors: Option<Vec<models::CallRecordCallErrorsInner>>,
    /// May be expired. Resolve a fresh playable URL via GET /v1/calls/{id}/recording (any channel).
    #[serde(rename = "recordingUrl", skip_serializing_if = "Option::is_none")]
    pub recording_url: Option<String>,
    /// Most recent transcript segment, for list previews.
    #[serde(
        rename = "lastTranscriptSnippet",
        skip_serializing_if = "Option::is_none"
    )]
    pub last_transcript_snippet: Option<String>,
    /// Full transcript segments (detail endpoint only; omitted from lists).
    #[serde(rename = "transcript", skip_serializing_if = "Option::is_none")]
    pub transcript: Option<Vec<models::CallRecordTranscriptInner>>,
    #[serde(rename = "billing", skip_serializing_if = "Option::is_none")]
    pub billing: Option<Box<models::CallRecordBilling>>,
    #[serde(rename = "createdAt", skip_serializing_if = "Option::is_none")]
    pub created_at: Option<String>,
    #[serde(rename = "updatedAt", skip_serializing_if = "Option::is_none")]
    pub updated_at: Option<String>,
    /// CRM contact name for the counterparty, when resolved.
    #[serde(rename = "contactName", skip_serializing_if = "Option::is_none")]
    pub contact_name: Option<String>,
}

impl ListCalls200ResponseCallsInner {
    pub fn new() -> ListCalls200ResponseCallsInner {
        ListCalls200ResponseCallsInner {
            _id: None,
            account_id: None,
            conversation_id: None,
            contact_id: None,
            channel: None,
            direction: None,
            from: None,
            to: None,
            forward_to: None,
            greeting: None,
            status: None,
            is_voicemail: None,
            amd: None,
            answered_machine: None,
            forward_caller_id: None,
            recording_enabled: None,
            transcription_enabled: None,
            transcription_language: None,
            started_at: None,
            answered_at: None,
            ended_at: None,
            transferred_at: None,
            duration_seconds: None,
            end_reason: None,
            hangup_cause: None,
            sip_hangup_cause: None,
            call_errors: None,
            recording_url: None,
            last_transcript_snippet: None,
            transcript: None,
            billing: None,
            created_at: None,
            updated_at: None,
            contact_name: None,
        }
    }
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Channel {
    #[serde(rename = "whatsapp")]
    Whatsapp,
    #[serde(rename = "pstn")]
    Pstn,
}

impl Default for Channel {
    fn default() -> Channel {
        Self::Whatsapp
    }
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Direction {
    #[serde(rename = "inbound")]
    Inbound,
    #[serde(rename = "outbound")]
    Outbound,
}

impl Default for Direction {
    fn default() -> Direction {
        Self::Inbound
    }
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Status {
    #[serde(rename = "ringing")]
    Ringing,
    #[serde(rename = "answered")]
    Answered,
    #[serde(rename = "ended")]
    Ended,
    #[serde(rename = "failed")]
    Failed,
}

impl Default for Status {
    fn default() -> Status {
        Self::Ringing
    }
}
/// Caller ID presented on the forwarded leg.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum ForwardCallerId {
    #[serde(rename = "business")]
    Business,
    #[serde(rename = "caller")]
    Caller,
}

impl Default for ForwardCallerId {
    fn default() -> ForwardCallerId {
        Self::Business
    }
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum TranscriptionLanguage {
    #[serde(rename = "auto")]
    Auto,
    #[serde(rename = "en")]
    En,
    #[serde(rename = "es")]
    Es,
}

impl Default for TranscriptionLanguage {
    fn default() -> TranscriptionLanguage {
        Self::Auto
    }
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum EndReason {
    #[serde(rename = "hangup")]
    Hangup,
    #[serde(rename = "no_answer")]
    NoAnswer,
    #[serde(rename = "rejected")]
    Rejected,
    #[serde(rename = "error")]
    Error,
}

impl Default for EndReason {
    fn default() -> EndReason {
        Self::Hangup
    }
}