Class: Onlyfans::Resources::Statistics

Inherits:
Object
  • Object
show all
Defined in:
lib/onlyfans/resources/statistics.rb,
lib/onlyfans/resources/statistics/reach.rb,
lib/onlyfans/resources/statistics/statements.rb

Defined Under Namespace

Classes: Reach, Statements

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Statistics

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

Parameters:



108
109
110
111
112
# File 'lib/onlyfans/resources/statistics.rb', line 108

def initialize(client:)
  @client = client
  @statements = Onlyfans::Resources::Statistics::Statements.new(client: client)
  @reach = Onlyfans::Resources::Statistics::Reach.new(client: client)
end

Instance Attribute Details

#reachOnlyfans::Resources::Statistics::Reach (readonly)



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

def reach
  @reach
end

#statementsOnlyfans::Resources::Statistics::Statements (readonly)



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

def statements
  @statements
end

Instance Method Details

#calculate_total_transactions(account, end_date:, start_date:, request_options: {}) ⇒ Onlyfans::Models::StatisticCalculateTotalTransactionsResponse

Calculate the total transactions and amounts.

Parameters:

  • account (String)

    The Account ID

  • end_date (String)

    The end date for the period. Keep empty to calculate everything.

  • start_date (String)

    The start date for the period. Keep empty to calculate everything.

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

Returns:

See Also:



27
28
29
30
31
32
33
34
35
36
37
# File 'lib/onlyfans/resources/statistics.rb', line 27

def calculate_total_transactions(, params)
  parsed, options = Onlyfans::StatisticCalculateTotalTransactionsParams.dump_request(params)
  query = Onlyfans::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["api/%1$s/statistics/total-transactions", ],
    query: query,
    model: Onlyfans::Models::StatisticCalculateTotalTransactionsResponse,
    options: options
  )
end

#get_overview(account, end_date: nil, start_date: nil, type: nil, request_options: {}) ⇒ Onlyfans::Models::StatisticGetOverviewResponse

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

Get an overview of statistics for fans, visitors, posts, or general.

Parameters:

  • account (String)

    The Account ID

  • end_date (String)

    The end date for the statistics. Keep empty to retrieve until now.

  • start_date (String)

    The start date for the statistics. Keep empty to retrieve from the model’s start

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

    The type of statistics to retrieve (default = empty)

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

Returns:

See Also:



59
60
61
62
63
64
65
66
67
68
69
# File 'lib/onlyfans/resources/statistics.rb', line 59

def get_overview(, params = {})
  parsed, options = Onlyfans::StatisticGetOverviewParams.dump_request(params)
  query = Onlyfans::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["api/%1$s/statistics/overview", ],
    query: query,
    model: Onlyfans::Models::StatisticGetOverviewResponse,
    options: options
  )
end

#get_subscriber_metrics(account, end_date:, start_date:, detailed: nil, request_options: {}) ⇒ Onlyfans::Models::StatisticGetSubscriberMetricsResponse

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

Get subscriber metrics including total, new, renewed, paid, and free subscriptions for a specified timeframe. ‘unknown_subscriptions` indicates deleted fan accounts.

Parameters:

  • account (String)

    The Account ID

  • end_date (String)

    The end date for the metrics.

  • start_date (String)

    The start date for the metrics.

  • detailed (Boolean, nil)

    Include paid and free fan metrics. Will slow down the response time, and might t

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

Returns:

See Also:



93
94
95
96
97
98
99
100
101
102
103
# File 'lib/onlyfans/resources/statistics.rb', line 93

def get_subscriber_metrics(, params)
  parsed, options = Onlyfans::StatisticGetSubscriberMetricsParams.dump_request(params)
  query = Onlyfans::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["api/%1$s/statistics/subscriber-metrics", ],
    query: query,
    model: Onlyfans::Models::StatisticGetSubscriberMetricsResponse,
    options: options
  )
end