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

/// JobDetails : Document describing a job, including the status and config used.  This model will be returned when you get job details or list all jobs.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct JobDetails {
    /// The UTC date time the job was created.
    #[serde(rename = "created_at")]
    pub created_at: String,
    /// Name of the data file submitted for job.
    #[serde(rename = "data_name")]
    pub data_name: String,
    /// Name of the text file submitted to be aligned to audio.
    #[serde(rename = "text_name", skip_serializing_if = "Option::is_none")]
    pub text_name: Option<String>,
    /// The file duration (in seconds). May be missing for fetch URL jobs.
    #[serde(rename = "duration", skip_serializing_if = "Option::is_none")]
    pub duration: Option<i32>,
    /// The unique id assigned to the job.
    #[serde(rename = "id")]
    pub id: String,
    /// The status of the job.  - `running` - The job is actively running  - `done` - The job completed successfully.  - `rejected` - The job was accepted at first, but later could not be processed by the transcriber.  - `deleted` - The user deleted the job.  - `expired` - The system deleted the job. Usually because the job was in the `done` state for a very long time.
    #[serde(rename = "status")]
    pub status: Status,
    #[serde(rename = "config", skip_serializing_if = "Option::is_none")]
    pub config: Option<Box<models::JobConfig>>,
    /// Optional parameter used for backwards compatibility with v1 api
    #[serde(rename = "lang", skip_serializing_if = "Option::is_none")]
    pub lang: Option<String>,
    /// Optional list of errors that have occurred in user interaction, for example: audio could not be fetched or notification could not be sent.
    #[serde(rename = "errors", skip_serializing_if = "Option::is_none")]
    pub errors: Option<Vec<models::JobDetailError>>,
}

impl JobDetails {
    /// Document describing a job, including the status and config used.  This model will be returned when you get job details or list all jobs.
    pub fn new(created_at: String, data_name: String, id: String, status: Status) -> JobDetails {
        JobDetails {
            created_at,
            data_name,
            text_name: None,
            duration: None,
            id,
            status,
            config: None,
            lang: None,
            errors: None,
        }
    }
}
/// The status of the job.  - `running` - The job is actively running  - `done` - The job completed successfully.  - `rejected` - The job was accepted at first, but later could not be processed by the transcriber.  - `deleted` - The user deleted the job.  - `expired` - The system deleted the job. Usually because the job was in the `done` state for a very long time.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Status {
    #[serde(rename = "running")]
    Running,
    #[serde(rename = "done")]
    Done,
    #[serde(rename = "rejected")]
    Rejected,
    #[serde(rename = "deleted")]
    Deleted,
    #[serde(rename = "expired")]
    Expired,
}

impl Default for Status {
    fn default() -> Status {
        Self::Running
    }
}