Socket
Socket
Sign inDemoInstall

tq1-public-sdk

Package Overview
Dependencies
40
Maintainers
2
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    tq1-public-sdk

Node.js SDK used to access TQ1 Public API described at http://docs.tq1publicapi.apiary.io


Version published
Maintainers
2
Install size
2.48 MB
Created

Readme

Source

TQ1 Node.js Public API SDK

Build Status

Install

  1. Add tq1-public-sdk dependency to your package.json

Usage

Setup

Provided with the Application Key and an API Access Token, create a client as following


var tq1 = require('tq1-public-sdk');

var client = tq1('my application key', 'my application token');

Calling the API

API call examples:


// Fetching metadata

client.fetchMetadata(function(err, data) {
  // data will be an object like the one described at http://docs.tq1publicapi.apiary.io/#reference/authentication/fetch-metadata/get
});

// Sending Exclusive push notification to client with id 123456

var notification = {
  'status': 0,
  'parameters': {
    'custom': {
      'Client Code': ['123456']
    }
  },
  'content': {
    'title': 'Message title (for admin and reports purposes only)',
    'message': 'push notification message (will be shown on user device)',
    'scheduled_at': 1420741200,
  },
  'audienceText': ['Message for user with code 123456'],
  "max_audience": 1
};

client.schedulePushExclusiveNotification(notification, function(err, data) {
  // data will be an object like the one described at http://docs.tq1publicapi.apiary.io/#reference/authentication/new-exclusive-push-notification/post
});

Error handling

All calls that result in an error of some sort (validation or HTTP failure), will have an error object containing the following properties:

  • name: It is a string constant with value equal to "TQError", which can also be checked/compared with the .constants.errorName property of the client
  • message: Contains an error message string informing the error reason.
client.schedulePushExclusiveNotification(null, function(err, data) {
  // err.name == client.constants.errorName
  // > true
});

Test

$ npm install
$ npm test

FAQs

Last updated on 16 Dec 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc