Class: Onlyfans::Resources::DataExports

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

Overview

APIs for managing data exports

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ DataExports

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

Parameters:



172
173
174
# File 'lib/onlyfans/resources/data_exports.rb', line 172

def initialize(client:)
  @client = client
end

Instance Method Details

#cancel(data_export_id, request_options: {}) ⇒ Onlyfans::Models::DataExportCancelResponse

Cancel a running data export. Only exports with status ‘pending` or `in_progress` can be cancelled.

Parameters:

  • data_export_id (String)

    The prefixed ID of the data export

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

Returns:

See Also:



118
119
120
121
122
123
124
125
# File 'lib/onlyfans/resources/data_exports.rb', line 118

def cancel(data_export_id, params = {})
  @client.request(
    method: :delete,
    path: ["api/data-exports/%1$s", data_export_id],
    model: Onlyfans::Models::DataExportCancelResponse,
    options: params[:request_options]
  )
end

#create(end_date:, file_type:, start_date:, type:, account_ids: nil, auto_start: nil, export_columns: nil, options: nil, request_options: {}) ⇒ Onlyfans::Models::DataExportCreateResponse

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

Create a new data export request. This will calculate the required credits and prepare the export for starting.

Parameters:

  • end_date (String)

    The end date for the export (ISO 8601 format).

  • file_type (Symbol, Onlyfans::Models::DataExportCreateParams::FileType)

    The output file format. Supported formats vary by export type: ‘csv` or `xlsx` f

  • start_date (String)

    The start date for the export (ISO 8601 format).

  • type (Symbol, Onlyfans::Models::DataExportCreateParams::Type)

    The type of data to export

  • account_ids (Array<String>)

    Array of account prefixed IDs to export data from. Not required for ‘public_prof

  • auto_start (Boolean)

    When true, automatically starts the export after creation.

  • export_columns (Array<String>)

    Array of column names to include in the export (optional, defaults to all column

  • options (Hash{Symbol=>Object})

    Type-specific export options. For ‘chat_messages`: `maxMessages` (required per a

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

Returns:

See Also:



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

def create(params)
  parsed, options = Onlyfans::DataExportCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "api/data-exports",
    body: parsed,
    model: Onlyfans::Models::DataExportCreateResponse,
    options: options
  )
end

#list(download_url_expires_in: nil, page: nil, per_page: nil, status: nil, type: nil, request_options: {}) ⇒ Onlyfans::Models::DataExportListResponse

Get a paginated list of data exports for the team

Parameters:

Returns:

See Also:



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

def list(params = {})
  parsed, options = Onlyfans::DataExportListParams.dump_request(params)
  query = Onlyfans::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "api/data-exports",
    query: query,
    model: Onlyfans::Models::DataExportListResponse,
    options: options
  )
end

#retrieve(data_export_id, download_url_expires_in: nil, request_options: {}) ⇒ Onlyfans::Models::DataExportRetrieveResponse

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

Get the current status and progress of a data export

Parameters:

  • data_export_id (String)

    The prefixed ID of the data export

  • download_url_expires_in (Integer)

    Number of minutes until the download URL expires. Min ‘1`, max `60`, default `5`

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

Returns:

See Also:



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

def retrieve(data_export_id, params = {})
  parsed, options = Onlyfans::DataExportRetrieveParams.dump_request(params)
  query = Onlyfans::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["api/data-exports/%1$s", data_export_id],
    query: query,
    model: Onlyfans::Models::DataExportRetrieveResponse,
    options: options
  )
end

#retry_(data_export_id, request_options: {}) ⇒ Onlyfans::Models::DataExportRetryResponse

Create a new data export with the same parameters as a failed export and automatically start it.

Parameters:

  • data_export_id (String)

    The prefixed ID of the failed data export

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

Returns:

See Also:



139
140
141
142
143
144
145
146
# File 'lib/onlyfans/resources/data_exports.rb', line 139

def retry_(data_export_id, params = {})
  @client.request(
    method: :post,
    path: ["api/data-exports/%1$s/retry", data_export_id],
    model: Onlyfans::Models::DataExportRetryResponse,
    options: params[:request_options]
  )
end

#start(data_export_id, request_options: {}) ⇒ Onlyfans::Models::DataExportStartResponse

Start processing a data export that has completed credit calculation. This will begin the actual export process and charge credits.

Parameters:

  • data_export_id (String)

    The prefixed ID of the data export

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

Returns:

See Also:



160
161
162
163
164
165
166
167
# File 'lib/onlyfans/resources/data_exports.rb', line 160

def start(data_export_id, params = {})
  @client.request(
    method: :post,
    path: ["api/data-exports/%1$s/start", data_export_id],
    model: Onlyfans::Models::DataExportStartResponse,
    options: params[:request_options]
  )
end