Giter Club home page Giter Club logo

voogd-figma-client's Introduction

Voogd-Figma-Client

Originally developed for internal use at Voogd & Voogd Verzekeringen.

⚠️ This project is no longer supported by me nor by my previous employer.

Table of Contents


Prerequisites

Your personal an access token for the Figma API.

Installation

npm install @voogd/figma-client

Javascript

const { Client } = require("voogdfigma");

const voogdFigma = new Client("ACCESS_TOKEN");

Typescript/ES6

import { Client } from "voogdFigma";

const voogdFigma = new Client("ACCESS_TOKEN");

Usage

Documents, Projects, and Project Files

// Fetching a document (no callback)
client
  .getDocument("YOUR_FILE_KEY")
  .then((document) => {})
  .catch((err) => {});

// Fetching a document (with callback)
function logMyDocument(document, err) {
  const message = err || document;
  console.log(message);
}

client.getDocument("YOUR_FILE_KEY", logMyDocument);

Styles

// All styles accross every projects (no callback)
client.getTeamStyle('YOUR_TEAM_ID')
  .then((styles) => {})
  .catch((err) => {});

// All styles accross every projects (with callback)
function logMyStyles(styles, err) {
  const message = err || document;
  console.log(message);
}

client.getTeamStyle('YOUR_TEAM_ID', logMyStyles);

// Uou can provide the key(s) of the file(s) in which the styles are defined.
// The call will then only those relevant styles.
client.getTeamStyle('YOUR_TEAM_ID', ['FILE_KEY_1', 'FILE_KEY_2'...])
  .then((styles) => {})
  .catch((err) => {});

Assets

const options = {
  assetRefs: [
    {
      // Node ID.
      id: "0:1",
      // Name the asset will hold on local disk
      exportAs: "foobar",
    },
  ],
  outDir: "./assets",
  format: "PNG",
};

// Exporting an asset (no callback)
client
  .exportAssets("YOUR_FILE_KEY", options)
  .then(() => {})
  .catch((err) => {});

// Exporting an asset (with callback)
function notifyUserOfExportStatus(err) {
  const message = err || "All assets have been exported!";
  console.log(message);
}

client.exportAssets("YOUR_FILE_KEY", options, notifyUserOfExportStatus);

Definitions

Some types may have been altered in order to make them more relevant to this project.

Please refer to the project's definition file.

License

No license

Maximilien Zaleski © 2019

voogd-figma-client's People

Contributors

maxzaleski avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.