Skip to content

Commit ef9b874

Browse files
committed
Update to 3.0.1
1 parent a94c78d commit ef9b874

36 files changed

Lines changed: 157 additions & 237 deletions

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ details on how to implement Dyspatch.
1111
This Python package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
1212

1313
- API version: 2019.10
14-
- Package version: 3.0.0
14+
- Package version: 3.0.1
1515
- Build package: io.swagger.codegen.languages.PythonClientCodegen
1616
For more information, please visit [https://docs.dyspatch.io](https://docs.dyspatch.io)
1717

docs/DraftsApi.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ void (empty response body)
403403
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
404404

405405
# **drafts_get**
406-
> DraftsRead drafts_get(status=status)
406+
> DraftsRead drafts_get(cursor=cursor, status=status)
407407
408408
List Drafts
409409

@@ -425,11 +425,12 @@ configuration.api_key['Authorization'] = 'YOUR_API_KEY'
425425

426426
# create an instance of the API class
427427
api_instance = dyspatch_client.DraftsApi(dyspatch_client.ApiClient(configuration))
428+
cursor = 'cursor_example' # str | A cursor value used to retrieve a specific page from a paginated result set. (optional)
428429
status = 'status_example' # str | Filter the list of drafts by a particular status (optional)
429430

430431
try:
431432
# List Drafts
432-
api_response = api_instance.drafts_get(status=status)
433+
api_response = api_instance.drafts_get(cursor=cursor, status=status)
433434
pprint(api_response)
434435
except ApiException as e:
435436
print("Exception when calling DraftsApi->drafts_get: %s\n" % e)
@@ -439,6 +440,7 @@ except ApiException as e:
439440

440441
Name | Type | Description | Notes
441442
------------- | ------------- | ------------- | -------------
443+
**cursor** | **str**| A cursor value used to retrieve a specific page from a paginated result set. | [optional]
442444
**status** | **str**| Filter the list of drafts by a particular status | [optional]
443445

444446
### Return type

dyspatch_client/api/drafts_api.py

Lines changed: 77 additions & 73 deletions
Large diffs are not rendered by default.

dyspatch_client/api/localizations_api.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,19 @@ def localizations_localization_id_get(self, localization_id, target_language, **
3838
3939
Returns a specific localization object with a matching ID. # noqa: E501
4040
This method makes a synchronous HTTP request by default. To make an
41-
asynchronous HTTP request, please pass async_req=True
42-
>>> thread = api.localizations_localization_id_get(localization_id, target_language, async_req=True)
41+
asynchronous HTTP request, please pass async=True
42+
>>> thread = api.localizations_localization_id_get(localization_id, target_language, async=True)
4343
>>> result = thread.get()
4444
45-
:param async_req bool
45+
:param async bool
4646
:param str localization_id: A localization ID (required)
4747
:param str target_language: The type of templating language to compile as. Should only be used for visual templates. (required)
4848
:return: LocalizationRead
4949
If the method is called asynchronously,
5050
returns the request thread.
5151
"""
5252
kwargs['_return_http_data_only'] = True
53-
if kwargs.get('async_req'):
53+
if kwargs.get('async'):
5454
return self.localizations_localization_id_get_with_http_info(localization_id, target_language, **kwargs) # noqa: E501
5555
else:
5656
(data) = self.localizations_localization_id_get_with_http_info(localization_id, target_language, **kwargs) # noqa: E501
@@ -61,11 +61,11 @@ def localizations_localization_id_get_with_http_info(self, localization_id, targ
6161
6262
Returns a specific localization object with a matching ID. # noqa: E501
6363
This method makes a synchronous HTTP request by default. To make an
64-
asynchronous HTTP request, please pass async_req=True
65-
>>> thread = api.localizations_localization_id_get_with_http_info(localization_id, target_language, async_req=True)
64+
asynchronous HTTP request, please pass async=True
65+
>>> thread = api.localizations_localization_id_get_with_http_info(localization_id, target_language, async=True)
6666
>>> result = thread.get()
6767
68-
:param async_req bool
68+
:param async bool
6969
:param str localization_id: A localization ID (required)
7070
:param str target_language: The type of templating language to compile as. Should only be used for visual templates. (required)
7171
:return: LocalizationRead
@@ -74,7 +74,7 @@ def localizations_localization_id_get_with_http_info(self, localization_id, targ
7474
"""
7575

7676
all_params = ['localization_id', 'target_language'] # noqa: E501
77-
all_params.append('async_req')
77+
all_params.append('async')
7878
all_params.append('_return_http_data_only')
7979
all_params.append('_preload_content')
8080
all_params.append('_request_timeout')
@@ -130,7 +130,7 @@ def localizations_localization_id_get_with_http_info(self, localization_id, targ
130130
files=local_var_files,
131131
response_type='LocalizationRead', # noqa: E501
132132
auth_settings=auth_settings,
133-
async_req=params.get('async_req'),
133+
async=params.get('async'),
134134
_return_http_data_only=params.get('_return_http_data_only'),
135135
_preload_content=params.get('_preload_content', True),
136136
_request_timeout=params.get('_request_timeout'),

dyspatch_client/api/templates_api.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,18 @@ def templates_get(self, **kwargs): # noqa: E501
3838
3939
Gets a list of Template Metadata objects for all templates. Up to 25 results returned before results are paginated. # noqa: E501
4040
This method makes a synchronous HTTP request by default. To make an
41-
asynchronous HTTP request, please pass async_req=True
42-
>>> thread = api.templates_get(async_req=True)
41+
asynchronous HTTP request, please pass async=True
42+
>>> thread = api.templates_get(async=True)
4343
>>> result = thread.get()
4444
45-
:param async_req bool
45+
:param async bool
4646
:param str cursor: A cursor value used to retrieve a specific page from a paginated result set.
4747
:return: TemplatesRead
4848
If the method is called asynchronously,
4949
returns the request thread.
5050
"""
5151
kwargs['_return_http_data_only'] = True
52-
if kwargs.get('async_req'):
52+
if kwargs.get('async'):
5353
return self.templates_get_with_http_info(**kwargs) # noqa: E501
5454
else:
5555
(data) = self.templates_get_with_http_info(**kwargs) # noqa: E501
@@ -60,19 +60,19 @@ def templates_get_with_http_info(self, **kwargs): # noqa: E501
6060
6161
Gets a list of Template Metadata objects for all templates. Up to 25 results returned before results are paginated. # noqa: E501
6262
This method makes a synchronous HTTP request by default. To make an
63-
asynchronous HTTP request, please pass async_req=True
64-
>>> thread = api.templates_get_with_http_info(async_req=True)
63+
asynchronous HTTP request, please pass async=True
64+
>>> thread = api.templates_get_with_http_info(async=True)
6565
>>> result = thread.get()
6666
67-
:param async_req bool
67+
:param async bool
6868
:param str cursor: A cursor value used to retrieve a specific page from a paginated result set.
6969
:return: TemplatesRead
7070
If the method is called asynchronously,
7171
returns the request thread.
7272
"""
7373

7474
all_params = ['cursor'] # noqa: E501
75-
all_params.append('async_req')
75+
all_params.append('async')
7676
all_params.append('_return_http_data_only')
7777
all_params.append('_preload_content')
7878
all_params.append('_request_timeout')
@@ -118,7 +118,7 @@ def templates_get_with_http_info(self, **kwargs): # noqa: E501
118118
files=local_var_files,
119119
response_type='TemplatesRead', # noqa: E501
120120
auth_settings=auth_settings,
121-
async_req=params.get('async_req'),
121+
async=params.get('async'),
122122
_return_http_data_only=params.get('_return_http_data_only'),
123123
_preload_content=params.get('_preload_content', True),
124124
_request_timeout=params.get('_request_timeout'),
@@ -129,19 +129,19 @@ def templates_template_id_get(self, template_id, target_language, **kwargs): #
129129
130130
Gets a template object with the matching ID. If the template has published content the \"compiled\" field will contain the template . # noqa: E501
131131
This method makes a synchronous HTTP request by default. To make an
132-
asynchronous HTTP request, please pass async_req=True
133-
>>> thread = api.templates_template_id_get(template_id, target_language, async_req=True)
132+
asynchronous HTTP request, please pass async=True
133+
>>> thread = api.templates_template_id_get(template_id, target_language, async=True)
134134
>>> result = thread.get()
135135
136-
:param async_req bool
136+
:param async bool
137137
:param str template_id: A template ID (required)
138138
:param str target_language: The type of templating language to compile as. Should only be used for visual templates. (required)
139139
:return: TemplateRead
140140
If the method is called asynchronously,
141141
returns the request thread.
142142
"""
143143
kwargs['_return_http_data_only'] = True
144-
if kwargs.get('async_req'):
144+
if kwargs.get('async'):
145145
return self.templates_template_id_get_with_http_info(template_id, target_language, **kwargs) # noqa: E501
146146
else:
147147
(data) = self.templates_template_id_get_with_http_info(template_id, target_language, **kwargs) # noqa: E501
@@ -152,11 +152,11 @@ def templates_template_id_get_with_http_info(self, template_id, target_language,
152152
153153
Gets a template object with the matching ID. If the template has published content the \"compiled\" field will contain the template . # noqa: E501
154154
This method makes a synchronous HTTP request by default. To make an
155-
asynchronous HTTP request, please pass async_req=True
156-
>>> thread = api.templates_template_id_get_with_http_info(template_id, target_language, async_req=True)
155+
asynchronous HTTP request, please pass async=True
156+
>>> thread = api.templates_template_id_get_with_http_info(template_id, target_language, async=True)
157157
>>> result = thread.get()
158158
159-
:param async_req bool
159+
:param async bool
160160
:param str template_id: A template ID (required)
161161
:param str target_language: The type of templating language to compile as. Should only be used for visual templates. (required)
162162
:return: TemplateRead
@@ -165,7 +165,7 @@ def templates_template_id_get_with_http_info(self, template_id, target_language,
165165
"""
166166

167167
all_params = ['template_id', 'target_language'] # noqa: E501
168-
all_params.append('async_req')
168+
all_params.append('async')
169169
all_params.append('_return_http_data_only')
170170
all_params.append('_preload_content')
171171
all_params.append('_request_timeout')
@@ -221,7 +221,7 @@ def templates_template_id_get_with_http_info(self, template_id, target_language,
221221
files=local_var_files,
222222
response_type='TemplateRead', # noqa: E501
223223
auth_settings=auth_settings,
224-
async_req=params.get('async_req'),
224+
async=params.get('async'),
225225
_return_http_data_only=params.get('_return_http_data_only'),
226226
_preload_content=params.get('_preload_content', True),
227227
_request_timeout=params.get('_request_timeout'),

dyspatch_client/api_client.py

Lines changed: 13 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -66,26 +66,18 @@ def __init__(self, configuration=None, header_name=None, header_value=None,
6666
configuration = Configuration()
6767
self.configuration = configuration
6868

69-
# Use the pool property to lazily initialize the ThreadPool.
70-
self._pool = None
69+
self.pool = ThreadPool()
7170
self.rest_client = rest.RESTClientObject(configuration)
7271
self.default_headers = {}
7372
if header_name is not None:
7473
self.default_headers[header_name] = header_value
7574
self.cookie = cookie
7675
# Set default User-Agent.
77-
self.user_agent = 'Swagger-Codegen/3.0.0/python'
76+
self.user_agent = 'Swagger-Codegen/3.0.1/python'
7877

7978
def __del__(self):
80-
if self._pool is not None:
81-
self._pool.close()
82-
self._pool.join()
83-
84-
@property
85-
def pool(self):
86-
if self._pool is None:
87-
self._pool = ThreadPool()
88-
return self._pool
79+
self.pool.close()
80+
self.pool.join()
8981

9082
@property
9183
def user_agent(self):
@@ -282,12 +274,12 @@ def __deserialize(self, data, klass):
282274
def call_api(self, resource_path, method,
283275
path_params=None, query_params=None, header_params=None,
284276
body=None, post_params=None, files=None,
285-
response_type=None, auth_settings=None, async_req=None,
277+
response_type=None, auth_settings=None, async=None,
286278
_return_http_data_only=None, collection_formats=None,
287279
_preload_content=True, _request_timeout=None):
288280
"""Makes the HTTP request (synchronous) and returns deserialized data.
289281
290-
To make an async request, set the async_req parameter.
282+
To make an async request, set the async parameter.
291283
292284
:param resource_path: Path to method endpoint.
293285
:param method: Method to call.
@@ -302,7 +294,7 @@ def call_api(self, resource_path, method,
302294
:param response: Response data type.
303295
:param files dict: key -> filename, value -> filepath,
304296
for `multipart/form-data`.
305-
:param async_req bool: execute request asynchronously
297+
:param async bool: execute request asynchronously
306298
:param _return_http_data_only: response data without head status code
307299
and headers
308300
:param collection_formats: dict of collection formats for path, query,
@@ -315,13 +307,13 @@ def call_api(self, resource_path, method,
315307
timeout. It can also be a pair (tuple) of
316308
(connection, read) timeouts.
317309
:return:
318-
If async_req parameter is True,
310+
If async parameter is True,
319311
the request will be called asynchronously.
320312
The method will return the request thread.
321-
If parameter async_req is False or missing,
313+
If parameter async is False or missing,
322314
then the method will return the response directly.
323315
"""
324-
if not async_req:
316+
if not async:
325317
return self.__call_api(resource_path, method,
326318
path_params, query_params, header_params,
327319
body, post_params, files,
@@ -549,7 +541,7 @@ def __deserialize_primitive(self, data, klass):
549541
try:
550542
return klass(data)
551543
except UnicodeEncodeError:
552-
return six.text_type(data)
544+
return six.u(data)
553545
except TypeError:
554546
return data
555547

@@ -599,9 +591,6 @@ def __deserialize_datatime(self, string):
599591
)
600592
)
601593

602-
def __hasattr(self, object, name):
603-
return name in object.__class__.__dict__
604-
605594
def __deserialize_model(self, data, klass):
606595
"""Deserializes list or dict to model.
607596
@@ -610,8 +599,7 @@ def __deserialize_model(self, data, klass):
610599
:return: model object.
611600
"""
612601

613-
if (not klass.swagger_types and
614-
not self.__hasattr(klass, 'get_real_child_model')):
602+
if not klass.swagger_types and not hasattr(klass, 'get_real_child_model'):
615603
return data
616604

617605
kwargs = {}
@@ -625,13 +613,7 @@ def __deserialize_model(self, data, klass):
625613

626614
instance = klass(**kwargs)
627615

628-
if (isinstance(instance, dict) and
629-
klass.swagger_types is not None and
630-
isinstance(data, dict)):
631-
for key, value in data.items():
632-
if key not in klass.swagger_types:
633-
instance[key] = value
634-
if self.__hasattr(instance, 'get_real_child_model'):
616+
if hasattr(instance, 'get_real_child_model'):
635617
klass_name = instance.get_real_child_model(data)
636618
if klass_name:
637619
instance = self.__deserialize(data, klass_name)

dyspatch_client/configuration.py

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,29 @@
2323
from six.moves import http_client as httplib
2424

2525

26-
class Configuration(object):
26+
class TypeWithDefault(type):
27+
def __init__(cls, name, bases, dct):
28+
super(TypeWithDefault, cls).__init__(name, bases, dct)
29+
cls._default = None
30+
31+
def __call__(cls):
32+
if cls._default is None:
33+
cls._default = type.__call__(cls)
34+
return copy.copy(cls._default)
35+
36+
def set_default(cls, default):
37+
cls._default = copy.copy(default)
38+
39+
40+
class Configuration(six.with_metaclass(TypeWithDefault, object)):
2741
"""NOTE: This class is auto generated by the swagger code generator program.
2842
2943
Ref: https://github.com/swagger-api/swagger-codegen
3044
Do not edit the class manually.
3145
"""
3246

33-
_default = None
34-
3547
def __init__(self):
3648
"""Constructor"""
37-
if self._default:
38-
for key in self._default.__dict__.keys():
39-
self.__dict__[key] = copy.copy(self._default.__dict__[key])
40-
return
41-
4249
# Default Base url
4350
self.host = "https://api.dyspatch.io"
4451
# Temp file folder for downloading files
@@ -94,10 +101,6 @@ def __init__(self):
94101
# Safe chars for path_param
95102
self.safe_chars_for_path_param = ''
96103

97-
@classmethod
98-
def set_default(cls, default):
99-
cls._default = default
100-
101104
@property
102105
def logger_file(self):
103106
"""The logger file.
@@ -240,5 +243,5 @@ def to_debug_report(self):
240243
"OS: {env}\n"\
241244
"Python Version: {pyversion}\n"\
242245
"Version of the API: 2019.10\n"\
243-
"SDK Package Version: 3.0.0".\
246+
"SDK Package Version: 3.0.1".\
244247
format(env=sys.platform, pyversion=sys.version)

dyspatch_client/models/api_error.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,6 @@ def to_dict(self):
153153
))
154154
else:
155155
result[attr] = value
156-
if issubclass(APIError, dict):
157-
for key, value in self.items():
158-
result[key] = value
159156

160157
return result
161158

0 commit comments

Comments
 (0)