open-logistics 0.2.2

Rust client for the Open Logistics Shiprocket and Delhivery APIs.
Documentation
/*
 * Open Logistics — Shiprocket
 *
 * OpenAPI description of the Shiprocket 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.  Two TypeScript methods (`checkServiceability` and `calculateRates`) call `GET /courier/serviceability`; OpenAPI permits one operation per path + method, so this spec exposes a single `courier_serviceability` operation. Language facades may alias it as `calculate_rates`. 
 *
 * The version of the OpenAPI document: 0.2.2
 * 
 * Generated by: https://openapi-generator.tech
 */

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

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct TrackEvent {
    #[serde(rename = "id")]
    pub id: i32,
    #[serde(rename = "awb_code")]
    pub awb_code: String,
    #[serde(rename = "courier_company_id")]
    pub courier_company_id: i32,
    #[serde(rename = "shipment_id")]
    pub shipment_id: i32,
    #[serde(rename = "order_id")]
    pub order_id: i32,
    #[serde(rename = "pickup_date", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub pickup_date: Option<Option<String>>,
    #[serde(rename = "delivered_date", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub delivered_date: Option<Option<String>>,
    #[serde(rename = "weight")]
    pub weight: String,
    #[serde(rename = "packages")]
    pub packages: i32,
    #[serde(rename = "current_status")]
    pub current_status: String,
    #[serde(rename = "delivered_to")]
    pub delivered_to: String,
    #[serde(rename = "destination")]
    pub destination: String,
    #[serde(rename = "consignee_name")]
    pub consignee_name: String,
    #[serde(rename = "origin")]
    pub origin: String,
    #[serde(rename = "courier_agent_details", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub courier_agent_details: Option<Option<String>>,
}

impl TrackEvent {
    pub fn new(id: i32, awb_code: String, courier_company_id: i32, shipment_id: i32, order_id: i32, weight: String, packages: i32, current_status: String, delivered_to: String, destination: String, consignee_name: String, origin: String) -> TrackEvent {
        TrackEvent {
            id,
            awb_code,
            courier_company_id,
            shipment_id,
            order_id,
            pickup_date: None,
            delivered_date: None,
            weight,
            packages,
            current_status,
            delivered_to,
            destination,
            consignee_name,
            origin,
            courier_agent_details: None,
        }
    }
}