[][src]Struct ipfs_api::IpfsClient

pub struct IpfsClient { /* fields omitted */ }

Asynchronous Ipfs client.

Methods

impl IpfsClient[src]

pub fn new(host: &str, port: u16) -> Result<IpfsClient, InvalidUri>[src]

Creates a new IpfsClient.

pub fn new_from_uri(uri: &str) -> Result<IpfsClient, InvalidUri>[src]

Creates a new IpfsClient for any given URI.

impl IpfsClient[src]

pub async fn add<'_, R>(&'_ self, data: R) -> Result<AddResponse, Error> where
    R: 'static + Read + Send + Sync
[src]

Add file to Ipfs.

Examples

use ipfs_api::IpfsClient;
use std::io::Cursor;

let client = IpfsClient::default();
let data = Cursor::new("Hello World!");
let res = client.add(data);

pub async fn add_path<'_, P>(
    &'_ self,
    path: P
) -> Result<Vec<AddResponse>, Error> where
    P: AsRef<Path>, 
[src]

Add a path to Ipfs. Can be a file or directory. A hard limit of 128 open file descriptors is set such that any small additional files are stored in-memory.

Examples

use ipfs_api::IpfsClient;

let client = IpfsClient::default();
let path = "./src";
let res = client.add_path(path);

pub async fn bitswap_ledger<'_, '_>(
    &'_ self,
    peer: &'_ str
) -> Result<BitswapLedgerResponse, Error>
[src]

Returns the current ledger for a peer.

Examples

use ipfs_api::IpfsClient;

let client = IpfsClient::default();
let res = client.bitswap_ledger("QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ");

pub async fn bitswap_reprovide<'_>(
    &'_ self
) -> Result<BitswapReprovideResponse, Error>
[src]

Triggers a reprovide.

Examples

use ipfs_api::IpfsClient;

let client = IpfsClient::default();
let res = client.bitswap_reprovide();

pub async fn bitswap_stat<'_>(&'_ self) -> Result<BitswapStatResponse, Error>[src]

Returns some stats about the bitswap agent.

Examples

use ipfs_api::IpfsClient;

let client = IpfsClient::default();
let res = client.bitswap_stat();

pub async fn bitswap_unwant<'_, '_>(
    &'_ self,
    key: &'_ str
) -> Result<BitswapUnwantResponse, Error>
[src]

Remove a given block from your wantlist.

Examples

use ipfs_api::IpfsClient;

let client = IpfsClient::default();
let res = client.bitswap_unwant("QmXdNSQx7nbdRvkjGCEQgVjVtVwsHvV8NmV2a8xzQVwuFA");

pub async fn bitswap_wantlist<'_, '_>(
    &'_ self,
    peer: Option<&'_ str>
) -> Result<BitswapWantlistResponse, Error>
[src]

Shows blocks on the wantlist for you or the specified peer.

Examples

use ipfs_api::IpfsClient;

let client = IpfsClient::default();
let res = client.bitswap_wantlist(
    Some("QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ")
);

pub fn block_get(&self, hash: &str) -> impl Stream<Item = Result<Bytes, Error>>[src]

Gets a raw IPFS block.

Examples

use futures::TryStreamExt;
use ipfs_api::IpfsClient;

let client = IpfsClient::default();
let hash = "QmXdNSQx7nbdRvkjGCEQgVjVtVwsHvV8NmV2a8xzQVwuFA";
let res = client
    .block_get(hash)
    .map_ok(|chunk| chunk.to_vec())
    .try_concat();

pub async fn block_put<'_, R>(
    &'_ self,
    data: R
) -> Result<BlockPutResponse, Error> where
    R: 'static + Read + Send + Sync
[src]

Store input as an IPFS block.

Examples

use ipfs_api::IpfsClient;
use std::io::Cursor;

let client = IpfsClient::default();
let data = Cursor::new("Hello World!");
let res = client.block_put(data);

pub async fn block_rm<'_, '_>(
    &'_ self,
    hash: &'_ str
) -> Result<BlockRmResponse, Error>
[src]

Removes an IPFS block.

Examples

use ipfs_api::IpfsClient;

let client = IpfsClient::default();
let res = client.block_rm("QmXdNSQx7nbdRvkjGCEQgVjVtVwsHvV8NmV2a8xzQVwuFA");

pub async fn block_stat<'_, '_>(
    &'_ self,
    hash: &'_ str
) -> Result<BlockStatResponse, Error>
[src]

Prints information about a raw IPFS block.

Examples

use ipfs_api::IpfsClient;

let client = IpfsClient::default();
let res = client.block_stat("QmXdNSQx7nbdRvkjGCEQgVjVtVwsHvV8NmV2a8xzQVwuFA");

pub async fn bootstrap_add_default<'_>(
    &'_ self
) -> Result<BootstrapAddDefaultResponse, Error>
[src]

Add default peers to the bootstrap list.

Examples

use ipfs_api::IpfsClient;

let client = IpfsClient::default();
let res = client.bootstrap_add_default();

pub async fn bootstrap_list<'_>(
    &'_ self
) -> Result<BootstrapListResponse, Error>
[src]

Lists peers in bootstrap list.

Examples

use ipfs_api::IpfsClient;

let client = IpfsClient::default();
let res = client.bootstrap_list();

pub async fn bootstrap_rm_all<'_>(
    &'_ self
) -> Result<BootstrapRmAllResponse, Error>
[src]

Removes all peers in bootstrap list.

Examples

use ipfs_api::IpfsClient;

let client = IpfsClient::default();
let res = client.bootstrap_rm_all();

pub fn cat(&self, path: &str) -> impl Stream<Item = Result<Bytes, Error>>[src]

Returns the contents of an Ipfs object.

Examples

use futures::TryStreamExt;
use ipfs_api::IpfsClient;

let client = IpfsClient::default();
let hash = "QmXdNSQx7nbdRvkjGCEQgVjVtVwsHvV8NmV2a8xzQVwuFA";
let res = client
    .cat(hash)
    .map_ok(|chunk| chunk.to_vec())
    .try_concat();

pub async fn commands<'_>(&'_ self) -> Result<CommandsResponse, Error>[src]

List available commands that the server accepts.

use ipfs_api::IpfsClient;

let client = IpfsClient::default();
let res = client.commands();

pub async fn config_edit<'_>(&'_ self) -> Result<ConfigEditResponse, Error>[src]

Opens the config file for editing (on the server).

use ipfs_api::IpfsClient;

let client = IpfsClient::default();
let res = client.config_edit();

pub async fn config_replace<'_, R>(
    &'_ self,
    data: R
) -> Result<ConfigReplaceResponse, Error> where
    R: 'static + Read + Send + Sync
[src]

Replace the config file.

use ipfs_api::IpfsClient;
use std::io::Cursor;

let client = IpfsClient::default();
let config = Cursor::new("{..json..}");
let res = client.config_replace(config);

pub async fn config_show<'_>(&'_ self) -> Result<ConfigShowResponse, Error>[src]

Show the current config of the server.

Returns an unparsed json string, due to an unclear spec.

use ipfs_api::IpfsClient;

let client = IpfsClient::default();
let res = client.config_show();

pub async fn dag_get<'_, '_>(
    &'_ self,
    path: &'_ str
) -> Result<DagGetResponse, Error>
[src]

Returns information about a dag node in Ipfs.

use ipfs_api::IpfsClient;

let client = IpfsClient::default();
let res = client.dag_get("QmXdNSQx7nbdRvkjGCEQgVjVtVwsHvV8NmV2a8xzQVwuFA");

pub fn dht_findpeer(
    &self,
    peer: &str
) -> impl Stream<Item = Result<DhtFindPeerResponse, Error>>
[src]

Query the DHT for all of the multiaddresses associated with a Peer ID.

use futures::TryStreamExt;
use ipfs_api::IpfsClient;

let client = IpfsClient::default();
let peer = "QmSoLPppuBtQSGwKDZT2M73ULpjvfd3aZ6ha4oFGL1KrGM";
let res = client.dht_findpeer(peer).try_collect::<Vec<_>>();

pub fn dht_findprovs(
    &self,
    key: &str
) -> impl Stream<Item = Result<DhtFindProvsResponse, Error>>
[src]

Find peers in the DHT that can provide a specific value given a key.

use futures::TryStreamExt;
use ipfs_api::IpfsClient;

