song.link API
Simple client to query song.link's API.
Usage
This library exports the following two functions:
getLinks(params: SonglinkRequestParams, apiParams?: SonglinkAPIParams) => Promise<SonglinkResponse>
SongLinkParams
is described on song.link's docs for their API. You can check it here
SonglinkAPIParams
is an object containing two optional keys:
url
: URL to song.link's APIapiKey
: API Key as described here
Example:
songlink.getLinks .then
getClient(apiParams: SonglinkAPIParams): (params: SonglinkRequestParams) => Promise
The types remain the same as in getLinks but this will return a new getLinks function, which does not require you to pass the API parameters every time.
This function is usefull in case you have an API key and intend to call getLinks
in various places of your code.
Example:
getLinks .then
TODOs
- Allow custom HTTP clients
- Allow options to be passed directly to axios