local App42API = require("App42-Lua-API.App42API")
local queryBuilder = require("App42-Lua-API.QueryBuilder")
local JSON = require("App42-Lua-API.JSON")
--local userService = App42API:buildUserService()
local userName = "Serafettin"
local key1 = "name"
local value1 = "hg"
local query = queryBuilder:build(key1, value1, Operator.EQUALS)
App42API:setDbName("TESTDB1");
App42API:initialize(Constant.apiKey,Constant.secretKey)
local userService = App42API:buildUserService()
userService:setQuery("users",query);
local App42CallBack = {}
userService:getUser(userName,App42CallBack)
function App42CallBack:onSuccess(object)
print("userName is "..object:getUserName())
print("emailId is "..object:getEmail())
print("getDocId is "..object:getJsonDocList():getDocId())
print("getCreatedAt is "..object:getJsonDocList():getCreatedAt());
print("getUpdatedAt is "..object:getJsonDocList():getUpdatedAt());
print("Doclist Name is "..JSON:encode(object:getJsonDocList():getJsonDoc()));
end
function App42CallBack:onException(exception)
print("Message is : "..exception:getMessage())
print("App Error code is : "..exception:getAppErrorCode())
print("Http Error code is "..exception:getHttpErrorCode())
print("Detail is : "..exception:getDetails())
end