Class: Onlyfans::Resources::Analytics::Financial::Profitability

Inherits:
Object
  • Object
show all
Defined in:
lib/onlyfans/resources/analytics/financial/profitability.rb

Overview

APIs for retrieving financial analytics data

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Profitability

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

Parameters:



71
72
73
# File 'lib/onlyfans/resources/analytics/financial/profitability.rb', line 71

def initialize(client:)
  @client = client
end

Instance Method Details

#get_history(account, account_prefixed_id:, months: nil, request_options: {}) ⇒ Array<Onlyfans::Models::Analytics::Financial::ProfitabilityGetHistoryResponseItem>

Some parameter documentations has been truncated, see Models::Analytics::Financial::ProfitabilityGetHistoryParams for more details.

Get historical profitability data for a specific account over multiple months.

Parameters:

  • account (String)

    The Account ID

  • account_prefixed_id (String)

    The account prefixed ID.

  • months (Integer)

    Number of months of history to retrieve (1-60, default 12). Must be at least 1.

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

Returns:

See Also:



28
29
30
31
32
33
34
35
36
37
38
# File 'lib/onlyfans/resources/analytics/financial/profitability.rb', line 28

def get_history(, params)
  parsed, options = Onlyfans::Analytics::Financial::ProfitabilityGetHistoryParams.dump_request(params)
  query = Onlyfans::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["api/analytics/financial/profitability/%1$s/history", ],
    query: query,
    model: Onlyfans::Internal::Type::ArrayOf[Onlyfans::Models::Analytics::Financial::ProfitabilityGetHistoryResponseItem],
    options: options
  )
end

#get_profitability(account_ids:, month:, year:, request_options: {}) ⇒ Array<Onlyfans::Models::Analytics::Financial::ProfitabilityGetProfitabilityResponseItem>

Calculate profitability for creators including revenue, costs, commissions, and margins for a specific month.

Parameters:

  • account_ids (Array<String>)

    Array of account prefixed IDs

  • month (Integer)

    The month to calculate profitability for (1-12)

  • year (Integer)

    The year to calculate profitability for

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

Returns:

See Also:



56
57
58
59
60
61
62
63
64
65
66
# File 'lib/onlyfans/resources/analytics/financial/profitability.rb', line 56

def get_profitability(params)
  parsed, options =
    Onlyfans::Analytics::Financial::ProfitabilityGetProfitabilityParams.dump_request(params)
  @client.request(
    method: :post,
    path: "api/analytics/financial/profitability",
    body: parsed,
    model: Onlyfans::Internal::Type::ArrayOf[Onlyfans::Models::Analytics::Financial::ProfitabilityGetProfitabilityResponseItem],
    options: options
  )
end