0.0.1 • Published 8 years ago

uniqush.js v0.0.1

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

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.')
  })
0.0.1

8 years ago