Skip to content

Commit a17a31e

Browse files
committed
Add support for Core bundle
1 parent 0950c16 commit a17a31e

File tree

3 files changed

+461
-0
lines changed

3 files changed

+461
-0
lines changed

src/api.rs

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,3 +266,63 @@ pub struct IpDetailsLite {
266266
#[serde(flatten)]
267267
pub extra: HashMap<String, Value>,
268268
}
269+
270+
/// Core API Geo details.
271+
#[derive(Debug, Default, Deserialize, Serialize, Clone)]
272+
pub struct CoreGeo {
273+
pub city: Option<String>,
274+
pub region: Option<String>,
275+
pub region_code: Option<String>,
276+
pub country: Option<String>,
277+
pub country_code: Option<String>,
278+
pub continent: Option<String>,
279+
pub continent_code: Option<String>,
280+
pub latitude: f64,
281+
pub longitude: f64,
282+
pub timezone: Option<String>,
283+
pub postal_code: Option<String>,
284+
285+
/// Enriched fields
286+
#[serde(skip_deserializing)]
287+
pub country_name: Option<String>,
288+
#[serde(skip_deserializing)]
289+
pub is_eu: Option<bool>,
290+
#[serde(skip_deserializing)]
291+
pub country_flag: Option<CountryFlag>,
292+
#[serde(skip_deserializing)]
293+
pub country_flag_url: Option<String>,
294+
#[serde(skip_deserializing)]
295+
pub country_currency: Option<CountryCurrency>,
296+
#[serde(skip_deserializing)]
297+
pub continent_info: Option<Continent>,
298+
}
299+
300+
/// Core API AS details.
301+
#[derive(Debug, Default, Deserialize, Serialize, Clone)]
302+
pub struct CoreAS {
303+
pub asn: String,
304+
pub name: String,
305+
pub domain: String,
306+
#[serde(rename = "type")]
307+
pub as_type: String,
308+
}
309+
310+
/// Core API IP address lookup details.
311+
#[derive(Debug, Default, Deserialize, Serialize, Clone)]
312+
pub struct IpDetailsCore {
313+
pub ip: String,
314+
pub geo: Option<CoreGeo>,
315+
#[serde(rename = "as")]
316+
pub asn: Option<CoreAS>,
317+
pub is_anonymous: bool,
318+
pub is_anycast: bool,
319+
pub is_hosting: bool,
320+
pub is_mobile: bool,
321+
pub is_satellite: bool,
322+
323+
/// If the IP Address is Bogon
324+
pub bogon: Option<bool>,
325+
326+
#[serde(flatten)]
327+
pub extra: HashMap<String, Value>,
328+
}

0 commit comments

Comments
 (0)