[Python] Add option to select content-type using body or force it for… (#10686)

* [Python] Add option to select content-type using body or force it for API call

* Add support for application/json-patch+json

* Add unittests.
This commit is contained in:
Tomasz Prus
2021-11-22 17:41:04 +01:00
committed by GitHub
parent c13067d100
commit e9f2ccde67
33 changed files with 819 additions and 302 deletions

View File

@@ -107,6 +107,7 @@ class {{classname}}(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -142,7 +143,8 @@ class {{classname}}(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -247,8 +249,10 @@ class {{classname}}(object):
{{/hasProduces}} {{/hasProduces}}
{{#hasConsumes}} {{#hasConsumes}}
# HTTP header `Content-Type` # HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 header_params['Content-Type'] = local_var_params.get('_content_type',
[{{#consumes}}'{{{mediaType}}}'{{^-last}}, {{/-last}}{{/consumes}}]) # noqa: E501 self.api_client.select_header_content_type(
[{{#consumes}}'{{{mediaType}}}'{{^-last}}, {{/-last}}{{/consumes}}],
'{{httpMethod}}', body_params)) # noqa: E501
{{/hasConsumes}} {{/hasConsumes}}
# Authentication setting # Authentication setting

View File

@@ -545,10 +545,12 @@ class ApiClient(object):
else: else:
return ', '.join(accepts) return ', '.join(accepts)
def select_header_content_type(self, content_types): def select_header_content_type(self, content_types, method=None, body=None):
"""Returns `Content-Type` based on an array of content_types provided. """Returns `Content-Type` based on an array of content_types provided.
:param content_types: List of content-types. :param content_types: List of content-types.
:param method: http method (e.g. POST, PATCH).
:param body: http body to send.
:return: Content-Type (e.g. application/json). :return: Content-Type (e.g. application/json).
""" """
if not content_types: if not content_types:
@@ -556,6 +558,11 @@ class ApiClient(object):
content_types = [x.lower() for x in content_types] content_types = [x.lower() for x in content_types]
if (method == 'PATCH' and
'application/json-patch+json' in content_types and
isinstance(body, list)):
return 'application/json-patch+json'
if 'application/json' in content_types or '*/*' in content_types: if 'application/json' in content_types or '*/*' in content_types:
return 'application/json' return 'application/json'
else: else:

View File

@@ -95,6 +95,7 @@ class AnotherFakeApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -112,7 +113,8 @@ class AnotherFakeApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -148,8 +150,10 @@ class AnotherFakeApi(object):
['application/json']) # noqa: E501 ['application/json']) # noqa: E501
# HTTP header `Content-Type` # HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 header_params['Content-Type'] = local_var_params.get('_content_type',
['application/json']) # noqa: E501 self.api_client.select_header_content_type(
['application/json'],
'PATCH', body_params)) # noqa: E501
# Authentication setting # Authentication setting
auth_settings = [] # noqa: E501 auth_settings = [] # noqa: E501

View File

@@ -95,6 +95,7 @@ class FakeApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -112,7 +113,8 @@ class FakeApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -144,8 +146,10 @@ class FakeApi(object):
if 'xml_item' in local_var_params: if 'xml_item' in local_var_params:
body_params = local_var_params['xml_item'] body_params = local_var_params['xml_item']
# HTTP header `Content-Type` # HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 header_params['Content-Type'] = local_var_params.get('_content_type',
['application/xml', 'application/xml; charset=utf-8', 'application/xml; charset=utf-16', 'text/xml', 'text/xml; charset=utf-8', 'text/xml; charset=utf-16']) # noqa: E501 self.api_client.select_header_content_type(
['application/xml', 'application/xml; charset=utf-8', 'application/xml; charset=utf-16', 'text/xml', 'text/xml; charset=utf-8', 'text/xml; charset=utf-16'],
'POST', body_params)) # noqa: E501
# Authentication setting # Authentication setting
auth_settings = [] # noqa: E501 auth_settings = [] # noqa: E501
@@ -228,6 +232,7 @@ class FakeApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -245,7 +250,8 @@ class FakeApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -359,6 +365,7 @@ class FakeApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -376,7 +383,8 @@ class FakeApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -490,6 +498,7 @@ class FakeApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -507,7 +516,8 @@ class FakeApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -621,6 +631,7 @@ class FakeApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -638,7 +649,8 @@ class FakeApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -752,6 +764,7 @@ class FakeApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -769,7 +782,8 @@ class FakeApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -801,8 +815,10 @@ class FakeApi(object):
if 'body' in local_var_params: if 'body' in local_var_params:
body_params = local_var_params['body'] body_params = local_var_params['body']
# HTTP header `Content-Type` # HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 header_params['Content-Type'] = local_var_params.get('_content_type',
['application/json']) # noqa: E501 self.api_client.select_header_content_type(
['application/json'],
'PUT', body_params)) # noqa: E501
# Authentication setting # Authentication setting
auth_settings = [] # noqa: E501 auth_settings = [] # noqa: E501
@@ -887,6 +903,7 @@ class FakeApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -905,7 +922,8 @@ class FakeApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -943,8 +961,10 @@ class FakeApi(object):
if 'body' in local_var_params: if 'body' in local_var_params:
body_params = local_var_params['body'] body_params = local_var_params['body']
# HTTP header `Content-Type` # HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 header_params['Content-Type'] = local_var_params.get('_content_type',
['application/json']) # noqa: E501 self.api_client.select_header_content_type(
['application/json'],
'PUT', body_params)) # noqa: E501
# Authentication setting # Authentication setting
auth_settings = [] # noqa: E501 auth_settings = [] # noqa: E501
@@ -1027,6 +1047,7 @@ class FakeApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -1044,7 +1065,8 @@ class FakeApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -1080,8 +1102,10 @@ class FakeApi(object):
['application/json']) # noqa: E501 ['application/json']) # noqa: E501
# HTTP header `Content-Type` # HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 header_params['Content-Type'] = local_var_params.get('_content_type',
['application/json']) # noqa: E501 self.api_client.select_header_content_type(
['application/json'],
'PATCH', body_params)) # noqa: E501
# Authentication setting # Authentication setting
auth_settings = [] # noqa: E501 auth_settings = [] # noqa: E501
@@ -1218,6 +1242,7 @@ class FakeApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -1248,7 +1273,8 @@ class FakeApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -1346,8 +1372,10 @@ class FakeApi(object):
body_params = None body_params = None
# HTTP header `Content-Type` # HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 header_params['Content-Type'] = local_var_params.get('_content_type',
['application/x-www-form-urlencoded']) # noqa: E501 self.api_client.select_header_content_type(
['application/x-www-form-urlencoded'],
'POST', body_params)) # noqa: E501
# Authentication setting # Authentication setting
auth_settings = ['http_basic_test'] # noqa: E501 auth_settings = ['http_basic_test'] # noqa: E501
@@ -1458,6 +1486,7 @@ class FakeApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -1482,7 +1511,8 @@ class FakeApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -1527,8 +1557,10 @@ class FakeApi(object):
body_params = None body_params = None
# HTTP header `Content-Type` # HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 header_params['Content-Type'] = local_var_params.get('_content_type',
['application/x-www-form-urlencoded']) # noqa: E501 self.api_client.select_header_content_type(
['application/x-www-form-urlencoded'],
'GET', body_params)) # noqa: E501
# Authentication setting # Authentication setting
auth_settings = [] # noqa: E501 auth_settings = [] # noqa: E501
@@ -1631,6 +1663,7 @@ class FakeApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -1653,7 +1686,8 @@ class FakeApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -1781,6 +1815,7 @@ class FakeApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -1798,7 +1833,8 @@ class FakeApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -1830,8 +1866,10 @@ class FakeApi(object):
if 'param' in local_var_params: if 'param' in local_var_params:
body_params = local_var_params['param'] body_params = local_var_params['param']
# HTTP header `Content-Type` # HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 header_params['Content-Type'] = local_var_params.get('_content_type',
['application/json']) # noqa: E501 self.api_client.select_header_content_type(
['application/json'],
'POST', body_params)) # noqa: E501
# Authentication setting # Authentication setting
auth_settings = [] # noqa: E501 auth_settings = [] # noqa: E501
@@ -1916,6 +1954,7 @@ class FakeApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -1934,7 +1973,8 @@ class FakeApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -1972,8 +2012,10 @@ class FakeApi(object):
body_params = None body_params = None
# HTTP header `Content-Type` # HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 header_params['Content-Type'] = local_var_params.get('_content_type',
['application/x-www-form-urlencoded']) # noqa: E501 self.api_client.select_header_content_type(
['application/x-www-form-urlencoded'],
'GET', body_params)) # noqa: E501
# Authentication setting # Authentication setting
auth_settings = [] # noqa: E501 auth_settings = [] # noqa: E501
@@ -2072,6 +2114,7 @@ class FakeApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -2093,7 +2136,8 @@ class FakeApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )

