feat(web): add library API types mirroring internal/api/types.go

This commit is contained in:
2026-04-23 08:22:33 -04:00
parent ea17be9d45
commit d15995d19e
+48
View File
@@ -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<T> = {
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[];
};