GithubHelp home page GithubHelp logo

aeolun / ts-jira-client Goto Github PK

View Code? Open in Web Editor NEW
6.0 2.0 2.0 2.86 MB

A Typescript wrapper for the Jira Rest API

Home Page: https://aeolun.github.io/ts-jira-client/

License: MIT License

TypeScript 100.00%

ts-jira-client's Introduction

Typescript JIRA API for node.js

A Typescript wrapper for the Jira Rest API, now in Typescript. I had this as a fork of jira-client for a while, but I felt the need to completely split it up to modernize it (as well as give myself an easier time deploying).

I've tried to keep the api as close to the original api as possible, but sometimes I've had to make compromises. Where possible any legacy calls have been removed, and replaced with what made most sense considering the latest versions of Jira Datacenter, Cloud, Software and Service Desk.

Warning

Types have been sourced wherever they exist (cloud has more type definitions, either in docs or openapi, than server/datacenter, but no guarantee they are compatible).

If you find any conflicts, or have any suggestions, please feel free to open an issue or a pull request.

License Documentation Jira Rest API Run tests npm Downloads Install Size

Installation

Install with the node package manager pnpm:

$ pnpm install ts-jira-client

Examples

Create the JIRA client

import { JiraApi } from 'ts-jira-client';

// Initialize
var jira = new JiraApi({
  protocol: 'https', // default is https
  host: 'jira.somehost.com', // REQUIRED
  username: 'username',
  password: 'password',
  apiVersion: '2', // default is 2
  strictSSL: true // default is true
});

Find the status of an issue

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

Documentation

Can't find what you need in the readme? Check out our documentation here: https://aeolun.github.io/ts-jira-client/

ts-jira-client's People

Contributors

pioug avatar mtscout6 avatar tebriel avatar kanoyugoro avatar dkokic avatar aeolun avatar devxiaolan avatar satcheluniverse avatar eduardolundgren avatar greenkeeperio-bot avatar itoche avatar steves avatar semantic-release-bot avatar seth10001 avatar anton-rudeshko avatar rkt2spc avatar netfantom-spb avatar randyho-kk avatar lucasvo avatar dhigginbotham avatar dschmidlin avatar cdloh avatar gabriel403 avatar lucasvo-taulia avatar dependabot[bot] avatar shaunburdick avatar peteszym avatar woellchen avatar yasumoto avatar idmitme avatar

Stargazers

xuatz avatar Sebastian Kasanzew avatar Ivan avatar Alexey avatar Alp Eren Velioğlu avatar Leonardo Machado avatar

Watchers

 avatar  avatar

ts-jira-client's Issues

addAttachmentOnIssue It only accepts Buffer, but I would like Stream

The method for adding files to issue only accepts a buffer, this is not very convenient, I want to get a preview of the file in jira and its type, but it turns out that I won't be able to send it.

  /** Add attachment to a Issue
   * [Jira Doc](https://docs.atlassian.com/jira/REST/latest/#api/2/issue/{issueIdOrKey}/attachments-addAttachment)
   * @param issueId - issue id
   * @param readStream - readStream object from fs
   */
  addAttachmentOnIssue(issueId: string, readStream: Buffer) {
    const formData = new FormData();
    formData.append("file", new Blob([readStream], { type: "application/octet-stream" }));
    return this.doRequest<unknown>(
      this.makeRequestHeader(
        this.makeUri({
          pathname: `/issue/${issueId}/attachments`,
        }),
        {
          method: "POST",
          headers: {
            "X-Atlassian-Token": "nocheck",
          },
          data: formData,
        },
      ),
    );
  }

In the classic version of the library it is possible to send streams, as far as I know, this is due to the fact that they use postman instead of axios.

Снимок экрана 2024-03-31 в 14 03 36

For me, the most important thing is that you can transfer the name and type of the file.

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.