Socket
Book a DemoInstallSign in
Socket

musikki

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

musikki

JavaScript client for Musikki's Music API

1.1.3
latest
Source
npmnpm
Version published
Maintainers
1
Created
Source

Musikki Music API

JavaScript client for Musikki's Music API

https://music-api.musikki.com

Usage

First, include this module and create an instance:

$ npm install musikki
const Musikki = require('musikki');
let musikki = new Musikki({ appid: yourAppID, appkey: yourAppKey });

This implementation abstracts Music API's endpoints and methods with a familiar javascript chaining syntax:

musikki.endpoint(mkid).method(filter, paging);

All parameters are optional or required, depending on the specific endpoint and method called (see API documentation for more information)

endpoint — A Music API endpoint, like artist or video

method — A Music API endpoint method, like search or info

mkid — Musikki ID of a specific resource

filter — An object containing the filter parameters specific to the given method

paging — An object containing the pagination options (page number and results limit)

To find all artists that match a given name

musikki.artists().search({ 'artist-name': 'slowdive' })
        .then(console.log);
musikki.artists().search({ 'artist-name': 'the' }, { limit: 100, page: 10 })
        .then(console.log);

To obtain info about a given artist

musikki.artists(100038744).info()
    .then(console.log);

Different casing styles for method parameters

Method parameter (filter) names are automatically transformed (using lodash.kebabCase) to the correct format used by the music API so you can pick any style that fits your code best.

musikki.artists().search({ artistName: 'morbid angel', label_name: 'earache' })
        .then(console.log);

Handling errors

Any error the library encounters during usage will be wrapped and passed in a rejected promise so you can .catch it.

musikki.artists().search()
    .then(console.log)
    .catch(console.error);
{ status: 400, message: 'Bad Request', payload: { error: { message: 'invalid query!', detail: [Object] } } }

FAQs

Package last updated on 22 Oct 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.