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

assistants-api

v1.3.1

Published

Assistants Center API Client

Downloads

6

Readme

assistants-api

Below we present the documentation of the assistants-api module used to communicate with the API Assistants Center (assistants.ga).

Installation

npm i assistants-api

Errors Handling

If an error occurred while executing an action, the function returned the following value:

{error: true, message: "error text"}

If all is successful, the following value will be returned:

{error: false, data: returnedData_ifThereIs}

API client

Require module

const Assistants = require('assistants-api');

New client

const client = new Assistants.Client(parametr, password);

where parametr is user username or e-mail adress and password is user password

Functions

Login

const user = await client.login();

success:

{
  error: false,
  data: { username: '', email: '' }
}

error:

As in Errors Handling above

Session

const session = await client.session();

success:

{
  cookie: {
    originalMaxAge: Number,
    expires: DateString,
    httpOnly: Boolean,
    path: String
  },
  user: { sid: String, username: String },
  __lastAccess: Number,
  apples: Number
}

error:

As in Errors Handling above

Register

const newAccount = await client.register({username: String, email: String, password: String, tos: Boolean})

success:

{
  error: false,
  data: { username: String, email: String }
}

error:

As in Errors Handling above

Events Listeners

You can connect to API Assistants to listen for the latest updates. For example, you can know when the daily store is updated, in what language, and get a ready-made store image buff.

Init

const events = await client.events();

Errors

As in Errors Handling above

Fortnite Daily Shop Updates

const shopEmitter = events.shop;
shopEmitter.on('shop::new', ({buff,lang}) => {
    console.log(`NEW SHOP! IMAGE buff: ${buff}, lang: ${lang}`);
});

Fortnite Sections Updates

const sectionsEmitter = events.sections;
sectionsEmitter.on('sections::new', ({buff,lang}) => {
    console.log(`NEW SECTIONS! IMAGE buff: ${buff}, lang: ${lang}`);
});

Ready-to-use example with public account

const Assistants = require('assistants-api');

const client = new Assistants.Client("assistants_api", "public123");

client.login().then(async (res)=>{
    if(res.error)return console.log(res);
    console.log(res);

    const userSession = await client.session();
    console.log(userSession);

    const newAccount = await client.register({username: "", email: "", password: "", tos: true});
    console.log(newAccount);


    const events = await client.events();

    const shopEmitter = events.shop;
    shopEmitter.on('shop::new', ({buff,lang}) => {
        console.log(`NEW SHOP! IMAGE buff: ${buff}, lang: ${lang}`);
    });

    const sectionsEmitter = events.sections;
    sectionsEmitter.on('sections::new', ({buff,lang}) => {
        console.log(`NEW SECTIONS! IMAGE buff: ${buff}, lang: ${lang}`);
    });
});