UNPKG

rblx.js

Version:

A JavaScript wrapper for interacting with the ROBLOX OpenCloud API.

27 lines (26 loc) 1.11 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const urlcat_1 = __importDefault(require("urlcat")); const axios_1 = __importDefault(require("axios")); const BASE_URL = "https://apis.roblox.com/datastores/v1/universes"; async function main(apiKey, universeid, datastoreName, entryKey, incrementBy) { try { BigInt(universeid); } catch (e) { throw new Error("Invalid universeid: " + universeid); } const res_url = (0, urlcat_1.default)(BASE_URL, "/:universeid/standard-datastores/datastore/entries/entry/increment?datastoreName=:datastoreName&entryKey=:entryKey", { universeid, datastoreName, entryKey }); const config = { headers: { "x-api-key": apiKey, "content-type": "application/json" } }; const response = await axios_1.default.post(res_url, incrementBy, config); return await response.data; } exports.default = main;