Skip to content

Commit

Permalink
Pass through token
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Solymos <psolymos@gmail.com>
  • Loading branch information
psolymos committed Jan 31, 2024
1 parent 7bd7118 commit 0078c05
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions R/cu-pat.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,16 @@
#' * add a line with `CU_PAT="your_token"` to the `.Renviron` file and save it,
#' * check with `Sys.getenv("CU_PAT")`, it should return the token.
#'
#' @param token ClickUp personal access token.
#' @param token ClickUp personal access token or an access token from the OAuth flow.
#'
#' @return
#'
#' `cu_set_pat` returns logical similarly to [Sys.setenv()].
#'
#' `cu_get_pat` returns the ClickUp PAT will look something like
#' `cu_get_pat` returns the ClickUp PAT that will look something like
#' `pk_4753994_EXP7MPOJ7XQM5UJDV2M45MPF0YHH5YHO`.
#' When `token` is not `NULL` it will simply pass through the token value
#' and not look for the `CU_PAT` environment variable.
#'
#' @seealso [Sys.setenv()] and [Sys.getenv()]
#'
Expand All @@ -42,7 +44,9 @@ NULL

#' @export
#' @rdname cu-pat
cu_get_pat <- function() {
cu_get_pat <- function(token = NULL) {
if (!is.null(token))
return(invisible(token))
pat <- Sys.getenv("CU_PAT")
if (identical(pat, ""))
stop("Set CU_PAT env var as your ClickUp personal access token",
Expand Down

0 comments on commit 0078c05

Please sign in to comment.