This function generates other functions for use with Google APIs
gar_api_generator(
baseURI,
http_header = c("GET", "POST", "PUT", "DELETE", "PATCH"),
path_args = NULL,
pars_args = NULL,
data_parse_function = NULL,
customConfig = NULL,
simplifyVector = getOption("googleAuthR.jsonlite.simplifyVector"),
checkTrailingSlash = TRUE
)
A function that can fetch the Google API data you specify
The stem of the API call.
Type of http request.
A named list with name=folder in request URI, value=the function variable.
A named list with name=parameter in request URI, value=the function variable.
A function that takes a request response, parses it and returns the data you need.
list of httr options such as use_proxy or add_headers that will be added to the request.
Passed to fromJSON for response parsing
Default TRUE will append a trailing slash to baseURI if missing
path_args and pars_args add default values to the baseURI. NULL entries are removed. Use "" if you want an empty argument.
You don't need to supply access_token for OAuth2 requests in pars_args, this is dealt with in gar_auth()
Add custom configurations to the request in this syntax:
customConfig = list(httr::add_headers("From" = "mark@example.com")