#' Fetches all available available series
#'
#' @return dataframe \describe{
#' \item{code}{other code}
#' \item{name}{other name}
#' \item{source_code}{source code}
#' \item{source_name}{source name, use this for caption}
#' \item{description}{description of this series}
#' \item{last_update}{date this series was last updated}
#' \item{usage}{code example on how to call for the dataseries}
#' }
#'
#' @examples
#' fetch_all_info()
#' fetch_all_info() %>%
#' filter(stringr::str_detect(name, stringr::fixed('störf', ignore_case = T)))
#'
#' @export
fetch_all_info <- function() {
fetch_currency_info() %>%
fetch_index_info() %>%
fetch_interest_info() %>%
fetch_commodity_info() %>%
fetch_other_info()
}
check_error <- function(resp) {
#* Stop if errors
if (httr::http_error(resp)) {
if (httr::status_code(resp) == 401) {
stop(
sprintf(
"DataHub API request failed, unauthorized. Use login(email, password) to update credentials."
),
call. = FALSE
)
}
if (httr::status_code(resp) == 500) {
stop(
sprintf(
"DataHub API request failed, server error. Please contact palmar@datahub.is to report this problem."
),
call. = FALSE
)
}
stop(
sprintf(
"DataHub API request failed [%s]\n%s\n<%s>",
httr::status_code(resp),
parsed$message,
parsed$errors
),
call. = FALSE
)
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.