misardev 1.0.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::build_query;
use crate::transport::encode_path;
use reqwest::Method;
use serde_json::Value;

/// The `gallery` resource — 3 operation(s).
///
/// The public community gallery, and likes.
///
/// Reached through [`crate::MisarDev::gallery`].
#[derive(Debug, Clone, Copy)]
pub struct GalleryResource<'a> {
    pub(crate) t: &'a Transport,
}

impl GalleryResource<'_> {
    /// `POST /gallery/:projectId/like`
    ///
    /// misardev:method gallery.like
    pub async fn like(self, project_id: &str) -> Result<Value, MisarDevError> {
        self.t.request(Method::POST, &format!("/gallery/{}/like", encode_path(project_id)), "", None).await
    }

    /// `GET /gallery`
    ///
    /// Public — works without a key, but the client still sends it.
    ///
    /// Optional query: `limit`, `offset`, `q`, `search`.
    ///
    /// misardev:method gallery.list
    pub async fn list(self, query: Option<Value>) -> Result<Value, MisarDevError> {
        self.t.request(Method::GET, "/gallery", &build_query(query.as_ref(), &[]), None).await
    }

    /// `DELETE /gallery/:projectId/like`
    ///
    /// misardev:method gallery.unlike
    pub async fn unlike(self, project_id: &str) -> Result<Value, MisarDevError> {
        self.t.request(Method::DELETE, &format!("/gallery/{}/like", encode_path(project_id)), "", None).await
    }
}