1.5.0 • Published 11 months ago
gabir-motors v1.5.0
Gabir Motors API Wrapper
Info
This is a wrapper for the GM API that I use for my various projects like the Gabir Motors Discord bot. The actual Gabir Motors API can be found here
Installation
npm i gabir-motors
Usage
Initialization
const { Client } = require("gabir-motors");
const client = new Client();
Calendar
// Get the current season's calendar
let calendar = await client.getCalendar();
Drivers
// Search for a driver using a query string
// Search with name
let driver_result1 = await client.searchDriver("Gabe");
// Search with number
let driver_result2 = await client.searchDriver("904");
// Search with partial name
let driver_result2 = await client.searchDriver("chri");
Teams
// Get team info from an abbreviation
let team_result1 = await client.getTeam("GM");
Viewer Submitted Content
let random_haiku = await client.getRandomHaiku();
let random_quote = await client.getRandomQuote();
Types
interface Calendar {
season: string;
name: string;
events: Event[];
getNext(): Event | null;
}
interface Event {
track: Content;
cars: Content[];
winner: {
name: string | null;
number: string | null;
};
notes: string | null;
theme: string | null;
date: string;
timestamp: number;
tags: string[];
hasPassed: boolean;
}
interface Content {
name: string;
paid: string;
}
interface Driver {
name: string;
username: string | null;
team?: Team;
car_number: string;
}
interface Team {
name: string;
abbr: string;
social_media_links: Link[];
logo: string;
team_leader: string;
drivers: Driver[];
}
interface Link {
type: string;
link: string;
}