Commit 47f4f161 authored by Pauline Maury Laribière's avatar Pauline Maury Laribière
Browse files

Merge branch 'lnguage_codelist' into 'master'

adding language for api

See merge request pauline.maury-laribiere/metadata-auto-r-library!2
parents 3229456c c1f9ee17
Pipeline #271539 passed with stage
in 23 seconds
......@@ -8,4 +8,7 @@ library(methods)
library(glue)
library(httr)
library(jsonlite)
library(rsdmx)
\ No newline at end of file
library(rsdmx)
# pkgload::load_all('my_package')
# styler::style_pkg('my_package')
\ No newline at end of file
......@@ -10,6 +10,7 @@
#' @return response based on the export format
#' @export
get_codelist <- function(identifier,
language = "en",
export_format = "SDMX-ML",
version_format = 2.1,
annotations = FALSE) {
......@@ -19,7 +20,7 @@ get_codelist <- function(identifier,
parameters = glue::glue("annotations={tolower(annotations)}"),
id = identifier
)
api$get_response()
dplyr::select(api$get_response(), contains(language) | matches("id"))
}
......
......@@ -9,10 +9,10 @@
#' @field language character (default = "en"). The language of the response data.
#' Available are 'fr', 'de', 'it', 'en'
#' @field version_format numeric (default = 2.1). The export format's version
#' (2.0 or 2.1 when format is SDMX-ML)
#' (2.0 or 2.1 when format is SDMX-ML)
#' (for 'codelist')
#' @field api_url character. The url to make the request to.
#'
#'
#' @importFrom methods new
api_class <- setRefClass(
"Api",
......@@ -38,7 +38,7 @@ api_class <- setRefClass(
parameters = parameters,
id = id,
language = language,
version_format = version_format,
version_format = version_format
)
get_url(id, export_format, version_format, language)
},
......@@ -60,7 +60,7 @@ api_class <- setRefClass(
"nomenclature_one_level" =
glue::glue("Nomenclatures/{id}/levelexport/CSV"),
"nomenclature_multiple_levels" =
glue::glue("Nomenclatures/{id}/multiplelevels/CSV"),
glue::glue("Nomenclatures/{id}/multiplelevels/CSV")
)
api_url <<- url_mapping[[api_type]]
}
......
......@@ -54,4 +54,4 @@ hash_to_string <- function(filters) {
}
}
string
}
\ No newline at end of file
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment