[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

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -521,10 +521,12 @@ class ApiClient(object):
else:
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.
: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).
"""
if not content_types:
@@ -532,6 +534,11 @@ class ApiClient(object):
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:
return 'application/json'
else: