[−][src]Struct semtexzv_ipfsapi::IpfsApi
Implementations
impl IpfsApi
[src]
pub async fn add<'_>(&'_ self, data: Bytes) -> Result<String, Error>
[src]
pub async fn cat<'_, '_>(&'_ self, hash: &'_ str) -> Result<Bytes, Error>
[src]
Retrieves the contents of a file from the IPFS network. Takes a hash and returns an iterator of bytes. The result can be streamed, if the file is large.
let api = IpfsApi::new("127.0.0.1", 5001); let hello = api.cat("QmWATWQ7fVPP2EFGu71UkfnqhYXDYH566qy47CnJDgvs8u")?; let hello_string = String::from_utf8(hello.collect())?; println!("{}", hello_string);
pub async fn get<'_, '_>(&'_ self, hash: &'_ str) -> Result<Bytes, Error>
[src]
impl IpfsApi
[src]
pub async fn name_resolve<'_, '_>(
&'_ self,
name: &'_ str
) -> Result<String, Error>
[src]
&'_ self,
name: &'_ str
) -> Result<String, Error>
Resolve an IPNS hash or a domain name
let api = IpfsApi::new("127.0.0.1", 5001); let hash = api.name_resolve("gkbrk.com"); println!("{}", hash);
pub async fn name_publish<'_, '_>(&'_ self, hash: &'_ str) -> Result<(), Error>
[src]
Publish an IPFS hash in IPNS.
impl IpfsApi
[src]
pub async fn object_stats<'_, '_>(
&'_ self,
hash: &'_ str
) -> Result<ObjectStats, Error>
[src]
&'_ self,
hash: &'_ str
) -> Result<ObjectStats, Error>
Get stats for an IPFS hash. It can be used to get the recursive size of a hash.
impl IpfsApi
[src]
pub async fn pin_add<'_, '_>(
&'_ self,
hash: &'_ str,
recursive: bool
) -> Result<PinResponse, Error>
[src]
&'_ self,
hash: &'_ str,
recursive: bool
) -> Result<PinResponse, Error>
Tells the IPFS server to pin the given object. If 'recursive' is true, it will recursively pin all objects that one depends on. If 'progress' is true, it will return a percentage(?) progress if the object has not been already pinned, or None if it has.
pub async fn pin_rm<'_, '_>(
&'_ self,
hash: &'_ str,
recursive: bool
) -> Result<PinResponse, Error>
[src]
&'_ self,
hash: &'_ str,
recursive: bool
) -> Result<PinResponse, Error>
Unpin the given object.
pub async fn pin_list<'_>(&'_ self) -> Result<Vec<PinnedHash>, Error>
[src]
List pinned objects.
impl IpfsApi
[src]
pub async fn pubsub_subscribe<'_, '_>(
&'_ self,
channel: &'_ str
) -> Result<impl Iterator<Item = PubSubMessage>, Error>
[src]
&'_ self,
channel: &'_ str
) -> Result<impl Iterator<Item = PubSubMessage>, Error>
Subscribes to a channel for p2p messages This function subscribes to a channel/topic and listens to any data sent to it. It can be used for peer-to-peer communication and dynamic apps over IPFS.
let api = IpfsApi::new("127.0.0.1", 5001); for message in api.pubsub_subscribe("chat")? { println!("{:?}", message); }
pub async fn pubsub_publish<'_, '_, '_>(
&'_ self,
channel: &'_ str,
data: &'_ str
) -> Result<(), Error>
[src]
&'_ self,
channel: &'_ str,
data: &'_ str
) -> Result<(), Error>
Sends a p2p message to a channel This function sends a data packet to a channel/topic. It can be used for peer-to-peer communication and dynamic apps over IPFS.
impl IpfsApi
[src]
pub async fn version<'_>(&'_ self) -> Result<IpfsVersion, Error>
[src]
Get the version from the IPFS daemon.
impl IpfsApi
[src]
pub async fn shutdown<'_>(&'_ self) -> Result<(), Error>
[src]
Shut down the IPFS daemon This function causes the IPFS daemon to terminate
impl IpfsApi
[src]
pub async fn block_put<'a>(&'a self, data: Bytes) -> Result<String, Error>
[src]
pub async fn block_get<'_, '_>(&'_ self, hash: &'_ str) -> Result<Bytes, Error>
[src]
impl IpfsApi
[src]
The main interface of the library The IpfsApi class represents a connection to the local IPFS daemon. It can read and write data to it using http requests to the server.
pub fn new(url: &str) -> Result<IpfsApi, ParseError>
[src]
Creates a new instance of the API
let api = IpfsApi::new("127.0.0.1", 5001);
Auto Trait Implementations
impl !RefUnwindSafe for IpfsApi
impl Send for IpfsApi
impl Sync for IpfsApi
impl Unpin for IpfsApi
impl !UnwindSafe for IpfsApi
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,