obscuravpn_api/cmd/
relay.rs

1use serde::{Deserialize, Serialize};
2
3use crate::types::OneRelay;
4
5use super::Cmd;
6
7const RELAYS_PATH: &str = "relays";
8
9#[derive(Debug, Serialize, Deserialize, Clone)]
10pub struct ListRelays {}
11
12impl Cmd for ListRelays {
13    type Output = Vec<OneRelay>;
14    const METHOD: http::Method = http::Method::GET;
15    const PATH: &'static str = RELAYS_PATH;
16}
17
18#[test]
19fn test_json() {
20    let output_json = r#"[
21  {
22    "id": "NYC-001",
23    "ip_v4": "8.8.31.3",
24    "ip_v6": "2001:db8:1234:ffff:ffff:ffff:ffff:ffff"
25  }
26    ]"#;
27    crate::cmd::check_cmd_json::<ListRelays>(None, Some(output_json));
28}