get channel list

This commit is contained in:
Sayem Chowdhury 2021-04-07 19:34:50 +06:00
parent 32a3945f61
commit f3e982c946
3 changed files with 15 additions and 0 deletions

View File

@ -221,7 +221,15 @@ if (process.env.CI) {
});
}
test('GET CHANNEL LIST', async (t) => {
const channel = await api.getChannelList();
t.is(channel.count, channel.data.length);
t.true(Array.isArray(channel.data));
});
test('GET PLAYLIST CHANNEL', async (t) => {
const channel = await api.getPlaylistChannel('dance');
t.deepEqual(Object.keys(channel), ['version', 'page_id', 'ga', 'title', 'persistent', 'sections', 'expire']);
t.truthy(channel.title);
t.true(Array.isArray(channel.sections));
});

View File

@ -8,6 +8,7 @@ import type {
playlistInfo,
playlistTracksType,
playlistChannelType,
channelSearchType,
artistInfoType,
discographyType,
profileType,
@ -130,6 +131,11 @@ export const getUser = async (): Promise<userType> => {
throw new Error(errorMessage);
};
/**
* Get list of channles
*/
export const getChannelList = async (): Promise<channelSearchType> => request({}, 'search_getChannels');
/**
* Get details about a playlist channel
*/

View File

@ -2,6 +2,7 @@ export * from './album';
export * from './artist';
export * from './playlist';
export * from './playlist-channel';
export * from './channel';
export * from './profile';
export * from './search';
export * from './tracks';