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 `notifications` resource — 5 operation(s).
///
/// In-app notifications and read state.
///
/// Reached through [`crate::MisarDev::notifications`].
#[derive(Debug, Clone, Copy)]
pub struct NotificationsResource<'a> {
    pub(crate) t: &'a Transport,
}

impl NotificationsResource<'_> {
    /// `GET /notifications/preferences`
    ///
    /// misardev:method notifications.getPreferences
    pub async fn get_preferences(self) -> Result<Value, MisarDevError> {
        self.t.request(Method::GET, "/notifications/preferences", "", None).await
    }

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

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

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

    /// `PATCH /notifications/preferences`
    ///
    /// misardev:method notifications.updatePreferences
    pub async fn update_preferences(self, body: Option<Value>) -> Result<Value, MisarDevError> {
        self.t.request(Method::PATCH, "/notifications/preferences", "", Some(body_or_empty(body))).await
    }
}