Skip to main content

Crate hackmd

Crate hackmd 

Source
Expand description

HackMD API client for Rust.

Async client for the HackMD HTTP API (mirrors @hackmd/api).

§Quick start

let client = hackmd::Client::new(std::env::var("HMD_API_ACCESS_TOKEN").unwrap())?;
let me = client.me().await?;
println!("hello {}", me.name);

// List the authenticated user's notes (may be empty).
let notes = client.notes().await?;
for n in &notes {
    println!("- {} ({})", n.title, n.id);
}

Requires a tokio runtime.

§Feature flags

  • cli (default) — builds the hackmd binary and the cli module.
  • tui — enables the hackmd tui subcommand (implies cli).

With default-features = false you get a pure async SDK with no clap / comfy-table / etc. dependencies pulled into the binary.

Re-exports§

pub use client::CachedResponse;
pub use client::Client;
pub use client::ClientConfig;
pub use client::DEFAULT_ENDPOINT;
pub use client::RetryConfig;
pub use error::Error;
pub use error::Result;
pub use types::ApiFolder;
pub use types::ApiFolderOrder;
pub use types::CommentPermissionType;
pub use types::CreateNoteOptions;
pub use types::CreateTeamFolderBody;
pub use types::CreateUserFolderBody;
pub use types::FolderPath;
pub use types::Note;
pub use types::NotePermissionRole;
pub use types::NotePublishType;
pub use types::SimpleUserProfile;
pub use types::SingleNote;
pub use types::Team;
pub use types::TeamVisibilityType;
pub use types::UpdateFolderOrderBody;
pub use types::UpdateNoteOptions;
pub use types::UpdateTeamFolderBody;
pub use types::UpdateUserFolderBody;
pub use types::User;

Modules§

api
HackMD HTTP API endpoint surface.
cli
Clap-based CLI surface mirroring @hackmd/hackmd-cli.
client
HTTP client + retry + ETag + rate-limit plumbing.
error
Error types for the HackMD SDK.
tui
Terminal UI for browsing and editing HackMD notes.
types
Data types mirroring the HackMD HTTP API.