JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q30526F
  • License MIT

A JavaScript wrapper for interacting with the ROBLOX OpenCloud API.

Package Exports

  • rblx.js
  • rblx.js/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (rblx.js) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

A JavaScript wrapper for the ROBLOX OpenCloud API.



Introduction

Recently at RDC 2022, ROBLOX announced OpenCloud API endpoints for DataStore, MessagingService and more. These would have official libraries for languages such as Python and JavaScript eventually, but until then, roblox.js bridges this gap as an API wrapper.

Installation

Yarn:

yarn add rblx.js

NPM:

npm i rblx.js

Usage

Roblox.js is a OpenCloud API wrapper with full TypeScript support. Once installed, you can access the following classes:

  • Datastore
  • MessagingService

Functions are named similar to the Lua equivalents and follow a similar structure. Each class is initialized with a universeId and an apiKey from https://create.roblox.com/credentials.

Datastore

GetAsync

GetAsync lets you fetch the value of a particular Key in a datastore.

const { Datastore } = require('rblx.js')

const datastore = new Datastore("UNIVERSE_ID", "API_KEY")

await datastore.GetAsync("DATASTORE_NAME", "KEY_NAME")

Returns: Promise<string|number|boolean|undefined>

SetAsync

SetAsync lets you set the value of a particular Key in a datastore.

const { Datastore } = require('rblx.js')

const datastore = new Datastore("UNIVERSE_ID", "API_KEY")

await datastore.SetAsync("DATASTORE_NAME", "KEY_NAME", "VALUE")

Optional Arguments: matchVersion: string, exclusiveCreate: Boolean

Returns: Promise<DatastoreSetResponse|undefined>

RemoveAsync

RemoveAsync lets you remove a key from a datastore.

const { Datastore } = require('rblx.js')

const datastore = new Datastore("UNIVERSE_ID", "API_KEY")

await datastore.RemoveAsync("DATASTORE_NAME", "KEY_NAME")

Returns: Promise<undefined>

ListKeysAsync

ListKeysAsync lets you fetch a list of keys in a datastore.

const { Datastore } = require('rblx.js')

const datastore = new Datastore("UNIVERSE_ID", "API_KEY")

await datastore.ListKeysAsync("DATASTORE_NAME")

Returns: Promise<DatastoreSetResponse|undefined>

ListDataStoresAsync

ListDataStoresAsync lets you fetch a list of datastores in a universe.

const { Datastore } = require('rblx.js')

const datastore = new Datastore("UNIVERSE_ID", "API_KEY")

await datastore.ListDataStoresAsync()

Optional Arguments: prefix: string, limit: string, cursor: string, AllScopes: boolean

Returns: Promise<DatastoreEntries|undefined>

GetVersionAsync

GetVersionAsync lets you fetch a key from its version.

const { Datastore } = require('rblx.js')

const datastore = new Datastore("UNIVERSE_ID", "API_KEY")

await datastore.GetVersionAsync("DATASTORE_NAME", "KEY_NAME", "08DA9790C75527F0.0000000011.08DA9798C9BEB578.01")

Optional Arguments: scope: string

Returns: Promise<string|number|boolean|undefined>

IncrementAsync

IncrementAsync increments a key with an integer value by the given value.

const { Datastore } = require('rblx.js')

const datastore = new Datastore("UNIVERSE_ID", "API_KEY")

await datastore.IncrementAsync("DATASTORE_NAME", "KEY_NAME", 3)

Returns: Promise<DatastoreSetResponse>

License

MIT © DevComp - see the LICENSE.md file for details.