A JavaScript / TypeScript wrapper for the JIRA REST API
Install with the npm:
npm install jira.jsInstall with the yarn:
yarn add jira.jsimport{Client}from"jira.js";// Initializeconstclient=newClient({host: "https://jira.somehost.com"});// Callbacksclient.projects.getAllProjects({},(err,data)=>{if(err){throwerr;}console.log(data);});// ES5/ES6client.projects.getAllProjects().then(projects=>console.log(projects)).catch(error=>console.log(error));// ES7asyncfunctiongetProjects(){constprojects=awaitclient.projects.getAllProjects();console.log(projects);returnprojects;}constclient=newClient({host: "https://jira.somehost.com",authentication: {basic: {username: "MyUsername",apiToken: "API_Token"}}});constclient=newClient({host: "https://jira.somehost.com",authentication: {basic: {username: "MyUsername",password: "MyPassword"}}});constclient=newClient({host: 'https://jira.somehost.com',authentication: {jwt: {iss: 'id',secret: 'secret key'}}});constclient=newClient({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"}}});constclient=newClient({host: "https://jira.somehost.com",authentication: {accessToken: "my access token"}});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";constclient=newClient({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},});import{Client}from"jira.js";constclient=newClient({host: "https://jira.somehost.com",middlewares: {onError: (error)=>{console.error(error);throwerror;},onResponse: (data)=>{console.log(data);returndata;}}});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/
| MrRefactoring | jayree | Swapnull | violine1101 |
- Response models (Check 2.0 version PR)
- Method names reducing (Check 2.0 version PR)
- Authentication: Added OAuth 1.0 authentication method
- CI: Migrated from
Travis CItoGithub CI