0.0.2 • Published 2 months ago

irritatedlol-wrapper.js v0.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
2 months ago

irritatedlol-wrapper.js

A lightweight fully documented and typed package that makes it simple to interact with irritated.lol's API

Installation and Import

npm install irritatedlol-wrapper.js
yarn add irritatedlol-wrapper.js
pnpm add irritatedlol-wrapper.js

ESM

import { Client } from "irritatedlol-wrapper.js";

CommonJS

const { Client } = require("irritatedlol-wrapper.js");

Usage

Creating an instance of the client and authenticating

import { Client, LoginDetails } from "irritatedlol-wrapper.js";
const client = new Client();

// Username + password authentication
const details: LoginDetails = {
    username: "username",
    password: "password",
};

// Email + password authentication
const details: LoginDetails = {
    email: "email@host.com",
    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("dumplings");
client.biolink.setName("peanutdumplings");
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://meow.rest");
client.socials.update(100, "peanutdumplings");
client.socials.delete(10);

User methods

These methods allow you to alter your user settings - email address, username and password

client.user.setEmailAddress("test@email.com", "test@host.com");
client.user.setUsername("dumplings");
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("388858536521629706");
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("dumplings").then(console.log);
client.user.fetch().then(console.log);
client.socials.fetch("dumplings").then(console.log);
client.discord.fetch("388858536521629706").then(console.log);
0.0.2

2 months ago

0.0.1

2 months ago

1.0.1

2 months ago

1.0.0

2 months ago