speechmatics 0.4.0

An async rust SDK for the Speechmatics API
Documentation
/*
 * Speechmatics ASR REST API
 *
 * The Speechmatics Automatic Speech Recognition REST API is used to submit ASR jobs and receive the results. 
 *
 * The version of the OpenAPI document: 2.0.0
 * Contact: support@speechmatics.com
 * Generated by: https://openapi-generator.tech
 */

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

/// RecognitionResult : An ASR job output item. The primary item types are `word` and `punctuation`. Other item types may be present, for example to provide semantic information of different forms.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct RecognitionResult {
    #[serde(rename = "channel", skip_serializing_if = "Option::is_none")]
    pub channel: Option<String>,
    #[serde(rename = "start_time")]
    pub start_time: f32,
    #[serde(rename = "end_time")]
    pub end_time: f32,
    /// Whether the punctuation mark is an end of sentence character. Only applies to punctuation marks.
    #[serde(rename = "is_eos", skip_serializing_if = "Option::is_none")]
    pub is_eos: Option<bool>,
    /// New types of items may appear without being requested; unrecognized item types can be ignored.
    #[serde(rename = "type")]
    pub type_value: Type,
    #[serde(rename = "alternatives", skip_serializing_if = "Option::is_none")]
    pub alternatives: Option<Vec<models::RecognitionAlternative>>,
}

impl RecognitionResult {
    /// An ASR job output item. The primary item types are `word` and `punctuation`. Other item types may be present, for example to provide semantic information of different forms.
    pub fn new(start_time: f32, end_time: f32, type_value: Type) -> RecognitionResult {
        RecognitionResult {
            channel: None,
            start_time,
            end_time,
            is_eos: None,
            type_value,
            alternatives: None,
        }
    }
}
/// New types of items may appear without being requested; unrecognized item types can be ignored.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
    #[serde(rename = "word")]
    Word,
    #[serde(rename = "punctuation")]
    Punctuation,
}

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