Skip to main content

ApiService

Struct ApiService 

Source
pub struct ApiService { /* private fields */ }
Expand description

Handle exposing the generic api/* endpoints (pin, tag, stewardship). Cheap to clone.

Implementations§

Source§

impl ApiService

Source

pub async fn pin(&self, reference: &Reference) -> Result<(), Error>

Pin a reference — POST /pins/{ref}.

Source

pub async fn unpin(&self, reference: &Reference) -> Result<(), Error>

Unpin a reference — DELETE /pins/{ref}.

Source

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.

Source

pub async fn list_pins(&self) -> Result<Vec<Reference>, Error>

List every pinned reference — GET /pins.

Source

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.

Source

pub async fn create_tag(&self) -> Result<Tag, Error>

Create a new tag — POST /tags.

Source

pub async fn get_tag(&self, uid: u32) -> Result<Tag, Error>

Get a tag by UID — GET /tags/{uid}.

Source

pub async fn retrieve_tag(&self, uid: u32) -> Result<Tag, Error>

bee-js name for ApiService::get_tag.

Source

pub async fn list_tags( &self, offset: Option<u32>, limit: Option<u32>, ) -> Result<Vec<Tag>, Error>

List tags with optional pagination — GET /tags.

Source

pub async fn delete_tag(&self, uid: u32) -> Result<(), Error>

Delete a tag — DELETE /tags/{uid}.

Source

pub async fn update_tag(&self, uid: u32, tag: &Tag) -> Result<(), Error>

Update a tag — PATCH /tags/{uid}.

Source

pub async fn reupload( &self, reference: &Reference, batch_id: &BatchId, ) -> Result<(), Error>

Re-upload locally pinned data — PUT /stewardship/{ref}.

Source

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.

Source

pub async fn get_grantees( &self, reference: &Reference, ) -> Result<Vec<String>, Error>

Get the grantees for a reference — GET /grantee/{ref}.

Source

pub async fn create_grantees( &self, batch_id: &BatchId, grantees: &[String], ) -> Result<GranteeResponse, Error>

Create a new grantee list — POST /grantee.

Source

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}.

Source

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

Source§

fn clone(&self) -> ApiService

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ApiService

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

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

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more