This commit is contained in:
geekerzp 2015-07-31 16:01:45 +08:00
parent 92208b4ec2
commit 79c988616c
6 changed files with 351 additions and 1 deletions

View File

@ -47,16 +47,30 @@ class {{classname}}(object):
}
{{#vars}}
self._{{name}} = None{{#description}} # {{description}}{{/description}}
self._{{name}} = None
{{/vars}}
{{#vars}}
@property
def {{name}}(self):
"""
Gets the {{name}} of this {{classname}}.
{{#description}} {{{description}}}{{/description}}
:return: The {{name}} of this {{classname}}.
:rtype: {{datatype}}
"""
return self._{{name}}
@{{name}}.setter
def {{name}}(self, {{name}}):
"""
Sets the {{name}} of this {{classname}}.
{{#description}} {{{description}}}{{/description}}
:param {{name}}: The {{name}} of this {{classname}}.
:type: {{datatype}}
"""
{{#isEnum}}allowed_values = [{{#allowableValues}}{{#values}}"{{{this}}}"{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}]
if {{name}} not in allowed_values:
raise ValueError(

View File

@ -49,18 +49,46 @@ class Category(object):
@property
def id(self):
"""
Gets the id of this Category.
:return: The id of this Category.
:rtype: int
"""
return self._id
@id.setter
def id(self, id):
"""
Sets the id of this Category.
:param id: The id of this Category.
:type: int
"""
self._id = id
@property
def name(self):
"""
Gets the name of this Category.
:return: The name of this Category.
:rtype: str
"""
return self._name
@name.setter
def name(self, name):
"""
Sets the name of this Category.
:param name: The name of this Category.
:type: str
"""
self._name = name
def to_dict(self):

View File

@ -61,42 +61,112 @@ class Order(object):
@property
def id(self):
"""
Gets the id of this Order.
:return: The id of this Order.
:rtype: int
"""
return self._id
@id.setter
def id(self, id):
"""
Sets the id of this Order.
:param id: The id of this Order.
:type: int
"""
self._id = id
@property
def pet_id(self):
"""
Gets the pet_id of this Order.
:return: The pet_id of this Order.
:rtype: int
"""
return self._pet_id
@pet_id.setter
def pet_id(self, pet_id):
"""
Sets the pet_id of this Order.
:param pet_id: The pet_id of this Order.
:type: int
"""
self._pet_id = pet_id
@property
def quantity(self):
"""
Gets the quantity of this Order.
:return: The quantity of this Order.
:rtype: int
"""
return self._quantity
@quantity.setter
def quantity(self, quantity):
"""
Sets the quantity of this Order.
:param quantity: The quantity of this Order.
:type: int
"""
self._quantity = quantity
@property
def ship_date(self):
"""
Gets the ship_date of this Order.
:return: The ship_date of this Order.
:rtype: datetime
"""
return self._ship_date
@ship_date.setter
def ship_date(self, ship_date):
"""
Sets the ship_date of this Order.
:param ship_date: The ship_date of this Order.
:type: datetime
"""
self._ship_date = ship_date
@property
def status(self):
"""
Gets the status of this Order.
Order Status
:return: The status of this Order.
:rtype: str
"""
return self._status
@status.setter
def status(self, status):
"""
Sets the status of this Order.
Order Status
:param status: The status of this Order.
:type: str
"""
allowed_values = ["placed", "approved", "delivered"]
if status not in allowed_values:
raise ValueError(
@ -107,10 +177,24 @@ class Order(object):
@property
def complete(self):
"""
Gets the complete of this Order.
:return: The complete of this Order.
:rtype: bool
"""
return self._complete
@complete.setter
def complete(self, complete):
"""
Sets the complete of this Order.
:param complete: The complete of this Order.
:type: bool
"""
self._complete = complete
def to_dict(self):

View File

@ -61,50 +61,134 @@ class Pet(object):
@property
def id(self):
"""
Gets the id of this Pet.
:return: The id of this Pet.
:rtype: int
"""
return self._id
@id.setter
def id(self, id):
"""
Sets the id of this Pet.
:param id: The id of this Pet.
:type: int
"""
self._id = id
@property
def category(self):
"""
Gets the category of this Pet.
:return: The category of this Pet.
:rtype: Category
"""
return self._category
@category.setter
def category(self, category):
"""
Sets the category of this Pet.
:param category: The category of this Pet.
:type: Category
"""
self._category = category
@property
def name(self):
"""
Gets the name of this Pet.
:return: The name of this Pet.
:rtype: str
"""
return self._name
@name.setter
def name(self, name):
"""
Sets the name of this Pet.
:param name: The name of this Pet.
:type: str
"""
self._name = name
@property
def photo_urls(self):
"""
Gets the photo_urls of this Pet.
:return: The photo_urls of this Pet.
:rtype: list[str]
"""
return self._photo_urls
@photo_urls.setter
def photo_urls(self, photo_urls):
"""
Sets the photo_urls of this Pet.
:param photo_urls: The photo_urls of this Pet.
:type: list[str]
"""
self._photo_urls = photo_urls
@property
def tags(self):
"""
Gets the tags of this Pet.
:return: The tags of this Pet.
:rtype: list[Tag]
"""
return self._tags
@tags.setter
def tags(self, tags):
"""
Sets the tags of this Pet.
:param tags: The tags of this Pet.
:type: list[Tag]
"""
self._tags = tags
@property
def status(self):
"""
Gets the status of this Pet.
pet status in the store
:return: The status of this Pet.
:rtype: str
"""
return self._status
@status.setter
def status(self, status):
"""
Sets the status of this Pet.
pet status in the store
:param status: The status of this Pet.
:type: str
"""
allowed_values = ["available", "pending", "sold"]
if status not in allowed_values:
raise ValueError(

View File

@ -49,18 +49,46 @@ class Tag(object):
@property
def id(self):
"""
Gets the id of this Tag.
:return: The id of this Tag.
:rtype: int
"""
return self._id
@id.setter
def id(self, id):
"""
Sets the id of this Tag.
:param id: The id of this Tag.
:type: int
"""
self._id = id
@property
def name(self):
"""
Gets the name of this Tag.
:return: The name of this Tag.
:rtype: str
"""
return self._name
@name.setter
def name(self, name):
"""
Sets the name of this Tag.
:param name: The name of this Tag.
:type: str
"""
self._name = name
def to_dict(self):

View File

@ -67,66 +67,178 @@ class User(object):
@property
def id(self):
"""
Gets the id of this User.
:return: The id of this User.
:rtype: int
"""
return self._id
@id.setter
def id(self, id):
"""
Sets the id of this User.
:param id: The id of this User.
:type: int
"""
self._id = id
@property
def username(self):
"""
Gets the username of this User.
:return: The username of this User.
:rtype: str
"""
return self._username
@username.setter
def username(self, username):
"""
Sets the username of this User.
:param username: The username of this User.
:type: str
"""
self._username = username
@property
def first_name(self):
"""
Gets the first_name of this User.
:return: The first_name of this User.
:rtype: str
"""
return self._first_name
@first_name.setter
def first_name(self, first_name):
"""
Sets the first_name of this User.
:param first_name: The first_name of this User.
:type: str
"""
self._first_name = first_name
@property
def last_name(self):
"""
Gets the last_name of this User.
:return: The last_name of this User.
:rtype: str
"""
return self._last_name
@last_name.setter
def last_name(self, last_name):
"""
Sets the last_name of this User.
:param last_name: The last_name of this User.
:type: str
"""
self._last_name = last_name
@property
def email(self):
"""
Gets the email of this User.
:return: The email of this User.
:rtype: str
"""
return self._email
@email.setter
def email(self, email):
"""
Sets the email of this User.
:param email: The email of this User.
:type: str
"""
self._email = email
@property
def password(self):
"""
Gets the password of this User.
:return: The password of this User.
:rtype: str
"""
return self._password
@password.setter
def password(self, password):
"""
Sets the password of this User.
:param password: The password of this User.
:type: str
"""
self._password = password
@property
def phone(self):
"""
Gets the phone of this User.
:return: The phone of this User.
:rtype: str
"""
return self._phone
@phone.setter
def phone(self, phone):
"""
Sets the phone of this User.
:param phone: The phone of this User.
:type: str
"""
self._phone = phone
@property
def user_status(self):
"""
Gets the user_status of this User.
User Status
:return: The user_status of this User.
:rtype: int
"""
return self._user_status
@user_status.setter
def user_status(self, user_status):
"""
Sets the user_status of this User.
User Status
:param user_status: The user_status of this User.
:type: int
"""
self._user_status = user_status
def to_dict(self):