ipfs_api_prelude/request/
block.rs1use crate::request::ApiRequest;
10use serde::Serialize;
11
12#[derive(Serialize)]
13pub struct BlockGet<'a> {
14 #[serde(rename = "arg")]
15 pub hash: &'a str,
16}
17
18impl<'a> ApiRequest for BlockGet<'a> {
19 const PATH: &'static str = "/block/get";
20}
21
22#[cfg_attr(feature = "with-builder", derive(TypedBuilder))]
23#[derive(Serialize, Default)]
24#[serde(rename_all = "kebab-case")]
25pub struct BlockPut<'a> {
26 #[cfg_attr(feature = "with-builder", builder(default, setter(strip_option)))]
27 pub format: Option<&'a str>,
28 #[cfg_attr(feature = "with-builder", builder(default, setter(strip_option)))]
29 pub mhtype: Option<&'a str>,
30 #[cfg_attr(feature = "with-builder", builder(default, setter(strip_option)))]
31 pub mhlen: Option<u32>,
32 #[cfg_attr(feature = "with-builder", builder(default, setter(strip_option)))]
33 pub pin: Option<bool>,
34}
35
36impl<'a> ApiRequest for BlockPut<'a> {
37 const PATH: &'static str = "/block/put";
38}
39
40#[derive(Serialize)]
41pub struct BlockRm<'a> {
42 #[serde(rename = "arg")]
43 pub hash: &'a str,
44}
45
46impl<'a> ApiRequest for BlockRm<'a> {
47 const PATH: &'static str = "/block/rm";
48}
49
50#[derive(Serialize)]
51pub struct BlockStat<'a> {
52 #[serde(rename = "arg")]
53 pub hash: &'a str,
54}
55
56impl<'a> ApiRequest for BlockStat<'a> {
57 const PATH: &'static str = "/block/stat";
58}