diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2021-11-26 22:14:00 +0100 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2021-11-26 22:14:00 +0100 |
commit | 88515ac848d105c8c84efb2faea31b530a0554ee (patch) | |
tree | c08204129c6b7312a99edb37d9952de1951bbdf4 /src/client.rs | |
parent | 1158487c6f14e3486ba3866fb8d1fc9052720d19 (diff) |
Add first stubs with tests for TDD this stuff
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Diffstat (limited to 'src/client.rs')
-rw-r--r-- | src/client.rs | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/client.rs b/src/client.rs new file mode 100644 index 0000000..39f3598 --- /dev/null +++ b/src/client.rs @@ -0,0 +1,36 @@ +use anyhow::Result; +use cid::Cid; + +use crate::config::Config; +use crate::ipfs_client::IpfsClient; + +pub struct Client { + ipfs: IpfsClient, + config: Config, +} + +impl std::fmt::Debug for Client { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + write!(f, "Client {{ config: {:?} }}", self.config) + } +} + +impl Client { + pub fn new(ipfs: IpfsClient, config: Config) -> Self { + Client { + ipfs, + config + } + } + fn post_text_blob_impl(&self, text: String) -> Result<Cid> { + unimplemented!() + } +} + +#[cfg(test)] +impl Client { + pub fn post_text_blob(&self, text: String) -> Result<Cid> { + self.post_text_blob_impl(text) + } +} + |