Skip to content

Commit

Permalink
Merge branch '11.0.0' into feature/add-request-class
Browse files Browse the repository at this point in the history
  • Loading branch information
alzheltkovskiy-hubspot committed Oct 22, 2024
2 parents 103ae7c + 40a706c commit e031d49
Show file tree
Hide file tree
Showing 10 changed files with 1,466 additions and 83 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pip install --upgrade hubspot-api-client

### Requirements

Make sure you have [Python 3.5+](https://docs.python.org/3/) and [pip](https://pypi.org/project/pip/) installed.
Make sure you have [Python 3.7+](https://docs.python.org/3/) and [pip](https://pypi.org/project/pip/) installed.


## Quickstart
Expand Down
18 changes: 8 additions & 10 deletions hubspot/discovery/discovery_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,21 @@ def __init__(self, config):

def _configure_api_client(self, api_client_package, api_name):
api_factory = self.config.get("api_factory") or self._default_api_factory
config = {k: v for k, v in self.config.items() if k != "api_factory" and v}
config = {k: v for k, v in self.config.items() if k != "api_factory" and v is not None}
return api_factory(api_client_package, api_name, config)

@staticmethod
def _default_api_factory(api_client_package, api_name, config):
configuration = api_client_package.Configuration()
if "api_key" in config:
configuration.api_key["developer_hapikey"] = config["api_key"]
if "access_token" in config:
configuration.access_token = config["access_token"]
if "retry" in config:
configuration.retries = config["retry"]
if "verify_ssl" in config:
configuration.verify_ssl = config["verify_ssl"]
for key in config:
if key == "api_key":
configuration.api_key["developer_hapikey"] = config["api_key"]
elif key == "retry":
configuration.retries = config["retry"]
else:
setattr(configuration, key, config[key])

api_client = api_client_package.ApiClient(configuration=configuration)

package_version = metadata.version("hubspot-api-client")
api_client.user_agent = "hubspot-api-client-python; {0}".format(package_version)

Expand Down
3 changes: 3 additions & 0 deletions hubspot/marketing/events/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
# import apis into sdk package
from hubspot.marketing.events.api.attendance_subscriber_state_changes_api import AttendanceSubscriberStateChangesApi
from hubspot.marketing.events.api.basic_api import BasicApi
from hubspot.marketing.events.api.list_associations_api import ListAssociationsApi
from hubspot.marketing.events.api.participant_state_api import ParticipantStateApi
from hubspot.marketing.events.api.settings_api import SettingsApi
from hubspot.marketing.events.api.subscriber_state_changes_api import SubscriberStateChangesApi
Expand All @@ -44,6 +45,7 @@
from hubspot.marketing.events.models.batch_response_subscriber_vid_response import BatchResponseSubscriberVidResponse
from hubspot.marketing.events.models.collection_response_marketing_event_external_unique_identifier_no_paging import CollectionResponseMarketingEventExternalUniqueIdentifierNoPaging
from hubspot.marketing.events.models.collection_response_with_total_participation_breakdown_forward_paging import CollectionResponseWithTotalParticipationBreakdownForwardPaging
from hubspot.marketing.events.models.collection_response_with_total_public_list_no_paging import CollectionResponseWithTotalPublicListNoPaging
from hubspot.marketing.events.models.contact_association import ContactAssociation
from hubspot.marketing.events.models.error import Error
from hubspot.marketing.events.models.error_detail import ErrorDetail
Expand All @@ -65,6 +67,7 @@
from hubspot.marketing.events.models.participation_breakdown import ParticipationBreakdown
from hubspot.marketing.events.models.participation_properties import ParticipationProperties
from hubspot.marketing.events.models.property_value import PropertyValue
from hubspot.marketing.events.models.public_list import PublicList
from hubspot.marketing.events.models.standard_error import StandardError
from hubspot.marketing.events.models.subscriber_email_response import SubscriberEmailResponse
from hubspot.marketing.events.models.subscriber_vid_response import SubscriberVidResponse
1 change: 1 addition & 0 deletions hubspot/marketing/events/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# import apis into api package
from hubspot.marketing.events.api.attendance_subscriber_state_changes_api import AttendanceSubscriberStateChangesApi
from hubspot.marketing.events.api.basic_api import BasicApi
from hubspot.marketing.events.api.list_associations_api import ListAssociationsApi
from hubspot.marketing.events.api.participant_state_api import ParticipantStateApi
from hubspot.marketing.events.api.settings_api import SettingsApi
from hubspot.marketing.events.api.subscriber_state_changes_api import SubscriberStateChangesApi
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ def __init__(self, api_client=None):
api_client = ApiClient()
self.api_client = api_client

def create_by_contact_email(self, external_event_id, subscriber_state, batch_input_marketing_event_email_subscriber, **kwargs): # noqa: E501
def record_by_contact_emails(self, external_event_id, subscriber_state, batch_input_marketing_event_email_subscriber, **kwargs): # noqa: E501
"""Record a subscriber state by contact email # noqa: E501
Record a subscriber state between multiple HubSpot contacts and a marketing event, using contact email addresses. If contact is not present it will be automatically created. The contactProperties field is used only when creating a new contact. These properties will not update existing contacts. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_by_contact_email(external_event_id, subscriber_state, batch_input_marketing_event_email_subscriber, async_req=True)
>>> thread = api.record_by_contact_emails(external_event_id, subscriber_state, batch_input_marketing_event_email_subscriber, async_req=True)
>>> result = thread.get()
:param external_event_id: The id of the marketing event (required)
Expand All @@ -67,16 +67,16 @@ def create_by_contact_email(self, external_event_id, subscriber_state, batch_inp
:rtype: BatchResponseSubscriberEmailResponse
"""
kwargs["_return_http_data_only"] = True
return self.create_by_contact_email_with_http_info(external_event_id, subscriber_state, batch_input_marketing_event_email_subscriber, **kwargs) # noqa: E501
return self.record_by_contact_emails_with_http_info(external_event_id, subscriber_state, batch_input_marketing_event_email_subscriber, **kwargs) # noqa: E501

def create_by_contact_email_with_http_info(self, external_event_id, subscriber_state, batch_input_marketing_event_email_subscriber, **kwargs): # noqa: E501
def record_by_contact_emails_with_http_info(self, external_event_id, subscriber_state, batch_input_marketing_event_email_subscriber, **kwargs): # noqa: E501
"""Record a subscriber state by contact email # noqa: E501
Record a subscriber state between multiple HubSpot contacts and a marketing event, using contact email addresses. If contact is not present it will be automatically created. The contactProperties field is used only when creating a new contact. These properties will not update existing contacts. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_by_contact_email_with_http_info(external_event_id, subscriber_state, batch_input_marketing_event_email_subscriber, async_req=True)
>>> thread = api.record_by_contact_emails_with_http_info(external_event_id, subscriber_state, batch_input_marketing_event_email_subscriber, async_req=True)
>>> result = thread.get()
:param external_event_id: The id of the marketing event (required)
Expand Down Expand Up @@ -118,18 +118,18 @@ def create_by_contact_email_with_http_info(self, external_event_id, subscriber_s

for key, val in six.iteritems(local_var_params["kwargs"]):
if key not in all_params:
raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method create_by_contact_email" % key)
raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method record_by_contact_emails" % key)
local_var_params[key] = val
del local_var_params["kwargs"]
# verify the required parameter 'external_event_id' is set
if self.api_client.client_side_validation and local_var_params.get("external_event_id") is None: # noqa: E501
raise ApiValueError("Missing the required parameter `external_event_id` when calling `create_by_contact_email`") # noqa: E501
raise ApiValueError("Missing the required parameter `external_event_id` when calling `record_by_contact_emails`") # noqa: E501
# verify the required parameter 'subscriber_state' is set
if self.api_client.client_side_validation and local_var_params.get("subscriber_state") is None: # noqa: E501
raise ApiValueError("Missing the required parameter `subscriber_state` when calling `create_by_contact_email`") # noqa: E501
raise ApiValueError("Missing the required parameter `subscriber_state` when calling `record_by_contact_emails`") # noqa: E501
# verify the required parameter 'batch_input_marketing_event_email_subscriber' is set
if self.api_client.client_side_validation and local_var_params.get("batch_input_marketing_event_email_subscriber") is None: # noqa: E501
raise ApiValueError("Missing the required parameter `batch_input_marketing_event_email_subscriber` when calling `create_by_contact_email`") # noqa: E501
raise ApiValueError("Missing the required parameter `batch_input_marketing_event_email_subscriber` when calling `record_by_contact_emails`") # noqa: E501

collection_formats = {}

Expand Down Expand Up @@ -185,14 +185,14 @@ def create_by_contact_email_with_http_info(self, external_event_id, subscriber_s
_request_auth=local_var_params.get("_request_auth"),
)

def create_by_contact_id(self, external_event_id, subscriber_state, batch_input_marketing_event_subscriber, **kwargs): # noqa: E501
def record_by_contact_ids(self, external_event_id, subscriber_state, batch_input_marketing_event_subscriber, **kwargs): # noqa: E501
"""Record a subscriber state by contact ids # noqa: E501
Record a subscriber state between multiple HubSpot contacts and a marketing event, using HubSpot contact ids. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_by_contact_id(external_event_id, subscriber_state, batch_input_marketing_event_subscriber, async_req=True)
>>> thread = api.record_by_contact_ids(external_event_id, subscriber_state, batch_input_marketing_event_subscriber, async_req=True)
>>> result = thread.get()
:param external_event_id: The id of the marketing event (required)
Expand All @@ -219,16 +219,16 @@ def create_by_contact_id(self, external_event_id, subscriber_state, batch_input_
:rtype: BatchResponseSubscriberVidResponse
"""
kwargs["_return_http_data_only"] = True
return self.create_by_contact_id_with_http_info(external_event_id, subscriber_state, batch_input_marketing_event_subscriber, **kwargs) # noqa: E501
return self.record_by_contact_ids_with_http_info(external_event_id, subscriber_state, batch_input_marketing_event_subscriber, **kwargs) # noqa: E501

def create_by_contact_id_with_http_info(self, external_event_id, subscriber_state, batch_input_marketing_event_subscriber, **kwargs): # noqa: E501
def record_by_contact_ids_with_http_info(self, external_event_id, subscriber_state, batch_input_marketing_event_subscriber, **kwargs): # noqa: E501
"""Record a subscriber state by contact ids # noqa: E501
Record a subscriber state between multiple HubSpot contacts and a marketing event, using HubSpot contact ids. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_by_contact_id_with_http_info(external_event_id, subscriber_state, batch_input_marketing_event_subscriber, async_req=True)
>>> thread = api.record_by_contact_ids_with_http_info(external_event_id, subscriber_state, batch_input_marketing_event_subscriber, async_req=True)
>>> result = thread.get()
:param external_event_id: The id of the marketing event (required)
Expand Down Expand Up @@ -270,18 +270,18 @@ def create_by_contact_id_with_http_info(self, external_event_id, subscriber_stat

for key, val in six.iteritems(local_var_params["kwargs"]):
if key not in all_params:
raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method create_by_contact_id" % key)
raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method record_by_contact_ids" % key)
local_var_params[key] = val
del local_var_params["kwargs"]
# verify the required parameter 'external_event_id' is set
if self.api_client.client_side_validation and local_var_params.get("external_event_id") is None: # noqa: E501
raise ApiValueError("Missing the required parameter `external_event_id` when calling `create_by_contact_id`") # noqa: E501
raise ApiValueError("Missing the required parameter `external_event_id` when calling `record_by_contact_ids`") # noqa: E501
# verify the required parameter 'subscriber_state' is set
if self.api_client.client_side_validation and local_var_params.get("subscriber_state") is None: # noqa: E501
raise ApiValueError("Missing the required parameter `subscriber_state` when calling `create_by_contact_id`") # noqa: E501
raise ApiValueError("Missing the required parameter `subscriber_state` when calling `record_by_contact_ids`") # noqa: E501
# verify the required parameter 'batch_input_marketing_event_subscriber' is set
if self.api_client.client_side_validation and local_var_params.get("batch_input_marketing_event_subscriber") is None: # noqa: E501
raise ApiValueError("Missing the required parameter `batch_input_marketing_event_subscriber` when calling `create_by_contact_id`") # noqa: E501
raise ApiValueError("Missing the required parameter `batch_input_marketing_event_subscriber` when calling `record_by_contact_ids`") # noqa: E501

collection_formats = {}

Expand Down
Loading

0 comments on commit e031d49

Please sign in to comment.