R/data_states.R

#' data_states
#'
#' \code{data_states} provides the options to filter \code{get_occurences} by State.
#'
#' @param \code{add_token}: add the user's token to access the API.
#' @usage data_cities(add_token=xxxx)
#' @return it returns a dataframe of with the options available in the API to filter the results by State
#' The values can be used to filter the cases in the function \code{get_occurrences}
#' #' @examples
#' data_state()
#' @import httr
#' @import rvest
#' @import purrr
#' @import jsonlite
#' @import tibble
#' @importFrom magrittr "%>%"
#' @export

data_states <- function(add_token){

  endpoint <- "/states"

  response <- httr::GET(paste0(base, endpoint),
                        add_headers('Authorization' = paste("Bearer", add_token, sep = " ")))

  jsonlite::fromJSON(httr::content(response, as="text")) %>% tibble::as_tibble()

}
TiagoVentura/get_fogocruzado documentation built on June 27, 2019, 12:19 a.m.