Skip to main content
EventRequest is an enum that represents all valid event requests in TAPLE. Each variant corresponds to a specific operation that can be performed on a subject in the network.

Variants

Create

A request to create a new subject in the network. Type: StartRequest See StartRequest for detailed information.

Fact

A request to add a fact (state change) to an existing subject. Type: FactRequest See FactRequest for detailed information.

Transfer

A request to transfer ownership of a subject to a new owner. Type: TransferRequest See TransferRequest for detailed information.

EOL

A request to mark a subject as end-of-life, indicating it will no longer accept new events. Type: EOLRequest See EOLRequest for detailed information.

Methods

requires_eval_appr

Determines whether the request requires evaluation and approval.
pub fn requires_eval_appr(&self) -> bool
Returns: true for Fact requests, false for Create, Transfer, and EOL requests.

hash_id

Generates a hash identifier for the event request.
pub fn hash_id(&self, derivator: DigestDerivator) -> Result<DigestIdentifier, SubjectError>
derivator
DigestDerivator
required
The digest derivator algorithm to use for hashing
Returns: A Result containing the DigestIdentifier on success or a SubjectError on failure.

Usage Example

use taple_core::{
    EventRequest, StartRequest, FactRequest,
    DigestIdentifier, KeyIdentifier, ValueWrapper
};
use serde_json::json;

// Create a new subject
let create_request = EventRequest::Create(StartRequest {
    governance_id: DigestIdentifier::default(),
    schema_id: "governance".to_string(),
    namespace: "namespace1".to_string(),
    name: "subject_name".to_string(),
    public_key: KeyIdentifier::default(),
});

// Add a fact to an existing subject
let fact_request = EventRequest::Fact(FactRequest {
    subject_id: DigestIdentifier::from_str("JxT...").unwrap(),
    payload: ValueWrapper(json!({
        "temperature": 25.5,
        "humidity": 60
    })),
});

// Check if evaluation is required
if fact_request.requires_eval_appr() {
    println!("This request requires evaluation and approval");
}

Build docs developers (and LLMs) love