Commit ea5bfe6b authored by Zdralovic Edim's avatar Zdralovic Edim

Documented the classes

parent bb6703e1
......@@ -39,24 +39,18 @@ wesDAO = wes_dao.WES_DAO()
############################################################
class CWLRestAPI(FlaskView):
"""
This class represents the API for the Workflows.
Available routes:
/workflows
A POST on '/workflows/' expects two arguments in JSON: the token of the
authenticated user and his role.
After successfully starting a workflow the ID for this workflow is yielded
which can be used to retrieve the status of this workflow.
A GET on this directive will yield all workflows for the user with their current status in JSON format.
/workflows/'workflowID'
A GET on this directive will yield all availaible workflow informations matching the given ID in JSON format.
A DELETE on this directive will terminate the workflow matching the given ID.
/service-info'
A GET on this directive will yield some basic informations about this API in JSON format.
This class represents the API for this service.
Following routes and actions are available:
- /workflows/gitURL (POST)
- /workflows (POST; GET)
- /workflows/<workflowID> (GET; POST; DELETE)
- /workflows/<workflowID>/status (GET)
- /workflows/user/<userToken> (GET)
- /service-info (GET)
- /upload (POST)
For more information about these routes, read the method
descriptions.
"""
############################################################
#Section: Variables
......@@ -70,28 +64,7 @@ class CWLRestAPI(FlaskView):
############################################################
def index(self): #route_base
return """
<div>
<h2>This class represents the API for the Workflows.</h2>
<h3>Available routes:</h3>
<pre>
/workflows
A POST on '/workflows/' expects two arguments in JSON: the token of the
authenticated user and his role.
After successfully starting a workflow the ID for this workflow is yielded
which can be used to retrieve the status of this workflow.
A GET on this directive will yield all workflows for the user with their current status in JSON format.
</pre>
<pre>
/workflows/'workflowID'
A GET on this directive will yield all availaible workflow informations matching the given ID in JSON format.
A DELETE on this directive will terminate the workflow matching the given ID.
</pre>
<pre>
/service-info'
A GET on this directive will yield some basic informations about this API in JSON format.
</pre>
<h2>The service is available.</h2>
"""
@route('/workflows/gitURL', methods=['POST'])
......@@ -183,6 +156,9 @@ class CWLRestAPI(FlaskView):
@route('/upload', methods=['POST'])
def upload_files(self):
"""
Files can be uploaded to Flask.
"""
if request.method == 'POST':
filename = ""
# check if the post request has the file part
......@@ -208,6 +184,9 @@ class CWLRestAPI(FlaskView):
return jsonify({"RequestError": "Wrong request method used."})
def allowed_file(self, filename):
"""
This methods yields all file types that are allowed to be uploaded.
"""
return '.' in filename and filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS
class WorkflowManager:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment