Class: Onlyfans::Resources::Stories

Inherits:
Object
  • Object
show all
Defined in:
lib/onlyfans/resources/stories.rb,
lib/onlyfans/resources/stories/highlights.rb

Overview

APIs for managing OnlyFans stories

Defined Under Namespace

Classes: Highlights

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Stories

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

Parameters:



230
231
232
233
# File 'lib/onlyfans/resources/stories.rb', line 230

def initialize(client:)
  @client = client
  @highlights = Onlyfans::Resources::Stories::Highlights.new(client: client)
end

Instance Attribute Details

#highlightsOnlyfans::Resources::Stories::Highlights (readonly)

APIs for managing OnlyFans story highlights



9
10
11
# File 'lib/onlyfans/resources/stories.rb', line 9

def highlights
  @highlights
end

Instance Method Details

#create(account, media_files:, request_options: {}) ⇒ Onlyfans::Models::StoryCreateResponse

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

Post a new media or vault file to your story.

Parameters:

  • account (String)

    The Account ID

  • media_files (Array<String>)

    Array of media file upload prefixed_ids, or OF media IDs (required if price is n

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

Returns:

See Also:



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

def create(, params)
  parsed, options = Onlyfans::StoryCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["api/%1$s/stories", ],
    body: parsed,
    model: Onlyfans::Models::StoryCreateResponse,
    options: options
  )
end

#delete(story_id, account:, request_options: {}) ⇒ Onlyfans::Models::StoryDeleteResponse

Delete a specific story by its ID.

Parameters:

  • story_id (Integer)

    The ID of the story to retrieve

  • account (String)

    The Account ID

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

Returns:

See Also:



78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/onlyfans/resources/stories.rb', line 78

def delete(story_id, params)
  parsed, options = Onlyfans::StoryDeleteParams.dump_request(params)
   =
    parsed.delete(:account) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :delete,
    path: ["api/%1$s/stories/%2$s", , story_id],
    model: Onlyfans::Models::StoryDeleteResponse,
    options: options
  )
end

#list_active(account, request_options: {}) ⇒ Onlyfans::Models::StoryListActiveResponse

Retrieve a list of your currently active stories.

Parameters:

Returns:

See Also:



103
104
105
106
107
108
109
110
# File 'lib/onlyfans/resources/stories.rb', line 103

def list_active(, params = {})
  @client.request(
    method: :get,
    path: ["api/%1$s/stories", ],
    model: Onlyfans::Models::StoryListActiveResponse,
    options: params[:request_options]
  )
end

#list_archive(account, limit: nil, marker: nil, request_options: {}) ⇒ Onlyfans::Models::StoryListArchiveResponse

Retrieve a list of your archived stories.

Parameters:

  • account (String)

    The Account ID

  • limit (Integer)

    Number of stories to return (default = 18)

  • marker (String)

    The marker used for pagination. Default: ‘null`

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

Returns:

See Also:



127
128
129
130
131
132
133
134
135
136
137
# File 'lib/onlyfans/resources/stories.rb', line 127

def list_archive(, params = {})
  parsed, options = Onlyfans::StoryListArchiveParams.dump_request(params)
  query = Onlyfans::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["api/%1$s/stories/archive", ],
    query: query,
    model: Onlyfans::Models::StoryListArchiveResponse,
    options: options
  )
end

#list_viewers(story_id, account:, limit: nil, offset: nil, request_options: {}) ⇒ Onlyfans::Models::StoryListViewersResponse

Retrieve the list of viewers for a specific story by its ID.

Parameters:

  • story_id (Integer)

    Path param: The ID of the story to get viewers for

  • account (String)

    Path param: The Account ID

  • limit (Integer, nil)

    Query param: The number of story viewers to return. Default ‘8`

  • offset (Integer, nil)

    Query param: The offset used for pagination. Default ‘0`

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

Returns:

See Also:



156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# File 'lib/onlyfans/resources/stories.rb', line 156

def list_viewers(story_id, params)
  parsed, options = Onlyfans::StoryListViewersParams.dump_request(params)
  query = Onlyfans::Internal::Util.encode_query_params(parsed)
   =
    parsed.delete(:account) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :get,
    path: ["api/%1$s/stories/%2$s/viewers", , story_id],
    query: query,
    model: Onlyfans::Models::StoryListViewersResponse,
    options: options
  )
end

#mark_as_watched(story_id, account:, request_options: {}) ⇒ Onlyfans::Models::StoryMarkAsWatchedResponse

Mark a specific story as watched by its ID.

Parameters:

  • story_id (Integer)

    The ID of the story to mark as watched.

  • account (String)

    The Account ID

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

Returns:

See Also:



185
186
187
188
189
190
191
192
193
194
195
196
197
# File 'lib/onlyfans/resources/stories.rb', line 185

def mark_as_watched(story_id, params)
  parsed, options = Onlyfans::StoryMarkAsWatchedParams.dump_request(params)
   =
    parsed.delete(:account) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :post,
    path: ["api/%1$s/stories/%2$s/mark-as-watched", , story_id],
    model: Onlyfans::Models::StoryMarkAsWatchedResponse,
    options: options
  )
end

#retrieve(story_id, account:, request_options: {}) ⇒ Onlyfans::Models::StoryRetrieveResponse

Retrieve details of a specific story by its ID.

Parameters:

  • story_id (Integer)

    The ID of the story to retrieve

  • account (String)

    The Account ID

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

Returns:

See Also:



51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/onlyfans/resources/stories.rb', line 51

def retrieve(story_id, params)
  parsed, options = Onlyfans::StoryRetrieveParams.dump_request(params)
   =
    parsed.delete(:account) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :get,
    path: ["api/%1$s/stories/%2$s", , story_id],
    model: Onlyfans::Models::StoryRetrieveResponse,
    options: options
  )
end

#retrieve_stats(story_id, account:, request_options: {}) ⇒ Onlyfans::Models::StoryRetrieveStatsResponse

Retrieve viewer count, likes count, comments count, and tips statistics for a specific story by its ID.

Parameters:

  • story_id (Integer)

    The ID of the story to get stats for

  • account (String)

    The Account ID

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

Returns:

See Also:



213
214
215
216
217
218
219
220
221
222
223
224
225
# File 'lib/onlyfans/resources/stories.rb', line 213

def retrieve_stats(story_id, params)
  parsed, options = Onlyfans::StoryRetrieveStatsParams.dump_request(params)
   =
    parsed.delete(:account) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :get,
    path: ["api/%1$s/stories/%2$s/stats", , story_id],
    model: Onlyfans::Models::StoryRetrieveStatsResponse,
    options: options
  )
end