Skip to main content

open_logistics/shiprocket/models/
order_response.rs

1/*
2 * Open Logistics — Shiprocket
3 *
4 * 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`. 
5 *
6 * The version of the OpenAPI document: 0.3.0
7 * 
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::shiprocket::models;
12use serde::{Deserialize, Serialize};
13
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct OrderResponse {
16    #[serde(rename = "order_id")]
17    pub order_id: i32,
18    #[serde(rename = "shipment_id")]
19    pub shipment_id: i32,
20    #[serde(rename = "status")]
21    pub status: String,
22    #[serde(rename = "status_code")]
23    pub status_code: i32,
24    #[serde(rename = "onboarding_completed_now")]
25    pub onboarding_completed_now: bool,
26    #[serde(rename = "awb_code", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
27    pub awb_code: Option<Option<String>>,
28    #[serde(rename = "courier_company_id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
29    pub courier_company_id: Option<Option<i32>>,
30    #[serde(rename = "courier_name", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
31    pub courier_name: Option<Option<String>>,
32}
33
34impl OrderResponse {
35    pub fn new(order_id: i32, shipment_id: i32, status: String, status_code: i32, onboarding_completed_now: bool) -> OrderResponse {
36        OrderResponse {
37            order_id,
38            shipment_id,
39            status,
40            status_code,
41            onboarding_completed_now,
42            awb_code: None,
43            courier_company_id: None,
44            courier_name: None,
45        }
46    }
47}
48