misardev 1.1.0

Async Rust client for the Misar.Dev API: create projects, write files, build and deploy, start from templates, run OpenAI-compatible chat completions, search code and read usage. Retries, typed plan-limit errors, SSE streaming.
Documentation
// GENERATED by scripts/generate-sdk-resources.mjs from sdks/manifest.json.
// Do not edit by hand — change the route, run `pnpm sdk:sync`, and regenerate.

use crate::error::MisarDevError;
use crate::transport::Transport;
use crate::transport::body_or_empty;
use crate::transport::build_query;
use reqwest::Method;
use serde_json::Value;

/// The `rag` resource — 3 operation(s).
///
/// Index a project's code for semantic search, query it, clear it.
///
/// Reached through [`crate::MisarDev::rag`].
#[derive(Debug, Clone, Copy)]
pub struct RagResource<'a> {
    pub(crate) t: &'a Transport,
}

impl RagResource<'_> {
    /// `DELETE /rag`
    ///
    /// misardev:method rag.clear
    pub async fn clear(self, project_id: &str) -> Result<Value, MisarDevError> {
        self.t.request(Method::DELETE, "/rag", &build_query(None, &[("projectId", project_id)]), None).await
    }

    /// `POST /rag`
    ///
    /// misardev:method rag.index
    pub async fn index(self, body: Option<Value>) -> Result<Value, MisarDevError> {
        self.t.request(Method::POST, "/rag", "", Some(body_or_empty(body))).await
    }

    /// `GET /rag`
    ///
    /// Optional query: `query`, `stats`.
    ///
    /// misardev:method rag.search
    pub async fn search(self, project_id: &str, query: Option<Value>) -> Result<Value, MisarDevError> {
        self.t.request(Method::GET, "/rag", &build_query(query.as_ref(), &[("projectId", project_id)]), None).await
    }
}