Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to stream messages. #72

Open
avinashbot opened this issue Oct 26, 2017 · 1 comment
Open

Add ability to stream messages. #72

avinashbot opened this issue Oct 26, 2017 · 1 comment

Comments

@avinashbot
Copy link
Owner

Requested in https://redd.it/76rrw4.

Is it possible to stream comment replies? e.g.:

session.my_messages(:category=>'comments').stream { |comment| .. }

Thanks in advance.

EDIT: It looks like PRAW supports it (see here). I wonder if it would be possible to duplicate this functionality in Redd.

@avinashbot
Copy link
Owner Author

avinashbot commented Nov 2, 2017

Reply by OP (for keeping track):

This seems to be working. Let me know if I'm on the right track!

options = { :category=>'unread' }.freeze
Redd::Models::PaginatedListing.new(SESSION.client, options) do |**req_options|
  SESSION.my_messages(options.merge(req_options))
end.stream do |comment|
  next unless comment.instance_of?(Redd::Models::Comment)

  # ..
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant