@vlgroup/rhymba-typescript-sdk
v1.0.4
Published
Typescript SDK for VL Group's Rhymba API.
Downloads
5
Readme
Rhymba API SDK
Typescript SDK for VL Group's Rhymba API.
It uses npm, TypeScript compiler, Jest, webpack, ESLint, Prettier, husky, pinst, commitlint. The production files include CommonJS, ES Modules, UMD version and TypeScript declaration files.
#Documentation General instructions for the Rhymba API.
Sign Up for the Rhymba API to get an Access Token.
Use prebuilt functions to quickly request data.
const search = new Search(accessToken);
const media = search.getMediaByArtistName('Elvis');
Use OData functions to request exactly the data and properties you need.
const search = new Search(accessToken);
const media = search.service.Medias(mediaId).query((builder) => {
return builder
.select('id')
.select('name')
.select('artist_id')
.select('artist_name')
.top(25);
});
Get a url for a Preview MP3
const preview = new Preview(accessToken);
const url = preview.getPreviewUrl(mediaId);
Get an Album Cover url
const images = new Images();
const url = images.getAlbumCover(albumId);
Search by Keyword
const search = new Search(accessToken);
const media = search.getMediaByKeyword('love');
Build your own search using Keyword
const search = new Search(accessToken);
const media = search.service.Medias(mediaId).query(
(builder) => {
return builder
.select('id')
.select('name')
.select('artist_id')
.select('artist_name')
.top(25);
},
{
params: {
keyword: "'" + encodeURIComponent(keyword) + "'",
access_token: accessToken
}
}
);
Return multiple results by Media ID (id_cdl)
const search = new Search(accessToken);
const media = search.getMediaByIdCdl([mediaId1, mediaId2]);
Build your own search using id_cdl
const id_cdl = [mediaId1, mediaId2];
const search = new Search(accessToken);
const media = search.service.Medias(mediaId).query(
(builder) => {
return builder
.select('id')
.select('name')
.select('artist_id')
.select('artist_name')
.top(25);
},
{
params: {
id_cdl: "'" + JSON.stringify(id_cdl) + "'",
access_token: accessToken
}
}
);