Giter Site home page Giter Site logo

magr0s / jira.js Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mrrefactoring/jira.js

0.0 1.0 0.0 2.52 MB

A JavaScript/TypeScript wrapper for the JIRA REST API

Home Page: https://mrrefactoring.github.io/jira.js/

License: MIT License

TypeScript 100.00%

jira.js's Introduction

JavaScript / TypeScript JIRA API Client

A JavaScript / TypeScript wrapper for the JIRA REST API

NPM Downloads Minizipped size Dependencies Status DevDependencies Status Build status

Installation

Install with the npm:

npm install jira.js

Install with the yarn:

yarn add jira.js

Examples

Create the JIRA client

import { Client } from "jira.js";

// Initialize
const client = new Client({
  host: "https://jira.somehost.com"
});

Working with API (How to get a list of all projects, for example)

// Callbacks
client.projects.getAllProjects({}, (err, data) => {
  if (err) {
    throw err;
  }

  console.log(data);
});


// ES5/ES6
client.projects
  .getAllProjects()
  .then(projects => console.log(projects))
  .catch(error => console.log(error));

// ES7
async function getProjects() {
  const projects = await client.projects.getAllProjects();

  console.log(projects);

  return projects;
}

Authorization

Basic authorization

With API token
const client = new Client({
  host: "https://jira.somehost.com",
  authentication: {
    basic: {
      username: "MyUsername",
      apiToken: "API_Token"
    }
  }
});
With password
const client = new Client({
  host: "https://jira.somehost.com",
  authentication: {
    basic: {
      username: "MyUsername",
      password: "MyPassword"
    }
  }
});

JWT authentication

const client = new Client({
  host: 'https://jira.somehost.com',
  authentication: {
    jwt: {
      iss: 'id',
      secret: 'secret key'
    }
  }
});

OAuth1.0 authentication

const client = new Client({
  host: "https://jira.somehost.com",
  authentication: {
    oauth1: {
      consumerKey: "your consumer key",
      consumerSecret: "-----BEGIN RSA PRIVATE KEY-----\n" + "some private key\n" + "-----END RSA PRIVATE KEY-----",
      accessToken: "your access token",
      tokenSecret: "your token secret"
    }
  }
});

OAuth2.0 authentication

const client = new Client({
  host: "https://jira.somehost.com",
  authentication: {
    accessToken: "my access token"
  }
});

Base request config

If you want to add headers, timeout, withCredentials or other data for each of the requests that will be called, then pass them to baseRequestConfig.

Full list of properties for baseRequestConfig you can find here: https://github.com/axios/axios#request-config

import { Client } from "jira.js";

const client = new Client({
  host: 'https://jira.somehost.com',
  baseRequestConfig: {
    timeout: 20000,
    headers: {
      'Content-Type': 'application/json',
    },
    timeoutErrorMessage: 'Error message',
    withCredentials: false,
    responseType: 'arraybuffer',
    maxContentLength: 100,
    // and others properties
  },
});

Set middleware for Jira's responses and errors

import { Client } from "jira.js";

const client = new Client({
  host: "https://jira.somehost.com",
  middlewares: {
    onError: (error) => {
      console.error(error);
      throw error;
    },
    onResponse: (data) => {
      console.log(data);
      return data;
    }
  }
});

Documentation

Library based on Jira API v2 and Jira Agile API

Can't find what you need in the readme? Check out our documentation here: https://mrrefactoring.github.io/jira.js/

Contributors

MrRefactoring jayree Swapnull violine1101
MrRefactoring jayree Swapnull violine1101

Road map

Latest version changelog

1.8.0

  • Authentication: Added OAuth 1.0 authentication method
  • CI: Migrated from Travis CI to Github CI

jira.js's People

Contributors

mrrefactoring avatar dependabot-preview[bot] avatar dependabot[bot] avatar swapnull avatar jayree avatar violine1101 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.