Home Reference Source Repository

Ingresse JavaScript SDK

CircleCI Coverage Status

This is the Ingresse JavaScript SDK for node and Browser.

Supported API's:

API Authentication
Ingresse Ingresse Auth
Tickets JWT
Events JWT
EventsSearch Public

Install

To use in node:

$ npm install --save ingresse-sdk

To use in the browser:

<script src="https://cdn.ingresse.com/sdk/ingresse-sdk.js"></script>

How to use

In the Browser

Browser Support

Chrome Firefox Safari Opera Edge IE
Latest ✔ Latest ✔ Latest ✔ Latest ✔ Latest ✔ 8+ ✔

To use in browser include the script dist/browser/ingresse-sdk.js in your .html and create a new instance of the Sdk.

<head>
    <!-- Include Ingresse SDK -->
    <script src="https://cdn.ingresse.com/sdk/ingresse-sdk.js"></script>

    <script>
        // Require Ingresse JS SDK
        var Sdk = require('ingresse-sdk');

        // Create a new SDK instance
        var ingresse = new Sdk();

        // Set the auth token for the ticket api
        ingresse.ticket.auth.setToken('1f2e3ggef4e5.gedgwevrwg.23f2f');

        // Get ticket item with ID: 570
        ingresse.ticket.getItem('570')
            .then(function (response) {
                console.log(response)

            }).catch(function (error) {
                console.log(error)
            });
    </script>
</head>

<body></body>

You can also customize some of the Sdk configuration like the url of the API you want to use.

<head>
    <!-- Include Ingresse SDK -->
    <script src="https://cdn.ingresse.com/sdk/ingresse-sdk.js"></script>

    <script>
        // Require Ingresse JS SDK
        var Sdk = require('ingresse-sdk');

        // Create a new SDK instance passing configuration
        // params for the Ticket API
        var ingresse = new Sdk({
            ticket: {
                env: 'hmla'
            }
        });
    </script>
</head>

<body></body>

In Node

To use in node first install with npm:

$ npm install --save ingresse-sdk

Then you can require the module to use:

var Sdk = require('ingresse-sdk');

var ingresse = new Sdk({
    ticket: {
        env: 'hmla'
    }
});

ingresse.ticket.auth.setToken('123455');

// Get ticket item with ID: 570
ingresse.ticket.getItem('570')
    .then(function (response) {
        console.log(response);
    })
    .catch(function (error) {
        console.log(error);
    });

Development

To build the node|browser module run the command:

$ npm run build

To generete the docs run the command:

$ npm run docs

Documentation

Will run build and docs commands and after will publish the documentation at the GitHub Page.

$ npm run deploy