You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
varskipDeleteNodesBatchSleep=false// for accelerate UT testing only
37
35
varwbUpdateFlags= []common.Flag{
38
36
{Name: "idempotent-token", Desc: "idempotent token to ensure the update is idempotent. Default is empty. min length is 10.", Required: false},
39
37
{Name: "whiteboard-token", Desc: "whiteboard token of the whiteboard to update. You will need edit permission to update the whiteboard.", Required: true},
desc.POST(fmt.Sprintf("/open-apis/board/v1/whiteboards/%s/nodes", common.MaskToken(url.PathEscape(token)))).Body(nodes).Desc("create all nodes of the whiteboard.")
91
+
reqBody:=rawNodesCreateReq{
92
+
Nodes: nodes,
93
+
Overwrite: overwrite,
94
+
}
95
+
desc.POST(fmt.Sprintf("/open-apis/board/v1/whiteboards/%s/nodes", common.MaskToken(url.PathEscape(token)))).Body(reqBody).Desc("create all nodes of the whiteboard.")
107
96
caseFormatPlantUML, FormatMermaid:
108
97
syntaxType:=formatCodeMap[format]
109
98
reqBody:=plantumlCreateReq{
110
99
PlantUmlCode: input,
111
100
SyntaxType: syntaxType,
112
101
ParseMode: 1,
113
102
DiagramType: 0,
103
+
Overwrite: overwrite,
114
104
}
115
105
desc.POST(fmt.Sprintf("/open-apis/board/v1/whiteboards/%s/nodes/plantuml", common.MaskToken(url.PathEscape(token)))).Body(reqBody).Desc(fmt.Sprintf("create %s node on the whiteboard.", format))
116
106
}
117
107
118
-
ifoverwrite&&delNum>0 {
119
-
// 在 DryRun 中只记录意图,不实际拉取和计算节点
120
-
desc.GET(fmt.Sprintf("/open-apis/board/v1/whiteboards/%s/nodes", common.MaskToken(url.PathEscape(token)))).Desc("get all nodes of the whiteboard to delete, then filter out newly created ones.")
Desc(fmt.Sprintf("delete all old nodes of the whiteboard 100 nodes at a time. This API may be called multiple times and is not reversible. %d whiteboard nodes will be deleted while update.", delNum))
123
-
}
124
108
returndesc
125
109
}
126
110
@@ -185,31 +169,17 @@ type createResponse struct {
185
169
} `json:"data"`
186
170
}
187
171
188
-
typedeleteResponsestruct {
189
-
Codeint`json:"code"`
190
-
Msgstring`json:"msg"`
191
-
}
192
-
193
-
typesimpleNodeRespstruct {
194
-
Codeint`json:"code"`
195
-
Msgstring`json:"msg"`
196
-
Datastruct {
197
-
Nodes []struct {
198
-
Idstring`json:"id"`
199
-
Children []string`json:"children"`
200
-
} `json:"nodes"`
201
-
} `json:"data"`
202
-
}
203
-
204
-
typedeleteNodeReqBodystruct {
205
-
Ids []string`json:"ids"`
206
-
}
207
-
208
172
typeplantumlCreateReqstruct {
209
173
PlantUmlCodestring`json:"plant_uml_code"`
210
174
SyntaxTypeint`json:"syntax_type"`
211
175
DiagramTypeint`json:"diagram_type,omitempty"`
212
176
ParseModeint`json:"parse_mode,omitempty"`
177
+
Overwritebool`json:"overwrite,omitempty"`
178
+
}
179
+
180
+
typerawNodesCreateReqstruct {
181
+
Nodes []interface{} `json:"nodes"`
182
+
Overwritebool`json:"overwrite,omitempty"`
213
183
}
214
184
215
185
typeplantumlCreateRespstruct {
@@ -220,7 +190,7 @@ type plantumlCreateResp struct {
0 commit comments