#' eccc_collections
#' @description Lists collections available for query via the ECCC Geomet API
#' @return \code{tibble} containing collection titles and ids
#' @export
#' @examples
#' eccc_collections()
#'
eccc_collections <- function(){
req <- eccc_request(path = "collections")
dplyr::tibble(
collection = req$content$collections$title,
collection_id = req$content$collections$id
)
}
#' eccc_queryables
#'
#' @description Provides queryable parameters for API requests
#' @param collection Which collection to get informatio for.
#' See \code{eccc_collections}
#' @return \code{tibble} containing possible queryables and their expected type
#' @export
#' @examples
#' eccc_queryables("hydrometric-stations")
#'
eccc_queryables <- function(collection){
query_path <- paste0("/collections/", collection, "/queryables")
req <- eccc_request(path = query_path)
parsed_req <- req$content$properties
purrr::map_df(
parsed_req,
~{
dplyr::tibble(queryable = .x$title, type = .x$type)
}
)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.