Show how one part of a Clarifo document would change, or what publishing
it would do. Writes nothing.
Use when the user asks to change, rewrite, update or add to an existing
document. Give exactly one target:
- section_id + markdown: a section (get_workspace_item view="manifest").
- block_id + markdown: one paragraph, list or table (view="blocks"); a
table as a Markdown table.
- visual_id + visual_data: the data of one saved chart, map or heatmap
(view="visuals"; visual_data is its saved_data as read, or just the
data object inside it (chartData, ...); every stored key kept). The result shows Clarifo's rendering of the saved
and the proposed chart.
- visual_story: the whole Visual Story (as view="visuals" returns it,
changed). The result lists the changes card by card, the cards the
validator would leave out and why, and shows the changed cards.
- story_patch: small Visual Story edits instead of the whole story, a
list of {"card": 3, "path": "segments.1.figureLabel", "value":
"+137.6 %"} (card numbers 1-based as in the preview; "delete": true
removes a field), {"card": 5, "remove": true}, {"insert_after": 2,
"card_data": {...}} or {"path": "period", "value": ...}.
- seo: publishing settings {"title", "description", "slug",
"cover_image_url", "cover_image_alt"}; keys left out stay;
cover_image_url "" removes the cover. The address (slug) is
fixed once the document has been published.
- board_ops: edits to a board item (list_workspace_items types
["board"]; widget ids from get_workspace_item view="manifest"), a
list of {"op": set_title | add_page | update_page | remove_page |
move_page | add_widget | update_widget | move_widget | remove_widget
| replace_company, ...}. Clarifo re-resolves the numbers.
- publish: "public" (on clarifo.com for anyone) or "private" (signed-in
Clarifo users only), only when the user asks to publish. The result
shows the document as it would be published, its title, address,
visibility, last check and whether it can be published now (an
Automate draft with open issues cannot: blockers lists them). With
accept_quality_issues=true, only after the user has seen those issues
and agreed, publishing accepts them and marks the draft reviewed.
Show the user the diff and the images (for publish:
the preview, the address and visibility), then call
apply_document_update with the same arguments plus base_version and
preview_hash only after they agree.
Args:
item_id: The document, from list_workspace_items.
section_id: The section to change (manifest), or "intro".
markdown: The new text, for a section or block. For a section
replace without a leading heading the section keeps its
heading; for insert_after start with a ## heading. Cite a
filing page as [page_id] and list it in sources, or keep
the document's own [n] as read (it stays that source).
None for remove.
operation: replace (default), insert_after, or remove (takes the
section, with its subsections, or the block out; no
markdown). A part holding a chart is not removed here.
sources: Filing page_ids the new text or cards rest on. Omitted
for a section or block: the pages it already cites
(sources_inherited in the result).
companies: Optional; not used (figures are not checked).
workspace_id: Optional; the document's workspace.
block_id: One block to replace or insert after (view="blocks").
visual_id: A saved chart's V<n> (view="visuals").
visual_data: The chart's new data, with visual_id.
visual_story: The new Visual Story.
story_patch: Edits to the saved Visual Story (instead of
visual_story).
seo: New publishing settings (SEO title, description, URL slug,
cover image).
publish: "public" or "private" to preview publishing the document;
give no other target with it.
board_ops: Board edits, on their own (e.g. {"op": "update_widget",
"widget_id", "patch": {"binding": {"metrics":
["ebit_margin"], "frequency": "quarterly"}}}, {"op":
"add_widget", "page_id", "widget": {"kind": "chart",
"binding": {...}}}, {"op": "replace_company", "to":
"Kone"}).
accept_quality_issues: With publish, an Automate draft's open
issues are accepted on publish (the user
agreed after seeing them).
Returns:
{"board_diff", "base_version", "preview_hash"} for board_ops, or
{"section" | "block_id" | "visual", "old_text", "new_text", "diff",
"base_version", "preview_hash"} (+ images for a visual)
or {"error", "failure_kind"}.