1use std::borrow::Borrow;
2
3use serde::Serialize;
4use serde_with::skip_serializing_none;
5
6use crate::{Qbit, Result, model::*};
7
8impl Qbit {
9 pub async fn get_logs(&self, arg: impl Borrow<GetLogsArg> + Send + Sync) -> Result<Vec<Log>> {
11 self.get_with("log/main", arg.borrow())
12 .await?
13 .json()
14 .await
15 .map_err(Into::into)
16 }
17
18 pub async fn get_peer_logs(
20 &self,
21 last_known_id: impl Into<Option<i64>> + Send + Sync,
22 ) -> Result<Vec<PeerLog>> {
23 #[derive(Serialize)]
24 #[skip_serializing_none]
25 struct Arg {
26 last_known_id: Option<i64>,
27 }
28
29 self.get_with(
30 "log/peers",
31 &Arg {
32 last_known_id: last_known_id.into(),
33 },
34 )
35 .await?
36 .json()
37 .await
38 .map_err(Into::into)
39 }
40}