ipfs_api_prelude/request/
bitswap.rs

1// Copyright 2017 rust-ipfs-api Developers
2//
3// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
4// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
5// http://opensource.org/licenses/MIT>, at your option. This file may not be
6// copied, modified, or distributed except according to those terms.
7//
8
9use crate::request::ApiRequest;
10use serde::Serialize;
11
12#[derive(Serialize)]
13pub struct BitswapLedger<'a> {
14    #[serde(rename = "arg")]
15    pub peer: &'a str,
16}
17
18impl<'a> ApiRequest for BitswapLedger<'a> {
19    const PATH: &'static str = "/bitswap/ledger";
20}
21
22pub struct BitswapReprovide;
23
24impl_skip_serialize!(BitswapReprovide);
25
26impl ApiRequest for BitswapReprovide {
27    const PATH: &'static str = "/bitswap/reprovide";
28}
29
30pub struct BitswapStat;
31
32impl_skip_serialize!(BitswapStat);
33
34impl ApiRequest for BitswapStat {
35    const PATH: &'static str = "/bitswap/stat";
36}
37
38#[derive(Serialize)]
39pub struct BitswapUnwant<'a> {
40    #[serde(rename = "arg")]
41    pub key: &'a str,
42}
43
44impl<'a> ApiRequest for BitswapUnwant<'a> {
45    const PATH: &'static str = "/bitswap/stat";
46}
47
48#[derive(Serialize)]
49pub struct BitswapWantlist<'a> {
50    pub peer: Option<&'a str>,
51}
52
53impl<'a> ApiRequest for BitswapWantlist<'a> {
54    const PATH: &'static str = "/bitswap/wantlist";
55}