Alpha: Document API is currently alpha and subject to breaking changes.
Summary
Wrap an existing text range with a hyperlink.- Operation ID:
hyperlinks.wrap - API member path:
editor.doc.hyperlinks.wrap(...) - Mutates document:
yes - Idempotency:
conditional - Supports tracked mode:
no - Supports dry run:
yes - Deterministic target resolution:
yes
Expected result
Returns a HyperlinkMutationResult with the created hyperlink address on success, or a failure code on no-op.Input fields
| Field | Type | Required | Description |
|---|---|---|---|
link | object | yes | |
link.destination | object | yes | |
link.destination.anchor | string | no | |
link.destination.docLocation | string | no | |
link.destination.href | string | no | |
link.rel | string | no | |
link.target | string | no | |
link.tooltip | string | no | |
target | TextAddress | yes | TextAddress |
target.blockId | string | yes | |
target.kind | "text" | yes | Constant: "text" |
target.range | Range | yes | Range |
target.range.end | integer | yes | |
target.range.start | integer | yes |
Example request
Output fields
Variant 1 (hyperlink.kind=“inline”)
| Field | Type | Required | Description |
|---|---|---|---|
hyperlink | object(kind=“inline”) | yes | |
hyperlink.anchor | InlineAnchor | yes | InlineAnchor |
hyperlink.anchor.end | Position | yes | Position |
hyperlink.anchor.end.blockId | string | yes | |
hyperlink.anchor.end.offset | integer | yes | |
hyperlink.anchor.start | Position | yes | Position |
hyperlink.anchor.start.blockId | string | yes | |
hyperlink.anchor.start.offset | integer | yes | |
hyperlink.kind | "inline" | yes | Constant: "inline" |
hyperlink.nodeType | "hyperlink" | yes | Constant: "hyperlink" |
success | true | yes | Constant: true |
Variant 2 (success=false)
| Field | Type | Required | Description |
|---|---|---|---|
failure | object | yes | |
failure.code | enum | yes | "NO_OP", "INVALID_TARGET", "TARGET_NOT_FOUND", "CAPABILITY_UNAVAILABLE" |
failure.details | object | no | |
failure.message | string | yes | |
success | false | yes | Constant: false |
Example response
Pre-apply throws
TARGET_NOT_FOUNDCAPABILITY_UNAVAILABLEINVALID_TARGETINVALID_INPUT
Non-applied failure codes
NO_OP
Raw schemas
Raw input schema
Raw input schema
Raw output schema
Raw output schema
Raw success schema
Raw success schema
Raw failure schema
Raw failure schema