let client = IpfsClient::default();
let key = "QmXdNSQx7nbdRvkjGCEQgVjVtVwsHvV8NmV2a8xzQVwuFA";
let res = client.dht_findprovs(key).try_collect::<Vec<_>>();

pub fn dht_get(
    &self,
    key: &str
) -> impl Stream<Item = Result<DhtGetResponse, Error>>
[src]

Query the DHT for a given key.

use futures::TryStreamExt;
use ipfs_api::IpfsClient;

let client = IpfsClient::default();
let key = "QmXdNSQx7nbdRvkjGCEQgVjVtVwsHvV8NmV2a8xzQVwuFA";
let res = client.dht_get(key).try_collect::<Vec<_>>();

pub fn dht_provide(
    &self,
    key: &str
) -> impl Stream<Item = Result<DhtProvideResponse, Error>>
[src]

Announce to the network that you are providing a given value.

use futures::TryStreamExt;
use ipfs_api::IpfsClient;

let client = IpfsClient::default();
let key = "QmXdNSQx7nbdRvkjGCEQgVjVtVwsHvV8NmV2a8xzQVwuFA";
let res = client.dht_provide(key).try_collect::<Vec<_>>();

pub fn dht_put(
    &self,
    key: &str,
    value: &str
) -> impl Stream<Item = Result<DhtPutResponse, Error>>
[src]

Write a key/value pair to the DHT.

use futures::TryStreamExt;
use ipfs_api::IpfsClient;

let client = IpfsClient::default();
let res = client.dht_put("test", "Hello World!").try_collect::<Vec<_>>();

pub fn dht_query(
    &self,
    peer: &str
) -> impl Stream<Item = Result<DhtQueryResponse, Error>>
[src]

Find the closest peer given the peer ID by querying the DHT.

use futures::TryStreamExt;
use ipfs_api::IpfsClient;

let client = IpfsClient::default();
let peer = "QmSoLPppuBtQSGwKDZT2M73ULpjvfd3aZ6ha4oFGL1KrGM";
let res = client.dht_query(peer).try_collect::<Vec<_>>();

pub async fn diag_cmds_clear<'_>(
    &'_ self
) -> Result<DiagCmdsClearResponse, Error>
[src]

Clear inactive requests from the log.

use ipfs_api::IpfsClient;

let client = IpfsClient::default();
let res = client.diag_cmds_clear();

pub async fn diag_cmds_set_time<'_, '_>(
    &'_ self,
    time: &'_ str
) -> Result<DiagCmdsSetTimeResponse, Error>
[src]

Set how long to keep inactive requests in the log.

use ipfs_api::IpfsClient;

let client = IpfsClient::default();
let res = client.diag_cmds_set_time("1m");

pub async fn diag_sys<'_>(&'_ self) -> Result<DiagSysResponse, Error>[src]

Print system diagnostic information.

Note: There isn't good documentation on what this call is supposed to return. It might be platform dependent, but if it isn't, this can be fixed to return an actual object.

use ipfs_api::IpfsClient;

let client = IpfsClient::default();
let res = client.diag_sys();

pub async fn dns<'_, '_>(
    &'_ self,
    link: &'_ str,
    recursive: bool
) -> Result<DnsResponse, Error>
[src]

Resolve DNS link.

use ipfs_api::IpfsClient;

let client = IpfsClient::default();
let res = client.dns("ipfs.io", true);

pub async fn file_ls<'_, '_>(
    &'_ self,
    path: &'_ str
) -> Result<FileLsResponse, Error>
[src]

List directory for Unix filesystem objects.

use ipfs_api::IpfsClient;

let client = IpfsClient::default();
let res = client.file_ls("/ipns/ipfs.io");

pub async fn files_cp<'_, '_, '_>(
    &'_ self,
    path: &'_ str,
    dest: &'_ str
) -> Result<FilesCpResponse, Error>
[src]

Copy files into MFS.

use ipfs_api::IpfsClient;

let client = IpfsClient::default();
let res = client.files_cp("/path/to/file", "/dest");

pub async fn files_flush<'_, '_>(
    &'_ self,
    path: Option<&'_ str>
) -> Result<FilesFlushResponse, Error>
[src]

Flush a path's data to disk.

use ipfs_api::IpfsClient;

