Skip to main content

mistral_openapi_client/models/
document_out.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 DocumentOut {
16    #[serde(rename = "id")]
17    pub id: uuid::Uuid,
18    #[serde(rename = "library_id")]
19    pub library_id: uuid::Uuid,
20    #[serde(rename = "hash", deserialize_with = "Option::deserialize")]
21    pub hash: Option<String>,
22    #[serde(rename = "mime_type", deserialize_with = "Option::deserialize")]
23    pub mime_type: Option<String>,
24    #[serde(rename = "extension", deserialize_with = "Option::deserialize")]
25    pub extension: Option<String>,
26    #[serde(rename = "size", deserialize_with = "Option::deserialize")]
27    pub size: Option<i32>,
28    #[serde(rename = "name")]
29    pub name: String,
30    #[serde(rename = "summary", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
31    pub summary: Option<Option<String>>,
32    #[serde(rename = "created_at")]
33    pub created_at: String,
34    #[serde(rename = "last_processed_at", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
35    pub last_processed_at: Option<Option<String>>,
36    #[serde(rename = "number_of_pages", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
37    pub number_of_pages: Option<Option<i32>>,
38    #[serde(rename = "process_status")]
39    pub process_status: models::ProcessStatus,
40    #[serde(rename = "uploaded_by_id", deserialize_with = "Option::deserialize")]
41    pub uploaded_by_id: Option<uuid::Uuid>,
42    #[serde(rename = "uploaded_by_type")]
43    pub uploaded_by_type: String,
44    #[serde(rename = "tokens_processing_main_content", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
45    pub tokens_processing_main_content: Option<Option<i32>>,
46    #[serde(rename = "tokens_processing_summary", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
47    pub tokens_processing_summary: Option<Option<i32>>,
48    #[serde(rename = "url", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
49    pub url: Option<Option<String>>,
50    #[serde(rename = "attributes", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
51    pub attributes: Option<Option<std::collections::HashMap<String, serde_json::Value>>>,
52    #[serde(rename = "processing_status")]
53    pub processing_status: String,
54    #[serde(rename = "tokens_processing_total")]
55    pub tokens_processing_total: i32,
56}
57
58impl DocumentOut {
59    pub fn new(id: uuid::Uuid, library_id: uuid::Uuid, hash: Option<String>, mime_type: Option<String>, extension: Option<String>, size: Option<i32>, name: String, created_at: String, process_status: models::ProcessStatus, uploaded_by_id: Option<uuid::Uuid>, uploaded_by_type: String, processing_status: String, tokens_processing_total: i32) -> DocumentOut {
60        DocumentOut {
61            id,
62            library_id,
63            hash,
64            mime_type,
65            extension,
66            size,
67            name,
68            summary: None,
69            created_at,
70            last_processed_at: None,
71            number_of_pages: None,
72            process_status,
73            uploaded_by_id,
74            uploaded_by_type,
75            tokens_processing_main_content: None,
76            tokens_processing_summary: None,
77            url: None,
78            attributes: None,
79            processing_status,
80            tokens_processing_total,
81        }
82    }
83}
84