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 Streams, fixes #206 #249

Merged
merged 2 commits into from
May 6, 2018
Merged

Add Streams, fixes #206 #249

merged 2 commits into from
May 6, 2018

Conversation

mattbdean
Copy link
Owner

Some minor changes:

  • There's a new interface called UniquelyIdentifable with one method: String getUniqueId().
  • The upper bound for RedditIterable (and therefore Paginator) has been changed from Any (Object in Java) to UniquelyIdentifiable.
  • RedditIterable has a new method: Stream stream(BackoffStrategy).

A Stream is just a subclass of Iterator. It continuously fetches new data as it arrives, or as quickly as its BackoffStrategy allows. Currently, the only BackoffStrategy is ConstantBackoffStrategy, which allows requests to be made at a certain rate.

Here's a practical example of using a Stream:

for (c in redditClient.subreddit("RocketLeague").comments().build().stream()) {
    // Do something with the newly-created comment
}

@mattbdean mattbdean added this to the v1.1.0 milestone May 6, 2018
@codecov
Copy link

codecov bot commented May 6, 2018

Codecov Report

Merging #249 into master will increase coverage by 78.99%.
The diff coverage is 74.6%.

Impacted file tree graph

@@              Coverage Diff              @@
##             master     #249       +/-   ##
=============================================
+ Coverage      0.53%   79.52%   +78.99%     
- Complexity        7      665      +658     
=============================================
  Files           120      124        +4     
  Lines          2237     2291       +54     
  Branches        282      291        +9     
=============================================
+ Hits             12     1822     +1810     
+ Misses         2224      295     -1929     
- Partials          1      174      +173
Impacted Files Coverage Δ Complexity Δ
...ib/src/main/java/net/dean/jraw/models/Comment.java 75% <0%> (+75%) 3 <0> (+3) ⬆️
...ib/src/main/java/net/dean/jraw/models/Message.java 66.66% <0%> (+66.66%) 2 <0> (+2) ⬆️
...src/main/java/net/dean/jraw/models/LiveThread.java 50% <0%> (+50%) 2 <0> (+2) ⬆️
...src/main/java/net/dean/jraw/models/LiveUpdate.java 80% <0%> (+80%) 2 <0> (+2) ⬆️
.../kotlin/net/dean/jraw/pagination/RedditIterable.kt 0% <0%> (ø) 0 <0> (?)
lib/src/main/java/net/dean/jraw/models/Trophy.java 66.66% <0%> (+66.66%) 2 <0> (+2) ⬆️
.../src/main/java/net/dean/jraw/models/Subreddit.java 51.72% <0%> (+51.72%) 8 <0> (+8) ⬆️
...c/main/java/net/dean/jraw/models/MoreChildren.java 60% <0%> (+60%) 5 <0> (+5) ⬆️
...src/main/java/net/dean/jraw/models/Submission.java 75% <0%> (+75%) 3 <0> (+3) ⬆️
...et/dean/jraw/pagination/ConstantBackoffStrategy.kt 100% <100%> (ø) 2 <2> (?)
... and 127 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e7079f6...7e89d81. Read the comment docs.

@mattbdean mattbdean merged commit 94f7622 into master May 6, 2018
@mattbdean mattbdean deleted the streams branch May 6, 2018 22:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant