-STATIC AFB_restapi pluginApis[]= {
- {"ping" , AFB_SESSION_NONE, (AFB_apiCB)pingSample , "Ping Application Framework"},
- {"pingnull" , AFB_SESSION_NONE, (AFB_apiCB)pingFail , "Return NULL"},
- {"pingbug" , AFB_SESSION_NONE, (AFB_apiCB)pingBug , "Do a Memory Violation"},
- {"pingJson" , AFB_SESSION_NONE, (AFB_apiCB)pingJson , "Return a JSON object"},
+ if (object == NULL)
+ afb_req_fail(request, "failed", "bad arguments");
+ else
+ afb_req_subcall(request, api, verb, object, subcallcb, afb_req_store(request));
+}
+
+// NOTE: this sample does not use session to keep test a basic as possible
+// in real application most APIs should be protected with AFB_SESSION_CHECK
+static const struct AFB_verb_desc_v1 verbs[]= {
+ {"ping" , AFB_SESSION_NONE, pingSample , "Ping Application Framework"},
+ {"pingfail" , AFB_SESSION_NONE, pingFail , "Fails"},
+ {"pingnull" , AFB_SESSION_NONE, pingNull , "Return NULL"},
+ {"pingbug" , AFB_SESSION_NONE, pingBug , "Do a Memory Violation"},
+ {"pingJson" , AFB_SESSION_NONE, pingJson , "Return a JSON object"},
+ {"pingevent", AFB_SESSION_NONE, pingEvent , "Send an event"},
+ {"subcall", AFB_SESSION_NONE, subcall , "Call api/verb(args)"},