TypeScript definitions for the Fandom + MediaWiki APIs.
npm install fandom-api-typesdiscord-api-types, this package provides a stable,
bash
npm install fandom-api-types
or
yarn add fandom-api-types
or
pnpm add fandom-api-types
or
bun add fandom-api-types
`
Usage
`ts
import { Rest, Action, Fandom, Generated, Routes } from "fandom-api-types";
// REST API types
const page: Rest.Page = {
id: 12345,
key: "Example_Page",
title: "Example Page",
// ...
};
// Action API types
const query: Action.MWQueryResponse = {
batchcomplete: "",
query: {
pages: {
"123": { pageid: 123, title: "Foo", ns: 0 }
}
}
};
// Fandom-specific types
const user: Fandom.FandomUser = {
id: "1",
name: "Admin",
avatar: "https://..."
};
// Auto-generated types from live API responses
const searchResult: Generated.MWQuerySearchResponse = {
query: {
search: [
{ title: "Result", pageid: 1 }
]
}
};
// Route helpers
const url = Routes.rest.page("https://community.fandom.com", "Main_Page");
// -> "https://community.fandom.com/w/rest.php/v1/page/Main_Page"
`
Documentation
Documentation for the fandom-api-types` package can be found at: