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
use std::collections::HashMap;
use crate::Request;
use serde::{Deserialize, Serialize};
#[derive(Default, Clone, Serialize)]
pub struct ServerInfoRequest {}
impl Request for ServerInfoRequest {
type Response = ServerInfoResponse;
fn method(&self) -> String {
"server_info".to_owned()
}
}
impl ServerInfoRequest {
pub fn new() -> Self {
Self::default()
}
}
pub type ServerState = String;
#[derive(Debug, Deserialize)]
pub struct StateAccountingInfo {
pub duration_us: String,
pub transitions: String,
}
#[derive(Debug, Deserialize)]
pub struct ServerInfo {
pub amendment_blocked: Option<bool>,
pub build_version: String,
pub peers: u32,
pub hostid: String,
pub server_state: ServerState,
pub state_accounting: HashMap<ServerState, StateAccountingInfo>,
pub time: String,
pub uptime: u32,
}
#[derive(Debug, Deserialize)]
pub struct ServerInfoResponse {
pub info: ServerInfo,
}