pub struct Api { /* private fields */ }
Expand description
Object that allows interaction with a TAPLE node.
It has methods to perform all available read and write operations.
Implementations§
Source§impl Api
impl Api
pub fn new( peer_id: PeerId, controller_id: String, public_key: Vec<u8>, sender: SenderEnd<APICommands, ApiResponses>, ) -> Self
pub fn peer_id(&self) -> &PeerId
pub fn controller_id(&self) -> &String
pub fn public_key(&self) -> &Vec<u8> ⓘ
pub async fn get_request( &self, request_id: DigestIdentifier, ) -> Result<TapleRequest, ApiError>
Sourcepub async fn external_request(
&self,
event_request: Signed<EventRequest>,
) -> Result<DigestIdentifier, ApiError>
pub async fn external_request( &self, event_request: Signed<EventRequest>, ) -> Result<DigestIdentifier, ApiError>
Allows to make a request to the node from an external Invoker
Sourcepub async fn get_subjects(
&self,
namespace: String,
from: Option<String>,
quantity: Option<i64>,
) -> Result<Vec<SubjectData>, ApiError>
pub async fn get_subjects( &self, namespace: String, from: Option<String>, quantity: Option<i64>, ) -> Result<Vec<SubjectData>, ApiError>
Allows to get all subjects that are known to the current node, regardless of their governance.
Paging can be performed using the optional arguments from
and quantity
.
Regarding the first one, note that it admits negative values, in which case the paging is
performed in the opposite direction starting from the end of the collection. Note that this method
also returns the subjects that model governance.
§Possible errors
• [ApiError::InternalError] if an internal error occurred during the execution of the operation.
pub async fn get_subjects_by_governance( &self, governance_id: DigestIdentifier, from: Option<String>, quantity: Option<i64>, ) -> Result<Vec<SubjectData>, ApiError>
Sourcepub async fn get_governances(
&self,
namespace: String,
from: Option<String>,
quantity: Option<i64>,
) -> Result<Vec<SubjectData>, ApiError>
pub async fn get_governances( &self, namespace: String, from: Option<String>, quantity: Option<i64>, ) -> Result<Vec<SubjectData>, ApiError>
It allows to obtain all the subjects that model existing governance in the node.
§Possible errors
• [ApiError::InternalError] if an internal error occurred during the execution of the operation.
pub async fn get_event( &self, subject_id: DigestIdentifier, sn: u64, ) -> Result<Signed<Event>, ApiError>
Sourcepub async fn get_events(
&self,
subject_id: DigestIdentifier,
from: Option<i64>,
quantity: Option<i64>,
) -> Result<Vec<Signed<Event>>, ApiError>
pub async fn get_events( &self, subject_id: DigestIdentifier, from: Option<i64>, quantity: Option<i64>, ) -> Result<Vec<Signed<Event>>, ApiError>
Allows to obtain events from a specific subject previously existing in the node.
Paging can be performed by means of the optional arguments from
and quantity
.
Regarding the former, it should be noted that negative values are allowed, in which case
the paging is performed in the opposite direction starting from the end of the string.
§Possible errors
• ApiError::InvalidParameters if the specified subject identifier does not match a valid DigestIdentifier.
Sourcepub async fn get_subject(
&self,
subject_id: DigestIdentifier,
) -> Result<SubjectData, ApiError>
pub async fn get_subject( &self, subject_id: DigestIdentifier, ) -> Result<SubjectData, ApiError>
Allows to obtain a specified subject by specifying its identifier.
§Possible errors
• ApiError::InvalidParameters if the specified identifier does not match a valid DigestIdentifier.
• ApiError::NotFound if the subject does not exist.
pub async fn get_all_allowed_subjects_and_providers( &self, from: Option<String>, quantity: Option<i64>, ) -> Result<Vec<(DigestIdentifier, HashSet<KeyIdentifier>)>, ApiError>
pub async fn add_keys( &self, derivator: KeyDerivator, ) -> Result<KeyIdentifier, ApiError>
pub async fn get_validation_proof( &self, subject_id: DigestIdentifier, ) -> Result<(HashSet<Signature>, ValidationProof), ApiError>
pub async fn get_governance_subjects( &self, governance_id: DigestIdentifier, from: Option<String>, quantity: Option<i64>, ) -> Result<Vec<SubjectData>, ApiError>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Api
impl RefUnwindSafe for Api
impl Send for Api
impl Sync for Api
impl Unpin for Api
impl UnwindSafe for Api
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more