Class: Onlyfans::Resources::Posts::Comments
- Inherits:
-
Object
- Object
- Onlyfans::Resources::Posts::Comments
- Defined in:
- lib/onlyfans/resources/posts/comments.rb
Instance Method Summary collapse
-
#create(post_id, account:, text:, answer_to: nil, giphy_id: nil, request_options: {}) ⇒ Onlyfans::Models::Posts::CommentCreateResponse
Create a comment on one of your posts.
-
#delete(comment_id, account:, post_id:, request_options: {}) ⇒ Onlyfans::Models::Posts::CommentDeleteResponse
Delete a comment on one of your posts.
-
#initialize(client:) ⇒ Comments
constructor
private
A new instance of Comments.
-
#like(comment_id, account:, post_id:, request_options: {}) ⇒ Onlyfans::Models::Posts::CommentLikeResponse
Like a comment on one of your posts.
-
#list(post_id, account:, limit: nil, offset: nil, sort: nil, request_options: {}) ⇒ Onlyfans::Models::Posts::CommentListResponse
Get comments from one of your posts.
-
#pin(comment_id, account:, post_id:, request_options: {}) ⇒ Onlyfans::Models::Posts::CommentPinResponse
Pin a comment on one of your posts.
-
#unlike(comment_id, account:, post_id:, request_options: {}) ⇒ Onlyfans::Models::Posts::CommentUnlikeResponse
Unlike a comment on one of your posts.
-
#unpin(comment_id, account:, post_id:, request_options: {}) ⇒ Onlyfans::Models::Posts::CommentUnpinResponse
Unpin a comment from one of your posts.
Constructor Details
#initialize(client:) ⇒ Comments
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 Comments.
245 246 247 |
# File 'lib/onlyfans/resources/posts/comments.rb', line 245 def initialize(client:) @client = client end |
Instance Method Details
#create(post_id, account:, text:, answer_to: nil, giphy_id: nil, request_options: {}) ⇒ Onlyfans::Models::Posts::CommentCreateResponse
Create a comment on one of your posts.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/onlyfans/resources/posts/comments.rb', line 26 def create(post_id, params) parsed, = Onlyfans::Posts::CommentCreateParams.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/comments", account, post_id], query: query.transform_keys(answer_to: "answerTo", giphy_id: "giphyId"), model: Onlyfans::Models::Posts::CommentCreateResponse, options: ) end |
#delete(comment_id, account:, post_id:, request_options: {}) ⇒ Onlyfans::Models::Posts::CommentDeleteResponse
Delete a comment on one of your posts.
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/onlyfans/resources/posts/comments.rb', line 92 def delete(comment_id, params) parsed, = Onlyfans::Posts::CommentDeleteParams.dump_request(params) account = parsed.delete(:account) do raise ArgumentError.new("missing required path argument #{_1}") end post_id = parsed.delete(:post_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :delete, path: ["api/%1$s/posts/%2$s/comments/%3$s", account, post_id, comment_id], model: Onlyfans::Models::Posts::CommentDeleteResponse, options: ) end |
#like(comment_id, account:, post_id:, request_options: {}) ⇒ Onlyfans::Models::Posts::CommentLikeResponse
Like a comment on one of your posts.
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 |
# File 'lib/onlyfans/resources/posts/comments.rb', line 125 def like(comment_id, params) parsed, = Onlyfans::Posts::CommentLikeParams.dump_request(params) account = parsed.delete(:account) do raise ArgumentError.new("missing required path argument #{_1}") end post_id = parsed.delete(:post_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :post, path: ["api/%1$s/posts/%2$s/comments/%3$s/like", account, post_id, comment_id], model: Onlyfans::Models::Posts::CommentLikeResponse, options: ) end |
#list(post_id, account:, limit: nil, offset: nil, sort: nil, request_options: {}) ⇒ Onlyfans::Models::Posts::CommentListResponse
Get comments from one of your posts.
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/onlyfans/resources/posts/comments.rb', line 61 def list(post_id, params) parsed, = Onlyfans::Posts::CommentListParams.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/comments", account, post_id], query: query, model: Onlyfans::Models::Posts::CommentListResponse, options: ) end |
#pin(comment_id, account:, post_id:, request_options: {}) ⇒ Onlyfans::Models::Posts::CommentPinResponse
Pin a comment on one of your posts.
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 |
# File 'lib/onlyfans/resources/posts/comments.rb', line 158 def pin(comment_id, params) parsed, = Onlyfans::Posts::CommentPinParams.dump_request(params) account = parsed.delete(:account) do raise ArgumentError.new("missing required path argument #{_1}") end post_id = parsed.delete(:post_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :post, path: ["api/%1$s/posts/%2$s/comments/%3$s/pin", account, post_id, comment_id], model: Onlyfans::Models::Posts::CommentPinResponse, options: ) end |
#unlike(comment_id, account:, post_id:, request_options: {}) ⇒ Onlyfans::Models::Posts::CommentUnlikeResponse
Unlike a comment on one of your posts.
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 |
# File 'lib/onlyfans/resources/posts/comments.rb', line 191 def unlike(comment_id, params) parsed, = Onlyfans::Posts::CommentUnlikeParams.dump_request(params) account = parsed.delete(:account) do raise ArgumentError.new("missing required path argument #{_1}") end post_id = parsed.delete(:post_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :delete, path: ["api/%1$s/posts/%2$s/comments/%3$s/like", account, post_id, comment_id], model: Onlyfans::Models::Posts::CommentUnlikeResponse, options: ) end |
#unpin(comment_id, account:, post_id:, request_options: {}) ⇒ Onlyfans::Models::Posts::CommentUnpinResponse
Unpin a comment from one of your posts.
224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 |
# File 'lib/onlyfans/resources/posts/comments.rb', line 224 def unpin(comment_id, params) parsed, = Onlyfans::Posts::CommentUnpinParams.dump_request(params) account = parsed.delete(:account) do raise ArgumentError.new("missing required path argument #{_1}") end post_id = parsed.delete(:post_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :delete, path: ["api/%1$s/posts/%2$s/comments/%3$s/pin", account, post_id, comment_id], model: Onlyfans::Models::Posts::CommentUnpinResponse, options: ) end |