pub struct ApiService { /* private fields */ }Expand description
Handle exposing the generic api/* endpoints (pin, tag,
stewardship). Cheap to clone.
Implementations§
Source§impl ApiService
impl ApiService
Sourcepub async fn pin(&self, reference: &Reference) -> Result<(), Error>
pub async fn pin(&self, reference: &Reference) -> Result<(), Error>
Pin a reference — POST /pins/{ref}.
Sourcepub async fn unpin(&self, reference: &Reference) -> Result<(), Error>
pub async fn unpin(&self, reference: &Reference) -> Result<(), Error>
Unpin a reference — DELETE /pins/{ref}.
Sourcepub async fn get_pin(&self, reference: &Reference) -> Result<bool, Error>
pub async fn get_pin(&self, reference: &Reference) -> Result<bool, Error>
Check whether a reference is pinned — GET /pins/{ref}.
Returns true on 200, false on 404, otherwise the
underlying response error.
Sourcepub async fn list_pins(&self) -> Result<Vec<Reference>, Error>
pub async fn list_pins(&self) -> Result<Vec<Reference>, Error>
List every pinned reference — GET /pins.
Sourcepub async fn check_pins(
&self,
reference: Option<&Reference>,
) -> Result<Vec<PinIntegrity>, Error>
pub async fn check_pins( &self, reference: Option<&Reference>, ) -> Result<Vec<PinIntegrity>, Error>
Validate the integrity of pinned chunks — GET /pins/check.
When reference is Some, only that pin is checked; when
None, every pinned root is walked.
Bee streams the result as NDJSON (one
PinIntegrity object per line under chunked
transfer-encoding) so it can flush progress for large pin
sets. We collect the stream into a Vec once the response
completes — fine for operator dashboards that only need a
single point-in-time view; if you need progressive reporting
against a node with thousands of pins, drop down to
[crate::Client::http] and stream the body yourself.
Sourcepub async fn create_tag(&self) -> Result<Tag, Error>
pub async fn create_tag(&self) -> Result<Tag, Error>
Create a new tag — POST /tags.
Sourcepub async fn get_tag(&self, uid: u32) -> Result<Tag, Error>
pub async fn get_tag(&self, uid: u32) -> Result<Tag, Error>
Get a tag by UID — GET /tags/{uid}.
Sourcepub async fn retrieve_tag(&self, uid: u32) -> Result<Tag, Error>
pub async fn retrieve_tag(&self, uid: u32) -> Result<Tag, Error>
bee-js name for ApiService::get_tag.
List tags with optional pagination — GET /tags.
Sourcepub async fn delete_tag(&self, uid: u32) -> Result<(), Error>
pub async fn delete_tag(&self, uid: u32) -> Result<(), Error>
Delete a tag — DELETE /tags/{uid}.
Sourcepub async fn update_tag(&self, uid: u32, tag: &Tag) -> Result<(), Error>
pub async fn update_tag(&self, uid: u32, tag: &Tag) -> Result<(), Error>
Update a tag — PATCH /tags/{uid}.
Sourcepub async fn reupload(
&self,
reference: &Reference,
batch_id: &BatchId,
) -> Result<(), Error>
pub async fn reupload( &self, reference: &Reference, batch_id: &BatchId, ) -> Result<(), Error>
Re-upload locally pinned data — PUT /stewardship/{ref}.
Sourcepub async fn is_retrievable(&self, reference: &Reference) -> Result<bool, Error>
pub async fn is_retrievable(&self, reference: &Reference) -> Result<bool, Error>
Check whether a reference is currently retrievable from the
network — GET /stewardship/{ref}. Mirrors bee-js
Bee.isRetrievable.
Sourcepub async fn get_grantees(
&self,
reference: &Reference,
) -> Result<Vec<String>, Error>
pub async fn get_grantees( &self, reference: &Reference, ) -> Result<Vec<String>, Error>
Get the grantees for a reference — GET /grantee/{ref}.
Sourcepub async fn create_grantees(
&self,
batch_id: &BatchId,
grantees: &[String],
) -> Result<GranteeResponse, Error>
pub async fn create_grantees( &self, batch_id: &BatchId, grantees: &[String], ) -> Result<GranteeResponse, Error>
Create a new grantee list — POST /grantee.
Sourcepub async fn patch_grantees(
&self,
batch_id: &BatchId,
reference: &Reference,
history_address: &Reference,
add: &[String],
revoke: &[String],
) -> Result<GranteeResponse, Error>
pub async fn patch_grantees( &self, batch_id: &BatchId, reference: &Reference, history_address: &Reference, add: &[String], revoke: &[String], ) -> Result<GranteeResponse, Error>
Patch the grantees for a reference — PATCH /grantee/{ref}.
Sourcepub async fn post_envelope(
&self,
batch_id: &BatchId,
reference: &Reference,
) -> Result<EnvelopeResponse, Error>
pub async fn post_envelope( &self, batch_id: &BatchId, reference: &Reference, ) -> Result<EnvelopeResponse, Error>
Build an envelope (postage stamp signature triple) for a
reference — POST /envelope/{ref}. Returns the issuer / index /
timestamp / signature quadruple.
Trait Implementations§
Source§impl Clone for ApiService
impl Clone for ApiService
Source§fn clone(&self) -> ApiService
fn clone(&self) -> ApiService
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more