- a = json_object_new_array();
- json_object_object_add(f, "name", json_object_new_string(verb->name));
- json_object_object_add(f, "info", json_object_new_string(verb->info));
- if (verb->session & AFB_SESSION_CLOSE)
- json_object_array_add(a, json_object_new_string("session-close"));
- if (verb->session & AFB_SESSION_RENEW)
- json_object_array_add(a, json_object_new_string("session-renew"));
- if (verb->session & AFB_SESSION_CHECK)
- json_object_array_add(a, json_object_new_string("session-check"));
- if (verb->session & AFB_SESSION_LOA_EQ) {
- const char *rel = "?";
- char buffer[80];
- switch (verb->session & AFB_SESSION_LOA_EQ) {
- case AFB_SESSION_LOA_GE: rel = ">="; break;
- case AFB_SESSION_LOA_LE: rel = "<="; break;
- case AFB_SESSION_LOA_EQ: rel = "=="; break;
- }
- snprintf(buffer, sizeof buffer, "LOA%s%d", rel, (int)((verb->session >> AFB_SESSION_LOA_SHIFT) & AFB_SESSION_LOA_MASK));
- json_object_array_add(a, json_object_new_string(buffer));
- }
- json_object_object_add(f, "flags", a);
- json_object_object_add(v, verb->name, f);
+ json_object_object_add(p, buffer, f);
+ g = json_object_new_object();
+ json_object_object_add(f, "get", g);
+
+ a = NULL;
+ if (verb->session & AFB_SESSION_CLOSE_X1)
+ a = addperm_key_valstr(a, "session", "close");
+ if (verb->session & AFB_SESSION_CHECK_X1)
+ a = addperm_key_valstr(a, "session", "check");
+ if (verb->session & AFB_SESSION_RENEW_X1)
+ a = addperm_key_valstr(a, "token", "refresh");
+ if (verb->session & AFB_SESSION_LOA_MASK_X1)
+ a = addperm_key_valint(a, "LOA", (verb->session >> AFB_SESSION_LOA_SHIFT_X1) & AFB_SESSION_LOA_MASK_X1);
+ if (a)
+ json_object_object_add(g, "x-permissions", a);
+
+ a = json_object_new_object();
+ json_object_object_add(g, "responses", a);
+ f = json_object_new_object();
+ json_object_object_add(a, "200", f);
+ json_object_object_add(f, "description", json_object_new_string(verb->info));