Skip to content

Library: Rest

ᴏᴠ ━ ᴀɴɪꜱᴀ edited this page Dec 5, 2024 · 7 revisions

» Overview

Longing for more straightforward, simplistic and optimized version of fetchRemote & callRemote to increase your productivity? Switch to Assetify's REST module and let us manage it natively for you! 😃

» Importing

Add the below code once in either of the shared .lua script of the resource you want to use within:

--Declare it globally only once
loadstring(exports.assetify_library:import("rest"))()

» APIs

━ assetify.rest:get() (Shared)

@Objective: Executes a GET request on specified URL.
local promise: cPromise = assetify.rest:get(
  string: route, --Remote URL
  int: timeout, --(Optional)
  table: headers, --(Optional)
  table: credentials --(Optional) Essentially required for protected requests.
)

━ assetify.rest:post() (Shared)

@Objective: Executes a POST request on specified URL.
local promise: cPromise = assetify.rest:post(
  string: route, --Remote URL
  table: data,
  int: timeout, --(Optional)
  table: headers, --(Optional)
  table: credentials --(Optional) Essentially required for protected requests.
)
Clone this wiki locally