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

/// The `billing` resource — 5 operation(s).
///
/// Plans, plan comparison, subscription, checkout, plan switch.
///
/// Reached through [`crate::MisarDev::billing`].
#[derive(Debug, Clone, Copy)]
pub struct BillingResource<'a> {
    pub(crate) t: &'a Transport,
}

impl BillingResource<'_> {
    /// `POST /billing/checkout`
    ///
    /// misardev:method billing.checkout
    pub async fn checkout(self, body: Option<Value>) -> Result<Value, MisarDevError> {
        self.t.request(Method::POST, "/billing/checkout", "", Some(body_or_empty(body))).await
    }

    /// `GET /billing/comparison`
    ///
    /// Public — works without a key, but the client still sends it.
    ///
    /// misardev:method billing.comparison
    pub async fn comparison(self) -> Result<Value, MisarDevError> {
        self.t.request(Method::GET, "/billing/comparison", "", None).await
    }

    /// `GET /billing/plans`
    ///
    /// Public — works without a key, but the client still sends it.
    ///
    /// misardev:method billing.plans
    pub async fn plans(self) -> Result<Value, MisarDevError> {
        self.t.request(Method::GET, "/billing/plans", "", None).await
    }

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

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