@simo.js/rest

1.0.5-2 • Public • Published

REST

@simo.js/rest is a light and fast module that lets you interact with the Simo API

Installation

The only way to install rest is via npm

npm install @simo.js/rest

Using

Creating a team:

import { REST, Routes } from '@simo.js/rest';

const rest = new REST({ auth: AUTH });

await rest
    .post(Routes.createTeam, {
        name: 'Team Name',
        avatar_url: 'https://some.avatar.com',
        description: 'Here is some description',
    })
    .catch(console.error);

Creating a feedback:

import { REST, Routes } from '@simo.js/rest';

const rest = new REST({ auth: AUTH });

await rest
    .post(Routes.addFeedback(BOT_ID), {
        stars: 5,
        content: 'Your bot is amazing!',
    })
    .catch(console.error);

Updating a feedback with @simo.js/simo-api-types:

import { REST, Routes } from '@simo.js/rest';
import type { RESTPatchFeedbackResult } from '@simo.js/simo-api-types';

const rest = new REST({ auth: AUTH });

await rest
    .patch<RESTPatchFeedbackResult>(Routes.updateFeedback(BOT_ID), {
        reply_message: {
            content: 'Thanks!',
            posted_at: new Date().toISOString(),
        },
    })
    .catch(console.error);

Util Links

Help

If you don't understand something or you are experiencing problems, please join simo Server

Readme

Keywords

none

Package Sidebar

Install

npm i @simo.js/rest

Weekly Downloads

0

Version

1.0.5-2

License

ISC

Unpacked Size

13.9 kB

Total Files

8

Last publish

Collaborators

  • spyei
  • escoteiros