1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
pub use node_types::Status;

//@todo would be nice to have a method of doing this *without* needing to build a struct.
//@todo we need a timeout as well btw.
//@todo should probably have a builder struct to configure all of that.

pub struct NodeClient {
    url: String,
}

impl NodeClient {
    //@todo should probably include a Result here.
    pub async fn status(&self) -> Status {
        let status: Status = surf::get(&self.url)
            .await
            .unwrap()
            .body_json()
            .await
            .unwrap();

        status
    }
}