nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: jira-node/node-jira-client
Pull request #250 (2019-06-03 22:49:57)

Certificate Authority Option
Pass an SSL certificate authority through to the request-promise library.


Patch:
diff --git a/src/jira.js b/src/jira.js
index fe23ed2..46680a1 100644
--- a/src/jira.js
+++ b/src/jira.js
@@ -27,6 +27,10 @@ export default class JiraApi {
     this.greenhopperVersion = options.greenhopperVersion || '1.0';
     this.baseOptions = {};
 
+    if (options.ca) {
+      this.baseOptions.ca = options.ca;
+    }
+
     if (options.oauth && options.oauth.consumer_key && options.oauth.access_token) {
       this.baseOptions.oauth = {
         consumer_key: options.oauth.consumer_key,


Test patch:
diff --git a/test/jira-tests.js b/test/jira-tests.js
index 170b347..9258807 100644
--- a/test/jira-tests.js
+++ b/test/jira-tests.js
@@ -15,6 +15,7 @@ function getOptions(options) {
     oauth: actualOptions.oauth || null,
     intermediatePath: actualOptions.intermediatePath,
     bearer: actualOptions.bearer || null,
+    ca: actualOptions.ca || null,
   };
 }
 
@@ -96,6 +97,16 @@ describe('Jira API Tests', () => {
 
       expect(jira.strictSSL).to.equal(false);
     });
+
+    it('should allow the user to pass in a certificate authority', () => {
+      const jira = new JiraApi(
+        getOptions({
+          ca: 'fakestring',
+        }),
+      );
+
+      expect(jira.baseOptions.ca).to.equal('fakestring');
+    });
   });
 
   describe('makeRequestHeader Tests', () => {
Repository: jira-node/node-jira-client
Pull request #251 (2019-06-11 08:33:49)

Add attachment download function
I implemented a new function to download an issue's attachment.


Patch:
diff --git a/src/jira.js b/src/jira.js
index fe23ed2..f497e05 100644
--- a/src/jira.js
+++ b/src/jira.js
@@ -300,6 +300,21 @@ export default class JiraApi {
     })));
   }
 
+  /**
+   * @name downloadAttachment
+   * @function
+   * Download an attachment
+   * [Jira Doc](http://docs.atlassian.com/jira/REST/latest/#id288524)
+   * @param {object} attachment - the attachment
+   */
+  downloadAttachment(attachment) {
+    return this.doRequest(this.makeRequestHeader(this.makeUri({
+      pathname: `/attachment/${attachment.id}/${attachment.filename}`,
+      intermediatePath: '/secure',
+    }), { json: false, encoding: null }));
+  }
+
+
   /**
    * @name getUnresolvedIssueCount
    * @function


Test patch:
diff --git a/test/jira-tests.js b/test/jira-tests.js
index 170b347..383168a 100644
--- a/test/jira-tests.js
+++ b/test/jira-tests.js
@@ -391,6 +391,11 @@ describe('Jira API Tests', () => {
       result.should.eql('http://jira.somehost.com:8080/rest/api/2.0/issue/PK-100?expand=&fields=transitions,changelog&properties=*all&fieldsByKeys=true');
     });
 
+    it('downloadAttachment hits proper url with attachment id and filename', async () => {
+      const result = await dummyURLCall('downloadAttachment', [{ id: '123456', filename: 'attachment.txt' }]);
+      result.should.eql('http://jira.somehost.com:8080/secure/attachment/123456/attachment.txt');
+    });
+
     it('getUnresolvedIssueCount hits proper url', async () => {
       async function dummyRequest(requestOptions) {
         return { issuesUnresolvedCount: requestOptions };
Repository: jira-node/node-jira-client
Pull request #257 (2019-07-19 15:42:04)

Add method relatedIssueCounts
Signed-off-by: Sanjeev Premi <spremi@ymail.com>


Patch:
diff --git a/src/jira.js b/src/jira.js
index de63638..e39078f 100644
--- a/src/jira.js
+++ b/src/jira.js
@@ -840,6 +840,18 @@ export default class JiraApi {
     }));
   }
 
+  /** Get count of issues assigned to the component.
+   * [Jira Doc](https://developer.atlassian.com/cloud/jira/platform/rest/v2/#api-rest-api-2-component-id-relatedIssueCounts-get)
+   * @name relatedIssueCounts
+   * @function
+   * @param {string} id - Component Id.
+   */
+  relatedIssueCounts(id) {
+    return this.doRequest(this.makeRequestHeader(this.makeUri({
+      pathname: `/component/${id}/relatedIssueCounts`,
+    })));
+  }
+
   /** Create custom Jira field
    * [Jira Doc](http://docs.atlassian.com/jira/REST/latest/#api/2/field-createCustomField)
    * @name createCustomField


Test patch:
diff --git a/test/jira-tests.js b/test/jira-tests.js
index 1bd873c..a7378df 100644
--- a/test/jira-tests.js
+++ b/test/jira-tests.js
@@ -627,6 +627,11 @@ describe('Jira API Tests', () => {
       result.should.eql('http://jira.somehost.com:8080/rest/api/2.0/component/someComponentNumber?moveIssuesTo=someComponentName');
     });
 
+    it('relatedIssueCounts hits proper url', async () => {
+      const result = await dummyURLCall('relatedIssueCounts', ['someComponentNumber', 'someComponentName']);
+      result.should.eql('http://jira.somehost.com:8080/rest/api/2.0/component/someComponentNumber/relatedIssueCounts');
+    });
+
     // Field APIs Suite Tests
     describe('Field APIs Suite Tests', () => {
       it('createCustomField hits proper url', async () => {
Repository: jira-node/node-jira-client
Pull request #261 (2019-09-16 17:52:35)

Add support startAt and maxResults for getIssueWorklogs and getIssueC…
Add support startAt and maxResults for getIssueWorklogs and getIssueChangelogs functions


Patch:
diff --git a/src/jira.js b/src/jira.js
index 52f3b8a..c17a15b 100644
--- a/src/jira.js
+++ b/src/jira.js
@@ -975,10 +975,16 @@ export default class JiraApi {
    * List all changes for an issue, sorted by date, starting from the latest
    * [Jira Doc](https://docs.atlassian.com/jira/REST/cloud/#api/2/issue/{issueIdOrKey}/changelog)
    * @param {string} issueNumber - The issue number to search for including the project key
+   * @param {integer} [startAt=0] - optional starting index number
+   * @param {integer} [maxResults=50] - optional ending index number
    */
