@@ -5,7 +5,7 @@ import * as HackMDErrors from './error'
5
5
export class API {
6
6
private axios : AxiosInstance
7
7
8
- constructor ( readonly accessToken : string , public hackmdAPIEndpointURL : string = "https://api.hackmd.io/v1" ) {
8
+ constructor ( readonly accessToken : string , public hackmdAPIEndpointURL : string = "https://api.hackmd.io/v1" ) {
9
9
if ( ! accessToken ) {
10
10
throw new HackMDErrors . MissingRequiredArgument ( 'Missing access token when creating HackMD client' )
11
11
}
@@ -53,62 +53,62 @@ export class API {
53
53
)
54
54
}
55
55
56
- getMe = async ( ) => {
56
+ async getMe ( ) {
57
57
const { data } = await this . axios . get < User > ( "me" )
58
58
return data
59
59
}
60
60
61
- getHistory = async ( ) => {
61
+ async getHistory ( ) {
62
62
const { data } = await this . axios . get < Note [ ] > ( "history" )
63
63
return data
64
64
}
65
65
66
- getNoteList = async ( ) => {
66
+ async getNoteList ( ) {
67
67
const { data } = await this . axios . get < Note [ ] > ( "notes" )
68
68
return data
69
69
}
70
70
71
- getNote = async ( noteId : string ) => {
71
+ async getNote ( noteId : string ) {
72
72
const { data } = await this . axios . get < Note > ( `notes/${ noteId } ` )
73
73
return data
74
74
}
75
75
76
- createNote = async ( options : CreateNoteOptions ) => {
76
+ async createNote ( options : CreateNoteOptions ) {
77
77
const { data } = await this . axios . post < Note > ( "notes" , options )
78
78
return data
79
79
}
80
80
81
- updateNoteContent = async ( noteId : string , content ?: string ) => {
81
+ async updateNoteContent ( noteId : string , content ?: string ) {
82
82
const { data } = await this . axios . patch < string > ( `notes/${ noteId } ` , { content } )
83
83
return data
84
84
}
85
85
86
- deleteNote = async ( noteId : string ) => {
86
+ async deleteNote ( noteId : string ) {
87
87
const { data } = await this . axios . delete < void > ( `notes/${ noteId } ` )
88
88
return data
89
89
}
90
90
91
- getTeams = async ( ) => {
91
+ async getTeams ( ) {
92
92
const { data } = await this . axios . get < Team [ ] > ( "teams" )
93
93
return data
94
94
}
95
95
96
- getTeamNotes = async ( teamPath : string ) => {
96
+ async getTeamNotes ( teamPath : string ) {
97
97
const { data} = await this . axios . get < Note [ ] > ( `teams/${ teamPath } /notes` )
98
98
return data
99
99
}
100
100
101
- createTeamNote = async ( teamPath : string , options : CreateNoteOptions ) => {
101
+ async createTeamNote ( teamPath : string , options : CreateNoteOptions ) {
102
102
const { data } = await this . axios . post < Note > ( `teams/${ teamPath } /notes` , options )
103
103
return data
104
104
}
105
105
106
- updateTeamNoteContent = async ( teamPath : string , noteId : string , content ?: string ) => {
106
+ async updateTeamNoteContent ( teamPath : string , noteId : string , content ?: string ) {
107
107
const { data } = await this . axios . patch < string > ( `teams/${ teamPath } /notes/${ noteId } ` , { content } )
108
108
return data
109
109
}
110
110
111
- deleteTeamNote = async ( teamPath : string , noteId : string ) => {
111
+ async deleteTeamNote ( teamPath : string , noteId : string ) {
112
112
const { data } = await this . axios . delete < void > ( `teams/${ teamPath } /notes/${ noteId } ` )
113
113
return data
114
114
}
0 commit comments