doc_type: code

content: encodeSHA256("payload_data", checksum)


block_type: addResult

content:
encodeSHA256("payload_data", checksum)
addResult(checksum)


block_type: registerEndpoint

content: registerEndpoint("/hello_world","GET",[],"HELLO_WORLD",main,result)


block_type: addVar

content:
registerEndpoint("/hello_world","GET",[],"HELLO_WORLD",main,result)
addVar(name,"Alberto")


block_type: assignment

content:
addVar(name,"Alberto")
result = "Hello," + name


content:
result = "Hello," + name
addResult(result)


content: addVar(mensaje, "Hola mundo desde AVAP")


content:
addVar(mensaje, "Hola mundo desde AVAP")
addResult(mensaje)


block_type: addParam

content: addParam("emails", emails)


block_type: getQueryParamList

content:
addParam("emails", emails)
getQueryParamList("lista_correos", lista_correos)


content:
getQueryParamList("lista_correos", lista_correos)
addResult(lista_correos)


content: addParam("lang", l)


block_type: if

content:
addParam("lang", l)
if(l, "es", "=")
    addVar(msg, "Hola")
end()


content:
if(l, "es", "=")
    addVar(msg, "Hola")
end()
addResult(msg)


content:
nombre = "Sistema"
log = "Evento registrado por: %s" % nombre


content:
nombre = "Sistema"
log = "Evento registrado por: %s" % nombre
addResult(log)


content:
addParam("password",pass_nueva)
pass_antigua = "password"


content:
pass_antigua = "password"
if(pass_nueva, pass_antigua, "!=")
        addVar(cambio, "Contraseña actualizada")
end()


content:
if(pass_nueva, pass_antigua, "!=")
        addVar(cambio, "Contraseña actualizada")
end()
addResult(cambio)


block_type: replace

content: replace("REF_1234_OLD","OLD", "NEW", ref_actualizada)


content:
replace("REF_1234_OLD","OLD", "NEW", ref_actualizada)
addResult(ref_actualizada)


block_type: try

content:
try()
    ormDirect("UPDATE table_inexistente SET a=1", res)
exception(e)
    addVar(_status, 500)
    addVar(error_msg, "Error de base de datos")
    addResult(error_msg)
end()


content:
addParam("sal_par",saldo)
if(saldo, 0, ">")
    permitir = True
else()
    permitir = False
end()


content:
else()
    permitir = False
end()
addResult(permitir)


content:
addParam("userrype", user_type)
addParam("sells", compras)


content:
addParam("userrype", user_type)
addParam("sells", compras)
if(None, None, " user_type == 'VIP' or compras > 100")
    addVar(descuento, 0.20)
end()


content:
if(None, None, " user_type == 'VIP' or compras > 100")
    addVar(descuento, 0.20)
end()
addResult(descuento)


block_type: getDateTime

content: getDateTime("%Y-%m-%d %H:%M:%S", 0, "Europe/Madrid", sql_date)


content:
getDateTime("%Y-%m-%d %H:%M:%S", 0, "Europe/Madrid", sql_date)
addResult(sql_date)


content: registros = ['1','2','3']


block_type: getListLen

content:
registros = ['1','2','3']
getListLen(registros, total)


content:
getListLen(registros, total)
contador = 0


block_type: startLoop

content:
contador = 0
startLoop(idx, 0, 2)
    actual = registros[int(idx)]
endLoop()


content:
startLoop(idx, 0, 2)
    actual = registros[int(idx)]
endLoop()
addResult(actual)


content: getDateTime("", 86400, "UTC", expira)


content:
getDateTime("", 86400, "UTC", expira)
addResult(expira)


content: addParam("client_id", id_interno)


content:
addParam("client_id", id_interno)
addResult(id_interno)


content:
try()
    RequestGet("https://api.test.com/data", 0, 0, respuesta, None)
exception(e)
    addVar(error_trace, e)
    addResult(error_trace)
end()


content: addParam("api_key", key)


content:
addParam("api_key", key)
if(key, None, "==")
    addVar(_status, 403)
    addVar(error, "Acceso denegado: falta API KEY")
    addResult(error)
end()


content: addParam("rol", r)


content:
addParam("rol", r)
acceso = False


content:
acceso = False
if(None, None, "r == 'admin' or r == 'editor' or r == 'root'")
    acceso = True
