Git Product home page Git Product logo

randr-node's Introduction

R&R Music API Helper Library for node

Build Status Dependency Status npm version


This is my helper library for the R&R Music API. Documentation for the API itself can be found here.

How to use

First, install the library and save it to your package.json file.

npm install --save randr-node

Then require the library and initialise it using your access key. I store my access key in an environmental variable, for ease of deployment. Access tokens are not yet publically available.

var RandR = require('randr-node');
var randr = new RandR(process.env.RANDRMUSICAPIACCESSTOKEN);

Here is an example query to the API

randr.tracks.recommendations({
  id:'medianet:track:104058357'
},function(err,data){
  if(err){console.err(data)}
  else{
    console.log(data);
  }
});

The layout of the wrapper API is nearly identical to that of the API:

randr = {
  tracks:{
    id,
    recommendations
  },
  albums:{
    id,
    similar
  },
  artists:{
    id,
    similar
  },
  search
}

The parameters of each endpoint are passed as options in the first argument to an API call. Bear in mind that when passing multiple ids, the parameter for an array of ids is ids rather than id. You can find the required and optional parameters in the API documentation. I do some parameter validation inside the library, but this is by no means complete, in part because if the validation is done on the API level, this helper client is more flexible to API updates.

Contributing

Please try and stick to the coding style - i.e. don't change how we do indentation, bracketing style, or other similar style choices. Tests are important! Other than that, just submit a Pull Request and I'll merge it when I have time if I'm happy with it.

randr-node's People

Contributors

hughrawlinson avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.