Skip to main content

mistral_openapi_client/models/
ocr_page_object.rs

1/*
2 * Mistral AI API
3 *
4 * Our Chat Completion and Embeddings APIs specification. Create your account on [La Plateforme](https://console.mistral.ai) to get access and read the [docs](https://docs.mistral.ai) to learn how to use it.
5 *
6 * The version of the OpenAPI document: 1.0.0
7 * 
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct OcrPageObject {
16    /// The page index in a pdf document starting from 0
17    #[serde(rename = "index")]
18    pub index: i32,
19    /// The markdown string response of the page
20    #[serde(rename = "markdown")]
21    pub markdown: String,
22    /// List of all extracted images in the page
23    #[serde(rename = "images")]
24    pub images: Vec<models::OcrImageObject>,
25    /// List of all extracted tables in the page
26    #[serde(rename = "tables", skip_serializing_if = "Option::is_none")]
27    pub tables: Option<Vec<models::OcrTableObject>>,
28    /// List of all hyperlinks in the page
29    #[serde(rename = "hyperlinks", skip_serializing_if = "Option::is_none")]
30    pub hyperlinks: Option<Vec<String>>,
31    #[serde(rename = "header", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
32    pub header: Option<Option<String>>,
33    #[serde(rename = "footer", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
34    pub footer: Option<Option<String>>,
35    #[serde(rename = "dimensions", deserialize_with = "Option::deserialize")]
36    pub dimensions: Option<Box<models::OcrPageDimensions>>,
37}
38
39impl OcrPageObject {
40    pub fn new(index: i32, markdown: String, images: Vec<models::OcrImageObject>, dimensions: Option<models::OcrPageDimensions>) -> OcrPageObject {
41        OcrPageObject {
42            index,
43            markdown,
44            images,
45            tables: None,
46            hyperlinks: None,
47            header: None,
48            footer: None,
49            dimensions: if let Some(x) = dimensions {Some(Box::new(x))} else {None},
50        }
51    }
52}
53