end()


content:
if(None, None, "r == 'admin' or r == 'editor' or r == 'root'")
    acceso = True
end()
addResult(acceso)


content: datos_cliente = "datos"


content:
datos_cliente = "datos"
addVar(clave, "cliente_vip")


block_type: addVariableToJSON

content:
addVar(clave, "cliente_vip")
AddvariableToJSON(clave, datos_cliente, mi_json_final)


content:
AddvariableToJSON(clave, datos_cliente, mi_json_final)
addResult(mi_json_final)


content: addParam("data_list", mi_lista)


content:
addParam("data_list", mi_lista)
getListLen(mi_lista, cantidad)


content:
getListLen(mi_lista, cantidad)
addResult(cantidad)


block_type: stampToDatetime

content: stampToDatetime(1708726162, "%d/%m/%Y", 0, fecha_human)


content:
stampToDatetime(1708726162, "%d/%m/%Y", 0, fecha_human)
addResult(fecha_human)


content:
addVar(base, 1000)
addVar(copia, $base)


content:
addVar(base, 1000)
addVar(copia, $base)
addResult(copia)


content:
addVar(code, 200)
addVar(status, "Success")


content:
addVar(code, 200)
addVar(status, "Success")
addResult(code)
addResult(status)


content: encontrado = False


content:
encontrado = False
startLoop(i, 1, 10)
    if(i, 5, "==")
        encontrado = True
        i = 11
    end()
endLoop()


content:
i = 11
    end()
endLoop()
addResult(encontrado)


block_type: function

content:
function suma(a, b){
        total = a + b
        return(total)
    }


function suma(a, b)


content:
// contexto: function suma(a, b)
resultado = suma(10, 20)


content:
// contexto: function suma(a, b)
addResult(resultado)


content:
function es_valido(token){
    response = False
    if(token, "SECRET", "=")
        response = True
    end()
    return(response)
    }


function es_valido(token)


content:
// contexto: function es_valido(token)
autorizado = es_valido("SECRET")


content:
// contexto: function es_valido(token)
addResult(autorizado)


block_type: randomString

content: randomString("[A-Z]\d", 32, token_seguridad)


content:
randomString("[A-Z]\d", 32, token_seguridad)
addResult(token_seguridad)


content: getDateTime("", 0, "UTC", ahora)


content:
getDateTime("", 0, "UTC", ahora)
addResult(ahora)


content: ormCheckTable(tabla_pruebas,resultado_comprobacion)


content:
ormCheckTable(tabla_pruebas,resultado_comprobacion)
if(resultado_comprobacion,False,'==')
    ormCreateTable("username,age",'VARCHAR,INTEGER',tabla_pruebas,resultado_creacion)
end()


content:
if(resultado_comprobacion,False,'==')
    ormCreateTable("username,age",'VARCHAR,INTEGER',tabla_pruebas,resultado_creacion)
end()
addResult(resultado_comprobacion)
addResult(resultado_creacion)


content:
addParam("page", p)
addParam("size", s)


content:
addParam("page", p)
addParam("size", s)
registros = ["u1", "u2", "u3", "u4", "u5", "u6"]
offset = int(p) * int(s)
limite = offset + int(s)
contador = 0


content:
offset = int(p) * int(s)
limite = offset + int(s)
contador = 0
addResult(offset)
addResult(limite)


content:
addResult(offset)
addResult(limite)
startLoop(i, 2, limite)
    actual = registros[int(i)]
    titulo = "reg_%s" % i
    AddvariableToJSON(titulo, actual, pagina_json)
endLoop()


content:
titulo = "reg_%s" % i
    AddvariableToJSON(titulo, actual, pagina_json)
endLoop()
addResult(pagina_json)


content:
nivel = 5
es_admin = nivel >= 10


content:
nivel = 5
es_admin = nivel >= 10
addResult(es_admin)


content:
subtotal = 150.50
iva = subtotal * 0.21
total = subtotal + iva


content:
subtotal = 150.50
iva = subtotal * 0.21
total = subtotal + iva
addResult(total)


content:
startLoop(i,1,10)
        item = "item_%s" % i
        AddvariableToJSON(item,'valor_generado',mi_json)
endLoop()


content:
item = "item_%s" % i
        AddvariableToJSON(item,'valor_generado',mi_json)
endLoop()
addResult(mi_json)