View File

@@ -95,6 +95,7 @@ class FakeClassnameTags123Api(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -112,7 +113,8 @@ class FakeClassnameTags123Api(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -148,8 +150,10 @@ class FakeClassnameTags123Api(object):
['application/json']) # noqa: E501 ['application/json']) # noqa: E501
# HTTP header `Content-Type` # HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 header_params['Content-Type'] = local_var_params.get('_content_type',
['application/json']) # noqa: E501 self.api_client.select_header_content_type(
['application/json'],
'PATCH', body_params)) # noqa: E501
# Authentication setting # Authentication setting
auth_settings = ['api_key_query'] # noqa: E501 auth_settings = ['api_key_query'] # noqa: E501

View File

@@ -93,6 +93,7 @@ class PetApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -110,7 +111,8 @@ class PetApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -142,8 +144,10 @@ class PetApi(object):
if 'body' in local_var_params: if 'body' in local_var_params:
body_params = local_var_params['body'] body_params = local_var_params['body']
# HTTP header `Content-Type` # HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 header_params['Content-Type'] = local_var_params.get('_content_type',
['application/json', 'application/xml']) # noqa: E501 self.api_client.select_header_content_type(
['application/json', 'application/xml'],
'POST', body_params)) # noqa: E501
# Authentication setting # Authentication setting
auth_settings = ['petstore_auth'] # noqa: E501 auth_settings = ['petstore_auth'] # noqa: E501
@@ -228,6 +232,7 @@ class PetApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -246,7 +251,8 @@ class PetApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -360,6 +366,7 @@ class PetApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -377,7 +384,8 @@ class PetApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -497,6 +505,7 @@ class PetApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -514,7 +523,8 @@ class PetApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -634,6 +644,7 @@ class PetApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -651,7 +662,8 @@ class PetApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -769,6 +781,7 @@ class PetApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -786,7 +799,8 @@ class PetApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -818,8 +832,10 @@ class PetApi(object):
if 'body' in local_var_params: if 'body' in local_var_params:
body_params = local_var_params['body'] body_params = local_var_params['body']
# HTTP header `Content-Type` # HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 header_params['Content-Type'] = local_var_params.get('_content_type',
['application/json', 'application/xml']) # noqa: E501 self.api_client.select_header_content_type(
['application/json', 'application/xml'],
'PUT', body_params)) # noqa: E501
# Authentication setting # Authentication setting
auth_settings = ['petstore_auth'] # noqa: E501 auth_settings = ['petstore_auth'] # noqa: E501
@@ -908,6 +924,7 @@ class PetApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -927,7 +944,8 @@ class PetApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -963,8 +981,10 @@ class PetApi(object):
body_params = None body_params = None
# HTTP header `Content-Type` # HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 header_params['Content-Type'] = local_var_params.get('_content_type',
['application/x-www-form-urlencoded']) # noqa: E501 self.api_client.select_header_content_type(
['application/x-www-form-urlencoded'],
'POST', body_params)) # noqa: E501
# Authentication setting # Authentication setting
auth_settings = ['petstore_auth'] # noqa: E501 auth_settings = ['petstore_auth'] # noqa: E501
@@ -1053,6 +1073,7 @@ class PetApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -1072,7 +1093,8 @@ class PetApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -1112,8 +1134,10 @@ class PetApi(object):
['application/json']) # noqa: E501 ['application/json']) # noqa: E501
# HTTP header `Content-Type` # HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 header_params['Content-Type'] = local_var_params.get('_content_type',
['multipart/form-data']) # noqa: E501 self.api_client.select_header_content_type(
['multipart/form-data'],
'POST', body_params)) # noqa: E501
# Authentication setting # Authentication setting
auth_settings = ['petstore_auth'] # noqa: E501 auth_settings = ['petstore_auth'] # noqa: E501
@@ -1204,6 +1228,7 @@ class PetApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -1223,7 +1248,8 @@ class PetApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -1267,8 +1293,10 @@ class PetApi(object):
['application/json']) # noqa: E501 ['application/json']) # noqa: E501
# HTTP header `Content-Type` # HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 header_params['Content-Type'] = local_var_params.get('_content_type',
['multipart/form-data']) # noqa: E501 self.api_client.select_header_content_type(
['multipart/form-data'],
'POST', body_params)) # noqa: E501
# Authentication setting # Authentication setting
auth_settings = ['petstore_auth'] # noqa: E501 auth_settings = ['petstore_auth'] # noqa: E501

View File

@@ -95,6 +95,7 @@ class StoreApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -112,7 +113,8 @@ class StoreApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -220,6 +222,7 @@ class StoreApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -236,7 +239,8 @@ class StoreApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -348,6 +352,7 @@ class StoreApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -365,7 +370,8 @@ class StoreApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -487,6 +493,7 @@ class StoreApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -504,7 +511,8 @@ class StoreApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )

View File

@@ -95,6 +95,7 @@ class UserApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -112,7 +113,8 @@ class UserApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -222,6 +224,7 @@ class UserApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -239,7 +242,8 @@ class UserApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -349,6 +353,7 @@ class UserApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -366,7 +371,8 @@ class UserApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -478,6 +484,7 @@ class UserApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -495,7 +502,8 @@ class UserApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -605,6 +613,7 @@ class UserApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -622,7 +631,8 @@ class UserApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -744,6 +754,7 @@ class UserApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -762,7 +773,8 @@ class UserApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -881,6 +893,7 @@ class UserApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -897,7 +910,8 @@ class UserApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -1007,6 +1021,7 @@ class UserApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -1025,7 +1040,8 @@ class UserApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )

View File

@@ -522,10 +522,12 @@ class ApiClient(object):
else: else:
return ', '.join(accepts) return ', '.join(accepts)
def select_header_content_type(self, content_types): def select_header_content_type(self, content_types, method=None, body=None):
"""Returns `Content-Type` based on an array of content_types provided. """Returns `Content-Type` based on an array of content_types provided.
:param content_types: List of content-types. :param content_types: List of content-types.
:param method: http method (e.g. POST, PATCH).
:param body: http body to send.
:return: Content-Type (e.g. application/json). :return: Content-Type (e.g. application/json).
""" """
if not content_types: if not content_types:
@@ -533,6 +535,11 @@ class ApiClient(object):
content_types = [x.lower() for x in content_types] content_types = [x.lower() for x in content_types]
if (method == 'PATCH' and
'application/json-patch+json' in content_types and
isinstance(body, list)):
return 'application/json-patch+json'
if 'application/json' in content_types or '*/*' in content_types: if 'application/json' in content_types or '*/*' in content_types:
return 'application/json' return 'application/json'
else: else:

View File

@@ -95,6 +95,7 @@ class AnotherFakeApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -112,7 +113,8 @@ class AnotherFakeApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -148,8 +150,10 @@ class AnotherFakeApi(object):
['application/json']) # noqa: E501 ['application/json']) # noqa: E501
# HTTP header `Content-Type` # HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 header_params['Content-Type'] = local_var_params.get('_content_type',
['application/json']) # noqa: E501 self.api_client.select_header_content_type(
['application/json'],
'PATCH', body_params)) # noqa: E501
# Authentication setting # Authentication setting
auth_settings = [] # noqa: E501 auth_settings = [] # noqa: E501

