| Title: | 'R' Interface to the 'Diariodeobras' Application |
|---|---|
| Description: | Provides a set of functions for securely storing 'API' tokens and interacting with the <https://diariodeobras.net> system. Includes convenient wrappers around the 'httr2' package to perform authenticated requests, retrieve project details, tasks, reports, and more. |
| Authors: | Andre Leite [aut, cre], Hugo Vasconcelos [aut], Diogo Bezerra [aut], Marcos Wasilew [aut], Carlos Amorim [aut], Felipe Ferreira [aut], Roger Azevedo [aut] |
| Maintainer: | Andre Leite <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.2 |
| Built: | 2026-06-28 23:07:58 UTC |
| Source: | https://github.com/strategicprojects/diario |
This function retrieves company details from the Diario API.
diario_get_company()diario_get_company()
A list containing company details.
## Not run: company <- diario_get_company() ## End(Not run)## Not run: company <- diario_get_company() ## End(Not run)
This function retrieves all registered entities from the Diario API.
diario_get_entities()diario_get_entities()
A list containing the entities data.
## Not run: entities <- diario_get_entities() ## End(Not run)## Not run: entities <- diario_get_entities() ## End(Not run)
This function retrieves details of a specific project by its ID from the Diario API.
diario_get_project_details(project_id)diario_get_project_details(project_id)
project_id |
A valid non-empty string with the project ID. |
A list containing the project details.
## Not run: project <- diario_get_project_details("66face5fe26175e0a904d398") ## End(Not run)## Not run: project <- diario_get_project_details("66face5fe26175e0a904d398") ## End(Not run)
This function retrieves a list of projects from the Diario API.
diario_get_projects()diario_get_projects()
A tibble containing the projects data.
## Not run: projects <- diario_get_projects() ## End(Not run)## Not run: projects <- diario_get_projects() ## End(Not run)
This function retrieves details of a specific report by report ID within a project.
diario_get_report_details(project_id, report_id)diario_get_report_details(project_id, report_id)
project_id |
A valid non-empty string with the project ID. |
report_id |
A valid non-empty string with the report ID. |
A list containing the report details.
## Not run: report <- diario_get_report_details("6717f864d163f517ae06e242", "67648080f0971de9d00324c2") ## End(Not run)## Not run: report <- diario_get_report_details("6717f864d163f517ae06e242", "67648080f0971de9d00324c2") ## End(Not run)
This function retrieves reports of a specific project with optional parameters for limit and order.
diario_get_reports(project_id, limit = 50, order = "desc")diario_get_reports(project_id, limit = 50, order = "desc")
project_id |
A valid non-empty string with the project ID. |
limit |
An integer specifying the maximum number of reports to retrieve. Default is 50. |
order |
A character string specifying the order of the reports (e.g., "asc" or "desc"). Default is "desc". |
A tibble containing the reports.
## Not run: reports <- diario_get_reports("6717f864d163f517ae06e242", limit = 10, order = "asc") ## End(Not run)## Not run: reports <- diario_get_reports("6717f864d163f517ae06e242", limit = 10, order = "asc") ## End(Not run)
This function retrieves details of a specific task by task ID within a project.
diario_get_task_details(project_id, task_id)diario_get_task_details(project_id, task_id)
project_id |
A valid non-empty string with the project ID. |
task_id |
A valid non-empty string with the task ID. |
A list containing task details.
## Not run: task <- diario_get_task_details("66cf438223aa80386306e647", "66cf44209e4fedefb306bcd3") ## End(Not run)## Not run: task <- diario_get_task_details("66cf438223aa80386306e647", "66cf44209e4fedefb306bcd3") ## End(Not run)
This function retrieves the task list (schedule, or cronograma) of a
specific project by its ID. The underlying API wraps the schedule items in a
cronograma field alongside summary counters; this function returns the
schedule items themselves as one row per task.
diario_get_task_list(project_id)diario_get_task_list(project_id)
project_id |
A valid non-empty string with the project ID. |
A tibble with one row per schedule item (task). Returns an empty tibble if the project has no tasks.
## Not run: tasks <- diario_get_task_list("66cf438223aa80386306e647") ## End(Not run)## Not run: tasks <- diario_get_task_list("66cf438223aa80386306e647") ## End(Not run)
This function performs an authenticated request to the specified endpoint of the Diario API.
diario_perform_request( endpoint, query = list(), method = "GET", body = NULL, verbosity = 0 )diario_perform_request( endpoint, query = list(), method = "GET", body = NULL, verbosity = 0 )
endpoint |
A non-empty character string specifying the API endpoint. |
query |
A named list of query parameters (optional). |
method |
The HTTP method to use (e.g., "GET", "POST", "PUT", "DELETE"). Default is "GET". |
body |
A list representing the JSON body for request methods that support a body (e.g., POST). |
verbosity |
Verbosity level for the request (0 = none, 1 = minimal). Default is 0. |
A list (by default) containing the response from the API. If the content is JSON, it will be returned as an R object. If not, an error is raised.
## Not run: diario_perform_request("v1/obras", query = list(status = "active")) ## End(Not run)## Not run: diario_perform_request("v1/obras", query = list(status = "active")) ## End(Not run)
This function retrieves the stored authentication token using the keyring package.
If no valid token (or keyring) is found, it will return NULL and (unless
quiet = TRUE) emit an informational message indicating that no valid token
was found.
diario_retrieve_token(quiet = FALSE)diario_retrieve_token(quiet = FALSE)
quiet |
A logical flag. If |
A character string containing the API token, or NULL if no valid token is found.
## Not run: token <- diario_retrieve_token() ## End(Not run)## Not run: token <- diario_retrieve_token() ## End(Not run)
This function stores the provided authentication token using the keyring package.
If the token cannot be stored (for example, because the keyring is not accessible),
it emits a warning instead of throwing an error, and returns FALSE.
diario_store_token(token)diario_store_token(token)
token |
A character string containing the API token to be stored. |
TRUE (invisibly) if the token was stored successfully;
FALSE otherwise.
## Not run: # Attempt to store a token: diario_store_token("your-api-token") ## End(Not run)## Not run: # Attempt to store a token: diario_store_token("your-api-token") ## End(Not run)