nodemcu/Library/RegisterNodemcuClient/lib/LiveQueryObject/LiveQueryObject.c
uint8_t createSubscribeToken(const char * className, const char *key, const char *value, cJSON *subscribeObject)
{
    uint8_t created;
    created = deleteJSONObject_IfNull( cJSON_AddStringToObject(subscribeObject, LIVEQUERY_OP, LIVEQUERY_TO_SUBSCRIBE) );
    created &= deleteJSONObject_IfNull( cJSON_AddNumberToObject(subscribeObject, LIVEQUERY_REQUEST_ID, 1) );

    cJSON * queryObject = cJSON_CreateObject();
    created &= deleteJSONObject_IfNull( cJSON_AddStringToObject(queryObject, LIVEQUERY_CLASSNAME, className) );

    cJSON * identifier_object = cJSON_CreateObject();
    created &= deleteJSONObject_IfNull( cJSON_AddStringToObject(identifier_object, key, value) );    
    cJSON_AddItemToObject(queryObject, LIVEQUERY_WHERE, identifier_object); 

    cJSON_AddItemToObject(subscribeObject, LIVEQUERY_QUERY, queryObject);

    return created;
}
// DONE, Make the fields dynamic
// TODO, Make requestID dynamic
DONE, Make the fields dynamic
TODO, Make requestID dynamic
DONE Make the fields dynamic TODO Make requestID dynamic
uint8_t createSubscribeToken(const char * className, const char *key, const char *value, cJSON *subscribeObject)
{
    uint8_t created;
    created = deleteJSONObject_IfNull( cJSON_AddStringToObject(subscribeObject, LIVEQUERY_OP, LIVEQUERY_TO_SUBSCRIBE) );
    created &= deleteJSONObject_IfNull( cJSON_AddNumberToObject(subscribeObject, LIVEQUERY_REQUEST_ID, 1) );
    cJSON * queryObject = cJSON_CreateObject();
    created &= deleteJSONObject_IfNull( cJSON_AddStringToObject(queryObject, LIVEQUERY_CLASSNAME, className) );
    cJSON * identifier_object = cJSON_CreateObject();
    created &= deleteJSONObject_IfNull( cJSON_AddStringToObject(identifier_object, key, value) );    
    cJSON_AddItemToObject(queryObject, LIVEQUERY_WHERE, identifier_object); 
    cJSON_AddItemToObject(subscribeObject, LIVEQUERY_QUERY, queryObject);
    return created;
}
uint8_t createSubscribeToken ( const char * className , const char * key , const char * value , cJSON * subscribeObject ) { uint8_t created ; created = deleteJSONObject_IfNull ( cJSON_AddStringToObject ( subscribeObject , LIVEQUERY_OP , LIVEQUERY_TO_SUBSCRIBE ) ) ; created &= deleteJSONObject_IfNull ( cJSON_AddNumberToObject ( subscribeObject , LIVEQUERY_REQUEST_ID , 1 ) ) ; cJSON * queryObject = cJSON_CreateObject ( ) ; created &= deleteJSONObject_IfNull ( cJSON_AddStringToObject ( queryObject , LIVEQUERY_CLASSNAME , className ) ) ; cJSON * identifier_object = cJSON_CreateObject ( ) ; created &= deleteJSONObject_IfNull ( cJSON_AddStringToObject ( identifier_object , key , value ) ) ; cJSON_AddItemToObject ( queryObject , LIVEQUERY_WHERE , identifier_object ) ; cJSON_AddItemToObject ( subscribeObject , LIVEQUERY_QUERY , queryObject ) ; return created ; }
DONE, Make the fields dynamic
TODO, Make requestID dynamic
DONE Make the fields dynamic TODO Make requestID dynamic