ipfs_api_prelude/request/
pin.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 PinAdd<'a> {
14    #[serde(rename = "arg")]
15    pub key: &'a str,
16
17    pub recursive: Option<bool>,
18    pub progress: bool,
19}
20
21impl<'a> ApiRequest for PinAdd<'a> {
22    const PATH: &'static str = "/pin/add";
23}
24
25#[derive(Serialize)]
26pub struct PinLs<'a> {
27    #[serde(rename = "arg")]
28    pub key: Option<&'a str>,
29
30    #[serde(rename = "type")]
31    pub typ: Option<&'a str>,
32}
33
34impl<'a> ApiRequest for PinLs<'a> {
35    const PATH: &'static str = "/pin/ls";
36}
37
38#[derive(Serialize)]
39pub struct PinRm<'a> {
40    #[serde(rename = "arg")]
41    pub key: &'a str,
42
43    pub recursive: bool,
44}
45
46impl<'a> ApiRequest for PinRm<'a> {
47    const PATH: &'static str = "/pin/rm";
48}