Files
siftlode/frontend/src/lib/api/sync.ts
T
peter 8ce1e0230a 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.
2026-07-28 22:41:34 +02:00

31 lines
1003 B
TypeScript

// The global sync engine: overall status, pause/resume, and a manual subscriptions pull.
// (Per-channel management + my-status/deep-all live in channels.ts.) Only touches core's req.
import { req } from "./core";
export interface SyncStatus {
subscriptions: number;
channels_total: number;
channels_backfilling: number;
videos_total: number;
pending_enrich: number;
quota_used_today: number;
quota_remaining_today: number;
paused: boolean;
is_admin: boolean;
}
export const syncApi = {
status: (): Promise<SyncStatus> => req("/api/sync/status"),
pauseSync: () => req("/api/sync/pause", { method: "POST" }),
resumeSync: () => req("/api/sync/resume", { method: "POST" }),
syncSubscriptions: (): Promise<{
subscriptions: number;
channels_new: number;
channels_detailed: number;
removed_stale: number;
prune_skipped: boolean;
quota_used_estimate: number;
quota_remaining_today: number;
}> => req("/api/sync/subscriptions", { method: "POST" }),
};