diff options
author | fx <[email protected]> | 2023-10-18 15:11:44 +0200 |
---|---|---|
committer | fx <[email protected]> | 2023-10-18 15:11:44 +0200 |
commit | b4f59c226c6916a3e45f1a52dc6a9b15c800297a (patch) | |
tree | 07016e2ac7278da6b63aa839065c5ad572215e50 /src/requests/get.rs | |
download | webol-cli-b4f59c226c6916a3e45f1a52dc6a9b15c800297a.tar webol-cli-b4f59c226c6916a3e45f1a52dc6a9b15c800297a.tar.gz webol-cli-b4f59c226c6916a3e45f1a52dc6a9b15c800297a.zip |
basic cli, only start and get device
Diffstat (limited to 'src/requests/get.rs')
-rw-r--r-- | src/requests/get.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/requests/get.rs b/src/requests/get.rs new file mode 100644 index 0000000..225562d --- /dev/null +++ b/src/requests/get.rs | |||
@@ -0,0 +1,21 @@ | |||
1 | use crate::{error::CliError, config::SETTINGS, default_headers}; | ||
2 | |||
3 | pub fn get(id: String) -> Result<(), CliError> { | ||
4 | let res = reqwest::blocking::Client::new() | ||
5 | .get( | ||
6 | format!( | ||
7 | "{}/start", | ||
8 | SETTINGS.get_string("server").map_err(CliError::Config)? | ||
9 | ) | ||
10 | ) | ||
11 | .headers(default_headers()?) | ||
12 | .body( | ||
13 | format!(r#"{{"id": "{}"}}"#, id) | ||
14 | ) | ||
15 | .send() | ||
16 | .map_err(CliError::Reqwest)? | ||
17 | .text(); | ||
18 | |||
19 | println!("{:?}", res); | ||
20 | Ok(()) | ||
21 | } | ||