request_generate: Build a request for the Google Drive API

Description Usage Arguments Value See Also Examples

View source: R/request_generate.R

Description

Build a request, using knowledge of the Drive v3 API from its Discovery Document. Most users should, instead, use higher-level wrappers that facilitate common tasks, such as uploading or downloading Drive files. The functions here are intended for internal use and for programming around the Drive API.

request_generate() lets you provide the bare minimum of input. It takes a nickname for an endpoint and:

Usage

1
2
3
4
5
6
request_generate(
  endpoint = character(),
  params = list(),
  key = NULL,
  token = drive_token()
)

Arguments

endpoint

Character. Nickname for one of the selected Drive v3 API endpoints built into googledrive. Learn more in drive_endpoints().

params

Named list. Parameters destined for endpoint URL substitution, the query, or the body.

key

API key. Needed for requests that don't contain a token. The need for an API key in the absence of a token is explained in Google's document Credentials, access, security, and identity. In order of precedence, these sources are consulted: the formal key argument, a key parameter in params, a user-configured API key fetched via drive_api_key(), a built-in key shipped with googledrive. See drive_auth_configure() for details on a user-configured key.

token

Drive token. Set to NULL to suppress the inclusion of a token. Note that, if auth has been de-activated via drive_deauth(), drive_token() will actually return NULL.

Value

list()
Components are method, path, query, body, token, and url, suitable as input for request_make().

See Also

gargle::request_develop(), gargle::request_build()

Other low-level API functions: drive_has_token(), drive_token(), request_make()

Examples

1
2
3
4
5
6
req <- request_generate(
  "drive.files.get",
  list(fileId = "abc"),
  token = drive_token()
)
req

googledrive documentation built on July 8, 2021, 5:07 p.m.