HackMD Rust API Client
🦀📝 A Rust client library for the HackMD API.
You can sign up for an account at hackmd.io, and then create access tokens by following the developer portal.
Features
- ✅ Complete API coverage (User, Notes, Teams)
- ✅ Async/await support with
tokio - ✅ Retry mechanism with exponential backoff
- ✅ Comprehensive error handling & Type-safe request/response
Installation
Quick Start
use ;
use CreateNoteOptions;
async
Configuration
You can customize the client behavior with ApiClientOptions:
use ;
use Duration;
let options = ApiClientOptions ;
let client = new?;
API Methods
User API
get_me()- Get current user informationget_history()- Get user's note historyget_note_list()- Get user's notesget_note(note_id)- Get a specific notecreate_note(options)- Create a new noteupdate_note(note_id, options)- Update a noteupdate_note_content(note_id, content)- Update note content onlydelete_note(note_id)- Delete a note
Team API
get_teams()- Get user's teamsget_team_notes(team_path)- Get team's notescreate_team_note(team_path, options)- Create a team noteupdate_team_note(team_path, note_id, options)- Update a team noteupdate_team_note_content(team_path, note_id, content)- Update team note contentdelete_team_note(team_path, note_id)- Delete a team note
Error Handling
The client provides comprehensive error handling with custom error types:
use ApiError;
match client.get_me.await
Examples
Run the basic usage example:
[!NOTE] Make sure to set your HackMD access token in the example code before running.
advanced usage example:
Types
All API types are available in the types module:
User- User informationTeam- Team informationNote- Note metadataSingleNote- Note with contentCreateNoteOptions- Options for creating notesUpdateNoteOptions- Options for updating notes- Various enums for permissions and visibility
License
MIT License