Skip to main content

NbClient

Struct NbClient 

Source
pub struct NbClient { /* private fields */ }
Expand description

Client for invoking nb commands.

Implementations§

Source§

impl NbClient

Source

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.

Source

pub async fn status(&self, notebook: Option<&str>) -> Result<String, NbError>

Returns status information about the resolved notebook.

Source

pub async fn notebooks(&self) -> Result<String, NbError>

Lists available notebooks.

Source

pub async fn notebook_path( &self, notebook: Option<&str>, ) -> Result<PathBuf, NbError>

Returns the path for a notebook.

Source

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.

Source

pub async fn show( &self, id: &str, notebook: Option<&str>, ) -> Result<String, NbError>

Shows a note’s content.

Source

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.

Source

pub async fn search( &self, queries: &[String], mode: SearchMode, tags: &[String], folder: Option<&str>, notebook: Option<&str>, ) -> Result<String, NbError>

Searches notes.

Source

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.

Source

pub async fn delete( &self, id: &str, notebook: Option<&str>, ) -> Result<String, NbError>

Deletes a note.

Source

pub async fn move_note( &self, id: &str, destination: &str, notebook: Option<&str>, ) -> Result<String, NbError>

Moves or renames a note.

Source

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.

Source

pub async fn do_task( &self, id: &str, task_number: Option<u32>, notebook: Option<&str>, ) -> Result<String, NbError>

Marks a todo as done.

Source

pub async fn undo_task( &self, id: &str, task_number: Option<u32>, notebook: Option<&str>, ) -> Result<String, NbError>

Marks a todo as not done.

Source

pub async fn tasks( &self, folder: Option<&str>, status: Option<TaskStatus>, recursive: bool, notebook: Option<&str>, ) -> Result<String, NbError>

Lists todos.

Source

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.

Source

pub async fn folders( &self, parent: Option<&str>, notebook: Option<&str>, ) -> Result<String, NbError>

Lists folders in a notebook.

Source

pub async fn mkdir( &self, path: &str, notebook: Option<&str>, ) -> Result<String, NbError>

Creates a folder.

Source

pub async fn import( &self, source: &str, folder: Option<&str>, filename: Option<&str>, convert: bool, notebook: Option<&str>, ) -> Result<String, NbError>

Imports a file or URL into the notebook.

Trait Implementations§

Source§

impl Clone for NbClient

Source§

fn clone(&self) -> NbClient

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more