diff --git a/DESCRIPTION b/DESCRIPTION index c0f284a..d88c934 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -25,9 +25,7 @@ Authors@R: role = c("aut", "cre"), email = "luca.belmonte@efsa.europa.eu", comment = c(ORCID = "0000-0002-7977-9170"))) -Description: Provides a pool of functions to query 'DistillerSR' through its - APIs. It features authentication and utilities to retrieve data from - 'DistillerSR' projects and reports. See +Description: Interface to 'DistillerSR' APIs. See for more details. License: EUPL-1.2 URL: https://openefsa.github.io/distilleR/ diff --git a/R/buildAuthenticationRequest.R b/R/buildAuthenticationRequest.R index 47baf72..f75534a 100644 --- a/R/buildAuthenticationRequest.R +++ b/R/buildAuthenticationRequest.R @@ -26,14 +26,6 @@ #' #' @importFrom checkmate assert_string assert_int #' @importFrom httr2 request req_method req_headers req_timeout -#' -#' @examplesIf FALSE -#' distillerInstanceUrl_ <- "https://url.to.distiller.instance" -#' distillerKey_ <- "YOUR_API_KEY" -#' -#' request_ <- .buildAuthenticationRequest( -#' distillerInstanceUrl = distillerInstanceUrl_, -#' distillerKey = distillerKey_) #' #' @keywords internal #' @noRd diff --git a/R/buildServiceRequest.R b/R/buildServiceRequest.R index 607d3be..78b19aa 100644 --- a/R/buildServiceRequest.R +++ b/R/buildServiceRequest.R @@ -30,15 +30,6 @@ #' #' @importFrom checkmate assert_string assert_list assert_int #' @importFrom httr2 request req_method req_headers req_timeout req_body_json -#' -#' @examplesIf FALSE -#' serviceUrl_ <- "https://url.to.distiller.instance/projects" -#' -#' distillerToken_ <- getAuthenticationToken() -#' -#' serviceRequest_ <- .buildServiceRequest( -#' serviceUrl = serviceUrl_, -#' distillerToken = distillerToken_) #' #' @keywords internal #' @noRd diff --git a/R/getAuthenticationToken.R b/R/getAuthenticationToken.R index fd202a2..017e5ed 100644 --- a/R/getAuthenticationToken.R +++ b/R/getAuthenticationToken.R @@ -26,7 +26,8 @@ #' #' @importFrom checkmate assert_string assert_int #' -#' @examplesIf FALSE +#' @examples +#' \dontrun{ #' # If 'DISTILLER_INSTANCE_URL' and 'DISTILLER_API_KEY' are defined in your #' # environment (e.g. .Renviron). #' distillerToken_ <- getAuthenticationToken() @@ -34,8 +35,8 @@ #' # If 'distillerInstanceUrl' and 'distillerKey' are to be specified manually. #' distillerToken_ <- getAuthenticationToken( #' distillerInstanceUrl = "https://url.to.distiller.instance", -#' distillerKey = "YOUR_API_KEY" -#' ) +#' distillerKey = "YOUR_API_KEY") +#' } #' #' @export #' diff --git a/R/getProjects.R b/R/getProjects.R index 08512b2..61dd4c4 100644 --- a/R/getProjects.R +++ b/R/getProjects.R @@ -30,10 +30,12 @@ #' #' @seealso \code{\link{getAuthenticationToken}} #' -#' @examplesIf FALSE +#' @examples +#' \dontrun{ #' distillerToken_ <- getAuthenticationToken() #' #' projects_ <- getProjects(distillerToken = distillerToken_) +#' } #' #' @export #' diff --git a/R/getReport.R b/R/getReport.R index dfaa5f9..7a93826 100644 --- a/R/getReport.R +++ b/R/getReport.R @@ -47,9 +47,12 @@ #' @seealso \code{\link{getProjects}} #' @seealso \code{\link{getReports}} #' -#' @examplesIf FALSE +#' @examples +#' \dontrun{ #' distillerToken_ <- getAuthenticationToken() +#' #' projects_ <- getProjects(distillerToken = distillerToken_) +#' #' reports_ <- getReports( #' projectId = projects_$id[1], #' distillerToken = distillerToken_) @@ -59,6 +62,7 @@ #' reportID = reports_$id[7], #' format = "csv", #' distillerToken = distillerToken_) +#' } #' #' @export #' diff --git a/R/getReports.R b/R/getReports.R index 8b3f6a9..ae1f493 100644 --- a/R/getReports.R +++ b/R/getReports.R @@ -34,13 +34,16 @@ #' @seealso \code{\link{getAuthenticationToken}} #' @seealso \code{\link{getProjects}} #' -#' @examplesIf FALSE +#' @examples +#' \dontrun{ #' distillerToken_ <- getAuthenticationToken() +#' #' projects_ <- getProjects(distillerToken = distillerToken_) #' #' reports_ <- getReports( #' projectId = projects_$id[1], #' distillerToken = distillerToken_) +#' } #' #' @export #' diff --git a/R/handleHTTPErrors.R b/R/handleHTTPErrors.R index 9cd7f7c..d3473c3 100644 --- a/R/handleHTTPErrors.R +++ b/R/handleHTTPErrors.R @@ -15,11 +15,6 @@ #' @importFrom checkmate assert_class assert_string #' @importFrom httr2 resp_status #' @importFrom cli cli_abort -#' -#' @examplesIf FALSE -#' response_ <- req_perform(request("https://example.org/")) -#' -#' .handleHTTPErrors(response = response_) #' #' @keywords internal #' @noRd diff --git a/R/parseCSVResponse.R b/R/parseCSVResponse.R index 7b38cf4..7292709 100644 --- a/R/parseCSVResponse.R +++ b/R/parseCSVResponse.R @@ -23,11 +23,6 @@ #' @importFrom readr read_csv cols #' @importFrom httr2 resp_body_string #' @importFrom cli cli_abort -#' -#' @examplesIf FALSE -#' response_ <- req_perform(request("https://example.org/")) -#' -#' csvResponseData_ <- .parseCSVResponse(response = response_) #' #' @keywords internal #' @noRd diff --git a/R/parseJSONResponse.R b/R/parseJSONResponse.R index 66b43c0..b3a21b0 100644 --- a/R/parseJSONResponse.R +++ b/R/parseJSONResponse.R @@ -18,11 +18,6 @@ #' @importFrom jsonlite fromJSON #' @importFrom httr2 resp_body_string #' @importFrom cli cli_abort -#' -#' @examplesIf FALSE -#' response_ <- req_perform(request("https://example.org/")) -#' -#' responseData_ <- .parseJSONResponse(response = response_) #' #' @keywords internal #' @noRd diff --git a/R/parseXLSXResponse.R b/R/parseXLSXResponse.R index 58aeba7..370ea81 100644 --- a/R/parseXLSXResponse.R +++ b/R/parseXLSXResponse.R @@ -18,11 +18,6 @@ #' @importFrom readxl read_excel #' @importFrom httr2 resp_body_raw #' @importFrom cli cli_abort -#' -#' @examplesIf FALSE -#' response_ <- req_perform(request("https://example.org/")) -#' -#' xlsxResponseData_ <- .parseXLSXResponse(response = response_) #' #' @keywords internal #' @noRd diff --git a/R/performRequest.R b/R/performRequest.R index 1720121..b132415 100644 --- a/R/performRequest.R +++ b/R/performRequest.R @@ -17,11 +17,6 @@ #' @importFrom httr2 req_perform #' @importFrom cli cli_abort #' -#' @examplesIf FALSE -#' request_ <- request("https://example.org/") -#' -#' response_ <- .performRequest(request = request_) -#' #' @keywords internal #' @noRd #' diff --git a/R/sleep.R b/R/sleep.R index a44948d..9f26de8 100644 --- a/R/sleep.R +++ b/R/sleep.R @@ -6,10 +6,6 @@ #' @param seconds `integer`. The maximum number of seconds to wait. #' #' @importFrom checkmate assert_int -#' -#' @examplesIf FALSE -#' # Sleep for 1 second. -#' .sleep(1) #' #' @keywords internal #' @noRd diff --git a/man/distilleR-package.Rd b/man/distilleR-package.Rd index 7481e9a..2e14546 100644 --- a/man/distilleR-package.Rd +++ b/man/distilleR-package.Rd @@ -8,7 +8,7 @@ \description{ \if{html}{\figure{logo.png}{options: style='float: right' alt='logo' width='120'}} -Provides a pool of functions to query 'DistillerSR' through its APIs. It features authentication and utilities to retrieve data from 'DistillerSR' projects and reports. See \url{https://apidocs.evidencepartners.com/} for more details. +Interface to 'DistillerSR' APIs. See \url{https://apidocs.evidencepartners.com/} for more details. } \seealso{ Useful links: diff --git a/man/getAuthenticationToken.Rd b/man/getAuthenticationToken.Rd index 309cf5a..eefb613 100644 --- a/man/getAuthenticationToken.Rd +++ b/man/getAuthenticationToken.Rd @@ -39,7 +39,7 @@ By default, the personal access key and the instance URL are read from the environment variables \code{DISTILLER_API_KEY} and \code{DISTILLER_INSTANCE_URL}. } \examples{ -\dontshow{if (FALSE) withAutoprint(\{ # examplesIf} +\dontrun{ # If 'DISTILLER_INSTANCE_URL' and 'DISTILLER_API_KEY' are defined in your # environment (e.g. .Renviron). distillerToken_ <- getAuthenticationToken() @@ -47,7 +47,7 @@ distillerToken_ <- getAuthenticationToken() # If 'distillerInstanceUrl' and 'distillerKey' are to be specified manually. distillerToken_ <- getAuthenticationToken( distillerInstanceUrl = "https://url.to.distiller.instance", - distillerKey = "YOUR_API_KEY" -) -\dontshow{\}) # examplesIf} + distillerKey = "YOUR_API_KEY") +} + } diff --git a/man/getProjects.Rd b/man/getProjects.Rd index 744b5b5..066c1ca 100644 --- a/man/getProjects.Rd +++ b/man/getProjects.Rd @@ -39,11 +39,12 @@ and a valid API instance URL. The result is a dataframe listing available projects. } \examples{ -\dontshow{if (FALSE) withAutoprint(\{ # examplesIf} +\dontrun{ distillerToken_ <- getAuthenticationToken() projects_ <- getProjects(distillerToken = distillerToken_) -\dontshow{\}) # examplesIf} +} + } \seealso{ \code{\link{getAuthenticationToken}} diff --git a/man/getReport.Rd b/man/getReport.Rd index b3bde95..23973fa 100644 --- a/man/getReport.Rd +++ b/man/getReport.Rd @@ -60,9 +60,11 @@ and a valid API endpoint URL. The result is a dataframe containing metadata about the saved report. } \examples{ -\dontshow{if (FALSE) withAutoprint(\{ # examplesIf} +\dontrun{ distillerToken_ <- getAuthenticationToken() + projects_ <- getProjects(distillerToken = distillerToken_) + reports_ <- getReports( projectId = projects_$id[1], distillerToken = distillerToken_) @@ -72,7 +74,8 @@ report_ <- getReport( reportID = reports_$id[7], format = "csv", distillerToken = distillerToken_) -\dontshow{\}) # examplesIf} +} + } \seealso{ \code{\link{getAuthenticationToken}} diff --git a/man/getReports.Rd b/man/getReports.Rd index 13060f6..4ae6850 100644 --- a/man/getReports.Rd +++ b/man/getReports.Rd @@ -43,14 +43,16 @@ and a valid API endpoint URL. The result is a dataframe containing metadata about each saved report. } \examples{ -\dontshow{if (FALSE) withAutoprint(\{ # examplesIf} +\dontrun{ distillerToken_ <- getAuthenticationToken() + projects_ <- getProjects(distillerToken = distillerToken_) reports_ <- getReports( projectId = projects_$id[1], distillerToken = distillerToken_) -\dontshow{\}) # examplesIf} +} + } \seealso{ \code{\link{getAuthenticationToken}}