#' Utilities
#' @import jsonlite
#' @import httr
#' @export
get_search = function(query, ..., token = token){
baseURL = "https://www.eventbriteapi.com/v3/events/search?"
call = httr::GET(baseURL,
query = list(q = query, ...),
httr::add_headers("Authorization" = paste("Bearer", token), "Content-Type" = "application/json")
)
url = paste0(call$url, "&token=", token)
print(url)
response = jsonlite::fromJSON(url)
return(response)
}
# borrowed from https://github.com/renkun-ken/rlist/blob/master/R/list.flatten.R. For some reason, can't "import" with roxygen2 so saving it locally
list.flatten <- function(x, use.names = TRUE, classes = "ANY") {
len <- sum(rapply(x, function(x) 1L, classes = classes))
y <- vector("list", len)
i <- 0L
items <- rapply(x, function(x) {
i <<- i + 1L
y[[i]] <<- x
TRUE
}, classes = classes)
if (use.names && !is.null(nm <- names(items)))
names(y) <- nm
y
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.