Skip to content

Commit 54536f0

Browse files
committed
qb v5: rename pause/stop, resume/start
1 parent 6b63683 commit 54536f0

File tree

1 file changed

+19
-26
lines changed

1 file changed

+19
-26
lines changed

src/lib.rs

Lines changed: 19 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use std::{
1313
pub mod model;
1414
pub use builder::QbitBuilder;
1515
use bytes::Bytes;
16-
use reqwest::{header, Client, Method, Response, StatusCode};
16+
use reqwest::{Client, Method, Response, StatusCode, header};
1717
use serde::Serialize;
1818
use serde_with::skip_serializing_none;
1919
use tap::{Pipe, TapFallible};
@@ -207,12 +207,9 @@ impl Qbit {
207207
last_known_id: Option<i64>,
208208
}
209209

210-
self.get_with(
211-
"log/peers",
212-
&Arg {
213-
last_known_id: last_known_id.into(),
214-
},
215-
)
210+
self.get_with("log/peers", &Arg {
211+
last_known_id: last_known_id.into(),
212+
})
216213
.await?
217214
.json()
218215
.await
@@ -244,13 +241,10 @@ impl Qbit {
244241
rid: Option<i64>,
245242
}
246243

247-
self.get_with(
248-
"sync/torrentPeers",
249-
&Arg {
250-
hash: hash.as_ref(),
251-
rid: rid.into(),
252-
},
253-
)
244+
self.get_with("sync/torrentPeers", &Arg {
245+
hash: hash.as_ref(),
246+
rid: rid.into(),
247+
})
254248
.await
255249
.and_then(|r| r.map_status(TORRENT_NOT_FOUND))?
256250
.json()
@@ -282,7 +276,9 @@ impl Qbit {
282276
}
283277

284278
pub async fn toggle_speed_limits_mode(&self) -> Result<()> {
285-
self.post("transfer/toggleSpeedLimitsMode", None::<&()>).await?.end()
279+
self.post("transfer/toggleSpeedLimitsMode", None::<&()>)
280+
.await?
281+
.end()
286282
}
287283

288284
pub async fn get_download_limit(&self) -> Result<u64> {
@@ -413,13 +409,10 @@ impl Qbit {
413409
indexes: Option<String>,
414410
}
415411

416-
self.get_with(
417-
"torrents/files",
418-
&Arg {
419-
hash: hash.as_ref(),
420-
indexes: indexes.into().map(|s| s.to_string()),
421-
},
422-
)
412+
self.get_with("torrents/files", &Arg {
413+
hash: hash.as_ref(),
414+
indexes: indexes.into().map(|s| s.to_string()),
415+
})
423416
.await
424417
.and_then(|r| r.map_status(TORRENT_NOT_FOUND))?
425418
.json()
@@ -451,14 +444,14 @@ impl Qbit {
451444
.map_err(Into::into)
452445
}
453446

454-
pub async fn pause_torrents(&self, hashes: impl Into<Hashes> + Send + Sync) -> Result<()> {
455-
self.post("torrents/pause", Some(&HashesArg::new(hashes)))
447+
pub async fn stop_torrents(&self, hashes: impl Into<Hashes> + Send + Sync) -> Result<()> {
448+
self.post("torrents/stop", Some(&HashesArg::new(hashes)))
456449
.await?
457450
.end()
458451
}
459452

460-
pub async fn resume_torrents(&self, hashes: impl Into<Hashes> + Send + Sync) -> Result<()> {
461-
self.post("torrents/resume", Some(&HashesArg::new(hashes)))
453+
pub async fn start_torrents(&self, hashes: impl Into<Hashes> + Send + Sync) -> Result<()> {
454+
self.post("torrents/start", Some(&HashesArg::new(hashes)))
462455
.await?
463456
.end()
464457
}

0 commit comments

Comments
 (0)