airlabs_api/
request.rs

1use super::*;
2
3mod impls;
4
5#[derive(Clone, Debug, Serialize, Deserialize)]
6pub struct Request {
7    pub lang: String,
8    pub currency: String,
9    pub time: u64,
10    pub id: String,
11    pub server: String,
12    pub host: String,
13    pub pid: u64,
14    pub key: Key,
15    pub params: BTreeMap<String, String>,
16    pub version: u64,
17    pub method: String,
18    pub client: ClientInfo,
19}
20
21#[derive(Clone, Debug, Serialize, Deserialize)]
22pub struct Key {
23    pub id: u64,
24    pub api_key: String,
25    pub r#type: String,
26    #[serde(with = "time::serde::rfc3339")]
27    pub expired: time::OffsetDateTime,
28    #[serde(with = "time::serde::rfc3339")]
29    pub registered: time::OffsetDateTime,
30    pub upgraded: Option<String>,
31    pub limits_by_hour: u64,
32    pub limits_by_minute: u64,
33    pub limits_by_month: u64,
34    pub limits_total: u64,
35}
36
37#[derive(Clone, Debug, Serialize, Deserialize)]
38pub struct Params {
39    pub params: BTreeMap<String, String>,
40}
41
42#[derive(Clone, Debug, Serialize, Deserialize)]
43pub struct ClientInfo {
44    pub ip: String,
45    pub geo: GeoInfo,
46    pub connection: ConnectionInfo,
47    pub device: BTreeMap<String, String>,
48    pub agent: BTreeMap<String, String>,
49    pub karma: Karma,
50}
51
52#[derive(Clone, Debug, Serialize, Deserialize)]
53pub struct GeoInfo {
54    pub country_code: String,
55    pub country: String,
56    pub continent: String,
57    pub city: String,
58    pub lat: f64,
59    pub lng: f64,
60    pub timezone: String,
61}
62
63#[derive(Clone, Debug, Serialize, Deserialize)]
64pub struct ConnectionInfo {
65    pub r#type: Option<String>,
66    pub isp_code: Option<u64>,
67    pub isp_name: Option<String>,
68}
69
70#[derive(Clone, Debug, Serialize, Deserialize)]
71pub struct Karma {
72    pub is_blocked: bool,
73    pub is_crawler: bool,
74    pub is_bot: bool,
75    pub is_friend: bool,
76    pub is_regular: bool,
77}