@hackmd/api 2.0.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +4 -1
- package/dist/index.js +6 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AxiosResponse } from 'axios';
|
|
2
|
+
import { CreateNoteOptions, GetMe, GetUserHistory, GetUserNotes, GetUserNote, CreateUserNote, GetUserTeams, GetTeamNotes, CreateTeamNote, DeleteUserNote, DeleteTeamNote, UpdateUserNote, SingleNote, UpdateTeamNote } from './type';
|
|
2
3
|
export default class API {
|
|
3
4
|
readonly accessToken: string;
|
|
4
5
|
hackmdAPIEndpointURL: string;
|
|
@@ -10,10 +11,12 @@ export default class API {
|
|
|
10
11
|
getNote(noteId: string): Promise<GetUserNote>;
|
|
11
12
|
createNote(options: CreateNoteOptions): Promise<CreateUserNote>;
|
|
12
13
|
updateNoteContent(noteId: string, content?: string): Promise<UpdateUserNote>;
|
|
14
|
+
updateNote(noteId: string, options: Pick<SingleNote, 'content' | 'readPermission' | 'writePermission'>): Promise<AxiosResponse>;
|
|
13
15
|
deleteNote(noteId: string): Promise<DeleteUserNote>;
|
|
14
16
|
getTeams(): Promise<GetUserTeams>;
|
|
15
17
|
getTeamNotes(teamPath: string): Promise<GetTeamNotes>;
|
|
16
18
|
createTeamNote(teamPath: string, options: CreateNoteOptions): Promise<CreateTeamNote>;
|
|
17
19
|
updateTeamNoteContent(teamPath: string, noteId: string, content?: string): Promise<UpdateTeamNote>;
|
|
20
|
+
updateTeamNote(teamPath: string, noteId: string, options: Pick<SingleNote, 'content' | 'readPermission' | 'writePermission'>): Promise<AxiosResponse>;
|
|
18
21
|
deleteTeamNote(teamPath: string, noteId: string): Promise<DeleteTeamNote>;
|
|
19
22
|
}
|
package/dist/index.js
CHANGED
|
@@ -59,6 +59,9 @@ class API {
|
|
|
59
59
|
async updateNoteContent(noteId, content) {
|
|
60
60
|
await this.axios.patch(`notes/${noteId}`, { content });
|
|
61
61
|
}
|
|
62
|
+
async updateNote(noteId, options) {
|
|
63
|
+
return await this.axios.patch(`notes/${noteId}`, options);
|
|
64
|
+
}
|
|
62
65
|
async deleteNote(noteId) {
|
|
63
66
|
await this.axios.delete(`notes/${noteId}`);
|
|
64
67
|
}
|
|
@@ -77,6 +80,9 @@ class API {
|
|
|
77
80
|
async updateTeamNoteContent(teamPath, noteId, content) {
|
|
78
81
|
await this.axios.patch(`teams/${teamPath}/notes/${noteId}`, { content });
|
|
79
82
|
}
|
|
83
|
+
async updateTeamNote(teamPath, noteId, options) {
|
|
84
|
+
return await this.axios.patch(`teams/${teamPath}/notes/${noteId}`, options);
|
|
85
|
+
}
|
|
80
86
|
async deleteTeamNote(teamPath, noteId) {
|
|
81
87
|
await this.axios.delete(`teams/${teamPath}/notes/${noteId}`);
|
|
82
88
|
}
|