From d15995d19ec686302145bda466e46806551a57f1 Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Thu, 23 Apr 2026 08:22:33 -0400 Subject: [PATCH] feat(web): add library API types mirroring internal/api/types.go --- web/src/lib/api/types.ts | 48 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 web/src/lib/api/types.ts diff --git a/web/src/lib/api/types.ts b/web/src/lib/api/types.ts new file mode 100644 index 00000000..8ac29936 --- /dev/null +++ b/web/src/lib/api/types.ts @@ -0,0 +1,48 @@ +// Mirrors internal/api/types.go. Kept minimal — only the shapes the SPA +// actually reads today (no LoginRequest/LoginResponse here; those live in +// client.ts alongside the auth plumbing). + +export type Page = { + items: T[]; + total: number; + limit: number; + offset: number; +}; + +export type ArtistRef = { + id: string; + name: string; + album_count: number; +}; + +export type AlbumRef = { + id: string; + title: string; + artist_id: string; + artist_name: string; + year?: number; + track_count: number; + duration_sec: number; + cover_url: string; +}; + +export type TrackRef = { + id: string; + title: string; + album_id: string; + album_title: string; + artist_id: string; + artist_name: string; + track_number?: number; + disc_number?: number; + duration_sec: number; + stream_url: string; +}; + +export type ArtistDetail = ArtistRef & { + albums: AlbumRef[]; +}; + +export type AlbumDetail = AlbumRef & { + tracks: TrackRef[]; +};