Skip to content

Commit

Permalink
Merge pull request #18 from hackmdio/develop
Browse files Browse the repository at this point in the history
v2.0.0
  • Loading branch information
Yukaii authored Mar 2, 2022
2 parents 412a754 + 5f9cdb1 commit 4e52ba7
Show file tree
Hide file tree
Showing 9 changed files with 3,019 additions and 501 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# HackMD API Clients

This repository contains a set of packages for interacting with the [HackMD API](https://hackmd.io/).

## Node.JS

See [README](./nodejs)
Expand Down
26 changes: 26 additions & 0 deletions nodejs/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
const path = require('path')

module.exports = {
"parser": "@typescript-eslint/parser",
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended"
],
"rules": {
"no-trailing-spaces": ["warn", { "skipBlankLines": false }],
"semi": ["warn", "never"],
"@typescript-eslint/no-non-null-assertion": "off",
"keyword-spacing": ["warn", {"before": true, "after": true}],
"space-infix-ops": "warn",
"space-before-function-paren": "warn",
"eol-last": ["error", "always"]
},
"parserOptions": {
"project": [
path.resolve(__dirname, "tsconfig.json")
]
},
"ignorePatterns": [
".eslintrc.js"
],
}
34 changes: 32 additions & 2 deletions nodejs/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,41 @@
# HackMD Node.js API Client

![npm](https://img.shields.io/npm/v/@hackmd/api)

## About

This is a Node.js client for the [HackMD API](https://hackmd.io/).

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).

For bugs and feature requests, please open an issue or pull request on [GitHub](https://github.com/hackmdio/api-client).

## **v2.0.0 Update Note**

`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.

## Installation

```bash
npm install @hackmd/api --save
```

## Usage
## Example

```javascript
import HackMDAPI from '@hackmd/api'

const client = new HackMDAPI('YOUR_ACCESS_TOKEN' /* required */, 'https://api.hackmd.io/v1' /* optional */)

client.getMe().then(me => {
console.log(me.email)
})
```

## API

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.

## License

TODO
MIT
Loading

0 comments on commit 4e52ba7

Please sign in to comment.