Skip to main content

mistral_openapi_client/models/
document.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/// Document : Document to run OCR on
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct Document {
17    #[serde(rename = "type", skip_serializing_if = "Option::is_none")]
18    pub r#type: Option<Type>,
19    #[serde(rename = "file_id")]
20    pub file_id: uuid::Uuid,
21    #[serde(rename = "document_url")]
22    pub document_url: String,
23    #[serde(rename = "document_name", skip_serializing_if = "Option::is_none")]
24    pub document_name: Option<String>,
25    #[serde(rename = "image_url")]
26    pub image_url: Box<models::ImageUrl>,
27}
28
29impl Document {
30    /// Document to run OCR on
31    pub fn new(file_id: uuid::Uuid, document_url: String, image_url: models::ImageUrl) -> Document {
32        Document {
33            r#type: None,
34            file_id,
35            document_url,
36            document_name: None,
37            image_url: Box::new(image_url),
38        }
39    }
40}
41/// 
42#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
43pub enum Type {
44    #[serde(rename = "file")]
45    File,
46    #[serde(rename = "document_url")]
47    DocumentUrl,
48    #[serde(rename = "image_url")]
49    ImageUrl,
50}
51
52impl Default for Type {
53    fn default() -> Type {
54        Self::File
55    }
56}
57