canvas

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package canvas provides high-level operations for Aha.io strategic canvases.

Index

Constants

This section is empty.

Variables

View Source
var BMCBlocks = []string{
	"Key Partners",
	"Key Activities",
	"Key Resources",
	"Value Propositions",
	"Customer Relationships",
	"Channels",
	"Customer Segments",
	"Cost Structure",
	"Revenue Streams",
}

BMCBlocks defines the standard block names for Business Model Canvas.

View Source
var LeanUXBlocks = []string{
	"Business Problem",
	"Business Outcomes",
	"Users",
	"Benefits",
	"Solutions",
	"Hypotheses",
	"Riskiest Assumption",
	"Smallest Experiment",
}

LeanUXBlocks defines the standard block names for Lean UX Canvas.

View Source
var OpportunityBlocks = []string{
	"Users & Customers",
	"Problems",
	"Solution Ideas",
	"Solutions Today",
	"User Value",
	"Adoption Strategy",
	"User Metrics",
	"Business Problem",
	"Business Metrics",
	"Budget",
}

OpportunityBlocks defines the standard block names for Opportunity Canvas.

Functions

func BlocksForKind

func BlocksForKind(kind Kind) []string

BlocksForKind returns the standard block names for a canvas kind.

func Create

func Create(ctx context.Context, client *aha.Client, opts CreateOptions) (*aha.StrategicModel, error)

Create creates a new strategic canvas in Aha.io.

func Export

func Export(ctx context.Context, client *aha.Client, opts ExportOptions) ([]byte, error)

Export exports a canvas to the specified format.

func ExportModel

func ExportModel(sm *aha.StrategicModel, opts ExportOptions) ([]byte, error)

ExportModel exports a strategic model to the specified format. This function is useful for testing without an API call.

func GetAvailableBlocks

func GetAvailableBlocks(ctx context.Context, client *aha.Client, canvasID string) ([]string, error)

GetAvailableBlocks returns the available block names for a canvas.

func LoadBlocksFromFile

func LoadBlocksFromFile(path string) (map[string]string, error)

LoadBlocksFromFile loads block content from a JSON file.

Types

type BlockError

type BlockError struct {
	BlockName string
	Err       error
}

BlockError represents an error updating a specific block.

type CreateOptions

type CreateOptions struct {
	ProductID   string
	Name        string
	Description string
	Kind        Kind
}

CreateOptions configures canvas creation.

type ExportFormat

type ExportFormat string

ExportFormat represents an export format.

const (
	FormatSVG     ExportFormat = "svg"
	FormatJSON    ExportFormat = "json"
	FormatD2      ExportFormat = "d2"
	FormatMermaid ExportFormat = "mermaid"
)

Export formats.

func SupportedFormats

func SupportedFormats() []ExportFormat

SupportedFormats returns the list of supported export formats.

type ExportOptions

type ExportOptions struct {
	CanvasID string
	Format   ExportFormat
	Width    int
	Height   int
}

ExportOptions configures canvas export.

func DefaultExportOptions

func DefaultExportOptions() ExportOptions

DefaultExportOptions returns default export options.

type Kind

type Kind string

Kind represents a canvas type.

const (
	KindOpportunity Kind = "Opportunity"
	KindLeanUX      Kind = "Lean Canvas"
	KindBMC         Kind = "Business Model"
)

Canvas kinds.

type UpdateOptions

type UpdateOptions struct {
	CanvasID string
	Blocks   map[string]string // Block name -> HTML content
}

UpdateOptions configures canvas update.

type UpdateResult

type UpdateResult struct {
	SuccessCount int
	ErrorCount   int
	Errors       []BlockError
	Unknown      []string // Block names not found in canvas
}

UpdateResult contains the result of an update operation.

func Update

func Update(ctx context.Context, client *aha.Client, opts UpdateOptions) (*UpdateResult, error)

Update updates canvas blocks with new content.

Jump to

Keyboard shortcuts

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