npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

rbx-open-cloud

v2.1.0

Published

OOP Wrapper for Roblox Open Cloud API

Downloads

7

Readme

rbx-open-cloud

A familiar OOP wrapper for Roblox's Open Cloud API.

The goal of this project is to simplify the Open Cloud API into a familar format which mimics Roblox's in-engine API, as well as simplify some of the tedious functionality.

Contributions are much welcome!

Docs

Classes

class CloudClient(universeId: number, apiKey: string)

This is the default export of the module.

import CloudClient from "rbx-open-cloud"

const client = new CloudClient(process.env.RBLX_API_KEY)

Methods:

  • registerService(serviceName : string, ...args) : Service
    const messagingService = client.registerService("MessagingService", 1234567890)
  • getService(serviceName : string) : Service;
    const messagingService = client.getService("MessagingService")

class DataStoreService(universeId: number, apiKey: string)

import { DataStoreService } from "rbx-open-cloud"

const newDataService = new DataStoreService(1234567890, process.env.RBLX_API_KEY)

Properties:

  • baseUrl: string
  • universeId: number

Methods:

  • listDataStores(params?: ListDataStoresParams) : Promise<ListDataStoresResponse>
    const data = await newDataService.listDataStores({prefix: "Test", pageSize: 1, cursor: ""})
  • getDataStore(name: string, params?: DataStoreParams) : DataStore
    const targetDataStore = newDataService.getDataStore("Test_1", {scope: "global"})

class DataStore

Properties:

  • name: string
  • universeId: number

Methods:

  • listKeys(params? : ListEntriesParams) : Promise<ListEntriesResponse>;

  • get(key : string) : Promise<GetDataResponse>;

  • set(key : string, value : JsonDataType, params? : SetDataParams) : Promise<SetDataResponse>;

  • delete(key : string) : Promise<void>;

  • increment(key : string, amount : number, params? : EntryMetaData) : Promise<GetDataResponse>;

  • getVersion(key : string, versionId : string) : Promise<GetDataVersionResponse>;

  • listVersions(key : string, params? : ListVersionsParams) : Promise<ListVersionsResponse>;

class MessagingService(universeId: number, apiKey: string)

import { MessagingService } from "rbx-open-cloud"

const newMessageService = new MessagingService(1234567890, process.env.RBLX_API_KEY)

Properties:

  • baseUrl: string
  • universeId: number

Methods:

  • getTopic(topicName: string) : Topic
    const targetTopic = newMessageService.getTopic("Topic1")

class Topic

Properties:

  • topicName: string
  • universeId: number

Methods:

  • publish(message: string) : Promise<void>
    targetTopic.publish("Message Text")
        .then(() => {
            console.log("Sent message successfully!")
        })
        .catch(err => {
            console.log("Failed to send message")
        })

class PlaceService(universeId: number, apiKey: string)

import { PlaceService } from "rbx-open-cloud"

const newPlaceService = new PlaceService(1234567890, process.env.RBLX_API_KEY)

Properties:

  • baseUrl: string
  • universeId: number

Methods:

  • getPlace(placeId: number) : Place
    const targetPlace = newPlaceService.getPlace(123467)

class Place

Properties:

  • placeId: number
  • universeId: number

Methods:

  • publish(versionType: "Saved" | "Published", fileType: "rbxlx" | "rbxl", content: Buffer) : Promise<PlacePublishResponse>
    import fs from "fs"
    
    fs.readFile("./PlaceFile.rbxl", "binary", (content) => {
        const contentBuffer = Buffer.from(content, "binary")
    
        targetPlace.publish("Published", "rbxl", contentBuffer)
            .then(result => {
                console.log("Place published successfully", result.versionNumber)
            })
            .catch(err => {
                console.log("Failed to publish place", err)
            })
    })
    

class AssetService(creatorId: number, isGroup: boolean, apiKey: string)

import { AssetService } from "rbx-open-cloud"

const newAssetService = new AssetService(1234567890, false, process.env.RBLX_API_KEY)

Properties:

  • baseUrl: string
  • ownerId: number
  • isGroup: boolean

Methods:

  • create(assetType, name, fileContent, options) : Promise<AssetCreateResponse>

    • assetType : "Audio" | "Decal" | "Model"
    • name : string
    • fileContent : Blob
    • options : { description : string }
    const assetPromise = newAssetService.create("Audio", "NewAudio!", FileBlob, { description: "Cool new asset" })
    
    // Response used in .get()
  • get(operationIdPath : string) : Promise<AssetGetResponse>

      assetPromise.then((uploadResult) => {
          let getResult = undefined;
          while (!getResult || !getResult.response) { // Roblox backend has a race condition. This is a hacky fix.
              await new Promise(r => setTimeout(r, 1000));
              getResult = await newAssetService.get(uploadResult.path)
    
              const unusualResult = (getResult as unknown) as {[key : string] : string};
              if (unusualResult.error) {
                  throw new Error(unusualResult.error);
              }
          }
    
          console.log(getResult.response.assetId);
      }).catch((err) => {
          console.log("Upload failed")
      });
  • update(assetId : number, fileContent : Blob) : Promise<AssetCreateResponse>

    const assetPromise = newAssetService.update(0123456789, FileBlob)

class GroupService(groupId: number, apiKey: string)

import { GroupService } from "rbx-open-cloud"

const newGroupService = new GroupService(1234567890, process.env.RBLX_API_KEY)

Properties:

  • baseUrl: string
  • groupId: number

Methods:

  • getInfo() : Promise<GroupInfoResponse>
  • getMembers(amount : number, params : GroupMemberParams ) : Promise<GroupMembersResponse>
  • getRoles(amount : number, params : GroupRolesParams) : Promise<GroupRolesResponse>
  • getShout() : Promise<GroupShoutResponse>