Skip to content

Commit

Permalink
Merge pull request #94 from Offerzen/feature/add-get-recent-engagements
Browse files Browse the repository at this point in the history
Add get_recently_modified method to EngagementsClient class
  • Loading branch information
jpetrucciani authored Mar 20, 2020
2 parents 8cb3ef9 + d1bab21 commit ce79220
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions hubspot3/engagements.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,22 @@ def get_all(self, **options):
offset = batch["offset"]

return output

def get_recently_modified(self, since, **options):
"""get recently modified engagements"""
finished = False
output = []
query_limit = 100 # Max value according to docs
offset = 0
while not finished:
batch = self._call(
"engagements/recent/modified",
method="GET",
params={"limit": query_limit, "offset": offset, "since": since},
**options
)
output.extend(batch["results"])
finished = not batch["hasMore"]
offset = batch["offset"]

return output

0 comments on commit ce79220

Please sign in to comment.