Skip to content

Commit 4e52ba7

Browse files
authored
Merge pull request #18 from hackmdio/develop
v2.0.0
2 parents 412a754 + 5f9cdb1 commit 4e52ba7

File tree

9 files changed

+3019
-501
lines changed

9 files changed

+3019
-501
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# HackMD API Clients
22

3+
This repository contains a set of packages for interacting with the [HackMD API](https://hackmd.io/).
4+
35
## Node.JS
46

57
See [README](./nodejs)

nodejs/.eslintrc.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
const path = require('path')
2+
3+
module.exports = {
4+
"parser": "@typescript-eslint/parser",
5+
"extends": [
6+
"eslint:recommended",
7+
"plugin:@typescript-eslint/recommended"
8+
],
9+
"rules": {
10+
"no-trailing-spaces": ["warn", { "skipBlankLines": false }],
11+
"semi": ["warn", "never"],
12+
"@typescript-eslint/no-non-null-assertion": "off",
13+
"keyword-spacing": ["warn", {"before": true, "after": true}],
14+
"space-infix-ops": "warn",
15+
"space-before-function-paren": "warn",
16+
"eol-last": ["error", "always"]
17+
},
18+
"parserOptions": {
19+
"project": [
20+
path.resolve(__dirname, "tsconfig.json")
21+
]
22+
},
23+
"ignorePatterns": [
24+
".eslintrc.js"
25+
],
26+
}

nodejs/README.md

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,41 @@
11
# HackMD Node.js API Client
22

3+
![npm](https://img.shields.io/npm/v/@hackmd/api)
4+
5+
## About
6+
7+
This is a Node.js client for the [HackMD API](https://hackmd.io/).
8+
9+
You can sign up for an account at [hackmd.io](https://hackmd.io/), and then create access tokens for your projects by following the [HackMD API documentation](https://hackmd.io/@hackmd-api/developer-portal).
10+
11+
For bugs and feature requests, please open an issue or pull request on [GitHub](https://github.com/hackmdio/api-client).
12+
13+
## **v2.0.0 Update Note**
14+
15+
`v2.0.0` is a completely rewrite and is incompatible with `v1.x.x`. But the best of all, it does not require Node.JS runtime anymore, which means you can use it in a browser. We recommend you to upgrade to `v2.0.0` if you are using the old one.
16+
317
## Installation
418

519
```bash
620
npm install @hackmd/api --save
721
```
822

9-
## Usage
23+
## Example
24+
25+
```javascript
26+
import HackMDAPI from '@hackmd/api'
27+
28+
const client = new HackMDAPI('YOUR_ACCESS_TOKEN' /* required */, 'https://api.hackmd.io/v1' /* optional */)
29+
30+
client.getMe().then(me => {
31+
console.log(me.email)
32+
})
33+
```
34+
35+
## API
36+
37+
See the [code](./src/index.ts) and [typings](./src/type.ts). The API client is written in TypeScript, so you can get auto-completion and type checking in any TypeScript Language Server powered editor or IDE.
38+
39+
## License
1040

11-
TODO
41+
MIT

0 commit comments

Comments
 (0)