Add fetchUserByName, fetchUserByID

They're pretty equivalent.
This commit is contained in:
insweater 2015-02-05 18:14:22 +03:00
parent 99c4cd0a13
commit 32160d95d2

View File

@ -52,6 +52,28 @@ function GJ.authUser(name, token)
return s
end
function GJ.fetchUserByName(name)
local r = req("users/?username=" .. name, "keypair", false, false)
local t = {}
parseKeypair(r, function(k, v)
t[k] = v
end)
return t
end
function GJ.fetchUserByID(id)
local r = req("users/?user_id=" .. id, "keypair", false, false)
local t = {}
parseKeypair(r, function(k, v)
t[k] = v
end)
return t
end
-- sessions
function GJ.openSession()
return string.find(req("sessions/open/?", "dump", true, true), "SUCCESS") ~= nil