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

/// The `highlights` resource — 6 operation(s).
///
/// Story highlights on a profile: create, edit, delete, add and remove stories.
///
/// Reached through [`crate::MisarDev::highlights`].
#[derive(Debug, Clone, Copy)]
pub struct HighlightsResource<'a> {
    pub(crate) t: &'a Transport,
}

impl HighlightsResource<'_> {
    /// `POST /highlights/:id/items`
    ///
    /// misardev:method highlights.addStory
    pub async fn add_story(self, id: &str, body: Option<Value>) -> Result<Value, MisarDevError> {
        self.t.request(Method::POST, &format!("/highlights/{}/items", encode_path(id)), "", Some(body_or_empty(body))).await
    }

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

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

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

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

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