View File

@@ -95,6 +95,7 @@ class FakeApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -112,7 +113,8 @@ class FakeApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -144,8 +146,10 @@ class FakeApi(object):
if 'xml_item' in local_var_params: if 'xml_item' in local_var_params:
body_params = local_var_params['xml_item'] body_params = local_var_params['xml_item']
# HTTP header `Content-Type` # HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 header_params['Content-Type'] = local_var_params.get('_content_type',
['application/xml', 'application/xml; charset=utf-8', 'application/xml; charset=utf-16', 'text/xml', 'text/xml; charset=utf-8', 'text/xml; charset=utf-16']) # noqa: E501 self.api_client.select_header_content_type(
['application/xml', 'application/xml; charset=utf-8', 'application/xml; charset=utf-16', 'text/xml', 'text/xml; charset=utf-8', 'text/xml; charset=utf-16'],
'POST', body_params)) # noqa: E501
# Authentication setting # Authentication setting
auth_settings = [] # noqa: E501 auth_settings = [] # noqa: E501
@@ -228,6 +232,7 @@ class FakeApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -245,7 +250,8 @@ class FakeApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -359,6 +365,7 @@ class FakeApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -376,7 +383,8 @@ class FakeApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -490,6 +498,7 @@ class FakeApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -507,7 +516,8 @@ class FakeApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -621,6 +631,7 @@ class FakeApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -638,7 +649,8 @@ class FakeApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -752,6 +764,7 @@ class FakeApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -769,7 +782,8 @@ class FakeApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -801,8 +815,10 @@ class FakeApi(object):
if 'body' in local_var_params: if 'body' in local_var_params:
body_params = local_var_params['body'] body_params = local_var_params['body']
# HTTP header `Content-Type` # HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 header_params['Content-Type'] = local_var_params.get('_content_type',
['application/json']) # noqa: E501 self.api_client.select_header_content_type(
['application/json'],
'PUT', body_params)) # noqa: E501
# Authentication setting # Authentication setting
auth_settings = [] # noqa: E501 auth_settings = [] # noqa: E501
@@ -887,6 +903,7 @@ class FakeApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -905,7 +922,8 @@ class FakeApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -943,8 +961,10 @@ class FakeApi(object):
if 'body' in local_var_params: if 'body' in local_var_params:
body_params = local_var_params['body'] body_params = local_var_params['body']
# HTTP header `Content-Type` # HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 header_params['Content-Type'] = local_var_params.get('_content_type',
['application/json']) # noqa: E501 self.api_client.select_header_content_type(
['application/json'],
'PUT', body_params)) # noqa: E501
# Authentication setting # Authentication setting
auth_settings = [] # noqa: E501 auth_settings = [] # noqa: E501
@@ -1027,6 +1047,7 @@ class FakeApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -1044,7 +1065,8 @@ class FakeApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -1080,8 +1102,10 @@ class FakeApi(object):
['application/json']) # noqa: E501 ['application/json']) # noqa: E501
# HTTP header `Content-Type` # HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 header_params['Content-Type'] = local_var_params.get('_content_type',
['application/json']) # noqa: E501 self.api_client.select_header_content_type(
['application/json'],
'PATCH', body_params)) # noqa: E501
# Authentication setting # Authentication setting
auth_settings = [] # noqa: E501 auth_settings = [] # noqa: E501
@@ -1218,6 +1242,7 @@ class FakeApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -1248,7 +1273,8 @@ class FakeApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -1346,8 +1372,10 @@ class FakeApi(object):
body_params = None body_params = None
# HTTP header `Content-Type` # HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 header_params['Content-Type'] = local_var_params.get('_content_type',
['application/x-www-form-urlencoded']) # noqa: E501 self.api_client.select_header_content_type(
['application/x-www-form-urlencoded'],
'POST', body_params)) # noqa: E501
# Authentication setting # Authentication setting
auth_settings = ['http_basic_test'] # noqa: E501 auth_settings = ['http_basic_test'] # noqa: E501
@@ -1458,6 +1486,7 @@ class FakeApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -1482,7 +1511,8 @@ class FakeApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -1527,8 +1557,10 @@ class FakeApi(object):
body_params = None body_params = None
# HTTP header `Content-Type` # HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 header_params['Content-Type'] = local_var_params.get('_content_type',
['application/x-www-form-urlencoded']) # noqa: E501 self.api_client.select_header_content_type(
['application/x-www-form-urlencoded'],
'GET', body_params)) # noqa: E501
# Authentication setting # Authentication setting
auth_settings = [] # noqa: E501 auth_settings = [] # noqa: E501
@@ -1631,6 +1663,7 @@ class FakeApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -1653,7 +1686,8 @@ class FakeApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -1781,6 +1815,7 @@ class FakeApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -1798,7 +1833,8 @@ class FakeApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -1830,8 +1866,10 @@ class FakeApi(object):
if 'param' in local_var_params: if 'param' in local_var_params:
body_params = local_var_params['param'] body_params = local_var_params['param']
# HTTP header `Content-Type` # HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 header_params['Content-Type'] = local_var_params.get('_content_type',
['application/json']) # noqa: E501 self.api_client.select_header_content_type(
['application/json'],
'POST', body_params)) # noqa: E501
# Authentication setting # Authentication setting
auth_settings = [] # noqa: E501 auth_settings = [] # noqa: E501
@@ -1916,6 +1954,7 @@ class FakeApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -1934,7 +1973,8 @@ class FakeApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -1972,8 +2012,10 @@ class FakeApi(object):
body_params = None body_params = None
# HTTP header `Content-Type` # HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 header_params['Content-Type'] = local_var_params.get('_content_type',
['application/x-www-form-urlencoded']) # noqa: E501 self.api_client.select_header_content_type(
['application/x-www-form-urlencoded'],
'GET', body_params)) # noqa: E501
# Authentication setting # Authentication setting
auth_settings = [] # noqa: E501 auth_settings = [] # noqa: E501
@@ -2072,6 +2114,7 @@ class FakeApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -2093,7 +2136,8 @@ class FakeApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )

View File

@@ -95,6 +95,7 @@ class FakeClassnameTags123Api(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -112,7 +113,8 @@ class FakeClassnameTags123Api(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -148,8 +150,10 @@ class FakeClassnameTags123Api(object):
['application/json']) # noqa: E501 ['application/json']) # noqa: E501
# HTTP header `Content-Type` # HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 header_params['Content-Type'] = local_var_params.get('_content_type',
['application/json']) # noqa: E501 self.api_client.select_header_content_type(
['application/json'],
'PATCH', body_params)) # noqa: E501
# Authentication setting # Authentication setting
auth_settings = ['api_key_query'] # noqa: E501 auth_settings = ['api_key_query'] # noqa: E501

View File

