MrRefactoring / jira.js

A JavaScript/TypeScript wrapper for the JIRA Cloud, Service Desk and Agile REST API
https://mrrefactoring.github.io/jira.js/
MIT License
349 stars 46 forks source link

dev-status api support #254

Closed nheath closed 7 months ago

nheath commented 1 year ago

I'm working on some features to add custom integrations between jira and github, and need to access the "Development Information" already stored associated with an issue. In particualar, fetching a list of pull requests, commits, branches, so that additional information can be pulled from these resources, and updated in jira.

I see that jira.js implements the Development Information api, but this seems more geared for integrating systems like github, bitbucket, to push information into jira.

Alternatively, there is a non-public dev-status api, that appears to be a better fit, and that Ive seen used in other projects, and that other npm modules expose. I understand the risks associated with using a non-public api, and am willing to accept these in my project.

Is supporting this api in line with the goals for this project?

Alternately, is it possible through this package, to manually build a request with a url and payload, and leverage the package's implementation for common requirements like base url and authorization?

MrRefactoring commented 7 months ago

Hello,

Thank you for bringing up the integration of the non-public dev-status API with jira.js. After careful consideration, I've decided not to support this API in the project. While I understand the potential benefits it offers for certain use cases, the risks and maintenance complexities associated with integrating a non-public API do not align with the long-term goals of jira.js. I appreciate your understanding and am open to discussing alternative solutions that align with the project's direction.

Best regards, Vladislav

nheath commented 7 months ago

Thanks for the answer. In the meantime, I have extended jira.js in my own project, with a dev-status client that leverages common handling in the BaseClient (like auth), and its working well. I understand that this is out of scope for the project itself, but will post it here in case it helps others willing to adopt a similar solution and maintenance burden. I've ommitted api contract type definitions for brevity and clarity; you may define them as necessary

import { BaseClient, Callback, RequestConfig } from 'jira.js';
import { JiraDevStatusIssueSummaryResponse, JiraDevStatusIssueSummaryReuest, JiraDevStatusIssueDetailResponse, JiraDevStatusIssueDetailRequest } from '../models/dev-status-jira-models';

export class DevStatusJiraClient extends BaseClient {

    async getDevStatusSummary<T = JiraDevStatusIssueSummaryResponse>(
        parameters: JiraDevStatusIssueSummaryReuest,
        callback?: Callback<T>
    ): Promise<void | T> {
        const config: RequestConfig = {
            url: `/rest/dev-status/latest/issue/summary`,
            method: 'GET',
            params: {
                issueId: parameters.issueId
            }
        };
        return this.sendRequest(config, callback);
    }

    async getDevStatusIssueDetail<T = JiraDevStatusIssueDetailResponse>(
        parameters: JiraDevStatusIssueDetailRequest,
        callback?: Callback<T>
    ): Promise<void | T> {
        const config: RequestConfig = {
            url: `/rest/dev-status/latest/issue/detail`,
            method: 'GET',
            params: {
                issueId: parameters.issueId,
                applicationType: parameters.applicationType,
                dataType: parameters.dataType
            }
        };

        return this.sendRequest(config, callback);
    }
}