mirror of
https://github.com/kovetskiy/mark.git
synced 2026-04-19 12:41:13 +00:00
Add label support
This commit is contained in:
@@ -434,7 +434,7 @@ func (api *API) CreatePage(
|
||||
}
|
||||
|
||||
func (api *API) UpdatePage(
|
||||
page *PageInfo, newContent string,
|
||||
page *PageInfo, newContent string, newLabels []string,
|
||||
) error {
|
||||
nextPageVersion := page.Version.Number + 1
|
||||
|
||||
@@ -450,6 +450,17 @@ func (api *API) UpdatePage(
|
||||
{"id": page.Ancestors[len(page.Ancestors)-1].Id},
|
||||
}
|
||||
|
||||
labels := []map[string]interface{}{}
|
||||
for _, label := range newLabels {
|
||||
if label != "" {
|
||||
item := map[string]interface{}{
|
||||
"prexix": "global",
|
||||
"name": label,
|
||||
}
|
||||
labels = append(labels, item)
|
||||
}
|
||||
}
|
||||
|
||||
payload := map[string]interface{}{
|
||||
"id": page.ID,
|
||||
"type": "page",
|
||||
@@ -465,6 +476,9 @@ func (api *API) UpdatePage(
|
||||
"representation": "storage",
|
||||
},
|
||||
},
|
||||
"metadata": map[string]interface{}{
|
||||
"labels": labels,
|
||||
},
|
||||
}
|
||||
|
||||
request, err := api.rest.Res(
|
||||
|
||||
Reference in New Issue
Block a user