Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
m-pilarski committed Aug 18, 2023
1 parent bbc116c commit cf6e88b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
23 changes: 18 additions & 5 deletions R/fetch.R
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ fetch_tweet_count_raw <- function(
#' @param .tweet_count_max ...
#' @param .excl_replies ...
#' @param .excl_retweets ...
#' @param .until_tweet_id ...
#' @param .tweet_query_pars_static ...
#' @param ... ...
#' @return \code{fetch_tweet_timeline_raw} - returns a ...
Expand All @@ -226,7 +227,8 @@ fetch_tweet_count_raw <- function(
#' 1+1
fetch_tweet_timeline_raw <- function(
.user_id_vec=bit64::integer64(), .bearer_token, .tweet_count_max=Inf,
.excl_replies=FALSE, .excl_retweets=FALSE, .tweet_query_pars_static=NULL, ...
.excl_replies=FALSE, .excl_retweets=FALSE, .until_tweet_id=NULL,
.tweet_query_pars_static=NULL, ...
){

stopifnot(bit64::is.integer64(.user_id_vec))
Expand All @@ -241,15 +243,26 @@ fetch_tweet_timeline_raw <- function(
.pars_static=.tweet_query_pars_static
)

if(!"exclude" %in% names(.tweet_query)){
if(.excl_replies | .excl_retweets){
if(.excl_replies | .excl_retweets){
if(!"exclude" %in% names(.tweet_query)){
.tweet_query[["exclude"]] <- stringr::str_c(
if(.excl_replies){"replies"}, if(.excl_retweets){"retweets"},
sep=","
)
}else{
stop("\"exclude\" query parameter already present")
}
}

if(!is.null(.until_tweet_id)){
if(!"until_id" %in% names(.tweet_query)){
stopifnot(bit64::is.integer64(.until_tweet_id))
.tweet_query[["until_id"]] <- bit64::as.character.integer64(
.until_tweet_id
)
}else{
stop("\"until_id\" query parameter already present")
}
}else{
stop("\"exclude\" query parameter already present")
}

.tweet_url <- stringr::str_c(
Expand Down
3 changes: 3 additions & 0 deletions man/fetch_tweet_timeline_raw.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit cf6e88b

Please sign in to comment.