googledrive (version 0.0.0.9000)

build_request: Build a request for the Google Drive v3 API

Description

Build a request, using some knowledge of the Drive v3API. 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.

Usage

build_request(endpoint = character(), params = list(),
  token = drive_token(), .api_key = NULL)

Arguments

endpoint

Character. Nickname for one of the documented Drive v3 API endpoints. to do: list or link, once I've auto-generated those docs

params

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

token

Drive token, obtained from drive_auth()

.api_key

NULL for now.

Value

list() Components are method, path, query, and url, suitable as input for make_request(). The path is post-substitution and the query is a named list of all the input params that were not used during this substitution. url is the full URL after prepending the base URL for the Drive v3 API and appending an API key to the query.

Details

  • build_request() takes a nickname for an endpoint and uses the API spec to look up the path and method. The params are checked for validity and completeness with respect to the endpoint.

Examples

Run this code

req <- build_request(
  "drive.files.get",
  list(
    fileId = "abc",
  )
)
req

Run the code above in your browser using DataLab