Class: XTwitterScraper::Resources::X::Profile

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

Overview

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

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Profile

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

Parameters:



91
92
93
# File 'lib/x_twitter_scraper/resources/x/profile.rb', line 91

def initialize(client:)
  @client = client
end

Instance Method Details

#update(account:, description: nil, location: nil, name: nil, url: nil, request_options: {}) ⇒ XTwitterScraper::Models::X::ProfileUpdateResponse

Update X profile

Parameters:

  • account (String)

    X account (@username or ID) to update profile

  • description (String)

    Bio description

  • location (String)
  • name (String)

    Display name

  • url (String)

    Website URL

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

Returns:

See Also:



27
28
29
30
31
32
33
34
35
36
# File 'lib/x_twitter_scraper/resources/x/profile.rb', line 27

def update(params)
  parsed, options = XTwitterScraper::X::ProfileUpdateParams.dump_request(params)
  @client.request(
    method: :patch,
    path: "x/profile",
    body: parsed,
    model: XTwitterScraper::Models::X::ProfileUpdateResponse,
    options: options
  )
end

#update_avatar(account:, file:, request_options: {}) ⇒ XTwitterScraper::Models::X::ProfileUpdateAvatarResponse

Update profile avatar

Parameters:

Returns:

See Also:



51
52
53
54
55
56
57
58
59
60
61
# File 'lib/x_twitter_scraper/resources/x/profile.rb', line 51

def update_avatar(params)
  parsed, options = XTwitterScraper::X::ProfileUpdateAvatarParams.dump_request(params)
  @client.request(
    method: :patch,
    path: "x/profile/avatar",
    headers: {"content-type" => "multipart/form-data"},
    body: parsed,
    model: XTwitterScraper::Models::X::ProfileUpdateAvatarResponse,
    options: options
  )
end

#update_banner(account:, file:, request_options: {}) ⇒ XTwitterScraper::Models::X::ProfileUpdateBannerResponse

Update profile banner

Parameters:

Returns:

See Also:



76
77
78
79
80
81
82
83
84
85
86
# File 'lib/x_twitter_scraper/resources/x/profile.rb', line 76

def update_banner(params)
  parsed, options = XTwitterScraper::X::ProfileUpdateBannerParams.dump_request(params)
  @client.request(
    method: :patch,
    path: "x/profile/banner",
    headers: {"content-type" => "multipart/form-data"},
    body: parsed,
    model: XTwitterScraper::Models::X::ProfileUpdateBannerResponse,
    options: options
  )
end