amazon_spapi/models/orders_v0/
address.rs

1/*
2 * Selling Partner API for Orders
3 *
4 * Use the Orders Selling Partner API to programmatically retrieve order information. With this API, you can develop fast, flexible, and custom applications to manage order synchronization, perform order research, and create demand-based decision support tools.   _Note:_ For the JP, AU, and SG marketplaces, the Orders API supports orders from 2016 onward. For all other marketplaces, the Orders API supports orders for the last two years (orders older than this don't show up in the response).
5 *
6 * The version of the OpenAPI document: v0
7 * 
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// Address : The shipping address for the order.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct Address {
17    /// The name.
18    #[serde(rename = "Name")]
19    pub name: String,
20    /// The company name of the recipient.  **Note**: This attribute is only available for shipping address.
21    #[serde(rename = "CompanyName", skip_serializing_if = "Option::is_none")]
22    pub company_name: Option<String>,
23    /// The street address.
24    #[serde(rename = "AddressLine1", skip_serializing_if = "Option::is_none")]
25    pub address_line1: Option<String>,
26    /// Additional street address information, if required.
27    #[serde(rename = "AddressLine2", skip_serializing_if = "Option::is_none")]
28    pub address_line2: Option<String>,
29    /// Additional street address information, if required.
30    #[serde(rename = "AddressLine3", skip_serializing_if = "Option::is_none")]
31    pub address_line3: Option<String>,
32    /// The city.
33    #[serde(rename = "City", skip_serializing_if = "Option::is_none")]
34    pub city: Option<String>,
35    /// The county.
36    #[serde(rename = "County", skip_serializing_if = "Option::is_none")]
37    pub county: Option<String>,
38    /// The district.
39    #[serde(rename = "District", skip_serializing_if = "Option::is_none")]
40    pub district: Option<String>,
41    /// The state or region.
42    #[serde(rename = "StateOrRegion", skip_serializing_if = "Option::is_none")]
43    pub state_or_region: Option<String>,
44    /// The municipality.
45    #[serde(rename = "Municipality", skip_serializing_if = "Option::is_none")]
46    pub municipality: Option<String>,
47    /// The postal code.
48    #[serde(rename = "PostalCode", skip_serializing_if = "Option::is_none")]
49    pub postal_code: Option<String>,
50    /// The country code. A two-character country code, in ISO 3166-1 alpha-2 format.
51    #[serde(rename = "CountryCode", skip_serializing_if = "Option::is_none")]
52    pub country_code: Option<String>,
53    /// The phone number of the buyer.  **Note**:  1. This attribute is only available for shipping address. 2. In some cases, the buyer phone number is suppressed:  a. Phone is suppressed for all `AFN` (fulfilled by Amazon) orders. b. Phone is suppressed for the shipped `MFN` (fulfilled by seller) order when the current date is past the Latest Delivery Date.
54    #[serde(rename = "Phone", skip_serializing_if = "Option::is_none")]
55    pub phone: Option<String>,
56    #[serde(rename = "ExtendedFields", skip_serializing_if = "Option::is_none")]
57    pub extended_fields: Option<Box<models::orders_v0::AddressExtendedFields>>,
58    /// The address type of the shipping address.
59    #[serde(rename = "AddressType", skip_serializing_if = "Option::is_none")]
60    pub address_type: Option<AddressType>,
61}
62
63impl Address {
64    /// The shipping address for the order.
65    pub fn new(name: String) -> Address {
66        Address {
67            name,
68            company_name: None,
69            address_line1: None,
70            address_line2: None,
71            address_line3: None,
72            city: None,
73            county: None,
74            district: None,
75            state_or_region: None,
76            municipality: None,
77            postal_code: None,
78            country_code: None,
79            phone: None,
80            extended_fields: None,
81            address_type: None,
82        }
83    }
84}
85/// The address type of the shipping address.
86#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
87pub enum AddressType {
88    #[serde(rename = "Residential")]
89    Residential,
90    #[serde(rename = "Commercial")]
91    Commercial,
92}
93
94impl Default for AddressType {
95    fn default() -> AddressType {
96        Self::Residential
97    }
98}
99