a150fb836e71498d74d76a1c9c2ce146f61c1b53
[apps/agl-service-unicens.git] / ucs2-afb / ucs_apidef.json
1 {
2   "openapi": "3.0.0",
3   "$schema": "http:iot.bzh/download/openapi/schema-3.0/default-schema.json",
4   "info": {
5     "description": "",
6     "title": "ucs2",
7     "version": "1.0",
8     "x-binding-c-generator": {
9       "api": "UNICENS",
10       "version": 2,
11       "prefix": "ucs2_",
12       "postfix": "",
13       "start": null ,
14       "onevent": null,
15       "preinit": null,
16       "init": "ucs2_initbinding",
17       "scope": "",
18       "private": false
19     }
20   },
21   "servers": [
22     {
23       "url": "ws://{host}:{port}/api/monitor",
24       "description": "Unicens2 API.",
25       "variables": {
26         "host": {
27           "default": "localhost"
28         },
29         "port": {
30           "default": "1234"
31         }
32       },
33       "x-afb-events": [
34         {
35           "$ref": "#/components/schemas/afb-event"
36         }
37       ]
38     }
39   ],
40   "components": {
41     "schemas": {
42       "afb-reply": {
43         "$ref": "#/components/schemas/afb-reply-v2"
44       },
45       "afb-event": {
46         "$ref": "#/components/schemas/afb-event-v2"
47       },
48       "afb-reply-v2": {
49         "title": "Generic response.",
50         "type": "object",
51         "required": [ "jtype", "request" ],
52         "properties": {
53           "jtype": {
54             "type": "string",
55             "const": "afb-reply"
56           },
57           "request": {
58             "type": "object",
59             "required": [ "status" ],
60             "properties": {
61               "status": { "type": "string" },
62               "info": { "type": "string" },
63               "token": { "type": "string" },
64               "uuid": { "type": "string" },
65               "reqid": { "type": "string" }
66             }
67           },
68           "response": { "type": "object" }
69         }
70       },
71       "afb-event-v2": {
72         "type": "object",
73         "required": [ "jtype", "event" ],
74         "properties": {
75           "jtype": {
76             "type": "string",
77             "const": "afb-event"
78           },
79           "event": { "type": "string" },
80           "data": { "type": "object" }
81         }
82       }
83     },
84     "x-permissions": {
85         "config": {
86           "permission": "urn:AGL:permission:UNICENS:public:initialise"
87         },
88         "monitor": {
89           "permission": "urn:AGL:permission:UNICENS:public:monitor"
90         }
91     },
92     "responses": {
93             "200": {
94               "description": "A complex object array response",
95               "content": {
96                 "application/json": {
97                   "schema": {
98                     "$ref": "#/components/schemas/afb-reply"
99                   }
100                 }
101             }
102           }
103     }
104   },
105   "paths": {
106     "/listconfig": {
107       "description": "List Config Files",
108       "get": {
109         "x-permissions": {
110           "$ref": "#/components/x-permissions/config"
111         },
112         "parameters": [
113           {
114             "in": "query",
115             "name": "cfgpath",
116             "required": false,
117             "schema": { "type": "string" }
118           }
119         ],
120         "responses": {
121           "200": {"$ref": "#/components/responses/200"}
122         }
123       }
124     },
125     "/initialise": {
126       "description": "configure Unicens2 lib from NetworkConfig.XML.",
127       "get": {
128         "x-permissions": {
129           "$ref": "#/components/x-permissions/config"
130         },
131         "parameters": [
132           {
133             "in": "query",
134             "name": "filename",
135             "required": true,
136             "schema": { "type": "string" }
137           }
138         ],
139         "responses": {
140           "200": {"$ref": "#/components/responses/200"}
141         }
142       }
143     },
144     "/subscribe": {
145       "description": "Subscribe to UNICENS Events.",
146       "get": {
147         "x-permissions": {
148           "$ref": "#/components/x-permissions/monitor"
149         },
150         "responses": {
151           "200": {"$ref": "#/components/responses/200"}
152         }
153       }
154     },
155     "/writei2c": {
156       "description": "Writes I2C command to remote node.",
157       "get": {
158         "x-permissions": {
159           "$ref": "#/components/x-permissions/monitor"
160         },
161         "parameters": [
162           {
163             "in": "query",
164             "name": "node",
165             "required": true,
166             "schema": {
167                 "type": "integer",
168                 "format": "int32"
169             }
170           },
171           {
172             "in": "query",
173             "name": "data",
174             "required": true,
175             "schema": {
176                 "type": "array",
177                 "format": "int32"
178             },
179             "style": "simple"
180           }
181         ],
182         "responses": {
183           "200": {"$ref": "#/components/responses/200"}
184         }
185       }
186     },
187     "/sendmessage": {
188       "description": "Transmits a control message to a node.",
189       "get": {
190         "x-permissions": {
191           "$ref": "#/components/x-permissions/monitor"
192         },
193         "parameters": [
194           {
195             "in": "query",
196             "name": "node",
197             "required": true,
198             "schema": {
199                 "type": "integer",
200                 "format": "int32"
201             }
202           },
203           {
204             "in": "query",
205             "name": "msgid",
206             "required": true,
207             "schema": {
208                 "type": "integer",
209                 "format": "int32"
210             }
211           },
212           {
213             "in": "query",
214             "name": "data",
215             "required": true,
216             "schema": {
217                 "type": "array",
218                 "format": "int32"
219             },
220             "style": "simple"
221           }
222         ],
223         "responses": {
224           "200": {"$ref": "#/components/responses/200"}
225         }
226       }
227     }
228   }
229 }