Documentation
¶
Index ¶
- func ColorToHex(c figmaColor) string
- func FillsToStrings(fills []figmaPaint) []string
- type Client
- func (c *Client) ExportImages(ctx context.Context, fileKey string, nodeIDs []string, format string) ([]ImageExport, error)
- func (c *Client) GetFile(ctx context.Context, fileKey string) (*FileSummary, error)
- func (c *Client) GetFileComments(ctx context.Context, fileKey string) ([]FileComment, error)
- func (c *Client) GetFileComponents(ctx context.Context, fileKey string) ([]Component, error)
- func (c *Client) GetNodes(ctx context.Context, fileKey string, nodeIDs []string) ([]NodeSummary, error)
- func (c *Client) ListProjectFiles(ctx context.Context, projectID string) ([]ProjectFile, error)
- func (c *Client) ListProjects(ctx context.Context, teamID string) ([]Project, error)
- func (c *Client) SetHTTPDoer(doer apiclient.HTTPDoer)
- type Component
- type Config
- type FileComment
- type FileSummary
- type ImageExport
- type Instance
- type NodeSummary
- type PageSummary
- type Project
- type ProjectFile
- type Size
- type Typography
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ColorToHex ¶
func ColorToHex(c figmaColor) string
ColorToHex converts a Figma RGBA color to a hex string like "#FF5733".
func FillsToStrings ¶
func FillsToStrings(fills []figmaPaint) []string
FillsToStrings converts a list of fills to human-readable color strings.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a Figma API client.
func (*Client) ExportImages ¶
func (c *Client) ExportImages(ctx context.Context, fileKey string, nodeIDs []string, format string) ([]ImageExport, error)
ExportImages exports nodes as images and returns temporary URLs.
func (*Client) GetFileComments ¶
GetFileComments lists comments on a file.
func (*Client) GetFileComponents ¶
GetFileComponents lists published components in a file.
func (*Client) GetNodes ¶
func (c *Client) GetNodes(ctx context.Context, fileKey string, nodeIDs []string) ([]NodeSummary, error)
GetNodes fetches specific nodes and returns summaries.
func (*Client) ListProjectFiles ¶
ListProjectFiles lists files in a project.
func (*Client) ListProjects ¶
ListProjects lists projects for a team.
func (*Client) SetHTTPDoer ¶
SetHTTPDoer replaces the HTTP client used for API requests.
type Component ¶
type Component struct {
Key string `json:"key"`
NodeID string `json:"node_id"`
Name string `json:"name"`
Description string `json:"description"`
Page string `json:"page"`
Frame string `json:"frame"`
}
Component represents a published component.
type Config ¶
type Config struct {
Name string `mapstructure:"name"`
URL string `mapstructure:"url"`
Token string `mapstructure:"token"`
Description string `mapstructure:"description"`
}
Config holds the configuration for a single Figma instance.
func LoadConfigs ¶
LoadConfigs reads a .humanconfig YAML file from dir and returns the list of configured Figma instances. Returns nil and no error if the file does not exist.
type FileComment ¶
type FileComment struct {
ID string `json:"id"`
Author string `json:"author"`
Message string `json:"message"`
CreatedAt string `json:"created_at"`
Resolved bool `json:"resolved"`
NodeID string `json:"node_id,omitempty"`
ParentID string `json:"parent_id,omitempty"`
}
FileComment represents a comment on a file.
type FileSummary ¶
type FileSummary struct {
Name string `json:"name"`
LastModified string `json:"last_modified"`
ThumbnailURL string `json:"thumbnail_url"`
Version string `json:"version"`
Pages []PageSummary `json:"pages"`
ComponentCount int `json:"component_count"`
}
FileSummary is the output for file get.
type ImageExport ¶
ImageExport represents an exported node image.
type Instance ¶
Instance represents a configured Figma workspace ready for use.
func LoadInstances ¶
LoadInstances reads config, applies env overrides, creates clients, and returns ready-to-use Figma instances.
type NodeSummary ¶
type NodeSummary struct {
ID string `json:"id"`
Name string `json:"name"`
Type string `json:"type"`
Size *Size `json:"size,omitempty"`
Text string `json:"text,omitempty"`
Typography *Typography `json:"typography,omitempty"`
Fills []string `json:"fills,omitempty"`
Children []NodeSummary `json:"children,omitempty"`
ComponentID string `json:"component_id,omitempty"`
}
NodeSummary is a clean representation of a Figma node.
func SummarizeNode ¶
func SummarizeNode(node figmaNode, maxDepth int) NodeSummary
SummarizeNode converts a raw Figma node into a clean NodeSummary. maxDepth controls how deep to recurse into children (0 = no children).
type PageSummary ¶
type PageSummary struct {
ID string `json:"id"`
Name string `json:"name"`
ChildCount int `json:"child_count"`
}
PageSummary describes a top-level page in a Figma file.
type ProjectFile ¶
type ProjectFile struct {
Key string `json:"key"`
Name string `json:"name"`
ThumbnailURL string `json:"thumbnail_url"`
LastModified string `json:"last_modified"`
}
ProjectFile represents a file in a project.
type Typography ¶
type Typography struct {
FontFamily string `json:"font_family"`
FontSize float64 `json:"font_size"`
FontWeight float64 `json:"font_weight"`
}
Typography holds font properties for text nodes.