ExperimentalGear/docs/lua_api/http.lua

40 lines
1.1 KiB
Lua

-- Global `Http` table
---@class Http
Http = {
}
---@class HttpResponse
---@field cookies string
---@field double number
---@field header table<string, string>
---@field status integer
---@field error string
---@field text string
---@field url string
HttpResponse = {}
-- Executes a blocking `GET` request
---@param url string
---@param header table<string, string>
---@return HttpResponse
Http.Get = function(url, header) end
-- Executes a `GET` request and calls `callback` with `HttpResponse` as a parameter
---@param url string
---@param header table<string, string>
---@param callback function
Http.GetAsync = function(url, header, callback) end
-- Executes a blocking `POST` request
---@param url string
---@param content string
---@param header table<string, string>
---@return HttpResponse
Http.Post = function(url, content, header) end
-- Executes a `POST` request and calls `callback` with `HttpResponse` as a parameter
---@param url string
---@param header table<string, string>
---@param callback function
Http.PostAsync = function(url, header, callback) end