Musicfetch

Musicfetch SDK

Musicfetch has a dedicated JS/TS library providing a type-safe interface to the Musicfetch API as well as brand assets to get your UI off the ground quickly.

npm install musicfetch

Usage

Once musicfetch is installed into your node.js/browser project you can import it like any other NPM package. Configure an instance with your token and then use it throughout your app.

import Musicfetch from 'musicfetch';
// initialize once
export const musicfetch = new Musicfetch({
token: YOUR_TOKEN,
});
Then use it throughout your application
import { musicfetch } from './my-musicfetch'
const result = await musicfetch.url({
url: 'https://open.spotify.com/track/…',
services: ['appleMusic', 'youtube'],
});

Using brand assets

The musicfetch package comes bundled with all brand names, SVG icons and colors, making building a slick UI that bit faster. Icons come as React components, SVG strings or SVG files.

import brands from 'musicfetch/brands';
import { BrandIcon } from 'musicfetch/react';
const BrandCard = (link) => {
// resolve brand from a link or key (eg. 'spotify')
const brand = brands.resolve(link);
return (
<div style={{ background: brand.color }}>
<h2>{brand.name}</h2>
<BrandIcon brand={brand} size={32} />
</div>
);
};