@otters/valve
Public npm package for Valve.
Basic Usage:
import {Valve} from '@otters/valve';
const valve = new Valve('my-api-key');
// Add a new email on to the end of the waitlist
await valve.addEmail('hi@alistair.sh');
// Get a record of all emails. Values are the unix
// timestamp that they were added at.
const emails = await valve.getAllEmails();
const joinedAt = new Date(emails['hi@alistair.sh']);
// Get a single email
const email = await valve.getEmail('hi@alistair.sh');
email.joinedAt; // unix timestamp
email.rank; // the position in the waitlist
// Peek the next email in the waitlist
const nextEmail = await valve.peekNextEmail();
// Remove and return the next email in the waitlist
const nextEmail = await valve.popNextEmail();
// Remove a specific email from the waitlist
await valve.removeEmail('hi@alistair.sh');