R/error.R

Defines functions replace_space_with_20 stop_if_no_key

#check if there is api_key function
stop_if_no_key <- function(api_key = ""){
  if (nchar(api_key) == 0) {
    rlang::abort(c(
      "`AKL_TRANS_API` is required to run this funcion.",
      i = "Please apply an API key at https://dev-portal.at.govt.nz",
      i = "Please use `usethis::edit_r_environ()` to add your API key to the `.Renviron`."))
  }
}

#replace space with %20
replace_space_with_20 <- function(x) {
  gsub(" ", "%20", x)
}
Tina-ye112/kiaora documentation built on Feb. 25, 2021, 2:03 p.m.