pub struct NbClient { /* private fields */ }Expand description
Client for invoking nb commands.
Implementations§
Source§impl NbClient
impl NbClient
Sourcepub fn new(config: &Config) -> Result<Self>
pub fn new(config: &Config) -> Result<Self>
Creates a new nb client.
Uses the notebook from config if set, otherwise falls back to a
Git-derived notebook name. Does NOT read NB_MCP_NOTEBOOK —
that is an MCP-server-specific env var resolved by the server.
Sourcepub async fn status(&self, notebook: Option<&str>) -> Result<String, NbError>
pub async fn status(&self, notebook: Option<&str>) -> Result<String, NbError>
Returns status information about the resolved notebook.
Sourcepub async fn notebook_path(
&self,
notebook: Option<&str>,
) -> Result<PathBuf, NbError>
pub async fn notebook_path( &self, notebook: Option<&str>, ) -> Result<PathBuf, NbError>
Returns the path for a notebook.
Sourcepub async fn add(
&self,
title: Option<&str>,
content: &str,
tags: &[String],
folder: Option<&str>,
notebook: Option<&str>,
) -> Result<String, NbError>
pub async fn add( &self, title: Option<&str>, content: &str, tags: &[String], folder: Option<&str>, notebook: Option<&str>, ) -> Result<String, NbError>
Creates a new note.
Sourcepub async fn show(
&self,
id: &str,
notebook: Option<&str>,
) -> Result<String, NbError>
pub async fn show( &self, id: &str, notebook: Option<&str>, ) -> Result<String, NbError>
Shows a note’s content.
Sourcepub async fn list(
&self,
folder: Option<&str>,
tags: &[String],
limit: Option<u32>,
notebook: Option<&str>,
) -> Result<String, NbError>
pub async fn list( &self, folder: Option<&str>, tags: &[String], limit: Option<u32>, notebook: Option<&str>, ) -> Result<String, NbError>
Lists notes in a notebook or folder.
Sourcepub async fn search(
&self,
queries: &[String],
mode: SearchMode,
tags: &[String],
folder: Option<&str>,
notebook: Option<&str>,
) -> Result<String, NbError>
pub async fn search( &self, queries: &[String], mode: SearchMode, tags: &[String], folder: Option<&str>, notebook: Option<&str>, ) -> Result<String, NbError>
Searches notes.
Sourcepub async fn edit(
&self,
id: &str,
content: &str,
mode: EditMode,
notebook: Option<&str>,
) -> Result<String, NbError>
pub async fn edit( &self, id: &str, content: &str, mode: EditMode, notebook: Option<&str>, ) -> Result<String, NbError>
Edits a note using the provided content mode.
Sourcepub async fn delete(
&self,
id: &str,
notebook: Option<&str>,
) -> Result<String, NbError>
pub async fn delete( &self, id: &str, notebook: Option<&str>, ) -> Result<String, NbError>
Deletes a note.
Sourcepub async fn move_note(
&self,
id: &str,
destination: &str,
notebook: Option<&str>,
) -> Result<String, NbError>
pub async fn move_note( &self, id: &str, destination: &str, notebook: Option<&str>, ) -> Result<String, NbError>
Moves or renames a note.
Sourcepub async fn todo(
&self,
title: &str,
description: Option<&str>,
tasks: &[String],
tags: &[String],
folder: Option<&str>,
notebook: Option<&str>,
) -> Result<String, NbError>
pub async fn todo( &self, title: &str, description: Option<&str>, tasks: &[String], tags: &[String], folder: Option<&str>, notebook: Option<&str>, ) -> Result<String, NbError>
Creates a todo item.
Sourcepub async fn do_task(
&self,
id: &str,
task_number: Option<u32>,
notebook: Option<&str>,
) -> Result<String, NbError>
pub async fn do_task( &self, id: &str, task_number: Option<u32>, notebook: Option<&str>, ) -> Result<String, NbError>
Marks a todo as done.
Sourcepub async fn undo_task(
&self,
id: &str,
task_number: Option<u32>,
notebook: Option<&str>,
) -> Result<String, NbError>
pub async fn undo_task( &self, id: &str, task_number: Option<u32>, notebook: Option<&str>, ) -> Result<String, NbError>
Marks a todo as not done.
Sourcepub async fn tasks(
&self,
folder: Option<&str>,
status: Option<TaskStatus>,
recursive: bool,
notebook: Option<&str>,
) -> Result<String, NbError>
pub async fn tasks( &self, folder: Option<&str>, status: Option<TaskStatus>, recursive: bool, notebook: Option<&str>, ) -> Result<String, NbError>
Lists todos.
Sourcepub async fn bookmark(
&self,
url: &str,
title: Option<&str>,
tags: &[String],
comment: Option<&str>,
folder: Option<&str>,
notebook: Option<&str>,
) -> Result<String, NbError>
pub async fn bookmark( &self, url: &str, title: Option<&str>, tags: &[String], comment: Option<&str>, folder: Option<&str>, notebook: Option<&str>, ) -> Result<String, NbError>
Creates a bookmark.
Sourcepub async fn folders(
&self,
parent: Option<&str>,
notebook: Option<&str>,
) -> Result<String, NbError>
pub async fn folders( &self, parent: Option<&str>, notebook: Option<&str>, ) -> Result<String, NbError>
Lists folders in a notebook.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for NbClient
impl RefUnwindSafe for NbClient
impl Send for NbClient
impl Sync for NbClient
impl Unpin for NbClient
impl UnsafeUnpin for NbClient
impl UnwindSafe for NbClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more