pub struct BridgeClient { /* private fields */ }Expand description
A client bound to one running bridge’s control plane.
Implementations§
Source§impl BridgeClient
impl BridgeClient
Sourcepub fn new(control_port: u16, token: String) -> Self
pub fn new(control_port: u16, token: String) -> Self
Builds a client targeting the control plane on control_port, using
token for bearer auth.
Sourcepub fn request_builder(&self, payload: &ControlRequest) -> RequestBuilder
pub fn request_builder(&self, payload: &ControlRequest) -> RequestBuilder
Builds the authenticated POST /__bridge/request request for payload,
without sending it. Callers that need the raw streamed response (e.g. the
request --stream path) drive this builder themselves.
Carries this process’s request-log invocation_id on the
auth::BRIDGE_ORIGIN_HEADER so daemon-hosted (or standalone) bridge HTTP
records correlate back to the originating CLI invocation (#1198). This
covers every BridgeClient caller — request and harvest alike.
Sourcepub async fn send(&self, payload: &ControlRequest) -> Result<ResponseEnvelope>
pub async fn send(&self, payload: &ControlRequest) -> Result<ResponseEnvelope>
Sends a buffered request and returns the parsed response envelope.
Errors when the bridge is unreachable, returns a non-success status, or
returns a body that is not a ResponseEnvelope.