diff --git a/R/doApiQuery.R b/R/doApiQuery.R index 7915a56479ea365d0f0dd6aa21a540728dd6b9e1..455420137db1e6ad2887f5a7a2d2f177064b2837 100644 --- a/R/doApiQuery.R +++ b/R/doApiQuery.R @@ -22,7 +22,7 @@ #' cfg <- config::get(file = system.file("config.yml", package = "hubeau")) #' names(cfg$apis) #' -#' # To get the available operation in an API +#' # To get the available endpoints in an API #' names(cfg$apis[["prelevements"]]$operations) #' #' # To get available parameters in operation "chroniques" of the API "prelevements" diff --git a/R/get_available_params.R b/R/get_available_params.R index 333e4f34d0ee0bf18cc07aeca7cb817f549aead3..55a2a632ed2b123315121d23a6e28c6a32115319 100644 --- a/R/get_available_params.R +++ b/R/get_available_params.R @@ -1,5 +1,11 @@ -#' @rdname doApiQuery +#' List available query parameters of an API endpoint +#' +#' @inheritParams doApiQuery +#' +#' @return A [character] vector with available query parameters for the requested API/endpoint +#' #' @export +#' @inherit doApiQuery examples #' get_available_params <- function(api, operation, diff --git a/man/doApiQuery.Rd b/man/doApiQuery.Rd index cd0e8d24084f6b63c839619d6fad21c40defab27..fc2627150d3527d7d24e52f7cce6d8274ac59981 100644 --- a/man/doApiQuery.Rd +++ b/man/doApiQuery.Rd @@ -1,8 +1,7 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/doApiQuery.R, R/get_available_params.R +% Please edit documentation in R/doApiQuery.R \name{doApiQuery} \alias{doApiQuery} -\alias{get_available_params} \title{Main internal functions for querying the Hub'eau APIs} \usage{ doApiQuery( @@ -11,12 +10,6 @@ doApiQuery( params, cfg = config::get(file = system.file("config.yml", package = "hubeau")) ) - -get_available_params( - api, - operation, - cfg = config::get(file = system.file("config.yml", package = "hubeau")) -) } \arguments{ \item{api}{a \link{character} name of the API (e.g.: "indicateurs_services", "prelevements"...), see example for available APIs} @@ -45,7 +38,7 @@ The functions \verb{get_[api]_[operation]} call the function \code{doQueryApi} a cfg <- config::get(file = system.file("config.yml", package = "hubeau")) names(cfg$apis) -# To get the available operation in an API +# To get the available endpoints in an API names(cfg$apis[["prelevements"]]$operations) # To get available parameters in operation "chroniques" of the API "prelevements" diff --git a/man/get_available_params.Rd b/man/get_available_params.Rd new file mode 100644 index 0000000000000000000000000000000000000000..95040b2df949a5d44ae768b8ee0dde7ead544fb1 --- /dev/null +++ b/man/get_available_params.Rd @@ -0,0 +1,43 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/get_available_params.R +\name{get_available_params} +\alias{get_available_params} +\title{List available query parameters of an API endpoint} +\usage{ +get_available_params( + api, + operation, + cfg = config::get(file = system.file("config.yml", package = "hubeau")) +) +} +\arguments{ +\item{api}{a \link{character} name of the API (e.g.: "indicateurs_services", "prelevements"...), see example for available APIs} + +\item{operation}{a \link{character} name of the endpoint, see example for available endpoints in an API} + +\item{cfg}{a \link{config} object describing the configuration of the APIs. Use the internal package configuration by default +configuration} +} +\value{ +A \link{character} vector with available query parameters for the requested API/endpoint +} +\description{ +List available query parameters of an API endpoint +} +\examples{ +# To get the available APIs in the package +cfg <- config::get(file = system.file("config.yml", package = "hubeau")) +names(cfg$apis) + +# To get the available endpoints in an API +names(cfg$apis[["prelevements"]]$operations) + +# To get available parameters in operation "chroniques" of the API "prelevements" +get_available_params(api = "prelevements", operation = "chroniques") + +# To query the operation "chroniques" of the API "prelevements" +# on all devices in the commune of Romilly-sur-Seine in 2018 +doApiQuery(api = "prelevements", + operation = "chroniques", + params = list(code_commune_insee = "10323", annee = "2018")) +}