Repository: HubSpot/hubspot-api-python

Issue:
TIcket Merge Bug
According to the API reference tickets is supposed to have a public_object_api property, but whenever I tried to call that property (to merge tickets) it gave me the error
AttributeError: 'Discovery' object has no attribute 'public_object_api'


After looking through the source code I found that in the file hubspot/discovery/crm/tickets/discovery.py it's missing some lines that existed in the equivalent company file (hubspot/discovery/crm/companies/discovery.py). I copied these lines into the ticket file on my local machine and it now works. 

    @property
    def public_object_api(self) -> api_client.PublicObjectApi:
        return self._configure_api_client(api_client, "PublicObjectApi")


I also use python code in workflow custom code and would like to see this update pushed there so I can merge tickets in workflows (without having to switch languages or use requests).

Discussion:
@alzheltkovskiy-hubspot: Hey @alzheltkovskiy-hubspot. You are absolutely right, the client does not fully align with the documentation. We will correct this in the next version. Thank you for pointing out the inaccuracy.

Solution patch:
diff --git a/hubspot/discovery/crm/tickets/discovery.py b/hubspot/discovery/crm/tickets/discovery.py
index 66cb6695..2af56323 100644
--- a/hubspot/discovery/crm/tickets/discovery.py
+++ b/hubspot/discovery/crm/tickets/discovery.py
@@ -8,13 +8,17 @@ class Discovery(DiscoveryBase):
     def basic_api(self) -> api_client.BasicApi:
         return self._configure_api_client(api_client, "BasicApi")
 
-    @property
-    def search_api(self) -> api_client.SearchApi:
-        return self._configure_api_client(api_client, "SearchApi")
-
     @property
     def batch_api(self) -> api_client.BatchApi:
         return self._configure_api_client(api_client, "BatchApi")
 
+    @property
+    def merge_api(self) -> api_client.MergeApi:
+        return self._configure_api_client(api_client, "MergeApi")
+
+    @property
+    def search_api(self) -> api_client.SearchApi:
+        return self._configure_api_client(api_client, "SearchApi")
+
     def get_all(self, **kwargs):
         return fetch_all(self.basic_api, **kwargs)


Test patch:
diff --git a/tests/spec/crm/test_tickets.py b/tests/spec/crm/test_tickets.py
index e57b00d0..888ea1a8 100644
--- a/tests/spec/crm/test_tickets.py
+++ b/tests/spec/crm/test_tickets.py
@@ -1,10 +1,11 @@
 from hubspot import HubSpot
-from hubspot.crm.tickets import BasicApi, BatchApi, SearchApi
+from hubspot.crm.tickets import BasicApi, BatchApi, MergeApi, SearchApi
 
 
 def test_is_discoverable():
     apis = HubSpot().crm.tickets
     assert isinstance(apis.basic_api, BasicApi)
     assert isinstance(apis.batch_api, BatchApi)
+    assert isinstance(apis.merge_api, MergeApi)
     assert isinstance(apis.search_api, SearchApi)
     assert hasattr(apis, "get_all")