Skip to content

Commit

Permalink
feat: add updateNote/updateTeamNote method
Browse files Browse the repository at this point in the history
  • Loading branch information
Yukaii committed Jul 29, 2022
1 parent 20a65d3 commit deb0f72
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 deb0f72

Please sign in to comment.