import type { PluginContext } from "@sttracker/plugin-sdk/types"; export const BASE_URL = "https://api.mangabaka.org"; /** The host builds the HttpClient; it should use this rate for this plugin. */ export const RATE_PER_MINUTE = 150; export interface ApiSource { id?: number | string | null } export interface ApiSeries { id: number; title: string; type?: string | null; state?: string | null; merged_with?: number | null; year?: number | null; source?: { anilist?: ApiSource | null; my_anime_list?: ApiSource | null; manga_updates?: ApiSource | null; kitsu?: ApiSource | null; } | null; } export interface ApiEntry { series_id: number; state?: string | null; rating?: number | null; progress_chapter?: number | null; progress_volume?: number | null; start_date?: string | null; finish_date?: string | null; note?: string | null; series?: ApiSeries | null; } export interface LibraryPage { data: ApiEntry[]; pagination?: { page?: number; total_pages?: number } | null; } export interface ChangesPage { data: { type: "upsert" | "delete"; entry?: ApiEntry; series_id: number }[]; next_cursor?: string | null; } export function authHeaders(ctx: PluginContext): Record { const token = ctx.config.token; if (typeof token !== "string" || token === "") throw new Error("mangabaka: token is not configured"); return { "x-api-key": token }; }