if (FALSE) {
## usually set on package load
options(googleAuthR.batch_endpoint = "https://www.googleapis.com/batch/urlshortener/v1")
## from goo.gl API
shorten_url <- function(url){
body = list(longUrl = url)
f <- gar_api_generator("https://www.googleapis.com/urlshortener/v1/url",
"POST",
data_parse_function = function(x) x$id)
f(the_body = body)
}
## from goo.gl API
user_history <- function(){
f <- gar_api_generator("https://www.googleapis.com/urlshortener/v1/url/history",
"GET",
data_parse_function = function(x) x$items)
f()
}
gar_batch(list(shorten_url("http://markedmondson.me"), user_history()))
}
Run the code above in your browser using DataLab