let client = IpfsClient::default();
let res = client.files_flush(None);
let res = client.files_flush(Some("/tmp"));

pub async fn files_ls<'_, '_>(
    &'_ self,
    path: Option<&'_ str>
) -> Result<FilesLsResponse, Error>
[src]

List directories in MFS.

use ipfs_api::IpfsClient;

let client = IpfsClient::default();
let res = client.files_ls(None);
let res = client.files_ls(Some("/tmp"));

pub async fn files_mkdir<'_, '_>(
    &'_ self,
    path: &'_ str,
    parents: bool
) -> Result<FilesMkdirResponse, Error>
[src]

Make directories in MFS.

use ipfs_api::IpfsClient;

let client = IpfsClient::default();
let res = client.files_mkdir("/test", false);
let res = client.files_mkdir("/test/nested/dir", true);

pub async fn files_mv<'_, '_, '_>(
    &'_ self,
    path: &'_ str,
    dest: &'_ str
) -> Result<FilesMvResponse, Error>
[src]

Copy files into MFS.

use ipfs_api::IpfsClient;

let client = IpfsClient::default();
let res = client.files_mv("/test/tmp.json", "/test/file.json");

pub fn files_read(&self, path: &str) -> impl Stream<Item = Result<Bytes, Error>>[src]

Read a file in MFS.

use ipfs_api::IpfsClient;

let client = IpfsClient::default();
let res = client.files_read("/test/file.json");

pub async fn files_rm<'_, '_>(
    &'_ self,
    path: &'_ str,
    recursive: bool
) -> Result<FilesRmResponse, Error>
[src]

Remove a file in MFS.

use ipfs_api::IpfsClient;

let client = IpfsClient::default();
let res = client.files_rm("/test/dir", true);
let res = client.files_rm("/test/file.json", false);

pub async fn files_stat<'_, '_>(
    &'_ self,
    path: &'_ str
) -> Result<FilesStatResponse, Error>
[src]

Display a file's status in MDFS.

use ipfs_api::IpfsClient;

let client = IpfsClient::default();
let res = client.files_stat("/test/file.json");

pub async fn files_write<'_, '_, R>(
    &'_ self,
    path: &'_ str,
    create: bool,
    truncate: bool,
    data: R
) -> Result<FilesWriteResponse, Error> where
    R: 'static + Read + Send + Sync
[src]

Write to a mutable file in the filesystem.

use ipfs_api::IpfsClient;
use std::fs::File;

let client = IpfsClient::default();
let file = File::open("test.json").unwrap();
let res = client.files_write("/test/file.json", true, true, file);

pub fn filestore_dups(
    &self
) -> impl Stream<Item = Result<FilestoreDupsResponse, Error>>
[src]

List blocks that are both in the filestore and standard block storage.

use ipfs_api::IpfsClient;

let client = IpfsClient::default();
let res = client.filestore_dups();

pub fn filestore_ls(
    &self,
    cid: Option<&str>
) -> impl Stream<Item = Result<FilestoreLsResponse, Error>>
[src]

List objects in filestore.

use ipfs_api::IpfsClient;

let client = IpfsClient::default();
let res = client.filestore_ls(
    Some("QmYPP3BovR2m8UqCZxFbdXSit6SKgExxDkFAPLqiGsap4X")
);

pub fn filestore_verify(
    &self,
    cid: Option<&str>
) -> impl Stream<Item = Result<FilestoreVerifyResponse, Error>>
[src]

Verify objects in filestore.

use ipfs_api::IpfsClient;

let client = IpfsClient::default();
let res = client.filestore_verify(None);

pub fn get(&self, path: &str) -> impl Stream<Item = Result<Bytes, Error>>[src]

Download Ipfs object.

use ipfs_api::IpfsClient;

let client = IpfsClient::default();
let res = client.get("/test/file.json");

pub async fn id<'_, '_>(
    &'_ self,
    peer: Option<&'_ str>
) -> Result<IdResponse, Error>
[src]

Returns information about a peer.

If peer is None, returns information about you.

use ipfs_api::IpfsClient;

let client = IpfsClient::default();
let res = client.id(None);
let res = client.id(Some("QmSoLPppuBtQSGwKDZT2M73ULpjvfd3aZ6ha4oFGL1KrGM"));

