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::encode_path;
use reqwest::Method;
use serde_json::Value;

/// The `checkpoints` resource — 3 operation(s).
///
/// Saved project snapshots: rename, restore, delete.
///
/// Reached through [`crate::MisarDev::checkpoints`].
#[derive(Debug, Clone, Copy)]
pub struct CheckpointsResource<'a> {
    pub(crate) t: &'a Transport,
}

impl CheckpointsResource<'_> {
    /// `DELETE /checkpoints/:id`
    ///
    /// misardev:method checkpoints.delete
    pub async fn delete(self, id: &str) -> Result<Value, MisarDevError> {
        self.t.request(Method::DELETE, &format!("/checkpoints/{}", encode_path(id)), "", None).await
    }

    /// `POST /checkpoints/:id/restore`
    ///
    /// misardev:method checkpoints.restore
    pub async fn restore(self, id: &str) -> Result<Value, MisarDevError> {
        self.t.request(Method::POST, &format!("/checkpoints/{}/restore", encode_path(id)), "", None).await
    }

    /// `PATCH /checkpoints/:id`
    ///
    /// misardev:method checkpoints.update
    pub async fn update(self, id: &str, body: Option<Value>) -> Result<Value, MisarDevError> {
        self.t.request(Method::PATCH, &format!("/checkpoints/{}", encode_path(id)), "", Some(body_or_empty(body))).await
    }
}