summaryrefslogtreecommitdiffstats
path: root/ipfs-api-prelude/src/request
diff options
context:
space:
mode:
Diffstat (limited to 'ipfs-api-prelude/src/request')
-rw-r--r--ipfs-api-prelude/src/request/add.rs61
-rw-r--r--ipfs-api-prelude/src/request/bitswap.rs55
-rw-r--r--ipfs-api-prelude/src/request/block.rs48
-rw-r--r--ipfs-api-prelude/src/request/bootstrap.rs33
-rw-r--r--ipfs-api-prelude/src/request/cat.rs20
-rw-r--r--ipfs-api-prelude/src/request/commands.rs17
-rw-r--r--ipfs-api-prelude/src/request/config.rs53
-rw-r--r--ipfs-api-prelude/src/request/dag.rs28
-rw-r--r--ipfs-api-prelude/src/request/dht.rs73
-rw-r--r--ipfs-api-prelude/src/request/diag.rs36
-rw-r--r--ipfs-api-prelude/src/request/dns.rs22
-rw-r--r--ipfs-api-prelude/src/request/file.rs20
-rw-r--r--ipfs-api-prelude/src/request/files.rs201
-rw-r--r--ipfs-api-prelude/src/request/filestore.rs38
-rw-r--r--ipfs-api-prelude/src/request/get.rs20
-rw-r--r--ipfs-api-prelude/src/request/id.rs20
-rw-r--r--ipfs-api-prelude/src/request/key.rs78
-rw-r--r--ipfs-api-prelude/src/request/log.rs85
-rw-r--r--ipfs-api-prelude/src/request/ls.rs55
-rw-r--r--ipfs-api-prelude/src/request/mod.rs130
-rw-r--r--ipfs-api-prelude/src/request/name.rs42
-rw-r--r--ipfs-api-prelude/src/request/object.rs105
-rw-r--r--ipfs-api-prelude/src/request/pin.rs48
-rw-r--r--ipfs-api-prelude/src/request/ping.rs22
-rw-r--r--ipfs-api-prelude/src/request/pubsub.rs53
-rw-r--r--ipfs-api-prelude/src/request/refs.rs17
-rw-r--r--ipfs-api-prelude/src/request/shutdown.rs17
-rw-r--r--ipfs-api-prelude/src/request/stats.rs33
-rw-r--r--ipfs-api-prelude/src/request/swarm.rs25
-rw-r--r--ipfs-api-prelude/src/request/tar.rs28
-rw-r--r--ipfs-api-prelude/src/request/version.rs17
31 files changed, 1500 insertions, 0 deletions
diff --git a/ipfs-api-prelude/src/request/add.rs b/ipfs-api-prelude/src/request/add.rs
new file mode 100644
index 0000000..889c617
--- /dev/null
+++ b/ipfs-api-prelude/src/request/add.rs
@@ -0,0 +1,61 @@
+// Copyright 2017 rust-ipfs-api Developers
+//
+// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
+// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
+// http://opensource.org/licenses/MIT>, at your option. This file may not be
+// copied, modified, or distributed except according to those terms.
+//
+
+use crate::request::ApiRequest;
+use serde::Serialize;
+
+#[cfg_attr(feature = "with-builder", derive(TypedBuilder))]
+#[derive(Serialize, Default)]
+#[serde(rename_all = "kebab-case")]
+pub struct Add<'a> {
+ /// Use trickle-dag format for dag generation.
+ #[cfg_attr(feature = "with-builder", builder(default, setter(strip_option)))]
+ pub trickle: Option<bool>,
+
+ /// Only chunk and hash - do not write to disk.
+ #[cfg_attr(feature = "with-builder", builder(default, setter(strip_option)))]
+ pub only_hash: Option<bool>,
+
+ /// Wrap files with a directory object.
+ #[cfg_attr(feature = "with-builder", builder(default, setter(strip_option)))]
+ pub wrap_with_directory: Option<bool>,
+
+ /// Chunking algorithm, `size-[bytes]`, `rabin-[min]-[avg]-[max]` or `buzhash`.
+ #[cfg_attr(feature = "with-builder", builder(default, setter(strip_option)))]
+ pub chunker: Option<&'a str>,
+
+ /// Pin this object when adding. Defaults to `true`.
+ #[cfg_attr(feature = "with-builder", builder(default, setter(strip_option)))]
+ pub pin: Option<bool>,
+
+ /// Use raw blocks for leaf nodes. (experimental).
+ #[cfg_attr(feature = "with-builder", builder(default, setter(strip_option)))]
+ pub raw_leaves: Option<bool>,
+
+ /// CID version. Defaults to 0 unless an option that depends on CIDv1 is passed.
+ /// (experimental).
+ #[cfg_attr(feature = "with-builder", builder(default, setter(strip_option)))]
+ pub cid_version: Option<u32>,
+
+ /// Hash function to use. Implies CIDv1 if not sha2-256. (experimental). Default:
+ /// `sha2-256`.
+ #[cfg_attr(feature = "with-builder", builder(default, setter(strip_option)))]
+ pub hash: Option<&'a str>,
+
+ /// Inline small blocks into CIDs. (experimental).
+ #[cfg_attr(feature = "with-builder", builder(default, setter(strip_option)))]
+ pub inline: Option<bool>,
+
+ /// Maximum block size to inline. (experimental). Default: `32`.
+ #[cfg_attr(feature = "with-builder", builder(default, setter(strip_option)))]
+ pub inline_limit: Option<u32>,
+}
+
+impl<'a> ApiRequest for Add<'a> {
+ const PATH: &'static str = "/add";
+}
diff --git a/ipfs-api-prelude/src/request/bitswap.rs b/ipfs-api-prelude/src/request/bitswap.rs
new file mode 100644
index 0000000..c23ac1e
--- /dev/null
+++ b/ipfs-api-prelude/src/request/bitswap.rs
@@ -0,0 +1,55 @@
+// Copyright 2017 rust-ipfs-api Developers
+//
+// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
+// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
+// http://opensource.org/licenses/MIT>, at your option. This file may not be
+// copied, modified, or distributed except according to those terms.
+//
+
+use crate::request::ApiRequest;
+use serde::Serialize;
+
+#[derive(Serialize)]
+pub struct BitswapLedger<'a> {
+ #[serde(rename = "arg")]
+ pub peer: &'a str,
+}
+
+impl<'a> ApiRequest for BitswapLedger<'a> {
+ const PATH: &'static str = "/bitswap/ledger";
+}
+
+pub struct BitswapReprovide;
+
+impl_skip_serialize!(BitswapReprovide);
+
+impl ApiRequest for BitswapReprovide {
+ const PATH: &'static str = "/bitswap/reprovide";
+}
+
+pub struct BitswapStat;
+
+impl_skip_serialize!(BitswapStat);
+
+impl ApiRequest for BitswapStat {
+ const PATH: &'static str = "/bitswap/stat";
+}
+
+#[derive(Serialize)]
+pub struct BitswapUnwant<'a> {
+ #[serde(rename = "arg")]
+ pub key: &'a str,
+}
+
+impl<'a> ApiRequest for BitswapUnwant<'a> {
+ const PATH: &'static str = "/bitswap/stat";
+}
+
+#[derive(Serialize)]
+pub struct BitswapWantlist<'a> {
+ pub peer: Option<&'a str>,
+}
+
+impl<'a> ApiRequest for BitswapWantlist<'a> {
+ const PATH: &'static str = "/bitswap/wantlist";
+}
diff --git a/ipfs-api-prelude/src/request/block.rs b/ipfs-api-prelude/src/request/block.rs
new file mode 100644
index 0000000..d3094e5
--- /dev/null
+++ b/ipfs-api-prelude/src/request/block.rs
@@ -0,0 +1,48 @@
+// Copyright 2017 rust-ipfs-api Developers
+//
+// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
+// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
+// http://opensource.org/licenses/MIT>, at your option. This file may not be
+// copied, modified, or distributed except according to those terms.
+//
+
+use crate::request::ApiRequest;
+use serde::Serialize;
+
+#[derive(Serialize)]
+pub struct BlockGet<'a> {
+ #[serde(rename = "arg")]
+ pub hash: &'a str,
+}
+
+impl<'a> ApiRequest for BlockGet<'a> {
+ const PATH: &'static str = "/block/get";
+}
+
+pub struct BlockPut;
+
+impl_skip_serialize!(BlockPut);
+
+impl ApiRequest for BlockPut {
+ const PATH: &'static str = "/block/put";
+}
+
+#[derive(Serialize)]
+pub struct BlockRm<'a> {
+ #[serde(rename = "arg")]
+ pub hash: &'a str,
+}
+
+impl<'a> ApiRequest for BlockRm<'a> {
+ const PATH: &'static str = "/block/rm";
+}
+
+#[derive(Serialize)]
+pub struct BlockStat<'a> {
+ #[serde(rename = "arg")]
+ pub hash: &'a str,
+}
+
+impl<'a> ApiRequest for BlockStat<'a> {
+ const PATH: &'static str = "/block/stat";
+}
diff --git a/ipfs-api-prelude/src/request/bootstrap.rs b/ipfs-api-prelude/src/request/bootstrap.rs
new file mode 100644
index 0000000..9e321e5
--- /dev/null
+++ b/ipfs-api-prelude/src/request/bootstrap.rs
@@ -0,0 +1,33 @@
+// Copyright 2017 rust-ipfs-api Developers
+//
+// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
+// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
+// http://opensource.org/licenses/MIT>, at your option. This file may not be
+// copied, modified, or distributed except according to those terms.
+//
+
+use crate::request::ApiRequest;
+
+pub struct BootstrapAddDefault;
+
+impl_skip_serialize!(BootstrapAddDefault);
+
+impl ApiRequest for BootstrapAddDefault {
+ const PATH: &'static str = "/bootstrap/add/default";
+}
+
+pub struct BootstrapList;
+
+impl_skip_serialize!(BootstrapList);
+
+impl ApiRequest for BootstrapList {
+ const PATH: &'static str = "/bootstrap/list";
+}
+
+pub struct BootstrapRmAll;
+
+impl_skip_serialize!(BootstrapRmAll);
+
+impl ApiRequest for BootstrapRmAll {
+ const PATH: &'static str = "/bootstrap/rm/all";
+}
diff --git a/ipfs-api-prelude/src/request/cat.rs b/ipfs-api-prelude/src/request/cat.rs
new file mode 100644
index 0000000..25c5dc4
--- /dev/null
+++ b/ipfs-api-prelude/src/request/cat.rs
@@ -0,0 +1,20 @@
+// Copyright 2017 rust-ipfs-api Developers
+//
+// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
+// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
+// http://opensource.org/licenses/MIT>, at your option. This file may not be
+// copied, modified, or distributed except according to those terms.
+//
+
+use crate::request::ApiRequest;
+use serde::Serialize;
+
+#[derive(Serialize)]
+pub struct Cat<'a> {
+ #[serde(rename = "arg")]
+ pub path: &'a str,
+}
+
+impl<'a> ApiRequest for Cat<'a> {
+ const PATH: &'static str = "/cat";
+}
diff --git a/ipfs-api-prelude/src/request/commands.rs b/ipfs-api-prelude/src/request/commands.rs
new file mode 100644
index 0000000..108c45e
--- /dev/null
+++ b/ipfs-api-prelude/src/request/commands.rs
@@ -0,0 +1,17 @@
+// Copyright 2017 rust-ipfs-api Developers
+//
+// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
+// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
+// http://opensource.org/licenses/MIT>, at your option. This file may not be
+// copied, modified, or distributed except according to those terms.
+//
+
+use crate::request::ApiRequest;
+
+pub struct Commands;
+
+impl_skip_serialize!(Commands);
+
+impl ApiRequest for Commands {
+ const PATH: &'static str = "/commands";
+}
diff --git a/ipfs-api-prelude/src/request/config.rs b/ipfs-api-prelude/src/request/config.rs
new file mode 100644
index 0000000..b89f6f9
--- /dev/null
+++ b/ipfs-api-prelude/src/request/config.rs
@@ -0,0 +1,53 @@
+// Copyright 2017 rust-ipfs-api Developers
+//
+// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
+// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
+// http://opensource.org/licenses/MIT>, at your option. This file may not be
+// copied, modified, or distributed except according to those terms.
+//
+
+use crate::request::ApiRequest;
+use serde::Serialize;
+
+#[derive(Serialize)]
+pub struct Config<'a> {
+ #[serde(rename = "arg")]
+ pub key: &'a str,
+
+ #[serde(rename = "arg")]
+ pub value: Option<&'a str>,
+
+ #[serde(rename = "bool")]
+ pub boolean: Option<bool>,
+
+ #[serde(rename = "json")]
+ pub stringified_json: Option<bool>,
+}
+
+impl<'a> ApiRequest for Config<'a> {
+ const PATH: &'static str = "/config";
+}
+
+pub struct ConfigEdit;
+
+impl_skip_serialize!(ConfigEdit);
+
+impl ApiRequest for ConfigEdit {
+ const PATH: &'static str = "/config/edit";
+}
+
+pub struct ConfigReplace;
+
+impl_skip_serialize!(ConfigReplace);
+
+impl ApiRequest for ConfigReplace {
+ const PATH: &'static str = "/config/replace";
+}
+
+pub struct ConfigShow;
+
+impl_skip_serialize!(ConfigShow);
+
+impl ApiRequest for ConfigShow {
+ const PATH: &'static str = "/config/show";
+}
diff --git a/ipfs-api-prelude/src/request/dag.rs b/ipfs-api-prelude/src/request/dag.rs
new file mode 100644
index 0000000..2a9a64c
--- /dev/null
+++ b/ipfs-api-prelude/src/request/dag.rs
@@ -0,0 +1,28 @@
+// Copyright 2017 rust-ipfs-api Developers
+//
+// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
+// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
+// http://opensource.org/licenses/MIT>, at your option. This file may not be
+// copied, modified, or distributed except according to those terms.
+//
+
+use crate::request::ApiRequest;
+use serde::Serialize;
+
+#[derive(Serialize)]
+pub struct DagGet<'a> {
+ #[serde(rename = "arg")]
+ pub path: &'a str,
+}
+
+impl<'a> ApiRequest for DagGet<'a> {
+ const PATH: &'static str = "/dag/get";
+}
+
+pub struct DagPut;
+
+impl_skip_serialize!(DagPut);
+
+impl ApiRequest for DagPut {
+ const PATH: &'static str = "/dag/put";
+}
diff --git a/ipfs-api-prelude/src/request/dht.rs b/ipfs-api-prelude/src/request/dht.rs
new file mode 100644
index 0000000..a208565
--- /dev/null
+++ b/ipfs-api-prelude/src/request/dht.rs
@@ -0,0 +1,73 @@
+// Copyright 2017 rust-ipfs-api Developers
+//
+// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
+// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
+// http://opensource.org/licenses/MIT>, at your option. This file may not be
+// copied, modified, or distributed except according to those terms.
+//
+
+use crate::request::ApiRequest;
+use serde::Serialize;
+
+#[derive(Serialize)]
+pub struct DhtFindPeer<'a> {
+ #[serde(rename = "arg")]
+ pub peer: &'a str,
+}
+
+impl<'a> ApiRequest for DhtFindPeer<'a> {
+ const PATH: &'static str = "/dht/findpeer";
+}
+
+#[derive(Serialize)]
+pub struct DhtFindProvs<'a> {
+ #[serde(rename = "arg")]
+ pub key: &'a str,
+}
+
+impl<'a> ApiRequest for DhtFindProvs<'a> {
+ const PATH: &'static str = "/dht/findprovs";
+}
+
+#[derive(Serialize)]
+pub struct DhtGet<'a> {
+ #[serde(rename = "arg")]
+ pub key: &'a str,
+}
+
+impl<'a> ApiRequest for DhtGet<'a> {
+ const PATH: &'static str = "/dht/get";
+}
+
+#[derive(Serialize)]
+pub struct DhtProvide<'a> {
+ #[serde(rename = "arg")]
+ pub key: &'a str,
+}
+
+impl<'a> ApiRequest for DhtProvide<'a> {
+ const PATH: &'static str = "/dht/provide";
+}
+
+#[derive(Serialize)]
+pub struct DhtPut<'a> {
+ #[serde(rename = "arg")]
+ pub key: &'a str,
+
+ #[serde(rename = "arg")]
+ pub value: &'a str,
+}
+
+impl<'a> ApiRequest for DhtPut<'a> {
+ const PATH: &'static str = "/dht/put";
+}
+
+#[derive(Serialize)]
+pub struct DhtQuery<'a> {
+ #[serde(rename = "arg")]
+ pub peer: &'a str,
+}
+
+impl<'a> ApiRequest for DhtQuery<'a> {
+ const PATH: &'static str = "/dht/query";
+}
diff --git a/ipfs-api-prelude/src/request/diag.rs b/ipfs-api-prelude/src/request/diag.rs
new file mode 100644
index 0000000..9ca6abc
--- /dev/null
+++ b/ipfs-api-prelude/src/request/diag.rs
@@ -0,0 +1,36 @@
+// Copyright 2017 rust-ipfs-api Developers
+//
+// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
+// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
+// http://opensource.org/licenses/MIT>, at your option. This file may not be
+// copied, modified, or distributed except according to those terms.
+//
+
+use crate::request::ApiRequest;
+use serde::Serialize;
+
+pub struct DiagCmdsClear;
+
+impl_skip_serialize!(DiagCmdsClear);
+
+impl ApiRequest for DiagCmdsClear {
+ const PATH: &'static str = "/diag/cmds/clear";
+}
+
+#[derive(Serialize)]
+pub struct DiagCmdsSetTime<'a> {
+ #[serde(rename = "arg")]
+ pub time: &'a str,
+}
+
+impl<'a> ApiRequest for DiagCmdsSetTime<'a> {
+ const PATH: &'static str = "/diag/cmds/set-time";
+}
+
+pub struct DiagSys;
+
+impl_skip_serialize!(DiagSys);
+
+impl ApiRequest for DiagSys {
+ const PATH: &'static str = "/diag/sys";
+}
diff --git a/ipfs-api-prelude/src/request/dns.rs b/ipfs-api-prelude/src/request/dns.rs
new file mode 100644
index 0000000..dc0cfaa
--- /dev/null
+++ b/ipfs-api-prelude/src/request/dns.rs
@@ -0,0 +1,22 @@
+// Copyright 2017 rust-ipfs-api Developers
+//
+// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
+// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
+// http://opensource.org/licenses/MIT>, at your option. This file may not be
+// copied, modified, or distributed except according to those terms.
+//
+
+use crate::request::ApiRequest;
+use serde::Serialize;
+
+#[derive(Serialize)]
+pub struct Dns<'a> {
+ #[serde(rename = "arg")]
+ pub link: &'a str,
+
+ pub recursive: bool,
+}
+
+impl<'a> ApiRequest for Dns<'a> {
+ const PATH: &'static str = "/dns";
+}
diff --git a/ipfs-api-prelude/src/request/file.rs b/ipfs-api-prelude/src/request/file.rs
new file mode 100644
index 0000000..2eab5de
--- /dev/null
+++ b/ipfs-api-prelude/src/request/file.rs
@@ -0,0 +1,20 @@
+// Copyright 2017 rust-ipfs-api Developers
+//
+// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
+// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
+// http://opensource.org/licenses/MIT>, at your option. This file may not be
+// copied, modified, or distributed except according to those terms.
+//
+
+use crate::request::ApiRequest;
+use serde::Serialize;
+
+#[derive(Serialize)]
+pub struct FileLs<'a> {
+ #[serde(rename = "arg")]
+ pub path: &'a str,
+}
+
+impl<'a> ApiRequest for FileLs<'a> {
+ const PATH: &'static str = "/file/ls";
+}
diff --git a/ipfs-api-prelude/src/request/files.rs b/ipfs-api-prelude/src/request/files.rs
new file mode 100644
index 0000000..a5b93cb
--- /dev/null
+++ b/ipfs-api-prelude/src/request/files.rs
@@ -0,0 +1,201 @@
+// Copyright 2017 rust-ipfs-api Developers
+//
+// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
+// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
+// http://opensource.org/licenses/MIT>, at your option. This file may not be
+// copied, modified, or distributed except according to those terms.
+//
+
+use crate::request::ApiRequest;
+use serde::Serialize;
+
+#[derive(Serialize, Default)]
+pub struct FilesCp<'a> {
+ #[serde(rename = "arg")]
+ pub path: &'a str,
+
+ #[serde(rename = "arg")]
+ pub dest: &'a str,
+
+ pub flush: Option<bool>,
+}
+
+impl<'a> ApiRequest for FilesCp<'a> {
+ const PATH: &'static str = "/files/cp";
+}
+
+#[derive(Serialize)]
+pub struct FilesFlush<'a> {
+ #[serde(rename = "arg")]
+ pub path: Option<&'a str>,
+}
+
+impl<'a> ApiRequest for FilesFlush<'a> {
+ const PATH: &'static str = "/files/flush";
+}
+
+#[cfg_attr(feature = "with-builder", derive(TypedBuilder))]
+#[derive(Serialize, Default)]
+pub struct FilesLs<'a> {
+ #[serde(rename = "arg")]
+ #[cfg_attr(feature = "with-builder", builder(default, setter(strip_option)))]
+ pub path: Option<&'a str>,
+
+ #[cfg_attr(feature = "with-builder", builder(default, setter(strip_option)))]
+ pub long: Option<bool>,
+
+ #[cfg_attr(feature = "with-builder", builder(default, setter(strip_option)))]
+ #[serde(rename = "U")]
+ pub unsorted: Option<bool>,
+}
+
+impl<'a> ApiRequest for FilesLs<'a> {
+ const PATH: &'static str = "/files/ls";
+}
+
+#[cfg_attr(feature = "with-builder", derive(TypedBuilder))]
+#[derive(Serialize, Default)]
+#[serde(rename_all = "kebab-case")]
+pub struct FilesMkdir<'a> {
+ #[serde(rename = "arg")]
+ pub path: &'a str,
+
+ #[cfg_attr(feature = "with-builder", builder(default, setter(strip_option)))]
+ pub parents: Option<bool>,
+
+ #[cfg_attr(feature = "with-builder", builder(default, setter(strip_option)))]
+ pub hash: Option<&'a str>,
+
+ #[cfg_attr(feature = "with-builder", builder(default, setter(strip_option)))]
+ pub cid_version: Option<i32>,
+
+ #[cfg_attr(feature = "with-builder", builder(default, setter(strip_option)))]
+ pub flush: Option<bool>,
+}
+
+impl<'a> ApiRequest for FilesMkdir<'a> {
+ const PATH: &'static str = "/files/mkdir";
+}
+
+#[derive(Serialize, Default)]
+pub struct FilesMv<'a> {
+ #[serde(rename = "arg")]
+ pub path: &'a str,
+
+ #[serde(rename = "arg")]
+ pub dest: &'a str,
+
+ pub flush: Option<bool>,
+}
+
+impl<'a> ApiRequest for FilesMv<'a> {
+ const PATH: &'static str = "/files/mv";
+}
+
+#[cfg_attr(feature = "with-builder", derive(TypedBuilder))]
+#[derive(Serialize, Default)]
+pub struct FilesRead<'a> {
+ #[serde(rename = "arg")]
+ pub path: &'a str,
+
+ #[cfg_attr(feature = "with-builder", builder(default, setter(strip_option)))]
+ pub offset: Option<i64>,
+
+ #[cfg_attr(feature = "with-builder", builder(default, setter(strip_option)))]
+ pub count: Option<i64>,
+}
+
+impl<'a> ApiRequest for FilesRead<'a> {
+ const PATH: &'static str = "/files/read";
+}
+
+#[cfg_attr(feature = "with-builder", derive(TypedBuilder))]
+#[derive(Serialize, Default)]
+pub struct FilesRm<'a> {
+ #[serde(rename = "arg")]
+ pub path: &'a str,
+
+ #[cfg_attr(feature = "with-builder", builder(default, setter(strip_option)))]
+ pub recursive: Option<bool>,
+
+ #[cfg_attr(feature = "with-builder", builder(default, setter(strip_option)))]
+ pub flush: Option<bool>,
+}
+
+impl<'a> ApiRequest for FilesRm<'a> {
+ const PATH: &'static str = "/files/rm";
+}
+
+#[derive(Serialize, Default)]
+#[serde(rename_all = "kebab-case")]
+pub struct FilesStat<'a> {
+ #[serde(rename = "arg")]
+ pub path: &'a str,
+
+ pub with_local: Option<bool>,
+}
+
+impl<'a> ApiRequest for FilesStat<'a> {
+ const PATH: &'static str = "/files/stat";
+}
+
+#[cfg_attr(feature = "with-builder", derive(TypedBuilder))]
+#[derive(Serialize, Default)]
+#[serde(rename_all = "kebab-case")]
+pub struct FilesWrite<'a> {
+ #[serde(rename = "arg")]
+ pub path: &'a str,
+
+ #[cfg_attr(feature = "with-builder", builder(default, setter(strip_option)))]
+ pub create: Option<bool>,
+
+ #[cfg_attr(feature = "with-builder", builder(default, setter(strip_option)))]
+ pub truncate: Option<bool>,
+
+ #[cfg_attr(feature = "with-builder", builder(default, setter(strip_option)))]
+ pub parents: Option<bool>,
+
+ #[cfg_attr(feature = "with-builder", builder(default, setter(strip_option)))]
+ pub offset: Option<i64>,
+
+ #[cfg_attr(feature = "with-builder", builder(default, setter(strip_option)))]
+ pub count: Option<i64>,
+
+ #[cfg_attr(feature = "with-builder", builder(default, setter(strip_option)))]
+ pub raw_leaves: Option<bool>,
+
+ #[cfg_attr(feature = "with-builder", builder(default, setter(strip_option)))]
+ pub hash: Option<&'a str>,
+
+ #[cfg_attr(feature = "with-builder", builder(default, setter(strip_option)))]
+ pub cid_version: Option<i32>,
+
+ #[cfg_attr(feature = "with-builder", builder(default, setter(strip_option)))]
+ pub flush: Option<bool>,
+}
+
+impl<'a> ApiRequest for FilesWrite<'a> {
+ const PATH: &'static str = "/files/write";
+}
+
+#[cfg_attr(feature = "with-builder", derive(TypedBuilder))]
+#[derive(Serialize, Default)]
+#[serde(rename_all = "kebab-case")]
+pub struct FilesChcid<'a> {
+ #[cfg_attr(feature = "with-builder", builder(default, setter(strip_option)))]
+ #[serde(rename = "arg")]
+ pub path: Option<&'a str>,
+
+ #[cfg_attr(feature = "with-builder", builder(default, setter(strip_option)))]
+ pub hash: Option<&'a str>,
+
+ #[cfg_attr(feature = "with-builder", builder(default, setter(strip_option)))]
+ pub cid_version: Option<i32>,
+
+ #[cfg_attr(feature = "with-builder", builder(default, setter(strip_option)))]
+ pub flush: Option<bool>,
+}
+
+impl<'a> ApiRequest for FilesChcid<'a> {
+ const PATH: &'static str = "/files/chcid";
+}
diff --git a/ipfs-api-prelude/src/request/filestore.rs b/ipfs-api-prelude/src/request/filestore.rs
new file mode 100644
index 0000000..1046e79
--- /dev/null
+++ b/ipfs-api-prelude/src/request/filestore.rs
@@ -0,0 +1,38 @@
+// Copyright 2017 rust-ipfs-api Developers
+//
+// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
+// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
+// http://opensource.org/licenses/MIT>, at your option. This file may not be
+// copied, modified, or distributed except according to those terms.
+//
+
+use crate::request::ApiRequest;
+use serde::Serialize;
+
+pub struct FilestoreDups;
+
+impl_skip_serialize!(FilestoreDups);
+
+impl ApiRequest for FilestoreDups {
+ const PATH: &'static str = "/filestore/dups";
+}
+
+#[derive(Serialize)]
+pub struct FilestoreLs<'a> {
+ #[serde(rename = "arg")]
+ pub cid: Option<&'a str>,
+}
+
+impl<'a> ApiRequest for FilestoreLs<'a> {
+ const PATH: &'static str = "/filestore/ls";
+}
+
+#[derive(Serialize)]
+pub struct FilestoreVerify<'a> {
+ #[serde(rename = "arg")]
+ pub cid: Option<&'a str>,
+}
+
+impl<'a> ApiRequest for FilestoreVerify<'a> {
+ const PATH: &'static str = "/filestore/verify";
+}
diff --git a/ipfs-api-prelude/src/request/get.rs b/ipfs-api-prelude/src/request/get.rs
new file mode 100644
index 0000000..a8b755a
--- /dev/null
+++ b/ipfs-api-prelude/src/request/get.rs
@@ -0,0 +1,20 @@
+// Copyright 2017 rust-ipfs-api Developers
+//
+// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
+// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
+// http://opensource.org/licenses/MIT>, at your option. This file may not be
+// copied, modified, or distributed except according to those terms.
+//
+
+use crate::request::ApiRequest;
+use serde::Serialize;
+
+#[derive(Serialize)]
+pub struct Get<'a> {
+ #[serde(rename = "arg")]
+ pub path: &'a str,
+}
+
+impl<'a> ApiRequest for Get<'a> {
+ const PATH: &'static str = "/get";
+}
diff --git a/ipfs-api-prelude/src/request/id.rs b/ipfs-api-prelude/src/request/id.rs
new file mode 100644
index 0000000..5187e97
--- /dev/null
+++ b/ipfs-api-prelude/src/request/id.rs
@@ -0,0 +1,20 @@
+// Copyright 2017 rust-ipfs-api Developers
+//
+// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
+// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
+// http://opensource.org/licenses/MIT>, at your option. This file may not be
+// copied, modified, or distributed except according to those terms.
+//
+
+use crate::request::ApiRequest;
+use serde::Serialize;
+
+#[derive(Serialize)]
+pub struct Id<'a> {
+ #[serde(rename = "arg")]
+ pub peer: Option<&'a str>,
+}
+
+impl<'a> ApiRequest for Id<'a> {
+ const PATH: &'static str = "/id";
+}
diff --git a/ipfs-api-prelude/src/request/key.rs b/ipfs-api-prelude/src/request/key.rs
new file mode 100644
index 0000000..47c4ec1
--- /dev/null
+++ b/ipfs-api-prelude/src/request/key.rs
@@ -0,0 +1,78 @@
+// Copyright 2017 rust-ipfs-api Developers
+//
+// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
+// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
+// http://opensource.org/licenses/MIT>, at your option. This file may not be
+// copied, modified, or distributed except according to those terms.
+//
+
+use crate::request::ApiRequest;
+use serde::{Serialize, Serializer};
+
+#[derive(Copy, Clone)]
+pub enum KeyType {
+ Rsa,
+ Ed25519,
+}
+
+impl Serialize for KeyType {
+ fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
+ where
+ S: Serializer,
+ {
+ let s = match self {
+ KeyType::Rsa => "rsa",
+ KeyType::Ed25519 => "ed25519",
+ };
+
+ serializer.serialize_str(s)
+ }
+}
+
+#[derive(Serialize)]
+pub struct KeyGen<'a> {
+ #[serde(rename = "arg")]
+ pub name: &'a str,
+
+ #[serde(rename = "type")]
+ pub kind: KeyType,
+
+ pub size: i32,
+}
+
+impl<'a> ApiRequest for KeyGen<'a> {
+ const PATH: &'static str = "/key/gen";
+}
+
+pub struct KeyList;
+
+impl_skip_serialize!(KeyList);
+
+impl ApiRequest for KeyList {
+ const PATH: &'static str = "/key/list";
+}
+
+#[derive(Serialize)]
+pub struct KeyRename<'a, 'b> {
+ #[serde(rename = "arg")]
+ pub name: &'a str,
+
+ #[serde(rename = "arg")]
+ pub new: &'b str,
+
+ pub force: bool,
+}
+
+impl<'a, 'b> ApiRequest for KeyRename<'a, 'b> {
+ const PATH: &'static str = "/key/rename";
+}
+
+#[derive(Serialize)]
+pub struct KeyRm<'a> {
+ #[serde(rename = "arg")]
+ pub name: &'a str,