forked from MakcRe/KuGouMusicApi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
interface.d.ts
202 lines (143 loc) · 7.65 KB
/
interface.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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
export type BufferLike<T = any> = Buffer | string | Object | Record<string | number | symbol, T>;
export type ExpressExtension = { server?: import('http').Server };
export type UseAxios = (config: UseAxiosRequestConfig) => Promise<UseAxiosResponse>;
export type UseModuleParams<T = any> = Record<string, T> & { cookie?: Record<string, string> };
export type UseModule = (req: UseModuleParams, useAxios: UseAxios) => Promise<UseAxiosResponse>;
export type ModuleDefinition = { identifier?: string; route: string; module: UseModule };
export type EncryptType = 'android' | 'web' | 'register';
export interface UseAxiosRequestConfig<T = any> {
method: 'get' | 'GET' | 'post' | 'POST';
url: string;
baseURL?: string;
params?: T;
data?: T;
headers?: Record<string, string | number>;
cookie?: { [key: string]: string | number };
encryptType: EncryptType;
encryptKey?: boolean;
clearDefaultParams?: boolean;
ip?: string;
realIP?: string;
}
export type APIBaseResponse = { data: any; errcode: number; status: number; error: string; [index: string]: unknown };
export interface UseAxiosResponse<T = APIBaseResponse> {
status: number;
body: T;
cookie: string[];
headers?: Record<string, string>;
}
export type RequestBaseConfig = { cookie?: { [key: string]: string | number }; realIP?: string; proxy?: string };
export type MultiPageConfig = { page?: number | string; pagesize?: number | string };
export function startService(): Promise<import('express').Express & ExpressExtension>;
export function getModulesDefinitions(modulesPath: string, specificRoute: Record<string, string>, doRequire?: boolean): Promise<ModuleDefinition[]>;
export function createRequest(params: UseAxiosRequestConfig): Promise<UseAxiosResponse>;
// API
export function login_cellphone(params: { mobile: number; code: number | string } & RequestBaseConfig): Promise<Response>;
export function login(params: { username: string; password: string } & RequestBaseConfig): Promise<UseAxiosResponse>;
export function login_openplat(params: { code: string } & RequestBaseConfig): Promise<UseAxiosResponse>;
export function login_qr_key(params?: RequestBaseConfig): Promise<UseAxiosResponse>;
export function login_qr_create(parmas: { key: string; qrimg?: boolean } & RequestBaseConfig): Promise<UseAxiosResponse>;
export function login_qr_check(params: { key: string } & RequestBaseConfig): Promise<UseAxiosResponse>;
export function login_wx_create(params?: RequestBaseConfig): Promise<UseAxiosResponse>;
export function login_wx_check(params: { uuid: string; timestamp?: string | number } & RequestBaseConfig): Promise<UseAxiosResponse>;
export function login_token(params: { token: string; userid: string | number } & RequestBaseConfig): Promise<UseAxiosResponse>;
export function captcha_sent(params: { mobile: string | number } & RequestBaseConfig): Promise<UseAxiosResponse>;
export function register_dev(params?: RequestBaseConfig): Promise<UseAxiosResponse>;
export function user_detail(params?: RequestBaseConfig): Promise<UseAxiosResponse>;
export function user_playlist(params?: RequestBaseConfig & MultiPageConfig): Promise<UseAxiosResponse>;
export function user_follow(params?: RequestBaseConfig): Promise<UseAxiosResponse>;
export function user_listen(params?: { type?: 0 | 1 } & RequestBaseConfig): Promise<UseAxiosResponse>;
export function user_history(params?: { bp?: string } & RequestBaseConfig): Promise<UseAxiosResponse>;
export enum PlaylistAdd {
Add = 0,
Collect = 1,
}
export function playlist_add(
params: {
name: string;
list_create_userid: string | number;
list_create_listid: number | string;
type: PlaylistAdd.Collect;
list_create_gid: string;
} & RequestBaseConfig
): Promise<UseAxiosResponse>;
export function playlist_add(
params: {
name: string;
list_create_userid: string | number;
list_create_listid: number | string;
type: PlaylistAdd.Add;
is_pri?: 1 | 0;
} & RequestBaseConfig
): Promise<UseAxiosResponse>;
export function playlist_del(params: { listid: number | string } & RequestBaseConfig): Promise<UseAxiosResponse>;
export function playlist_tracks_add(params: { listid: number | string; data: string } & RequestBaseConfig): Promise<UseAxiosResponse>;
export function playlist_tracks_del(params: { listid: number | string; fileids: string } & RequestBaseConfig): Promise<UseAxiosResponse>;
export enum TopAlbum {
ZH = 1,
EA = 2,
JP = 3,
KR = 4,
}
export function top_album(params?: { type?: TopAlbum } & MultiPageConfig & RequestBaseConfig): Promise<UseAxiosResponse>;
export function album(params: { album_id: string; fields?: string } & RequestBaseConfig): Promise<UseAxiosResponse>;
export function album_detail(params: { id: string | number } & RequestBaseConfig): Promise<UseAxiosResponse>;
export function album_songs(params: { id: string | number } & MultiPageConfig & RequestBaseConfig): Promise<UseAxiosResponse>;
export enum SongURLQuality {
Piano = 'piano',
Acappella = 'acappella',
Subwoofer = 'subwoofer',
Ancient = 'ancient',
Surnay = 'surnay',
DJ = 'dj',
128 = '128',
320 = '320',
Flac = 'flac',
HiRes = 'high',
ViperAtmos = 'viper_atmos',
ViperClear = 'viper_clear',
ViperTape = 'viper_tape',
}
export function song_url(
params: {
hash: string;
album_id?: number | string;
free_part?: boolean;
album_audio_id?: number | string;
quality?: SongURLQuality;
} & RequestBaseConfig
): Promise<UseAxiosResponse>;
export function song_climax(params: { hash: string } & RequestBaseConfig): Promise<UseAxiosResponse>;
export enum SearchType {
Special = 'special',
Lyric = 'lyric',
Song = 'song',
Album = 'album',
Author = 'author',
MV = 'mv',
}
export function search(params: { keyword: string; type?: SearchType } & MultiPageConfig & RequestBaseConfig): Promise<UseAxiosResponse>;
export function search_default(params?: RequestBaseConfig): Promise<UseAxiosResponse>;
export function search_complex(params: { keyword: string } & MultiPageConfig & RequestBaseConfig): Promise<UseAxiosResponse>;
export function search_hot(params?: RequestBaseConfig): Promise<UseAxiosResponse>;
export function search_lyric(params: { keyword: string; album_audio_id?: string | number } & RequestBaseConfig): Promise<UseAxiosResponse>;
export function search_lyric(params: { hash: string; album_audio_id?: string | number } & RequestBaseConfig): Promise<UseAxiosResponse>;
export function lyric(
params: { id: string | number; accesskey: string; fmt?: 'lrc' | 'krc'; decode?: boolean } & RequestBaseConfig
): Promise<UseAxiosResponse>;
export function playlist_tags(params?: RequestBaseConfig): Promise<UseAxiosResponse>;
export enum TopPlaylistCategory {
Recommend = 0,
HIRES = 11292,
}
export function top_playlist(
params: { category_id: TopPlaylistCategory | number | string; withsong?: 0 | 1; withtag?: 0 | 1 } & RequestBaseConfig
): Promise<UseAxiosResponse>;
export function theme_playlist(params?: RequestBaseConfig): Promise<UseAxiosResponse>;
export function playlist_effect(params?: RequestBaseConfig): Promise<UseAxiosResponse>;
export function playlist_detail(params: { ids: string } & RequestBaseConfig): Promise<UseAxiosResponse>;
export function playlist_track_all(params: { id: string } & MultiPageConfig & RequestBaseConfig): Promise<UseAxiosResponse>;
export function playlist_track_all_new(params: { lisdid: string | number } & MultiPageConfig & RequestBaseConfig): Promise<UseAxiosResponse>;
export function playlist_similar(params: { ids: string } & RequestBaseConfig): Promise<UseAxiosResponse>;
export function theme_playlist_track(params: { theme_id: string | number } & RequestBaseConfig): Promise<UseAxiosResponse>;
export function theme_music(params?: RequestBaseConfig): Promise<UseAxiosResponse>;