oreoshake / hackerone-client

An unofficial wrapper for the HackerOne API
https://api.hackerone.com/docs/v1
MIT License
55 stars 27 forks source link

Incremental activities #36

Closed esjee closed 6 years ago

esjee commented 7 years ago

This is a feature based on the discussion in https://github.com/oreoshake/hackerone-client/issues/25. Essentially, it allows you to fetch all activities of your program incrementally. The idea here is this acts like a stream; you start at one point and keep moving forward in time until you run out of activities. As mentioned in #25, this feature has multiple usages:

The code is still a bit rough, but I envision it being used something like this:

program = HackerOne::Client::Program.find 'my_program'
updated_at_after = ... # load previous session in some fashion
incremental_activities = program.incremental_activities(updated_at_after: updated_at_after)

incremental_activities.traverse do |activity|
  # Loop through every single activity in order of creation
end

# Save progress in some fashion; any activities processed during this run will not be processed again

Before I go on writing tests, I'd be curious to see what you think of this feature, and if you have any suggestions on how to improve it.

Willianvdv commented 7 years ago

Nice feature! If this works, we can remove a lot of request to our servers :D

esjee commented 6 years ago

I tried cleaning it up a bit. Is this helpful?

oreoshake commented 6 years ago

Looks like there's a merge conflict, otherwise :+1:

esjee commented 6 years ago

It appears there's a bit of an issue with the endpoint, in that it may get stuck repeating the last page infinitely. I'm hoping I'll be able to fix this, and I'll finish off this PR at that point.

esjee commented 6 years ago

Alright! I'm happy with the PR in it's current state. Curious to know what you think!