Class: Onlyfans::Resources::Analytics::Summary

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

Overview

APIs for retrieving summary analytics data

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Summary

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

Parameters:



93
94
95
# File 'lib/onlyfans/resources/analytics/summary.rb', line 93

def initialize(client:)
  @client = client
end

Instance Method Details

#get_earnings_overview(account_ids:, end_date:, start_date:, request_options: {}) ⇒ Onlyfans::Models::Analytics::SummaryGetEarningsOverviewResponse

Get earnings overview by category for selected accounts within a date range. Returns total earnings, subscriptions, posts, messages, tips, streams, and content stats.

Parameters:

  • account_ids (Array<String>)

    Array of account prefixed IDs to get earnings for

  • end_date (String)

    The end date (ISO 8601 format)

  • start_date (String)

    The start date (ISO 8601 format)

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

Returns:

See Also:



25
26
27
28
29
30
31
32
33
34
# File 'lib/onlyfans/resources/analytics/summary.rb', line 25

def get_earnings_overview(params)
  parsed, options = Onlyfans::Analytics::SummaryGetEarningsOverviewParams.dump_request(params)
  @client.request(
    method: :post,
    path: "api/analytics/summary/earnings",
    body: parsed,
    model: Onlyfans::Models::Analytics::SummaryGetEarningsOverviewResponse,
    options: options
  )
end

#get_historical_performance(time_range: nil, request_options: {}) ⇒ Array<Onlyfans::Models::Analytics::SummaryGetHistoricalPerformanceResponseItem>

Get historical earnings chart data for the team. Returns monthly aggregated revenue data for the specified time range.



48
49
50
51
52
53
54
55
56
57
# File 'lib/onlyfans/resources/analytics/summary.rb', line 48

def get_historical_performance(params = {})
  parsed, options = Onlyfans::Analytics::SummaryGetHistoricalPerformanceParams.dump_request(params)
  @client.request(
    method: :post,
    path: "api/analytics/summary/historical",
    body: parsed,
    model: Onlyfans::Internal::Type::ArrayOf[Onlyfans::Models::Analytics::SummaryGetHistoricalPerformanceResponseItem],
    options: options
  )
end

#get_period_comparison(account_ids:, period_a:, period_b:, granularity: nil, stat_type: nil, request_options: {}) ⇒ Onlyfans::Models::Analytics::SummaryGetPeriodComparisonResponse

Compare two time periods to analyze performance changes. Returns summary, breakdown, and chart data for the comparison.

Parameters:

Returns:

See Also:



79
80
81
82
83
84
85
86
87
88
# File 'lib/onlyfans/resources/analytics/summary.rb', line 79

def get_period_comparison(params)
  parsed, options = Onlyfans::Analytics::SummaryGetPeriodComparisonParams.dump_request(params)
  @client.request(
    method: :post,
    path: "api/analytics/summary/comparison",
    body: parsed,
    model: Onlyfans::Models::Analytics::SummaryGetPeriodComparisonResponse,
    options: options
  )
end