1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
use serde::{Deserialize, Serialize};
use thiserror::Error;
#[derive(Debug, Serialize, Deserialize)]
pub struct JSONInfoData {
pub wurfl_api_version: String,
pub wm_version: String,
pub wurfl_info: String,
pub important_headers: Vec<String>,
pub static_caps: Vec<String>,
pub virtual_caps: Vec<String>,
ltime: String,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct JSONDeviceData {
pub capabilities: HashMap<String, String>,
pub error: String,
pub mtime: i64,
pub ltime: String,
}
#[derive(Debug, Serialize, Deserialize)]
struct JSONMakeModel {
brand_name: String,
model_name: String,
marketing_name: Option<String>
}
#[derive(Debug, Serialize, Deserialize, Eq, Ord, PartialEq, PartialOrd)]
pub struct JSONModelMktName {
pub model_name: String,
pub marketing_name: String
}
#[derive(Debug, Serialize, Deserialize)]
struct JSONDeviceOsVersions {
device_os: String,
device_os_version: String,
}
#[derive(Debug, Serialize)]
struct Request {
lookup_headers: Option<HashMap<String, String>>,
requested_caps: Option<Vec<String>>,
requested_vcaps: Option<Vec<String>>,
wurfl_id: Option<String>,
}
impl Request {
pub fn new(lh: Option<HashMap<String, String>>, req_caps: Option<Vec<String>>, req_vcaps: Option<Vec<String>>, wid: Option<String>) -> Request {
Request {
lookup_headers: lh,
requested_caps: req_caps,
requested_vcaps: req_vcaps,
wurfl_id: wid
}
}
}
#[derive(Error, Debug)]
pub struct WmError {
pub msg: String,
}
impl std::fmt::Display for WmError {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(f, "{}", self.msg)
}
}
impl From<reqwest::Error> for WmError {
fn from(reqw_err: Error) -> Self {
WmError{msg: reqw_err.to_string()}
}
}