diff options
author | Ferris Tseng <ferristseng@fastmail.fm> | 2021-04-04 20:06:34 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-04 20:06:34 -0400 |
commit | 799f702b22a9b567c0b6b7674210583b02b10d55 (patch) | |
tree | 92d7a1c9dcac42599357097c53caccfbdcaa8105 /ipfs-api-prelude | |
parent | 4c78f5759c60499eefd4527ea34d574c2fb35c14 (diff) | |
parent | 168f3a5e68780c37f4070ea9d42ac70bd0158292 (diff) |
Divide backends into separate crates
Diffstat (limited to 'ipfs-api-prelude')
120 files changed, 8350 insertions, 0 deletions
diff --git a/ipfs-api-prelude/Cargo.toml b/ipfs-api-prelude/Cargo.toml new file mode 100644 index 0000000..9cedf4c --- /dev/null +++ b/ipfs-api-prelude/Cargo.toml @@ -0,0 +1,39 @@ +[package] +name = "ipfs-api-prelude" +description = "Shared code for IPFS HTTP API clients" +authors = ["Ferris Tseng <ferristseng@fastmail.fm>"] +edition = "2018" +documentation = "https://docs.rs/ipfs-api" +repository = "https://github.com/ferristseng/rust-ipfs-api" +keywords = ["ipfs"] +categories = ["filesystem", "web-programming"] +version = "0.1.0" +readme = "../README.md" +license = "MIT OR Apache-2.0" + +[features] +with-builder = ["typed-builder"] + +[dependencies] +async-trait = "0.1" +bytes = "1.0" +common-multipart-rfc7578 = "0.3" +dirs = "3.0" +futures = "0.3" +http = "0.2" +parity-multiaddr = "0.11" +serde = { version = "1.0", features = ["derive"] } +serde_json = "1.0" +serde_urlencoded = "0.7" +thiserror = "1.0" +tokio = "1" +tokio-util = { version = "0.6", features = ["codec"] } +tracing = "0.1" +typed-builder = { version = "0.9", optional = true } +walkdir = "2.3" + +[dev-dependencies] +ipfs-api = { package = "ipfs-api-backend-hyper", version = "0.1", path = "../ipfs-api-backend-hyper" } +tokio = { version = "1", features = ["rt-multi-thread", "macros", "time"] } +tokio-stream = { version = "0.1", features = ["time"] } +tracing-subscriber = { version = "0.2", features = ["fmt"] } diff --git a/ipfs-api-prelude/src/api.rs b/ipfs-api-prelude/src/api.rs new file mode 100644 index 0000000..48ed893 --- /dev/null +++ b/ipfs-api-prelude/src/api.rs @@ -0,0 +1,2098 @@ +// Copyright 2021 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::{read::LineDecoder, request, response, Backend}; +use async_trait::async_trait; +use bytes::Bytes; +use common_multipart_rfc7578::client::multipart; +use futures::{future, FutureExt, Stream, TryStreamExt}; +use std::{ + fs::File, + io::{Cursor, Read}, + path::{Path, PathBuf}, |