@@ -93,6 +93,7 @@ class PetApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -110,7 +111,8 @@ class PetApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -142,8 +144,10 @@ class PetApi(object):
if 'body' in local_var_params: if 'body' in local_var_params:
body_params = local_var_params['body'] body_params = local_var_params['body']
# HTTP header `Content-Type` # HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 header_params['Content-Type'] = local_var_params.get('_content_type',
['application/json', 'application/xml']) # noqa: E501 self.api_client.select_header_content_type(
['application/json', 'application/xml'],
'POST', body_params)) # noqa: E501
# Authentication setting # Authentication setting
auth_settings = ['petstore_auth'] # noqa: E501 auth_settings = ['petstore_auth'] # noqa: E501
@@ -228,6 +232,7 @@ class PetApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -246,7 +251,8 @@ class PetApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -360,6 +366,7 @@ class PetApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -377,7 +384,8 @@ class PetApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -497,6 +505,7 @@ class PetApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -514,7 +523,8 @@ class PetApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -634,6 +644,7 @@ class PetApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -651,7 +662,8 @@ class PetApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -769,6 +781,7 @@ class PetApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -786,7 +799,8 @@ class PetApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -818,8 +832,10 @@ class PetApi(object):
if 'body' in local_var_params: if 'body' in local_var_params:
body_params = local_var_params['body'] body_params = local_var_params['body']
# HTTP header `Content-Type` # HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 header_params['Content-Type'] = local_var_params.get('_content_type',
['application/json', 'application/xml']) # noqa: E501 self.api_client.select_header_content_type(
['application/json', 'application/xml'],
'PUT', body_params)) # noqa: E501
# Authentication setting # Authentication setting
auth_settings = ['petstore_auth'] # noqa: E501 auth_settings = ['petstore_auth'] # noqa: E501
@@ -908,6 +924,7 @@ class PetApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -927,7 +944,8 @@ class PetApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -963,8 +981,10 @@ class PetApi(object):
body_params = None body_params = None
# HTTP header `Content-Type` # HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 header_params['Content-Type'] = local_var_params.get('_content_type',
['application/x-www-form-urlencoded']) # noqa: E501 self.api_client.select_header_content_type(
['application/x-www-form-urlencoded'],
'POST', body_params)) # noqa: E501
# Authentication setting # Authentication setting
auth_settings = ['petstore_auth'] # noqa: E501 auth_settings = ['petstore_auth'] # noqa: E501
@@ -1053,6 +1073,7 @@ class PetApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -1072,7 +1093,8 @@ class PetApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -1112,8 +1134,10 @@ class PetApi(object):
['application/json']) # noqa: E501 ['application/json']) # noqa: E501
# HTTP header `Content-Type` # HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 header_params['Content-Type'] = local_var_params.get('_content_type',
['multipart/form-data']) # noqa: E501 self.api_client.select_header_content_type(
['multipart/form-data'],
'POST', body_params)) # noqa: E501
# Authentication setting # Authentication setting
auth_settings = ['petstore_auth'] # noqa: E501 auth_settings = ['petstore_auth'] # noqa: E501
@@ -1204,6 +1228,7 @@ class PetApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -1223,7 +1248,8 @@ class PetApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -1267,8 +1293,10 @@ class PetApi(object):
['application/json']) # noqa: E501 ['application/json']) # noqa: E501
# HTTP header `Content-Type` # HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 header_params['Content-Type'] = local_var_params.get('_content_type',
['multipart/form-data']) # noqa: E501 self.api_client.select_header_content_type(
['multipart/form-data'],
'POST', body_params)) # noqa: E501
# Authentication setting # Authentication setting
auth_settings = ['petstore_auth'] # noqa: E501 auth_settings = ['petstore_auth'] # noqa: E501

View File

@@ -95,6 +95,7 @@ class StoreApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -112,7 +113,8 @@ class StoreApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -220,6 +222,7 @@ class StoreApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -236,7 +239,8 @@ class StoreApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -348,6 +352,7 @@ class StoreApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -365,7 +370,8 @@ class StoreApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -487,6 +493,7 @@ class StoreApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -504,7 +511,8 @@ class StoreApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )

View File

@@ -95,6 +95,7 @@ class UserApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -112,7 +113,8 @@ class UserApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -222,6 +224,7 @@ class UserApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -239,7 +242,8 @@ class UserApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -349,6 +353,7 @@ class UserApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -366,7 +371,8 @@ class UserApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -478,6 +484,7 @@ class UserApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -495,7 +502,8 @@ class UserApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -605,6 +613,7 @@ class UserApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -622,7 +631,8 @@ class UserApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -744,6 +754,7 @@ class UserApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -762,7 +773,8 @@ class UserApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -881,6 +893,7 @@ class UserApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -897,7 +910,8 @@ class UserApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -1007,6 +1021,7 @@ class UserApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -1025,7 +1040,8 @@ class UserApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )

View File

@@ -521,10 +521,12 @@ class ApiClient(object):
else: else:
return ', '.join(accepts) return ', '.join(accepts)
def select_header_content_type(self, content_types): def select_header_content_type(self, content_types, method=None, body=None):
"""Returns `Content-Type` based on an array of content_types provided. """Returns `Content-Type` based on an array of content_types provided.
:param content_types: List of content-types. :param content_types: List of content-types.
:param method: http method (e.g. POST, PATCH).
:param body: http body to send.
:return: Content-Type (e.g. application/json). :return: Content-Type (e.g. application/json).
""" """
if not content_types: if not content_types:
@@ -532,6 +534,11 @@ class ApiClient(object):
content_types = [x.lower() for x in content_types] content_types = [x.lower() for x in content_types]
if (method == 'PATCH' and
'application/json-patch+json' in content_types and
isinstance(body, list)):
return 'application/json-patch+json'
if 'application/json' in content_types or '*/*' in content_types: if 'application/json' in content_types or '*/*' in content_types:
return 'application/json' return 'application/json'
else: else:

View File

@@ -98,6 +98,16 @@ class ApiClientTests(unittest.TestCase):
content_type = self.api_client.select_header_content_type(content_types) content_type = self.api_client.select_header_content_type(content_types)
self.assertEqual(content_type, 'application/json') self.assertEqual(content_type, 'application/json')
content_types = ['application/json-patch+json', 'application/json']
content_type = self.api_client.select_header_content_type(content_types,
'PATCH', [{ "op": "add", "path": "/myPath", "value": ["myValue"]}])
self.assertEqual(content_type, 'application/json-patch+json')
content_types = ['application/json-patch+json', 'application/json']
content_type = self.api_client.select_header_content_type(content_types,
'PATCH', {"value": ["myValue"]})
self.assertEqual(content_type, 'application/json')
def test_sanitize_for_serialization(self): def test_sanitize_for_serialization(self):
# None # None
data = None data = None

View File

@@ -13,6 +13,7 @@ $ nosetests -v
import os import os
import unittest import unittest
from unittest.mock import patch
import petstore_api import petstore_api
from petstore_api import Configuration from petstore_api import Configuration
@@ -293,5 +294,26 @@ class PetApiTests(unittest.TestCase):
except ApiException as e: except ApiException as e:
self.assertEqual(404, e.status) self.assertEqual(404, e.status)
@patch.object(petstore_api.ApiClient, 'call_api')
@patch.object(petstore_api.ApiClient, 'select_header_content_type')
def test_call_select_header_content_type(self, mock_select_ct, mock_call_api):
mock_select_ct.return_value = 'application/json'
self.pet_api.add_pet({'id': 1000, 'name': 'my pet'})
mock_select_ct.assert_called_once_with(
['application/json', 'application/xml'],
'POST',
{'id': 1000, 'name': 'my pet'})
mock_call_api.assert_called_once()
self.assertEqual(mock_call_api.mock_calls[0][1][4],
{'Content-Type': 'application/json'})
@patch.object(petstore_api.ApiClient, 'call_api')
def test_call_with_forced_content_type(self, mock_call_api):
mock_call_api.return_value = 'application/xml'
self.pet_api.add_pet('<mock></mock>', _content_type='application/xml')
mock_call_api.assert_called_once()
self.assertEqual(mock_call_api.mock_calls[0][1][4],
{'Content-Type': 'application/xml'})
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()

View File

@@ -95,6 +95,7 @@ class AnotherFakeApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -112,7 +113,8 @@ class AnotherFakeApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -148,8 +150,10 @@ class AnotherFakeApi(object):
['application/json']) # noqa: E501 ['application/json']) # noqa: E501
# HTTP header `Content-Type` # HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 header_params['Content-Type'] = local_var_params.get('_content_type',
['application/json']) # noqa: E501 self.api_client.select_header_content_type(
['application/json'],
'PATCH', body_params)) # noqa: E501
# Authentication setting # Authentication setting
auth_settings = [] # noqa: E501 auth_settings = [] # noqa: E501

View File

