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 `usage` resource — 3 operation(s).
///
/// Usage for a period, your plan's allowances, and usage events.
///
/// Reached through [`crate::MisarDev::usage`].
#[derive(Debug, Clone, Copy)]
pub struct UsageResource<'a> {
    pub(crate) t: &'a Transport,
}

impl UsageResource<'_> {
    /// `GET /usage`
    ///
    /// Optional query: `analytics`, `days`, `format`.
    ///
    /// misardev:method usage.list
    pub async fn list(self, query: Option<Value>) -> Result<Value, MisarDevError> {
        self.t.request(Method::GET, "/usage", &build_query(query.as_ref(), &[]), None).await
    }

    /// `GET /usage/plan`
    ///
    /// misardev:method usage.plan
    pub async fn plan(self) -> Result<Value, MisarDevError> {
        self.t.request(Method::GET, "/usage/plan", "", None).await
    }

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