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 DelhiveryOrderEditPayload {
    #[serde(rename = "waybill")]
    pub waybill: String,
    /// Set to true to cancel the shipment.
    #[serde(rename = "cancellation", skip_serializing_if = "Option::is_none")]
    pub cancellation: Option<bool>,
    #[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 = "cod", skip_serializing_if = "Option::is_none")]
    pub cod: Option<f64>,
    #[serde(rename = "gm", skip_serializing_if = "Option::is_none")]
    pub gm: Option<f64>,
    #[serde(rename = "name", skip_serializing_if = "Option::is_none")]
    pub name: Option<String>,
    #[serde(rename = "add", skip_serializing_if = "Option::is_none")]
    pub add: Option<String>,
    #[serde(rename = "phone", skip_serializing_if = "Option::is_none")]
    pub phone: Option<String>,
    #[serde(rename = "product_details", skip_serializing_if = "Option::is_none")]
    pub product_details: Option<String>,
    #[serde(rename = "pt", skip_serializing_if = "Option::is_none")]
    pub pt: Option<Pt>,
}

impl DelhiveryOrderEditPayload {
    pub fn new(waybill: String) -> DelhiveryOrderEditPayload {
        DelhiveryOrderEditPayload {
            waybill,
            cancellation: None,
            shipment_length: None,
            shipment_width: None,
            shipment_height: None,
            cod: None,
            gm: None,
            name: None,
            add: None,
            phone: None,
            product_details: None,
            pt: None,
        }
    }
}
/// 
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Pt {
    #[serde(rename = "COD")]
    Cod,
    #[serde(rename = "Pre-paid")]
    PrePaid,
    #[serde(rename = "Pickup")]
    Pickup,
}

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