diff --git a/R/auth.R b/R/auth.R index 0ea0b1fa..72c2b577 100644 --- a/R/auth.R +++ b/R/auth.R @@ -173,9 +173,8 @@ ask_pass <- function(type) { val } -#' Generate a Bearer token from a client -#' #' @export +#' @rdname rtweet_user rtweet_bearer <- function(client = NULL, scopes = set_scopes()) { client <- client %||% client_get() @@ -200,7 +199,7 @@ rtweet_bearer <- function(client = NULL, scopes = set_scopes()) { token } -#' @seealso [invalidate_bearer()] +# @seealso [invalidate_bearer()] rtweet_invalidate <- function(api_key, api_secret, token = NULL) { if (missing(api_key)) { api_key <- ask_pass("API key") diff --git a/R/bearer_token.R b/R/bearer_token.R index 5ba89a2b..fe24ec76 100644 --- a/R/bearer_token.R +++ b/R/bearer_token.R @@ -26,7 +26,6 @@ bearer_token <- function(token = NULL) { #' @references #' #' @keywords internal -#' @seealso [rtweet_invalidate()] #' @export invalidate_bearer <- function(api_key, api_secret, client = NULL, token = NULL) { # See also rtweet_invalidate in auth.R diff --git a/R/collections.R b/R/collections.R index 92bd1928..ff5678c3 100644 --- a/R/collections.R +++ b/R/collections.R @@ -12,7 +12,7 @@ lookup_collections <- function(id, n = 200, parse = TRUE, token = NULL, ...) { - lifecycle::deprecate_stop("1.0.0", "lookup_collections()") + lifecycle::deprecate_stop("1.0.0", function_call()) } #' @export @@ -24,5 +24,5 @@ get_collections <- function(user = NULL, parse = TRUE, token = NULL) { - lifecycle::deprecate_stop("1.0.0", "get_collections()") + lifecycle::deprecate_stop("1.0.0", function_call()) } diff --git a/R/http.R b/R/http.R index 9f3b3fb7..73d22f40 100644 --- a/R/http.R +++ b/R/http.R @@ -27,6 +27,9 @@ TWIT_method <- function(method, token, api, retryonratelimit = NULL, verbose = TRUE, ...) { + lifecycle::deprecate_stop("2.0.0", function_caller(), + details = c("The removal of API v1.1 made this function obsolete.", + "See the new vignette about the new requirements and functions.")) # need scipen to ensure large IDs are not displayed in scientific notation # need ut8-encoding for the comma separated IDs withr::local_options(scipen = 14, encoding = "UTF-8") diff --git a/R/ts_plot.R b/R/ts_plot.R index b26c0ed0..58c03c2c 100644 --- a/R/ts_plot.R +++ b/R/ts_plot.R @@ -31,6 +31,7 @@ #' @family ts_data #' @export ts_plot <- function(data, by = "days", trim = 0L, tz ="UTC", ...) { + lifecycle::deprecate_stop("2.0.0", function_call()) data <- ts_data(data, by, trim, tz) check_installed("ggplot2") @@ -79,6 +80,7 @@ ts_plot <- function(data, by = "days", trim = 0L, tz ="UTC", ...) { #' #' @export ts_data <- function(data, by = "days", trim = 0L, tz ="UTC") { + lifecycle::deprecate_stop("2.0.0", function_call()) stopifnot(is.data.frame(data), is.atomic(by) && !is.null(by)) if (has_name_(data, "created_at")) { dtvar <- "created_at" diff --git a/R/utils.R b/R/utils.R index 4e1e5b74..6b944fb9 100644 --- a/R/utils.R +++ b/R/utils.R @@ -92,3 +92,12 @@ release_bullets <- function() { "Check spelling with: `spelling::spell_check_package()`", "Run manual tests.") } + + +function_call <- function() { + paste0(as.character(sys.call(sys.parent(1)))[1L], "()") +} + +function_caller <- function() { + paste0(as.character(sys.call(1))[1L], "()") +} diff --git a/man/invalidate_bearer.Rd b/man/invalidate_bearer.Rd index 2d1ff2d8..0783d182 100644 --- a/man/invalidate_bearer.Rd +++ b/man/invalidate_bearer.Rd @@ -24,7 +24,4 @@ Not tested! \url{https://developer.twitter.com/en/docs/authentication/api-reference/invalidate_bearer_token} \url{https://developer.twitter.com/en/docs/authentication/api-reference/invalidate_access_token} } -\seealso{ -\code{\link[=rtweet_invalidate]{rtweet_invalidate()}} -} \keyword{internal} diff --git a/man/rtweet_bearer.Rd b/man/rtweet_bearer.Rd deleted file mode 100644 index f7da3887..00000000 --- a/man/rtweet_bearer.Rd +++ /dev/null @@ -1,11 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/auth.R -\name{rtweet_bearer} -\alias{rtweet_bearer} -\title{Generate a Bearer token from a client} -\usage{ -rtweet_bearer(client = NULL, scopes = set_scopes()) -} -\description{ -Generate a Bearer token from a client -} diff --git a/man/rtweet_user.Rd b/man/rtweet_user.Rd index 1197079f..c38e94f9 100644 --- a/man/rtweet_user.Rd +++ b/man/rtweet_user.Rd @@ -4,6 +4,7 @@ \alias{rtweet_user} \alias{rtweet_bot} \alias{rtweet_app} +\alias{rtweet_bearer} \alias{rtweet_oauth2} \title{Authentication options} \usage{ @@ -18,6 +19,8 @@ rtweet_bot(api_key, api_secret, access_token, access_secret, app = "rtweet") rtweet_app(bearer_token) +rtweet_bearer(client = NULL, scopes = set_scopes()) + rtweet_oauth2(client = NULL, scopes = NULL) } \arguments{