Repository: jira-node/node-jira-client (js)

Issue:
Add support for "fields" query param on `findIssue` method
It would be great to be able to restrict the fields returned for an issue for the `findIssue` method by using the "fields" query param that the REST API already supports:

https://docs.atlassian.com/jira/REST/server/#api/2/issue-getIssue

Pull request:
Find issue
Fixes #144 
Changes package.json to conform to updated NPM standards.

Patch:
diff --git a/package.json b/package.json
index 14ac024..ac28a4f 100644
--- a/package.json
+++ b/package.json
@@ -24,12 +24,7 @@
     "LICENSE.md",
     "README.md"
   ],
-  "licenses": [
-    {
-      "type": "The MIT License",
-      "url": "http://www.opensource.org/licenses/mit-license.php"
-    }
-  ],
+  "license": "MIT",
   "dependencies": {
     "babel-runtime": "^6.20.0",
     "request-promise": "^4.1.1"
@@ -39,7 +34,7 @@
     "docs-build": "rm -rf docs && esdoc -c esdoc.json",
     "lint": "eslint ./",
     "test": "npm run lint && mocha && npm run docs-build",
-    "prepublish": "npm run build && npm run docs-build",
+    "prepublishOnly": "npm run build && npm run docs-build",
     "release": "release"
   },
   "devDependencies": {
diff --git a/src/jira.js b/src/jira.js
index c111c25..1b47657 100644
--- a/src/jira.js
+++ b/src/jira.js
@@ -234,12 +234,18 @@ export default class JiraApi {
    * [Jira Doc](http://docs.atlassian.com/jira/REST/latest/#id290709)
    * @param {string} issueNumber - The issue number to search for including the project key
    * @param {string} expand - The resource expansion to return additional fields in the response
+   * @param {string} fields - Comma separated list of field ids or keys to retrieve
+   * @param {string} properties - Comma separated list of properties to retrieve
+   * @param {boolean} fieldsByKeys - False by default, used to retrieve fields by key instead of id
    */
-  findIssue(issueNumber, expand) {
+  findIssue(issueNumber, expand, fields, properties, fieldsByKeys) {
     return this.doRequest(this.makeRequestHeader(this.makeUri({
       pathname: `/issue/${issueNumber}`,
       query: {
         expand: expand || '',
+        fields: fields || '*all',
+        properties: properties || '',
+        fieldsByKeys: fieldsByKeys || false,
       },
     })));
   }


Test patch:
diff --git a/test/jira-tests.js b/test/jira-tests.js
index dca8ff2..7a2573c 100644
--- a/test/jira-tests.js
+++ b/test/jira-tests.js
@@ -352,12 +352,27 @@ describe('Jira API Tests', () => {
 
     it('findIssue hits proper url', async () => {
       const result = await dummyURLCall('findIssue', ['PK-100']);
-      result.should.eql('http://jira.somehost.com:8080/rest/api/2.0/issue/PK-100?expand=');
+      result.should.eql('http://jira.somehost.com:8080/rest/api/2.0/issue/PK-100?expand=&fields=*all&properties=&fieldsByKeys=false');
     });
 
     it('findIssue hits proper url with expansion', async () => {
       const result = await dummyURLCall('findIssue', ['PK-100', 'transitions,changelog']);
-      result.should.eql('http://jira.somehost.com:8080/rest/api/2.0/issue/PK-100?expand=transitions,changelog');
+      result.should.eql('http://jira.somehost.com:8080/rest/api/2.0/issue/PK-100?expand=transitions,changelog&fields=*all&properties=&fieldsByKeys=false');
+    });
+
+    it('findIssue hits proper url with fields', async () => {
+      const result = await dummyURLCall('findIssue', ['PK-100', null, 'transitions,changelog']);
+      result.should.eql('http://jira.somehost.com:8080/rest/api/2.0/issue/PK-100?expand=&fields=transitions,changelog&properties=&fieldsByKeys=false');
+    });
+
+    it('findIssue hits proper url with properties', async () => {
+      const result = await dummyURLCall('findIssue', ['PK-100', null, null, 'transitions,changelog']);
+      result.should.eql('http://jira.somehost.com:8080/rest/api/2.0/issue/PK-100?expand=&fields=*all&properties=transitions,changelog&fieldsByKeys=false');
+    });
+
+    it('findIssue hits proper url with fields and fieldsByKeys', async () => {
+      const result = await dummyURLCall('findIssue', ['PK-100', null, 'transitions,changelog', null, true]);
+      result.should.eql('http://jira.somehost.com:8080/rest/api/2.0/issue/PK-100?expand=&fields=transitions,changelog&properties=&fieldsByKeys=true');
     });
 
     it('getUnresolvedIssueCount hits proper url', async () => {