1 | # JavaScript JIRA API for node.js #
|
2 |
|
3 | A node.js module, which provides an object oriented wrapper for the Jira Rest API.
|
4 |
|
5 | [![Documentation](https://img.shields.io/badge/Documentation--green.svg)](https://jira-node.github.io/)
|
6 | [![Jira Rest API](https://img.shields.io/badge/Jira%20Rest%20API--green.svg)](http://docs.atlassian.com/jira/REST/latest/)
|
7 | [![Run tests](https://github.com/jira-node/node-jira-client/workflows/Run%20tests/badge.svg)](https://github.com/jira-node/node-jira-client/actions)
|
8 | [![npm](https://img.shields.io/npm/v/jira-client.svg)](https://www.npmjs.com/package/jira-client)
|
9 | [![Downloads](https://img.shields.io/npm/dm/jira-client.svg)](https://npmjs.com/jira-client)
|
10 | [![Install Size](https://packagephobia.now.sh/badge?p=jira-client)](https://packagephobia.now.sh/result?p=jira-client)
|
11 | [![dependency Status](https://david-dm.org/jira-node/node-jira-client/status.svg)](https://david-dm.org/jira-node/node-jira-client)
|
12 | [![devDependency Status](https://david-dm.org/jira-node/node-jira-client/dev-status.svg)](https://david-dm.org/jira-node/node-jira-client?type=dev)
|
13 |
|
14 | ## Installation ##
|
15 |
|
16 | Install with the node package manager [npm](http://npmjs.org):
|
17 |
|
18 | ```shell
|
19 | $ npm install jira-client
|
20 | ```
|
21 |
|
22 | ## Examples ##
|
23 |
|
24 | ### Create the JIRA client ###
|
25 |
|
26 | ```javascript
|
27 | // With ES5
|
28 | var JiraApi = require('jira-client');
|
29 |
|
30 | // With ES6
|
31 | import JiraApi from 'jira-client';
|
32 |
|
33 | // Initialize
|
34 | var jira = new JiraApi({
|
35 | protocol: 'https',
|
36 | host: 'jira.somehost.com',
|
37 | username: 'username',
|
38 | password: 'password',
|
39 | apiVersion: '2',
|
40 | strictSSL: true
|
41 | });
|
42 | ```
|
43 |
|
44 | ### Find the status of an issue ###
|
45 |
|
46 | ```javascript
|
47 | // ES5
|
48 | // We are using an ES5 Polyfill for Promise support. Please note that if you don't explicitly
|
49 | // apply a catch exceptions will get swallowed. Read up on ES6 Promises for further details.
|
50 | jira.findIssue(issueNumber)
|
51 | .then(function(issue) {
|
52 | console.log('Status: ' + issue.fields.status.name);
|
53 | })
|
54 | .catch(function(err) {
|
55 | console.error(err);
|
56 | });
|
57 |
|
58 | // ES6
|
59 | jira.findIssue(issueNumber)
|
60 | .then(issue => {
|
61 | console.log(`Status: ${issue.fields.status.name}`);
|
62 | })
|
63 | .catch(err => {
|
64 | console.error(err);
|
65 | });
|
66 |
|
67 | // ES7
|
68 | async function logIssueName() {
|
69 | try {
|
70 | const issue = await jira.findIssue(issueNumber);
|
71 | console.log(`Status: ${issue.fields.status.name}`);
|
72 | } catch (err) {
|
73 | console.error(err);
|
74 | }
|
75 | }
|
76 |
|
77 | ```
|
78 |
|
79 | ## Documentation ##
|
80 | Can't find what you need in the readme? Check out our documentation here: https://jira-node.github.io/
|