@sodiumlabs/plume-api
Version:
The official Plume API wrapper
554 lines (548 loc) • 16.8 kB
TypeScript
interface PlumeAPIRESTOptions {
userAgent?: string;
}
declare class PlumeAPIREST {
readonly options: PlumeAPIRESTOptions;
static readonly baseURL: string;
static readonly defaultUserAgent: string;
constructor(options?: PlumeAPIRESTOptions);
request(method: string, path: string, body?: object): Promise<Response>;
get<T = unknown>(path: string): Promise<T>;
file(path: string): Promise<Buffer>;
}
type ExecLanguage = "javascript" | "typescript" | "python" | "cpp" | "go" | "rust" | "java" | "shell" | "php" | "ruby" | "lua" | "elixir" | "zig" | "postgres" | "mysql" | "sqlite";
type InteractionType = "bite" | "blush" | "cry" | "hug" | "kiss" | "lick" | "pat" | "poke" | "slap" | "smile" | "tickle";
type AsciiFont = "standard" | "isometric" | "3d" | "letters";
type DecodeType = "base64" | "binary" | "hex" | "morse" | "unicode";
interface DecodeData {
decoded: string;
}
type EncodeType = "base64" | "binary" | "hex" | "morse" | "unicode";
interface EncodeData {
encoded: string;
}
interface EightBallData {
answer: string;
}
/**
* @deprecated Use `EightBallData` instead
*/
interface HeightBallData {
answer: string;
}
interface EmojiMixData {
emoji_url: string;
}
interface FunFactData {
text: string;
source_url: string;
language: string;
}
interface JokeData {
question: string;
answer: string;
}
interface MathData {
result: string | null;
}
interface MemeData {
title: string;
downvotes: number;
upvotes: number;
url: string;
image_url: string;
comments: number;
author: string;
}
interface NasaAPOD {
date: string;
title: string;
url: string;
hd_url?: string;
media_type: string;
explanation: string;
page_url: string;
}
interface NPMData {
name: string;
description: string;
version: string;
keywords: string[];
author_username: string;
author_email: string;
repository_url?: string;
npm_url: string;
dependents: number;
search_score: number;
downloads_yearly?: number;
downloads_monthly: number;
downloads_weekly: number;
downloads_history?: {
count: number;
start: number;
end: number;
};
last_published_date: string;
last_published: number;
}
interface QuoteData {
quote: string;
author: string;
}
interface RandomEmojiMixData {
emoji_url: string;
}
interface UpsideDownTextData {
text: string;
}
interface UrbanData {
word: string;
url: string;
definition: string;
example: string;
author: string;
thumbs_up: number;
thumbs_down: number;
}
interface GitHubRepository {
name: string;
full_name: string;
description: string;
url: string;
owner_username: string;
owner_avatar_url: string;
language?: string;
license_name?: string;
disabled?: boolean;
archived?: boolean;
fork?: boolean;
created_at_date?: string;
created_at?: number;
updated_at_date?: string;
updated_at?: number;
stargazers_count?: number;
forks_count?: number;
open_issues_count?: number;
}
interface GitHubUser {
id: number;
username: string;
avatar_url: string;
page_url: string;
followers_page_url: string;
following_page_url: string;
stars_page_url: string;
repos_page_url: string;
is_admin: boolean;
}
interface CryptoData {
name: string;
currency: string;
price: number;
market_cap: number;
volume_24h: number;
change_24h: number;
}
interface DefinitionData {
word: string;
phonetic?: string;
definitions: {
part_of_speech: string;
definitions: {
definition: string;
example?: string;
}[];
synonyms: string[];
antonyms: string[];
}[];
}
interface ExecData {
success: boolean;
timeout: boolean;
duration: number;
stdout: string | null;
stderr: string | null;
}
interface FreeGamesData {
games: {
store: string;
id: string;
title: string;
description: string;
image?: string;
original_price: number;
currency: string;
free_until: number;
}[];
}
interface IPInfoData {
ip: string;
city: string;
region: string;
country: string;
latitude: number;
longitude: number;
postal: string;
timezone: string;
}
interface ISSData {
latitude: number;
longitude: number;
altitude: number;
timestamp: number;
velocity: number;
}
interface ReverseTextData {
text: string;
}
interface TranslateData {
text: string;
}
interface WeatherData {
city_name: string;
full_city_name: string;
latitude: number;
longitude: number;
temperature: number;
humidity: number;
wind_speed: number;
hourly: {
time: number[];
temperature_2m: number[];
relative_humidity_2m: number[];
wind_speed_10m: number[];
};
}
interface WikipediaData {
title: string;
page_id: number;
thumbnail: {
source: string;
width: number;
height: number;
};
original_image: {
source: string;
width: number;
height: number;
};
lang: string;
description: string;
content_urls: {
desktop: {
page: string;
revisions: string;
edit: string;
talk: string;
};
mobile: {
page: string;
revisions: string;
edit: string;
talk: string;
};
};
extract: string;
}
interface InteractionData {
url: string;
}
interface AdviceData {
advice: string;
}
interface AgifyData {
age: number;
name: string;
count: number;
}
interface AsciiData {
text: string;
}
interface EmojifyData {
text: string;
}
interface UUIDData {
uuid: string;
}
interface FortniteMapData {
images: {
map: string;
map_with_pois: string;
};
pois: {
id: string;
name: string;
location: {
x: number;
y: number;
z: number;
};
}[];
}
interface MinecraftIDData {
id: string;
name: string;
}
interface MinecraftNameData {
id: string;
name: string;
}
interface MinecraftSkinData {
id: string;
name: string;
skin_url: string;
cape_url: string;
avatar_url: string;
body_url: string;
}
interface RobloxIDData {
id: number;
name: string;
}
interface RobloxUserAvatarAssetData {
id: number;
name: string;
type_id: number;
type_name: string;
}
type RobloxUserAvatarType = "R6" | "R15";
interface RobloxUserData {
id: number;
name: string;
display_name: string;
description: string | null;
created_at: number;
is_banned: boolean;
has_verified_badge: boolean;
friend_count: number;
thumbnail_url: string | null;
avatar_type: RobloxUserAvatarType;
avatar_assets: RobloxUserAvatarAssetData[];
}
interface MinecraftLatestVersions {
release: string;
snapshot: string;
}
type MinecraftVersionType = "release" | "snapshot" | "old_beta" | "old_alpha";
interface MinecraftVersion {
id: string;
type: MinecraftVersionType;
url: string;
update_time: number;
release_time: number;
sha1: string;
compliance_level: 0 | 1;
}
interface MinecraftVersions {
latest: MinecraftLatestVersions;
versions: MinecraftVersion[];
}
type MinecraftBedrockServerEdition = "MCPE" | "MCEE";
interface MinecraftBedrockServerVersion {
name: string | null;
protocol: number | null;
}
interface MinecraftBedrockServerPlayers {
online: number | null;
max: number | null;
}
interface MinecraftBedrockServerMotd {
raw: string;
clean: string;
}
interface MinecraftBedrockServerStatus {
host: string;
port: number;
ip_address: string | null;
eula_blocked: boolean;
updated_at: number;
version: MinecraftBedrockServerVersion;
players: MinecraftBedrockServerPlayers;
motd: MinecraftBedrockServerMotd;
gamemode: string | null;
edition: MinecraftBedrockServerEdition | null;
}
interface MinecraftJavaServerVersion {
name_raw: string;
name_clean: string;
protocol: number;
}
interface MinecraftJavaServerPlayers {
online: number;
max: number;
}
interface MinecraftJavaServerMotd {
raw: string;
clean: string;
}
interface MinecraftJavaServerStatus {
host: string;
port: number;
ip_address: string | null;
eula_blocked: boolean;
updated_at: number;
version: MinecraftJavaServerVersion;
players: MinecraftJavaServerPlayers;
motd: MinecraftJavaServerMotd;
icon: string | null;
}
interface PlusCodeData {
code: string;
length: number;
}
type PlusCodeLength = 4 | 6 | 8 | 10 | 11 | 12 | 13 | 14 | 15;
type Locale = "en" | "fr";
interface ColorData {
rgb: {
r: number;
g: number;
b: number;
value: string;
};
hsl: {
h: number;
s: number;
l: number;
value: string;
};
hsv: {
h: number;
s: number;
v: number;
value: string;
};
cmyk: {
c: number;
m: number;
y: number;
k: number;
value: string;
};
name: string;
int: number;
hex: {
value: string;
clean: string;
};
url: string;
}
interface PlumeAPIOptions extends PlumeAPIRESTOptions {
}
/**
* The client to interact with Plume API.
*
* @example
* ```ts
* const plumeAPI = new PlumeAPI();
*
* const joke = await plumeAPI.joke();
* console.log(joke);
* ```
*/
declare class PlumeAPI {
readonly rest: PlumeAPIREST;
constructor(options?: PlumeAPIOptions);
eightBall(locale?: Locale): Promise<EightBallData>;
advice(locale?: Locale): Promise<AdviceData>;
agify(name: string): Promise<AgifyData>;
asciiImage(text: string, font?: AsciiFont | (string & {})): Promise<Buffer>;
asciiText(text: string): Promise<AsciiData>;
/**
* @deprecated Use `eightBall` instead
*/
heightBall(locale?: Locale): Promise<HeightBallData>;
emojiMix(left: string, right: string): Promise<EmojiMixData>;
emojify(text: string): Promise<EmojifyData>;
funFact(locale?: Locale): Promise<FunFactData>;
issImage(circle?: boolean): Promise<Buffer>;
iss(): Promise<ISSData>;
joke(locale?: Locale): Promise<JokeData>;
math(expr: string): Promise<MathData>;
meme(): Promise<MemeData>;
nasaAPOD(): Promise<NasaAPOD>;
npm(name: string): Promise<NPMData>;
quote(locale?: Locale): Promise<QuoteData>;
randomEmojiMix(): Promise<RandomEmojiMixData>;
upsideDown(text: string): Promise<UpsideDownTextData>;
urban(word: string): Promise<UrbanData>;
color(hex: string): Promise<ColorData>;
colorImage(hex: string): Promise<Buffer>;
randomColor(): Promise<ColorData>;
githubRepository(name: string): Promise<GitHubRepository>;
githubUser(name: string): Promise<GitHubUser>;
captcha(): Promise<{
code: string;
image: Buffer;
}>;
crypto(name: string, currency: "usd" | "eur" | (string & {})): Promise<CryptoData>;
definition(locale: Locale, word: string): Promise<DefinitionData>;
exec(language: ExecLanguage | (string & {}), code: string): Promise<ExecData>;
freeGames(locale?: Locale): Promise<FreeGamesData>;
ipInfo(ip: string): Promise<IPInfoData>;
plusCode(lat: number, lon: number, code_length?: PlusCodeLength): Promise<PlusCodeData>;
latex(expr: string): Promise<Buffer>;
qrcode(text: string): Promise<Buffer>;
reverseText(text: string): Promise<ReverseTextData>;
screenshot(url: string): Promise<Buffer>;
translate(text: string, to: string): Promise<TranslateData>;
uuid(): Promise<UUIDData>;
weather(city: string): Promise<WeatherData>;
wikipedia(page: string, locale?: Locale): Promise<WikipediaData>;
duck(): Promise<Buffer>;
fox(): Promise<Buffer>;
encode(type: EncodeType, text: string): Promise<EncodeData>;
decode(type: DecodeType, text: string): Promise<DecodeData>;
fortniteMapImagePois(locale?: Locale): Promise<Buffer>;
fortniteMapImage(): Promise<Buffer>;
fortniteMap(locale?: Locale): Promise<FortniteMapData>;
minecraftAvatar(name: string): Promise<Buffer>;
minecraftBody(name: string): Promise<Buffer>;
minecraftID(name: string): Promise<MinecraftIDData>;
minecraftName(id: string): Promise<MinecraftNameData>;
minecraftSkin(name: string): Promise<MinecraftSkinData>;
minecraftBedrockServerStatus(host: string): Promise<MinecraftBedrockServerStatus>;
minecraftJavaServerStatus(host: string): Promise<MinecraftJavaServerStatus>;
minecraftLatestVersions(): Promise<MinecraftLatestVersions>;
minecraftVersions(): Promise<MinecraftVersions>;
robloxID(name: string): Promise<RobloxIDData>;
robloxUser(name: string): Promise<RobloxUserData>;
interaction(type: InteractionType): Promise<InteractionData>;
achievement(text: string): Promise<Buffer>;
alert(text: string): Promise<Buffer>;
caution(text: string): Promise<Buffer>;
challenge(text: string): Promise<Buffer>;
jail(avatar: string): Promise<Buffer>;
nokia(url: string): Promise<Buffer>;
tweet(avatar: string, name: string, username: string, text: string, retweets?: number, quote_tweets?: number, likes?: number): Promise<Buffer>;
wanted(avatar: string): Promise<Buffer>;
blur(url: string): Promise<Buffer>;
colorify(url: string, color: string): Promise<Buffer>;
grayscale(url: string): Promise<Buffer>;
invert(url: string): Promise<Buffer>;
rotate(url: string, deg: number): Promise<Buffer>;
changeMyMind(text: string): Promise<Buffer>;
didYouMean(search: string, correction: string): Promise<Buffer>;
drake(top: string, bottom: string): Promise<Buffer>;
duolingo(text: string): Promise<Buffer>;
facts(text: string): Promise<Buffer>;
fuze3(text: string): Promise<Buffer>;
hugo(text: string): Promise<Buffer>;
jarvis(text: string, banner?: boolean): Promise<Buffer>;
nothing(text: string): Promise<Buffer>;
oogway(text: string): Promise<Buffer>;
pepeHug(avatar: string): Promise<Buffer>;
sadcat(top: string, bottom: string): Promise<Buffer>;
stonks(avatar: string, stonks?: boolean): Promise<Buffer>;
tableFlip(avatar: string): Promise<Buffer>;
water(text: string): Promise<Buffer>;
woosh(avatar: string): Promise<Buffer>;
boost(avatar: string, username: string, text?: string): Promise<Buffer>;
couple(avatar1: string, avatar2: string, percentage?: number, primary_color?: string): Promise<Buffer>;
rank(avatar: string, global_name: string, username: string, level: number, xp: number, max_xp: number, rank?: number, bg_url?: string, bg_color?: string, blur?: boolean, color?: string): Promise<Buffer>;
welcome(avatar: string, text1: string, text2?: string, text3?: string, bg_url?: string, bg_color?: string, font_color?: string, blur?: boolean, avatar_border?: boolean, avatar_border_color?: string): Promise<Buffer>;
}
declare class PlumeAPIError extends Error {
res?: (Response | null) | undefined;
constructor(message: string, options?: ErrorOptions | undefined, res?: (Response | null) | undefined);
}
export { type AdviceData, type AgifyData, type AsciiData, type AsciiFont, type ColorData, type CryptoData, type DecodeData, type DecodeType, type DefinitionData, type EightBallData, type EmojiMixData, type EmojifyData, type EncodeData, type EncodeType, type ExecData, type ExecLanguage, type FortniteMapData, type FreeGamesData, type FunFactData, type GitHubRepository, type GitHubUser, type HeightBallData, type IPInfoData, type ISSData, type InteractionData, type InteractionType, type JokeData, type Locale, type MathData, type MemeData, type MinecraftBedrockServerEdition, type MinecraftBedrockServerMotd, type MinecraftBedrockServerPlayers, type MinecraftBedrockServerStatus, type MinecraftBedrockServerVersion, type MinecraftIDData, type MinecraftJavaServerMotd, type MinecraftJavaServerPlayers, type MinecraftJavaServerStatus, type MinecraftJavaServerVersion, type MinecraftLatestVersions, type MinecraftNameData, type MinecraftSkinData, type MinecraftVersion, type MinecraftVersionType, type MinecraftVersions, type NPMData, type NasaAPOD, PlumeAPI, PlumeAPIError, type PlumeAPIOptions, PlumeAPIREST, type PlumeAPIRESTOptions, type PlusCodeData, type PlusCodeLength, type QuoteData, type RandomEmojiMixData, type ReverseTextData, type RobloxIDData, type RobloxUserAvatarAssetData, type RobloxUserAvatarType, type RobloxUserData, type TranslateData, type UUIDData, type UpsideDownTextData, type UrbanData, type WeatherData, type WikipediaData };