Skip to content

transport

Structs

  • TransportView - Immutable pairing of an [ExecutionEnvelope] and its

Struct

Immutable pairing of an [ExecutionEnvelope] and its [InjectedCredentials], handed to the connector layer as the single input it needs to build the outbound request.

Neither field can be mutated through this view. Connectors read the envelope to derive the request (URL, method, headers, body) and read the credentials to merge injected headers before dispatch.

use std::collections::HashMap;
use firma_core::{InjectedCredentials, TransportView};
# use firma_core::{ActionParams, ExecutionEnvelope, ExecutionIntent,
# ExecutionMetadata, HttpMethod, HttpParams};
# fn envelope() -> ExecutionEnvelope {
# ExecutionEnvelope::new(
# ExecutionIntent {
# action_class: "filesystem.read".to_string(),
# resource: ExecutionIntent::resource_map_from("https://api.example.com"),
# params: ActionParams::Http(HttpParams {
# method: HttpMethod::GET,
# headers: HashMap::new(),
# body: None,
# query: HashMap::new(),
# }),
# raw_transport: "https".to_string(),
# raw_action_ref: "GET /".to_string(),
# },
# "v4.public.eyJ0...".to_string(),
# ExecutionMetadata {
# session_id: "sess_001".parse().unwrap(),
# agent_id: "agent_abc".parse().unwrap(),
# timestamp: chrono::Utc::now(),
# trace_id: None,
# budget_consumed: 0.0,
# risk_score: None,
# },
# None,
# )
# }
let view = TransportView::new(envelope(), InjectedCredentials::empty());
assert!(view.credentials().is_empty());

Methods:

  • fn new(envelope: ExecutionEnvelope, credentials: InjectedCredentials) -> Self - Creates a new [TransportView] from an envelope and its
  • fn envelope(self: &Self) -> &ExecutionEnvelope - Returns a reference to the enforced [ExecutionEnvelope].
  • fn credentials(self: &Self) -> &InjectedCredentials - Returns a reference to the [InjectedCredentials].

Trait Implementations:

  • Debug
    • fn fmt(self: &Self, f: & mut $crate::fmt::Formatter) -> $crate::fmt::Result
  • Clone
    • fn clone(self: &Self) -> TransportView