amazon-spapi 2.0.3

A Rust client library for Amazon Selling Partner API (SP-API)
Documentation
/*
 * Selling Partner API for Direct Fulfillment Payments
 *
 * The Selling Partner API for Direct Fulfillment Payments provides programmatic access to a direct fulfillment vendor's invoice data.
 *
 * The version of the OpenAPI document: v1
 * 
 * Generated by: https://openapi-generator.tech
 */

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

/// Address : Address of the party.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Address {
    /// The name of the person, business or institution at that address.
    #[serde(rename = "name")]
    pub name: String,
    /// First line of the address.
    #[serde(rename = "addressLine1")]
    pub address_line1: String,
    /// Additional street address information, if required.
    #[serde(rename = "addressLine2", skip_serializing_if = "Option::is_none")]
    pub address_line2: Option<String>,
    /// Additional street address information, if required.
    #[serde(rename = "addressLine3", skip_serializing_if = "Option::is_none")]
    pub address_line3: Option<String>,
    /// The city where the person, business or institution is located.
    #[serde(rename = "city")]
    pub city: String,
    /// The county where person, business or institution is located.
    #[serde(rename = "county", skip_serializing_if = "Option::is_none")]
    pub county: Option<String>,
    /// The district where person, business or institution is located.
    #[serde(rename = "district", skip_serializing_if = "Option::is_none")]
    pub district: Option<String>,
    /// The state or region where person, business or institution is located.
    #[serde(rename = "stateOrRegion")]
    pub state_or_region: String,
    /// The postal code of that address. It conatins a series of letters or digits or both, sometimes including spaces or punctuation.
    #[serde(rename = "postalCode")]
    pub postal_code: String,
    /// The two digit country code in ISO 3166-1 alpha-2 format.
    #[serde(rename = "countryCode")]
    pub country_code: String,
    /// The phone number of the person, business or institution located at that address.
    #[serde(rename = "phone", skip_serializing_if = "Option::is_none")]
    pub phone: Option<String>,
}

impl Address {
    /// Address of the party.
    pub fn new(name: String, address_line1: String, city: String, state_or_region: String, postal_code: String, country_code: String) -> Address {
        Address {
            name,
            address_line1,
            address_line2: None,
            address_line3: None,
            city,
            county: None,
            district: None,
            state_or_region,
            postal_code,
            country_code,
            phone: None,
        }
    }
}