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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@ragula/sdk

v0.0.3

Published

Ragula.io SDK

Readme

Ragula Logo

Ragula Node.js SDK

This package provides a Node.js SDK for interacting with the Ragula API.

Installation

npm install @ragula/sdk
# or
yarn add @ragula/sdk

Authentication & Usage

Instantiate the Ragula client with your API key.

import Ragula from '@ragula/sdk'; // Assuming default export

// 1. Instantiate the client
const ragula = new Ragula('YOUR_API_KEY'); // Replace with your actual API key

// 2. Use the client methods
async function main() {
  try {
    // List collections
    const collections = await ragula.listCollections();
    console.log('Collections:', collections);

    // Create a collection
    const newCollection = await ragula.createCollection('My New Collection', 'Description');
    console.log('New Collection:', newCollection);

    // Access collection-specific operations
    const collectionId = newCollection.id; // Assuming the response has an id
    const collectionHandler = ragula.collection(collectionId);

    // Example: List files in the collection (Method names are illustrative)
    // const files = await collectionHandler.listFiles();
    // console.log('Files:', files);

    // Example: Query the collection (Method names are illustrative)
    // const queryResults = await collectionHandler.query({ query: 'Search term' });
    // console.log('Query Results:', queryResults);

  } catch (error) {
    console.error('API Call Failed:', error);
  }
}

main();

SDK Structure

The SDK provides a main Ragula class for top-level operations like managing collections.

  • new Ragula(apiKey): Creates a new client instance.
  • ragula.listCollections(): Lists all accessible collections.
  • ragula.createCollection(name, description): Creates a new collection.
  • ragula.collection(collectionId): Returns a handler object for operations specific to a single collection (e.g., managing files, folders, querying).

Collection Handler

The object returned by ragula.collection(collectionId) provides methods to interact with a specific collection:

Collection Methods

  • details(): Get detailed information about the collection
  • status(): Get the current status of the collection (file count, size, etc.)
  • update(payload): Update collection properties (name, description)
  • delete(): Delete the collection
  • query(query): Perform a search query against the collection
  • question(query): Ask the collection a question

Folder Operations

  • listFolders(): List all folders in the collection
  • createFolder(payload): Create a new folder in the collection
  • folder(folderId): Get a handler for operations on a specific folder

File Operations

  • listFiles(): List all files in the collection
  • uploadFile(file): Upload a file to the collection
  • file(fileId): Get a handler for operations on a specific file

Error Handling

Methods generally return Promises. If an API call fails or encounters an error, the Promise will reject. Use standard try...catch blocks or .catch() on the Promise chain to handle errors.

import Ragula from '@ragula/sdk';

const ragula = new Ragula('YOUR_API_KEY');

async function getCollections() {
  try {
    const collections = await ragula.listCollections();
    console.log('Collections:', collections);
  } catch (error) {
    console.error('Error fetching collections:', error);
    // Handle the error appropriately
  }
}

getCollections();

Folder Handler

The object returned by ragula.collection(collectionId).folder(folderId) provides methods to interact with a specific folder:

  • delete(): Delete the folder
  • listFiles(): List all files in the folder
  • file(fileId): Get a handler for operations on a specific file

File Handler

The object returned by ragula.collection(collectionId).file(fileId) or ragula.collection(collectionId).folder(folderId).file(fileId) provides methods to interact with a specific file:

  • delete(): Delete the file

Type Definitions

Refer to the source code or specific type definitions (src/types.ts) for details on request/response structures and available methods.

Development

Running Tests

npm test

The test suite uses Jest and includes tests for:

  • Core SDK functionality (src/__tests__/index.test.ts)
  • Collection handler methods (src/__tests__/collectionHandler.test.ts)
  • Folder handler methods (src/__tests__/foldersHandler.test.ts)
  • File handler methods (src/__tests__/filesHandler.test.ts)