forked from loafle/openapi-generator-original
updated api.mustache of python.
This commit is contained in:
parent
a30f537f5f
commit
ddc5293e6a
@ -71,7 +71,6 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
|
|||||||
supportingFiles.add(new SupportingFile("setup.mustache", eggPackage, "setup.py"));
|
supportingFiles.add(new SupportingFile("setup.mustache", eggPackage, "setup.py"));
|
||||||
supportingFiles.add(new SupportingFile("api_client.mustache", invokerPackage, "api_client.py"));
|
supportingFiles.add(new SupportingFile("api_client.mustache", invokerPackage, "api_client.py"));
|
||||||
supportingFiles.add(new SupportingFile("rest.mustache", invokerPackage, "rest.py"));
|
supportingFiles.add(new SupportingFile("rest.mustache", invokerPackage, "rest.py"));
|
||||||
supportingFiles.add(new SupportingFile("util.mustache", invokerPackage, "util.py"));
|
|
||||||
supportingFiles.add(new SupportingFile("configuration.mustache", invokerPackage, "configuration.py"));
|
supportingFiles.add(new SupportingFile("configuration.mustache", invokerPackage, "configuration.py"));
|
||||||
supportingFiles.add(new SupportingFile("__init__package.mustache", invokerPackage, "__init__.py"));
|
supportingFiles.add(new SupportingFile("__init__package.mustache", invokerPackage, "__init__.py"));
|
||||||
supportingFiles.add(new SupportingFile("__init__model.mustache", modelPackage, "__init__.py"));
|
supportingFiles.add(new SupportingFile("__init__model.mustache", modelPackage, "__init__.py"));
|
||||||
|
@ -27,8 +27,6 @@ import os
|
|||||||
# python 2 and python 3 compatibility library
|
# python 2 and python 3 compatibility library
|
||||||
from six import iteritems
|
from six import iteritems
|
||||||
|
|
||||||
from ..util import remove_none
|
|
||||||
|
|
||||||
from ..api_client import ApiClient
|
from ..api_client import ApiClient
|
||||||
|
|
||||||
{{#operations}}
|
{{#operations}}
|
||||||
@ -66,13 +64,32 @@ class {{classname}}(object):
|
|||||||
resource_path = '{{path}}'.replace('{format}', 'json')
|
resource_path = '{{path}}'.replace('{format}', 'json')
|
||||||
method = '{{httpMethod}}'
|
method = '{{httpMethod}}'
|
||||||
|
|
||||||
path_params = remove_none(dict({{#pathParams}}{{baseName}}=params.get('{{paramName}}'){{#hasMore}}, {{/hasMore}}{{/pathParams}}))
|
path_params = {}
|
||||||
query_params = remove_none(dict({{#queryParams}}{{baseName}}=params.get('{{paramName}}'){{#hasMore}}, {{/hasMore}}{{/queryParams}}))
|
{{#pathParams}}
|
||||||
header_params = remove_none(dict({{#headerParams}}{{baseName}}=params.get('{{paramName}}'){{#hasMore}}, {{/hasMore}}{{/headerParams}}))
|
if '{{paramName}}' in params:
|
||||||
form_params = remove_none(dict({{#formParams}}{{^isFile}}{{baseName}}=params.get('{{paramName}}'){{#hasMore}}, {{/hasMore}}{{/isFile}}{{/formParams}}))
|
path_params['{{baseName}}'] = params['{{paramName}}']
|
||||||
files = remove_none(dict({{#formParams}}{{#isFile}}{{baseName}}=params.get('{{paramName}}'){{#hasMore}}, {{/hasMore}}{{/isFile}}{{/formParams}}))
|
{{/pathParams}}
|
||||||
body_params = {{#bodyParam}}params.get('{{paramName}}'){{/bodyParam}}{{^bodyParam}}None{{/bodyParam}}
|
query_params = {}
|
||||||
|
{{#queryParams}}
|
||||||
|
if '{{paramName}}' in params:
|
||||||
|
query_params['{{baseName}}'] = params['{{paramName}}']
|
||||||
|
{{/queryParams}}
|
||||||
|
header_params = {}
|
||||||
|
{{#headerParams}}
|
||||||
|
if '{{paramName}}' in params:
|
||||||
|
header_params['{{baseName}}'] = params['{{paramName}}']
|
||||||
|
{{/headerParams}}
|
||||||
|
form_params = {}
|
||||||
|
files = {}
|
||||||
|
{{#formParams}}
|
||||||
|
if '{{paramName}}' in params:
|
||||||
|
{{#notFile}}form_params['{{baseName}}'] = params['{{paramName}}']{{/notFile}}{{#isFile}}files['{{baseName}}'] = params['{{paramName}}']{{/isFile}}
|
||||||
|
{{/formParams}}
|
||||||
|
body_params = None
|
||||||
|
{{#bodyParam}}
|
||||||
|
if '{{paramName}}' in params:
|
||||||
|
body_params = params['{{paramName}}']
|
||||||
|
{{/bodyParam}}
|
||||||
# HTTP header `Accept`
|
# HTTP header `Accept`
|
||||||
header_params['Accept'] = self.api_client.select_header_accept([{{#produces}}'{{mediaType}}'{{#hasMore}}, {{/hasMore}}{{/produces}}])
|
header_params['Accept'] = self.api_client.select_header_accept([{{#produces}}'{{mediaType}}'{{#hasMore}}, {{/hasMore}}{{/produces}}])
|
||||||
if not header_params['Accept']:
|
if not header_params['Accept']:
|
||||||
|
@ -248,6 +248,7 @@ class ApiClient(object):
|
|||||||
|
|
||||||
if files:
|
if files:
|
||||||
for k, v in iteritems(files):
|
for k, v in iteritems(files):
|
||||||
|
if v:
|
||||||
with open(v, 'rb') as f:
|
with open(v, 'rb') as f:
|
||||||
filename = os.path.basename(f.name)
|
filename = os.path.basename(f.name)
|
||||||
filedata = f.read()
|
filedata = f.read()
|
||||||
|
@ -1,16 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
from six import iteritems
|
|
||||||
|
|
||||||
def remove_none(obj):
|
|
||||||
"""
|
|
||||||
Remove None from `list`, `tuple`, `set`.
|
|
||||||
Remove None value from `dict`.
|
|
||||||
"""
|
|
||||||
if isinstance(obj, (list, tuple, set)):
|
|
||||||
return type(obj)(remove_none(x) for x in obj if x is not None)
|
|
||||||
elif isinstance(obj, dict):
|
|
||||||
return type(obj)((remove_none(k), remove_none(v))
|
|
||||||
for k, v in iteritems(obj) if k is not None and v is not None)
|
|
||||||
else:
|
|
||||||
return obj
|
|
@ -248,6 +248,7 @@ class ApiClient(object):
|
|||||||
|
|
||||||
if files:
|
if files:
|
||||||
for k, v in iteritems(files):
|
for k, v in iteritems(files):
|
||||||
|
if v:
|
||||||
with open(v, 'rb') as f:
|
with open(v, 'rb') as f:
|
||||||
filename = os.path.basename(f.name)
|
filename = os.path.basename(f.name)
|
||||||
filedata = f.read()
|
filedata = f.read()
|
||||||
|
@ -27,8 +27,6 @@ import os
|
|||||||
# python 2 and python 3 compatibility library
|
# python 2 and python 3 compatibility library
|
||||||
from six import iteritems
|
from six import iteritems
|
||||||
|
|
||||||
from ..util import remove_none
|
|
||||||
|
|
||||||
from ..api_client import ApiClient
|
from ..api_client import ApiClient
|
||||||
|
|
||||||
class PetApi(object):
|
class PetApi(object):
|
||||||
@ -61,12 +59,19 @@ class PetApi(object):
|
|||||||
resource_path = '/pet'.replace('{format}', 'json')
|
resource_path = '/pet'.replace('{format}', 'json')
|
||||||
method = 'PUT'
|
method = 'PUT'
|
||||||
|
|
||||||
path_params = remove_none(dict())
|
path_params = {}
|
||||||
query_params = remove_none(dict())
|
|
||||||
header_params = remove_none(dict())
|
query_params = {}
|
||||||
form_params = remove_none(dict())
|
|
||||||
files = remove_none(dict())
|
header_params = {}
|
||||||
body_params = params.get('body')
|
|
||||||
|
form_params = {}
|
||||||
|
files = {}
|
||||||
|
|
||||||
|
body_params = None
|
||||||
|
|
||||||
|
if 'body' in params:
|
||||||
|
body_params = params['body']
|
||||||
|
|
||||||
# HTTP header `Accept`
|
# HTTP header `Accept`
|
||||||
header_params['Accept'] = self.api_client.select_header_accept(['application/json', 'application/xml'])
|
header_params['Accept'] = self.api_client.select_header_accept(['application/json', 'application/xml'])
|
||||||
@ -105,12 +110,19 @@ class PetApi(object):
|
|||||||
resource_path = '/pet'.replace('{format}', 'json')
|
resource_path = '/pet'.replace('{format}', 'json')
|
||||||
method = 'POST'
|
method = 'POST'
|
||||||
|
|
||||||
path_params = remove_none(dict())
|
path_params = {}
|
||||||
query_params = remove_none(dict())
|
|
||||||
header_params = remove_none(dict())
|
query_params = {}
|
||||||
form_params = remove_none(dict())
|
|
||||||
files = remove_none(dict())
|
header_params = {}
|
||||||
body_params = params.get('body')
|
|
||||||
|
form_params = {}
|
||||||
|
files = {}
|
||||||
|
|
||||||
|
body_params = None
|
||||||
|
|
||||||
|
if 'body' in params:
|
||||||
|
body_params = params['body']
|
||||||
|
|
||||||
# HTTP header `Accept`
|
# HTTP header `Accept`
|
||||||
header_params['Accept'] = self.api_client.select_header_accept(['application/json', 'application/xml'])
|
header_params['Accept'] = self.api_client.select_header_accept(['application/json', 'application/xml'])
|
||||||
@ -149,11 +161,18 @@ class PetApi(object):
|
|||||||
resource_path = '/pet/findByStatus'.replace('{format}', 'json')
|
resource_path = '/pet/findByStatus'.replace('{format}', 'json')
|
||||||
method = 'GET'
|
method = 'GET'
|
||||||
|
|
||||||
path_params = remove_none(dict())
|
path_params = {}
|
||||||
query_params = remove_none(dict(status=params.get('status')))
|
|
||||||
header_params = remove_none(dict())
|
query_params = {}
|
||||||
form_params = remove_none(dict())
|
|
||||||
files = remove_none(dict())
|
if 'status' in params:
|
||||||
|
query_params['status'] = params['status']
|
||||||
|
|
||||||
|
header_params = {}
|
||||||
|
|
||||||
|
form_params = {}
|
||||||
|
files = {}
|
||||||
|
|
||||||
body_params = None
|
body_params = None
|
||||||
|
|
||||||
# HTTP header `Accept`
|
# HTTP header `Accept`
|
||||||
@ -195,11 +214,18 @@ class PetApi(object):
|
|||||||
resource_path = '/pet/findByTags'.replace('{format}', 'json')
|
resource_path = '/pet/findByTags'.replace('{format}', 'json')
|
||||||
method = 'GET'
|
method = 'GET'
|
||||||
|
|
||||||
path_params = remove_none(dict())
|
path_params = {}
|
||||||
query_params = remove_none(dict(tags=params.get('tags')))
|
|
||||||
header_params = remove_none(dict())
|
query_params = {}
|
||||||
form_params = remove_none(dict())
|
|
||||||
files = remove_none(dict())
|
if 'tags' in params:
|
||||||
|
query_params['tags'] = params['tags']
|
||||||
|
|
||||||
|
header_params = {}
|
||||||
|
|
||||||
|
form_params = {}
|
||||||
|
files = {}
|
||||||
|
|
||||||
body_params = None
|
body_params = None
|
||||||
|
|
||||||
# HTTP header `Accept`
|
# HTTP header `Accept`
|
||||||
@ -245,11 +271,18 @@ class PetApi(object):
|
|||||||
resource_path = '/pet/{petId}'.replace('{format}', 'json')
|
resource_path = '/pet/{petId}'.replace('{format}', 'json')
|
||||||
method = 'GET'
|
method = 'GET'
|
||||||
|
|
||||||
path_params = remove_none(dict(petId=params.get('pet_id')))
|
path_params = {}
|
||||||
query_params = remove_none(dict())
|
|
||||||
header_params = remove_none(dict())
|
if 'pet_id' in params:
|
||||||
form_params = remove_none(dict())
|
path_params['petId'] = params['pet_id']
|
||||||
files = remove_none(dict())
|
|
||||||
|
query_params = {}
|
||||||
|
|
||||||
|
header_params = {}
|
||||||
|
|
||||||
|
form_params = {}
|
||||||
|
files = {}
|
||||||
|
|
||||||
body_params = None
|
body_params = None
|
||||||
|
|
||||||
# HTTP header `Accept`
|
# HTTP header `Accept`
|
||||||
@ -297,11 +330,24 @@ class PetApi(object):
|
|||||||
resource_path = '/pet/{petId}'.replace('{format}', 'json')
|
resource_path = '/pet/{petId}'.replace('{format}', 'json')
|
||||||
method = 'POST'
|
method = 'POST'
|
||||||
|
|
||||||
path_params = remove_none(dict(petId=params.get('pet_id')))
|
path_params = {}
|
||||||
query_params = remove_none(dict())
|
|
||||||
header_params = remove_none(dict())
|
if 'pet_id' in params:
|
||||||
form_params = remove_none(dict(name=params.get('name'), status=params.get('status')))
|
path_params['petId'] = params['pet_id']
|
||||||
files = remove_none(dict())
|
|
||||||
|
query_params = {}
|
||||||
|
|
||||||
|
header_params = {}
|
||||||
|
|
||||||
|
form_params = {}
|
||||||
|
files = {}
|
||||||
|
|
||||||
|
if 'name' in params:
|
||||||
|
form_params['name'] = params['name']
|
||||||
|
|
||||||
|
if 'status' in params:
|
||||||
|
form_params['status'] = params['status']
|
||||||
|
|
||||||
body_params = None
|
body_params = None
|
||||||
|
|
||||||
# HTTP header `Accept`
|
# HTTP header `Accept`
|
||||||
@ -346,11 +392,21 @@ class PetApi(object):
|
|||||||
resource_path = '/pet/{petId}'.replace('{format}', 'json')
|
resource_path = '/pet/{petId}'.replace('{format}', 'json')
|
||||||
method = 'DELETE'
|
method = 'DELETE'
|
||||||
|
|
||||||
path_params = remove_none(dict(petId=params.get('pet_id')))
|
path_params = {}
|
||||||
query_params = remove_none(dict())
|
|
||||||
header_params = remove_none(dict(api_key=params.get('api_key')))
|
if 'pet_id' in params:
|
||||||
form_params = remove_none(dict())
|
path_params['petId'] = params['pet_id']
|
||||||
files = remove_none(dict())
|
|
||||||
|
query_params = {}
|
||||||
|
|
||||||
|
header_params = {}
|
||||||
|
|
||||||
|
if 'api_key' in params:
|
||||||
|
header_params['api_key'] = params['api_key']
|
||||||
|
|
||||||
|
form_params = {}
|
||||||
|
files = {}
|
||||||
|
|
||||||
body_params = None
|
body_params = None
|
||||||
|
|
||||||
# HTTP header `Accept`
|
# HTTP header `Accept`
|
||||||
@ -396,11 +452,24 @@ class PetApi(object):
|
|||||||
resource_path = '/pet/{petId}/uploadImage'.replace('{format}', 'json')
|
resource_path = '/pet/{petId}/uploadImage'.replace('{format}', 'json')
|
||||||
method = 'POST'
|
method = 'POST'
|
||||||
|
|
||||||
path_params = remove_none(dict(petId=params.get('pet_id')))
|
path_params = {}
|
||||||
query_params = remove_none(dict())
|
|
||||||
header_params = remove_none(dict())
|
if 'pet_id' in params:
|
||||||
form_params = remove_none(dict(additionalMetadata=params.get('additional_metadata'), ))
|
path_params['petId'] = params['pet_id']
|
||||||
files = remove_none(dict(file=params.get('file')))
|
|
||||||
|
query_params = {}
|
||||||
|
|
||||||
|
header_params = {}
|
||||||
|
|
||||||
|
form_params = {}
|
||||||
|
files = {}
|
||||||
|
|
||||||
|
if 'additional_metadata' in params:
|
||||||
|
form_params['additionalMetadata'] = params['additional_metadata']
|
||||||
|
|
||||||
|
if 'file' in params:
|
||||||
|
files['file'] = params['file']
|
||||||
|
|
||||||
body_params = None
|
body_params = None
|
||||||
|
|
||||||
# HTTP header `Accept`
|
# HTTP header `Accept`
|
||||||
@ -427,3 +496,6 @@ class PetApi(object):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -27,8 +27,6 @@ import os
|
|||||||
# python 2 and python 3 compatibility library
|
# python 2 and python 3 compatibility library
|
||||||
from six import iteritems
|
from six import iteritems
|
||||||
|
|
||||||
from ..util import remove_none
|
|
||||||
|
|
||||||
from ..api_client import ApiClient
|
from ..api_client import ApiClient
|
||||||
|
|
||||||
class StoreApi(object):
|
class StoreApi(object):
|
||||||
@ -60,11 +58,15 @@ class StoreApi(object):
|
|||||||
resource_path = '/store/inventory'.replace('{format}', 'json')
|
resource_path = '/store/inventory'.replace('{format}', 'json')
|
||||||
method = 'GET'
|
method = 'GET'
|
||||||
|
|
||||||
path_params = remove_none(dict())
|
path_params = {}
|
||||||
query_params = remove_none(dict())
|
|
||||||
header_params = remove_none(dict())
|
query_params = {}
|
||||||
form_params = remove_none(dict())
|
|
||||||
files = remove_none(dict())
|
header_params = {}
|
||||||
|
|
||||||
|
form_params = {}
|
||||||
|
files = {}
|
||||||
|
|
||||||
body_params = None
|
body_params = None
|
||||||
|
|
||||||
# HTTP header `Accept`
|
# HTTP header `Accept`
|
||||||
@ -106,12 +108,19 @@ class StoreApi(object):
|
|||||||
resource_path = '/store/order'.replace('{format}', 'json')
|
resource_path = '/store/order'.replace('{format}', 'json')
|
||||||
method = 'POST'
|
method = 'POST'
|
||||||
|
|
||||||
path_params = remove_none(dict())
|
path_params = {}
|
||||||
query_params = remove_none(dict())
|
|
||||||
header_params = remove_none(dict())
|
query_params = {}
|
||||||
form_params = remove_none(dict())
|
|
||||||
files = remove_none(dict())
|
header_params = {}
|
||||||
body_params = params.get('body')
|
|
||||||
|
form_params = {}
|
||||||
|
files = {}
|
||||||
|
|
||||||
|
body_params = None
|
||||||
|
|
||||||
|
if 'body' in params:
|
||||||
|
body_params = params['body']
|
||||||
|
|
||||||
# HTTP header `Accept`
|
# HTTP header `Accept`
|
||||||
header_params['Accept'] = self.api_client.select_header_accept(['application/json', 'application/xml'])
|
header_params['Accept'] = self.api_client.select_header_accept(['application/json', 'application/xml'])
|
||||||
@ -156,11 +165,18 @@ class StoreApi(object):
|
|||||||
resource_path = '/store/order/{orderId}'.replace('{format}', 'json')
|
resource_path = '/store/order/{orderId}'.replace('{format}', 'json')
|
||||||
method = 'GET'
|
method = 'GET'
|
||||||
|
|
||||||
path_params = remove_none(dict(orderId=params.get('order_id')))
|
path_params = {}
|
||||||
query_params = remove_none(dict())
|
|
||||||
header_params = remove_none(dict())
|
if 'order_id' in params:
|
||||||
form_params = remove_none(dict())
|
path_params['orderId'] = params['order_id']
|
||||||
files = remove_none(dict())
|
|
||||||
|
query_params = {}
|
||||||
|
|
||||||
|
header_params = {}
|
||||||
|
|
||||||
|
form_params = {}
|
||||||
|
files = {}
|
||||||
|
|
||||||
body_params = None
|
body_params = None
|
||||||
|
|
||||||
# HTTP header `Accept`
|
# HTTP header `Accept`
|
||||||
@ -206,11 +222,18 @@ class StoreApi(object):
|
|||||||
resource_path = '/store/order/{orderId}'.replace('{format}', 'json')
|
resource_path = '/store/order/{orderId}'.replace('{format}', 'json')
|
||||||
method = 'DELETE'
|
method = 'DELETE'
|
||||||
|
|
||||||
path_params = remove_none(dict(orderId=params.get('order_id')))
|
path_params = {}
|
||||||
query_params = remove_none(dict())
|
|
||||||
header_params = remove_none(dict())
|
if 'order_id' in params:
|
||||||
form_params = remove_none(dict())
|
path_params['orderId'] = params['order_id']
|
||||||
files = remove_none(dict())
|
|
||||||
|
query_params = {}
|
||||||
|
|
||||||
|
header_params = {}
|
||||||
|
|
||||||
|
form_params = {}
|
||||||
|
files = {}
|
||||||
|
|
||||||
body_params = None
|
body_params = None
|
||||||
|
|
||||||
# HTTP header `Accept`
|
# HTTP header `Accept`
|
||||||
|
@ -27,8 +27,6 @@ import os
|
|||||||
# python 2 and python 3 compatibility library
|
# python 2 and python 3 compatibility library
|
||||||
from six import iteritems
|
from six import iteritems
|
||||||
|
|
||||||
from ..util import remove_none
|
|
||||||
|
|
||||||
from ..api_client import ApiClient
|
from ..api_client import ApiClient
|
||||||
|
|
||||||
class UserApi(object):
|
class UserApi(object):
|
||||||
@ -61,12 +59,19 @@ class UserApi(object):
|
|||||||
resource_path = '/user'.replace('{format}', 'json')
|
resource_path = '/user'.replace('{format}', 'json')
|
||||||
method = 'POST'
|
method = 'POST'
|
||||||
|
|
||||||
path_params = remove_none(dict())
|
path_params = {}
|
||||||
query_params = remove_none(dict())
|
|
||||||
header_params = remove_none(dict())
|
query_params = {}
|
||||||
form_params = remove_none(dict())
|
|
||||||
files = remove_none(dict())
|
header_params = {}
|
||||||
body_params = params.get('body')
|
|
||||||
|
form_params = {}
|
||||||
|
files = {}
|
||||||
|
|
||||||
|
body_params = None
|
||||||
|
|
||||||
|
if 'body' in params:
|
||||||
|
body_params = params['body']
|
||||||
|
|
||||||
# HTTP header `Accept`
|
# HTTP header `Accept`
|
||||||
header_params['Accept'] = self.api_client.select_header_accept(['application/json', 'application/xml'])
|
header_params['Accept'] = self.api_client.select_header_accept(['application/json', 'application/xml'])
|
||||||
@ -105,12 +110,19 @@ class UserApi(object):
|
|||||||
resource_path = '/user/createWithArray'.replace('{format}', 'json')
|
resource_path = '/user/createWithArray'.replace('{format}', 'json')
|
||||||
method = 'POST'
|
method = 'POST'
|
||||||
|
|
||||||
path_params = remove_none(dict())
|
path_params = {}
|
||||||
query_params = remove_none(dict())
|
|
||||||
header_params = remove_none(dict())
|
query_params = {}
|
||||||
form_params = remove_none(dict())
|
|
||||||
files = remove_none(dict())
|
header_params = {}
|
||||||
body_params = params.get('body')
|
|
||||||
|
form_params = {}
|
||||||
|
files = {}
|
||||||
|
|
||||||
|
body_params = None
|
||||||
|
|
||||||
|
if 'body' in params:
|
||||||
|
body_params = params['body']
|
||||||
|
|
||||||
# HTTP header `Accept`
|
# HTTP header `Accept`
|
||||||
header_params['Accept'] = self.api_client.select_header_accept(['application/json', 'application/xml'])
|
header_params['Accept'] = self.api_client.select_header_accept(['application/json', 'application/xml'])
|
||||||
@ -149,12 +161,19 @@ class UserApi(object):
|
|||||||
resource_path = '/user/createWithList'.replace('{format}', 'json')
|
resource_path = '/user/createWithList'.replace('{format}', 'json')
|
||||||
method = 'POST'
|
method = 'POST'
|
||||||
|
|
||||||
path_params = remove_none(dict())
|
path_params = {}
|
||||||
query_params = remove_none(dict())
|
|
||||||
header_params = remove_none(dict())
|
query_params = {}
|
||||||
form_params = remove_none(dict())
|
|
||||||
files = remove_none(dict())
|
header_params = {}
|
||||||
body_params = params.get('body')
|
|
||||||
|
form_params = {}
|
||||||
|
files = {}
|
||||||
|
|
||||||
|
body_params = None
|
||||||
|
|
||||||
|
if 'body' in params:
|
||||||
|
body_params = params['body']
|
||||||
|
|
||||||
# HTTP header `Accept`
|
# HTTP header `Accept`
|
||||||
header_params['Accept'] = self.api_client.select_header_accept(['application/json', 'application/xml'])
|
header_params['Accept'] = self.api_client.select_header_accept(['application/json', 'application/xml'])
|
||||||
@ -194,11 +213,21 @@ class UserApi(object):
|
|||||||
resource_path = '/user/login'.replace('{format}', 'json')
|
resource_path = '/user/login'.replace('{format}', 'json')
|
||||||
method = 'GET'
|
method = 'GET'
|
||||||
|
|
||||||
path_params = remove_none(dict())
|
path_params = {}
|
||||||
query_params = remove_none(dict(username=params.get('username'), password=params.get('password')))
|
|
||||||
header_params = remove_none(dict())
|
query_params = {}
|
||||||
form_params = remove_none(dict())
|
|
||||||
files = remove_none(dict())
|
if 'username' in params:
|
||||||
|
query_params['username'] = params['username']
|
||||||
|
|
||||||
|
if 'password' in params:
|
||||||
|
query_params['password'] = params['password']
|
||||||
|
|
||||||
|
header_params = {}
|
||||||
|
|
||||||
|
form_params = {}
|
||||||
|
files = {}
|
||||||
|
|
||||||
body_params = None
|
body_params = None
|
||||||
|
|
||||||
# HTTP header `Accept`
|
# HTTP header `Accept`
|
||||||
@ -239,11 +268,15 @@ class UserApi(object):
|
|||||||
resource_path = '/user/logout'.replace('{format}', 'json')
|
resource_path = '/user/logout'.replace('{format}', 'json')
|
||||||
method = 'GET'
|
method = 'GET'
|
||||||
|
|
||||||
path_params = remove_none(dict())
|
path_params = {}
|
||||||
query_params = remove_none(dict())
|
|
||||||
header_params = remove_none(dict())
|
query_params = {}
|
||||||
form_params = remove_none(dict())
|
|
||||||
files = remove_none(dict())
|
header_params = {}
|
||||||
|
|
||||||
|
form_params = {}
|
||||||
|
files = {}
|
||||||
|
|
||||||
body_params = None
|
body_params = None
|
||||||
|
|
||||||
# HTTP header `Accept`
|
# HTTP header `Accept`
|
||||||
@ -287,11 +320,18 @@ class UserApi(object):
|
|||||||
resource_path = '/user/{username}'.replace('{format}', 'json')
|
resource_path = '/user/{username}'.replace('{format}', 'json')
|
||||||
method = 'GET'
|
method = 'GET'
|
||||||
|
|
||||||
path_params = remove_none(dict(username=params.get('username')))
|
path_params = {}
|
||||||
query_params = remove_none(dict())
|
|
||||||
header_params = remove_none(dict())
|
if 'username' in params:
|
||||||
form_params = remove_none(dict())
|
path_params['username'] = params['username']
|
||||||
files = remove_none(dict())
|
|
||||||
|
query_params = {}
|
||||||
|
|
||||||
|
header_params = {}
|
||||||
|
|
||||||
|
form_params = {}
|
||||||
|
files = {}
|
||||||
|
|
||||||
body_params = None
|
body_params = None
|
||||||
|
|
||||||
# HTTP header `Accept`
|
# HTTP header `Accept`
|
||||||
@ -338,12 +378,22 @@ class UserApi(object):
|
|||||||
resource_path = '/user/{username}'.replace('{format}', 'json')
|
resource_path = '/user/{username}'.replace('{format}', 'json')
|
||||||
method = 'PUT'
|
method = 'PUT'
|
||||||
|
|
||||||
path_params = remove_none(dict(username=params.get('username')))
|
path_params = {}
|
||||||
query_params = remove_none(dict())
|
|
||||||
header_params = remove_none(dict())
|
if 'username' in params:
|
||||||
form_params = remove_none(dict())
|
path_params['username'] = params['username']
|
||||||
files = remove_none(dict())
|
|
||||||
body_params = params.get('body')
|
query_params = {}
|
||||||
|
|
||||||
|
header_params = {}
|
||||||
|
|
||||||
|
form_params = {}
|
||||||
|
files = {}
|
||||||
|
|
||||||
|
body_params = None
|
||||||
|
|
||||||
|
if 'body' in params:
|
||||||
|
body_params = params['body']
|
||||||
|
|
||||||
# HTTP header `Accept`
|
# HTTP header `Accept`
|
||||||
header_params['Accept'] = self.api_client.select_header_accept(['application/json', 'application/xml'])
|
header_params['Accept'] = self.api_client.select_header_accept(['application/json', 'application/xml'])
|
||||||
@ -386,11 +436,18 @@ class UserApi(object):
|
|||||||
resource_path = '/user/{username}'.replace('{format}', 'json')
|
resource_path = '/user/{username}'.replace('{format}', 'json')
|
||||||
method = 'DELETE'
|
method = 'DELETE'
|
||||||
|
|
||||||
path_params = remove_none(dict(username=params.get('username')))
|
path_params = {}
|
||||||
query_params = remove_none(dict())
|
|
||||||
header_params = remove_none(dict())
|
if 'username' in params:
|
||||||
form_params = remove_none(dict())
|
path_params['username'] = params['username']
|
||||||
files = remove_none(dict())
|
|
||||||
|
query_params = {}
|
||||||
|
|
||||||
|
header_params = {}
|
||||||
|
|
||||||
|
form_params = {}
|
||||||
|
files = {}
|
||||||
|
|
||||||
body_params = None
|
body_params = None
|
||||||
|
|
||||||
# HTTP header `Accept`
|
# HTTP header `Accept`
|
||||||
|
@ -1,16 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
from six import iteritems
|
|
||||||
|
|
||||||
def remove_none(obj):
|
|
||||||
"""
|
|
||||||
Remove None from `list`, `tuple`, `set`.
|
|
||||||
Remove None value from `dict`.
|
|
||||||
"""
|
|
||||||
if isinstance(obj, (list, tuple, set)):
|
|
||||||
return type(obj)(remove_none(x) for x in obj if x is not None)
|
|
||||||
elif isinstance(obj, dict):
|
|
||||||
return type(obj)((remove_none(k), remove_none(v))
|
|
||||||
for k, v in iteritems(obj) if k is not None and v is not None)
|
|
||||||
else:
|
|
||||||
return obj
|
|
Loading…
x
Reference in New Issue
Block a user