Skip to main content

threads_rs/types/
location.rs

1use serde::{Deserialize, Serialize};
2
3/// A geographic location that can be tagged in posts.
4#[derive(Debug, Clone, Serialize, Deserialize)]
5pub struct Location {
6    /// Location ID.
7    pub id: String,
8    /// Location name.
9    pub name: String,
10    /// Street address.
11    #[serde(default, skip_serializing_if = "Option::is_none")]
12    pub address: Option<String>,
13    /// City name.
14    #[serde(default, skip_serializing_if = "Option::is_none")]
15    pub city: Option<String>,
16    /// Country name.
17    #[serde(default, skip_serializing_if = "Option::is_none")]
18    pub country: Option<String>,
19    /// Geographic latitude.
20    #[serde(default, skip_serializing_if = "Option::is_none")]
21    pub latitude: Option<f64>,
22    /// Geographic longitude.
23    #[serde(default, skip_serializing_if = "Option::is_none")]
24    pub longitude: Option<f64>,
25    /// Postal code.
26    #[serde(default, skip_serializing_if = "Option::is_none")]
27    pub postal_code: Option<String>,
28}
29
30/// Response from the location search endpoint.
31#[derive(Debug, Clone, Serialize, Deserialize)]
32pub struct LocationSearchResponse {
33    /// List of matching locations.
34    pub data: Vec<Location>,
35}