open-logistics 0.2.2

Rust client for the Open Logistics Shiprocket and Delhivery APIs.
Documentation
/*
 * Open Logistics — Delhivery
 *
 * OpenAPI description of the Delhivery B2C endpoints wrapped by `open-logistics`.  Source of truth for generated Python and Rust clients. Operation IDs and schema field names are intentionally snake_case so every language exposes the same names.  Delhivery overloads `POST /api/p/edit` for update and cancel, and `GET /api/v1/packages/json/` for single, order, and bulk tracking. OpenAPI permits one operation per path + method, so this spec exposes `orders_edit` and `tracking_fetch`; language facades may alias them as `update`, `cancel`, `by_waybill`, `by_order_id`, and `by_waybills`. 
 *
 * The version of the OpenAPI document: 0.2.2
 * 
 * Generated by: https://openapi-generator.tech
 */

use crate::delhivery::models;
use serde::{Deserialize, Serialize};

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct DelhiveryShipmentPayload {
    /// Fields the schema allows but does not enumerate.
    #[serde(flatten)]
    pub additional_properties: std::collections::HashMap<String, serde_json::Value>,

    #[serde(rename = "order_id")]
    pub order_id: String,
    #[serde(rename = "waybill", skip_serializing_if = "Option::is_none")]
    pub waybill: Option<String>,
    #[serde(rename = "order_date", skip_serializing_if = "Option::is_none")]
    pub order_date: Option<String>,
    #[serde(rename = "client", skip_serializing_if = "Option::is_none")]
    pub client: Option<String>,
    #[serde(rename = "pickup_location")]
    pub pickup_location: Box<models::DelhiveryPickupLocation>,
    #[serde(rename = "package_type")]
    pub package_type: PackageType,
    #[serde(rename = "payment_mode", skip_serializing_if = "Option::is_none")]
    pub payment_mode: Option<PaymentMode>,
    #[serde(rename = "cod_amount", skip_serializing_if = "Option::is_none")]
    pub cod_amount: Option<f64>,
    #[serde(rename = "name")]
    pub name: String,
    #[serde(rename = "add", skip_serializing_if = "Option::is_none")]
    pub add: Option<String>,
    #[serde(rename = "address", skip_serializing_if = "Option::is_none")]
    pub address: Option<String>,
    #[serde(rename = "phone")]
    pub phone: String,
    #[serde(rename = "pin")]
    pub pin: String,
    #[serde(rename = "city", skip_serializing_if = "Option::is_none")]
    pub city: Option<String>,
    #[serde(rename = "state", skip_serializing_if = "Option::is_none")]
    pub state: Option<String>,
    #[serde(rename = "country", skip_serializing_if = "Option::is_none")]
    pub country: Option<String>,
    #[serde(rename = "products_desc", skip_serializing_if = "Option::is_none")]
    pub products_desc: Option<String>,
    #[serde(rename = "product_details", skip_serializing_if = "Option::is_none")]
    pub product_details: Option<String>,
    #[serde(rename = "shipment_length", skip_serializing_if = "Option::is_none")]
    pub shipment_length: Option<f64>,
    #[serde(rename = "shipment_width", skip_serializing_if = "Option::is_none")]
    pub shipment_width: Option<f64>,
    #[serde(rename = "shipment_height", skip_serializing_if = "Option::is_none")]
    pub shipment_height: Option<f64>,
    #[serde(rename = "gm", skip_serializing_if = "Option::is_none")]
    pub gm: Option<f64>,
    #[serde(rename = "weight", skip_serializing_if = "Option::is_none")]
    pub weight: Option<f64>,
    #[serde(rename = "fragile_shipment", skip_serializing_if = "Option::is_none")]
    pub fragile_shipment: Option<bool>,
    #[serde(rename = "ewaybill", skip_serializing_if = "Option::is_none")]
    pub ewaybill: Option<String>,
    #[serde(rename = "seller_gst_tin", skip_serializing_if = "Option::is_none")]
    pub seller_gst_tin: Option<String>,
    #[serde(rename = "client_gst_tin", skip_serializing_if = "Option::is_none")]
    pub client_gst_tin: Option<String>,
    #[serde(rename = "consignee_gst_tin", skip_serializing_if = "Option::is_none")]
    pub consignee_gst_tin: Option<String>,
    #[serde(rename = "hsn_code", skip_serializing_if = "Option::is_none")]
    pub hsn_code: Option<Box<models::DelhiveryApiErrorBodyErrorsValue>>,
    #[serde(rename = "invoice_reference", skip_serializing_if = "Option::is_none")]
    pub invoice_reference: Option<String>,
    #[serde(rename = "qc", skip_serializing_if = "Option::is_none")]
    pub qc: Option<Box<models::DelhiveryShipmentPayloadQc>>,
    #[serde(rename = "shipment", skip_serializing_if = "Option::is_none")]
    pub shipment: Option<Vec<models::DelhiveryShipmentItem>>,
}

impl DelhiveryShipmentPayload {
    pub fn new(order_id: String, pickup_location: models::DelhiveryPickupLocation, package_type: PackageType, name: String, phone: String, pin: String) -> DelhiveryShipmentPayload {
        DelhiveryShipmentPayload {
            order_id,
            waybill: None,
            order_date: None,
            client: None,
            pickup_location: Box::new(pickup_location),
            package_type,
            payment_mode: None,
            cod_amount: None,
            name,
            add: None,
            address: None,
            phone,
            pin,
            city: None,
            state: None,
            country: None,
            products_desc: None,
            product_details: None,
            shipment_length: None,
            shipment_width: None,
            shipment_height: None,
            gm: None,
            weight: None,
            fragile_shipment: None,
            ewaybill: None,
            seller_gst_tin: None,
            client_gst_tin: None,
            consignee_gst_tin: None,
            hsn_code: None,
            invoice_reference: None,
            qc: None,
            shipment: None,
            additional_properties: Default::default(),
        }
    }
}
/// 
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum PackageType {
    #[serde(rename = "COD")]
    Cod,
    #[serde(rename = "Pre-paid")]
    PrePaid,
    #[serde(rename = "Pickup")]
    Pickup,
}

impl Default for PackageType {
    fn default() -> PackageType {
        Self::Cod
    }
}
/// 
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum PaymentMode {
    #[serde(rename = "COD")]
    Cod,
    #[serde(rename = "Pre-paid")]
    PrePaid,
    #[serde(rename = "Pickup")]
    Pickup,
}

impl Default for PaymentMode {
    fn default() -> PaymentMode {
        Self::Cod
    }
}