deepl_openapi/models/get_document_status_200_response.rs
1/*
2 * DeepL API Documentation
3 *
4 * The DeepL API provides programmatic access to DeepL’s machine translation technology.
5 *
6 * The version of the OpenAPI document: 2.7.0
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11
12
13
14#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
15pub struct GetDocumentStatus200Response {
16 /// A unique ID assigned to the uploaded document and the requested translation process. The same ID that was used when requesting the translation status.
17 #[serde(rename = "document_id")]
18 pub document_id: String,
19 /// 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
20 #[serde(rename = "status")]
21 pub status: Status,
22 /// Estimated number of seconds until the translation is done. This parameter is only included while `status` is `\"translating\"`.
23 #[serde(rename = "seconds_remaining", skip_serializing_if = "Option::is_none")]
24 pub seconds_remaining: Option<i32>,
25 /// The number of characters billed to your account.
26 #[serde(rename = "billed_characters", skip_serializing_if = "Option::is_none")]
27 pub billed_characters: Option<i32>,
28 /// 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.
29 #[serde(rename = "error_message", skip_serializing_if = "Option::is_none")]
30 pub error_message: Option<String>,
31}
32
33impl GetDocumentStatus200Response {
34 pub fn new(document_id: String, status: Status) -> GetDocumentStatus200Response {
35 GetDocumentStatus200Response {
36 document_id,
37 status,
38 seconds_remaining: None,
39 billed_characters: None,
40 error_message: None,
41 }
42 }
43}
44
45/// 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
46#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
47pub enum Status {
48 #[serde(rename = "queued")]
49 Queued,
50 #[serde(rename = "translating")]
51 Translating,
52 #[serde(rename = "done")]
53 Done,
54 #[serde(rename = "error")]
55 Error,
56}
57
58impl Default for Status {
59 fn default() -> Status {
60 Self::Queued
61 }
62}
63