Skip to content

Commit

Permalink
#92: Add docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
keiranjprice101 committed Oct 17, 2019
1 parent 7d4b1b0 commit 18832dc
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/resources/entities/entity_endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@


def get_endpoint(name, table):
"""
Given an entity name generate a flask_restful Resource class.
In main.py these generated classes are registered with the api e.g
api.add_resource(get_endpoint("Datafiles", DATAFILE), "/datafiles")
:param name: The name of the entity
:param table: The table the endpoint will use in queries
:return: The generated endpoint class
"""
class Endpoint(Resource):
@requires_session_id
@queries_records
Expand All @@ -28,6 +36,14 @@ def patch(self):


def get_id_endpoint(name, table):
"""
Given an entity name generate a flask_restful Resource class.
In main.py these generated classes are registered with the api e.g
api.add_resource(get_endpoint("Datafiles", DATAFILE), "/datafiles/<int:id>")
:param name: The name of the entity
:param table: The table the endpoint will use in queries
:return: The generated id endpoint class
"""
class EndpointWithID(Resource):

@requires_session_id
Expand All @@ -52,6 +68,14 @@ def patch(self, id):


def get_count_endpoint(name, table):
"""
Given an entity name generate a flask_restful Resource class.
In main.py these generated classes are registered with the api e.g
api.add_resource(get_endpoint("Datafiles", DATAFILE), "/datafiles/count")
:param name: The name of the entity
:param table: The table the endpoint will use in queries
:return: The generated count endpoint class
"""
class CountEndpoint(Resource):

@requires_session_id
Expand All @@ -65,6 +89,14 @@ def get(self):


def get_find_one_endpoint(name, table):
"""
Given an entity name generate a flask_restful Resource class.
In main.py these generated classes are registered with the api e.g
api.add_resource(get_endpoint("Datafiles", DATAFILE), "/datafiles/findone")
:param name: The name of the entity
:param table: The table the endpoint will use in queries
:return: The generated findOne endpoint class
"""
class FindOneEndpoint(Resource):

@requires_session_id
Expand Down

0 comments on commit 18832dc

Please sign in to comment.