1.0.9 • Published 7 years ago

jira-agile-api-client v1.0.9

Weekly downloads
1
License
GPL-3.0
Repository
github
Last release
7 years ago

Jira agile api client

This is a Javascript wrapper around the JIRA Software Cloud REST API.

Installation

npm install jira-agile-api-client

Setup

Node.js

var api = require('jira-agile-api-client');
var btoa = require('btoa');

// Import fetch polyfill.
global.fetch = require('node-fetch');

// Set JIRA Url.
api.setEndpoint('https://jira.example.com');

// Set login data.
api.setSetting('headers', {
  'Authorization': 'Basic '+btoa('USERNAME:PASSWORD')
});

Browser apps - online

The app either needs to be in the same domain or CORS should be set up.

var api = require('jira-agile-api-client');
api.setEndpoint('https://jira.example.com');

Browser apps - local

Start with npm run dev-server and provide jira url, your username and password. Use http://localhost:3001 as endpoint.

var api = require('jira-agile-api-client');
api.setEndpoint('http://localhost:3001');

Usage

Get day-by-day sprint statistics.

api.util.getSprintWithHistory(boardId, sprintId).then(function (result) {
  console.log(result.history);

  // result.history
  // [{
  //   "date": "2017-01-01",
  //   "stats": {
  //     "To Do": 10.5,
  //     "Done": 5,
  //     ...
  //   }
  // }, {
  //   "date": "2017-01-02",
  //   "stats": {
  //     "To Do": 9,
  //     "Done": 6,
  //     ...
  // }]

  console.log(result.sprint);
  console.log(result.issues);
}).catch(function (error) {
  console.log(error);
});

Get all boards

api.board.getList().then(function (boards) {
  console.log(boards);
}).catch(function (error) {
  console.log(error);
});

Get all sprints in a board

api.board.getSprints(boardId).then(function (boards) {
  console.log(boards);
}).catch(function (error) {
  console.log(error);
});

Create a new sprint

api.sprint.create(name, boardId).then(function (sprint) {
  console.log(sprint);
}).catch(function (error) {
  console.log(error);
});

Move issues to a sprint

api.sprint.moveIssuesToSprint(sprintId, ['TEST-1', 'TEST-2']).then(function (result) {
  console.log(result);
}).catch(function (error) {
  console.log(error);
});

See src/index.js for a full list of available methods.

1.0.9

7 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago