Skip to content

Commit

Permalink
Merge pull request #20 from hackmdio:feature/update-note
Browse files Browse the repository at this point in the history
Update note api
  • Loading branch information
Yukaii authored Jul 29, 2022
2 parents 29f1cf6 + deb0f72 commit 23ba43c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
4 changes: 2 additions & 2 deletions nodejs/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion nodejs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hackmd/api",
"version": "2.0.0",
"version": "2.1.0",
"description": "HackMD Node.js API Client",
"main": "dist/index.js",
"declaration": "./dist/index.d.ts",
Expand Down
8 changes: 8 additions & 0 deletions nodejs/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ export default class API {
await this.axios.patch<AxiosResponse>(`notes/${noteId}`, { content })
}

async updateNote (noteId: string, options: Pick<SingleNote, 'content' | 'readPermission' | 'writePermission'>): Promise<AxiosResponse> {
return await this.axios.patch<AxiosResponse>(`notes/${noteId}`, options)
}

async deleteNote (noteId: string): Promise<DeleteUserNote> {
await this.axios.delete<AxiosResponse>(`notes/${noteId}`)
}
Expand All @@ -105,6 +109,10 @@ export default class API {
await this.axios.patch<AxiosResponse>(`teams/${teamPath}/notes/${noteId}`, { content })
}

async updateTeamNote (teamPath: string, noteId: string, options: Pick<SingleNote, 'content' | 'readPermission' | 'writePermission'>): Promise<AxiosResponse> {
return await this.axios.patch<AxiosResponse>(`teams/${teamPath}/notes/${noteId}`, options)
}

async deleteTeamNote (teamPath: string, noteId: string): Promise<DeleteTeamNote> {
await this.axios.delete<AxiosResponse>(`teams/${teamPath}/notes/${noteId}`)
}
Expand Down

0 comments on commit 23ba43c

Please sign in to comment.