Higher-order function that applies a tidying function to an API response.
Handles both successful responses and errors, returning a consistent tibble structure. The tidy_func
parameter allows you to provide the necessary function for your particular workflow.
Value
A tibble with processed results or error information, including:
original_index: Position in original request batch
.error: Logical indicating if an error occurred
.error_message: Character description of any error
Additional columns from tidy_func output
Examples
if (FALSE) { # \dontrun{
# Process a response with custom tidying function
result <- process_response(
resp = api_response,
indices = c(1, 2, 3),
tidy_func = function(r) { tibble::tibble(data = httr2::resp_body_json(r)) }
)
} # }