figma-api-client
v2.1.1
Published
Figma js typed api
Downloads
32
Maintainers
Readme
figma-api-client
Based on didoo/figma-api
Official docs Figma API.
Install
npm i figma-api-client
Usage
import * as Figma from 'figma-api-client';
const api = new Figma.Api({
personalAccessToken: 'access token',
});
const file = await api.getFile('file key');
Api
Helpers
Api.request<T>(url, params): Promise<T>
- Make request with auth headers.
Authentication
new Api({ personalAccessToken } | { oAuthToken });
Creates new Api object with specified personal
or oAuthToken
.
Documentation on how to get tokens
Helpers
oAuthLink
- Returns link for OAuth auth flow. User should open this link, allow access and he will be redirected toredirect_uri?code=<code>
. Then you should useoAuthToken
method to getaccess token
.oAuthToken
- Returnsaccess token
info from oauth code (seeoAuthLink
method).
Figma files
Api.getFile
- Require file dataApi.getFileNodes
- Require file nodes dataApi.getImage
- Renders imagesApi.getImageFills
- Returns download links for all images present in image fills in a document.
Comments
Api.getComments
- List of commentsApi.postComment
- Posts a new comment on the file.Api.deleteComment
- Deletes a specific comment
Users
Api.getMe
- You can use the Users Endpoint
Version history
Api.getVersions
- List of the version
Projects
Api.getTeamProjects
- Lists the projectsApi.getProjectFiles
- List the files
Components and styles
Api.getTeamComponents
- Get a paginated list of published componentsApi.getFileComponents
- Get a list of published componentsApi.getComponent
- Get metadata on a component by key.Api.getTeamComponentSets
- Get a paginated list of published component_sets.Api.getFileComponentSets
- Get a list of published component_setsApi.getComponentSet
- Get metadata on a component_set by key.Api.getTeamStyles
- Get a paginated list of published styles.Api.getFileStyles
- Get a list of published stylesApi.getStyle
- Get metadata on a style by key.
Variables
Api.getLocalVariables
- Get local variables.Api.getPublishedVariables
- Get published variables.Api.postVariables
- Bulk create, update, and delete variables and variable collections.
File types
Helpers
isEffectShadow
- Check if effect is one of shadow effects.isEffectBlur
- Check if effect is one of blur effects.isPaintSolid
- Check if paint is one of pain types.isPaintGradient
- Check if paint is one of pain types.isPaintImage
Check if paint is one of pain types.isNodeType
- Check if node is type of specified node.