From c963af54d84250d2fdeba36e0c5839c404c549d2 Mon Sep 17 00:00:00 2001
From: NizarBouchedakh <nizarbouchedakh@NizarBouchedakhs-iMac.local>
Date: Wed, 18 Oct 2017 15:34:44 +0200
Subject: [PATCH] update of apidoc

---
 .DS_Store     | Bin 0 -> 6148 bytes
 flask-main.py |  96 +++++++++++++++++++++++++++++++++++++++++++++-----
 2 files changed, 88 insertions(+), 8 deletions(-)
 create mode 100644 .DS_Store

diff --git a/.DS_Store b/.DS_Store
new file mode 100644
index 0000000000000000000000000000000000000000..64fb0201fb915d8ff163ff471e5856e4c2f93f62
GIT binary patch
literal 6148
zcmZQzU|@7AO)+F(5MW?n;9!8zOq>i@0Z1N%F(jFwBCH_uz-FW}<T0c$=rI&9R6^xO
zslgorpt$2=NMcB2NM^`pK#D)loc!dZocttc;;?35V9@vv24D|yGbA(QGvqO(F=R5N
zGZZjnLSh|F*Ge>9ybNg!ISh#m#SGaDx(vAti42(xdDwI^ilOP`V<=$AXDDVUVTfl)
zX2@a41iQ5atKL>Ly_^gs45<vc3<Y4jLF{5wcQSrP(*gG4C@~rWqaiRF0>d^07$H96
z;D*qn<Y)+thQMeDz(W93J}5xi_6!bCx&cCiq!<_(7{FZsMg|5Jm?lPWKY#%w2hs|n
zL0UmHNGk&)hy^wStd)Tgs+AGk4FTx`bxA-pSUUqF*k%wPtet@oY%>D`BSbp`Bh+R_
zXb*)EqMd;eqMd;eY&*<#qx5J9jD`R#1ehTV0Z{$#%D{lD{|`|$N{)uWXb23;5MX3+
z33hP;SIXG^2dZm9^=SfB8dL{^s$)h_y^Ih8SH(<_0YwR@FsQl*X$8^Xs+f_10i<=b
PApi@YQF=541|S3g9Mx3X

literal 0
HcmV?d00001

diff --git a/flask-main.py b/flask-main.py
index 0c22912..1307efc 100644
--- a/flask-main.py
+++ b/flask-main.py
@@ -52,9 +52,9 @@ def index():
 
 @apiSuccess {boolean} Is_Ready Node status
 
-@apiSuccess {String[]} Neighbours Node's neighbours
+@apiSuccess {String[]} Neighbours List of the node's neighbours IDs
 
-@apiSuccess {Number} Node_ID Node's ID
+@apiSuccess {String} Node_ID Node's ID
 
 @apiSuccess {String} Node_location Node's location
 
@@ -64,7 +64,7 @@ def index():
 
 @apiSuccess {String} Query_stage Node object's readiness stage. Once it's at "Complete" stage, the Node object is ready to be used.
 
-@apiSuccess {Number} Query_stage_(%)  Node object's readiness stage (pourcentage). Once it's at 100%, the Node object is ready to be used.
+@apiSuccess {String} Query_stage_(%)  Node object's readiness stage (pourcentage). Once it's at 100%, the Node object is ready to be used.
 
 
 
@@ -75,7 +75,7 @@ def index():
 "Network Home ID": "0xe221b13f",
 "Node 1": {
     "Is Ready": true,
-    "Neighbours": "2",
+    "Neighbours": ["2","3"],
     "Node ID": "1",
     "Node location": "",
     "Node name": "",
@@ -85,13 +85,23 @@ def index():
   },
 "Node 2": {
     "Is Ready": true,
-    "Neighbours": "1",
+    "Neighbours": ["1","3"],
     "Node ID": "2",
     "Node location": "",
     "Node name": "",
     "Product name": "MultiSensor 6",
     "Query Stage": "Complete",
     "Query Stage (%)": "100 %"
+  },
+"Node 3": {
+    "Is Ready": true,
+    "Neighbours": ["1","2"],
+    "Node ID": "3",
+    "Node location": "",
+    "Node name": "",
+    "Product name": "ZE27",
+    "Query Stage": "Complete",
+    "Query Stage (%)": "100 %"
   }
 }
 
@@ -118,7 +128,7 @@ def network_info():
 
 @apiParamExample {json} Request-Exemple :
     {
-        'Group_Interval' : '241',
+        'Group_Interval' : '224',
         'Group_Reports' : '480',
         'Wake-up_Interval' : '480'
     }
@@ -178,7 +188,7 @@ def network_configure_sensor_Nodes():
 {
 "Network Home ID": "0xe221b13f",
 "Node 2": {
-    "Enable Motion Sensor": "Enabled level 5 (maximum sensitivity",
+    "Enable Motion Sensor": "Enabled level 5 (maximum sensitivity)",
     "Group 1 Interval": "3600",
     "Group 1 Reports": "241",
     "Group 2 Interval": "3600",
@@ -542,7 +552,7 @@ def get_node_name(node):
 
 @apiParam {Number} node_id Sensor's unique ID
 
-@apiSuccess {String[]} neighbors list of a node's neighbours
+@apiSuccess {String[]} neighbours list of a node's neighbours
 
 @apiDescription Gets list of a node's neighbours
 
@@ -620,6 +630,16 @@ def get_sensors_list():
 }
 @apiDescription Gets all measures of a given sensor, in a JSON format
 
+@apiErrorExample {json} Error in case node is not a sensor:
+     {
+       "error": "Node is not a sensor"
+     }
+
+@apiErrorExample {json} Error in case node is not ready:
+     {
+       "error": "Node is not ready"
+     }
+
 """
     
 @app.route('/sensors/<int:node>/get_all_measures', strict_slashes=False)
@@ -653,6 +673,16 @@ def get_all_measures(node):
 }
 @apiDescription Gets temperature of a given sensor in a JSON format
 
+@apiErrorExample {json} Error in case node is not a sensor:
+     {
+       "error": "Node is not a sensor"
+     }
+
+@apiErrorExample {json} Error in case node is not ready:
+     {
+       "error": "Node is not ready"
+     }
+
 """
 
 @app.route('/sensors/<int:node>/get_temperature', strict_slashes=False)
@@ -686,6 +716,16 @@ def get_temperature(node):
 }
 @apiDescription Gets humidity of a given sensor in a JSON format
 
+@apiErrorExample {json} Error in case node is not a sensor:
+     {
+       "error": "Node is not a sensor"
+     }
+
+@apiErrorExample {json} Error in case node is not ready:
+     {
+       "error": "Node is not ready"
+     }
+
 """
 
 @app.route('/sensors/<int:node>/get_humidity', strict_slashes=False)
@@ -719,6 +759,16 @@ def get_humidity(node):
 }
 @apiDescription Gets humidity of a given sensor in a JSON format
 
+@apiErrorExample {json} Error in case node is not a sensor:
+     {
+       "error": "Node is not a sensor"
+     }
+
+@apiErrorExample {json} Error in case node is not ready:
+     {
+       "error": "Node is not ready"
+     }
+
 """
 
 @app.route('/sensors/<int:node>/get_luminance', strict_slashes=False)
@@ -752,6 +802,16 @@ def get_luminance(node):
 }
 @apiDescription Gets motion of a given sensor in a JSON format
 
+@apiErrorExample {json} Error in case node is not a sensor:
+     {
+       "error": "Node is not a sensor"
+     }
+
+@apiErrorExample {json} Error in case node is not ready:
+     {
+       "error": "Node is not ready"
+     }
+
 """
 
 @app.route('/sensors/<int:node>/get_motion', strict_slashes=False)
@@ -820,6 +880,16 @@ def get_dimmers():
 }
 @apiDescription Gets level of a given dimmer in a JSON format
 
+@apiErrorExample {json} Error in case node is not a dimmer:
+     {
+       "error": "Node is not a dimmer"
+     }
+
+@apiErrorExample {json} Error in case node is not ready:
+     {
+       "error": "Node is not ready"
+     }
+
 
 """
 
@@ -848,6 +918,16 @@ def get_dimmer_level(node_id):
 
 @apiDescription Sends command to dimmer node 
 
+@apiErrorExample {json} Error in case node is not a dimmer:
+     {
+       "error": "Node is not a dimmer"
+     }
+
+@apiErrorExample {json} Error in case node is not ready:
+     {
+       "error": "Node is not ready"
+     }
+
 """
 
 @app.route('/dimmers/set_level', methods=['GET', 'POST'], strict_slashes=False)
-- 
GitLab