JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q65452F
  • License MIT

Node.js NPR API client

Package Exports

  • npr-api

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (npr-api) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Node.js NPR API Build Status

A Node.js package for accessing NPR APIs.

Requirements

This module is a npm package, and requires the latest stable version of node.js.

$ node -v
v0.12.7

Installation

$ mkdir npr_test && cd npr_test
$ npm install npr-api

Usage

As of right now, the full NPR One API is available in this package. There are more examples in the test directory.

Example: getting recommendations for your user

// paste into a file called index.js,
// and edit the credentials to match
// your account info.
var NPR = require('npr-api');

var npr = NPR({
  client_id: 'your_client_id',
  client_secret: 'your_client_secret',
  username: 'your_username',
  password: 'your_password'
});

npr.one.init()
  .then(npr.one.listening.getRecommendations({ channel: 'npr' }))
  .then(function(recommendations) {
    console.log(recommendations);
  }).catch(console.err);

Then you can run this example by running:

$ node index.js

NPR ONE APIs

More information about the NPR One API can be found at the NPR One Developer Center.

  • Authorization
    • npr.one.authorization.createToken()
    • npr.one.authorization.generateDeviceCode()
    • npr.one.authorization.getAuthorizationPage()
  • Identity
    • npr.one.identity.getUser()
    • npr.one.identity.postFollowing()
    • npr.one.identity.updateFollowingStatus()
    • npr.one.identity.updateStations()
  • Listening
    • npr.one.listening.getAggRecommendations()
    • npr.one.listening.getChannels()
    • npr.one.listening.getHistory()
    • npr.one.listening.getRecommendations()
    • npr.one.listening.getSearchRecommendations()
    • npr.one.listening.postRating()
  • Local Activation
    • npr.one.localactivation.sendDonationEmail()
  • Sponsorship
    • npr.one.sponsorship.getAds()
    • npr.one.sponsorship.receiveAdTracking()

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Gulp.

License

Copyright (c) 2015 Adafruit Industries. Licensed under the MIT license.