summaryrefslogtreecommitdiff
path: root/src/requests/get.rs
diff options
context:
space:
mode:
authorfx <[email protected]>2023-10-18 15:11:44 +0200
committerfx <[email protected]>2023-10-18 15:11:44 +0200
commitb4f59c226c6916a3e45f1a52dc6a9b15c800297a (patch)
tree07016e2ac7278da6b63aa839065c5ad572215e50 /src/requests/get.rs
downloadwebol-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.rs21
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 @@
1use crate::{error::CliError, config::SETTINGS, default_headers};
2
3pub 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}