mirror of
https://github.com/gmod-integration/lua.git
synced 2025-03-15 22:07:34 +00:00
add gmInte.http.METHOD insted of gmInte.METHOD
This commit is contained in:
parent
909b429111
commit
28c064241a
|
@ -163,9 +163,6 @@ local possibleConfig = {
|
||||||
["label"] = "Force Player Verif",
|
["label"] = "Force Player Verif",
|
||||||
["description"] = "Sync chat between the server and the discord server.",
|
["description"] = "Sync chat between the server and the discord server.",
|
||||||
["type"] = "checkbox",
|
["type"] = "checkbox",
|
||||||
["condition"] = function(data)
|
|
||||||
return false // Disabled for now
|
|
||||||
end,
|
|
||||||
["value"] = function(setting, value)
|
["value"] = function(setting, value)
|
||||||
return value
|
return value
|
||||||
end,
|
end,
|
||||||
|
|
|
@ -37,7 +37,7 @@ function gmInte.openVerifPopup()
|
||||||
local button = vgui.Create("DButton")
|
local button = vgui.Create("DButton")
|
||||||
button:SetText("Refresh Verification")
|
button:SetText("Refresh Verification")
|
||||||
button.DoClick = function()
|
button.DoClick = function()
|
||||||
gmInte.get("/players/" .. LocalPlayer():SteamID64(), function(code, body)
|
gmInte.http.get("/players/" .. LocalPlayer():SteamID64(), function(code, body)
|
||||||
gmInte.SendNet(6)
|
gmInte.SendNet(6)
|
||||||
frame:Close()
|
frame:Close()
|
||||||
end,
|
end,
|
||||||
|
|
|
@ -12,6 +12,15 @@ local function formatName(name)
|
||||||
return name
|
return name
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function gmInte.chatAddText(data)
|
||||||
|
local args = {}
|
||||||
|
for _, v in ipairs(data) do
|
||||||
|
table.insert(args, v.color)
|
||||||
|
table.insert(args, v.text)
|
||||||
|
end
|
||||||
|
chat.AddText(unpack(args))
|
||||||
|
end
|
||||||
|
|
||||||
function gmInte.discordSyncChatPly(data)
|
function gmInte.discordSyncChatPly(data)
|
||||||
chat.AddText(Color(92, 105, 255), "(DISCORD) ", Color(12, 151, 12), formatName(data.name) .. ": ", Color(255, 255, 255), data.content)
|
chat.AddText(Color(92, 105, 255), "(DISCORD) ", Color(12, 151, 12), formatName(data.name) .. ": ", Color(255, 255, 255), data.content)
|
||||||
end
|
end
|
||||||
|
|
|
@ -16,6 +16,9 @@ Receive
|
||||||
2 - Get Config
|
2 - Get Config
|
||||||
3 - Test Connection
|
3 - Test Connection
|
||||||
4 - Take ScreenShot
|
4 - Take ScreenShot
|
||||||
|
5 - Set Public Config
|
||||||
|
6 - Add Chat
|
||||||
|
7 - Open Verif Popup
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Send
|
// Send
|
||||||
|
@ -40,6 +43,15 @@ local netFunc = {
|
||||||
end,
|
end,
|
||||||
[4] = function(data)
|
[4] = function(data)
|
||||||
gmInte.takeScreenShot(data.serverID, data.authToken)
|
gmInte.takeScreenShot(data.serverID, data.authToken)
|
||||||
|
end,
|
||||||
|
[5] = function(data)
|
||||||
|
gmInte.config = data
|
||||||
|
end,
|
||||||
|
[6] = function(data)
|
||||||
|
gmInte.chatAddText(data)
|
||||||
|
end,
|
||||||
|
[7] = function()
|
||||||
|
gmInte.openVerifPopup()
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ hook.Add("PostRender", "gmInteScreenshot", function()
|
||||||
screenCapture = util.Base64Encode(screenCapture)
|
screenCapture = util.Base64Encode(screenCapture)
|
||||||
gmInte.log("Screenshot Taken - " .. string.len(#screenCapture / 1024) .. "KB", true)
|
gmInte.log("Screenshot Taken - " .. string.len(#screenCapture / 1024) .. "KB", true)
|
||||||
|
|
||||||
gmInte.post("/screenshots",
|
gmInte.http.post("/screenshots",
|
||||||
{
|
{
|
||||||
["steamID64"] = LocalPlayer():SteamID64(),
|
["steamID64"] = LocalPlayer():SteamID64(),
|
||||||
["screenshot"] = screenCapture,
|
["screenshot"] = screenCapture,
|
||||||
|
|
|
@ -56,9 +56,9 @@ local function playerFilter(data)
|
||||||
if (data.bot == 1) then return end
|
if (data.bot == 1) then return end
|
||||||
data.steamID64 = util.SteamIDTo64(data.networkid)
|
data.steamID64 = util.SteamIDTo64(data.networkid)
|
||||||
|
|
||||||
gmInte.get("/players/" .. data.steamID64,
|
gmInte.http.get("/players/" .. data.steamID64,
|
||||||
function(code, body)
|
function(code, body)
|
||||||
if (!body.trust) then return end
|
if (!body || !body.trust) then return end
|
||||||
|
|
||||||
if (!checkBanStatus(body.ban)) then
|
if (!checkBanStatus(body.ban)) then
|
||||||
game.KickID(data.networkid, filterMessage("You are banned from this server"))
|
game.KickID(data.networkid, filterMessage("You are banned from this server"))
|
||||||
|
|
|
@ -63,7 +63,7 @@ end
|
||||||
function gmInte.postLogPlayerSay(ply, text, teamChat)
|
function gmInte.postLogPlayerSay(ply, text, teamChat)
|
||||||
if (!validLogAndPlayers({ply})) then return end
|
if (!validLogAndPlayers({ply})) then return end
|
||||||
|
|
||||||
gmInte.post("/logs/playerSay",
|
gmInte.http.post("/logs/playerSay",
|
||||||
{
|
{
|
||||||
["ply"] = gmInte.playerFormat(ply),
|
["ply"] = gmInte.playerFormat(ply),
|
||||||
["text"] = text,
|
["text"] = text,
|
||||||
|
@ -75,7 +75,7 @@ end
|
||||||
function gmInte.postLogPlayerDeath(ply, inflictor, attacker)
|
function gmInte.postLogPlayerDeath(ply, inflictor, attacker)
|
||||||
if (!validLogAndPlayers({ply, attacker})) then return end
|
if (!validLogAndPlayers({ply, attacker})) then return end
|
||||||
|
|
||||||
gmInte.post("/logs/playerDeath",
|
gmInte.http.post("/logs/playerDeath",
|
||||||
{
|
{
|
||||||
["ply"] = gmInte.playerFormat(ply),
|
["ply"] = gmInte.playerFormat(ply),
|
||||||
["inflictor"] = logFormatEntity(inflictor),
|
["inflictor"] = logFormatEntity(inflictor),
|
||||||
|
@ -87,7 +87,7 @@ end
|
||||||
function gmInte.postLogPlayerInitialSpawn(ply)
|
function gmInte.postLogPlayerInitialSpawn(ply)
|
||||||
if (!validLogAndPlayers({ply})) then return end
|
if (!validLogAndPlayers({ply})) then return end
|
||||||
|
|
||||||
gmInte.post("/logs/playerInitialSpawn",
|
gmInte.http.post("/logs/playerInitialSpawn",
|
||||||
{
|
{
|
||||||
["ply"] = gmInte.playerFormat(ply)
|
["ply"] = gmInte.playerFormat(ply)
|
||||||
}
|
}
|
||||||
|
@ -109,7 +109,7 @@ function gmInte.postLogPlayerHurt(ply, attacker, healthRemaining, damageTaken)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
gmInte.post("/logs/playerHurt",
|
gmInte.http.post("/logs/playerHurt",
|
||||||
{
|
{
|
||||||
["ply"] = gmInte.playerFormat(ply),
|
["ply"] = gmInte.playerFormat(ply),
|
||||||
["attacker"] = gmInte.playerFormat(attacker),
|
["attacker"] = gmInte.playerFormat(attacker),
|
||||||
|
@ -123,7 +123,7 @@ end
|
||||||
function gmInte.postLogPlayerSpawnedSomething(object, ply, ent, model)
|
function gmInte.postLogPlayerSpawnedSomething(object, ply, ent, model)
|
||||||
if (!validLogAndPlayers({ply})) then return end
|
if (!validLogAndPlayers({ply})) then return end
|
||||||
|
|
||||||
gmInte.post("/logs/playerSpawnedSomething",
|
gmInte.http.post("/logs/playerSpawnedSomething",
|
||||||
{
|
{
|
||||||
["object"] = object,
|
["object"] = object,
|
||||||
["ply"] = gmInte.playerFormat(ply),
|
["ply"] = gmInte.playerFormat(ply),
|
||||||
|
@ -136,7 +136,7 @@ end
|
||||||
function gmInte.postLogPlayerSpawn(ply)
|
function gmInte.postLogPlayerSpawn(ply)
|
||||||
if (!validLogAndPlayers({ply})) then return end
|
if (!validLogAndPlayers({ply})) then return end
|
||||||
|
|
||||||
gmInte.post("/logs/playerSpawn",
|
gmInte.http.post("/logs/playerSpawn",
|
||||||
{
|
{
|
||||||
["ply"] = gmInte.playerFormat(ply)
|
["ply"] = gmInte.playerFormat(ply)
|
||||||
}
|
}
|
||||||
|
@ -146,7 +146,7 @@ end
|
||||||
function gmInte.postLogPlayerDisconnect(ply)
|
function gmInte.postLogPlayerDisconnect(ply)
|
||||||
if (!validLogAndPlayers({ply})) then return end
|
if (!validLogAndPlayers({ply})) then return end
|
||||||
|
|
||||||
gmInte.post("/logs/playerDisconnect",
|
gmInte.http.post("/logs/playerDisconnect",
|
||||||
{
|
{
|
||||||
["ply"] = gmInte.playerFormat(ply)
|
["ply"] = gmInte.playerFormat(ply)
|
||||||
}
|
}
|
||||||
|
@ -156,7 +156,7 @@ end
|
||||||
function gmInte.postLogPlayerConnect(data)
|
function gmInte.postLogPlayerConnect(data)
|
||||||
if (logDisable() || data.bot) then return end
|
if (logDisable() || data.bot) then return end
|
||||||
|
|
||||||
gmInte.post("/logs/playerConnect",
|
gmInte.http.post("/logs/playerConnect",
|
||||||
{
|
{
|
||||||
["steamID64"] = util.SteamIDTo64(data.networkid),
|
["steamID64"] = util.SteamIDTo64(data.networkid),
|
||||||
["steamID"] = data.networkid,
|
["steamID"] = data.networkid,
|
||||||
|
@ -169,7 +169,7 @@ end
|
||||||
function gmInte.postLogPlayerGivet(ply, class, swep)
|
function gmInte.postLogPlayerGivet(ply, class, swep)
|
||||||
if (!validLogAndPlayers({ply})) then return end
|
if (!validLogAndPlayers({ply})) then return end
|
||||||
|
|
||||||
gmInte.post("/logs/playerGive",
|
gmInte.http.post("/logs/playerGive",
|
||||||
{
|
{
|
||||||
["ply"] = gmInte.playerFormat(ply),
|
["ply"] = gmInte.playerFormat(ply),
|
||||||
["class"] = class,
|
["class"] = class,
|
||||||
|
|
|
@ -8,6 +8,9 @@ Upload
|
||||||
2 - Get Config
|
2 - Get Config
|
||||||
3 - Test Connection
|
3 - Test Connection
|
||||||
4 - Take Screenshot
|
4 - Take Screenshot
|
||||||
|
5 - Send Public Config
|
||||||
|
6 - Send Message
|
||||||
|
7 - Open Verif Popup
|
||||||
Receive
|
Receive
|
||||||
0 - Player is Ready
|
0 - Player is Ready
|
||||||
1 - Test Connection
|
1 - Test Connection
|
||||||
|
|
|
@ -77,48 +77,64 @@ end
|
||||||
|
|
||||||
function gmInte.verifyPlayer(ply)
|
function gmInte.verifyPlayer(ply)
|
||||||
if (!gmInte.plyValid(ply)) then return end
|
if (!gmInte.plyValid(ply)) then return end
|
||||||
gmInte.get("/players/" .. ply:SteamID64(), function(data)
|
gmInte.http.get("/players/" .. ply:SteamID64(), function(code, data)
|
||||||
if (data.discordID && ply.gmIntUnVerified) then
|
if ((data && data.steam_id && ply.gmIntUnVerified) || !gmInte.config.forcePlayerLink) then
|
||||||
|
gmInte.SendNet(6, {
|
||||||
|
[1] = {
|
||||||
|
["text"] = "You have been verified",
|
||||||
|
["color"] = Color(255, 255, 255)
|
||||||
|
}
|
||||||
|
}, ply)
|
||||||
ply:Freeze(false)
|
ply:Freeze(false)
|
||||||
ply.gmIntUnVerified = false
|
ply.gmIntUnVerified = false
|
||||||
|
else
|
||||||
|
gmInte.SendNet(6, {
|
||||||
|
[1] = {
|
||||||
|
["text"] = "You are not verified",
|
||||||
|
["color"] = Color(255, 0, 0)
|
||||||
|
}
|
||||||
|
}, ply)
|
||||||
|
ply:Freeze(true)
|
||||||
|
ply.gmIntUnVerified = true
|
||||||
|
gmInte.SendNet(7, nil, ply)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
// Generate a unique token that allow player to update data link to this server (ex: screnshot, report bug, etc.)
|
// Generate a unique token that allow player to update data link to this server (ex: screnshot, report bug, etc.)
|
||||||
function gmInte.getClientOneTimeToken(ply, callback)
|
function gmInte.getClientOneTimeToken(ply, callback)
|
||||||
gmInte.get("/players/" .. ply:SteamID64() .. "/get-one-time-token", function(data)
|
gmInte.http.get("/players/" .. ply:SteamID64() .. "/get-one-time-token", function(code, data)
|
||||||
callback(data.token)
|
callback(data.token)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
function gmInte.playerConnect(data)
|
function gmInte.playerConnect(data)
|
||||||
gmInte.post("/players/" .. util.SteamIDTo64(data.networkid) .. "/connect", data)
|
gmInte.http.post("/players/" .. util.SteamIDTo64(data.networkid) .. "/connect", data)
|
||||||
end
|
end
|
||||||
|
|
||||||
function gmInte.userFinishConnect(ply)
|
function gmInte.userFinishConnect(ply)
|
||||||
if (!gmInte.plyValid(ply)) then return end
|
if (!gmInte.plyValid(ply)) then return end
|
||||||
|
|
||||||
|
// Initialize Time
|
||||||
ply.gmIntTimeConnect = math.Round(RealTime())
|
ply.gmIntTimeConnect = math.Round(RealTime())
|
||||||
|
|
||||||
gmInte.post("/players/" .. ply:SteamID64() .. "/finish-connect",
|
// Send Public Config
|
||||||
|
gmInte.publicGetConfig(ply)
|
||||||
|
|
||||||
|
gmInte.http.post("/players/" .. ply:SteamID64() .. "/finish-connect",
|
||||||
{
|
{
|
||||||
["player"] = gmInte.playerFormat(ply),
|
["player"] = gmInte.playerFormat(ply),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
if (!gmInte.config.forcePlayerLink) then return end
|
if (!gmInte.config.forcePlayerLink) then return end
|
||||||
gmInte.get("/players/" .. ply:SteamID64(), function(data)
|
gmInte.verifyPlayer(ply)
|
||||||
if (!data.discordID) then
|
|
||||||
ply:Freeze(true)
|
|
||||||
ply.gmIntUnVerified = true
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function gmInte.playerDisconnected(ply)
|
function gmInte.playerDisconnected(ply)
|
||||||
if (!gmInte.plyValid(ply)) then return end
|
if (!gmInte.plyValid(ply)) then return end
|
||||||
|
|
||||||
gmInte.post("/players/" .. ply:SteamID64() .. "/disconnect",
|
gmInte.http.post("/players/" .. ply:SteamID64() .. "/disconnect",
|
||||||
{
|
{
|
||||||
["player"] = gmInte.playerFormat(ply),
|
["player"] = gmInte.playerFormat(ply),
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ function gmInte.saveSetting(setting, value)
|
||||||
end
|
end
|
||||||
|
|
||||||
function gmInte.tryConfig()
|
function gmInte.tryConfig()
|
||||||
gmInte.get("",
|
gmInte.http.get("",
|
||||||
function(code, body)
|
function(code, body)
|
||||||
print(" ")
|
print(" ")
|
||||||
gmInte.log("Congratulations your server is now connected to Gmod Integration")
|
gmInte.log("Congratulations your server is now connected to Gmod Integration")
|
||||||
|
@ -29,7 +29,7 @@ function gmInte.tryConfig()
|
||||||
end
|
end
|
||||||
|
|
||||||
function gmInte.testConnection(ply)
|
function gmInte.testConnection(ply)
|
||||||
gmInte.get("",
|
gmInte.http.get("",
|
||||||
function(code, body)
|
function(code, body)
|
||||||
if (ply) then gmInte.SendNet(3, body, ply) end
|
if (ply) then gmInte.SendNet(3, body, ply) end
|
||||||
end,
|
end,
|
||||||
|
@ -52,6 +52,15 @@ function gmInte.superadminGetConfig(ply)
|
||||||
gmInte.SendNet(2, gmInte.config, ply)
|
gmInte.SendNet(2, gmInte.config, ply)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function gmInte.publicGetConfig(ply)
|
||||||
|
if (!gmInte.plyValid(ply)) then return end
|
||||||
|
|
||||||
|
gmInte.SendNet(5, {
|
||||||
|
["debug"] = gmInte.config.debug,
|
||||||
|
["devInstance"] = gmInte.config.devInstance
|
||||||
|
}, ply)
|
||||||
|
end
|
||||||
|
|
||||||
function gmInte.superadminSetConfig(ply, data)
|
function gmInte.superadminSetConfig(ply, data)
|
||||||
if (!gmInte.plyValid(ply) || !ply:IsSuperAdmin()) then return end
|
if (!gmInte.plyValid(ply) || !ply:IsSuperAdmin()) then return end
|
||||||
|
|
||||||
|
|
|
@ -16,15 +16,15 @@ local function getServerFormat()
|
||||||
end
|
end
|
||||||
|
|
||||||
function gmInte.sendStatus()
|
function gmInte.sendStatus()
|
||||||
gmInte.post("/status", getServerFormat())
|
gmInte.http.post("/status", getServerFormat())
|
||||||
end
|
end
|
||||||
|
|
||||||
-- function gmInte.serverStart()
|
-- function gmInte.serverStart()
|
||||||
-- gmInte.post("/start", getServerFormat())
|
-- gmInte.http.post("/start", getServerFormat())
|
||||||
-- end
|
-- end
|
||||||
|
|
||||||
function gmInte.serverShutDown()
|
function gmInte.serverShutDown()
|
||||||
gmInte.post("/shutdown")
|
gmInte.http.post("/shutdown")
|
||||||
end
|
end
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -15,7 +15,7 @@ end
|
||||||
//
|
//
|
||||||
|
|
||||||
function gmInte.playerBan(data)
|
function gmInte.playerBan(data)
|
||||||
gmInte.post("/players/" .. util.SteamIDTo64(data.networkid) .. "/bans", data)
|
gmInte.http.post("/players/" .. util.SteamIDTo64(data.networkid) .. "/bans", data)
|
||||||
end
|
end
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -13,7 +13,7 @@ end
|
||||||
function gmInte.playerSay(ply, text, team)
|
function gmInte.playerSay(ply, text, team)
|
||||||
if (!gmInte.config.syncChat) then return end
|
if (!gmInte.config.syncChat) then return end
|
||||||
|
|
||||||
gmInte.post("/players/" .. ply:SteamID64() .. "/say",
|
gmInte.http.post("/players/" .. ply:SteamID64() .. "/say",
|
||||||
{
|
{
|
||||||
["player"] = gmInte.playerFormat(ply),
|
["player"] = gmInte.playerFormat(ply),
|
||||||
["text"] = text,
|
["text"] = text,
|
||||||
|
|
|
@ -15,7 +15,7 @@ end
|
||||||
function gmInte.playerChangeName(ply, oldName, newName)
|
function gmInte.playerChangeName(ply, oldName, newName)
|
||||||
if (!gmInte.plyValid(ply)) then return end
|
if (!gmInte.plyValid(ply)) then return end
|
||||||
|
|
||||||
gmInte.post("/players/" .. ply:SteamID64() .. "/name",
|
gmInte.http.post("/players/" .. ply:SteamID64() .. "/name",
|
||||||
{
|
{
|
||||||
["player"] = gmInte.playerFormat(ply),
|
["player"] = gmInte.playerFormat(ply),
|
||||||
["oldName"] = oldName,
|
["oldName"] = oldName,
|
||||||
|
|
|
@ -2,6 +2,8 @@ local apiVersion = "v3"
|
||||||
local apiFQDN = "api.gmod-integration.com"
|
local apiFQDN = "api.gmod-integration.com"
|
||||||
local apiDevFQDN = "dev-api.gmod-integration.com"
|
local apiDevFQDN = "dev-api.gmod-integration.com"
|
||||||
|
|
||||||
|
gmInte.http = gmInte.http || {}
|
||||||
|
|
||||||
//
|
//
|
||||||
// HTTP
|
// HTTP
|
||||||
//
|
//
|
||||||
|
@ -11,14 +13,18 @@ local function getAPIURL(endpoint)
|
||||||
|
|
||||||
if (SERVER) then
|
if (SERVER) then
|
||||||
url = url .. "/servers/" .. gmInte.config.id
|
url = url .. "/servers/" .. gmInte.config.id
|
||||||
elseif (endpoint == "/players") then
|
else
|
||||||
|
if (string.sub(endpoint, 1, 8) == "/players" || string.sub(endpoint, 1, 7) == "/errors") then
|
||||||
|
return url .. endpoint
|
||||||
|
end
|
||||||
|
|
||||||
url = url .. "/clients/" .. LocalPlayer():SteamID64()
|
url = url .. "/clients/" .. LocalPlayer():SteamID64()
|
||||||
end
|
end
|
||||||
|
|
||||||
return url .. endpoint
|
return url .. endpoint
|
||||||
end
|
end
|
||||||
|
|
||||||
function gmInte.requestAPI(params)
|
function gmInte.http.requestAPI(params)
|
||||||
local body = params.body || ""
|
local body = params.body || ""
|
||||||
local bodyLength = string.len(body)
|
local bodyLength = string.len(body)
|
||||||
local token = params.token || gmInte.config.token || ""
|
local token = params.token || gmInte.config.token || ""
|
||||||
|
@ -67,7 +73,7 @@ function gmInte.requestAPI(params)
|
||||||
body = util.JSONToTable(body || "{}")
|
body = util.JSONToTable(body || "{}")
|
||||||
|
|
||||||
// Return success
|
// Return success
|
||||||
return success(code, body, headers)
|
return success(body)
|
||||||
end,
|
end,
|
||||||
["failed"] = function(error)
|
["failed"] = function(error)
|
||||||
gmInte.logError(error)
|
gmInte.logError(error)
|
||||||
|
@ -79,8 +85,8 @@ end
|
||||||
// HTTP Methods
|
// HTTP Methods
|
||||||
//
|
//
|
||||||
|
|
||||||
function gmInte.get(endpoint, onSuccess, onFailed)
|
function gmInte.http.get(endpoint, onSuccess, onFailed)
|
||||||
gmInte.requestAPI({
|
gmInte.http.requestAPI({
|
||||||
["endpoint"] = endpoint,
|
["endpoint"] = endpoint,
|
||||||
["method"] = "GET",
|
["method"] = "GET",
|
||||||
["success"] = onSuccess,
|
["success"] = onSuccess,
|
||||||
|
@ -88,8 +94,8 @@ function gmInte.get(endpoint, onSuccess, onFailed)
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
function gmInte.post(endpoint, data, onSuccess, onFailed)
|
function gmInte.http.post(endpoint, data, onSuccess, onFailed)
|
||||||
gmInte.requestAPI({
|
gmInte.http.requestAPI({
|
||||||
["endpoint"] = endpoint,
|
["endpoint"] = endpoint,
|
||||||
["method"] = "POST",
|
["method"] = "POST",
|
||||||
["body"] = util.TableToJSON(data),
|
["body"] = util.TableToJSON(data),
|
||||||
|
@ -98,8 +104,8 @@ function gmInte.post(endpoint, data, onSuccess, onFailed)
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
function gmInte.put(endpoint, data, onSuccess, onFailed)
|
function gmInte.http.put(endpoint, data, onSuccess, onFailed)
|
||||||
gmInte.requestAPI({
|
gmInte.http.requestAPI({
|
||||||
["endpoint"] = endpoint,
|
["endpoint"] = endpoint,
|
||||||
["method"] = "PUT",
|
["method"] = "PUT",
|
||||||
["body"] = util.TableToJSON(data),
|
["body"] = util.TableToJSON(data),
|
||||||
|
@ -108,8 +114,8 @@ function gmInte.put(endpoint, data, onSuccess, onFailed)
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
function gmInte.delete(endpoint, onSuccess, onFailed)
|
function gmInte.http.delete(endpoint, onSuccess, onFailed)
|
||||||
gmInte.requestAPI({
|
gmInte.http.requestAPI({
|
||||||
["endpoint"] = endpoint,
|
["endpoint"] = endpoint,
|
||||||
["method"] = "DELETE",
|
["method"] = "DELETE",
|
||||||
["success"] = onSuccess,
|
["success"] = onSuccess,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user