tf-types 0.1.8

Core semantic types, traits, and schemas powering the TrustForge protocol.
Documentation
// GENERATED by `tf-schema codegen --target rust` — DO NOT EDIT BY HAND.

#![allow(unused_imports, non_camel_case_types, non_snake_case, clippy::all)]

use serde::{Deserialize, Serialize};
use super::*;

/// One RPC method.
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct Method {
    /// Method name, camelCase or snake_case, starts with a lowercase letter.
    pub name: String,
    /// Streaming mode. unary: one request → one response. server-streaming: one request → many. client-streaming: many → one. bidi-streaming: many ↔ many. subscribe: one subscribe → many events with optional ack. command-channel: long-lived control with backpressure. bulk-transfer: chunked binary with content-hashing. telemetry: push-only with priority class. remote-shell: stdin/stdout stream. agent-session: bidi stream that carries the chain of responsibility. http-bridge: bidi stream that carries HTTP/1.1 or HTTP/2 frames (headers, chunks, trailers) for cross-site proxying.
    pub kind: Method_Kind,
    /// What this method does.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub description: Option<String>,
    /// Inline JSON Schema describing the request body. Must be type:object with properties.
    pub request: serde_json::Value,
    /// Inline JSON Schema describing the response body (or stream element for server-streaming).
    pub response: serde_json::Value,
    /// Name of the TrustForge capability required to invoke.
    pub capability: ActionName,
    /// Risk class assigned to this method.
    pub risk: RiskClass,
    /// Proof level at which successful calls are emitted.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub proof: Option<ProofLevel>,
    /// Approval requirement for invocations; defaults to none.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub approval: Option<ApprovalRequirement>,
    /// Names of policy hooks the daemon must consult before this method runs.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub policy_hooks: Option<Vec<String>>,
    /// Optional human-readable denial reason if the method is forbidden in this trust domain.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub denial: Option<String>,
    /// Priority class for streaming methods (TF-0011).
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub streaming_priority: Option<Method_StreamingPriority>,
    /// Conformance vector files this method participates in.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub conformance_tests: Option<Vec<String>>,
}

/// Streaming mode. unary: one request → one response. server-streaming: one request → many. client-streaming: many → one. bidi-streaming: many ↔ many. subscribe: one subscribe → many events with optional ack. command-channel: long-lived control with backpressure. bulk-transfer: chunked binary with content-hashing. telemetry: push-only with priority class. remote-shell: stdin/stdout stream. agent-session: bidi stream that carries the chain of responsibility. http-bridge: bidi stream that carries HTTP/1.1 or HTTP/2 frames (headers, chunks, trailers) for cross-site proxying.
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub enum Method_Kind {
    #[serde(rename = "unary")]
    Unary,
    #[serde(rename = "server-streaming")]
    ServerStreaming,
    #[serde(rename = "client-streaming")]
    ClientStreaming,
    #[serde(rename = "bidi-streaming")]
    BidiStreaming,
    #[serde(rename = "subscribe")]
    Subscribe,
    #[serde(rename = "command-channel")]
    CommandChannel,
    #[serde(rename = "bulk-transfer")]
    BulkTransfer,
    #[serde(rename = "telemetry")]
    Telemetry,
    #[serde(rename = "remote-shell")]
    RemoteShell,
    #[serde(rename = "agent-session")]
    AgentSession,
    #[serde(rename = "http-bridge")]
    HttpBridge,
}

/// Priority class for streaming methods (TF-0011).
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub enum Method_StreamingPriority {
    #[serde(rename = "P0")]
    P0,
    #[serde(rename = "P1")]
    P1,
    #[serde(rename = "P2")]
    P2,
    #[serde(rename = "P3")]
    P3,
    #[serde(rename = "P4")]
    P4,
    #[serde(rename = "P5")]
    P5,
}

/// Declarative RPC service definition consumed by tf-schema codegen --target rpc-ts|rpc-rust. See TF-0007.
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct Proofrpc {
    /// Version of the proofrpc service descriptor schema.
    pub rpc_version: Proofrpc_RpcVersion,
    /// PascalCase service identifier used by generated client and server types.
    pub service_id: String,
    /// Human-readable description of the service.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub description: Option<String>,
    /// Methods exposed by this service.
    pub methods: Vec<Method>,
}

/// Version of the proofrpc service descriptor schema.
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub enum Proofrpc_RpcVersion {
    #[serde(rename = "1")]
    V1,
}