Update Installation Documentation
[apps/agl-service-unicens.git] / ucs2-afb / ucs_apidef.h
1
2 static const char _afb_description_v2_UNICENS[] =
3     "{\"openapi\":\"3.0.0\",\"$schema\":\"http:iot.bzh/download/openapi/schem"
4     "a-3.0/default-schema.json\",\"info\":{\"description\":\"\",\"title\":\"u"
5     "cs2\",\"version\":\"1.0\",\"x-binding-c-generator\":{\"api\":\"UNICENS\""
6     ",\"version\":2,\"prefix\":\"Ucs2\",\"postfix\":\"API\",\"start\":null,\""
7     "onevent\":null,\"init\":null,\"scope\":\"\",\"private\":false}},\"server"
8     "s\":[{\"url\":\"ws://{host}:{port}/api/monitor\",\"description\":\"Unice"
9     "ns2 API.\",\"variables\":{\"host\":{\"default\":\"localhost\"},\"port\":"
10     "{\"default\":\"1234\"}},\"x-afb-events\":[{\"$ref\":\"#/components/schem"
11     "as/afb-event\"}]}],\"components\":{\"schemas\":{\"afb-reply\":{\"$ref\":"
12     "\"#/components/schemas/afb-reply-v2\"},\"afb-event\":{\"$ref\":\"#/compo"
13     "nents/schemas/afb-event-v2\"},\"afb-reply-v2\":{\"title\":\"Generic resp"
14     "onse.\",\"type\":\"object\",\"required\":[\"jtype\",\"request\"],\"prope"
15     "rties\":{\"jtype\":{\"type\":\"string\",\"const\":\"afb-reply\"},\"reque"
16     "st\":{\"type\":\"object\",\"required\":[\"status\"],\"properties\":{\"st"
17     "atus\":{\"type\":\"string\"},\"info\":{\"type\":\"string\"},\"token\":{\""
18     "type\":\"string\"},\"uuid\":{\"type\":\"string\"},\"reqid\":{\"type\":\""
19     "string\"}}},\"response\":{\"type\":\"object\"}}},\"afb-event-v2\":{\"typ"
20     "e\":\"object\",\"required\":[\"jtype\",\"event\"],\"properties\":{\"jtyp"
21     "e\":{\"type\":\"string\",\"const\":\"afb-event\"},\"event\":{\"type\":\""
22     "string\"},\"data\":{\"type\":\"object\"}}}},\"x-permissions\":{\"config\""
23     ":{\"permission\":\"urn:AGL:permission:UNICENS:public:initialise\"},\"mon"
24     "itor\":{\"permission\":\"urn:AGL:permission:UNICENS:public:monitor\"}},\""
25     "responses\":{\"200\":{\"description\":\"A complex object array response\""
26     ",\"content\":{\"application/json\":{\"schema\":{\"$ref\":\"#/components/"
27     "schemas/afb-reply\"}}}}}},\"paths\":{\"/initialise\":{\"description\":\""
28     "Initialise Unicens2 lib from NetworkConfig.XML.\",\"get\":{\"x-permissio"
29     "ns\":{\"$ref\":\"#/components/x-permissions/config\"},\"parameters\":[{\""
30     "in\":\"query\",\"name\":\"filename\",\"required\":true,\"schema\":{\"typ"
31     "e\":\"string\"}}],\"responses\":{\"200\":{\"$ref\":\"#/components/respon"
32     "ses/200\"}}}},\"/volume\":{\"description\":\"Set Master Volume.\",\"get\""
33     ":{\"x-permissions\":{\"$ref\":\"#/components/x-permissions/monitor\"},\""
34     "parameters\":[{\"in\":\"query\",\"name\":\"value\",\"required\":true,\"s"
35     "chema\":{\"type\":\"integer\"}}],\"responses\":{\"200\":{\"$ref\":\"#/co"
36     "mponents/responses/200\"}}}},\"/monitor\":{\"description\":\"Subscribe t"
37     "o Unicens Event.\",\"get\":{\"x-permissions\":{\"$ref\":\"#/components/x"
38     "-permissions/monitor\"},\"responses\":{\"200\":{\"$ref\":\"#/components/"
39     "responses/200\"}}}}}}"
40 ;
41
42 static const struct afb_auth _afb_auths_v2_UNICENS[] = {
43         { .type = afb_auth_Permission, .text = "urn:AGL:permission:UNICENS:public:initialise" },
44         { .type = afb_auth_Permission, .text = "urn:AGL:permission:UNICENS:public:monitor" }
45 };
46
47  void Ucs2initialiseAPI(struct afb_req req);
48  void Ucs2volumeAPI(struct afb_req req);
49  void Ucs2monitorAPI(struct afb_req req);
50
51 static const struct afb_verb_v2 _afb_verbs_v2_UNICENS[] = {
52     {
53         .verb = "initialise",
54         .callback = Ucs2initialiseAPI,
55         .auth = &_afb_auths_v2_UNICENS[0],
56         .info = NULL,
57         .session = AFB_SESSION_NONE_V2
58     },
59     {
60         .verb = "volume",
61         .callback = Ucs2volumeAPI,
62         .auth = &_afb_auths_v2_UNICENS[1],
63         .info = NULL,
64         .session = AFB_SESSION_NONE_V2
65     },
66     {
67         .verb = "monitor",
68         .callback = Ucs2monitorAPI,
69         .auth = &_afb_auths_v2_UNICENS[1],
70         .info = NULL,
71         .session = AFB_SESSION_NONE_V2
72     },
73     { .verb = NULL }
74 };
75
76 const struct afb_binding_v2 afbBindingV2 = {
77     .api = "UNICENS",
78     .specification = _afb_description_v2_UNICENS,
79     .info = NULL,
80     .verbs = _afb_verbs_v2_UNICENS,
81     .preinit = NULL,
82     .init = NULL,
83     .onevent = NULL,
84     .noconcurrency = 0
85 };
86