JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q47657F
  • License ISC

A simple NodeJS supported OpenCloud api wrapper similarly typed to roblox lua's functions.

Package Exports

  • @itsrune/opencloud.js
  • @itsrune/opencloud.js/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 (@itsrune/opencloud.js) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

opencloud.js

Experimental

Table of Contents

About

opencloud.js is an api wrapper meant to simplify the complexities with requesting to roblox's opencloud apis. This wrapper is built to mimic roblox's luau functions.

Installing

Use node package manager to install the package for use.

npm i @itsrune/opencloud.js

Usage

To start, you need to create a new Universe using the package. This is simple as demonstrated below:

const OpenCloud = require('@itsrune/opencloud.js');
const Universe = new OpenCloud(000000, "API_KEY");

This Universe class holds services within itself and caches your api key, so you don't have to reuse it over and over again.

DataStores

Datastores work just like with roblox. First we need to get the datastore itself then we are able to use it.

const DataStore = Universe.DataStoreService.GetDataStore("Coins");

GetAsync

Once you've gotten the datastore, you can then increment / set / get async to it. All requests to the api are asynchronous, make sure you handle their Promises appropriately.

DataStore.GetAsync("my-datastore-key").then((myCoins) => {

}).catch(err => console.error);

SetAsync

To update a datastore entry, just use SetAsync.

try {
    await DataStore.SetAsync("my-datastore-key", 100);
} catch(err) {
    console.error(err);
}

IncrementAsync

In this case we could use IncrementAsync to update this datastore due to Coins being an integer.

try {
    await DataStore.IncrementAsync("my-datastore-key", 5); // Adds 5 coins.
} catch(err) {
    console.error(err);
}

RemoveAsync

Let's say we want to delete an entry, how would we do that? Well, this is where RemoveAsync would be used.

try {
    await DataStore.RemoveAsync("my-datastore-key");
} catch(err) {
    console.error(err);
}

GetDataStores

Too lazy to go into studio? Want to list your datastores on a front-end application? No problem! GetDataStores would be your function for this!

try {
    const DataStores = await Universe.DataStoreService.GetDataStores();
} catch(err) {
    console.error(err);
}

Note: This function will return the json data from the request, it will not be formatted. View the documentation for more information on how it's formatted.

Messaging Service

Messaging via external applications are incredibly powerful when it comes to roblox apps. Example of use: You have an update coming up and want to alert users before a shutdown occurs.

At the moment MessagingService has only 1 asynchronous function, PublishAsync, which takes 2 string parameters; The topic and the message to send.

const Universe = new OpenCloud(000000, "API_KEY");
const MessagingService = Universe.MessagingService;

try {
    await MessagingService.PublishAsync("Topic", "Hello World!");
} catch(err) {
    console.error(err);
};

Place Management

Not Implemented for use.