amazon-spapi 2.0.3

A Rust client library for Amazon Selling Partner API (SP-API)
Documentation
/*
 * The Selling Partner API for Amazon Warehousing and Distribution
 *
 * The Selling Partner API for Amazon Warehousing and Distribution (AWD) provides programmatic access to information about AWD shipments and inventory.
 *
 * The version of the OpenAPI document: 2024-05-09
 * 
 * Generated by: https://openapi-generator.tech
 */

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

/// Address : Shipping address that represents the origin or destination location.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Address {
    /// First line of the address text.
    #[serde(rename = "addressLine1")]
    pub address_line1: String,
    /// Optional second line of the address text.
    #[serde(rename = "addressLine2", skip_serializing_if = "Option::is_none")]
    pub address_line2: Option<String>,
    /// Optional third line of the address text.
    #[serde(rename = "addressLine3", skip_serializing_if = "Option::is_none")]
    pub address_line3: Option<String>,
    /// Optional city where this address is located.
    #[serde(rename = "city", skip_serializing_if = "Option::is_none")]
    pub city: Option<String>,
    /// Two-digit, ISO 3166-1 alpha-2 formatted country code where this address is located.
    #[serde(rename = "countryCode")]
    pub country_code: String,
    /// Optional county where this address is located.
    #[serde(rename = "county", skip_serializing_if = "Option::is_none")]
    pub county: Option<String>,
    /// Optional district where this address is located.
    #[serde(rename = "district", skip_serializing_if = "Option::is_none")]
    pub district: Option<String>,
    /// Name of the person, business, or institution at this address.
    #[serde(rename = "name")]
    pub name: String,
    /// Optional E.164-formatted phone number for an available contact at this address.
    #[serde(rename = "phoneNumber", skip_serializing_if = "Option::is_none")]
    pub phone_number: Option<String>,
    /// Optional postal code where this address is located.
    #[serde(rename = "postalCode", skip_serializing_if = "Option::is_none")]
    pub postal_code: Option<String>,
    /// State or region where this address is located. Note that this is contextual to the specified country code.
    #[serde(rename = "stateOrRegion")]
    pub state_or_region: String,
}

impl Address {
    /// Shipping address that represents the origin or destination location.
    pub fn new(address_line1: String, country_code: String, name: String, state_or_region: String) -> Address {
        Address {
            address_line1,
            address_line2: None,
            address_line3: None,
            city: None,
            country_code,
            county: None,
            district: None,
            name,
            phone_number: None,
            postal_code: None,
            state_or_region,
        }
    }
}