@@ -95,6 +95,7 @@ class FakeApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -112,7 +113,8 @@ class FakeApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -144,8 +146,10 @@ class FakeApi(object):
if 'xml_item' in local_var_params: if 'xml_item' in local_var_params:
body_params = local_var_params['xml_item'] body_params = local_var_params['xml_item']
# HTTP header `Content-Type` # HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 header_params['Content-Type'] = local_var_params.get('_content_type',
['application/xml', 'application/xml; charset=utf-8', 'application/xml; charset=utf-16', 'text/xml', 'text/xml; charset=utf-8', 'text/xml; charset=utf-16']) # noqa: E501 self.api_client.select_header_content_type(
['application/xml', 'application/xml; charset=utf-8', 'application/xml; charset=utf-16', 'text/xml', 'text/xml; charset=utf-8', 'text/xml; charset=utf-16'],
'POST', body_params)) # noqa: E501
# Authentication setting # Authentication setting
auth_settings = [] # noqa: E501 auth_settings = [] # noqa: E501
@@ -228,6 +232,7 @@ class FakeApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -245,7 +250,8 @@ class FakeApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -359,6 +365,7 @@ class FakeApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -376,7 +383,8 @@ class FakeApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -490,6 +498,7 @@ class FakeApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -507,7 +516,8 @@ class FakeApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -621,6 +631,7 @@ class FakeApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -638,7 +649,8 @@ class FakeApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -752,6 +764,7 @@ class FakeApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -769,7 +782,8 @@ class FakeApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -801,8 +815,10 @@ class FakeApi(object):
if 'body' in local_var_params: if 'body' in local_var_params:
body_params = local_var_params['body'] body_params = local_var_params['body']
# HTTP header `Content-Type` # HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 header_params['Content-Type'] = local_var_params.get('_content_type',
['application/json']) # noqa: E501 self.api_client.select_header_content_type(
['application/json'],
'PUT', body_params)) # noqa: E501
# Authentication setting # Authentication setting
auth_settings = [] # noqa: E501 auth_settings = [] # noqa: E501
@@ -887,6 +903,7 @@ class FakeApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -905,7 +922,8 @@ class FakeApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -943,8 +961,10 @@ class FakeApi(object):
if 'body' in local_var_params: if 'body' in local_var_params:
body_params = local_var_params['body'] body_params = local_var_params['body']
# HTTP header `Content-Type` # HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 header_params['Content-Type'] = local_var_params.get('_content_type',
['application/json']) # noqa: E501 self.api_client.select_header_content_type(
['application/json'],
'PUT', body_params)) # noqa: E501
# Authentication setting # Authentication setting
auth_settings = [] # noqa: E501 auth_settings = [] # noqa: E501
@@ -1027,6 +1047,7 @@ class FakeApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -1044,7 +1065,8 @@ class FakeApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -1080,8 +1102,10 @@ class FakeApi(object):
['application/json']) # noqa: E501 ['application/json']) # noqa: E501
# HTTP header `Content-Type` # HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 header_params['Content-Type'] = local_var_params.get('_content_type',
['application/json']) # noqa: E501 self.api_client.select_header_content_type(
['application/json'],
'PATCH', body_params)) # noqa: E501
# Authentication setting # Authentication setting
auth_settings = [] # noqa: E501 auth_settings = [] # noqa: E501
@@ -1218,6 +1242,7 @@ class FakeApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -1248,7 +1273,8 @@ class FakeApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -1346,8 +1372,10 @@ class FakeApi(object):
body_params = None body_params = None
# HTTP header `Content-Type` # HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 header_params['Content-Type'] = local_var_params.get('_content_type',
['application/x-www-form-urlencoded']) # noqa: E501 self.api_client.select_header_content_type(
['application/x-www-form-urlencoded'],
'POST', body_params)) # noqa: E501
# Authentication setting # Authentication setting
auth_settings = ['http_basic_test'] # noqa: E501 auth_settings = ['http_basic_test'] # noqa: E501
@@ -1458,6 +1486,7 @@ class FakeApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -1482,7 +1511,8 @@ class FakeApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -1527,8 +1557,10 @@ class FakeApi(object):
body_params = None body_params = None
# HTTP header `Content-Type` # HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 header_params['Content-Type'] = local_var_params.get('_content_type',
['application/x-www-form-urlencoded']) # noqa: E501 self.api_client.select_header_content_type(
['application/x-www-form-urlencoded'],
'GET', body_params)) # noqa: E501
# Authentication setting # Authentication setting
auth_settings = [] # noqa: E501 auth_settings = [] # noqa: E501
@@ -1631,6 +1663,7 @@ class FakeApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -1653,7 +1686,8 @@ class FakeApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -1781,6 +1815,7 @@ class FakeApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -1798,7 +1833,8 @@ class FakeApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -1830,8 +1866,10 @@ class FakeApi(object):
if 'param' in local_var_params: if 'param' in local_var_params:
body_params = local_var_params['param'] body_params = local_var_params['param']
# HTTP header `Content-Type` # HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 header_params['Content-Type'] = local_var_params.get('_content_type',
['application/json']) # noqa: E501 self.api_client.select_header_content_type(
['application/json'],
'POST', body_params)) # noqa: E501
# Authentication setting # Authentication setting
auth_settings = [] # noqa: E501 auth_settings = [] # noqa: E501
@@ -1916,6 +1954,7 @@ class FakeApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -1934,7 +1973,8 @@ class FakeApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -1972,8 +2012,10 @@ class FakeApi(object):
body_params = None body_params = None
# HTTP header `Content-Type` # HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 header_params['Content-Type'] = local_var_params.get('_content_type',
['application/x-www-form-urlencoded']) # noqa: E501 self.api_client.select_header_content_type(
['application/x-www-form-urlencoded'],
'GET', body_params)) # noqa: E501
# Authentication setting # Authentication setting
auth_settings = [] # noqa: E501 auth_settings = [] # noqa: E501
@@ -2072,6 +2114,7 @@ class FakeApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -2093,7 +2136,8 @@ class FakeApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )

View File

@@ -95,6 +95,7 @@ class FakeClassnameTags123Api(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -112,7 +113,8 @@ class FakeClassnameTags123Api(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -148,8 +150,10 @@ class FakeClassnameTags123Api(object):
['application/json']) # noqa: E501 ['application/json']) # noqa: E501
# HTTP header `Content-Type` # HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 header_params['Content-Type'] = local_var_params.get('_content_type',
['application/json']) # noqa: E501 self.api_client.select_header_content_type(
['application/json'],
'PATCH', body_params)) # noqa: E501
# Authentication setting # Authentication setting
auth_settings = ['api_key_query'] # noqa: E501 auth_settings = ['api_key_query'] # noqa: E501

View File

