agl-service-unicens: Rx message event
[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 network 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     "/subscriberx": {
156       "description": "Subscribe to Rx control message events.",
157       "get": {
158         "x-permissions": {
159           "$ref": "#/components/x-permissions/monitor"
160         },
161         "responses": {
162           "200": {"$ref": "#/components/responses/200"}
163         }
164       }
165     },
166     "/writei2c": {
167       "description": "Writes I2C command to remote node.",
168       "get": {
169         "x-permissions": {
170           "$ref": "#/components/x-permissions/monitor"
171         },
172         "parameters": [
173           {
174             "in": "query",
175             "name": "node",
176             "required": true,
177             "schema": {
178                 "type": "integer",
179                 "format": "int32"
180             }
181           },
182           {
183             "in": "query",
184             "name": "data",
185             "required": true,
186             "schema": {
187                 "type": "array",
188                 "format": "int32"
189             },
190             "style": "simple"
191           }
192         ],
193         "responses": {
194           "200": {"$ref": "#/components/responses/200"}
195         }
196       }
197     },
198     "/sendmessage": {
199       "description": "Transmits a control message to a node.",
200       "get": {
201         "x-permissions": {
202           "$ref": "#/components/x-permissions/monitor"
203         },
204         "parameters": [
205           {
206             "in": "query",
207             "name": "node",
208             "required": true,
209             "schema": {
210                 "type": "integer",
211                 "format": "int32"
212             }
213           },
214           {
215             "in": "query",
216             "name": "msgid",
217             "required": true,
218             "schema": {
219                 "type": "integer",
220                 "format": "int32"
221             }
222           },
223           {
224             "in": "query",
225             "name": "data",
226             "required": true,
227             "schema": {
228                 "type": "array",
229                 "format": "int32"
230             },
231             "style": "simple"
232           }
233         ],
234         "responses": {
235           "200": {"$ref": "#/components/responses/200"}
236         }
237       }
238     }
239   }
240 }