osdm_sys/models/
document.rs

1/*
2 * UIC 90918-10 - OSDM
3 *
4 * Specifications for the OSDM API standard. The OSDM specification supports two modes of operation: Retailer Mode and Distributor Mode. The API works identically in both modes, except that in distributor mode the API also returns fare information.  The following resources are key to get started:    -  [Processes](https://osdm.io/spec/processes/)   -  [Models](https://osdm.io/spec/models/)   -  [Getting started](https://osdm.io/spec/getting-started/) 
5 *
6 * The version of the OpenAPI document: 3.7.0
7 * Contact: osdm@uic.org
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14use serde_with::serde_as;
15
16/// Document : Non travel document created. Either downloadLink + downloadExpiry or content must be provided. 
17#[serde_as]
18#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
19pub struct Document {
20    #[serde(rename = "id")]
21    pub id: String,
22    #[serde(rename = "summary", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
23    pub summary: Option<Option<String>>,
24    /// Reference to a passenger, to be specified when the document related to an individual passenger. 
25    #[serde(rename = "passengerRef", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
26    pub passenger_ref: Option<Option<String>>,
27    #[serde(rename = "downloadLink", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
28    pub download_link: Option<Option<String>>,
29    /// Expiration time of the download link, the document will not be available at the given URI  after this time. 
30    #[serde(rename = "downloadExpiry", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
31    pub download_expiry: Option<Option<String>>,
32    /// base64 encoded binary of the actual fulfillment document. The length restriction of 4 MBytes applies to the encoded string, so the raw document cannot exceed 3 MBytes in size. 
33    #[serde_as(as = "super::DoubleOption<serde_with::base64::Base64>")]
34    #[serde(rename = "content", default, skip_serializing_if = "Option::is_none")]
35    pub content: Option<Option<Vec<u8>>>,
36    #[serde(rename = "format", skip_serializing_if = "Option::is_none")]
37    pub format: Option<models::DocumentFormat>,
38    #[serde(rename = "type")]
39    pub r#type: models::DocumentType,
40    #[serde(rename = "scope")]
41    pub scope: models::DocumentScope,
42}
43
44impl Document {
45    /// Non travel document created. Either downloadLink + downloadExpiry or content must be provided. 
46    pub fn new(id: String, r#type: models::DocumentType, scope: models::DocumentScope) -> Document {
47        Document {
48            id,
49            summary: None,
50            passenger_ref: None,
51            download_link: None,
52            download_expiry: None,
53            content: None,
54            format: None,
55            r#type,
56            scope,
57        }
58    }
59}
60