beevelop / uniqush.js

Simple Node.js API abstraction for Uniqush

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

npm Code Climate Gemnasium js-standard-style Badges Beevelop

Uniqush.js (API-Docs)

Simple Node.js API abstraction for Uniqush

Example

'use strict'

const uniq = require('uniqush.js')('http://uniqush.beevelop.com')

uniq.version
  .then(console.log)

  // Add GCM via addpsp
  .then(() => {
    return uniq.addGCM('unicorn', 'MagicProjectId', '[**yourGCMapikey**]')
  })
  .then(console.log)

  // Subscribe user "dom.cobb" to GCM PSP
  .then(() => {
    return uniq.subscribeGCM('unicorn', 'dom.cobb', '[**yourDeviceRegId**]')
  })
  .then(console.log)

  // Push to "dom.cobb" via service "unicorn" (the GCM PSP)
  .then(() => {
    return uniq.push('unicorn', 'dom.cobb', {
      title: 'Oh yeah',
      message: 'Did you know that unicorns are awesome?'
    })
  })
  .then(console.log)

  // Unsubscribe "dom.cobb" from "unicorn" (the GCM PSP)
  .then(() => {
    return uniq.unsubscribeGCM('unicorn', 'dom.cobb', '[**yourDeviceRegId**]')
  })
  .then(console.log)

  // Remove "unicorn", the GCM PSP
  .then(() => {
    return uniq.rmGCM('unicorn', 'MagicProjectId', '[**yourGCMapikey**]')
  })
  .then(console.log)

  // Aaaannnnd time for a coffe break
  .then(() => {
    console.log('Done.')
  })

About

Simple Node.js API abstraction for Uniqush


Languages

Language:JavaScript 100.0%