You may be able to improve the performance of your API calls by
requesting only the metadata that you actually need. This function is
primarily for internal use and is currently focused on the Files resource. Note
that high-level googledrive functions assume that the name
, id
, and
kind
fields are included, at a bare minimum. Assuming that resource = "files"
(the default), input provided via fields
is checked for validity
against the known field names and the validated fields are returned. To see
a tibble containing all possible fields and a short description of each,
call drive_fields(expose())
.
prep_fields()
prepares fields for inclusion as query
parameters.
drive_fields(fields = NULL, resource = "files")
prep_fields(fields, resource = "files")
drive_fields()
: Character vector of field names. prep_fields()
: a
string.
Improve performance, in the Drive API documentation.
# get a tibble of all fields for the Files resource + indicator of defaults
drive_fields(expose())
#> # A tibble: 55 × 2
#> name desc
#> <chr> <chr>
#> 1 appProperties "A collection of arbitrary key-value pairs whic…
#> 2 capabilities "Capabilities the current user has on this file…
#> 3 contentHints "Additional information about the content of th…
#> 4 copyRequiresWriterPermission "Whether the options to copy, print, or downloa…
#> 5 createdTime "The time at which the file was created (RFC 33…
#> 6 description "A short description of the file."
#> 7 driveId "ID of the shared drive the file resides in. On…
#> 8 explicitlyTrashed "Whether the file has been explicitly trashed, …
#> 9 exportLinks "Links for exporting Google Docs to specific fo…
#> 10 fileExtension "The final component of fullFileExtension. This…
#> # ℹ 45 more rows
# invalid fields are removed and throw warning
drive_fields(c("name", "parents", "ownedByMe", "pancakes!"))
#> Warning: Omitting fields that are not recognized as part of the Files resource:
#> • pancakes!
#> [1] "name" "parents" "ownedByMe"
# prepare fields for query
prep_fields(c("name", "parents", "kind"))
#> [1] "files/name,files/parents,files/kind"