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 ¶
- func ChangeManagementEnabled(ctx core.CommandContext, canvasID string) (bool, error)
- func DescribeCanvasVersionByID(ctx core.CommandContext, canvasID string, versionID string) (openapi_client.CanvasesCanvasVersion, error)
- func EnsureCurrentUserDraftVersionID(ctx core.CommandContext, canvasID string) (string, error)
- func FindCanvasID(ctx core.CommandContext, client *openapi_client.APIClient, nameOrID string) (string, error)
- func FindCurrentUserDraftVersionID(ctx core.CommandContext, canvasID string) (string, error)
- func FindOwnedDraftVersionID(ctx core.CommandContext, canvasID string, userID string) (string, error)
- func ResolveCanvasNameOrIDArg(ctx core.CommandContext, arg string) (string, error)
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.