Skip to content

Commit 88e4a97

Browse files
Merge pull request #97 from HubSpot/feature/regen06042022
Feature/regen06042022
2 parents 5ab761d + ed232b8 commit 88e4a97

File tree

729 files changed

+91067
-8753
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

729 files changed

+91067
-8753
lines changed

Diff for: CHANGELOG.md

+21-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,27 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8-
## [Unreleased](https://github.com/HubSpot/hubspot-api-python/compare/v4.0.2...HEAD)
8+
## [Unreleased](https://github.com/HubSpot/hubspot-api-python/compare/v5.0.0...HEAD)
9+
10+
## [5.0.0](https://github.com/HubSpot/hubspot-api-python/compare/v4.0.6...v5.0.0) - 2022-04-12
11+
12+
### Added
13+
14+
- cms.source_code API client
15+
- crm.objects.calls API client
16+
- crm.objects.emails API client
17+
- crm.objects.meetings API client
18+
- crm.objects.notes API client
19+
- crm.objects.tasks API client
20+
- marketing.forms API client
21+
- marketing.events API client
22+
- settings.users API client
23+
24+
### Changed (no discovery breaking changes)
25+
26+
- cms.blogs.authors.author_api => cms.blogs.authors.blog_authors_api
27+
- cms.blogs.blog_posts.default_api => cms.blogs.blog_posts.blog_posts_api
28+
- cms.blogs.tags.default_api => cms.blogs.tags.blog_tags_api
929

1030
## [4.0.2](https://github.com/HubSpot/hubspot-api-python/compare/v4.0.1...v4.0.1) - 2021-11-03
1131

Diff for: VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4.0.6
1+
5.0.0

Diff for: hubspot/auth/oauth/api/access_tokens_api.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import six
1919

2020
from hubspot.auth.oauth.api_client import ApiClient
21-
from hubspot.auth.oauth.exceptions import ApiTypeError, ApiValueError # noqa: F401
21+
from hubspot.auth.oauth.exceptions import ApiTypeError, ApiValueError
2222

2323

2424
class AccessTokensApi(object):
@@ -83,8 +83,11 @@ def get_access_token_with_http_info(self, token, **kwargs): # noqa: E501
8383

8484
local_var_params = locals()
8585

86-
all_params = ["token"]
87-
all_params.extend(["async_req", "_return_http_data_only", "_preload_content", "_request_timeout"])
86+
all_params = ["token"] # noqa: E501
87+
all_params.append("async_req")
88+
all_params.append("_return_http_data_only")
89+
all_params.append("_preload_content")
90+
all_params.append("_request_timeout")
8891

8992
for key, val in six.iteritems(local_var_params["kwargs"]):
9093
if key not in all_params:

Diff for: hubspot/auth/oauth/api/refresh_tokens_api.py

+11-5
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import six
1919

2020
from hubspot.auth.oauth.api_client import ApiClient
21-
from hubspot.auth.oauth.exceptions import ApiTypeError, ApiValueError # noqa: F401
21+
from hubspot.auth.oauth.exceptions import ApiTypeError, ApiValueError
2222

2323

2424
class RefreshTokensApi(object):
@@ -83,8 +83,11 @@ def archive_refresh_token_with_http_info(self, token, **kwargs): # noqa: E501
8383

8484
local_var_params = locals()
8585

86-
all_params = ["token"]
87-
all_params.extend(["async_req", "_return_http_data_only", "_preload_content", "_request_timeout"])
86+
all_params = ["token"] # noqa: E501
87+
all_params.append("async_req")
88+
all_params.append("_return_http_data_only")
89+
all_params.append("_preload_content")
90+
all_params.append("_request_timeout")
8891

8992
for key, val in six.iteritems(local_var_params["kwargs"]):
9093
if key not in all_params:
@@ -183,8 +186,11 @@ def get_refresh_token_with_http_info(self, token, **kwargs): # noqa: E501
183186

184187
local_var_params = locals()
185188

186-
all_params = ["token"]
187-
all_params.extend(["async_req", "_return_http_data_only", "_preload_content", "_request_timeout"])
189+
all_params = ["token"] # noqa: E501
190+
all_params.append("async_req")
191+
all_params.append("_return_http_data_only")
192+
all_params.append("_preload_content")
193+
all_params.append("_request_timeout")
188194

189195
for key, val in six.iteritems(local_var_params["kwargs"]):
190196
if key not in all_params:

Diff for: hubspot/auth/oauth/api/tokens_api.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import six
1919

2020
from hubspot.auth.oauth.api_client import ApiClient
21-
from hubspot.auth.oauth.exceptions import ApiTypeError, ApiValueError # noqa: F401
21+
from hubspot.auth.oauth.exceptions import ApiTypeError, ApiValueError
2222

2323

2424
class TokensApi(object):
@@ -93,8 +93,11 @@ def create_token_with_http_info(self, **kwargs): # noqa: E501
9393

9494
local_var_params = locals()
9595

96-
all_params = ["grant_type", "code", "redirect_uri", "client_id", "client_secret", "refresh_token"]
97-
all_params.extend(["async_req", "_return_http_data_only", "_preload_content", "_request_timeout"])
96+
all_params = ["grant_type", "code", "redirect_uri", "client_id", "client_secret", "refresh_token"] # noqa: E501
97+
all_params.append("async_req")
98+
all_params.append("_return_http_data_only")
99+
all_params.append("_preload_content")
100+
all_params.append("_request_timeout")
98101

