Class: Onlyfans::Resources::Fans

Inherits:
Object
  • Object
show all
Defined in:
lib/onlyfans/resources/fans.rb,
lib/onlyfans/resources/fans/notes.rb,
lib/onlyfans/resources/fans/summary.rb

Overview

APIs for managing OnlyFans fans (subscribers)

Defined Under Namespace

Classes: Notes, Summary

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Fans

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

Parameters:



257
258
259
260
261
# File 'lib/onlyfans/resources/fans.rb', line 257

def initialize(client:)
  @client = client
  @notes = Onlyfans::Resources::Fans::Notes.new(client: client)
  @summary = Onlyfans::Resources::Fans::Summary.new(client: client)
end

Instance Attribute Details

#notesOnlyfans::Resources::Fans::Notes (readonly)

APIs for managing OnlyFans fans (subscribers)



9
10
11
# File 'lib/onlyfans/resources/fans.rb', line 9

def notes
  @notes
end

#summaryOnlyfans::Resources::Fans::Summary (readonly)

APIs for generating and retrieving AI-powered fan profile summaries



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

def summary
  @summary
end

Instance Method Details

#get_subscription_history(user_id, account:, request_options: {}) ⇒ Onlyfans::Models::FanGetSubscriptionHistoryResponse

Get Subscription History for a given OnlyFans User ID. This can be useful, for example, when the user’s subscribed to your account for the first time.

Parameters:

  • user_id (String)

    The OnlyFans ID of the User.

  • account (String)

    The Account ID

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

Returns:

See Also:



29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/onlyfans/resources/fans.rb', line 29

def get_subscription_history(user_id, params)
  parsed, options = Onlyfans::FanGetSubscriptionHistoryParams.dump_request(params)
   =
    parsed.delete(:account) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :get,
    path: ["api/%1$s/fans/%2$s/subscriptions-history", , user_id],
    model: Onlyfans::Models::FanGetSubscriptionHistoryResponse,
    options: options
  )
end

#list_active(account, filter: nil, limit: nil, offset: nil, query: nil, type: nil, request_options: {}) ⇒ Onlyfans::Models::FanListActiveResponse

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

Get a paginated list of fans for an Account. Newest fans are first.

Parameters:

Returns:

See Also:



67
68
69
70
71
72
73
74
75
76
77
# File 'lib/onlyfans/resources/fans.rb', line 67

def list_active(, params = {})
  parsed, options = Onlyfans::FanListActiveParams.dump_request(params)
  query = Onlyfans::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["api/%1$s/fans/active", ],
    query: query,
    model: Onlyfans::Models::FanListActiveResponse,
    options: options
  )
end

#list_all(account, filter: nil, limit: nil, offset: nil, query: nil, type: nil, request_options: {}) ⇒ Onlyfans::Models::FanListAllResponse

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

Get a paginated list of fans for an Account. Newest fans are first.

Parameters:

Returns:

See Also:



103
104
105
106
107
108
109
110
111
112
113
# File 'lib/onlyfans/resources/fans.rb', line 103

def list_all(, params = {})
  parsed, options = Onlyfans::FanListAllParams.dump_request(params)
  query = Onlyfans::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["api/%1$s/fans/all", ],
    query: query,
    model: Onlyfans::Models::FanListAllResponse,
    options: options
  )
end

#list_expired(account, filter: nil, limit: nil, offset: nil, query: nil, type: nil, request_options: {}) ⇒ Onlyfans::Models::FanListExpiredResponse

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

Get a paginated list of expired fans for an Account. Newest fans are first.

Parameters:

Returns:

See Also:



139
140
141
142
143
144
145
146
147
148
149
# File 'lib/onlyfans/resources/fans.rb', line 139

def list_expired(, params = {})
  parsed, options = Onlyfans::FanListExpiredParams.dump_request(params)
  query = Onlyfans::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["api/%1$s/fans/expired", ],
    query: query,
    model: Onlyfans::Models::FanListExpiredResponse,
    options: options
  )
end

#list_latest(account, end_date: nil, limit: nil, offset: nil, start_date: nil, type: nil, request_options: {}) ⇒ Onlyfans::Models::FanListLatestResponse

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

Get a paginated list fans, filterable by total, only new subscribers, or only renewals. Newest fans are first.

Parameters:

  • account (String)

    The Account ID

  • end_date (String, nil)

    End date for filtering (required with start_date). This field is required when <

  • limit (Integer)

    Number of fans to return (1-50). Must be at least 1. Must not be greater than 10

  • offset (Integer)

    Number of fans to skip. Must be at least 0.

  • start_date (String, nil)

    Start date for filtering (required with end_date). This field is required when <

  • type (Symbol, Onlyfans::Models::FanListLatestParams::Type, nil)

    Filter by type: total, renew, or new.

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

Returns:

See Also:



176
177
178
179
180
181
182
183
184
185
186
# File 'lib/onlyfans/resources/fans.rb', line 176

def list_latest(, params = {})
  parsed, options = Onlyfans::FanListLatestParams.dump_request(params)
  query = Onlyfans::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["api/%1$s/fans/latest", ],
    query: query,
    model: Onlyfans::Models::FanListLatestResponse,
    options: options
  )
end

#list_top(account, by: nil, end_date: nil, start_date: nil, request_options: {}) ⇒ Onlyfans::Models::FanListTopResponse

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

Get a list of top fans sorted by spending. Filterable by total, subscriptions, tips, messages, posts, or streams.

Parameters:

  • account (String)

    The Account ID

  • by (Symbol, Onlyfans::Models::FanListTopParams::By, nil)

    Sort by: total (default), subscribes, tips, messages, post, streams.

  • end_date (String, nil)

    End date for filtering (required with start_date). This field is required when <

  • start_date (String, nil)

    Start date for filtering (required with end_date). This field is required when <

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

Returns:

See Also:



209
210
211
212
213
214
215
216
217
218
219
# File 'lib/onlyfans/resources/fans.rb', line 209

def list_top(, params = {})
  parsed, options = Onlyfans::FanListTopParams.dump_request(params)
  query = Onlyfans::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["api/%1$s/fans/top", ],
    query: query,
    model: Onlyfans::Models::FanListTopResponse,
    options: options
  )
end

#set_custom_name(fan_id, account:, custom_name:, request_options: {}) ⇒ Onlyfans::Models::FanSetCustomNameResponse

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

Change the Fan’s Custom Name shown in OnlyFans

Parameters:

  • fan_id (String)

    Path param: Fan’s OnlyFans ID

  • account (String)

    Path param: The Account ID

  • custom_name (String)

    Body param: New Custom Name for a Fan. Send empty string (‘“”`) or `null` to cle

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

Returns:

See Also:



239
240
241
242
243
244
245
246
247
248
249
250
251
252
# File 'lib/onlyfans/resources/fans.rb', line 239

def set_custom_name(fan_id, params)
  parsed, options = Onlyfans::FanSetCustomNameParams.dump_request(params)
   =
    parsed.delete(:account) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :put,
    path: ["api/%1$s/fans/%2$s/custom-name", , fan_id],
    body: parsed,
    model: Onlyfans::Models::FanSetCustomNameResponse,
    options: options
  )
end