Class: Onlyfans::Resources::Posts
- Inherits:
-
Object
- Object
- Onlyfans::Resources::Posts
- Defined in:
- lib/onlyfans/resources/posts.rb,
lib/onlyfans/resources/posts/labels.rb,
lib/onlyfans/resources/posts/comments.rb
Overview
APIs for managing OnlyFans posts
Defined Under Namespace
Instance Attribute Summary collapse
- #comments ⇒ Onlyfans::Resources::Posts::Comments readonly
-
#labels ⇒ Onlyfans::Resources::Posts::Labels
readonly
APIs for managing your post labels.
Instance Method Summary collapse
-
#archive(post_id, account:, private_archive: nil, request_options: {}) ⇒ Onlyfans::Models::PostArchiveResponse
Archive a post from your account.
-
#create(account, text:, expire_days: nil, fund_raising_target_amount: nil, fund_raising_tips_presets: nil, label_ids: nil, media_files: nil, previews: nil, rf_tag: nil, save_for_later: nil, scheduled_date: nil, voting_correct_index: nil, voting_due: nil, voting_options: nil, voting_type: nil, request_options: {}) ⇒ Onlyfans::Models::PostCreateResponse
Some parameter documentations has been truncated, see Models::PostCreateParams for more details.
-
#delete(post_id, account:, request_options: {}) ⇒ Onlyfans::Models::PostDeleteResponse
Delete a post from your account.
-
#initialize(client:) ⇒ Posts
constructor
private
A new instance of Posts.
-
#list(account, counters: nil, limit: nil, minimum_publish_date: nil, offset: nil, order: nil, pinned: nil, query: nil, sort: nil, request_options: {}) ⇒ Onlyfans::Models::PostListResponse
Get posts from your OnlyFans account.
-
#pin(post_id, account:, request_options: {}) ⇒ Onlyfans::Models::PostPinResponse
Pin or unpin a post to your account.
-
#retrieve(post_id, account:, request_options: {}) ⇒ Onlyfans::Models::PostRetrieveResponse
Retrieve details of a post from your account.
-
#stats(post_id, account:, with_historical_data: nil, request_options: {}) ⇒ Onlyfans::Models::PostStatsResponse
Show the statistics of a post like purchases, views, likes, tips and more.
-
#unarchive(post_id, account:, private_archive: nil, request_options: {}) ⇒ Onlyfans::Models::PostUnarchiveResponse
Unarchive a post from your account.
-
#update(post_id, account:, text:, expire_days: nil, fund_raising_target_amount: nil, fund_raising_tips_presets: nil, label_ids: nil, media_files: nil, price: nil, rf_tag: nil, save_for_later: nil, scheduled_date: nil, voting_correct_index: nil, voting_due: nil, voting_options: nil, voting_type: nil, request_options: {}) ⇒ String
Some parameter documentations has been truncated, see Models::PostUpdateParams for more details.
Constructor Details
#initialize(client:) ⇒ Posts
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 Posts.
344 345 346 347 348 |
# File 'lib/onlyfans/resources/posts.rb', line 344 def initialize(client:) @client = client @comments = Onlyfans::Resources::Posts::Comments.new(client: client) @labels = Onlyfans::Resources::Posts::Labels.new(client: client) end |
Instance Attribute Details
#comments ⇒ Onlyfans::Resources::Posts::Comments (readonly)
8 9 10 |
# File 'lib/onlyfans/resources/posts.rb', line 8 def comments @comments end |
#labels ⇒ Onlyfans::Resources::Posts::Labels (readonly)
APIs for managing your post labels
12 13 14 |
# File 'lib/onlyfans/resources/posts.rb', line 12 def labels @labels end |
Instance Method Details
#archive(post_id, account:, private_archive: nil, request_options: {}) ⇒ Onlyfans::Models::PostArchiveResponse
Archive a post from your account. Also can be used to move posts between the Regular and Private Archive.
236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 |
# File 'lib/onlyfans/resources/posts.rb', line 236 def archive(post_id, params) parsed, = Onlyfans::PostArchiveParams.dump_request(params) query = Onlyfans::Internal::Util.encode_query_params(parsed) account = parsed.delete(:account) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :post, path: ["api/%1$s/posts/%2$s/archive", account, post_id], query: query, model: Onlyfans::Models::PostArchiveResponse, options: ) end |
#create(account, text:, expire_days: nil, fund_raising_target_amount: nil, fund_raising_tips_presets: nil, label_ids: nil, media_files: nil, previews: nil, rf_tag: nil, save_for_later: nil, scheduled_date: nil, voting_correct_index: nil, voting_due: nil, voting_options: nil, voting_type: nil, request_options: {}) ⇒ Onlyfans::Models::PostCreateResponse
Some parameter documentations has been truncated, see Models::PostCreateParams for more details.
Compose and send a new post to your OnlyFans account.
56 57 58 59 60 61 62 63 64 65 |
# File 'lib/onlyfans/resources/posts.rb', line 56 def create(account, params) parsed, = Onlyfans::PostCreateParams.dump_request(params) @client.request( method: :post, path: ["api/%1$s/posts", account], body: parsed, model: Onlyfans::Models::PostCreateResponse, options: ) end |
#delete(post_id, account:, request_options: {}) ⇒ Onlyfans::Models::PostDeleteResponse
Delete a post from your account.
206 207 208 209 210 211 212 213 214 215 216 217 218 |
# File 'lib/onlyfans/resources/posts.rb', line 206 def delete(post_id, params) parsed, = Onlyfans::PostDeleteParams.dump_request(params) account = parsed.delete(:account) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :delete, path: ["api/%1$s/posts/%2$s", account, post_id], model: Onlyfans::Models::PostDeleteResponse, options: ) end |
#list(account, counters: nil, limit: nil, minimum_publish_date: nil, offset: nil, order: nil, pinned: nil, query: nil, sort: nil, request_options: {}) ⇒ Onlyfans::Models::PostListResponse
Get posts from your OnlyFans account.
181 182 183 184 185 186 187 188 189 190 191 |
# File 'lib/onlyfans/resources/posts.rb', line 181 def list(account, params = {}) parsed, = Onlyfans::PostListParams.dump_request(params) query = Onlyfans::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["api/%1$s/posts", account], query: query.transform_keys(minimum_publish_date: "minimumPublishDate"), model: Onlyfans::Models::PostListResponse, options: ) end |
#pin(post_id, account:, request_options: {}) ⇒ Onlyfans::Models::PostPinResponse
Pin or unpin a post to your account.
265 266 267 268 269 270 271 272 273 274 275 276 277 |
# File 'lib/onlyfans/resources/posts.rb', line 265 def pin(post_id, params) parsed, = Onlyfans::PostPinParams.dump_request(params) account = parsed.delete(:account) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :post, path: ["api/%1$s/posts/%2$s/pin", account, post_id], model: Onlyfans::Models::PostPinResponse, options: ) end |
#retrieve(post_id, account:, request_options: {}) ⇒ Onlyfans::Models::PostRetrieveResponse
Retrieve details of a post from your account.
80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/onlyfans/resources/posts.rb', line 80 def retrieve(post_id, params) parsed, = Onlyfans::PostRetrieveParams.dump_request(params) account = parsed.delete(:account) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :get, path: ["api/%1$s/posts/%2$s", account, post_id], model: Onlyfans::Models::PostRetrieveResponse, options: ) end |
#stats(post_id, account:, with_historical_data: nil, request_options: {}) ⇒ Onlyfans::Models::PostStatsResponse
Show the statistics of a post like purchases, views, likes, tips and more.
294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 |
# File 'lib/onlyfans/resources/posts.rb', line 294 def stats(post_id, params) parsed, = Onlyfans::PostStatsParams.dump_request(params) query = Onlyfans::Internal::Util.encode_query_params(parsed) account = parsed.delete(:account) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :get, path: ["api/%1$s/posts/%2$s/stats", account, post_id], query: query, model: Onlyfans::Models::PostStatsResponse, options: ) end |
#unarchive(post_id, account:, private_archive: nil, request_options: {}) ⇒ Onlyfans::Models::PostUnarchiveResponse
Unarchive a post from your account.
325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 |
# File 'lib/onlyfans/resources/posts.rb', line 325 def unarchive(post_id, params) parsed, = Onlyfans::PostUnarchiveParams.dump_request(params) query = Onlyfans::Internal::Util.encode_query_params(parsed) account = parsed.delete(:account) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :post, path: ["api/%1$s/posts/%2$s/unarchive", account, post_id], query: query, model: Onlyfans::Models::PostUnarchiveResponse, options: ) end |
#update(post_id, account:, text:, expire_days: nil, fund_raising_target_amount: nil, fund_raising_tips_presets: nil, label_ids: nil, media_files: nil, price: nil, rf_tag: nil, save_for_later: nil, scheduled_date: nil, voting_correct_index: nil, voting_due: nil, voting_options: nil, voting_type: nil, request_options: {}) ⇒ String
Some parameter documentations has been truncated, see Models::PostUpdateParams for more details.
Update a posted, queued, or “saved for later” post.
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 |
# File 'lib/onlyfans/resources/posts.rb', line 138 def update(post_id, params) parsed, = Onlyfans::PostUpdateParams.dump_request(params) account = parsed.delete(:account) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :put, path: ["api/%1$s/posts/%2$s", account, post_id], headers: {"accept" => "text/plain"}, body: parsed, model: String, options: ) end |