Class: XTwitterScraper::Resources::X::Tweets::Retweet

Inherits:
Object
  • Object
show all
Defined in:
lib/x_twitter_scraper/resources/x/tweets/retweet.rb

Overview

X write actions (tweets, likes, follows, DMs)

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Retweet

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Retweet.

Parameters:



60
61
62
# File 'lib/x_twitter_scraper/resources/x/tweets/retweet.rb', line 60

def initialize(client:)
  @client = client
end

Instance Method Details

#create(id, account:, request_options: {}) ⇒ XTwitterScraper::Models::X::Tweets::RetweetCreateResponse

Retweet

Parameters:

  • id (String)

    Tweet ID to retweet

  • account (String)

    X account identifier (@username or account ID)

  • request_options (XTwitterScraper::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



22
23
24
25
26
27
28
29
30
31
# File 'lib/x_twitter_scraper/resources/x/tweets/retweet.rb', line 22

def create(id, params)
  parsed, options = XTwitterScraper::X::Tweets::RetweetCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["x/tweets/%1$s/retweet", id],
    body: parsed,
    model: XTwitterScraper::Models::X::Tweets::RetweetCreateResponse,
    options: options
  )
end

#delete(id, account:, request_options: {}) ⇒ XTwitterScraper::Models::X::Tweets::RetweetDeleteResponse

Unretweet

Parameters:

  • id (String)

    Tweet ID to unretweet

  • account (String)

    X account identifier (@username or account ID)

  • request_options (XTwitterScraper::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



46
47
48
49
50
51
52
53
54
55
# File 'lib/x_twitter_scraper/resources/x/tweets/retweet.rb', line 46

def delete(id, params)
  parsed, options = XTwitterScraper::X::Tweets::RetweetDeleteParams.dump_request(params)
  @client.request(
    method: :delete,
    path: ["x/tweets/%1$s/retweet", id],
    body: parsed,
    model: XTwitterScraper::Models::X::Tweets::RetweetDeleteResponse,
    options: options
  )
end