spiral-sdk 0.1.10

Rust SDK for Spiral resource and table APIs
Documentation
// Generated by tools/service-contracts/rust.py. Do not edit.
#![doc = "Transport-independent service interface for local and remote calls."]

use async_trait::async_trait;
use spiral_contract::auth::AuthHeader;
use spiral_contract::call::CallError;
use uuid::Uuid;

use crate::api::connections::objects::*;
/// Service implementations authenticate Authorization headers and enforce resource permissions.
#[async_trait]
pub trait ConnectionsApi: Send + Sync + 'static {
    /// Create a Connection scoped to one Project.
    async fn create_connection(
        &self,
        auth_header: AuthHeader,
        request: CreateConnectionRequest,
    ) -> Result<CreateConnectionResponse, CallError<ConnectionsError>>;
    /// Drop a Connection and remove its stored secret.
    async fn drop_connection(
        &self,
        auth_header: AuthHeader,
        connection_id: Uuid,
    ) -> Result<DropResponse, CallError<ConnectionsError>>;
    /// Read a Connection without exposing its stored secret.
    async fn read_connection(
        &self,
        auth_header: AuthHeader,
        connection_id: Uuid,
    ) -> Result<ConnectionResponse, CallError<ConnectionsError>>;
    /// Test credential vending and provider access. Provider refusals are reported in the response.
    async fn test_connection(
        &self,
        auth_header: AuthHeader,
        connection_id: Uuid,
    ) -> Result<TestResponse, CallError<ConnectionsError>>;
    /// Change the maximum access granted by this Connection. Increasing access first verifies it
    /// with the provider.
    async fn update_allowed_access(
        &self,
        auth_header: AuthHeader,
        connection_id: Uuid,
        request: UpdateAllowedAccessRequest,
    ) -> Result<ConnectionResponse, CallError<ConnectionsError>>;
    /// Replace the entire credential with one for the same provider. Include every required secret.
    async fn update_credential(
        &self,
        auth_header: AuthHeader,
        connection_id: Uuid,
        request: UpdateCredentialRequest,
    ) -> Result<ConnectionResponse, CallError<ConnectionsError>>;
    /// Replace the description. Omit it to clear the description.
    async fn update_description(
        &self,
        auth_header: AuthHeader,
        connection_id: Uuid,
        request: UpdateDescriptionRequest,
    ) -> Result<ConnectionResponse, CallError<ConnectionsError>>;
    /// Obtain a short-lived read credential for a URI within the Connection.
    async fn vend_credential(
        &self,
        auth_header: AuthHeader,
        connection_id: Uuid,
        request: VendRequest,
    ) -> Result<VendResponse, CallError<ConnectionsError>>;
}