Class: Onlyfans::Resources::Settings

Inherits:
Object
  • Object
show all
Defined in:
lib/onlyfans/resources/settings.rb,
lib/onlyfans/resources/settings/welcome_message.rb,
lib/onlyfans/resources/settings/blocked_countries.rb,
lib/onlyfans/resources/settings/social_media_buttons.rb

Defined Under Namespace

Classes: BlockedCountries, SocialMediaButtons, WelcomeMessage

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Settings

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

Parameters:



134
135
136
137
138
139
# File 'lib/onlyfans/resources/settings.rb', line 134

def initialize(client:)
  @client = client
  @blocked_countries = Onlyfans::Resources::Settings::BlockedCountries.new(client: client)
  @welcome_message = Onlyfans::Resources::Settings::WelcomeMessage.new(client: client)
  @social_media_buttons = Onlyfans::Resources::Settings::SocialMediaButtons.new(client: client)
end

Instance Attribute Details

#blocked_countriesOnlyfans::Resources::Settings::BlockedCountries (readonly)



7
8
9
# File 'lib/onlyfans/resources/settings.rb', line 7

def blocked_countries
  @blocked_countries
end

#social_media_buttonsOnlyfans::Resources::Settings::SocialMediaButtons (readonly)



13
14
15
# File 'lib/onlyfans/resources/settings.rb', line 13

def social_media_buttons
  @social_media_buttons
end

#welcome_messageOnlyfans::Resources::Settings::WelcomeMessage (readonly)



10
11
12
# File 'lib/onlyfans/resources/settings.rb', line 10

def welcome_message
  @welcome_message
end

Instance Method Details

#check_username_availability(account, username:, request_options: {}) ⇒ Onlyfans::Models::SettingCheckUsernameAvailabilityResponse

Check if a username is taken. Returns ‘false` if the username is available, `true` if it is already taken.

Parameters:

  • account (String)

    The Account ID

  • username (String)

    The username to check.

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

Returns:

See Also:



49
50
51
52
53
54
55
56
57
58
# File 'lib/onlyfans/resources/settings.rb', line 49

def check_username_availability(, params)
  parsed, options = Onlyfans::SettingCheckUsernameAvailabilityParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["api/%1$s/settings/username-exists", ],
    body: parsed,
    model: Onlyfans::Models::SettingCheckUsernameAvailabilityResponse,
    options: options
  )
end

#retrieve(account, request_options: {}) ⇒ Onlyfans::Models::SettingRetrieveResponse

Returns the account settings

Parameters:

Returns:

See Also:



26
27
28
29
30
31
32
33
# File 'lib/onlyfans/resources/settings.rb', line 26

def retrieve(, params = {})
  @client.request(
    method: :get,
    path: ["api/%1$s/settings", ],
    model: Onlyfans::Models::SettingRetrieveResponse,
    options: params[:request_options]
  )
end

#update_profile(account, about: nil, avatar: nil, header: nil, location: nil, name: nil, username: nil, website: nil, wishlist: nil, request_options: {}) ⇒ Onlyfans::Models::SettingUpdateProfileResponse

Some parameter documentations has been truncated, see Models::SettingUpdateProfileParams for more details.

Updates the account profile. **Only include the fields you want to update.** To make a field empty, set it to ‘null`.

Parameters:

  • account (String)

    The Account ID

  • about (String, nil)

    The new bio to use. Set to ‘null` to empty it.

  • avatar (String)

    The new avatar to use. Must be a ‘ofapi_media_` ID. Refer to our `/media/upload`

  • header (String)

    The new header (banner) to use. Must be a ‘ofapi_media_` ID. Refer to our `/medi

  • location (String, nil)

    The new location to use. Set to ‘null` to empty it.

  • name (String, nil)

    The new display name to use. Set to ‘null` to use the default display name.

  • username (String)

    The new username to use. Make sure to first check if it exists using our ‘/setti

  • website (String, nil)

    The new website URL to use. Must be a valid URL. Set to ‘null` to empty it.

  • wishlist (String, nil)

    The new Amazon Wishlist URL to use. Must be a valid URL. Set to ‘null` to empty

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

Returns:

See Also:



91
92
93
94
95
96
97
98
99
100
# File 'lib/onlyfans/resources/settings.rb', line 91

def update_profile(, params = {})
  parsed, options = Onlyfans::SettingUpdateProfileParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["api/%1$s/settings/profile", ],
    body: parsed,
    model: Onlyfans::Models::SettingUpdateProfileResponse,
    options: options
  )
end

#update_subscription_price(account, price:, request_options: {}) ⇒ Onlyfans::Models::SettingUpdateSubscriptionPriceResponse

Some parameter documentations has been truncated, see Models::SettingUpdateSubscriptionPriceParams for more details.

Update the account subscription price. Send ‘0` or `“free”` to make the account free. ⚠️ WARNING! OnlyFans limits updating the subscription price to max. 3 times per day.

Parameters:

  • account (String)

    The Account ID

  • price (String)

    The new subscription price. Accepts ‘0`, `“free”`, or a number between 4.99 and

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

Returns:

See Also:



120
121
122
123
124
125
126
127
128
129
# File 'lib/onlyfans/resources/settings.rb', line 120

def update_subscription_price(, params)
  parsed, options = Onlyfans::SettingUpdateSubscriptionPriceParams.dump_request(params)
  @client.request(
    method: :patch,
    path: ["api/%1$s/settings/subscription-price", ],
    body: parsed,
    model: Onlyfans::Models::SettingUpdateSubscriptionPriceResponse,
    options: options
  )
end