diff options
author | FxQnLr <[email protected]> | 2024-06-17 11:19:13 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2024-06-17 11:19:13 +0200 |
commit | b375657e660b199127a76683980a5d210a572ab7 (patch) | |
tree | fbed775283917537c1d2d11bdbf38a0fa7c05a02 /src/requests/device.rs | |
parent | 31a57425a76cae121c5d8ef5b0f2442ca6a9ee61 (diff) | |
parent | 0877850a63791772dd19a0af9a0c7c87940aead2 (diff) | |
download | webol-cli-b375657e660b199127a76683980a5d210a572ab7.tar webol-cli-b375657e660b199127a76683980a5d210a572ab7.tar.gz webol-cli-b375657e660b199127a76683980a5d210a572ab7.zip |
0.3.0
Diffstat (limited to 'src/requests/device.rs')
-rw-r--r-- | src/requests/device.rs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/requests/device.rs b/src/requests/device.rs index 7583406..2606579 100644 --- a/src/requests/device.rs +++ b/src/requests/device.rs | |||
@@ -7,7 +7,7 @@ pub async fn put( | |||
7 | broadcast_addr: String, | 7 | broadcast_addr: String, |
8 | ip: String, | 8 | ip: String, |
9 | ) -> Result<(), Error> { | 9 | ) -> Result<(), Error> { |
10 | let url = format_url(config, "device", &Protocols::Http); | 10 | let url = format_url(config, "device", &Protocols::Http, None); |
11 | println!("{url}"); | 11 | println!("{url}"); |
12 | let res = reqwest::Client::new() | 12 | let res = reqwest::Client::new() |
13 | .put(url) | 13 | .put(url) |
@@ -25,9 +25,8 @@ pub async fn put( | |||
25 | 25 | ||
26 | pub async fn get(config: &Config, id: String) -> Result<(), Error> { | 26 | pub async fn get(config: &Config, id: String) -> Result<(), Error> { |
27 | let res = reqwest::Client::new() | 27 | let res = reqwest::Client::new() |
28 | .get(format_url(config, "device", &Protocols::Http)) | 28 | .get(format_url(config, "device", &Protocols::Http, Some(&id))) |
29 | .headers(default_headers(config)?) | 29 | .headers(default_headers(config)?) |
30 | .body(format!(r#"{{"id": "{id}"}}"#)) | ||
31 | .send() | 30 | .send() |
32 | .await?; | 31 | .await?; |
33 | 32 | ||
@@ -44,7 +43,7 @@ pub async fn post( | |||
44 | ip: String, | 43 | ip: String, |
45 | ) -> Result<(), Error> { | 44 | ) -> Result<(), Error> { |
46 | let res = reqwest::Client::new() | 45 | let res = reqwest::Client::new() |
47 | .post(format_url(config, "device", &Protocols::Http)) | 46 | .post(format_url(config, "device", &Protocols::Http, None)) |
48 | .headers(default_headers(config)?) | 47 | .headers(default_headers(config)?) |
49 | .body(format!( | 48 | .body(format!( |
50 | r#"{{"id": "{id}", "mac": "{mac}", "broadcast_addr": "{broadcast_addr}", "ip": "{ip}"}}"#, | 49 | r#"{{"id": "{id}", "mac": "{mac}", "broadcast_addr": "{broadcast_addr}", "ip": "{ip}"}}"#, |