This function receives a httr::response() object, and outputs a
tibble::tibble() object.
Arguments
- x
A Figma document object (i.e. a
figma::figma_documentobject), or, ahttr::responseobject to parse;- ...
Further arguments passed by the caller. Only
simplifiedargument is currently accepted, other arguments are ignored (See Details section);
Value
A tibble::tibble() object with all of the canvas and objects data of your
Figma file.
Details
The function parses the data from the response object and tries to fit
it into a tibble object. Each row in the resulting tibble will be describing
an object in your Figma file.
If as_tibble() receives a response object as input, it will call
as_figma_document() to convert this response object into a figma_document
object. But, as_tibble() can receive directly a figma_document object
and jump this step.
If the Figma file have no objects draw in a specific canvas, as_tibble()
will return an empty tibble object for this specific canvas. This means that, if
your Figma file is empty, or, in other words, if all of the canvas/pages of the
file have no objects draw in them, the final result of as_tibble() will
be an empty tibble object.
By default, figma::as_tibble() does not include any document metadata in
the resulting tibble object. But you can pass simplified = FALSE to the
function to change this behavior.
Examples
if (FALSE) {
file_key <- "hch8YlkgaUIZ9raDzjPvCz"
token <- "my figma token secret ... "
# Returns a `response` object:
r <- figma::get_figma_file(file_key, token)
result <- figma::as_tibble(r)
# To include all of the document metadata, use `simplified = FALSE`
result <- figma::as_tibble(r, simplified = FALSE)
}