Skip to main content

mistral_openapi_client/models/
ocr_image_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 OcrImageObject {
16    /// Image ID for extracted image in a page
17    #[serde(rename = "id")]
18    pub id: String,
19    #[serde(rename = "top_left_x", deserialize_with = "Option::deserialize")]
20    pub top_left_x: Option<i32>,
21    #[serde(rename = "top_left_y", deserialize_with = "Option::deserialize")]
22    pub top_left_y: Option<i32>,
23    #[serde(rename = "bottom_right_x", deserialize_with = "Option::deserialize")]
24    pub bottom_right_x: Option<i32>,
25    #[serde(rename = "bottom_right_y", deserialize_with = "Option::deserialize")]
26    pub bottom_right_y: Option<i32>,
27    #[serde(rename = "image_base64", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
28    pub image_base64: Option<Option<String>>,
29    #[serde(rename = "image_annotation", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
30    pub image_annotation: Option<Option<String>>,
31}
32
33impl OcrImageObject {
34    pub fn new(id: String, top_left_x: Option<i32>, top_left_y: Option<i32>, bottom_right_x: Option<i32>, bottom_right_y: Option<i32>) -> OcrImageObject {
35        OcrImageObject {
36            id,
37            top_left_x,
38            top_left_y,
39            bottom_right_x,
40            bottom_right_y,
41            image_base64: None,
42            image_annotation: None,
43        }
44    }
45}
46