Class: XTwitterScraper::Resources::X::Users::Follow

Inherits:
Object
  • Object
show all
Defined in:
lib/x_twitter_scraper/resources/x/users/follow.rb

Overview

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

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Follow

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 Follow.

Parameters:



60
61
62
# File 'lib/x_twitter_scraper/resources/x/users/follow.rb', line 60

def initialize(client:)
  @client = client
end

Instance Method Details

#create(id, account:, request_options: {}) ⇒ XTwitterScraper::Models::X::Users::FollowCreateResponse

Follow user

Parameters:

  • id (String)

    User ID to follow

  • 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/users/follow.rb', line 22

def create(id, params)
  parsed, options = XTwitterScraper::X::Users::FollowCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["x/users/%1$s/follow", id],
    body: parsed,
    model: XTwitterScraper::Models::X::Users::FollowCreateResponse,
    options: options
  )
end

#delete_all(id, account:, request_options: {}) ⇒ XTwitterScraper::Models::X::Users::FollowDeleteAllResponse

Unfollow user

Parameters:

  • id (String)

    User ID to unfollow

  • 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/users/follow.rb', line 46

def delete_all(id, params)
  parsed, options = XTwitterScraper::X::Users::FollowDeleteAllParams.dump_request(params)
  @client.request(
    method: :delete,
    path: ["x/users/%1$s/follow", id],
    body: parsed,
    model: XTwitterScraper::Models::X::Users::FollowDeleteAllResponse,
    options: options
  )
end