SomeRandomAPI.js
Unofficial wrapper for https://some-random-api.ml/ written in TypeScript with documentations and updated endpoints. This wrapper does not support pokemon
, premium
, chatbot
and welcome
endpoints.
UPDATE TO VERSION >=1.4.1 FOR BUG FIXES AND UPDATED DOCS
Endpoints: https://some-random-api.ml/endpoints
Documentation: https://some-random-api.ml/docs
Installation
Package Link: https://www.npmjs.com/package/somerandomapi.js
npm i somerandomapi.js
To use it in your project:
const SRA = require("somerandomapi.js");
const url = "https://cdn.discordapp.com/embed/avatars/2.png";
const tintedImgURL = SRA.canvas.filter.tint({
imgUrl: url,
hexColor: "1f1f1f",
});
console.log(tintedImgURL);
Examples
Every function is documentated for your convenience!
Animal Endpoints Example:
const SRA = require("somerandomapi.js");
async function myFunc(animal)
{
console.log(await SRA.animal.image({ animal, }));
console.log(await SRA.animal.fact({ animal, }));
console.log(await SRA.animal.imageAndFact({ animal, }));
}
myFunc()
Animu Endpoints Example:
const SRA = require("somerandomapi.js")
async function myFunc()
{
console.log(await SRA.animu.gif({ type: "hug", }));
}
myFunc();
Canvas Endpoints Example:
const SRA = require("somerandomapi.js")
const url = "https://cdn.discordapp.com/embed/avatars/2.png";
async function myFunc(url)
{
console.log(SRA.canvas.filter.greyscale({ imgUrl: url, }));
console.log(SRA.canvas.overlay.gay({ imgUrl: url, }));
console.log(SRA.canvas.misc.simpCard({ imgUrl: url, }));
}
myFunc(url);
Others Endpoints Example:
const SRA = require("somerandomapi.js")
async function myFunc()
{
console.log(await SRA.others.lyrics({ title: "Mockingbird", }));
console.log(
await SRA.others.base64({ mode: "encode", string: "let him cook", })
);
}
myFunc();