## ----setup, include=FALSE-----------------------------------------------------
knitr::opts_chunk$set(collapse = TRUE, comment = "#>", eval = FALSE)

## -----------------------------------------------------------------------------
# usethis::edit_r_environ()

## -----------------------------------------------------------------------------
# # No explicit api_key argument needed
# cpi <- tuiksdmx::tuik_get_data(
#   "DF_TUFE_SDMX_TT01",
#   start_period = "2026-01",
#   end_period = "2026-01"
# )

## -----------------------------------------------------------------------------
# # Assume `api` already contains your valid key as one character string.
# # Never paste a real key into source code that will be shared or committed.
# profile <- tuiksdmx::tuik_flow_profile(
#   "DF_TUFE_SDMX_TT01",
#   api_key = api
# )
# 
# cpi <- tuiksdmx::tuik_get_data(
#   profile,
#   start_period = "2026-01",
#   end_period = "2026-01",
#   api_key = api
# )

## -----------------------------------------------------------------------------
# Sys.setenv(TUIK_SDMX_API_KEY = api)
# 
# cpi <- tuiksdmx::tuik_get_data(
#   "DF_TUFE_SDMX_TT01",
#   start_period = "2026-01",
#   end_period = "2026-01"
# )

## -----------------------------------------------------------------------------
# # Example: reproducible query without a hard-coded secret.
# # Requires the user to configure TUIK_SDMX_API_KEY beforehand.
# result <- tuiksdmx::tuik_get_data(
#   "DF_TUFE_SDMX_TT01",
#   start_period = "2026-01",
#   end_period = "2026-01"
# )

