Skip to content

Commit 15d894b

Browse files
committed
Support creating note for team
1 parent 761daef commit 15d894b

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

nodejs/src/index.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ export type HistoryItem = {
4848
tags: string[]
4949
}
5050

51+
export type NewNoteOption = {
52+
team: string
53+
}
54+
5155
/**
5256
* codimd API Client
5357
*/
@@ -121,10 +125,17 @@ class API {
121125
return response.json()
122126
}
123127

124-
async newNote(body: string) {
128+
async newNote(body: string, options?: NewNoteOption) {
125129
let response
126130
if (this.enterprise) {
127-
response = await this.fetch(`${this.serverUrl}/new`, {
131+
let newNoteUrl
132+
if (options?.team) {
133+
newNoteUrl = `${this.serverUrl}/team/${options.team}/new`
134+
} else {
135+
newNoteUrl = `${this.serverUrl}/new`
136+
}
137+
138+
response = await this.fetch(newNoteUrl, {
128139
method: 'POST',
129140
body: encodeFormComponent({content: body}),
130141
headers: await this.wrapHeaders({

0 commit comments

Comments
 (0)