deepl-openapi 2.7.1

The DeepL API provides programmatic access to DeepL’s machine translation technology.
Documentation
/*
 * DeepL API Documentation
 *
 * The DeepL API provides programmatic access to DeepL’s machine translation technology.
 *
 * The version of the OpenAPI document: 2.7.0
 * 
 * Generated by: https://openapi-generator.tech
 */




#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
pub struct GetDocumentStatus200Response {
    /// A unique ID assigned to the uploaded document and the requested translation process. The same ID that was used when requesting the translation status.
    #[serde(rename = "document_id")]
    pub document_id: String,
    /// A short description of the state the document translation process is currently in. Possible values are:  * `queued` - the translation job is waiting in line to be processed  * `translating` - the translation is currently ongoing  * `done` - the translation is done and the translated document is ready for download  * `error` - an irrecoverable error occurred while translating the document
    #[serde(rename = "status")]
    pub status: Status,
    /// Estimated number of seconds until the translation is done. This parameter is only included while `status` is `\"translating\"`.
    #[serde(rename = "seconds_remaining", skip_serializing_if = "Option::is_none")]
    pub seconds_remaining: Option<i32>,
    /// The number of characters billed to your account.
    #[serde(rename = "billed_characters", skip_serializing_if = "Option::is_none")]
    pub billed_characters: Option<i32>,
    /// A short description of the error, if available. Note that the content is subject to change. This parameter may be included if an error occurred during translation.
    #[serde(rename = "error_message", skip_serializing_if = "Option::is_none")]
    pub error_message: Option<String>,
}

impl GetDocumentStatus200Response {
    pub fn new(document_id: String, status: Status) -> GetDocumentStatus200Response {
        GetDocumentStatus200Response {
            document_id,
            status,
            seconds_remaining: None,
            billed_characters: None,
            error_message: None,
        }
    }
}

/// A short description of the state the document translation process is currently in. Possible values are:  * `queued` - the translation job is waiting in line to be processed  * `translating` - the translation is currently ongoing  * `done` - the translation is done and the translated document is ready for download  * `error` - an irrecoverable error occurred while translating the document
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Status {
    #[serde(rename = "queued")]
    Queued,
    #[serde(rename = "translating")]
    Translating,
    #[serde(rename = "done")]
    Done,
    #[serde(rename = "error")]
    Error,
}

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