izihawa_ipfs_api_prelude/response/
mod.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
9//! This module contains structures returned by the IPFS API.
10
11use crate::serde::Deserialize;
12
13pub use self::add::*;
14pub use self::bitswap::*;
15pub use self::block::*;
16pub use self::bootstrap::*;
17pub use self::commands::*;
18pub use self::config::*;
19pub use self::dag::*;
20pub use self::dht::*;
21pub use self::diag::*;
22pub use self::dns::*;
23pub use self::error::*;
24pub use self::file::*;
25pub use self::files::*;
26pub use self::filestore::*;
27pub use self::id::*;
28pub use self::key::*;
29pub use self::log::*;
30pub use self::ls::*;
31pub use self::mount::*;
32pub use self::name::*;
33pub use self::object::*;
34pub use self::pin::*;
35pub use self::ping::*;
36pub use self::pubsub::*;
37pub use self::refs::*;
38pub use self::repo::*;
39pub use self::resolve::*;
40pub use self::shutdown::*;
41pub use self::stats::*;
42pub use self::swarm::*;
43pub use self::tar::*;
44pub use self::version::*;
45
46/// Create a test to deserialize a file to the given instance.
47///
48#[cfg(test)]
49macro_rules! deserialize_test {
50    ($f: ident, $ty: ident) => {
51        #[test]
52        fn $f() {
53            let raw = include_str!(concat!("tests/", stringify!($f), ".json"));
54
55            match ::serde_json::from_str::<super::$ty>(raw) {
56                Ok(_) => assert!(true),
57                Err(e) => assert!(false, "failed with error: {}", e),
58            };
59        }
60    };
61}
62
63mod add;
64mod bitswap;
65mod block;
66mod bootstrap;
67mod commands;
68mod config;
69mod dag;
70mod dht;
71mod diag;
72mod dns;
73mod error;
74mod file;
75mod files;
76mod filestore;
77mod id;
78mod key;
79mod log;
80mod ls;
81mod mount;
82mod name;
83mod object;
84mod pin;
85mod ping;
86mod pubsub;
87mod refs;
88mod repo;
89mod resolve;
90mod serde;
91mod shutdown;
92mod stats;
93mod swarm;
94mod tar;
95mod version;
96
97#[derive(Debug, Deserialize)]
98#[serde(rename_all = "PascalCase")]
99pub struct IpfsHeader {
100    pub name: String,
101    pub hash: String,
102    pub size: u64,
103
104    #[serde(rename = "Type")]
105    pub typ: Option<String>,
106}