Skip to contents

The untitled_file object is an example of what kind of object the functions from figma package tend to return to the user. This object was produced by a call to figma::get_figma_file(), and contains the data of a very simple Figma file entitled "Untitled".

Usage

untitled_file

Format

An object of class response, produced by httr HTTP methods (e.g. httr::GET());

Details

This "Untitled" Figma file have two canvas/pages, called "Page 1" and "Page 2". There are three objects drawn in Page 1 (a RECTANGLE, a TEXT and a VECTOR object), and, there are two objects drawn in Page 2 (a RECTANGLE and a TEXT object).

The untitled_file object contains the httr::response object returned by figma::get_figma_file(). This httr::response object is just a simple R list with class response. The elements of this list and their description are:

  • url: The URL used in the HTTP request made to the Figma API;

  • status_code: The HTTP status code returned by the Figma API;

  • headers and all_headers: The list of headers returned by the Figma API;

  • cookies: A named list of cookies returned by the Figma API;

  • content: The body of the response, as raw vector. See httr::content() for various ways to parse this content;

  • date and times: Timing information about the HTTP request made to the Figma API;

  • handle: The handle associated with the url;

  • request: The URL, HTTP method and options used in the HTTP request made to the Figma API;

All data of the Figma file is stored in the content element. However, this data is in raw format (i.e. in raw bytes). To convert these raw bytes into a useful format like a R list, or a string, you should use the httr::content() function. See vignette("figma") for a detailed description of the data present in this content element;

Examples

library(figma)
str(untitled_file)
#> List of 10
#>  $ url        : chr "https://api.figma.com/v1/files/hch8YlkIrYbU3raDzjPvCz"
#>  $ status_code: int 200
#>  $ headers    :List of 12
#>   ..$ content-type                : chr "application/json; charset=utf-8"
#>   ..$ date                        : chr "Sat, 29 Oct 2022 16:56:50 GMT"
#>   ..$ access-control-allow-origin : chr "*"
#>   ..$ access-control-allow-headers: chr "Content-Type, X-Figma-Token, Authorization"
#>   ..$ cache-control               : chr "no-cache, no-store"
#>   ..$ vary                        : chr "X-Figma-Token,Authorization"
#>   ..$ x-cache                     : chr "Miss from cloudfront"
#>   ..$ via                         : chr "1.1 88c333921d5c405e037b84bb8c2dc33e.cloudfront.net (CloudFront)"
#>   ..$ x-amz-cf-pop                : chr "GRU3-P1"
#>   ..$ alt-svc                     : chr "h3=\":443\"; ma=86400"
#>   ..$ x-amz-cf-id                 : chr "gjOnBhIpDZxekWpx-zbAwqxsOLunePv8LSTfdf-elMQNLXpyAVSuXw=="
#>   ..$ strict-transport-security   : chr "max-age=31536000; includeSubDomains; preload"
#>   ..- attr(*, "class")= chr [1:2] "insensitive" "list"
#>  $ all_headers:List of 1
#>   ..$ :List of 3
#>   .. ..$ status : int 200
#>   .. ..$ version: chr "HTTP/2"
#>   .. ..$ headers:List of 12
#>   .. .. ..$ content-type                : chr "application/json; charset=utf-8"
#>   .. .. ..$ date                        : chr "Sat, 29 Oct 2022 16:56:50 GMT"
#>   .. .. ..$ access-control-allow-origin : chr "*"
#>   .. .. ..$ access-control-allow-headers: chr "Content-Type, X-Figma-Token, Authorization"
#>   .. .. ..$ cache-control               : chr "no-cache, no-store"
#>   .. .. ..$ vary                        : chr "X-Figma-Token,Authorization"
#>   .. .. ..$ x-cache                     : chr "Miss from cloudfront"
#>   .. .. ..$ via                         : chr "1.1 88c333921d5c405e037b84bb8c2dc33e.cloudfront.net (CloudFront)"
#>   .. .. ..$ x-amz-cf-pop                : chr "GRU3-P1"
#>   .. .. ..$ alt-svc                     : chr "h3=\":443\"; ma=86400"
#>   .. .. ..$ x-amz-cf-id                 : chr "gjOnBhIpDZxekWpx-zbAwqxsOLunePv8LSTfdf-elMQNLXpyAVSuXw=="
#>   .. .. ..$ strict-transport-security   : chr "max-age=31536000; includeSubDomains; preload"
#>   .. .. ..- attr(*, "class")= chr [1:2] "insensitive" "list"
#>  $ cookies    :'data.frame':	0 obs. of  7 variables:
#>   ..$ domain    : logi(0) 
#>   ..$ flag      : logi(0) 
#>   ..$ path      : logi(0) 
#>   ..$ secure    : logi(0) 
#>   ..$ expiration: 'POSIXct' num(0) 
#>   ..$ name      : logi(0) 
#>   ..$ value     : logi(0) 
#>  $ content    : raw [1:4582] 7b 22 64 6f ...
#>  $ date       : POSIXct[1:1], format: "2022-10-29 16:56:50"
#>  $ times      : Named num [1:6] 0 0.173 0.275 0.378 1.606 ...
#>   ..- attr(*, "names")= chr [1:6] "redirect" "namelookup" "connect" "pretransfer" ...
#>  $ request    :List of 5
#>   ..$ method : chr "GET"
#>   ..$ url    : chr "https://api.figma.com/v1/files/hch8YlkIrYbU3raDzjPvCz"
#>   ..$ fields : NULL
#>   ..$ options:List of 2
#>   .. ..$ useragent: chr "libcurl/7.68.0 r-curl/4.3.2 httr/1.4.3"
#>   .. ..$ httpget  : logi TRUE
#>   ..$ output : list()
#>   .. ..- attr(*, "class")= chr [1:2] "write_memory" "write_function"
#>   ..- attr(*, "class")= chr "request"
#>  $ handle     :Class 'curl_handle' <externalptr> 
#>  - attr(*, "class")= chr "response"