@@ -93,6 +93,7 @@ class PetApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -110,7 +111,8 @@ class PetApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -142,8 +144,10 @@ class PetApi(object):
if 'body' in local_var_params: if 'body' in local_var_params:
body_params = local_var_params['body'] body_params = local_var_params['body']
# HTTP header `Content-Type` # HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 header_params['Content-Type'] = local_var_params.get('_content_type',
['application/json', 'application/xml']) # noqa: E501 self.api_client.select_header_content_type(
['application/json', 'application/xml'],
'POST', body_params)) # noqa: E501
# Authentication setting # Authentication setting
auth_settings = ['petstore_auth'] # noqa: E501 auth_settings = ['petstore_auth'] # noqa: E501
@@ -228,6 +232,7 @@ class PetApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -246,7 +251,8 @@ class PetApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -360,6 +366,7 @@ class PetApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -377,7 +384,8 @@ class PetApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -497,6 +505,7 @@ class PetApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -514,7 +523,8 @@ class PetApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -634,6 +644,7 @@ class PetApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -651,7 +662,8 @@ class PetApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -769,6 +781,7 @@ class PetApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -786,7 +799,8 @@ class PetApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -818,8 +832,10 @@ class PetApi(object):
if 'body' in local_var_params: if 'body' in local_var_params:
body_params = local_var_params['body'] body_params = local_var_params['body']
# HTTP header `Content-Type` # HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 header_params['Content-Type'] = local_var_params.get('_content_type',
['application/json', 'application/xml']) # noqa: E501 self.api_client.select_header_content_type(
['application/json', 'application/xml'],
'PUT', body_params)) # noqa: E501
# Authentication setting # Authentication setting
auth_settings = ['petstore_auth'] # noqa: E501 auth_settings = ['petstore_auth'] # noqa: E501
@@ -908,6 +924,7 @@ class PetApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -927,7 +944,8 @@ class PetApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -963,8 +981,10 @@ class PetApi(object):
body_params = None body_params = None
# HTTP header `Content-Type` # HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 header_params['Content-Type'] = local_var_params.get('_content_type',
['application/x-www-form-urlencoded']) # noqa: E501 self.api_client.select_header_content_type(
['application/x-www-form-urlencoded'],
'POST', body_params)) # noqa: E501
# Authentication setting # Authentication setting
auth_settings = ['petstore_auth'] # noqa: E501 auth_settings = ['petstore_auth'] # noqa: E501
@@ -1053,6 +1073,7 @@ class PetApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -1072,7 +1093,8 @@ class PetApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -1112,8 +1134,10 @@ class PetApi(object):
['application/json']) # noqa: E501 ['application/json']) # noqa: E501
# HTTP header `Content-Type` # HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 header_params['Content-Type'] = local_var_params.get('_content_type',
['multipart/form-data']) # noqa: E501 self.api_client.select_header_content_type(
['multipart/form-data'],
'POST', body_params)) # noqa: E501
# Authentication setting # Authentication setting
auth_settings = ['petstore_auth'] # noqa: E501 auth_settings = ['petstore_auth'] # noqa: E501
@@ -1204,6 +1228,7 @@ class PetApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -1223,7 +1248,8 @@ class PetApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -1267,8 +1293,10 @@ class PetApi(object):
['application/json']) # noqa: E501 ['application/json']) # noqa: E501
# HTTP header `Content-Type` # HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 header_params['Content-Type'] = local_var_params.get('_content_type',
['multipart/form-data']) # noqa: E501 self.api_client.select_header_content_type(
['multipart/form-data'],
'POST', body_params)) # noqa: E501
# Authentication setting # Authentication setting
auth_settings = ['petstore_auth'] # noqa: E501 auth_settings = ['petstore_auth'] # noqa: E501

View File

@@ -95,6 +95,7 @@ class StoreApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -112,7 +113,8 @@ class StoreApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -220,6 +222,7 @@ class StoreApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -236,7 +239,8 @@ class StoreApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -348,6 +352,7 @@ class StoreApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -365,7 +370,8 @@ class StoreApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -487,6 +493,7 @@ class StoreApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -504,7 +511,8 @@ class StoreApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )

View File

@@ -95,6 +95,7 @@ class UserApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -112,7 +113,8 @@ class UserApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -222,6 +224,7 @@ class UserApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -239,7 +242,8 @@ class UserApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -349,6 +353,7 @@ class UserApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -366,7 +371,8 @@ class UserApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -478,6 +484,7 @@ class UserApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -495,7 +502,8 @@ class UserApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -605,6 +613,7 @@ class UserApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -622,7 +631,8 @@ class UserApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -744,6 +754,7 @@ class UserApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -762,7 +773,8 @@ class UserApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -881,6 +893,7 @@ class UserApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -897,7 +910,8 @@ class UserApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -1007,6 +1021,7 @@ class UserApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -1025,7 +1040,8 @@ class UserApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )

View File

@@ -523,10 +523,12 @@ class ApiClient(object):
else: else:
return ', '.join(accepts) return ', '.join(accepts)
def select_header_content_type(self, content_types): def select_header_content_type(self, content_types, method=None, body=None):
"""Returns `Content-Type` based on an array of content_types provided. """Returns `Content-Type` based on an array of content_types provided.
:param content_types: List of content-types. :param content_types: List of content-types.
:param method: http method (e.g. POST, PATCH).
:param body: http body to send.
:return: Content-Type (e.g. application/json). :return: Content-Type (e.g. application/json).
""" """
if not content_types: if not content_types:
@@ -534,6 +536,11 @@ class ApiClient(object):
content_types = [x.lower() for x in content_types] content_types = [x.lower() for x in content_types]
if (method == 'PATCH' and
'application/json-patch+json' in content_types and
isinstance(body, list)):
return 'application/json-patch+json'
if 'application/json' in content_types or '*/*' in content_types: if 'application/json' in content_types or '*/*' in content_types:
return 'application/json' return 'application/json'
else: else:

View File

@@ -95,6 +95,7 @@ class AnotherFakeApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -112,7 +113,8 @@ class AnotherFakeApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -148,8 +150,10 @@ class AnotherFakeApi(object):
['application/json']) # noqa: E501 ['application/json']) # noqa: E501
# HTTP header `Content-Type` # HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 header_params['Content-Type'] = local_var_params.get('_content_type',
['application/json']) # noqa: E501 self.api_client.select_header_content_type(
['application/json'],
'PATCH', body_params)) # noqa: E501
# Authentication setting # Authentication setting
auth_settings = [] # noqa: E501 auth_settings = [] # noqa: E501

View File

@@ -89,6 +89,7 @@ class DefaultApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -105,7 +106,8 @@ class DefaultApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )

View File

