forked from loafle/openapi-generator-original
[Flask] Add packaging support
This commit is contained in:
@@ -0,0 +1,117 @@
|
||||
import connexion
|
||||
from swagger_server.models.api_response import ApiResponse
|
||||
from swagger_server.models.pet import Pet
|
||||
from datetime import date, datetime
|
||||
from typing import List, Dict
|
||||
from six import iteritems
|
||||
from ..util import deserialize_date, deserialize_datetime
|
||||
|
||||
|
||||
def add_pet(body):
|
||||
"""
|
||||
Add a new pet to the store
|
||||
|
||||
:param body: Pet object that needs to be added to the store
|
||||
:type body: dict | bytes
|
||||
|
||||
:rtype: None
|
||||
"""
|
||||
if connexion.request.is_json:
|
||||
body = Pet.from_dict(connexion.request.get_json())
|
||||
return 'do some magic!'
|
||||
|
||||
|
||||
def delete_pet(petId, api_key=None):
|
||||
"""
|
||||
Deletes a pet
|
||||
|
||||
:param petId: Pet id to delete
|
||||
:type petId: int
|
||||
:param api_key:
|
||||
:type api_key: str
|
||||
|
||||
:rtype: None
|
||||
"""
|
||||
return 'do some magic!'
|
||||
|
||||
|
||||
def find_pets_by_status(status):
|
||||
"""
|
||||
Finds Pets by status
|
||||
Multiple status values can be provided with comma separated strings
|
||||
:param status: Status values that need to be considered for filter
|
||||
:type status: List[str]
|
||||
|
||||
:rtype: List[Pet]
|
||||
"""
|
||||
return 'do some magic!'
|
||||
|
||||
|
||||
def find_pets_by_tags(tags):
|
||||
"""
|
||||
Finds Pets by tags
|
||||
Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
||||
:param tags: Tags to filter by
|
||||
:type tags: List[str]
|
||||
|
||||
:rtype: List[Pet]
|
||||
"""
|
||||
return 'do some magic!'
|
||||
|
||||
|
||||
def get_pet_by_id(petId):
|
||||
"""
|
||||
Find pet by ID
|
||||
Returns a single pet
|
||||
:param petId: ID of pet to return
|
||||
:type petId: int
|
||||
|
||||
:rtype: Pet
|
||||
"""
|
||||
return 'do some magic!'
|
||||
|
||||
|
||||
def update_pet(body):
|
||||
"""
|
||||
Update an existing pet
|
||||
|
||||
:param body: Pet object that needs to be added to the store
|
||||
:type body: dict | bytes
|
||||
|
||||
:rtype: None
|
||||
"""
|
||||
if connexion.request.is_json:
|
||||
body = Pet.from_dict(connexion.request.get_json())
|
||||
return 'do some magic!'
|
||||
|
||||
|
||||
def update_pet_with_form(petId, name=None, status=None):
|
||||
"""
|
||||
Updates a pet in the store with form data
|
||||
|
||||
:param petId: ID of pet that needs to be updated
|
||||
:type petId: int
|
||||
:param name: Updated name of the pet
|
||||
:type name: str
|
||||
:param status: Updated status of the pet
|
||||
:type status: str
|
||||
|
||||
:rtype: None
|
||||
"""
|
||||
return 'do some magic!'
|
||||
|
||||
|
||||
def upload_file(petId, additionalMetadata=None, file=None):
|
||||
"""
|
||||
uploads an image
|
||||
|
||||
:param petId: ID of pet to update
|
||||
:type petId: int
|
||||
:param additionalMetadata: Additional data to pass to server
|
||||
:type additionalMetadata: str
|
||||
:param file: file to upload
|
||||
:type file: werkzeug.datastructures.FileStorage
|
||||
|
||||
:rtype: ApiResponse
|
||||
"""
|
||||
return 'do some magic!'
|
||||
@@ -0,0 +1,54 @@
|
||||
import connexion
|
||||
from swagger_server.models.order import Order
|
||||
from datetime import date, datetime
|
||||
from typing import List, Dict
|
||||
from six import iteritems
|
||||
from ..util import deserialize_date, deserialize_datetime
|
||||
|
||||
|
||||
def delete_order(orderId):
|
||||
"""
|
||||
Delete purchase order by ID
|
||||
For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||
:param orderId: ID of the order that needs to be deleted
|
||||
:type orderId: str
|
||||
|
||||
:rtype: None
|
||||
"""
|
||||
return 'do some magic!'
|
||||
|
||||
|
||||
def get_inventory():
|
||||
"""
|
||||
Returns pet inventories by status
|
||||
Returns a map of status codes to quantities
|
||||
|
||||
:rtype: Dict[str, int]
|
||||
"""
|
||||
return 'do some magic!'
|
||||
|
||||
|
||||
def get_order_by_id(orderId):
|
||||
"""
|
||||
Find purchase order by ID
|
||||
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||
:param orderId: ID of pet that needs to be fetched
|
||||
:type orderId: int
|
||||
|
||||
:rtype: Order
|
||||
"""
|
||||
return 'do some magic!'
|
||||
|
||||
|
||||
def place_order(body):
|
||||
"""
|
||||
Place an order for a pet
|
||||
|
||||
:param body: order placed for purchasing the pet
|
||||
:type body: dict | bytes
|
||||
|
||||
:rtype: Order
|
||||
"""
|
||||
if connexion.request.is_json:
|
||||
body = Order.from_dict(connexion.request.get_json())
|
||||
return 'do some magic!'
|
||||
@@ -0,0 +1,112 @@
|
||||
import connexion
|
||||
from swagger_server.models.user import User
|
||||
from datetime import date, datetime
|
||||
from typing import List, Dict
|
||||
from six import iteritems
|
||||
from ..util import deserialize_date, deserialize_datetime
|
||||
|
||||
|
||||
def create_user(body):
|
||||
"""
|
||||
Create user
|
||||
This can only be done by the logged in user.
|
||||
:param body: Created user object
|
||||
:type body: dict | bytes
|
||||
|
||||
:rtype: None
|
||||
"""
|
||||
if connexion.request.is_json:
|
||||
body = User.from_dict(connexion.request.get_json())
|
||||
return 'do some magic!'
|
||||
|
||||
|
||||
def create_users_with_array_input(body):
|
||||
"""
|
||||
Creates list of users with given input array
|
||||
|
||||
:param body: List of user object
|
||||
:type body: list | bytes
|
||||
|
||||
:rtype: None
|
||||
"""
|
||||
if connexion.request.is_json:
|
||||
body = [User.from_dict(d) for d in connexion.request.get_json()]
|
||||
return 'do some magic!'
|
||||
|
||||
|
||||
def create_users_with_list_input(body):
|
||||
"""
|
||||
Creates list of users with given input array
|
||||
|
||||
:param body: List of user object
|
||||
:type body: list | bytes
|
||||
|
||||
:rtype: None
|
||||
"""
|
||||
if connexion.request.is_json:
|
||||
body = [User.from_dict(d) for d in connexion.request.get_json()]
|
||||
return 'do some magic!'
|
||||
|
||||
|
||||
def delete_user(username):
|
||||
"""
|
||||
Delete user
|
||||
This can only be done by the logged in user.
|
||||
:param username: The name that needs to be deleted
|
||||
:type username: str
|
||||
|
||||
:rtype: None
|
||||
"""
|
||||
return 'do some magic!'
|
||||
|
||||
|
||||
def get_user_by_name(username):
|
||||
"""
|
||||
Get user by user name
|
||||
|
||||
:param username: The name that needs to be fetched. Use user1 for testing.
|
||||
:type username: str
|
||||
|
||||
:rtype: User
|
||||
"""
|
||||
return 'do some magic!'
|
||||
|
||||
|
||||
def login_user(username, password):
|
||||
"""
|
||||
Logs user into the system
|
||||
|
||||
:param username: The user name for login
|
||||
:type username: str
|
||||
:param password: The password for login in clear text
|
||||
:type password: str
|
||||
|
||||
:rtype: str
|
||||
"""
|
||||
return 'do some magic!'
|
||||
|
||||
|
||||
def logout_user():
|
||||
"""
|
||||
Logs out current logged in user session
|
||||
|
||||
|
||||
:rtype: None
|
||||
"""
|
||||
return 'do some magic!'
|
||||
|
||||
|
||||
def update_user(username, body):
|
||||
"""
|
||||
Updated user
|
||||
This can only be done by the logged in user.
|
||||
:param username: name that need to be deleted
|
||||
:type username: str
|
||||
:param body: Updated user object
|
||||
:type body: dict | bytes
|
||||
|
||||
:rtype: None
|
||||
"""
|
||||
if connexion.request.is_json:
|
||||
body = User.from_dict(connexion.request.get_json())
|
||||
return 'do some magic!'
|
||||
Reference in New Issue
Block a user