forked from loafle/openapi-generator-original
update python petstore samples
This commit is contained in:
@@ -46,7 +46,7 @@ from petstore_api.models.has_only_read_only import HasOnlyReadOnly
|
||||
from petstore_api.models.list import List
|
||||
from petstore_api.models.map_test import MapTest
|
||||
from petstore_api.models.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass
|
||||
from petstore_api.models.model_200_response import Model200Response
|
||||
from petstore_api.models.model200_response import Model200Response
|
||||
from petstore_api.models.model_return import ModelReturn
|
||||
from petstore_api.models.name import Name
|
||||
from petstore_api.models.number_only import NumberOnly
|
||||
|
||||
@@ -36,6 +36,7 @@ class FakeClassnameTags123Api(object):
|
||||
def test_classname(self, body, **kwargs): # noqa: E501
|
||||
"""To test class name in snake case # noqa: E501
|
||||
|
||||
To test class name in snake case # noqa: E501
|
||||
This method makes a synchronous HTTP request by default. To make an
|
||||
asynchronous HTTP request, please pass async=True
|
||||
>>> thread = api.test_classname(body, async=True)
|
||||
@@ -57,6 +58,7 @@ class FakeClassnameTags123Api(object):
|
||||
def test_classname_with_http_info(self, body, **kwargs): # noqa: E501
|
||||
"""To test class name in snake case # noqa: E501
|
||||
|
||||
To test class name in snake case # noqa: E501
|
||||
This method makes a synchronous HTTP request by default. To make an
|
||||
asynchronous HTTP request, please pass async=True
|
||||
>>> thread = api.test_classname_with_http_info(body, async=True)
|
||||
|
||||
@@ -423,7 +423,7 @@ class UserApi(object):
|
||||
>>> result = thread.get()
|
||||
|
||||
:param async bool
|
||||
:param str username: The name that needs to be fetched. Use user1 for testing. (required)
|
||||
:param str username: The name that needs to be fetched. Use user1 for testing. (required)
|
||||
:return: User
|
||||
If the method is called asynchronously,
|
||||
returns the request thread.
|
||||
@@ -445,7 +445,7 @@ class UserApi(object):
|
||||
>>> result = thread.get()
|
||||
|
||||
:param async bool
|
||||
:param str username: The name that needs to be fetched. Use user1 for testing. (required)
|
||||
:param str username: The name that needs to be fetched. Use user1 for testing. (required)
|
||||
:return: User
|
||||
If the method is called asynchronously,
|
||||
returns the request thread.
|
||||
|
||||
@@ -34,7 +34,7 @@ from petstore_api.models.has_only_read_only import HasOnlyReadOnly
|
||||
from petstore_api.models.list import List
|
||||
from petstore_api.models.map_test import MapTest
|
||||
from petstore_api.models.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass
|
||||
from petstore_api.models.model_200_response import Model200Response
|
||||
from petstore_api.models.model200_response import Model200Response
|
||||
from petstore_api.models.model_return import ModelReturn
|
||||
from petstore_api.models.name import Name
|
||||
from petstore_api.models.number_only import NumberOnly
|
||||
|
||||
@@ -0,0 +1,138 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Swagger Petstore
|
||||
|
||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501
|
||||
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
"""
|
||||
|
||||
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
|
||||
import six
|
||||
|
||||
|
||||
class Model200Response(object):
|
||||
"""NOTE: This class is auto generated by the swagger code generator program.
|
||||
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
"""
|
||||
Attributes:
|
||||
swagger_types (dict): The key is attribute name
|
||||
and the value is attribute type.
|
||||
attribute_map (dict): The key is attribute name
|
||||
and the value is json key in definition.
|
||||
"""
|
||||
swagger_types = {
|
||||
'name': 'int',
|
||||
'_class': 'str'
|
||||
}
|
||||
|
||||
attribute_map = {
|
||||
'name': 'name',
|
||||
'_class': 'class'
|
||||
}
|
||||
|
||||
def __init__(self, name=None, _class=None): # noqa: E501
|
||||
"""Model200Response - a model defined in Swagger""" # noqa: E501
|
||||
|
||||
self._name = None
|
||||
self.__class = None
|
||||
self.discriminator = None
|
||||
|
||||
if name is not None:
|
||||
self.name = name
|
||||
if _class is not None:
|
||||
self._class = _class
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
"""Gets the name of this Model200Response. # noqa: E501
|
||||
|
||||
|
||||
:return: The name of this Model200Response. # noqa: E501
|
||||
:rtype: int
|
||||
"""
|
||||
return self._name
|
||||
|
||||
@name.setter
|
||||
def name(self, name):
|
||||
"""Sets the name of this Model200Response.
|
||||
|
||||
|
||||
:param name: The name of this Model200Response. # noqa: E501
|
||||
:type: int
|
||||
"""
|
||||
|
||||
self._name = name
|
||||
|
||||
@property
|
||||
def _class(self):
|
||||
"""Gets the _class of this Model200Response. # noqa: E501
|
||||
|
||||
|
||||
:return: The _class of this Model200Response. # noqa: E501
|
||||
:rtype: str
|
||||
"""
|
||||
return self.__class
|
||||
|
||||
@_class.setter
|
||||
def _class(self, _class):
|
||||
"""Sets the _class of this Model200Response.
|
||||
|
||||
|
||||
:param _class: The _class of this Model200Response. # noqa: E501
|
||||
:type: str
|
||||
"""
|
||||
|
||||
self.__class = _class
|
||||
|
||||
def to_dict(self):
|
||||
"""Returns the model properties as a dict"""
|
||||
result = {}
|
||||
|
||||
for attr, _ in six.iteritems(self.swagger_types):
|
||||
value = getattr(self, attr)
|
||||
if isinstance(value, list):
|
||||
result[attr] = list(map(
|
||||
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
|
||||
value
|
||||
))
|
||||
elif hasattr(value, "to_dict"):
|
||||
result[attr] = value.to_dict()
|
||||
elif isinstance(value, dict):
|
||||
result[attr] = dict(map(
|
||||
lambda item: (item[0], item[1].to_dict())
|
||||
if hasattr(item[1], "to_dict") else item,
|
||||
value.items()
|
||||
))
|
||||
else:
|
||||
result[attr] = value
|
||||
|
||||
return result
|
||||
|
||||
def to_str(self):
|
||||
"""Returns the string representation of the model"""
|
||||
return pprint.pformat(self.to_dict())
|
||||
|
||||
def __repr__(self):
|
||||
"""For `print` and `pprint`"""
|
||||
return self.to_str()
|
||||
|
||||
def __eq__(self, other):
|
||||
"""Returns true if both objects are equal"""
|
||||
if not isinstance(other, Model200Response):
|
||||
return False
|
||||
|
||||
return self.__dict__ == other.__dict__
|
||||
|
||||
def __ne__(self, other):
|
||||
"""Returns true if both objects are not equal"""
|
||||
return not self == other
|
||||
Reference in New Issue
Block a user