https://github.com/louis70109/hackmd-sdk-python
Type-safe Python SDK for HackMD developer
https://github.com/louis70109/hackmd-sdk-python
Last synced: 3 months ago
JSON representation
Type-safe Python SDK for HackMD developer
- Host: GitHub
- URL: https://github.com/louis70109/hackmd-sdk-python
- Owner: louis70109
- License: mit
- Created: 2022-11-10T16:04:25.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-11-12T14:39:12.000Z (over 2 years ago)
- Last Synced: 2025-01-30T22:36:44.526Z (4 months ago)
- Language: Python
- Size: 53.7 KB
- Stars: 8
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# HackMD Python SDK
[](https://opensource.org/licenses/MIT)
[](https://github.com/louis70109/line-notify#contributing)
[](https://badge.fury.io/py/lotify)It is a Type-Safe Python SDK which can enhance your HackMD development.
# Usage
```shell
pip install hackmd-sdk-python# or
python setup.py install
```## Get Me example
```python
from hackmd.client import Hackmdhack = Hackmd(token="YOUR_TOKEN")
me = hack.get_me()print(me.teams[0].name) # Your team name
print(me.name) # Your HackMD name
```## Create Note example
```python
from hackmd.client import Hackmd
from hackmd.typing.notes import NoteCreatehack = Hackmd(token="YOUR_TOKEN")
note = NoteCreate(**{
'title': 'New Post',
'content': 'I am Content',
'read_permission': 'owner',
'write_permission': 'owner',
'comment_permission': 'everyone',})
result = hack.create_note(body=note)
print(result)
```# Methods
> [Authentication](https://hackmd.io/@hackmd-api/developer-portal/https%3A%2F%2Fhackmd.io%2F%40hackmd-api%2Fapi-authorization): X-HackMD-API-Version: 1.0.0
## [User](https://hackmd.io/@hackmd-api/developer-portal/https%3A%2F%2Fhackmd.io%2F%40hackmd-api%2Fuser-api)- get_me()
- return: Me()
## [User Note](https://hackmd.io/@hackmd-api/developer-portal/https%3A%2F%2Fhackmd.io%2F%40hackmd-api%2Fuser-notes-api)- get_notes()
- return: List[Notes]
- get_note(note_id=note_id)
- return: Note()
- create_note(body=NoteCreate())
- return: Note()
- Note:
- If Title ✅ and Content ❌, Title ✅
- If Title ✅ and Content ✅, Title ❌
- If Title ❌ and Content ✅, Title ✅ (Parse by Content)
- update_note(note_id=note_id, body=NoteUpdate())
- return: Note()
- delete_note(note_id=note_id)
- return: ''
- get_read_notes_history()
- return: List[Notes]# Development
```shell
git clone
cd hackmd-sdk-python/
pythom -m pytest tests/
```# License
[MIT](https://github.com/louis70109/hackmd-sdk-python/blob/master/LICENSE)