API examples

Node.js example

using @drep/api

$ npm install @drep/api

Usage

const { DRepClient } = require('@drep/api');
const drep = new DRepClient('D-REP.YOUR-KEY');

Endpoints

class DRepClient {
rep(userID: string): Reputation;
infractions(userID: string): Ban | Warn | null;
}

Return Types

interface Reputation {
upvotes: number;
downvotes: number;
reputation: number;
rank: string;
xp: number;
staff: boolean;
}
interface Ban {
moderator: string;
reason: string;
date: Date;
}
interface Warn {
moderator: string;
reason: string;
date: Date;
}

Full example of getting reputation

const { DRepClient } = require('@drep/api');
const drep = new DRepClient('D-REP.YOUR-KEY');
let getReputation = async (userID) => {
let rep = await drep.rep(userID);
console.log(rep);
}
getReputation('1234567891234567');