ripslol-wrapper.js
v0.0.2
Published
A lightweight library for interacting with rips.lol's API
Downloads
3
Readme
ripslol-wrapper.js
A lightweight fully documented and typed package that makes it simple to interact with rips.lol's API
Installation and Import
npm install ripslol-wrapper.js
yarn add ripslol-wrapper.js
pnpm add ripslol-wrapper.js
ESM
import { Client } from "ripslol-wrapper.js";
CommonJS
const { Client } = require("ripslol-wrapper.js");
Usage
Creating an instance of the client and authenticating
import { Client, LoginDetails } from "ripslol-wrapper.js";
const client = new Client();
// Username + password authentication
const details: LoginDetails = {
username: "username",
password: "password",
};
// Email + password authentication
const details: LoginDetails = {
email: "[email protected]",
password: "password",
};
// Finally, log in!
client
.login(auth)
.then(() => {
console.log("Successfully logged in");
// Perform actions against the API
})
.catch((error) => {
// Catch for any errors that occur on login
console.log(error);
});
Methods
This wrapper exposes most of the available endpoints, however creating, updating and deleting socials is not yet supported as is fetching the authenticated user's data
We can organise the methods into 7 main groups:
Free biolink methods
These methods will work for anyone regardless of if they have purchased premium or not
client.biolink.setLink("qpro");
client.biolink.setName("qPro");
client.biolink.setBio("an example bio");
client.biolink.setProfilePicture("{profile picture url}");
client.biolink.setBackgroundPicture("{background picture url}");
Premium biolink methods
These methods will allow you to modify settings that a premium user could do, however they will not be displayed on the site
client.biolink.setMP3("{mp3 song url}");
client.biolink.setMP4("{mp4 video url}");
client.biolink.setNameColour("#ff0000");
client.biolink.enableSparkles(true);
client.biolink.enableTypewriter(false);
Socials methods
These methods allow the user to create, update and delete their own socials.
client.socials.create(client.sites.Website, "https://rips.lol");
client.socials.update(100, "qpro");
client.socials.delete(10);
User methods
These methods allow you to alter your user settings - email address, username and password
client.user.setEmailAddress("[email protected]", "[email protected]");
client.user.setUsername("qpro");
client.user.setPassword("pass", "word");
Spotify methods
These methods allow you to modify the spotify component of your biolink: setting the track with its track id and the theme that the spotify card will use.
client.spotify.setTrackId("3DK6m7It6Pw857FcQftMds");
client.spotify.setTheme(1);
Discord methods
These methods allow you to modify the discord component of your biolink: setting your discord user id, whether to display your status (online, offline, dnd, idle) and whether to display your current activity
client.discord.setDiscordId("1021219681471840317");
client.discord.enableStatus(false);
client.discord.enableActivity(true);
Fetch methods
These methods allow you to fetch the logged-in user's data, a discord user's information, spotify usage and presence/activites and a biolink's socials and data
client.biolink.fetch("qpro").then(console.log);
client.user.fetch().then(console.log);
client.socials.fetch("qpro").then(console.log);
client.discord.fetch("1021219681471840317").then(console.log);