From f19bb7ed864e94cf1c16f519a997385ceac7ab81 Mon Sep 17 00:00:00 2001 From: Christopher Date: Mon, 25 Sep 2023 12:19:40 -0700 Subject: [PATCH] update documentation to match httr2 program flow --- R/api_calls.R | 10 +++++----- man/format_params.Rd | 2 +- man/paginate.Rd | 2 +- man/quantaq_request.Rd | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/R/api_calls.R b/R/api_calls.R index acee6f4..1233da2 100644 --- a/R/api_calls.R +++ b/R/api_calls.R @@ -2,14 +2,14 @@ #' #' Generate an API request given an endpoint and any relevant query parameters. #' -#' @param endpoint A character string of the API endpoint to request. +#' @param endpoint A character string of the API endpoint to request. Can be a full url, or a relative endpoint for the QuantAQ API #' @param qs_params Query string parameters. #' #' @examples #' \dontrun{r <- quantaq_request("account")} #' -#' # include named arguments for query params, e.g. to limit the response to the first 5 results: -#' \dontrun{r <- quantaq_request("devices/MOD-PM-00808/data", limit = 5)} +#' # include a named list for query params, e.g. to limit the response to the first 5 results: +#' \dontrun{r <- quantaq_request("devices/MOD-PM-00808/data", list(limit = 5))} #' #' @returns The parsed JSON from the API, including both data and metadata. #' @@ -36,7 +36,7 @@ quantaq_request <- function(endpoint, qs_params = NULL){ #' #' Iterates over and collated all pages of the data. #' -#' @param response_content Content from a \code{\link{request}()} +#' @param response_content JSON content from a [quantaq_request()] response #' #' @returns All collated pages of the data. #' @@ -58,7 +58,7 @@ paginate <- function(response_content){ #' Handle requests params #' -#' A helper function to format the parameters that can be passed to \code{requests()}. +#' A helper function to format the parameters that can be passed to [requests()]. #' #' @importFrom stringr str_split #' @param ... Parameters to be translated to query string and passed to the request. diff --git a/man/format_params.Rd b/man/format_params.Rd index 63fd8a2..04a9962 100644 --- a/man/format_params.Rd +++ b/man/format_params.Rd @@ -13,5 +13,5 @@ format_params(...) A named list of query params. } \description{ -A helper function to format the parameters that can be passed to \code{requests()}. +A helper function to format the parameters that can be passed to \code{\link[=requests]{requests()}}. } diff --git a/man/paginate.Rd b/man/paginate.Rd index f751599..20843e6 100644 --- a/man/paginate.Rd +++ b/man/paginate.Rd @@ -7,7 +7,7 @@ paginate(response_content) } \arguments{ -\item{response_content}{Content from a \code{\link{request}()}} +\item{response_content}{JSON content from a \code{\link[=quantaq_request]{quantaq_request()}} response} } \value{ All collated pages of the data. diff --git a/man/quantaq_request.Rd b/man/quantaq_request.Rd index fad1c5d..af68168 100644 --- a/man/quantaq_request.Rd +++ b/man/quantaq_request.Rd @@ -7,7 +7,7 @@ quantaq_request(endpoint, qs_params = NULL) } \arguments{ -\item{endpoint}{A character string of the API endpoint to request.} +\item{endpoint}{A character string of the API endpoint to request. Can be a full url, or a relative endpoint for the QuantAQ API} \item{qs_params}{Query string parameters.} } @@ -20,7 +20,7 @@ Generate an API request given an endpoint and any relevant query parameters. \examples{ \dontrun{r <- quantaq_request("account")} -# include named arguments for query params, e.g. to limit the response to the first 5 results: -\dontrun{r <- quantaq_request("devices/MOD-PM-00808/data", limit = 5)} +# include a named list for query params, e.g. to limit the response to the first 5 results: +\dontrun{r <- quantaq_request("devices/MOD-PM-00808/data", list(limit = 5))} }