-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Establish and apply formal principles (#28)
- Loading branch information
1 parent
746ac82
commit cf92bd8
Showing
30 changed files
with
370 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,4 @@ | |
^_pkgdown\.yml$ | ||
^docs$ | ||
^pkgdown$ | ||
^principles\.md$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#' Add a method if it is supplied | ||
#' | ||
#' [httr2::req_method()] errors if `method` is `NULL`, rather than using the | ||
#' default rules. This function deals with that. | ||
#' | ||
#' @inheritParams .shared-parameters | ||
#' @param method If the method is something other than GET or POST, supply it. | ||
#' Case is ignored. | ||
#' | ||
#' @inherit .shared-request return | ||
#' @keywords internal | ||
.req_method_apply <- function(req, method) { | ||
.do_if_args_defined(req, httr2::req_method, method = method) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#' Process a path with glue syntax and append it | ||
#' | ||
#' @inheritParams .shared-parameters | ||
#' @param path The route to an API endpoint. Optionally, a list or character | ||
#' vector with the path as one or more unnamed arguments (which will be | ||
#' concatenated with "/") plus named arguments to [glue::glue()] into the | ||
#' path. | ||
#' | ||
#' @inherit .shared-request return | ||
#' @keywords internal | ||
.req_path_append <- function(req, path) { | ||
.do_if_args_defined(req, .req_path_append_impl, path = path) | ||
} | ||
|
||
.req_path_append_impl <- function(req, path) { | ||
path <- rlang::inject(glue::glue(!!!path, .sep = "/")) | ||
path <- url_normalize(path) | ||
req <- httr2::req_url_path_append(req, path) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,15 @@ | ||
.req_query_flatten <- function(req, query) { | ||
#' Add non-empty query elements to a request | ||
#' | ||
#' @inheritParams .shared-parameters | ||
#' @param query An optional list or character vector of parameters to pass in | ||
#' the query portion of the request. Can also include a `.multi` argument to | ||
#' pass to [httr2::req_url_query()] to control how elements containing | ||
#' multiple values are handled. | ||
#' | ||
#' @inherit .shared-request return | ||
#' @keywords internal | ||
.req_query_flatten <- function(req, | ||
query) { | ||
query <- purrr::discard(query, is.null) | ||
query <- purrr::map_chr(query, .prepare_query_element) | ||
return(httr2::req_url_query(req, !!!query)) | ||
} | ||
|
||
.prepare_query_element <- function(query_element) { | ||
return(paste(unlist(query_element), collapse = ",")) | ||
rlang::inject(httr2::req_url_query(req, !!!query)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
10 changes: 5 additions & 5 deletions
10
man/dot-security_api_key_cookie.Rd → man/dot-req_auth_api_key_cookie.Rd
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
8 changes: 4 additions & 4 deletions
8
man/dot-security_api_key_header.Rd → man/dot-req_auth_api_key_header.Rd
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.