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

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct ErrorResponse {
    /// The HTTP status code.
    #[serde(rename = "code")]
    pub code: i32,
    /// The error message.
    #[serde(rename = "error")]
    pub error: Error,
    /// The details of the error.
    #[serde(rename = "detail", skip_serializing_if = "Option::is_none")]
    pub detail: Option<String>,
}

impl ErrorResponse {
    pub fn new(code: i32, error: Error) -> ErrorResponse {
        ErrorResponse {
            code,
            error,
            detail: None,
        }
    }
}
/// The error message.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Error {
    #[serde(rename = "Bad Request")]
    BadRequest,
    #[serde(rename = "File Expired")]
    FileExpired,
    #[serde(rename = "Forbidden")]
    Forbidden,
    #[serde(rename = "Resource Locked")]
    ResourceLocked,
    #[serde(rename = "Format Not Supported")]
    FormatNotSupported,
    #[serde(rename = "Internal Server Error")]
    InternalServerError,
    #[serde(rename = "Job error")]
    JobError,
    #[serde(rename = "Job Expired")]
    JobExpired,
    #[serde(rename = "Job In Progress")]
    JobInProgress,
    #[serde(rename = "Job is not of type alignment")]
    JobIsNotOfTypeAlignment,
    #[serde(rename = "Job is not of type transcription")]
    JobIsNotOfTypeTranscription,
    #[serde(rename = "Job not found")]
    JobNotFound,
    #[serde(rename = "Job rejected")]
    JobRejected,
    #[serde(rename = "Job rejected due to invalid audio")]
    JobRejectedDueToInvalidAudio,
    #[serde(rename = "Job rejected due to invalid text")]
    JobRejectedDueToInvalidText,
    #[serde(rename = "Malformed request")]
    MalformedRequest,
    #[serde(rename = "Missing callback")]
    MissingCallback,
    #[serde(rename = "Missing data_file")]
    MissingDataFile,
    #[serde(rename = "Missing text_file")]
    MissingTextFile,
    #[serde(rename = "No language selected")]
    NoLanguageSelected,
    #[serde(rename = "Not Implemented")]
    NotImplemented,
    #[serde(rename = "Permission Denied")]
    PermissionDenied,
    #[serde(rename = "Requested product not available")]
    RequestedProductNotAvailable,
    #[serde(rename = "Transcription not ready")]
    TranscriptionNotReady,
    #[serde(rename = "Log file not available")]
    LogFileNotAvailable,
    #[serde(rename = "Requested Early Access Release not available")]
    RequestedEarlyAccessReleaseNotAvailable,
    #[serde(rename = "Unprocessable Entity")]
    UnprocessableEntity,
}

impl Default for Error {
    fn default() -> Error {
        Self::BadRequest
    }
}