spiral-sdk 0.1.7

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 crate::api::authorization::objects::*;
/// Service implementations authenticate Authorization headers and enforce resource permissions.
#[async_trait]
pub trait AuthorizationApi: Send + Sync + 'static {
    /// Approve requested resource permissions as an authorized resource owner.
    async fn approve_installation(
        &self,
        auth_header: AuthHeader,
        installation_id: String,
    ) -> Result<ReviewResponse, CallError<AuthorizationError>>;
    /// Grant a Project role with project grant role permission.
    async fn grant_role(
        &self,
        auth_header: AuthHeader,
        project_id: String,
        request: GrantRoleRequest,
    ) -> Result<GrantResponse, CallError<AuthorizationError>>;
    /// List active Project role grants with project view grants permission. Revoked grants are
    /// excluded.
    async fn list_grants(
        &self,
        auth_header: AuthHeader,
        project_id: String,
        request: ListGrantsRequest,
    ) -> Result<GrantPage, CallError<AuthorizationError>>;
    /// Read a role grant by its durable ID with project view grants permission, including revoked
    /// grants.
    async fn read_grant(
        &self,
        auth_header: AuthHeader,
        grant_id: String,
    ) -> Result<Grant, CallError<AuthorizationError>>;
    /// Read an installation and its requested resource permissions as an authorized resource owner.
    async fn read_installation(
        &self,
        auth_header: AuthHeader,
        installation_id: String,
    ) -> Result<InstallationResponse, CallError<AuthorizationError>>;
    /// Reject requested resource permissions as an authorized resource owner.
    async fn reject_installation(
        &self,
        auth_header: AuthHeader,
        installation_id: String,
    ) -> Result<ReviewResponse, CallError<AuthorizationError>>;
    /// Review requested resource permissions as an authorized resource owner.
    async fn review_installation(
        &self,
        auth_header: AuthHeader,
        installation_id: String,
        request: ReviewRequest,
    ) -> Result<ReviewResponse, CallError<AuthorizationError>>;
    /// Revoke a Project role grant with project grant role permission.
    async fn revoke_grant(
        &self,
        auth_header: AuthHeader,
        grant_id: String,
    ) -> Result<(), CallError<AuthorizationError>>;
}