npm.io
2.1.0 • Published 3 years ago

simply-api.js

Licence
MIT
Version
2.1.0
Deps
0
Size
10 kB
Vulns
0
Weekly
0
Stars
1

Simply-API

CodeFactor NodeJS Support Server

Download Download Package

npm install simply-api.js@latest

(or)

yarn add simply-api.js@latest

(or)

pnpm add simply-api.js@latest

Download Endpoints

Endpoint Description
chatbot(msg, {options}) Chat with Chat Bot
tictactoe(uid, ai, board) AI Game of Tic-Tac-Toe
toxicity(text) Detect Toxic messages
get(string, boolean) Custom Get Request
post(string, requestBody, boolean) Custom Post Request

Download Example Usages

Chatbot
import {chatbot} from "simply-api.js";

let data = await chatbot("Test Run by Simply-API.js", {uid: 69});
console.log(data) // returns JSON result
Tic-Tac-Toe
import {tictactoe} from "simply-api.js";

const uid = 123, ai = "o";
const board = [
    " ", " ", " ",
    " ", "x", " ",
    " ", " ", " "
];

let data = await tictactoe(uid, ai, board);
console.log(data) // returns JSON result
Toxicity
import {toxicity} from "simply-api.js";

const text = " *Insert offensive text here * ";

let data = await toxicity(text);
console.log(data) // returns JSON result
Custom Requests
import {get, post} from "simply-api.js";

const uid = 123, ai = "o";
const array = [
    " ", " ", " ",
    " ", "x", " ",
    " ", " ", " "
];

const board = JSON.stringify({"board": array});

let getData = await get("/api/grammar?text=get gud").catch(e => error);
let postData = await post("/api/tictactoe?uid=123&ai=o", board).catch(e => error);
console.log(getData, postData)
Alternative Methods
const URL = "https://i.pinimg.com/originals/ce/a7/21/cea7210bf2974d4085d09b53f782ea74.jpg";
const text = " *Insert offensive text here * ";
import simplyapi from "simply-api.js";

const uid = 123, ai = "o";
const board = [
    " ", " ", " ",
    " ", "x", " ",
    " ", " ", " "
];

simplyapi.chatbot("Hello!").then(data => {
    console.log(data) // returns JSON result
}); // Chat Bot AI

simplyapi.tictactoe(uid, ai, board).then(data => {
    console.log() // Returns Array Result
});

simplyapi.toxicity(text).then(data => {
    console.log(data) // returns JSON result
}); // Toxicity Detection

Keywords