-  getIssueChangelog(issueNumber) {
+  getIssueChangelog(issueNumber, startAt = 0, maxResults = 50) {
     return this.doRequest(this.makeRequestHeader(this.makeUri({
       pathname: `/issue/${issueNumber}/changelog`,
+      query: {
+        startAt,
+        maxResults,
+      },
     })));
   }
 
@@ -1182,11 +1188,17 @@ export default class JiraApi {
    * @name getIssueWorklogs
    * @function
    * @param {string} issueId - the Id of the issue to find worklogs for
+   * @param {integer} [startAt=0] - optional starting index number
+   * @param {integer} [maxResults=1000] - optional ending index number
    */
-  getIssueWorklogs(issueId) {
+  getIssueWorklogs(issueId, startAt = 0, maxResults = 1000) {
     return this.doRequest(this.makeRequestHeader(
       this.makeUri({
         pathname: `/issue/${issueId}/worklog`,
+        query: {
+          startAt,
+          maxResults,
+        },
       }),
     ));
   }


Test patch:
diff --git a/test/jira-tests.js b/test/jira-tests.js
index 61d2b1c..3247e13 100644
--- a/test/jira-tests.js
+++ b/test/jira-tests.js
@@ -574,7 +574,7 @@ describe('Jira API Tests', () => {
 
     it('getIssueChangelog hits proper url', async () => {
       const result = await dummyURLCall('getIssueChangelog', ['ZQ-9001']);
-      result.should.eql('http://jira.somehost.com:8080/rest/api/2.0/issue/ZQ-9001/changelog');
+      result.should.eql('http://jira.somehost.com:8080/rest/api/2.0/issue/ZQ-9001/changelog?startAt=0&maxResults=50');
     });
 
     it('getIssueWatchers hits proper url', async () => {
@@ -732,7 +732,7 @@ describe('Jira API Tests', () => {
 
     it('getIssueWorklogs hits proper url', async () => {
       const result = await dummyURLCall('getIssueWorklogs', ['someIssueNumber']);
-      result.should.eql('http://jira.somehost.com:8080/rest/api/2.0/issue/someIssueNumber/worklog');
+      result.should.eql('http://jira.somehost.com:8080/rest/api/2.0/issue/someIssueNumber/worklog?startAt=0&maxResults=1000');
     });
 
     it('listIssueTypes hits proper url', async () => {
Repository: jira-node/node-jira-client
Pull request #263 (2019-09-20 08:59:57)

getWorklogs function was added
Was added getWorklogs function, returns details for a list of worklogs IDs


Patch:
diff --git a/src/jira.js b/src/jira.js
index c17a15b..057b155 100644
--- a/src/jira.js
+++ b/src/jira.js
@@ -1183,6 +1183,30 @@ export default class JiraApi {
     ));
   }
 
+  /** Returns worklog details for a list of worklog IDs.
+   * [Jira Doc](https://developer.atlassian.com/cloud/jira/platform/rest/v3/#api-rest-api-3-worklog-list-post)
+   * @name getWorklogs
+   * @function
+   * @param {array} worklogsIDs - a list of worklog IDs.
+   * @param {string} expand - expand to include additional information about worklogs
+   *
+   */
+  getWorklogs(worklogsIDs, expand) {
+    return this.doRequest(this.makeRequestHeader(
+      this.makeUri({
+        pathname: '/worklog/list',
+        query: {
+          expand,
+        },
+      }), {
+        method: 'POST',
+        body: {
+          ids: worklogsIDs,
+        },
+      },
+    ));
+  }
+
   /** Get worklogs list from a given issue
    * [Jira Doc](https://developer.atlassian.com/cloud/jira/platform/rest/v3/#api-api-3-issue-issueIdOrKey-worklog-get)
    * @name getIssueWorklogs


Test patch:
diff --git a/test/jira-tests.js b/test/jira-tests.js
index 3247e13..4db0398 100644
--- a/test/jira-tests.js
+++ b/test/jira-tests.js
@@ -730,6 +730,12 @@ describe('Jira API Tests', () => {
       result.should.eql('http://jira.somehost.com:8080/rest/api/2.0/issue/someIssueNumber/worklog/someWorklogId');
     });
 
+    it('getWorklogs hits proper url', async () => {
+      const result = await dummyURLCall('getWorklogs');
+      result.should.eql('http://jira.somehost.com:8080/rest/api/2.0/worklog/list?expand=');
+    });
+
+
     it('getIssueWorklogs hits proper url', async () => {
       const result = await dummyURLCall('getIssueWorklogs', ['someIssueNumber']);
       result.should.eql('http://jira.somehost.com:8080/rest/api/2.0/issue/someIssueNumber/worklog?startAt=0&maxResults=1000');
Repository: jira-node/node-jira-client
Pull request #268 (2019-12-02 13:25:50)

Add deleteIssueLink


Patch:
diff --git a/src/jira.js b/src/jira.js
index f2d9c44..fd4179b 100644
--- a/src/jira.js
+++ b/src/jira.js
@@ -1194,6 +1194,21 @@ export default class JiraApi {
     ));
   }
 
+  /** Deletes an issue link.
+   * [Jira Doc](https://developer.atlassian.com/cloud/jira/platform/rest/v3/#api-rest-api-3-issueLink-linkId-delete)
+   * @name deleteIssueLink
+   * @function
+   * @param {string} linkId - the Id of the issue link to delete
+   */
+  deleteIssueLink(linkId) {
+    return this.doRequest(this.makeRequestHeader(this.makeUri({
+      pathname: `/issueLink/${linkId}`,
+    }), {
+      method: 'DELETE',
+      followAllRedirects: true,
+    }));
+  }
+
   /** Returns worklog details for a list of worklog IDs.
    * [Jira Doc](https://developer.atlassian.com/cloud/jira/platform/rest/v3/#api-rest-api-3-worklog-list-post)
    * @name getWorklogs


Test patch:
diff --git a/test/jira-tests.js b/test/jira-tests.js
index db37c73..b151fbe 100644
--- a/test/jira-tests.js
+++ b/test/jira-tests.js
@@ -730,6 +730,11 @@ describe('Jira API Tests', () => {
       result.should.eql('http://jira.somehost.com:8080/rest/api/2.0/issue/someIssueNumber/worklog/someWorklogId');
     });
 
+    it('deleteIssueLink hits proper url', async () => {
+      const result = await dummyURLCall('deleteIssueLink', ['someLinkId']);
+      result.should.eql('http://jira.somehost.com:8080/rest/api/2.0/issueLink/someLinkId');
+    });
+
     it('getWorklogs hits proper url', async () => {
       const result = await dummyURLCall('getWorklogs');
       result.should.eql('http://jira.somehost.com:8080/rest/api/2.0/worklog/list?expand=');