99102
for key, val in six.iteritems(local_var_params["kwargs"]):
100103
if key not in all_params:

Diff for: hubspot/auth/oauth/api_client.py

+18-45
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
from __future__ import absolute_import
1212

13-
import atexit
1413
import datetime
1514
from dateutil.parser import parse
1615
import json
@@ -27,7 +26,7 @@
2726
from hubspot.auth.oauth.configuration import Configuration
2827
import hubspot.auth.oauth.models
2928
from hubspot.auth.oauth import rest
30-
from hubspot.auth.oauth.exceptions import ApiValueError, ApiException
29+
from hubspot.auth.oauth.exceptions import ApiValueError
3130

3231

3332
class ApiClient(object):
@@ -67,7 +66,7 @@ class ApiClient(object):
6766

6867
def __init__(self, configuration=None, header_name=None, header_value=None, cookie=None, pool_threads=1):
6968
if configuration is None:
70-
configuration = Configuration.get_default_copy()
69+
configuration = Configuration()
7170
self.configuration = configuration
7271
self.pool_threads = pool_threads
7372

@@ -80,27 +79,18 @@ def __init__(self, configuration=None, header_name=None, header_value=None, cook
8079
self.user_agent = "OpenAPI-Generator/1.0.0/python"
8180
self.client_side_validation = configuration.client_side_validation
8281

83-
def __enter__(self):
84-
return self
85-
86-
def __exit__(self, exc_type, exc_value, traceback):
87-
self.close()
88-
89-
def close(self):
82+
def __del__(self):
9083
if self._pool:
9184
self._pool.close()
9285
self._pool.join()
9386
self._pool = None
94-
if hasattr(atexit, "unregister"):
95-
atexit.unregister(self.close)
9687

9788
@property
9889
def pool(self):
9990
"""Create thread pool on first request
10091
avoids instantiating unused threadpool for blocking clients.
10192
"""
10293
if self._pool is None:
103-
atexit.register(self.close)
10494
self._pool = ThreadPool(self.pool_threads)
10595
return self._pool
10696

@@ -180,36 +170,20 @@ def __call_api(
180170
# use server/host defined in path or operation instead
181171
url = _host + resource_path
182172

183-
try:
184-
# perform request and return response
185-
response_data = self.request(
186-
method, url, query_params=query_params, headers=header_params, post_params=post_params, body=body, _preload_content=_preload_content, _request_timeout=_request_timeout
187-
)
188-
except ApiException as e:
189-
e.body = e.body.decode("utf-8") if six.PY3 else e.body
190-
raise e
191-
192-
content_type = response_data.getheader("content-type")
173+
# perform request and return response
174+
response_data = self.request(
175+
method, url, query_params=query_params, headers=header_params, post_params=post_params, body=body, _preload_content=_preload_content, _request_timeout=_request_timeout
176+
)
193177

194178
self.last_response = response_data
195179

196180
return_data = response_data
197-
198-
if not _preload_content:
199-
return return_data
200-
201-
if six.PY3 and response_type not in ["file", "bytes"]:
202-
match = None
203-
if content_type is not None:
204-
match = re.search(r"charset=([a-zA-Z\-\d]+)[\s\;]?", content_type)
205-
encoding = match.group(1) if match else "utf-8"
206-
response_data.data = response_data.data.decode(encoding)
207-
208-
# deserialize response data
209-
if response_type:
210-
return_data = self.deserialize(response_data, response_type)
211-
else:
212-
return_data = None
181+
if _preload_content:
182+
# deserialize response data
183+
if response_type:
184+
return_data = self.deserialize(response_data, response_type)
185+
else:
186+
return_data = None
213187

214188
if _return_http_data_only:
215189
return return_data
@@ -522,7 +496,9 @@ def update_params_for_auth(self, headers, querys, auth_settings):
522496
for auth in auth_settings:
523497
auth_setting = self.configuration.auth_settings().get(auth)
524498
if auth_setting:
525-
if auth_setting["in"] == "cookie":
499+
if not auth_setting["value"]:
500+
continue
501+
elif auth_setting["in"] == "cookie":
526502
headers["Cookie"] = auth_setting["value"]
527503
elif auth_setting["in"] == "header":
528504
headers[auth_setting["key"]] = auth_setting["value"]
@@ -611,11 +587,8 @@ def __deserialize_model(self, data, klass):
611587
:param klass: class literal.
612588
:return: model object.
613589
"""
614-
has_discriminator = False
615-
if hasattr(klass, "get_real_child_model") and klass.discriminator_value_class_map:
616-
has_discriminator = True
617590

618-
if not klass.openapi_types and has_discriminator is False:
591+
if not klass.openapi_types and not hasattr(klass, "get_real_child_model"):
619592
return data
620593

621594
kwargs = {}
@@ -627,7 +600,7 @@ def __deserialize_model(self, data, klass):
627600

628601
instance = klass(**kwargs)
629602

630-
if has_discriminator:
603+
if hasattr(instance, "get_real_child_model"):
631604
klass_name = instance.get_real_child_model(data)
632605
if klass_name:
633606
instance = self.__deserialize(data, klass_name)

0 commit comments

Comments
 (0)