@@ -89,6 +89,7 @@ class FakeApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -105,7 +106,8 @@ class FakeApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -223,6 +225,7 @@ class FakeApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -242,7 +245,8 @@ class FakeApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -278,8 +282,10 @@ class FakeApi(object):
if 'pet' in local_var_params: if 'pet' in local_var_params:
body_params = local_var_params['pet'] body_params = local_var_params['pet']
# HTTP header `Content-Type` # HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 header_params['Content-Type'] = local_var_params.get('_content_type',
['application/json', 'application/xml']) # noqa: E501 self.api_client.select_header_content_type(
['application/json', 'application/xml'],
'GET', body_params)) # noqa: E501
# Authentication setting # Authentication setting
auth_settings = ['http_signature_test'] # noqa: E501 auth_settings = ['http_signature_test'] # noqa: E501
@@ -362,6 +368,7 @@ class FakeApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -379,7 +386,8 @@ class FakeApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -411,8 +419,10 @@ class FakeApi(object):
['*/*']) # noqa: E501 ['*/*']) # noqa: E501
# HTTP header `Content-Type` # HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 header_params['Content-Type'] = local_var_params.get('_content_type',
['application/json']) # noqa: E501 self.api_client.select_header_content_type(
['application/json'],
'POST', body_params)) # noqa: E501
# Authentication setting # Authentication setting
auth_settings = [] # noqa: E501 auth_settings = [] # noqa: E501
@@ -497,6 +507,7 @@ class FakeApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -514,7 +525,8 @@ class FakeApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -546,8 +558,10 @@ class FakeApi(object):
['*/*']) # noqa: E501 ['*/*']) # noqa: E501
# HTTP header `Content-Type` # HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 header_params['Content-Type'] = local_var_params.get('_content_type',
['application/json']) # noqa: E501 self.api_client.select_header_content_type(
['application/json'],
'POST', body_params)) # noqa: E501
# Authentication setting # Authentication setting
auth_settings = [] # noqa: E501 auth_settings = [] # noqa: E501
@@ -632,6 +646,7 @@ class FakeApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -649,7 +664,8 @@ class FakeApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -681,8 +697,10 @@ class FakeApi(object):
['*/*']) # noqa: E501 ['*/*']) # noqa: E501
# HTTP header `Content-Type` # HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 header_params['Content-Type'] = local_var_params.get('_content_type',
['application/json']) # noqa: E501 self.api_client.select_header_content_type(
['application/json'],
'POST', body_params)) # noqa: E501
# Authentication setting # Authentication setting
auth_settings = [] # noqa: E501 auth_settings = [] # noqa: E501
@@ -767,6 +785,7 @@ class FakeApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -784,7 +803,8 @@ class FakeApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -816,8 +836,10 @@ class FakeApi(object):
['*/*']) # noqa: E501 ['*/*']) # noqa: E501
# HTTP header `Content-Type` # HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 header_params['Content-Type'] = local_var_params.get('_content_type',
['application/json']) # noqa: E501 self.api_client.select_header_content_type(
['application/json'],
'POST', body_params)) # noqa: E501
# Authentication setting # Authentication setting
auth_settings = [] # noqa: E501 auth_settings = [] # noqa: E501
@@ -902,6 +924,7 @@ class FakeApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -919,7 +942,8 @@ class FakeApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -955,8 +979,10 @@ class FakeApi(object):
['*/*']) # noqa: E501 ['*/*']) # noqa: E501
# HTTP header `Content-Type` # HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 header_params['Content-Type'] = local_var_params.get('_content_type',
['application/json']) # noqa: E501 self.api_client.select_header_content_type(
['application/json'],
'POST', body_params)) # noqa: E501
# Authentication setting # Authentication setting
auth_settings = [] # noqa: E501 auth_settings = [] # noqa: E501
@@ -1041,6 +1067,7 @@ class FakeApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -1058,7 +1085,8 @@ class FakeApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -1086,8 +1114,10 @@ class FakeApi(object):
if 'body' in local_var_params: if 'body' in local_var_params:
body_params = local_var_params['body'] body_params = local_var_params['body']
# HTTP header `Content-Type` # HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 header_params['Content-Type'] = local_var_params.get('_content_type',
['image/png']) # noqa: E501 self.api_client.select_header_content_type(
['image/png'],
'PUT', body_params)) # noqa: E501
# Authentication setting # Authentication setting
auth_settings = [] # noqa: E501 auth_settings = [] # noqa: E501
@@ -1170,6 +1200,7 @@ class FakeApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -1187,7 +1218,8 @@ class FakeApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -1219,8 +1251,10 @@ class FakeApi(object):
if 'file_schema_test_class' in local_var_params: if 'file_schema_test_class' in local_var_params:
body_params = local_var_params['file_schema_test_class'] body_params = local_var_params['file_schema_test_class']
# HTTP header `Content-Type` # HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 header_params['Content-Type'] = local_var_params.get('_content_type',
['application/json']) # noqa: E501 self.api_client.select_header_content_type(
['application/json'],
'PUT', body_params)) # noqa: E501
# Authentication setting # Authentication setting
auth_settings = [] # noqa: E501 auth_settings = [] # noqa: E501
@@ -1305,6 +1339,7 @@ class FakeApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -1323,7 +1358,8 @@ class FakeApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -1361,8 +1397,10 @@ class FakeApi(object):
if 'user' in local_var_params: if 'user' in local_var_params:
body_params = local_var_params['user'] body_params = local_var_params['user']
# HTTP header `Content-Type` # HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 header_params['Content-Type'] = local_var_params.get('_content_type',
['application/json']) # noqa: E501 self.api_client.select_header_content_type(
['application/json'],
'PUT', body_params)) # noqa: E501
# Authentication setting # Authentication setting
auth_settings = [] # noqa: E501 auth_settings = [] # noqa: E501
@@ -1445,6 +1483,7 @@ class FakeApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -1462,7 +1501,8 @@ class FakeApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -1498,8 +1538,10 @@ class FakeApi(object):
['application/json']) # noqa: E501 ['application/json']) # noqa: E501
# HTTP header `Content-Type` # HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 header_params['Content-Type'] = local_var_params.get('_content_type',
['application/json']) # noqa: E501 self.api_client.select_header_content_type(
['application/json'],
'PATCH', body_params)) # noqa: E501
# Authentication setting # Authentication setting
auth_settings = [] # noqa: E501 auth_settings = [] # noqa: E501
@@ -1636,6 +1678,7 @@ class FakeApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -1666,7 +1709,8 @@ class FakeApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -1764,8 +1808,10 @@ class FakeApi(object):
body_params = None body_params = None
# HTTP header `Content-Type` # HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 header_params['Content-Type'] = local_var_params.get('_content_type',
['application/x-www-form-urlencoded']) # noqa: E501 self.api_client.select_header_content_type(
['application/x-www-form-urlencoded'],
'POST', body_params)) # noqa: E501
# Authentication setting # Authentication setting
auth_settings = ['http_basic_test'] # noqa: E501 auth_settings = ['http_basic_test'] # noqa: E501
@@ -1876,6 +1922,7 @@ class FakeApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -1900,7 +1947,8 @@ class FakeApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -1945,8 +1993,10 @@ class FakeApi(object):
body_params = None body_params = None
# HTTP header `Content-Type` # HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 header_params['Content-Type'] = local_var_params.get('_content_type',
['application/x-www-form-urlencoded']) # noqa: E501 self.api_client.select_header_content_type(
['application/x-www-form-urlencoded'],
'GET', body_params)) # noqa: E501
# Authentication setting # Authentication setting
auth_settings = [] # noqa: E501 auth_settings = [] # noqa: E501
@@ -2049,6 +2099,7 @@ class FakeApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -2071,7 +2122,8 @@ class FakeApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -2199,6 +2251,7 @@ class FakeApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -2216,7 +2269,8 @@ class FakeApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -2248,8 +2302,10 @@ class FakeApi(object):
if 'request_body' in local_var_params: if 'request_body' in local_var_params:
body_params = local_var_params['request_body'] body_params = local_var_params['request_body']
# HTTP header `Content-Type` # HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 header_params['Content-Type'] = local_var_params.get('_content_type',
['application/json']) # noqa: E501 self.api_client.select_header_content_type(
['application/json'],
'POST', body_params)) # noqa: E501
# Authentication setting # Authentication setting
auth_settings = [] # noqa: E501 auth_settings = [] # noqa: E501
@@ -2334,6 +2390,7 @@ class FakeApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -2352,7 +2409,8 @@ class FakeApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -2390,8 +2448,10 @@ class FakeApi(object):
body_params = None body_params = None
# HTTP header `Content-Type` # HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 header_params['Content-Type'] = local_var_params.get('_content_type',
['application/x-www-form-urlencoded']) # noqa: E501 self.api_client.select_header_content_type(
['application/x-www-form-urlencoded'],
'GET', body_params)) # noqa: E501
# Authentication setting # Authentication setting
auth_settings = [] # noqa: E501 auth_settings = [] # noqa: E501
@@ -2498,6 +2558,7 @@ class FakeApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -2521,7 +2582,8 @@ class FakeApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )

View File

@@ -95,6 +95,7 @@ class FakeClassnameTags123Api(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -112,7 +113,8 @@ class FakeClassnameTags123Api(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -148,8 +150,10 @@ class FakeClassnameTags123Api(object):
['application/json']) # noqa: E501 ['application/json']) # noqa: E501
# HTTP header `Content-Type` # HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 header_params['Content-Type'] = local_var_params.get('_content_type',
['application/json']) # noqa: E501 self.api_client.select_header_content_type(
['application/json'],
'PATCH', body_params)) # noqa: E501
# Authentication setting # Authentication setting
auth_settings = ['api_key_query'] # noqa: E501 auth_settings = ['api_key_query'] # noqa: E501

View File

