With this function you can bring all of the data of your Figma file into R.
By default, get_figma_file()
returns a `response` object with all of
the data returned by the API. That is, not only the data of your Figma file,
but also, the data from the HTTP request.
All of your Figma file data is in the content
element of
the `response` object. However, by default, the Figma API returns this data in
raw
format (that is, as raw bytes). To convert these bytes into a
useful object (like a JSON object, or a character vector, or a list), is
highly recommended to apply the httr::content()
function over this
content
element.
Although this being a useful output format (i.e. `response` object)
(specially because it brings all of the available data), you might want
a more "formatted" (or friendly) output. In this case, you can use the
.output_format
argument to get a different output format.
With .output_format = "figma_document"
, get_figma_file()
use figma::as_figma_document()
to convert the `response` object
into a Figma Document object (i.e. a object of class figma_document
),
and returns it as the output. This figma_document
object, is a normal
R list, with only the data of your Figma file (See documentation of
figma::as_figma_document()
for more details).
With .output_format = "tibble"
, get_figma_file()
will use
figma::as_tibble()
to parse the output from the API to fit into a
tibble::tibble()
object. If you use this output format, you can also
use the simplified
argument to control if document metadata should be
present in the resulting tibble
(See examples section).
By default, simplified
is set to TRUE
, so get_figma_file()
outputs a tibble with all the objects data from your Figma file, and their
corresponding canvas metadata. However, it does not include any metadata from
the document per se.
In other words, with simplified = TRUE
you get all the data of the
objects from each canvas in your Figma file, but you do not get any metadata
from the document. That is okay, because you usually do not need these
informations.
But if you want them in the resulting tibble, pass simplified = FALSE
to get_figma_file()
. If you want just the document metadata (and not
the canvas or objects data), you might want to use the get_document_info()
function instead of get_figma_file()
(See get_document_info()
documentation for more details).