jira-client

repository·master·Indexed 19 days ago

https://github.com/jira-node/node-jira-client

A node.js module providing an object-oriented wrapper for the Jira REST API, allowing developers to interact with Jira issues and data programmatically. Version 8.2.2.

Tokens
447
Snippets
3
Records
3
Agent score
16%

What's inside jira-client

  1. Initialize the JIRA client

    master

    To use the library, import JiraApi (using require for ES5 or import for ES6) and instantiate it with a configuration object. The configuration object requires protocol, host, username, password, and apiVersion. You can also specify strictSSL.

    // 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
    });
  2. Find the status of an issue using findIssue()

    master

    Use the findIssue(issueNumber) method to retrieve an issue object. The method returns a Promise. Once resolved, you can access the issue's status via issue.fields.status.name.

    Note: If using ES5, ensure you use a Promise polyfill and always include a .catch() block to prevent swallowed exceptions.

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