1.0.2 • Published 3 years ago

node-itglue v1.0.2

Weekly downloads
3
License
MIT
Repository
github
Last release
3 years ago

node-itglue

Simple authentication bindings for ITGlue.

Authentication

This library offers three methods of authentication: api key, bearer and user.

API Key

const ITGlue = require('node-itglue');

const itg = new ITGlue({
  // API Key auth
  // your api key
  apikey: 'abcdef12345',
 
  // optional
  // set true if you're connecting to the European datacenter with API Key auth
  eu: false, 
  // timeout in ms
  timeout: 10000, 
  
  // set the authentication mode
  // one of ['apikey', 'user', 'bearer', 'user-bearer']
  mode: 'apikey',
  // required when mode is set to 'user'
  // https://<your company>.itglue.com
  subdomain: 'yourcompany',
  // required when mode is set to 'user'
  user: { 
    email: 'user@yourcompany.com', 
    password: 'userpassword'
  },
  // JWT, required when mode is set to 'bearer' or 'user-bearer'
  token: '12345abcdef' 
})


itg.get({path, params})
  .then(result => {
    // result
  })
  .catch(error => {
    // error
  });
  
itg.post({path, params, body}).then()

itg.delete({path, params}).then()

itg.patch({path, params, body}).then()

Bearer Authentication

const itg = new ITGlue({
  mode: 'bearer',
  token,
})

User Authentication

The library will request and cache a new bearer token in memory for the duration of the running process.

const itg = new ITGlue({
  mode: 'user',
  subdomain,
  user: {
    email, 
    password,
  }
})

Search

Using user-bearer authentication, a search endpoint is provided.

const itg = new ITGlue({
  mode: 'user-bearer',
  subdomain,
  token
});

itg.search({
  query,       // wildcard match
  related,     // return related items
  limit,       // page size
  kind,        // comma separated list of types, e.g. passwords,organizations
  sort,        // property to sort
  filter_organization_id   // filter results to an organization
})
1.0.2

3 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.4.2

5 years ago

0.4.1

5 years ago

0.4.0

5 years ago

0.3.0

5 years ago

0.2.0

5 years ago

0.1.0

5 years ago

0.0.2

6 years ago

0.0.1

6 years ago