reasoninglayer 0.1.1

Rust client SDK for the Reasoning Layer API
Documentation
//! Sort-driven UI descriptor operations.

use crate::error::Error;
use crate::http::HttpClient;
use crate::types::common::RequestOptions;
use crate::types::ui::{
    UIActionRequest, UIActionResponse, UICatalogResponse, UIDescribeRequest, UIDescribeResponse,
};

#[derive(Debug, Clone)]
pub struct UiClient {
    http: HttpClient,
}

impl UiClient {
    pub(crate) fn new(http: HttpClient) -> Self {
        Self { http }
    }

    pub async fn describe(
        &self,
        request: UIDescribeRequest,
        options: Option<&RequestOptions>,
    ) -> Result<UIDescribeResponse, Error> {
        self.http.post("/ui/describe", &request, options).await
    }

    pub async fn execute_action(
        &self,
        request: UIActionRequest,
        options: Option<&RequestOptions>,
    ) -> Result<UIActionResponse, Error> {
        self.http.post("/ui/action", &request, options).await
    }

    pub async fn catalog(
        &self,
        options: Option<&RequestOptions>,
    ) -> Result<UICatalogResponse, Error> {
        self.http.get("/ui/catalog", None, options).await
    }
}