############################################################### ########################## i14y APIs ########################## ############################################################### # @export get_codelist <- function(identifier, export_format = "SDMX-ML", version_format = 2.1, annotations = FALSE) { api <- api_class( api_type = "codelist", export_format = export_format, parameters = glue("annotations={tolower(annotations)}"), id = identifier ) api$get_response() } get_content_configuration <- function() { api <- api_class(api_type = "content_configuration") api$get_response() } get_identifier_content <- function(identifier) { api <- api_class( api_type = "content_configuration_identifier", id = identifier ) api$get_response() } get_dataset_description <- function(identifier, language = "fr") { api <- api_class( api_type = "dcat_dataset_description", id = identifier, language = language ) api$get_response() } get_dataset_information <- function(identifier, language = "en") { api <- api_class( api_type = "dcat_dataset_information", id = identifier, language = language ) api$get_response() } get_data_structure <- function(identifier, language = "en") { api <- api_class( api_type = "dcat_data_structure", id = identifier, language = language ) api$get_response() } get_nomenclature_path_nodes <- function(identifier, path = ".", filters = "", language = "en") { api <- api_class( api_type = "nomenclature_path_nodes", id = identifier, path = path, parameters = stringify(filters), language = language ) api$get_response() } get_nomenclature_one_level <- function(identifier, filters, level_number = 1, language = "en", annotations = FALSE) { parameters <- glue::glue("language={language}&level={level_number}&annotations={tolower(annotations)}&{stringify(filters)}") print(parameters) api <- api_class( api_type = "nomenclature_one_level", id = identifier, parameters = parameters, export_format = "CSV" ) api$get_response() } get_nomenclature_multiple_levels <- function(identifier, filters, level_from = 1, level_to = 2, language = "en", annotations = FALSE) { parameters <- glue::glue("language={language}&levelFrom={level_from}&levelTo={level_to}&annotations={tolower(annotations)}&{stringify(filters)}") api <- api_class( api_type = "nomenclature_multiple_levels", id = identifier, parameters = parameters, export_format = "CSV" ) api$get_response() ############################################################### # TODO: post processing in R ############################################################### } query_nomenclature <- function(identifier, query, page_number, page_size, filters, language = "en") { parameters <- glue::glue("query={URLencode(query)}&page={page_number}&pageSize={page_size}&language={language}&{stringify(filters)}") api <- api_class( api_type = "nomenclature_search", id = identifier, parameters = parameters ) api$get_response() } ############################################################### ########################## dcat APIs ########################## ############################################################### dcat_list_all_agents <- function() { api <- api_class( api_type = "agents_list", root_url = DCAT_URL ) api$get_response() } dcat_get_agent_from_id <- function(agent_id) { api <- api_class( api_type = "agent_id", root_url = DCAT_URL, id = agent_id ) api$get_response() } dcat_list_all_datasets <- function() { api <- api_class( api_type = "dataset_list", root_url = DCAT_URL ) api$get_response() } dcat_get_distributions_from_dataset_id <- function(dataset_id) { api <- api_class( api_type = "dataset_id_distributions", root_url = DCAT_URL, id = dataset_id ) api$get_response() } dcat_get_dataset_from_id <- function(dataset_id) { api <- api_class( api_type = "dataset_id", root_url = DCAT_URL, id = dataset_id ) api$get_response() } dcat_get_dataset_from_identifier <- function(identifier) { api <- api_class( api_type = "dataset_identifier", root_url = DCAT_URL, id = identifier ) api$get_response() } dcat_get_distributions_from_dataset_identifier <- function(identifier) { api <- api_class( api_type = "dataset_identifier_distributions", root_url = DCAT_URL, id = identifier ) api$get_response() } dcat_list_all_distributions <- function() { api <- api_class( api_type = "distributions_list", root_url = DCAT_URL ) api$get_response() } dcat_get_distribution_from_id <- function(distribution_id) { api <- api_class( api_type = "distribution_id", root_url = DCAT_URL, id = distribution_id ) api$get_response() }