remove json apis

This commit is contained in:
tresabhi committed 2026-06-05 12:00:00 -05:00
1 parent 333866a9d6
commit 81e17317be
15 files changed
-210

No files matched your search

@@ -1,23 +0,0 @@
import type { APIContext } from "astro";
import { api } from "../../../api/dynamic";
import { mixStaticPaths } from "../../../astro/mixStaticPaths";
import { getStaticPaths as _getStaticPaths } from "../_index";
export const getStaticPaths = mixStaticPaths(_getStaticPaths, async () => {
const { avatars } = await api.avatars();
return avatars.map(({ id }) => ({ params: { id } }));
});
/**
* Returns data on an avatar based on its `id`. Do not use the `.webp` URLs
* from the returned data as they point to Wargaming's servers which may update
* over time, out of sync with BlitzKit.
*
* @see avatars/list.json for all avatar ids.
* @see avatars/[id].webp for avatar images.
* @type blitzkit/avatar.Avatar
*/
export async function GET({ params }: APIContext<never, { id: string }>) {
const avatar = await api.avatar(params.id);
return Response.json(avatar);
}
@@ -1,14 +0,0 @@
import { api } from "../../../api/dynamic";
export { getStaticPaths } from "../_index";
/**
* Identical to `avatars/[id].json`, but returns data on all avatars at once,
* mapped by `id`.
*
* @type blitzkit/avatars.Avatars
*/
export async function GET() {
const avatars = await api.avatars();
return Response.json(avatars);
}
@@ -1,13 +0,0 @@
import { api } from "../../../api/dynamic";
export { getStaticPaths } from "../_index";
/**
* Returns a list of all avatars ids.
*
* @type blitzkit/avatar_list.AvatarList
*/
export async function GET() {
const list = await api.avatarList();
return Response.json(list);
}
@@ -1,14 +0,0 @@
import type { APIContext } from "astro";
import { api } from "../../../api/dynamic";
import { mixStaticPaths } from "../../../astro/mixStaticPaths";
import { getStaticPaths as _getStaticPaths } from "../_index";
export const getStaticPaths = mixStaticPaths(_getStaticPaths, async () => {
const { backgrounds } = await api.backgrounds();
return backgrounds.map(({ id }) => ({ params: { id } }));
});
export async function GET({ params }: APIContext<never, { id: string }>) {
const background = await api.background(params.id);
return Response.json(background);
}
@@ -1,8 +0,0 @@
import { api } from "../../../api/dynamic";
export { getStaticPaths } from "../_index";
export async function GET() {
const { backgrounds } = await api.backgrounds();
return Response.json(backgrounds);
}
@@ -1,9 +0,0 @@
import { api } from "../../../api/dynamic";
export { getStaticPaths } from "../_index";
export async function GET() {
const { backgrounds } = await api.backgrounds();
const list = backgrounds.map((background) => background.name);
return Response.json(list);
}
@@ -1,28 +0,0 @@
import {
Nation,
TankClass,
TankType,
} from "@protos/blitz_static_tank_component";
import type { APIContext } from "astro";
import { mixStaticPaths } from "../../../astro/mixStaticPaths";
import { GunType } from "../../../tankopedia/characteristics";
import { getStaticPaths as _getStaticPaths } from "../_index";
import { GET as _GET } from "./all.json";
export const ENUMS = {
nation: Nation,
"tank-class": TankClass,
"tank-type": TankType,
"gun-type": GunType,
};
export const getStaticPaths = mixStaticPaths(_getStaticPaths, () => {
return Object.keys(ENUMS).map((name) => ({ params: { enum: name } }));
});
export async function GET({
params,
}: APIContext<never, { enum: keyof typeof ENUMS }>) {
const enums = (await _GET().json()) as Record<string, Record<number, string>>;
return Response.json(enums[params.enum]);
}
@@ -1,22 +0,0 @@
import { ENUMS } from "./[enum].json";
export { getStaticPaths } from "../_index";
export function GET() {
const enums: Record<string, Record<number, string>> = {};
for (const name in ENUMS) {
const _enum = ENUMS[name as keyof typeof ENUMS];
const map: Record<number, string> = {};
for (const key in _enum) {
const value = _enum[key];
if (typeof value !== "string") continue;
map[key] = value;
}
enums[name] = map;
}
return Response.json(enums);
}
@@ -1,8 +0,0 @@
import { ENUMS } from "./[enum].json";
export { getStaticPaths } from "../_index";
export function GET() {
const list = Object.keys(ENUMS);
return Response.json(list);
}
@@ -1,20 +0,0 @@
import type { APIContext } from "astro";
import { api } from "../../../api/dynamic";
import { mixStaticPaths } from "../../../astro/mixStaticPaths";
import { getStaticPaths as _getStaticPaths } from "../_index";
export const getStaticPaths = mixStaticPaths(_getStaticPaths, async () => {
const { list } = await api.tankList();
return list.map(({ id }) => ({ params: { id } }));
});
/**
* Even Noah can't save these animals.
* Even Noah can't save these animals.
* Even Noah can't save these animals.
* Even Noah can't save these animals.
*/
export async function GET({ params }: APIContext<never, { id: string }>) {
const tank = await api.tank(params.id);
return Response.json(tank);
}
@@ -1,11 +0,0 @@
import { api } from "../../../api/dynamic";
export { getStaticPaths } from "../_index";
/**
* Literally all the tanks in one place lmao.
*/
export async function GET() {
const tanks = await api.tanks();
return Response.json(tanks);
}
@@ -1,10 +0,0 @@
import { characteristicsOrder } from "../../../tankopedia/characteristicsOrder";
export { getStaticPaths } from "../_index";
/**
* The naked man fears no pickpocket.
*/
export function GET() {
return Response.json(characteristicsOrder);
}
@@ -1,11 +0,0 @@
import { api } from "../../../api/dynamic";
export { getStaticPaths } from "../_index";
/**
* List!
*/
export async function GET() {
const list = await api.tankList();
return Response.json(list);
}
@@ -1,8 +0,0 @@
import { api } from "../../../api/dynamic";
export { getStaticPaths } from "../_index";
export async function GET() {
const popular = await api.popularTanks();
return Response.json(popular);
}
@@ -1,11 +0,0 @@
import { api } from "../../api/dynamic";
export { getStaticPaths } from "./_index";
/**
* Woah! test.
*/
export async function GET() {
const tiers = await api.tiers();
return Response.json(tiers);
}