refactor(api): extract 8 content domains into api/*.ts slices (R7.5 S1)

Move feed, channels, sync, playlists, tags, notifications, saved-views and
quota out of the lib/api.ts god object into per-domain slice modules, each
owning its own types + method slice and spread into the façade. The `api`
object shape and all 54 call sites are unchanged; account/auth/setup/admin
stay inline until S2.

Reunites the interleaved tags read/CRUD that motivated the epic.
This commit is contained in:
2026-07-28 22:41:34 +02:00
parent 81d0943fdc
commit 8ce1e0230a
9 changed files with 607 additions and 535 deletions
+29
View File
@@ -0,0 +1,29 @@
// YouTube API quota usage: the signed-in user's own totals and the admin cross-user view.
// Only touches core's req.
import { req } from "./core";
export interface MyUsage {
today: number;
last_7d: number;
last_30d: number;
all_time: number;
by_action: Record<string, number>;
}
export interface AdminQuotaRow {
user_id: number | null;
email: string;
total: number;
by_action: Record<string, number>;
}
export interface AdminQuota {
range_days: number;
rows: AdminQuotaRow[];
daily: { day: string; total: number }[];
}
export const quotaApi = {
myUsage: (): Promise<MyUsage> => req("/api/quota/my-usage"),
adminQuota: (days = 30): Promise<AdminQuota> => req(`/api/quota/admin?days=${days}`),
};