speechmatics 0.4.0

An async rust SDK for the Speechmatics API
Documentation
/*
 * OpenAPI Template
 *
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: 1.0.0
 * 
 * Generated by: https://openapi-generator.tech
 */

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

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct RecognitionResult {
    #[serde(rename = "alternatives", skip_serializing_if = "Option::is_none")]
    pub alternatives: Option<Vec<models::RecognitionAlternative>>,
    #[serde(rename = "attaches_to", skip_serializing_if = "Option::is_none")]
    pub attaches_to: Option<AttachesTo>,
    #[serde(rename = "channel", skip_serializing_if = "Option::is_none")]
    pub channel: Option<String>,
    #[serde(rename = "end_time")]
    pub end_time: f32,
    #[serde(rename = "is_eos", skip_serializing_if = "Option::is_none")]
    pub is_eos: Option<bool>,
    #[serde(rename = "score", skip_serializing_if = "Option::is_none")]
    pub score: Option<f32>,
    #[serde(rename = "start_time")]
    pub start_time: f32,
    #[serde(rename = "type")]
    pub type_value: Type,
}

impl RecognitionResult {
    pub fn new(end_time: f32, start_time: f32, type_value: Type) -> RecognitionResult {
        RecognitionResult {
            alternatives: None,
            attaches_to: None,
            channel: None,
            end_time,
            is_eos: None,
            score: None,
            start_time,
            type_value,
        }
    }
}
/// 
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum AttachesTo {
    #[serde(rename = "next")]
    Next,
    #[serde(rename = "previous")]
    Previous,
    #[serde(rename = "none")]
    None,
    #[serde(rename = "both")]
    Both,
}

impl Default for AttachesTo {
    fn default() -> AttachesTo {
        Self::Next
    }
}
/// 
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
    #[serde(rename = "word")]
    Word,
    #[serde(rename = "punctuation")]
    Punctuation,
    #[serde(rename = "speaker_change")]
    SpeakerChange,
}

impl Default for Type {
    fn default() -> Type {
        Self::Word
    }
}