osdm_sys/models/
booking_request.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
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct BookingRequest {
16    /// The list of offers that need to be provisionally booked, with possibly the reservations and ancillaries associated that should be booked as well. 
17    #[serde(rename = "offers")]
18    pub offers: Vec<models::OfferSelection>,
19    /// If needed (cf requiredInformation) or desired, this array allows providing the required details on some or all passengers 
20    #[serde(rename = "passengerSpecifications")]
21    pub passenger_specifications: Vec<models::PassengerSpecification>,
22    #[serde(rename = "purchaser", skip_serializing_if = "Option::is_none")]
23    pub purchaser: Option<Box<models::PurchaserSpecification>>,
24    #[serde(rename = "promotionCodes", skip_serializing_if = "Option::is_none")]
25    pub promotion_codes: Option<Vec<models::PromotionCode>>,
26    /// Values from the [Fulfillment Type Code List](https://osdm.io/spec/catalog-of-code-lists/#FulfillmentType) Listed values here are examples. 
27    #[serde(rename = "requestedFulfillmentType", skip_serializing_if = "Option::is_none")]
28    pub requested_fulfillment_type: Option<String>,
29    /// Fulfillment types. RCT2, RCCST and UIC_PDF are official UIC standards. Notice:`ALLOCATOR_APP` is deprecated and should not be used anymore. The `ALLOCATOR_APP` type is replaced by the `RETAILER_APP` type. `DISTRIBUTOR_APP` was introduced to distinguish between the different types of apps that can be used to fulfill a booking. Values from the [Fulfillment Media Type Code List](https://osdm.io/spec/catalog-of-code-lists/#FulfillmentMediaType) Listed values here are examples. 
30    #[serde(rename = "preferredFulfillmentMedia", skip_serializing_if = "Option::is_none")]
31    pub preferred_fulfillment_media: Option<String>,
32    /// Influences whether referenced resources are returned in full or as references only. 
33    #[serde(rename = "embed", skip_serializing_if = "Option::is_none")]
34    pub embed: Option<Vec<models::BookingResponseContent>>,
35    #[serde(rename = "externalRef", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
36    pub external_ref: Option<Option<String>>,
37}
38
39impl BookingRequest {
40    pub fn new(offers: Vec<models::OfferSelection>, passenger_specifications: Vec<models::PassengerSpecification>) -> BookingRequest {
41        BookingRequest {
42            offers,
43            passenger_specifications,
44            purchaser: None,
45            promotion_codes: None,
46            requested_fulfillment_type: None,
47            preferred_fulfillment_media: None,
48            embed: None,
49            external_ref: None,
50        }
51    }
52}
53