6.0.3 • Published 2 years ago

truefit-jira-client v6.0.3

Weekly downloads
3
License
-
Repository
github
Last release
2 years ago

Truefit's Fork

A list of what we have changed:

  • add getGroups function
  • Add includeFutureSprints and includeHistoricSprints on listSprints function
  • Get Tempo Worklog for user and date range
  • Add getUser function
  • Add listWorklog function

JavaScript JIRA API for node.js

A node.js module, which provides an object oriented wrapper for the Jira Rest API.

Documentation Jira Rest API Build Status

Installation

Install with the node package manager npm:

$ npm install jira-client

Examples

Create the JIRA client

// With ES5
var JiraApi = require('jira-client');

// With ES6
import JiraApi from 'jira-client';

// Initialize
var jira = new JiraApi({
  protocol: 'https',
  host: 'jira.somehost.com',
  username: 'username',
  password: 'password',
  apiVersion: '2',
  strictSSL: true,
});

Find the status of an issue

// ES5
// We are using an ES5 Polyfill for Promise support. Please note that if you don't explicitly
// apply a catch exceptions will get swallowed. Read up on ES6 Promises for further details.
jira
  .findIssue(issueNumber)
  .then(function (issue) {
    console.log('Status: ' + issue.fields.status.name);
  })
  .catch(function (err) {
    console.error(err);
  });

// ES6
jira
  .findIssue(issueNumber)
  .then((issue) => {
    console.log(`Status: ${issue.fields.status.name}`);
  })
  .catch((err) => {
    console.error(err);
  });

// ES7
async function logIssueName() {
  try {
    const issue = await jira.findIssue(issueNumber);
    console.log(`Status: ${issue.fields.status.name}`);
  } catch (err) {
    console.error(err);
  }
}