aboutsummaryrefslogtreecommitdiff
path: root/examples/oauth.js
blob: 575d0d09f2c66fb786793544ad91bec098ac43fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
var Active911 = require('../');
var client = new Active911.RefreshClient('YOUR REFRESH TOKEN');

client.getAgency().then(function(agency) {
  console.log(agency.name);
  agency.devices.forEach(function(deviceInfo) {
    client.getDevice(deviceInfo.id).then(function(device) {
      console.log(device.name);
    }).catch(function(err) {
      console.log('Error retrieving device info for #' + deviceInfo.id);
    });
  });
}).catch(function(err) {
  console.log('Error retrieving agency info:', err);
});