---@meta lcurl.safe

--------------------------------------------------------------------------------
-- Lua-cURL safe C binding module
--------------------------------------------------------------------------------

---@class lcurl_safe*: lcurl
---@type lcurl_safe*
local M = {}

--- Initialize libcurl, errors in safe mode are given in the form of return values.
---@param initMode? integer initialization mode
---@return boolean|nil ok Returns true or the module's own agreed value on success
---@return lcurl_error*? err error object
function M.init(initMode) end

--- Create an error object.
---@param category string|integer Error classification, available ERROR_* constant or classification name
---@param code integer error code
---@return lcurl_error* err error object
function M.error(category, code) end

--- Create an HTTP multipart/formdata object.
---@return lcurl_form*? form form object
---@return lcurl_error*? err error object
function M.form() end

--- Create easy handle.
---@return lcurl_easy*? easy easy handle
---@return lcurl_error*? err error object
function M.easy() end

--- Create multiple handles.
---@return lcurl_multi*? multi multi handle
---@return lcurl_error*? err error object
function M.multi() end

--- Create share handle.
---@param options? table<lcurl_share_option,any>|table<string,any> Initialization options
---@return lcurl_share*? share share handle
---@return lcurl_error*? err error object
function M.share(options) end

--- Create a URL object.
---@param url? string Initial URL
---@param flags? lcurl_url_flag URL flag
---@return lcurl_url*? url URL object
---@return lcurl_error*? err error object
function M.url(url, flags) end

--- Get the libcurl version string.
---@return string version version string
function M.version() end

--- Get libcurl version information.
---@param param? string Specify field name
---@return lcurl_version_info|any info Version information table or specified field value
function M.version_info(param) end

--- Iterates through the easy options currently supported by libcurl.
---@return fun(state:table):lcurl_easy_option_info? iterator Iterator
---@return table state Iteration status
function M.ieasy_options() end

--- Query easy option description by ID.
---@param id integer Option ID
---@return lcurl_easy_option_info? option Option description
function M.easy_option_by_id(id) end

--- Query easy option descriptions by name.
---@param name string option name
---@return lcurl_easy_option_info? option Option description
function M.easy_option_by_name(name) end

return M
