square_rust/api/models/objects/address.rs
1//! Address — A physical address.
2
3use serde::{Deserialize, Serialize};
4
5use crate::api::models::enums::country::Country;
6
7/// Represents a physical address.
8#[derive(Debug, Clone, Serialize, Deserialize)]
9pub struct Address {
10 /// The first line of the address.
11 /// Fields that start with address_line provide the address's most specific details, like street number, street name, and building name. They do not provide less specific details like city,
12 /// state/province, or country (these details are provided in other fields).
13 pub address_line_1: Option<String>,
14 /// The second line of the address, if any.
15 pub address_line_2: Option<String>,
16 /// The third line of the address, if any.
17 pub address_line_3: Option<String>,
18 /// The city or town of the address. For a full list of field meanings by country, see [Working with Addresses.](https://developer.squareup.com/docs/build-basics/working-with-addresses).
19 pub locality: Option<String>,
20 /// A civil region within the address's locality, if any.
21 pub sublocality: Option<String>,
22 /// A civil region within the address's sublocality, if any.
23 pub sublocality_2: Option<String>,
24 /// A civil region within the address's sublocality_2, if any.
25 pub sublocality_3: Option<String>,
26 /// A civil entity within the address's country. In the US, this is the state. For a full list of field meanings by country, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses).
27 pub administrative_district_level_1: Option<String>,
28 /// A civil entity within the address's administrative_district_level_1. In the US, this is the county.
29 pub administrative_district_level_2: Option<String>,
30 /// A civil entity within the address's administrative_district_level_2, if any.
31 pub administrative_district_level_3: Option<String>,
32 /// The address's postal code. For a full list of field meanings by country, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses).
33 pub postal_code: Option<String>,
34 /// The address's country, in the two-letter format of ISO 3166. For example, US or FR.
35 pub country: Option<Country>,
36 /// Optional first name when it's representing recipient.
37 pub first_name: Option<String>,
38 /// Optional last name when it's representing recipient.
39 pub last_name: Option<String>,
40}