From c67e95d7e73a922ecd9cf728deabf63cbe239314 Mon Sep 17 00:00:00 2001 From: Jon Harmon Date: Fri, 8 May 2026 16:11:42 -0500 Subject: [PATCH 1/2] Minimize imports And otherwise clean things up toward CRAN release. --- DESCRIPTION | 9 ++++----- NAMESPACE | 1 - R/nectar-package.R | 4 +++- R/req_policy.R | 1 - R/resp_tidy.R | 2 +- man/do_if_fn_defined.Rd | 2 +- man/dot-do_if_args_defined.Rd | 2 +- man/dot-get_pkg_version.Rd | 2 +- man/dot-lib_user_agent_append.Rd | 2 +- man/dot-lib_user_agent_string.Rd | 2 +- man/dot-nectar_abort.Rd | 2 +- man/dot-nectar_user_agent_append.Rd | 2 +- man/dot-pkg_user_agent_append.Rd | 2 +- man/dot-req_body_auto.Rd | 6 +++--- man/dot-req_method_apply.Rd | 2 +- man/dot-req_path_append.Rd | 2 +- man/dot-req_policy.Rd | 4 ++-- man/dot-req_query_flatten.Rd | 2 +- man/dot-shared-params.Rd | 6 +++--- man/dot-user_agent_remove.Rd | 2 +- man/get_pkg_name.Rd | 2 +- man/iterate_with_json_cursor.Rd | 2 +- man/nectar-package.Rd | 7 +++++++ man/req_auth_api_key.Rd | 2 +- man/req_init.Rd | 12 ++++++------ man/req_modify.Rd | 14 +++++++------- man/req_pagination_policy.Rd | 12 ++++++------ man/req_pkg_user_agent.Rd | 2 +- man/req_prepare.Rd | 14 +++++++------- man/req_tidy_policy.Rd | 12 ++++++------ man/resp_body_auto.Rd | 2 +- man/resp_body_separate.Rd | 2 +- man/resp_parse.Rd | 6 +++--- man/resp_tidy.Rd | 4 ++-- man/resp_tidy_json.Rd | 2 +- man/resp_tidy_unknown.Rd | 2 +- man/url_path_append.Rd | 2 +- 37 files changed, 81 insertions(+), 75 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 23ccd50..35ccd51 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -14,7 +14,6 @@ BugReports: https://github.com/api2r/nectar/issues Depends: R (>= 4.1.0) Imports: - cli, curl, fs, glue, @@ -27,7 +26,6 @@ Imports: stringr, vctrs Suggests: - astgrepr, covr, knitr, rmarkdown, @@ -35,11 +33,12 @@ Suggests: testthat (>= 3.0.0), tibble, tibblify -VignetteBuilder: knitr +VignetteBuilder: + knitr Remotes: wranglezone/tibblify +Config/roxygen2/version: 8.0.0 Config/testthat/edition: 3 Encoding: UTF-8 Language: en-US -Roxygen: list(markdown = TRUE) -RoxygenNote: 7.3.3 +Roxygen: list(markdown = TRUE) \ No newline at end of file diff --git a/NAMESPACE b/NAMESPACE index b9cb7aa..feedca9 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -34,7 +34,6 @@ export(resp_tidy_json) export(resp_tidy_unknown) export(url_normalize) export(url_path_append) -importFrom(cli,cli_abort) importFrom(fs,path) importFrom(httr2,req_perform) importFrom(httr2,req_perform_iterative) diff --git a/R/nectar-package.R b/R/nectar-package.R index 0dcb2d8..3b2bb9e 100644 --- a/R/nectar-package.R +++ b/R/nectar-package.R @@ -1,8 +1,10 @@ #' @keywords internal "_PACKAGE" +# All of these really need to be imported, either so the package is a hard +# dependency for underlying usage, or to make mocking easier in tests. + ## usethis namespace: start -#' @importFrom cli cli_abort #' @importFrom fs path #' @importFrom httr2 req_perform #' @importFrom httr2 req_perform_iterative diff --git a/R/req_policy.R b/R/req_policy.R index 4bbf886..47deb15 100644 --- a/R/req_policy.R +++ b/R/req_policy.R @@ -5,7 +5,6 @@ #' export this function, but that may change in the future. #' #' @inheritParams .shared-params -#' @param ... #' #' @inherit .shared-request return #' @keywords internal diff --git a/R/resp_tidy.R b/R/resp_tidy.R index 1d92237..13a674c 100644 --- a/R/resp_tidy.R +++ b/R/resp_tidy.R @@ -31,7 +31,7 @@ #' httr2::resp_body_json #' ) #' # In practice, the request is attached automatically when the response is -#' # fetched with req_perform() or req_perform_opinionated(). +#' # fetched with httr2::req_perform() or req_perform_opinionated(). #' resp$request <- req #' resp_tidy(resp) resp_tidy <- function(resps) { diff --git a/man/do_if_fn_defined.Rd b/man/do_if_fn_defined.Rd index 5dbf6ce..f76072f 100644 --- a/man/do_if_fn_defined.Rd +++ b/man/do_if_fn_defined.Rd @@ -16,7 +16,7 @@ unchanged.} \item{...}{Additional arguments to pass to \code{fn}.} \item{call}{(\code{environment}) The environment from which a function was called, -e.g. \code{\link[rlang:stack]{rlang::caller_env()}} (the default). The environment will be mentioned +e.g. \code{\link[rlang:caller_env]{rlang::caller_env()}} (the default). The environment will be mentioned in error messages as the source of the error. This argument is particularly useful for functions that are intended to be called as utilities inside other functions.} diff --git a/man/dot-do_if_args_defined.Rd b/man/dot-do_if_args_defined.Rd index b065ca1..3d2ed48 100644 --- a/man/dot-do_if_args_defined.Rd +++ b/man/dot-do_if_args_defined.Rd @@ -15,7 +15,7 @@ unchanged.} \item{...}{These dots are for future extensions and must be empty.} \item{call}{(\code{environment}) The environment from which a function was called, -e.g. \code{\link[rlang:stack]{rlang::caller_env()}} (the default). The environment will be mentioned +e.g. \code{\link[rlang:caller_env]{rlang::caller_env()}} (the default). The environment will be mentioned in error messages as the source of the error. This argument is particularly useful for functions that are intended to be called as utilities inside other functions.} diff --git a/man/dot-get_pkg_version.Rd b/man/dot-get_pkg_version.Rd index a789867..34c017f 100644 --- a/man/dot-get_pkg_version.Rd +++ b/man/dot-get_pkg_version.Rd @@ -11,7 +11,7 @@ will usually be automatically determined based on the source of the call.} \item{call}{(\code{environment}) The environment from which a function was called, -e.g. \code{\link[rlang:stack]{rlang::caller_env()}} (the default). The environment will be mentioned +e.g. \code{\link[rlang:caller_env]{rlang::caller_env()}} (the default). The environment will be mentioned in error messages as the source of the error. This argument is particularly useful for functions that are intended to be called as utilities inside other functions.} diff --git a/man/dot-lib_user_agent_append.Rd b/man/dot-lib_user_agent_append.Rd index 58371a5..e5fc85f 100644 --- a/man/dot-lib_user_agent_append.Rd +++ b/man/dot-lib_user_agent_append.Rd @@ -25,7 +25,7 @@ add to or remove from the user agent string.} \item{url}{(\verb{length-1 character}) An optional url associated with \code{name}.} \item{call}{(\code{environment}) The environment from which a function was called, -e.g. \code{\link[rlang:stack]{rlang::caller_env()}} (the default). The environment will be mentioned +e.g. \code{\link[rlang:caller_env]{rlang::caller_env()}} (the default). The environment will be mentioned in error messages as the source of the error. This argument is particularly useful for functions that are intended to be called as utilities inside other functions.} diff --git a/man/dot-lib_user_agent_string.Rd b/man/dot-lib_user_agent_string.Rd index 4111051..0c397a9 100644 --- a/man/dot-lib_user_agent_string.Rd +++ b/man/dot-lib_user_agent_string.Rd @@ -15,7 +15,7 @@ add to or remove from the user agent string.} \item{url}{(\verb{length-1 character}) An optional url associated with \code{name}.} \item{call}{(\code{environment}) The environment from which a function was called, -e.g. \code{\link[rlang:stack]{rlang::caller_env()}} (the default). The environment will be mentioned +e.g. \code{\link[rlang:caller_env]{rlang::caller_env()}} (the default). The environment will be mentioned in error messages as the source of the error. This argument is particularly useful for functions that are intended to be called as utilities inside other functions.} diff --git a/man/dot-nectar_abort.Rd b/man/dot-nectar_abort.Rd index 04aef56..a339722 100644 --- a/man/dot-nectar_abort.Rd +++ b/man/dot-nectar_abort.Rd @@ -20,7 +20,7 @@ formatted with \code{\link[cli:cli_bullets]{cli::cli_bullets()}}.} prefixed by "\{package\}-error-".} \item{call}{(\code{environment}) The environment from which a function was called, -e.g. \code{\link[rlang:stack]{rlang::caller_env()}} (the default). The environment will be mentioned +e.g. \code{\link[rlang:caller_env]{rlang::caller_env()}} (the default). The environment will be mentioned in error messages as the source of the error. This argument is particularly useful for functions that are intended to be called as utilities inside other functions.} diff --git a/man/dot-nectar_user_agent_append.Rd b/man/dot-nectar_user_agent_append.Rd index 0579b58..c7cce43 100644 --- a/man/dot-nectar_user_agent_append.Rd +++ b/man/dot-nectar_user_agent_append.Rd @@ -15,7 +15,7 @@ agent, such as the value of \code{req$options$useragent} in a \code{\link[httr2: object.} \item{call}{(\code{environment}) The environment from which a function was called, -e.g. \code{\link[rlang:stack]{rlang::caller_env()}} (the default). The environment will be mentioned +e.g. \code{\link[rlang:caller_env]{rlang::caller_env()}} (the default). The environment will be mentioned in error messages as the source of the error. This argument is particularly useful for functions that are intended to be called as utilities inside other functions.} diff --git a/man/dot-pkg_user_agent_append.Rd b/man/dot-pkg_user_agent_append.Rd index 108a2e4..133fadd 100644 --- a/man/dot-pkg_user_agent_append.Rd +++ b/man/dot-pkg_user_agent_append.Rd @@ -23,7 +23,7 @@ will usually be automatically determined based on the source of the call.} package (default \code{NULL}).} \item{call}{(\code{environment}) The environment from which a function was called, -e.g. \code{\link[rlang:stack]{rlang::caller_env()}} (the default). The environment will be mentioned +e.g. \code{\link[rlang:caller_env]{rlang::caller_env()}} (the default). The environment will be mentioned in error messages as the source of the error. This argument is particularly useful for functions that are intended to be called as utilities inside other functions.} diff --git a/man/dot-req_body_auto.Rd b/man/dot-req_body_auto.Rd index 1a3fb0c..750d168 100644 --- a/man/dot-req_body_auto.Rd +++ b/man/dot-req_body_auto.Rd @@ -17,7 +17,7 @@ otherwise give it the class "fs_path" to indicate that it is a path.} the body. Some APIs allow you to leave this as NULL for them to guess.} \item{call}{(\code{environment}) The environment from which a function was called, -e.g. \code{\link[rlang:stack]{rlang::caller_env()}} (the default). The environment will be mentioned +e.g. \code{\link[rlang:caller_env]{rlang::caller_env()}} (the default). The environment will be mentioned in error messages as the source of the error. This argument is particularly useful for functions that are intended to be called as utilities inside other functions.} @@ -26,8 +26,8 @@ other functions.} A modified HTTP \link[httr2]{request}. } \description{ -Automatically choose between \code{\link[httr2:req_body]{httr2::req_body_json()}} and -\code{\link[httr2:req_body]{httr2::req_body_multipart()}} based on the content of the body. This is +Automatically choose between \code{\link[httr2:req_body_json]{httr2::req_body_json()}} and +\code{\link[httr2:req_body_multipart]{httr2::req_body_multipart()}} based on the content of the body. This is currently experimental and needs to be tested on more APIs. } \keyword{internal} diff --git a/man/dot-req_method_apply.Rd b/man/dot-req_method_apply.Rd index 6b3ea29..2d93051 100644 --- a/man/dot-req_method_apply.Rd +++ b/man/dot-req_method_apply.Rd @@ -13,7 +13,7 @@ other than \code{GET} or \code{POST}, supply it. Case is ignored.} \item{call}{(\code{environment}) The environment from which a function was called, -e.g. \code{\link[rlang:stack]{rlang::caller_env()}} (the default). The environment will be mentioned +e.g. \code{\link[rlang:caller_env]{rlang::caller_env()}} (the default). The environment will be mentioned in error messages as the source of the error. This argument is particularly useful for functions that are intended to be called as utilities inside other functions.} diff --git a/man/dot-req_path_append.Rd b/man/dot-req_path_append.Rd index 4c56869..7190e26 100644 --- a/man/dot-req_path_append.Rd +++ b/man/dot-req_path_append.Rd @@ -15,7 +15,7 @@ a list or character vector with the path as one or more unnamed arguments \code{\link[glue:glue]{glue::glue()}} into the path.} \item{call}{(\code{environment}) The environment from which a function was called, -e.g. \code{\link[rlang:stack]{rlang::caller_env()}} (the default). The environment will be mentioned +e.g. \code{\link[rlang:caller_env]{rlang::caller_env()}} (the default). The environment will be mentioned in error messages as the source of the error. This argument is particularly useful for functions that are intended to be called as utilities inside other functions.} diff --git a/man/dot-req_policy.Rd b/man/dot-req_policy.Rd index 743de92..54aaeb3 100644 --- a/man/dot-req_policy.Rd +++ b/man/dot-req_policy.Rd @@ -9,10 +9,10 @@ \arguments{ \item{req}{(\code{httr2_request}) A \code{\link[httr2:request]{httr2::request()}} object.} -\item{...}{} +\item{...}{These dots are for future extensions and must be empty.} \item{call}{(\code{environment}) The environment from which a function was called, -e.g. \code{\link[rlang:stack]{rlang::caller_env()}} (the default). The environment will be mentioned +e.g. \code{\link[rlang:caller_env]{rlang::caller_env()}} (the default). The environment will be mentioned in error messages as the source of the error. This argument is particularly useful for functions that are intended to be called as utilities inside other functions.} diff --git a/man/dot-req_query_flatten.Rd b/man/dot-req_query_flatten.Rd index dae982a..2b2c889 100644 --- a/man/dot-req_query_flatten.Rd +++ b/man/dot-req_query_flatten.Rd @@ -11,7 +11,7 @@ \item{query}{(\code{character} or \code{list}) An optional list or character vector of parameters to pass in the query portion of the request. Can also include a -\code{.multi} argument to pass to \code{\link[httr2:req_url]{httr2::req_url_query()}} to control how +\code{.multi} argument to pass to \code{\link[httr2:req_url_query]{httr2::req_url_query()}} to control how elements containing multiple values are handled.} } \value{ diff --git a/man/dot-shared-params.Rd b/man/dot-shared-params.Rd index 9651142..ecb9631 100644 --- a/man/dot-shared-params.Rd +++ b/man/dot-shared-params.Rd @@ -30,7 +30,7 @@ any component of the body is a path, pass it through \code{\link[fs:path]{fs::pa otherwise give it the class "fs_path" to indicate that it is a path.} \item{call}{(\code{environment}) The environment from which a function was called, -e.g. \code{\link[rlang:stack]{rlang::caller_env()}} (the default). The environment will be mentioned +e.g. \code{\link[rlang:caller_env]{rlang::caller_env()}} (the default). The environment will be mentioned in error messages as the source of the error. This argument is particularly useful for functions that are intended to be called as utilities inside other functions.} @@ -75,7 +75,7 @@ package (default \code{NULL}).} \item{query}{(\code{character} or \code{list}) An optional list or character vector of parameters to pass in the query portion of the request. Can also include a -\code{.multi} argument to pass to \code{\link[httr2:req_url]{httr2::req_url_query()}} to control how +\code{.multi} argument to pass to \code{\link[httr2:req_url_query]{httr2::req_url_query()}} to control how elements containing multiple values are handled.} \item{req}{(\code{httr2_request}) A \code{\link[httr2:request]{httr2::request()}} object.} @@ -92,7 +92,7 @@ list of such objects (as returned by \code{\link[=req_perform_opinionated]{req_p response. Default: \code{\link[=resp_body_auto]{resp_body_auto()}}.} \item{response_parser}{(\code{function}) A function to parse the server response -(\code{resp}). Defaults to \code{\link[httr2:resp_body_raw]{httr2::resp_body_json()}}, since JSON responses are +(\code{resp}). Defaults to \code{\link[httr2:resp_body_json]{httr2::resp_body_json()}}, since JSON responses are common. Set this to \code{NULL} to return the raw response from \code{\link[httr2:req_perform]{httr2::req_perform()}}.} diff --git a/man/dot-user_agent_remove.Rd b/man/dot-user_agent_remove.Rd index 5d254b2..2b20be8 100644 --- a/man/dot-user_agent_remove.Rd +++ b/man/dot-user_agent_remove.Rd @@ -22,7 +22,7 @@ add to or remove from the user agent string.} \item{url}{(\verb{length-1 character}) An optional url associated with \code{name}.} \item{call}{(\code{environment}) The environment from which a function was called, -e.g. \code{\link[rlang:stack]{rlang::caller_env()}} (the default). The environment will be mentioned +e.g. \code{\link[rlang:caller_env]{rlang::caller_env()}} (the default). The environment will be mentioned in error messages as the source of the error. This argument is particularly useful for functions that are intended to be called as utilities inside other functions.} diff --git a/man/get_pkg_name.Rd b/man/get_pkg_name.Rd index 01bc3c3..d265a09 100644 --- a/man/get_pkg_name.Rd +++ b/man/get_pkg_name.Rd @@ -8,7 +8,7 @@ get_pkg_name(call = rlang::caller_env()) } \arguments{ \item{call}{(\code{environment}) The environment from which a function was called, -e.g. \code{\link[rlang:stack]{rlang::caller_env()}} (the default). The environment will be mentioned +e.g. \code{\link[rlang:caller_env]{rlang::caller_env()}} (the default). The environment will be mentioned in error messages as the source of the error. This argument is particularly useful for functions that are intended to be called as utilities inside other functions.} diff --git a/man/iterate_with_json_cursor.Rd b/man/iterate_with_json_cursor.Rd index ce9af6e..08fc470 100644 --- a/man/iterate_with_json_cursor.Rd +++ b/man/iterate_with_json_cursor.Rd @@ -21,7 +21,7 @@ A function that takes the response and the previous request, and returns the next request if there are more results. } \description{ -This function is intended as a replacement for \code{\link[httr2:iterate_with_offset]{httr2::iterate_with_cursor()}} +This function is intended as a replacement for \code{\link[httr2:iterate_with_cursor]{httr2::iterate_with_cursor()}} for the common situation where the response body is json, and the cursor can be "empty" in various ways. Even within a single API, some endpoints might return a \code{NULL} \code{next_cursor} to indicate that there are no more pages of diff --git a/man/nectar-package.Rd b/man/nectar-package.Rd index 57fb5e7..4c86e7c 100644 --- a/man/nectar-package.Rd +++ b/man/nectar-package.Rd @@ -6,6 +6,8 @@ \alias{nectar-package} \title{nectar: A Framework for Web API Packages} \description{ +\if{html}{\figure{logo.svg}{options: style='float: right' alt='logo' width='120'}} + An opinionated framework for use within api-wrapping R packages. } \seealso{ @@ -20,6 +22,11 @@ Useful links: \author{ \strong{Maintainer}: Jon Harmon \email{jonthegeek@gmail.com} (\href{https://orcid.org/0000-0003-4781-4346}{ORCID}) [copyright holder] +Authors: +\itemize{ + \item Jon Harmon \email{jonthegeek@gmail.com} (\href{https://orcid.org/0000-0003-4781-4346}{ORCID}) [copyright holder] +} + Other contributors: \itemize{ \item R Consortium [funder] diff --git a/man/req_auth_api_key.Rd b/man/req_auth_api_key.Rd index 513c8e7..98371af 100644 --- a/man/req_auth_api_key.Rd +++ b/man/req_auth_api_key.Rd @@ -29,7 +29,7 @@ value is \code{NULL}, the key will be removed from the request. If this value is One of \code{"header"} (default), \code{"query"}, or \code{"cookie"}.} \item{call}{(\code{environment}) The environment from which a function was called, -e.g. \code{\link[rlang:stack]{rlang::caller_env()}} (the default). The environment will be mentioned +e.g. \code{\link[rlang:caller_env]{rlang::caller_env()}} (the default). The environment will be mentioned in error messages as the source of the error. This argument is particularly useful for functions that are intended to be called as utilities inside other functions.} diff --git a/man/req_init.Rd b/man/req_init.Rd index d54bb8e..f30dfbc 100644 --- a/man/req_init.Rd +++ b/man/req_init.Rd @@ -24,7 +24,7 @@ your package and nectar, but use this to provide additional details. Default \code{NULL}.} \item{call}{(\code{environment}) The environment from which a function was called, -e.g. \code{\link[rlang:stack]{rlang::caller_env()}} (the default). The environment will be mentioned +e.g. \code{\link[rlang:caller_env]{rlang::caller_env()}} (the default). The environment will be mentioned in error messages as the source of the error. This argument is particularly useful for functions that are intended to be called as utilities inside other functions.} @@ -45,10 +45,10 @@ req_init( ) } \seealso{ -Other opinionated request functions: -\code{\link{req_modify}()}, -\code{\link{req_pagination_policy}()}, -\code{\link{req_prepare}()}, -\code{\link{req_tidy_policy}()} +Other opinionated request functions: +\code{\link[=req_modify]{req_modify()}}, +\code{\link[=req_pagination_policy]{req_pagination_policy()}}, +\code{\link[=req_prepare]{req_prepare()}}, +\code{\link[=req_tidy_policy]{req_tidy_policy()}} } \concept{opinionated request functions} diff --git a/man/req_modify.Rd b/man/req_modify.Rd index d0e8082..3b4dfd8 100644 --- a/man/req_modify.Rd +++ b/man/req_modify.Rd @@ -27,7 +27,7 @@ a list or character vector with the path as one or more unnamed arguments \item{query}{(\code{character} or \code{list}) An optional list or character vector of parameters to pass in the query portion of the request. Can also include a -\code{.multi} argument to pass to \code{\link[httr2:req_url]{httr2::req_url_query()}} to control how +\code{.multi} argument to pass to \code{\link[httr2:req_url_query]{httr2::req_url_query()}} to control how elements containing multiple values are handled.} \item{body}{(multiple types) An object to use as the body of the request. If @@ -41,7 +41,7 @@ the body. Some APIs allow you to leave this as NULL for them to guess.} other than \code{GET} or \code{POST}, supply it. Case is ignored.} \item{call}{(\code{environment}) The environment from which a function was called, -e.g. \code{\link[rlang:stack]{rlang::caller_env()}} (the default). The environment will be mentioned +e.g. \code{\link[rlang:caller_env]{rlang::caller_env()}} (the default). The environment will be mentioned in error messages as the source of the error. This argument is particularly useful for functions that are intended to be called as utilities inside other functions.} @@ -59,10 +59,10 @@ req_modify(req_base, path = c("specific/{path}", path = "endpoint")) req_modify(req_base, query = c("param1" = "value1", "param2" = "value2")) } \seealso{ -Other opinionated request functions: -\code{\link{req_init}()}, -\code{\link{req_pagination_policy}()}, -\code{\link{req_prepare}()}, -\code{\link{req_tidy_policy}()} +Other opinionated request functions: +\code{\link[=req_init]{req_init()}}, +\code{\link[=req_pagination_policy]{req_pagination_policy()}}, +\code{\link[=req_prepare]{req_prepare()}}, +\code{\link[=req_tidy_policy]{req_tidy_policy()}} } \concept{opinionated request functions} diff --git a/man/req_pagination_policy.Rd b/man/req_pagination_policy.Rd index fb4a8f6..41bfdb6 100644 --- a/man/req_pagination_policy.Rd +++ b/man/req_pagination_policy.Rd @@ -18,7 +18,7 @@ request by \code{\link[=req_perform_opinionated]{req_perform_opinionated()}} and \code{\link[httr2:req_perform_iterative]{httr2::req_perform_iterative()}}.} \item{call}{(\code{environment}) The environment from which a function was called, -e.g. \code{\link[rlang:stack]{rlang::caller_env()}} (the default). The environment will be mentioned +e.g. \code{\link[rlang:caller_env]{rlang::caller_env()}} (the default). The environment will be mentioned in error messages as the source of the error. This argument is particularly useful for functions that are intended to be called as utilities inside other functions.} @@ -39,10 +39,10 @@ req <- httr2::request("https://example.com") req_pagination_policy(req, httr2::iterate_with_offset("page")) } \seealso{ -Other opinionated request functions: -\code{\link{req_init}()}, -\code{\link{req_modify}()}, -\code{\link{req_prepare}()}, -\code{\link{req_tidy_policy}()} +Other opinionated request functions: +\code{\link[=req_init]{req_init()}}, +\code{\link[=req_modify]{req_modify()}}, +\code{\link[=req_prepare]{req_prepare()}}, +\code{\link[=req_tidy_policy]{req_tidy_policy()}} } \concept{opinionated request functions} diff --git a/man/req_pkg_user_agent.Rd b/man/req_pkg_user_agent.Rd index 5140709..4268774 100644 --- a/man/req_pkg_user_agent.Rd +++ b/man/req_pkg_user_agent.Rd @@ -21,7 +21,7 @@ will usually be automatically determined based on the source of the call.} package (default \code{NULL}).} \item{call}{(\code{environment}) The environment from which a function was called, -e.g. \code{\link[rlang:stack]{rlang::caller_env()}} (the default). The environment will be mentioned +e.g. \code{\link[rlang:caller_env]{rlang::caller_env()}} (the default). The environment will be mentioned in error messages as the source of the error. This argument is particularly useful for functions that are intended to be called as utilities inside other functions.} diff --git a/man/req_prepare.Rd b/man/req_prepare.Rd index f71c345..cd1a159 100644 --- a/man/req_prepare.Rd +++ b/man/req_prepare.Rd @@ -35,7 +35,7 @@ a list or character vector with the path as one or more unnamed arguments \item{query}{(\code{character} or \code{list}) An optional list or character vector of parameters to pass in the query portion of the request. Can also include a -\code{.multi} argument to pass to \code{\link[httr2:req_url]{httr2::req_url_query()}} to control how +\code{.multi} argument to pass to \code{\link[httr2:req_url_query]{httr2::req_url_query()}} to control how elements containing multiple values are handled.} \item{body}{(multiple types) An object to use as the body of the request. If @@ -74,7 +74,7 @@ request by \code{\link[=req_perform_opinionated]{req_perform_opinionated()}} and \code{\link[httr2:req_perform_iterative]{httr2::req_perform_iterative()}}.} \item{call}{(\code{environment}) The environment from which a function was called, -e.g. \code{\link[rlang:stack]{rlang::caller_env()}} (the default). The environment will be mentioned +e.g. \code{\link[rlang:caller_env]{rlang::caller_env()}} (the default). The environment will be mentioned in error messages as the source of the error. This argument is particularly useful for functions that are intended to be called as utilities inside other functions.} @@ -96,10 +96,10 @@ req_prepare( ) } \seealso{ -Other opinionated request functions: -\code{\link{req_init}()}, -\code{\link{req_modify}()}, -\code{\link{req_pagination_policy}()}, -\code{\link{req_tidy_policy}()} +Other opinionated request functions: +\code{\link[=req_init]{req_init()}}, +\code{\link[=req_modify]{req_modify()}}, +\code{\link[=req_pagination_policy]{req_pagination_policy()}}, +\code{\link[=req_tidy_policy]{req_tidy_policy()}} } \concept{opinionated request functions} diff --git a/man/req_tidy_policy.Rd b/man/req_tidy_policy.Rd index f019ba0..5bf17af 100644 --- a/man/req_tidy_policy.Rd +++ b/man/req_tidy_policy.Rd @@ -21,7 +21,7 @@ to tidy the response.} \code{tidy_fn}.} \item{call}{(\code{environment}) The environment from which a function was called, -e.g. \code{\link[rlang:stack]{rlang::caller_env()}} (the default). The environment will be mentioned +e.g. \code{\link[rlang:caller_env]{rlang::caller_env()}} (the default). The environment will be mentioned in error messages as the source of the error. This argument is particularly useful for functions that are intended to be called as utilities inside other functions.} @@ -39,10 +39,10 @@ req <- httr2::request("https://example.com") req_tidy_policy(req, httr2::resp_body_json, list(simplifyVector = TRUE)) } \seealso{ -Other opinionated request functions: -\code{\link{req_init}()}, -\code{\link{req_modify}()}, -\code{\link{req_pagination_policy}()}, -\code{\link{req_prepare}()} +Other opinionated request functions: +\code{\link[=req_init]{req_init()}}, +\code{\link[=req_modify]{req_modify()}}, +\code{\link[=req_pagination_policy]{req_pagination_policy()}}, +\code{\link[=req_prepare]{req_prepare()}} } \concept{opinionated request functions} diff --git a/man/resp_body_auto.Rd b/man/resp_body_auto.Rd index e2a318e..345b6dd 100644 --- a/man/resp_body_auto.Rd +++ b/man/resp_body_auto.Rd @@ -16,7 +16,7 @@ The parsed response body. \description{ Use the \code{Content-Type} header (extracted using \code{\link[httr2:resp_content_type]{httr2::resp_content_type()}}) of a response to automatically choose and apply a body parser, such as -\code{\link[httr2:resp_body_raw]{httr2::resp_body_json()}} or \code{\link[=resp_body_csv]{resp_body_csv()}}. +\code{\link[httr2:resp_body_json]{httr2::resp_body_json()}} or \code{\link[=resp_body_csv]{resp_body_csv()}}. } \examples{ resp_json <- httr2::response_json(body = list(a = 1, b = "hello")) diff --git a/man/resp_body_separate.Rd b/man/resp_body_separate.Rd index c5df4f5..f70dec6 100644 --- a/man/resp_body_separate.Rd +++ b/man/resp_body_separate.Rd @@ -15,7 +15,7 @@ response. Default: \code{\link[=resp_body_auto]{resp_body_auto()}}.} } \value{ The parsed response body wrapped in a \code{\link[=list]{list()}}. This is useful for -things like raw vectors that you wish to parse with \code{\link[httr2:resps_successes]{httr2::resps_data()}}. +things like raw vectors that you wish to parse with \code{\link[httr2:resps_data]{httr2::resps_data()}}. } \description{ Wrap the parsed response body in a \code{\link[=list]{list()}}. Unlike \code{\link[=resp_body_auto]{resp_body_auto()}}, this diff --git a/man/resp_parse.Rd b/man/resp_parse.Rd index 1f91ca0..5c54674 100644 --- a/man/resp_parse.Rd +++ b/man/resp_parse.Rd @@ -31,20 +31,20 @@ will be mentioned in error messages as the input that is at the origin of a problem.} \item{call}{(\code{environment}) The environment from which a function was called, -e.g. \code{\link[rlang:stack]{rlang::caller_env()}} (the default). The environment will be mentioned +e.g. \code{\link[rlang:caller_env]{rlang::caller_env()}} (the default). The environment will be mentioned in error messages as the source of the error. This argument is particularly useful for functions that are intended to be called as utilities inside other functions.} \item{response_parser}{(\code{function}) A function to parse the server response -(\code{resp}). Defaults to \code{\link[httr2:resp_body_raw]{httr2::resp_body_json()}}, since JSON responses are +(\code{resp}). Defaults to \code{\link[httr2:resp_body_json]{httr2::resp_body_json()}}, since JSON responses are common. Set this to \code{NULL} to return the raw response from \code{\link[httr2:req_perform]{httr2::req_perform()}}.} } \value{ The response parsed by the \code{response_parser}. If \code{resps} was a list, the parsed responses are concatenated when possible. Unlike -\link[httr2:resps_successes]{httr2::resps_data}, this function does not concatenate raw vector +\link[httr2:resps_data]{httr2::resps_data}, this function does not concatenate raw vector responses. } \description{ diff --git a/man/resp_tidy.Rd b/man/resp_tidy.Rd index 4252c41..a79a711 100644 --- a/man/resp_tidy.Rd +++ b/man/resp_tidy.Rd @@ -14,7 +14,7 @@ list of such objects (as returned by \code{\link[=req_perform_opinionated]{req_p } \value{ The extracted and cleaned response, or, for a list of responses, -those responses cleaned then concatenated via \code{\link[httr2:resps_successes]{httr2::resps_data()}}. By +those responses cleaned then concatenated via \code{\link[httr2:resps_data]{httr2::resps_data()}}. By default, the response is processed with \code{\link[=resp_body_auto]{resp_body_auto()}}. } \description{ @@ -34,7 +34,7 @@ req <- req_tidy_policy( httr2::resp_body_json ) # In practice, the request is attached automatically when the response is -# fetched with req_perform() or req_perform_opinionated(). +# fetched with httr2::req_perform() or req_perform_opinionated(). resp$request <- req resp_tidy(resp) } diff --git a/man/resp_tidy_json.Rd b/man/resp_tidy_json.Rd index 3fb1309..94270a2 100644 --- a/man/resp_tidy_json.Rd +++ b/man/resp_tidy_json.Rd @@ -32,7 +32,7 @@ field such as \code{data}. If the desired part of the response body is in The tibblified response body. } \description{ -Parse the body of a response with \code{\link[httr2:resp_body_raw]{httr2::resp_body_json()}}, extract a named +Parse the body of a response with \code{\link[httr2:resp_body_json]{httr2::resp_body_json()}}, extract a named subset of that body, and tidy the result with \code{\link[tibblify:tibblify]{tibblify::tibblify()}}. } \examples{ diff --git a/man/resp_tidy_unknown.Rd b/man/resp_tidy_unknown.Rd index 7f22a71..3d1e0ba 100644 --- a/man/resp_tidy_unknown.Rd +++ b/man/resp_tidy_unknown.Rd @@ -11,7 +11,7 @@ resp_tidy_unknown(resp, call = rlang::caller_env()) returned by \code{\link[httr2:req_perform]{httr2::req_perform()}}).} \item{call}{(\code{environment}) The environment from which a function was called, -e.g. \code{\link[rlang:stack]{rlang::caller_env()}} (the default). The environment will be mentioned +e.g. \code{\link[rlang:caller_env]{rlang::caller_env()}} (the default). The environment will be mentioned in error messages as the source of the error. This argument is particularly useful for functions that are intended to be called as utilities inside other functions.} diff --git a/man/url_path_append.Rd b/man/url_path_append.Rd index a96c14c..f2e1abf 100644 --- a/man/url_path_append.Rd +++ b/man/url_path_append.Rd @@ -16,7 +16,7 @@ A modified URL. } \description{ Append zero or more path elements to a URL without duplicating "/" -characters. Based on \code{\link[httr2:req_url]{httr2::req_url_path_append()}}. +characters. Based on \code{\link[httr2:req_url_path_append]{httr2::req_url_path_append()}}. } \examples{ url_path_append("https://example.com", "api", "v1", "users") From eafefad2a1a3e43e493d45fbd386592fbcffeda1 Mon Sep 17 00:00:00 2001 From: Jon Harmon Date: Fri, 8 May 2026 16:27:34 -0500 Subject: [PATCH 2/2] Update actions --- .github/workflows/R-CMD-check.yaml | 2 +- .github/workflows/copilot-setup-steps.yml | 4 +- .github/workflows/install/action.yml | 118 ---------------------- .github/workflows/pkgdown-cleanup.yaml | 2 +- .github/workflows/pkgdown.yaml | 2 +- .github/workflows/pr-commands.yaml | 2 +- .github/workflows/qcthat.yaml | 2 +- .github/workflows/test-coverage.yaml | 2 +- 8 files changed, 9 insertions(+), 125 deletions(-) delete mode 100644 .github/workflows/install/action.yml diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 25cb2c5..efb3807 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -28,7 +28,7 @@ jobs: steps: - uses: actions/checkout@v6 - - uses: ./.github/workflows/install + - uses: api2r/actions/install@v1 with: use-container: "${{ matrix.config.container != '' }}" token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/copilot-setup-steps.yml b/.github/workflows/copilot-setup-steps.yml index ff25245..e1907e1 100644 --- a/.github/workflows/copilot-setup-steps.yml +++ b/.github/workflows/copilot-setup-steps.yml @@ -22,7 +22,7 @@ jobs: steps: - uses: actions/checkout@v6 - - uses: ./.github/workflows/install + - uses: api2r/actions/install@v1 with: token: ${{ secrets.GITHUB_TOKEN }} cache-version: copilot @@ -41,9 +41,11 @@ jobs: any::rcmdcheck any::rlang any::roxygen2 + any::stbl any::testthat any::usethis any::withr + Gilead-BioStats/qcthat local::. - name: Install air diff --git a/.github/workflows/install/action.yml b/.github/workflows/install/action.yml deleted file mode 100644 index ff4ba5e..0000000 --- a/.github/workflows/install/action.yml +++ /dev/null @@ -1,118 +0,0 @@ -name: "Install R and dependencies" -description: "Set up pandoc, R, and package dependencies" -inputs: - token: - description: "GitHub token, set to secrets.GITHUB_TOKEN" - required: true - r-version: - description: "R version, passed to r-lib/actions/setup-r@v2" - required: false - default: release - http-user-agent: - description: "HTTP user agent, passed to r-lib/actions/setup-r@v2" - required: false - default: "" - needs: - description: "Config/Needs tag(s), passed to r-lib/actions/setup-r-dependencies@v2" - required: false - default: "" - extra-packages: - description: "Extra packages, passed to r-lib/actions/setup-r-dependencies@v2" - required: false - default: any::rcmdcheck - optional-packages: - description: "Optional extra packages; installed individually, warn (not error) on failure" - required: false - default: "" - cache-version: - description: "Cache version for r-lib/actions/setup-r-dependencies@v2" - required: false - default: "1" - use-container: - description: "Set to 'true' when running inside a pre-warmed container (skips R and pandoc setup)" - required: false - default: "false" - -runs: - using: "composite" - steps: - - if: inputs.use-container != 'true' - uses: r-lib/actions/setup-pandoc@v2 - - - uses: r-lib/actions/setup-r@v2 - with: - install-r: ${{ inputs.use-container != 'true' }} - r-version: ${{ inputs.r-version }} - http-user-agent: ${{ inputs.http-user-agent }} - use-public-rspm: true - - # In pre-warmed containers every package may already be in the system - # library, so nothing is ever written to R_LIBS_USER. Ensure the - # directory exists with a sentinel so the actions/cache glob matches - # and the "Path Validation Error" warning doesn't fire at cache-save. - - if: inputs.use-container == 'true' - name: Ensure R_LIBS_USER exists - shell: bash - run: | - lib="$(Rscript -e 'cat(Sys.getenv("R_LIBS_USER"))')" - mkdir -p "$lib" - touch "$lib/.keep" - - # Container path: call pak::pak() directly so it checks .libPaths() and - # only installs/updates packages that are genuinely missing or outdated. - # setup-r-dependencies always runs a full lockfile-create → lockfile-install - # cycle which reinstalls everything even when the container already has it. - - if: inputs.use-container == 'true' - name: Update R package dependencies (container) - shell: Rscript {0} - env: - GITHUB_PAT: ${{ inputs.token }} - run: | - # Replicate needs → Config/Needs/ expansion from r-lib/actions - needs_parts <- strsplit("${{ inputs.needs }}", "[[:space:],]+")[[1]] - needs_parts <- needs_parts[nzchar(needs_parts)] - needs <- sprintf("Config/Needs/%s", needs_parts) - - extra_deps <- strsplit("${{ inputs.extra-packages }}", "[[:space:],]+")[[1]] - extra_deps <- extra_deps[nzchar(extra_deps)] - - # Over-protect for strangeness in the container - if (!requireNamespace("pak", quietly = TRUE)) { - install.packages("pak") - } - - pak::pak( - c("deps::.", extra_deps), - dependencies = c(needs, "all"), - upgrade = TRUE, - ask = FALSE - ) - - # Non-container path: standard setup-r-dependencies flow with caching. - - if: inputs.use-container != 'true' - uses: r-lib/actions/setup-r-dependencies@v2 - env: - GITHUB_PAT: ${{ inputs.token }} - with: - needs: ${{ inputs.needs }} - extra-packages: ${{ inputs.extra-packages }} - cache-version: ${{ inputs.cache-version }} - - - if: inputs.optional-packages != '' - name: Install optional packages - shell: Rscript {0} - env: - GITHUB_PAT: ${{ inputs.token }} - run: | - pkgs <- strsplit("${{ inputs.optional-packages }}", "\\s+")[[1]] - pkgs <- pkgs[nzchar(pkgs)] - for (pkg in pkgs) { - tryCatch( - pak::pak(pkg), - error = function(e) { - msg <- sprintf("Failed to install optional package %s: %s", pkg, conditionMessage(e)) - msg <- gsub("[\r\n]+", " ", msg) - cat("::warning::", msg, "\n", sep = "") - } - ) - } diff --git a/.github/workflows/pkgdown-cleanup.yaml b/.github/workflows/pkgdown-cleanup.yaml index 02e8f08..d8ea7c2 100644 --- a/.github/workflows/pkgdown-cleanup.yaml +++ b/.github/workflows/pkgdown-cleanup.yaml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout gh-pages branch - uses: actions/checkout@v5 + uses: actions/checkout@v6 with: repository: ${{ github.repository }} token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml index afc5f44..7f4f411 100644 --- a/.github/workflows/pkgdown.yaml +++ b/.github/workflows/pkgdown.yaml @@ -27,7 +27,7 @@ jobs: steps: - uses: actions/checkout@v6 - - uses: ./.github/workflows/install + - uses: api2r/actions/install@v1 with: use-container: "true" token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/pr-commands.yaml b/.github/workflows/pr-commands.yaml index 8c94262..8c2f575 100644 --- a/.github/workflows/pr-commands.yaml +++ b/.github/workflows/pr-commands.yaml @@ -22,7 +22,7 @@ jobs: with: repo-token: ${{ secrets.GITHUB_TOKEN }} - - uses: ./.github/workflows/install + - uses: api2r/actions/install@v1 with: use-container: "true" token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/qcthat.yaml b/.github/workflows/qcthat.yaml index a6ea54c..2adec84 100644 --- a/.github/workflows/qcthat.yaml +++ b/.github/workflows/qcthat.yaml @@ -58,7 +58,7 @@ jobs: steps: - uses: actions/checkout@v6 - - uses: ./.github/workflows/install + - uses: api2r/actions/install@v1 with: use-container: "true" token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml index 6878a49..8b7a5f3 100644 --- a/.github/workflows/test-coverage.yaml +++ b/.github/workflows/test-coverage.yaml @@ -16,7 +16,7 @@ jobs: steps: - uses: actions/checkout@v6 - - uses: ./.github/workflows/install + - uses: api2r/actions/install@v1 with: use-container: "true" token: ${{ secrets.GITHUB_TOKEN }}