File: print.R

package info (click to toggle)
r-cran-rtweet 1.1.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 18,224 kB
  • sloc: sh: 13; makefile: 2
file content (31 lines) | stat: -rw-r--r-- 851 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#' @export
print.post_tweet <- function(x, ...) {
  if (httr::status_code(x) != 200L) {
    cat("Your message has not been posted!", call. = FALSE)
  }
  ct <- httr::content(x)
  cat("Tweet", ct$id_str, "posted from", ct$user$screen_name,  "\nText:", ct$text)
}

#' @export
print.tweet_deleted <- function(x, ...) {
  if (httr::status_code(x) != 200L) {
    cat("Your message has not been deleted!", call. = FALSE)
  }
  ct <- httr::content(x)
  created <- format_date(ct$created_at)
  cat("Tweet", ct$id_str, "deleted from", ct$user$screen_name,
      "\nCreated at", as.character(created), ":", ct$text)
}

#' @export
print.tweets <- function(x, ...) {
  NextMethod(x)
  rlang::inform(c("i" = "Users data at users_data()\n"))
}

#' @export
print.users <- function(x, ...) {
  NextMethod(x)
  rlang::inform(c("i" = "Tweets data at tweets_data()"))
}