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 ¬es {
println!("- {} ({})", n.title, n.id);
}Requires a tokio runtime.
§Feature flags
cli(default) — builds thehackmdbinary and theclimodule.tui— enableshackmd tui(impliescli): a full terminal markdown reader/browser/editor (the merged md-tui v0.3.0) with HackMD cloud mode behind theH/ghkeybind — browse, read, edit, publish, push and download notes.
With default-features = false you get a pure async SDK with no clap /
comfy-table / ratatui / 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 markdown reader/editor, ported from md-tui v0.3.0 (zemse/md-tui @ d724187).
- types
- Data types mirroring the HackMD HTTP API.