canvasresolve

package
v0.23.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 28, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package canvasresolve groups the small set of helpers used by multiple CLI command packages to resolve a canvas (by name or id), read canvas settings such as change management, and find or create the current user's draft version. Keeping these in one place lets the `canvases` and `console` command packages share behavior without either depending on the other.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChangeManagementEnabled

func ChangeManagementEnabled(ctx core.CommandContext, canvasID string) (bool, error)

ChangeManagementEnabled reports whether change management is enabled on the canvas identified by `canvasID`.

func DescribeCanvasVersionByID

func DescribeCanvasVersionByID(
	ctx core.CommandContext,
	canvasID string,
	versionID string,
) (openapi_client.CanvasesCanvasVersion, error)

DescribeCanvasVersionByID loads a specific canvas version and errors when the response does not include one.

func EnsureCurrentUserDraftVersionID

func EnsureCurrentUserDraftVersionID(ctx core.CommandContext, canvasID string) (string, error)

EnsureCurrentUserDraftVersionID returns the id of the current user's draft version, creating one if it does not yet exist.

func FindCanvasID

func FindCanvasID(ctx core.CommandContext, client *openapi_client.APIClient, nameOrID string) (string, error)

FindCanvasID returns the canvas id for the given name or UUID. If `nameOrID` parses as a UUID, it is returned unchanged. Otherwise the CLI looks up canvases by name and requires exactly one match.

func FindCurrentUserDraftVersionID

func FindCurrentUserDraftVersionID(ctx core.CommandContext, canvasID string) (string, error)

FindCurrentUserDraftVersionID returns the id of the first non-published canvas version visible to the current user, or an empty string if none exists. It does not create a draft.

func FindOwnedDraftVersionID

func FindOwnedDraftVersionID(ctx core.CommandContext, canvasID string, userID string) (string, error)

FindOwnedDraftVersionID walks the version history (paginated) and returns the id of the latest non-published version whose owner matches `userID`, or an empty string when none is found.

func ResolveCanvasNameOrIDArg

func ResolveCanvasNameOrIDArg(ctx core.CommandContext, arg string) (string, error)

ResolveCanvasNameOrIDArg returns the canvas id for `arg`, falling back to the active canvas configured for the user when `arg` is empty. It returns a friendly error when neither is available so callers can surface the same message across commands.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL