common

package
v0.25.1 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CanvasYAMLRepositoryPath  = "canvas.yaml"
	ConsoleYAMLRepositoryPath = "console.yaml"
)

Variables

This section is empty.

Functions

func BuildAppURL added in v0.25.0

func BuildAppURL(ctx core.CommandContext, orgID, canvasID string) string

BuildCanvasURL composes the canonical web URL for an app. Returns "" when the context, base URL, organization id, or app id is missing so callers can omit the URL output without erroring.

orgID and canvasID should come from the API response (canvas metadata) rather than the local CLI context, so the URL stays correct even if the active context drifts.

func ChangeManagementEnabled

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

ChangeManagementEnabled reports whether change management is enabled on the app identified by `appID`.

func CommitRepositoryFiles added in v0.25.1

func CommitRepositoryFiles(
	ctx core.CommandContext,
	canvasID string,
	versionID string,
	expectedHeadSHA string,
	message string,
	operations []openapi_client.CanvasesCanvasRepositoryFileOperation,
	autoLayout *openapi_client.CanvasesCanvasAutoLayout,
	includeAutoLayout bool,
) (*openapi_client.CanvasesCommitCanvasRepositoryFilesResponse, error)

func CommitRepositorySpecFile added in v0.25.1

func CommitRepositorySpecFile(
	ctx core.CommandContext,
	canvasID string,
	versionID string,
	path string,
	content []byte,
	message string,
	autoLayout *openapi_client.CanvasesCanvasAutoLayout,
	includeAutoLayout bool,
) error

func DescribeAppVersionByID

func DescribeAppVersionByID(
	ctx core.CommandContext,
	appID string,
	versionID string,
) (openapi_client.CanvasesCanvasVersion, error)

DescribeAppVersionByID loads a specific app version and errors when the response does not include one.

func EnsureCurrentUserDraftVersionID

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

EnsureCurrentUserDraftVersionID returns the version id of a draft branch owned by the current user, creating one if it does not yet exist.

func FetchRepositoryFile added in v0.25.1

func FetchRepositoryFile(ctx core.CommandContext, canvasID, path, versionID string) ([]byte, error)

func FindAppID

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

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

func FindCurrentUserDraftVersionID

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

FindCurrentUserDraftVersionID returns the version id of the first draft branch owned by the current user, or an empty string if none exists. It does not create a draft.

func FindOwnedDraftVersionID

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

FindOwnedDraftVersionID returns the version id of the first draft branch owned by `userID`, or an empty string when none is found.

func ResolveAppNameOrIDArg

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

ResolveAppNameOrIDArg returns the app id for `arg`, falling back to the active app 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