Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

14 use swagger and openapi files to automatically check query fields #22

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 46 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,49 @@
.Rproj.user
# History files
.Rhistory
.Rapp.history

# Session Data files
.RData
.RDataTmp

# User-specific files
.Ruserdata
docs

# Example code in package build process
*-Ex.R

# Output files from R CMD build
/*.tar.gz

# Output files from R CMD check
/*.Rcheck/

# RStudio files
.Rproj.user/

# produced vignettes
vignettes/*.html
*.pdf

# OAuth2 token, see https://github.com/hadley/httr/releases/tag/v0.3
.httr-oauth

# knitr and R markdown default cache directories
*_cache/
/cache/

# Temporary files created by R markdown
*.utf8.md
*.knit.md

# R Environment Variables
.Renviron

# pkgdown site
docs/

# translation temp files
po/*~

# RStudio Connect folder
rsconnect/
2 changes: 1 addition & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export(get_ecoulement_campagnes)
export(get_ecoulement_observations)
export(get_ecoulement_stations)
export(get_hydrobio_indices)
export(get_hydrobio_stations)
export(get_hydrobio_stations_hydrobio)
export(get_hydrobio_taxons)
export(get_hydrometrie_obs_elab)
export(get_hydrometrie_observations_tr)
Expand Down
10 changes: 5 additions & 5 deletions R/get_hydrobio.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#' The data originate from the "NAIADES" database.
#' Available endpoints are:
#'
#' - `get_hydrobio_stations` retrieves site data and locations
#' - `get_hydrobio_stations_hydrobio` retrieves site data and locations
#' - `get_hydrobio_indices` retrieves bioassessment indices values
#' - `get_hydrobio_taxons` retrieves taxa data
#'
Expand All @@ -21,9 +21,9 @@
#' if(interactive()) {
#' # Retrieve the hydrobiology monitoring sites in the Pays-de-Loire region
#' list_params(api = "hydrobio",
#' endpoint = "stations")
#' endpoint = "stations_hydrobio")
#'
#' stations_pdl <- get_hydrobio_stations(
#' stations_pdl <- get_hydrobio_stations_hydrobio(
#' list(code_region = 52))
#'
#' # Retrieve the hydrobiological bioassessment indices in the city of Rennes
Expand All @@ -40,10 +40,10 @@
#' taxons_rennes <- hubeau::get_hydrobio_taxons(
#' list(code_commune = 35051))
#' }
get_hydrobio_stations <- function(params)
get_hydrobio_stations_hydrobio <- function(params)
{
l <- doApiQuery(api = "hydrobio",
endpoint = "stations",
endpoint = "stations_hydrobio",
params = params)

select_non_nested(l) %>%
Expand Down
Binary file modified R/sysdata.rda
Binary file not shown.
10 changes: 9 additions & 1 deletion R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,15 @@
#'
#' @examples
#' \dontrun{
#' my_flat_list <- select_non_nested(my_nested_list)
#' l <- doApiQuery(api = "hydrobio",
#' endpoint = "stations_hydrobio",
#' params = list(code_region = 52))
#'
#' select_non_nested(l) %>%
#' select(-code_commune,
#' -libelle_departement,
#' -(libelle_region:longitude)) %>%
#' distinct()
#' }
select_non_nested <- function(my_list)

Expand Down
Loading