File: post_destroy.R

package info (click to toggle)
r-cran-rtweet 2.0.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 18,068 kB
  • sloc: sh: 13; makefile: 2
file content (16 lines) | stat: -rw-r--r-- 662 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#' Delete status of user's Twitter account `r lifecycle::badge("deprecated")`
#'
#' Deletes a status of user's profile.
#' @inheritParams post_tweet
#' @export
#' @references <https://developer.twitter.com/en/docs/twitter-api/v1/tweets/post-and-engage/api-reference/post-statuses-destroy-id>
#' @seealso [tweet_delete()] [`rtweet-deprecated`]
post_destroy <- function(destroy_id, token = NULL) {
  stopifnot(is.character(destroy_id) && length(destroy_id) == 1)

  query <- sprintf("/1.1/statuses/destroy/%s", destroy_id)
  r <- TWIT_post(token, query)
  class(r) <- c("tweet_deleted", class(r))
  message("Your tweet has been deleted!")
  return(invisible(r))
}