pub async fn key_gen<'_, '_>(
    &'_ self,
    name: &'_ str,
    kind: KeyType,
    size: i32
) -> Result<KeyGenResponse, Error>
[src]

Create a new keypair.

use ipfs_api::{IpfsClient, KeyType};

let client = IpfsClient::default();
let res = client.key_gen("test", KeyType::Rsa, 64);

pub async fn key_list<'_>(&'_ self) -> Result<KeyListResponse, Error>[src]

List all local keypairs.

use ipfs_api::IpfsClient;

let client = IpfsClient::default();
let res = client.key_list();

pub async fn key_rename<'_, '_, '_>(
    &'_ self,
    name: &'_ str,
    new: &'_ str,
    force: bool
) -> Result<KeyRenameResponse, Error>
[src]

Rename a keypair.

use ipfs_api::IpfsClient;

let client = IpfsClient::default();
let res = client.key_rename("key_0", "new_name", false);

pub async fn key_rm<'_, '_>(
    &'_ self,
    name: &'_ str
) -> Result<KeyRmResponse, Error>
[src]

Remove a keypair.

use ipfs_api::IpfsClient;

let client = IpfsClient::default();
let res = client.key_rm("key_0");

pub async fn log_level<'_, '_>(
    &'_ self,
    logger: Logger<'_>,
    level: LoggingLevel
) -> Result<LogLevelResponse, Error>
[src]

Change the logging level for a logger.

use ipfs_api::{IpfsClient, Logger, LoggingLevel};
use std::borrow::Cow;

let client = IpfsClient::default();
let res = client.log_level(Logger::All, LoggingLevel::Debug);
let res = client.log_level(
    Logger::Specific(Cow::Borrowed("web")),
    LoggingLevel::Warning
);

pub async fn log_ls<'_>(&'_ self) -> Result<LogLsResponse, Error>[src]

List all logging subsystems.

use ipfs_api::IpfsClient;

let client = IpfsClient::default();
let res = client.log_ls();

pub fn log_tail(&self) -> impl Stream<Item = Result<String, Error>>[src]

Read the event log.

use ipfs_api::IpfsClient;

let client = IpfsClient::default();
let res = client.log_tail();

pub async fn ls<'_, '_>(
    &'_ self,
    path: Option<&'_ str>
) -> Result<LsResponse, Error>
[src]

List the contents of an Ipfs multihash.

use ipfs_api::IpfsClient;

let client = IpfsClient::default();
let res = client.ls(None);
let res = client.ls(Some("/ipfs/QmVrLsEDn27sScp3k23sgZNefVTjSAL3wpgW1iWPi4MgoY"));

pub async fn name_publish<'_, '_, '_, '_, '_>(
    &'_ self,
    path: &'_ str,
    resolve: bool,
    lifetime: Option<&'_ str>,
    ttl: Option<&'_ str>,
    key: Option<&'_ str>
) -> Result<NamePublishResponse, Error>
[src]

Publish an IPFS path to IPNS.

use ipfs_api::IpfsClient;

let client = IpfsClient::default();
let res = client.name_publish(
    "/ipfs/QmVrLsEDn27sScp3k23sgZNefVTjSAL3wpgW1iWPi4MgoY",
    false,
    Some("12h"),
    None,
    None
);

pub async fn name_resolve<'_, '_>(
    &'_ self,
    name: Option<&'_ str>,
    recursive: bool,
    nocache: bool
) -> Result<NameResolveResponse, Error>
[src]

Resolve an IPNS name.

use ipfs_api::IpfsClient;

let client = IpfsClient::default();
let res = client.name_resolve(
    Some("/ipns/ipfs.io"),
    true,
    false
);

pub fn object_data(&self, key: &str) -> impl Stream<Item = Result<Bytes, Error>>[src]

Output the raw bytes of an Ipfs object.

use ipfs_api::IpfsClient;

let client = IpfsClient::default();
let res = client.object_data("/ipfs/QmVrLsEDn27sScp3k23sgZNefVTjSAL3wpgW1iWPi4MgoY");

pub async fn object_diff<'_, '_, '_>(
    &'_ self,
    key0: &'_ str,
    key1: &'_ str
) -> Result<ObjectDiffResponse, Error>
[src]

Returns the diff of two Ipfs objects.

