-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
187 lines (149 loc) · 4.79 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
declare module '@huangsh/music-api' {
interface album {
id: number | string
name: string
cover: string
}
interface artist {
id: number | string
name: string
}
interface musicInfo {
id: number | string
name: string
album: album
artists: Array<artist>
commentId: number | string
cp: boolean
dl: boolean
quality: {
192: boolean,
320: boolean,
999: boolean
}
}
interface errorResult {
status: false
msg: string
log: any
}
interface searchSongResult {
total: number
songs: Array<musicInfo>
}
interface searchSongOptions {
keyword: string
limit: number
offset: number
type?: number
}
interface getSongDetailResult {
status: true,
data: musicInfo
}
interface getBatchSongDetailResult {
status: true,
data: Array<musicInfo>
}
interface getArtistSongsResult {
status: true,
data: {
detail: {
id: number | string,
name: string,
avatar: string,
desc: string
},
songs: Array<musicInfo>
}
}
interface getAlbumSongsResult {
status: true,
data: {
detail: {
id: number | string,
name: string,
cover: string,
desc: string
},
songs: Array<musicInfo>
}
}
enum qqSongLever {
high,
normal,
low
}
interface getSongUrlResult {
status: true
data: {
url: string
}
}
interface getLyricResult {
status: true
data: Array<string>[]
}
interface qqCommentInfo {
avatarurl: string
nick: string
rootcommentcontent: string
}
interface getCommentResult {
status: true
data: {
hotComments: Array<qqCommentInfo>
comments: Array<qqCommentInfo>
total: number
}
}
interface musicApiBase {
searchSong(options: searchSongOptions): Promise<searchSongResult | errorResult>
getSongDetail(id: number | string, getRaw?: boolean): Promise<getSongDetailResult | errorResult>
getSongUrl(id: number | string, level?: qqSongLever): Promise<getSongUrlResult | errorResult>
getLyric(id: number | string): Promise<getLyricResult | errorResult>
getComment(commentId: number | string, pagenum: number, pagesize: number): Promise<getCommentResult | errorResult>
}
export interface qq extends musicApiBase {
}
export interface xiami extends musicApiBase {
getXiamiToken(api: string): Promise<{ token: string, signedToken: string }>
parseLocation(location: string): string
}
interface getTopListResult {
status: true
data: {
name: string,
description: string,
cover: string,
playCount: number,
list: Array<musicInfo>
}
}
export interface netease extends musicApiBase {
getTopList(id: number | string): Promise<getTopListResult | errorResult>
}
interface musicApiSearchSongResult {
status: true,
data: {
netease: searchSongResult,
qq: searchSongResult,
xiami: searchSongResult
}
}
export function searchSong(keyword: string, offset?: number): Promise<musicApiSearchSongResult | errorResult>
enum vendor {
netease = 'netease',
qq = 'qq',
xiami = 'xiami'
}
export function getSongDetail(vendor: vendor, id: number | string): Promise<getSongDetailResult | errorResult>
export function getSongUrl(vendor: vendor, id: number | string): Promise<getSongUrlResult | errorResult>
export function getLyric(vendor: vendor, id: number | string): Promise<getLyricResult | errorResult>
export function getTopList(id: string): Promise<getTopListResult | errorResult>
export function getComment(vendor: vendor, id: number | string, offset?: number, limit?: number): Promise<getCommentResult | errorResult>
export function getBatchSongDetail(vendor: vendor, ids: Array<number | string>): Promise<getBatchSongDetailResult | errorResult>
export function getArtistSongs(vendor: vendor, ids: number | string, offset?: number, limit?: number): Promise<getArtistSongsResult | errorResult>
export function getAlbumSongs(vendor: vendor, ids: number | string, offset?: number, limit?: number): Promise<getAlbumSongsResult | errorResult>
export function getAnyVendorSongDetail(list: Array<{vendor: vendor, id: number}>) : Promise<Array<musicInfo>>
}