diario provides a set of functions for securely storing API tokens and interacting with the diariodeobras.net system. It wraps common functionality (e.g., authentication, GET/POST requests) in convenient R functions, making it easier to integrate Diario within R workflows.
You can install the development version of diario
from
GitHub
with:
# install.packages("remotes") # if needed
::install_github("StrategicProjects/diario") remotes
Before making any requests, you’ll need to store your Diario API
token securely. Use diario_store_token()
:
library(diario)
# Store your API token securely using keyring
diario_store_token("YOUR_API_TOKEN_HERE")
diario_retrieve_token()
#> "YOUR_API_TOKEN_HERE"
The main workhorse is perform_request()
, which sets up
and executes an authenticated request to the Diario API endpoints.
# Example: retrieving data from an endpoint
<- diario_perform_request("v1/obras")
response head(response)
# Retrieve information about the company
<- diario_get_company()
company_info company_info
<- diario_get_entities()
entities entities
<- diario_get_projects()
projects projects
<- "6717f864d163f517ae06e242"
project_id <- diario_get_project_details(project_id)
project_details project_details
<- diario_get_task_list(project_id)
tasks tasks
<- "6717f884baf8d51c4f079593"
task_id <- diario_get_task_details(project_id, task_id)
task_details task_details
<- diario_get_reports(project_id, limit = 10, order = "asc")
reports reports
<- "67648080f0971de9d00324c2"
report_id <- diario_get_report_details(project_id, report_id)
report_details report_details
If you would like to contribute to diario
:
This package is provided under the MIT License. See LICENSE for details.