use ipfs_api::IpfsClient;

let client = IpfsClient::default();
let res = client.object_diff(
    "/ipfs/QmVrLsEDn27sScp3k23sgZNefVTjSAL3wpgW1iWPi4MgoY",
    "/ipfs/QmXdNSQx7nbdRvkjGCEQgVjVtVwsHvV8NmV2a8xzQVwuFA"
);

pub async fn object_get<'_, '_>(
    &'_ self,
    key: &'_ str
) -> Result<ObjectGetResponse, Error>
[src]

Returns the data in an object.

use ipfs_api::IpfsClient;

let client = IpfsClient::default();
let res = client.object_get("/ipfs/QmVrLsEDn27sScp3k23sgZNefVTjSAL3wpgW1iWPi4MgoY");

Returns the links that an object points to.

use ipfs_api::IpfsClient;

let client = IpfsClient::default();
let res = client.object_links("/ipfs/QmVrLsEDn27sScp3k23sgZNefVTjSAL3wpgW1iWPi4MgoY");

pub async fn object_new<'_>(
    &'_ self,
    template: Option<ObjectTemplate>
) -> Result<ObjectNewResponse, Error>
[src]

Create a new object.

use ipfs_api::{IpfsClient, ObjectTemplate};

let client = IpfsClient::default();
let res = client.object_new(None);
let res = client.object_new(Some(ObjectTemplate::UnixFsDir));

pub async fn object_stat<'_, '_>(
    &'_ self,
    key: &'_ str
) -> Result<ObjectStatResponse, Error>
[src]

Returns the stats for an object.

use ipfs_api::IpfsClient;

let client = IpfsClient::default();
let res = client.object_stat("/ipfs/QmVrLsEDn27sScp3k23sgZNefVTjSAL3wpgW1iWPi4MgoY");

pub async fn pin_add<'_, '_>(
    &'_ self,
    key: &'_ str,
    recursive: bool
) -> Result<PinAddResponse, Error>
[src]

Pins a new object.

The "recursive" option tells the server whether to pin just the top-level object, or all sub-objects it depends on. For most cases you want it to be true.

Does not yet implement the "progress" agument because reading it is kinda squirrelly.

Examples

use ipfs_api::IpfsClient;

let client = IpfsClient::default();
let res = client.pin_add("QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ", true);

pub async fn pin_ls<'_, '_, '_>(
    &'_ self,
    key: Option<&'_ str>,
    typ: Option<&'_ str>
) -> Result<PinLsResponse, Error>
[src]

Returns a list of pinned objects in local storage.

use ipfs_api::IpfsClient;

let client = IpfsClient::default();
let res = client.pin_ls(None, None);
let res = client.pin_ls(
    Some("/ipfs/QmVrLsEDn27sScp3k23sgZNefVTjSAL3wpgW1iWPi4MgoY"),
    None
);
let res = client.pin_ls(None, Some("direct"));

pub async fn pin_rm<'_, '_>(
    &'_ self,
    key: &'_ str,
    recursive: bool
) -> Result<PinRmResponse, Error>
[src]

Removes a pinned object from local storage.

use ipfs_api::IpfsClient;

let client = IpfsClient::default();
let res = client.pin_rm(
    "/ipfs/QmVrLsEDn27sScp3k23sgZNefVTjSAL3wpgW1iWPi4MgoY",
    false
);
let res = client.pin_rm(
    "/ipfs/QmVrLsEDn27sScp3k23sgZNefVTjSAL3wpgW1iWPi4MgoY",
    true
);

pub fn ping(
    &self,
    peer: &str,
    count: Option<i32>
) -> impl Stream<Item = Result<PingResponse, Error>>
[src]

Pings a peer.

use ipfs_api::IpfsClient;

let client = IpfsClient::default();
let res = client.ping("QmSoLV4Bbm51jM9C4gDYZQ9Cy3U6aXMJDAbzgu2fzaDs64", None);
let res = client.ping("QmSoLV4Bbm51jM9C4gDYZQ9Cy3U6aXMJDAbzgu2fzaDs64", Some(15));

pub async fn pubsub_ls<'_>(&'_ self) -> Result<PubsubLsResponse, Error>[src]

List subscribed pubsub topics.

use ipfs_api::IpfsClient;

