pub struct Client<K, S>{
pub session: IdentifyResponse,
pub sphere_identity: String,
pub api_base: Url,
pub author: Author<K>,
pub store: S,
/* private fields */
}
Expand description
A Client is a simple, portable HTTP client for the Noosphere gateway REST API. It embodies the intended usage of the REST API, which includes an opening handshake (with associated key verification) and various UCAN-authorized verbs over sphere data.
Fields§
§session: IdentifyResponse
§sphere_identity: String
§api_base: Url
§store: S
Implementations§
Source§impl<K, S> Client<K, S>
impl<K, S> Client<K, S>
pub async fn identify( sphere_identity: &str, api_base: &Url, author: &Author<K>, did_parser: &mut DidParser, store: S, ) -> Result<Client<K, S>>
Sourcepub async fn replicate(
&self,
memo_version: &Cid,
params: Option<&ReplicateParameters>,
) -> Result<impl Stream<Item = Result<(Cid, Vec<u8>)>>>
pub async fn replicate( &self, memo_version: &Cid, params: Option<&ReplicateParameters>, ) -> Result<impl Stream<Item = Result<(Cid, Vec<u8>)>>>
Replicate content from Noosphere, streaming its blocks from the configured gateway. If the gateway doesn’t have the desired content, it will look it up from other sources such as IPFS if they are available. Note that this means this call can potentially block on upstream access to an IPFS node (which, depending on the node’s network configuration and peering status, can be quite slow).
pub async fn fetch( &self, params: &FetchParameters, ) -> Result<Option<(Link<MemoIpld>, impl Stream<Item = Result<(Cid, Vec<u8>)>>)>>
pub async fn push( &self, push_body: &PushBody, ) -> Result<PushResponse, PushError>
Auto Trait Implementations§
impl<K, S> Freeze for Client<K, S>
impl<K, S> !RefUnwindSafe for Client<K, S>
impl<K, S> Send for Client<K, S>
impl<K, S> Sync for Client<K, S>
impl<K, S> Unpin for Client<K, S>
impl<K, S> !UnwindSafe for Client<K, S>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more