Skip to content

Commit 219b2d7

Browse files
Merge pull request #84 from HubSpot/feature/objects-get-all
Get all with an object type
2 parents 0f23466 + a702b46 commit 219b2d7

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

Diff for: VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4.0.3
1+
4.0.4

Diff for: hubspot/discovery/crm/objects/discovery.py

+16-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import hubspot.crm.objects as api_client
2-
from hubspot.utils.objects import fetch_all
32
from ...discovery_base import DiscoveryBase
43
from .feedback_submissions.discovery import Discovery as FeedbackSubmissionsDiscovery
54

@@ -29,5 +28,19 @@ def gdpr_api(self) -> api_client.GDPRApi:
2928
def feedback_submissions(self):
3029
return FeedbackSubmissionsDiscovery(self.config)
3130

32-
def get_all(self, **kwargs):
33-
return fetch_all(self.basic_api, **kwargs)
31+
def get_all(self, object_type, **kwargs):
32+
return self.fetch_all(object_type, **kwargs)
33+
34+
def fetch_all(self, object_type, **kwargs):
35+
results = []
36+
after = None
37+
PAGE_MAX_SIZE = 100
38+
39+
while True:
40+
page = self.basic_api.get_page(object_type, after=after, limit=PAGE_MAX_SIZE, **kwargs)
41+
results.extend(page.results)
42+
if page.paging is None:
43+
break
44+
after = page.paging.next.after
45+
46+
return results

0 commit comments

Comments
 (0)