Class: Onlyfans::Resources::Posts::Comments

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

Instance Method Summary collapse

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.

Parameters:



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.

Parameters:

  • post_id (String)

    Path param: The ID of the post.

  • account (String)

    Path param: The Account ID

  • text (String)

    Query param: The text of the comment.

  • answer_to (Integer)

    Query param: The ID of the comment to which this comment is a reply.

  • giphy_id (String)

    Query param: The ID of the Giphy to include in the comment.

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

Returns:

See Also:



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, options = Onlyfans::Posts::CommentCreateParams.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: :post,
    path: ["api/%1$s/posts/%2$s/comments", , post_id],
    query: query.transform_keys(answer_to: "answerTo", giphy_id: "giphyId"),
    model: Onlyfans::Models::Posts::CommentCreateResponse,
    options: options
  )
end

#delete(comment_id, account:, post_id:, request_options: {}) ⇒ Onlyfans::Models::Posts::CommentDeleteResponse

Delete a comment on one of your posts.

Parameters:

  • comment_id (Integer)

    The ID of the comment to delete.

  • account (String)

    The Account ID

  • post_id (Integer)

    The ID of the post to which the comment belongs.

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

Returns:

See Also:



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, options = Onlyfans::Posts::CommentDeleteParams.dump_request(params)
   =
    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", , post_id, comment_id],
    model: Onlyfans::Models::Posts::CommentDeleteResponse,
    options: options
  )
end

#like(comment_id, account:, post_id:, request_options: {}) ⇒ Onlyfans::Models::Posts::CommentLikeResponse

Like a comment on one of your posts.

Parameters:

  • comment_id (Integer)

    The ID of the comment to like.

  • account (String)

    The Account ID

  • post_id (Integer)

    The ID of the post to which the comment belongs.

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

Returns:

See Also:



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, options = Onlyfans::Posts::CommentLikeParams.dump_request(params)
   =
    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", , post_id, comment_id],
    model: Onlyfans::Models::Posts::CommentLikeResponse,
    options: 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.

Parameters:

  • post_id (String)

    Path param: The ID of the post.

  • account (String)

    Path param: The Account ID

  • limit (Integer)

    Query param: Number of comments to return (default = 10)

  • offset (Integer)

    Query param: Number of comments to skip for pagination

  • sort (Symbol, Onlyfans::Models::Posts::CommentListParams::Sort)

    Query param: Sort the returned comments (default = desc)

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

Returns:

See Also:



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, options = Onlyfans::Posts::CommentListParams.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/posts/%2$s/comments", , post_id],
    query: query,
    model: Onlyfans::Models::Posts::CommentListResponse,
    options: options
  )
end

#pin(comment_id, account:, post_id:, request_options: {}) ⇒ Onlyfans::Models::Posts::CommentPinResponse

Pin a comment on one of your posts.

Parameters:

  • comment_id (Integer)

    The ID of the comment to pin.

  • account (String)

    The Account ID

  • post_id (Integer)

    The ID of the post to which the comment belongs.

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

Returns:

See Also:



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, options = Onlyfans::Posts::CommentPinParams.dump_request(params)
   =
    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", , post_id, comment_id],
    model: Onlyfans::Models::Posts::CommentPinResponse,
    options: options
  )
end

#unlike(comment_id, account:, post_id:, request_options: {}) ⇒ Onlyfans::Models::Posts::CommentUnlikeResponse

Unlike a comment on one of your posts.

Parameters:

  • comment_id (Integer)

    The ID of the comment to like.

  • account (String)

    The Account ID

  • post_id (Integer)

    The ID of the post to which the comment belongs.

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

Returns:

See Also:



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, options = Onlyfans::Posts::CommentUnlikeParams.dump_request(params)
   =
    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", , post_id, comment_id],
    model: Onlyfans::Models::Posts::CommentUnlikeResponse,
    options: options
  )
end

#unpin(comment_id, account:, post_id:, request_options: {}) ⇒ Onlyfans::Models::Posts::CommentUnpinResponse

Unpin a comment from one of your posts.

Parameters:

  • comment_id (Integer)

    The ID of the comment to pin.

  • account (String)

    The Account ID

  • post_id (Integer)

    The ID of the post to which the comment belongs.

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

Returns:

See Also:



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, options = Onlyfans::Posts::CommentUnpinParams.dump_request(params)
   =
    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", , post_id, comment_id],
    model: Onlyfans::Models::Posts::CommentUnpinResponse,
    options: options
  )
end