zp-figma-converter
Version:
Convert Figma designs to various code formats
54 lines • 1.79 kB
TypeScript
import { FigmaFile, FigmaNode } from './types';
/**
* Service for Figma API
*/
export declare class FigmaApi {
private apiClient;
private apiKey;
private baseUrl;
constructor(apiKey: string);
/**
* Get information of a Figma file
* @param fileKey Key of Figma file
* @returns Information of Figma file
*/
getFile(fileKey: string): Promise<FigmaFile>;
/**
* Get information of a specific node in a Figma file
* @param fileKey Key of Figma file
* @param nodeId ID of node
* @returns Information of node
*/
getNode(fileKey: string, nodeId: string): Promise<FigmaNode>;
/**
* Get image URLs from nodes in a Figma file
* @param fileKey Key of Figma file
* @param nodeIds List of IDs of nodes
* @param format Format of image (png, svg, jpg...)
* @param scale Scale of image
* @returns List of image URLs
*/
getImageUrls(fileKey: string, nodeIds: string[], format?: 'png' | 'svg' | 'jpg', scale?: number): Promise<{
[key: string]: string;
}>;
/**
* Download image from a URL and save to local
* @param imageUrl URL of image
* @param outputPath Path of image
* @returns Path of image
*/
downloadImage(imageUrl: string, outputPath: string): Promise<string>;
/**
* Download multiple images from Figma
* @param fileKey Key of Figma file
* @param nodeIds List of IDs of nodes and corresponding file names
* @param format Format of image
* @returns List of paths to images
*/
downloadImages(fileKey: string, nodeIds: {
id: string;
filePath: string;
}[], format?: 'png' | 'svg' | 'jpg'): Promise<string[]>;
private normalizeNodeId;
}
//# sourceMappingURL=figma-api.d.ts.map