let client = IpfsClient::default();
let res = client.pubsub_ls();

pub async fn pubsub_peers<'_, '_>(
    &'_ self,
    topic: Option<&'_ str>
) -> Result<PubsubPeersResponse, Error>
[src]

List peers that are being published to.

use ipfs_api::IpfsClient;

let client = IpfsClient::default();
let res = client.pubsub_peers(None);
let res = client.pubsub_peers(Some("feed"));

pub async fn pubsub_pub<'_, '_, '_>(
    &'_ self,
    topic: &'_ str,
    payload: &'_ str
) -> Result<PubsubPubResponse, Error>
[src]

Publish a message to a topic.

use ipfs_api::IpfsClient;

let client = IpfsClient::default();
let res = client.pubsub_pub("feed", "Hello World!");

pub fn pubsub_sub(
    &self,
    topic: &str,
    discover: bool
) -> impl Stream<Item = Result<PubsubSubResponse, Error>>
[src]

Subscribes to a pubsub topic.

use ipfs_api::IpfsClient;

let client = IpfsClient::default();
let res = client.pubsub_sub("feed", false);
let res = client.pubsub_sub("feed", true);

pub fn refs_local(&self) -> impl Stream<Item = Result<RefsLocalResponse, Error>>[src]

Gets a list of local references.

use ipfs_api::IpfsClient;

let client = IpfsClient::default();
let res = client.refs_local();

pub async fn shutdown<'_>(&'_ self) -> Result<ShutdownResponse, Error>[src]

Shutdown the Ipfs daemon.

use ipfs_api::IpfsClient;

let client = IpfsClient::default();
let res = client.shutdown();

pub async fn stats_bitswap<'_>(&'_ self) -> Result<StatsBitswapResponse, Error>[src]

Returns bitswap stats.

use ipfs_api::IpfsClient;

let client = IpfsClient::default();
let res = client.stats_bitswap();

pub async fn stats_bw<'_>(&'_ self) -> Result<StatsBwResponse, Error>[src]

Returns bandwidth stats.

use ipfs_api::IpfsClient;

let client = IpfsClient::default();
let res = client.stats_bw();

pub async fn stats_repo<'_>(&'_ self) -> Result<StatsRepoResponse, Error>[src]

Returns repo stats.

use ipfs_api::IpfsClient;

let client = IpfsClient::default();
let res = client.stats_repo();

pub async fn swarm_addrs_local<'_>(
    &'_ self
) -> Result<SwarmAddrsLocalResponse, Error>
[src]

Return a list of local addresses.

use ipfs_api::IpfsClient;

let client = IpfsClient::default();
let res = client.swarm_addrs_local();

pub async fn swarm_peers<'_>(&'_ self) -> Result<SwarmPeersResponse, Error>[src]

Return a list of peers with open connections.

use ipfs_api::IpfsClient;

let client = IpfsClient::default();
let res = client.swarm_peers();

pub async fn tar_add<'_, R>(&'_ self, data: R) -> Result<TarAddResponse, Error> where
    R: 'static + Read + Send + Sync
[src]

Add a tar file to Ipfs.

Note: data should already be a tar file. If it isn't the Api will return an error.

use ipfs_api::IpfsClient;
use std::fs::File;

let client = IpfsClient::default();
let tar = File::open("/path/to/file.tar").unwrap();
let res = client.tar_add(tar);

pub fn tar_cat(&self, path: &str) -> impl Stream<Item = Result<Bytes, Error>>[src]

Export a tar file from Ipfs.

use ipfs_api::IpfsClient;

let client = IpfsClient::default();
let res = client.tar_cat("/ipfs/QmVrLsEDn27sScp3k23sgZNefVTjSAL3wpgW1iWPi4MgoY");

pub async fn version<'_>(&'_ self) -> Result<VersionResponse, Error>[src]

Returns information about the Ipfs server version.

use ipfs_api::IpfsClient;

let client = IpfsClient::default();
let res = client.version();

Trait Implementations

impl Clone for IpfsClient[src]

impl Default for IpfsClient[src]

fn default() -> IpfsClient[src]

Creates an IpfsClient connected to the endpoint specified in ~/.ipfs/api. If not found, tries to connect to localhost:5001.

impl From<SocketAddr> for IpfsClient[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,