amazon-spapi 2.0.3

A Rust client library for Amazon Selling Partner API (SP-API)
Documentation
/*
 * Amazon Shipping API
 *
 * The Amazon Shipping API is designed to support outbound shipping use cases both for orders originating on Amazon-owned marketplaces as well as external channels/marketplaces. With these APIs, you can request shipping rates, create shipments, cancel shipments, and track shipments.
 *
 * The version of the OpenAPI document: v2
 * Contact: swa-api-core@amazon.com
 * Generated by: https://openapi-generator.tech
 */

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

/// Address : The address.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Address {
    /// The name of the person, business or institution at the address.
    #[serde(rename = "name")]
    pub name: String,
    /// The first line of the address.
    #[serde(rename = "addressLine1")]
    pub address_line1: String,
    /// Additional address information, if required.
    #[serde(rename = "addressLine2", skip_serializing_if = "Option::is_none")]
    pub address_line2: Option<String>,
    /// Additional address information, if required.
    #[serde(rename = "addressLine3", skip_serializing_if = "Option::is_none")]
    pub address_line3: Option<String>,
    /// The name of the business or institution associated with the address.
    #[serde(rename = "companyName", skip_serializing_if = "Option::is_none")]
    pub company_name: Option<String>,
    /// The state, county or region where the person, business or institution is located.
    #[serde(rename = "stateOrRegion")]
    pub state_or_region: String,
    /// The city or town where the person, business or institution is located.
    #[serde(rename = "city")]
    pub city: String,
    /// The two digit country code. Follows ISO 3166-1 alpha-2 format.
    #[serde(rename = "countryCode")]
    pub country_code: String,
    /// The postal code of that address. It contains a series of letters or digits or both, sometimes including spaces or punctuation.
    #[serde(rename = "postalCode")]
    pub postal_code: String,
    /// The email address of the contact associated with the address.
    #[serde(rename = "email", skip_serializing_if = "Option::is_none")]
    pub email: Option<String>,
    /// The phone number of the person, business or institution located at that address, including the country calling code.
    #[serde(rename = "phoneNumber", skip_serializing_if = "Option::is_none")]
    pub phone_number: Option<String>,
    #[serde(rename = "geocode", skip_serializing_if = "Option::is_none")]
    pub geocode: Option<Box<models::shipping_v2::Geocode>>,
}

impl Address {
    /// The address.
    pub fn new(name: String, address_line1: String, state_or_region: String, city: String, country_code: String, postal_code: String) -> Address {
        Address {
            name,
            address_line1,
            address_line2: None,
            address_line3: None,
            company_name: None,
            state_or_region,
            city,
            country_code,
            postal_code,
            email: None,
            phone_number: None,
            geocode: None,
        }
    }
}