Class: Onlyfans::Resources::Accounts

Inherits:
Object
  • Object
show all
Defined in:
lib/onlyfans/resources/accounts.rb

Overview

Endpoints for your linked accounts

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Accounts

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

Parameters:



57
58
59
# File 'lib/onlyfans/resources/accounts.rb', line 57

def initialize(client:)
  @client = client
end

Instance Method Details

#disconnect(id, request_options: {}) ⇒ Hash{Symbol=>Object}?

Disconnect an OnlyFans account.

Parameters:

Returns:

  • (Hash{Symbol=>Object}, nil)

See Also:



45
46
47
48
49
50
51
52
# File 'lib/onlyfans/resources/accounts.rb', line 45

def disconnect(id, params = {})
  @client.request(
    method: :delete,
    path: ["api/accounts/%1$s", id],
    model: Onlyfans::Internal::Type::HashOf[Onlyfans::Internal::Type::Unknown],
    options: params[:request_options]
  )
end

#list(onlyfans_email: nil, onlyfans_id: nil, onlyfans_username: nil, request_options: {}) ⇒ Array<Onlyfans::Models::AccountListResponseItem>

List all connected OnlyFans accounts.

Parameters:

  • onlyfans_email (String, nil)

    Optionally, filter by the OnlyFans email

  • onlyfans_id (String, nil)

    Optionally, filter by the OnlyFans ID

  • onlyfans_username (String, nil)

    Optionally, filter by the OnlyFans username

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

Returns:

See Also:



22
23
24
25
26
27
28
29
30
31
32
# File 'lib/onlyfans/resources/accounts.rb', line 22

def list(params = {})
  parsed, options = Onlyfans::AccountListParams.dump_request(params)
  query = Onlyfans::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "api/accounts",
    query: query,
    model: Onlyfans::Internal::Type::ArrayOf[Onlyfans::Models::AccountListResponseItem],
    options: options
  )
end