xref: /MusicFree/src/types/common.d.ts (revision 1fa77b042dffea2ad8db31c1b15672ed8f3755cf)
1declare namespace ICommon {
2    /** 支持搜索的媒体类型 */
3    export type SupportMediaType = 'music' | 'album' | 'artist' | 'sheet';
4
5    /** 媒体定义 */
6    export type SupportMediaItemBase = {
7        music: IMusic.IMusicItemBase;
8        album: IAlbum.IAlbumItemBase;
9        artist: IArtist.IArtistItemBase;
10        sheet: IMusic.IMusicSheetItemBase;
11    };
12
13    export type IUnique = {
14        id: string;
15        [k: string | symbol]: any;
16    };
17
18    export type IMediaBase = {
19        id: string;
20        platform: string;
21        $?: any;
22        [k: symbol]: any;
23        [k: string]: any;
24    };
25
26    /** 一些额外信息 */
27    export type IMediaMeta = {
28        lrc?: string;
29        associatedLrc?: IMediaBase;
30        headers?: Record<string, any>;
31        url?: string;
32        id?: string;
33        platform?: string;
34        qualities?: IMusic.IQuality;
35        $?: {
36            local?: {
37                localLrc?: string;
38                [k: string]: any;
39            };
40            [k: string]: any;
41        };
42        [k: string]: any;
43        [k: symbol]: any;
44    };
45
46    export type WithMusicList<T> = T & {
47        musicList?: IMusic.IMusicItem[];
48    };
49
50    export type PaginationResponse<T> = {
51        isEnd?: boolean;
52        data?: T[];
53    };
54}
55