Trait taple_core::ApiModuleInterface
source · pub trait ApiModuleInterface {
Show 14 methods
// Required methods
fn external_request<'life0, 'async_trait>(
&'life0 self,
event_request: Signed<EventRequest>
) -> Pin<Box<dyn Future<Output = Result<DigestIdentifier, ApiError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_subjects<'life0, 'async_trait>(
&'life0 self,
namespace: String,
from: Option<String>,
quantity: Option<i64>
) -> Pin<Box<dyn Future<Output = Result<Vec<SubjectData>, ApiError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_governances<'life0, 'async_trait>(
&'life0 self,
namespace: String,
from: Option<String>,
quantity: Option<i64>
) -> Pin<Box<dyn Future<Output = Result<Vec<SubjectData>, ApiError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_subjects_by_governance<'life0, 'async_trait>(
&'life0 self,
governance_id: DigestIdentifier,
from: Option<String>,
quantity: Option<i64>
) -> Pin<Box<dyn Future<Output = Result<Vec<SubjectData>, ApiError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_events<'life0, 'async_trait>(
&'life0 self,
subject_id: DigestIdentifier,
from: Option<i64>,
quantity: Option<i64>
) -> Pin<Box<dyn Future<Output = Result<Vec<Signed<Event>>, ApiError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_event<'life0, 'async_trait>(
&'life0 self,
subject_id: DigestIdentifier,
sn: u64
) -> Pin<Box<dyn Future<Output = Result<Signed<Event>, ApiError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_subject<'life0, 'async_trait>(
&'life0 self,
subject_id: DigestIdentifier
) -> Pin<Box<dyn Future<Output = Result<SubjectData, ApiError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn shutdown<'async_trait>(
self
) -> Pin<Box<dyn Future<Output = Result<(), ApiError>> + Send + 'async_trait>>
where Self: 'async_trait;
fn add_preauthorize_subject<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
subject_id: &'life1 DigestIdentifier,
providers: &'life2 HashSet<KeyIdentifier>
) -> Pin<Box<dyn Future<Output = Result<(), ApiError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn get_all_allowed_subjects_and_providers<'life0, 'async_trait>(
&'life0 self,
from: Option<String>,
quantity: Option<i64>
) -> Pin<Box<dyn Future<Output = Result<Vec<(DigestIdentifier, HashSet<KeyIdentifier>)>, ApiError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn add_keys<'life0, 'async_trait>(
&'life0 self,
derivator: KeyDerivator
) -> Pin<Box<dyn Future<Output = Result<KeyIdentifier, ApiError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_validation_proof<'life0, 'async_trait>(
&'life0 self,
subject_id: DigestIdentifier
) -> Pin<Box<dyn Future<Output = Result<(HashSet<Signature>, ValidationProof), ApiError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_request<'life0, 'async_trait>(
&'life0 self,
request_id: DigestIdentifier
) -> Pin<Box<dyn Future<Output = Result<TapleRequest, ApiError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_governance_subjects<'life0, 'async_trait>(
&'life0 self,
governance_id: DigestIdentifier,
from: Option<String>,
quantity: Option<i64>
) -> Pin<Box<dyn Future<Output = Result<Vec<SubjectData>, ApiError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}
Expand description
Trait that allows implementing the interface of a TAPLE node. The only native implementation is NodeAPI. Users can use the trait to add specific behaviors to an existing node interface. For example, a NodeAPI wrapper could be created that again implements the trait and perform certain intermediate operations, such as incrementing a counter to find out how many API queries have been made.
Required Methods§
sourcefn external_request<'life0, 'async_trait>(
&'life0 self,
event_request: Signed<EventRequest>
) -> Pin<Box<dyn Future<Output = Result<DigestIdentifier, ApiError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn external_request<'life0, 'async_trait>( &'life0 self, event_request: Signed<EventRequest> ) -> Pin<Box<dyn Future<Output = Result<DigestIdentifier, ApiError>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
Allows to make a request to the node from an external Invoker
sourcefn get_subjects<'life0, 'async_trait>(
&'life0 self,
namespace: String,
from: Option<String>,
quantity: Option<i64>
) -> Pin<Box<dyn Future<Output = Result<Vec<SubjectData>, ApiError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_subjects<'life0, 'async_trait>( &'life0 self, namespace: String, from: Option<String>, quantity: Option<i64> ) -> Pin<Box<dyn Future<Output = Result<Vec<SubjectData>, ApiError>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
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.
sourcefn get_governances<'life0, 'async_trait>(
&'life0 self,
namespace: String,
from: Option<String>,
quantity: Option<i64>
) -> Pin<Box<dyn Future<Output = Result<Vec<SubjectData>, ApiError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_governances<'life0, 'async_trait>( &'life0 self, namespace: String, from: Option<String>, quantity: Option<i64> ) -> Pin<Box<dyn Future<Output = Result<Vec<SubjectData>, ApiError>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
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.
fn get_subjects_by_governance<'life0, 'async_trait>( &'life0 self, governance_id: DigestIdentifier, from: Option<String>, quantity: Option<i64> ) -> Pin<Box<dyn Future<Output = Result<Vec<SubjectData>, ApiError>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
sourcefn get_events<'life0, 'async_trait>(
&'life0 self,
subject_id: DigestIdentifier,
from: Option<i64>,
quantity: Option<i64>
) -> Pin<Box<dyn Future<Output = Result<Vec<Signed<Event>>, ApiError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_events<'life0, 'async_trait>( &'life0 self, subject_id: DigestIdentifier, from: Option<i64>, quantity: Option<i64> ) -> Pin<Box<dyn Future<Output = Result<Vec<Signed<Event>>, ApiError>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
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.
fn get_event<'life0, 'async_trait>( &'life0 self, subject_id: DigestIdentifier, sn: u64 ) -> Pin<Box<dyn Future<Output = Result<Signed<Event>, ApiError>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
sourcefn get_subject<'life0, 'async_trait>(
&'life0 self,
subject_id: DigestIdentifier
) -> Pin<Box<dyn Future<Output = Result<SubjectData, ApiError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_subject<'life0, 'async_trait>( &'life0 self, subject_id: DigestIdentifier ) -> Pin<Box<dyn Future<Output = Result<SubjectData, ApiError>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
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.
sourcefn shutdown<'async_trait>(
self
) -> Pin<Box<dyn Future<Output = Result<(), ApiError>> + Send + 'async_trait>>where
Self: 'async_trait,
fn shutdown<'async_trait>( self ) -> Pin<Box<dyn Future<Output = Result<(), ApiError>> + Send + 'async_trait>>where Self: 'async_trait,
Stops the node, consuming the instance on the fly. This implies that any previously created API or [NotificationHandler] instances will no longer be functional.
fn get_all_allowed_subjects_and_providers<'life0, 'async_trait>( &'life0 self, from: Option<String>, quantity: Option<i64> ) -> Pin<Box<dyn Future<Output = Result<Vec<(DigestIdentifier, HashSet<KeyIdentifier>)>, ApiError>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
fn add_keys<'life0, 'async_trait>( &'life0 self, derivator: KeyDerivator ) -> Pin<Box<dyn Future<Output = Result<KeyIdentifier, ApiError>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
fn get_validation_proof<'life0, 'async_trait>( &'life0 self, subject_id: DigestIdentifier ) -> Pin<Box<dyn Future<Output = Result<(HashSet<Signature>, ValidationProof), ApiError>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
fn get_request<'life0, 'async_trait>( &'life0 self, request_id: DigestIdentifier ) -> Pin<Box<dyn Future<Output = Result<TapleRequest, ApiError>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
fn get_governance_subjects<'life0, 'async_trait>( &'life0 self, governance_id: DigestIdentifier, from: Option<String>, quantity: Option<i64> ) -> Pin<Box<dyn Future<Output = Result<Vec<SubjectData>, ApiError>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
Implementors§
impl ApiModuleInterface for NodeAPI
Feature that allows implementing the API Rest of an Taple node.