@@ -93,6 +93,7 @@ class PetApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -123,7 +124,8 @@ class PetApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -155,8 +157,10 @@ class PetApi(object):
if 'pet' in local_var_params: if 'pet' in local_var_params:
body_params = local_var_params['pet'] body_params = local_var_params['pet']
# HTTP header `Content-Type` # HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 header_params['Content-Type'] = local_var_params.get('_content_type',
['application/json', 'application/xml']) # noqa: E501 self.api_client.select_header_content_type(
['application/json', 'application/xml'],
'POST', body_params)) # noqa: E501
# Authentication setting # Authentication setting
auth_settings = ['petstore_auth'] # noqa: E501 auth_settings = ['petstore_auth'] # noqa: E501
@@ -242,6 +246,7 @@ class PetApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -260,7 +265,8 @@ class PetApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -374,6 +380,7 @@ class PetApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -391,7 +398,8 @@ class PetApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -511,6 +519,7 @@ class PetApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -528,7 +537,8 @@ class PetApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -648,6 +658,7 @@ class PetApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -665,7 +676,8 @@ class PetApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -783,6 +795,7 @@ class PetApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -813,7 +826,8 @@ class PetApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -845,8 +859,10 @@ class PetApi(object):
if 'pet' in local_var_params: if 'pet' in local_var_params:
body_params = local_var_params['pet'] body_params = local_var_params['pet']
# HTTP header `Content-Type` # HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 header_params['Content-Type'] = local_var_params.get('_content_type',
['application/json', 'application/xml']) # noqa: E501 self.api_client.select_header_content_type(
['application/json', 'application/xml'],
'PUT', body_params)) # noqa: E501
# Authentication setting # Authentication setting
auth_settings = ['petstore_auth'] # noqa: E501 auth_settings = ['petstore_auth'] # noqa: E501
@@ -936,6 +952,7 @@ class PetApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -955,7 +972,8 @@ class PetApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -991,8 +1009,10 @@ class PetApi(object):
body_params = None body_params = None
# HTTP header `Content-Type` # HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 header_params['Content-Type'] = local_var_params.get('_content_type',
['application/x-www-form-urlencoded']) # noqa: E501 self.api_client.select_header_content_type(
['application/x-www-form-urlencoded'],
'POST', body_params)) # noqa: E501
# Authentication setting # Authentication setting
auth_settings = ['petstore_auth'] # noqa: E501 auth_settings = ['petstore_auth'] # noqa: E501
@@ -1081,6 +1101,7 @@ class PetApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -1100,7 +1121,8 @@ class PetApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -1140,8 +1162,10 @@ class PetApi(object):
['application/json']) # noqa: E501 ['application/json']) # noqa: E501
# HTTP header `Content-Type` # HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 header_params['Content-Type'] = local_var_params.get('_content_type',
['multipart/form-data']) # noqa: E501 self.api_client.select_header_content_type(
['multipart/form-data'],
'POST', body_params)) # noqa: E501
# Authentication setting # Authentication setting
auth_settings = ['petstore_auth'] # noqa: E501 auth_settings = ['petstore_auth'] # noqa: E501
@@ -1232,6 +1256,7 @@ class PetApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -1251,7 +1276,8 @@ class PetApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -1295,8 +1321,10 @@ class PetApi(object):
['application/json']) # noqa: E501 ['application/json']) # noqa: E501
# HTTP header `Content-Type` # HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 header_params['Content-Type'] = local_var_params.get('_content_type',
['multipart/form-data']) # noqa: E501 self.api_client.select_header_content_type(
['multipart/form-data'],
'POST', body_params)) # noqa: E501
# Authentication setting # Authentication setting
auth_settings = ['petstore_auth'] # noqa: E501 auth_settings = ['petstore_auth'] # noqa: E501

View File

@@ -95,6 +95,7 @@ class StoreApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -112,7 +113,8 @@ class StoreApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -220,6 +222,7 @@ class StoreApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -236,7 +239,8 @@ class StoreApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -348,6 +352,7 @@ class StoreApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -365,7 +370,8 @@ class StoreApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -487,6 +493,7 @@ class StoreApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -504,7 +511,8 @@ class StoreApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -540,8 +548,10 @@ class StoreApi(object):
['application/xml', 'application/json']) # noqa: E501 ['application/xml', 'application/json']) # noqa: E501
# HTTP header `Content-Type` # HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 header_params['Content-Type'] = local_var_params.get('_content_type',
['application/json']) # noqa: E501 self.api_client.select_header_content_type(
['application/json'],
'POST', body_params)) # noqa: E501
# Authentication setting # Authentication setting
auth_settings = [] # noqa: E501 auth_settings = [] # noqa: E501

View File

@@ -95,6 +95,7 @@ class UserApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -112,7 +113,8 @@ class UserApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -144,8 +146,10 @@ class UserApi(object):
if 'user' in local_var_params: if 'user' in local_var_params:
body_params = local_var_params['user'] body_params = local_var_params['user']
# HTTP header `Content-Type` # HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 header_params['Content-Type'] = local_var_params.get('_content_type',
['application/json']) # noqa: E501 self.api_client.select_header_content_type(
['application/json'],
'POST', body_params)) # noqa: E501
# Authentication setting # Authentication setting
auth_settings = [] # noqa: E501 auth_settings = [] # noqa: E501
@@ -226,6 +230,7 @@ class UserApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -243,7 +248,8 @@ class UserApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -275,8 +281,10 @@ class UserApi(object):
if 'user' in local_var_params: if 'user' in local_var_params:
body_params = local_var_params['user'] body_params = local_var_params['user']
# HTTP header `Content-Type` # HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 header_params['Content-Type'] = local_var_params.get('_content_type',
['application/json']) # noqa: E501 self.api_client.select_header_content_type(
['application/json'],
'POST', body_params)) # noqa: E501
# Authentication setting # Authentication setting
auth_settings = [] # noqa: E501 auth_settings = [] # noqa: E501
@@ -357,6 +365,7 @@ class UserApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -374,7 +383,8 @@ class UserApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -406,8 +416,10 @@ class UserApi(object):
if 'user' in local_var_params: if 'user' in local_var_params:
body_params = local_var_params['user'] body_params = local_var_params['user']
# HTTP header `Content-Type` # HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 header_params['Content-Type'] = local_var_params.get('_content_type',
['application/json']) # noqa: E501 self.api_client.select_header_content_type(
['application/json'],
'POST', body_params)) # noqa: E501
# Authentication setting # Authentication setting
auth_settings = [] # noqa: E501 auth_settings = [] # noqa: E501
@@ -490,6 +502,7 @@ class UserApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -507,7 +520,8 @@ class UserApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -617,6 +631,7 @@ class UserApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -634,7 +649,8 @@ class UserApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -756,6 +772,7 @@ class UserApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -774,7 +791,8 @@ class UserApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -893,6 +911,7 @@ class UserApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -909,7 +928,8 @@ class UserApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -1019,6 +1039,7 @@ class UserApi(object):
request; this effectively ignores the authentication request; this effectively ignores the authentication
in the spec for a single request. in the spec for a single request.
:type _request_auth: dict, optional :type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object. :return: Returns the result object.
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
@@ -1037,7 +1058,8 @@ class UserApi(object):
'_return_http_data_only', '_return_http_data_only',
'_preload_content', '_preload_content',
'_request_timeout', '_request_timeout',
'_request_auth' '_request_auth',
'_content_type'
] ]
) )
@@ -1075,8 +1097,10 @@ class UserApi(object):
if 'user' in local_var_params: if 'user' in local_var_params:
body_params = local_var_params['user'] body_params = local_var_params['user']
# HTTP header `Content-Type` # HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 header_params['Content-Type'] = local_var_params.get('_content_type',
['application/json']) # noqa: E501 self.api_client.select_header_content_type(
['application/json'],
'PUT', body_params)) # noqa: E501
# Authentication setting # Authentication setting
auth_settings = [] # noqa: E501 auth_settings = [] # noqa: E501

View File

@@ -521,10 +521,12 @@ class ApiClient(object):
else: else:
return ', '.join(accepts) return ', '.join(accepts)
def select_header_content_type(self, content_types): def select_header_content_type(self, content_types, method=None, body=None):
"""Returns `Content-Type` based on an array of content_types provided. """Returns `Content-Type` based on an array of content_types provided.
:param content_types: List of content-types. :param content_types: List of content-types.
:param method: http method (e.g. POST, PATCH).
:param body: http body to send.
:return: Content-Type (e.g. application/json). :return: Content-Type (e.g. application/json).
""" """
if not content_types: if not content_types:
@@ -532,6 +534,11 @@ class ApiClient(object):
content_types = [x.lower() for x in content_types] content_types = [x.lower() for x in content_types]
if (method == 'PATCH' and
'application/json-patch+json' in content_types and
isinstance(body, list)):
return 'application/json-patch+json'
if 'application/json' in content_types or '*/*' in content_types: if 'application/json' in content_types or '*/*' in content_types:
return 'application/json' return 'application/json'
else: else: