Class: Onlyfans::Resources::Chats
- Inherits:
-
Object
- Object
- Onlyfans::Resources::Chats
- Defined in:
- lib/onlyfans/resources/chats.rb,
lib/onlyfans/resources/chats/messages.rb,
lib/onlyfans/resources/chats/mark_all_as_read.rb
Defined Under Namespace
Classes: MarkAllAsRead, Messages
Instance Attribute Summary collapse
- #mark_all_as_read ⇒ Onlyfans::Resources::Chats::MarkAllAsRead readonly
- #messages ⇒ Onlyfans::Resources::Chats::Messages readonly
Instance Method Summary collapse
-
#delete(chat_id, account:, request_options: {}) ⇒ Onlyfans::Models::ChatDeleteResponse
Delete a specific chat.
-
#hide(chat_id, account:, request_options: {}) ⇒ Onlyfans::Models::ChatHideResponse
Hide a specific chat from the chat list.
-
#initialize(client:) ⇒ Chats
constructor
private
A new instance of Chats.
-
#list(account, filter: nil, limit: nil, offset: nil, order: nil, query: nil, skip_users: nil, request_options: {}) ⇒ Onlyfans::Models::ChatListResponse
Get the list of chats for an Account.
-
#list_media(chat_id, account:, limit: nil, offset: nil, skip_users: nil, type: nil, request_options: {}) ⇒ Onlyfans::Models::ChatListMediaResponse
Some parameter documentations has been truncated, see Models::ChatListMediaParams for more details.
-
#mark_as_read(chat_id, account:, request_options: {}) ⇒ Onlyfans::Models::ChatMarkAsReadResponse
Mark a specific chat as read.
-
#mark_as_unread(chat_id, account:, request_options: {}) ⇒ Onlyfans::Models::ChatMarkAsUnreadResponse
Mark a specific chat as unread.
-
#mute(chat_id, account:, request_options: {}) ⇒ Onlyfans::Models::ChatMuteResponse
Mute notifications for a specific chat.
-
#start_typing(chat_id, account:, request_options: {}) ⇒ Onlyfans::Models::ChatStartTypingResponse
Calling this endpoint will show the target fan a “Model is typing…” note in the chat for ~4 seconds.
-
#unmute(chat_id, account:, request_options: {}) ⇒ Onlyfans::Models::ChatUnmuteResponse
Unmute notifications for a specific chat.
Constructor Details
#initialize(client:) ⇒ Chats
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 Chats.
283 284 285 286 287 |
# File 'lib/onlyfans/resources/chats.rb', line 283 def initialize(client:) @client = client @messages = Onlyfans::Resources::Chats::Messages.new(client: client) @mark_all_as_read = Onlyfans::Resources::Chats::MarkAllAsRead.new(client: client) end |
Instance Attribute Details
#mark_all_as_read ⇒ Onlyfans::Resources::Chats::MarkAllAsRead (readonly)
10 11 12 |
# File 'lib/onlyfans/resources/chats.rb', line 10 def mark_all_as_read @mark_all_as_read end |
#messages ⇒ Onlyfans::Resources::Chats::Messages (readonly)
7 8 9 |
# File 'lib/onlyfans/resources/chats.rb', line 7 def @messages end |
Instance Method Details
#delete(chat_id, account:, request_options: {}) ⇒ Onlyfans::Models::ChatDeleteResponse
Delete a specific chat.
60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/onlyfans/resources/chats.rb', line 60 def delete(chat_id, params) parsed, = Onlyfans::ChatDeleteParams.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/chats/%2$s", account, chat_id], model: Onlyfans::Models::ChatDeleteResponse, options: ) end |
#hide(chat_id, account:, request_options: {}) ⇒ Onlyfans::Models::ChatHideResponse
Hide a specific chat from the chat list. To unhide this chat, send a new message to the user.
88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/onlyfans/resources/chats.rb', line 88 def hide(chat_id, params) parsed, = Onlyfans::ChatHideParams.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/chats/%2$s/hide", account, chat_id], model: Onlyfans::Models::ChatHideResponse, options: ) end |
#list(account, filter: nil, limit: nil, offset: nil, order: nil, query: nil, skip_users: nil, request_options: {}) ⇒ Onlyfans::Models::ChatListResponse
Get the list of chats for an Account.
35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/onlyfans/resources/chats.rb', line 35 def list(account, params = {}) parsed, = Onlyfans::ChatListParams.dump_request(params) query = Onlyfans::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["api/%1$s/chats", account], query: query, model: Onlyfans::Models::ChatListResponse, options: ) end |
#list_media(chat_id, account:, limit: nil, offset: nil, skip_users: nil, type: nil, request_options: {}) ⇒ Onlyfans::Models::ChatListMediaResponse
Some parameter documentations has been truncated, see Models::ChatListMediaParams for more details.
List media files shared in a specific chat.
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
# File 'lib/onlyfans/resources/chats.rb', line 126 def list_media(chat_id, params) parsed, = Onlyfans::ChatListMediaParams.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/chats/%2$s/media", account, chat_id], query: query, model: Onlyfans::Models::ChatListMediaResponse, options: ) end |
#mark_as_read(chat_id, account:, request_options: {}) ⇒ Onlyfans::Models::ChatMarkAsReadResponse
Mark a specific chat as read. Alternative to List Chat Messages endpoint, if you just want to mark the chat as read without fetching messages.
156 157 158 159 160 161 162 163 164 165 166 167 168 |
# File 'lib/onlyfans/resources/chats.rb', line 156 def mark_as_read(chat_id, params) parsed, = Onlyfans::ChatMarkAsReadParams.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/chats/%2$s/mark-as-read", account, chat_id], model: Onlyfans::Models::ChatMarkAsReadResponse, options: ) end |
#mark_as_unread(chat_id, account:, request_options: {}) ⇒ Onlyfans::Models::ChatMarkAsUnreadResponse
Mark a specific chat as unread.
183 184 185 186 187 188 189 190 191 192 193 194 195 |
# File 'lib/onlyfans/resources/chats.rb', line 183 def mark_as_unread(chat_id, params) parsed, = Onlyfans::ChatMarkAsUnreadParams.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/chats/%2$s/mark-as-unread", account, chat_id], model: Onlyfans::Models::ChatMarkAsUnreadResponse, options: ) end |
#mute(chat_id, account:, request_options: {}) ⇒ Onlyfans::Models::ChatMuteResponse
Mute notifications for a specific chat.
210 211 212 213 214 215 216 217 218 219 220 221 222 |
# File 'lib/onlyfans/resources/chats.rb', line 210 def mute(chat_id, params) parsed, = Onlyfans::ChatMuteParams.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/chats/%2$s/mute", account, chat_id], model: Onlyfans::Models::ChatMuteResponse, options: ) end |
#start_typing(chat_id, account:, request_options: {}) ⇒ Onlyfans::Models::ChatStartTypingResponse
Calling this endpoint will show the target fan a “Model is typing…” note in the chat for ~4 seconds. If you want to continue showing the indicator call this endpoint multiple times. Free - no credits charged.
239 240 241 242 243 244 245 246 247 248 249 250 251 |
# File 'lib/onlyfans/resources/chats.rb', line 239 def start_typing(chat_id, params) parsed, = Onlyfans::ChatStartTypingParams.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/chats/%2$s/typing", account, chat_id], model: Onlyfans::Models::ChatStartTypingResponse, options: ) end |
#unmute(chat_id, account:, request_options: {}) ⇒ Onlyfans::Models::ChatUnmuteResponse
Unmute notifications for a specific chat.
266 267 268 269 270 271 272 273 274 275 276 277 278 |
# File 'lib/onlyfans/resources/chats.rb', line 266 def unmute(chat_id, params) parsed, = Onlyfans::ChatUnmuteParams.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/chats/%2$s/unmute", account, chat_id], model: Onlyfans::Models::ChatUnmuteResponse, options: ) end |