Socket
Socket
Sign inDemoInstall

assistants-api

Package Overview
Dependencies
27
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    assistants-api

Assistants Center API Client


Version published
Weekly downloads
2
Maintainers
1
Created
Weekly downloads
 

Readme

Source

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}`);
    });
});

FAQs

Last updated on 28 Dec 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc