1.6.0 • Published 12 months ago

somerandomapi.js v1.6.0

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

SomeRandomAPI.js

Unofficial wrapper for https://some-random-api.com/ 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.com/endpoints Documentation: https://some-random-api.com/docs

Installation

Package Link: https://www.npmjs.com/package/somerandomapi.js

npm i somerandomapi.js

To use it in your project:

// import SRA from "../dist/index"
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! npm.io npm.io

Animal Endpoints Example:

const SRA = require("somerandomapi.js");

async function myFunc(animal) 
{
	// Get image of an animal
	console.log(await SRA.animal.image({ animal, }));

	// Get fact of an animal
	console.log(await SRA.animal.fact({ animal, }));

	// Get image and fact about the animal
	console.log(await SRA.animal.imageAndFact({ animal, }));
}

// Call your function
myFunc()

Animu Endpoints Example:

const SRA = require("somerandomapi.js")

async function myFunc() 
{
	// Get an anime GIF
	console.log(await SRA.animu.gif({ type: "hug", }));
}

// Call your function
myFunc();

Canvas Endpoints Example:

const SRA = require("somerandomapi.js")

const url = "https://cdn.discordapp.com/embed/avatars/2.png";

async function myFunc(url) 
{
	// Filter Endpoints
	console.log(SRA.canvas.filter.greyscale({ imgUrl: url, }));

	// Overlay Endpoints
	console.log(SRA.canvas.overlay.gay({ imgUrl: url, }));

	// Misc Endpoints
	console.log(SRA.canvas.misc.simpCard({ imgUrl: url, }));
}

// Call your function
myFunc(url);

Others Endpoints Example:

const SRA = require("somerandomapi.js")

async function myFunc() 
{
	// Get lyrics for a song
	console.log(await SRA.others.lyrics({ title: "Mockingbird", }));

	// Encode a string in base64
	console.log(
		await SRA.others.base64({ mode: "encode", string: "let him cook", })
	);
}

// Call your function
myFunc();
1.6.0

12 months ago

1.5.3

1 year ago

1.5.2

1 year ago

1.5.1

1 year ago

1.5.0

1 year ago

1.4.6

1 year ago

1.4.5

1 year ago

1.4.4

1 year ago

1.4.3

1 year ago

1.4.2

1 year ago

1.4.1

1 year ago

1.4.0

1 year ago

1.3.2

1 year ago

1.3.1

1 year ago

1.3.0

1 year ago

1.2.0

1 year ago

1.1.0

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago