Skip to content

Commit 412a754

Browse files
authored
Merge pull request #11 from hackmdio/feature/add-list-api
List note
2 parents 1735e89 + 8166db0 commit 412a754

File tree

4 files changed

+21
-331
lines changed

4 files changed

+21
-331
lines changed

nodejs/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

nodejs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@hackmd/api",
3-
"version": "1.1.1",
3+
"version": "1.2.0",
44
"description": "HackMD/CodiMD Node.js API Client",
55
"main": "dist/index.js",
66
"declaration": "./dist/index.d.ts",

nodejs/src/index.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,25 @@ class API {
156156
throw new Error('Create note failed')
157157
}
158158
}
159+
160+
async listNotes () {
161+
// https://hackmd.io/api/overview?v=1627369059523
162+
if (this.enterprise) {
163+
const response = await this.fetch(url.resolve(this.serverUrl, 'api/overview'), this.defaultFetchOptions)
164+
165+
return response.json()
166+
} else {
167+
throw new Error('Not support')
168+
}
169+
}
170+
171+
async listTeamNotes (teamPath: string) {
172+
if (this.enterprise) {
173+
return this.fetch(url.resolve(this.serverUrl, `api/overview/team/${teamPath}`), this.defaultFetchOptions).then(res => res.json())
174+
} else {
175+
throw new Error('Not support')
176+
}
177+
}
159178

160179
private async exportRes(noteId: string, type: ExportType) {
161180
let res: Response

nodejs/yarn.lock

Lines changed: 0 additions & 329 deletions
This file was deleted.

0 commit comments

Comments
 (0)