Class: Onlyfans::Resources::Users

Inherits:
Object
  • Object
show all
Defined in:
lib/onlyfans/resources/users.rb,
lib/onlyfans/resources/users/block.rb,
lib/onlyfans/resources/users/restrict.rb,
lib/onlyfans/resources/users/subscribe.rb

Overview

APIs for fetching OnlyFans users

Defined Under Namespace

Classes: Block, Restrict, Subscribe

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Users

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

Parameters:



79
80
81
82
83
84
# File 'lib/onlyfans/resources/users.rb', line 79

def initialize(client:)
  @client = client
  @restrict = Onlyfans::Resources::Users::Restrict.new(client: client)
  @block = Onlyfans::Resources::Users::Block.new(client: client)
  @subscribe = Onlyfans::Resources::Users::Subscribe.new(client: client)
end

Instance Attribute Details

#blockOnlyfans::Resources::Users::Block (readonly)

APIs for fetching OnlyFans users



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

def block
  @block
end

#restrictOnlyfans::Resources::Users::Restrict (readonly)

APIs for fetching OnlyFans users



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

def restrict
  @restrict
end

#subscribeOnlyfans::Resources::Users::Subscribe (readonly)

APIs for fetching OnlyFans users



17
18
19
# File 'lib/onlyfans/resources/users.rb', line 17

def subscribe
  @subscribe
end

Instance Method Details

#list(account, ids:, request_options: {}) ⇒ Onlyfans::Models::UserListResponse

Save on credits by getting up to 10 user details with a single request. User details are retrieved using the current ‘account` so fields like `subscribedOnData` which include potential subscription details will be included.

Parameters:

  • account (String)

    The Account ID

  • ids (String)

    Comma-separated list of user IDs (max. 10 IDs). Must be at least 1 character.

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

Returns:

See Also:



64
65
66
67
68
69
70
71
72
73
74
# File 'lib/onlyfans/resources/users.rb', line 64

def list(, params)
  parsed, options = Onlyfans::UserListParams.dump_request(params)
  query = Onlyfans::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["api/%1$s/users/list", ],
    query: query,
    model: Onlyfans::Models::UserListResponse,
    options: options
  )
end

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

Get OnlyFans Profile details for a given username. User details are retrieved using the current ‘account` so fields like `subscribedOnData` which include potential subscription details will be included.

Parameters:

  • username (String)

    The OnlyFans username of the user to retrieve details for.

  • account (String)

    The Account ID

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

Returns:

See Also:



34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/onlyfans/resources/users.rb', line 34

def retrieve(username, params)
  parsed, options = Onlyfans::UserRetrieveParams.dump_request(params)
   =
    parsed.delete(:account) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :get,
    path: ["api/%1$s/users/%2$s", , username],
    model: Onlyfans::Models::UserRetrieveResponse,
    options: options
  )
end