|
29 | 29 |
|
30 | 30 | ### Create the JIRA client ###
|
31 | 31 |
|
| 32 | +#### Create a simple JIRA client #### |
| 33 | + |
32 | 34 | JiraApi = require('jira').JiraApi;
|
33 | 35 |
|
34 | 36 | var jira = new JiraApi('https', config.host, config.port, config.user, config.password, '2.0.alpha1');
|
35 | 37 |
|
| 38 | +#### Need special HTTP settings #### |
| 39 | + |
| 40 | +In the case of, if some particular settings are needed to sign in like proxy authentication, for example. This can be done by passing the HTTP request options as parameter of the jiraApiWithOptions method. |
| 41 | + |
| 42 | + const HttpProxyAgent = require("http-proxy-agent"); |
| 43 | + const agent = new HttpProxyAgent("http://proxy"); |
| 44 | + const options = { |
| 45 | + "agent": agent, // proxy setting |
| 46 | + rejectUnauthorized: this.strictSSL, // strict ssl option |
| 47 | + headers: { |
| 48 | + "Proxy-Authorization": "Bearer authentication_token", // proxy authentification |
| 49 | + "Authorization": 'Basic ' + Buffer.from(username + ':' + password).toString('base64') // basic authentication |
| 50 | + }, |
| 51 | + oauth: { // in the case of oauth instead of basic |
| 52 | + consumer_key: oauth.consumer_key, |
| 53 | + consumer_secret: oauth.consumer_secret, |
| 54 | + token: oauth.access_token, |
| 55 | + token_secret: oauth.access_token_secret |
| 56 | + } |
| 57 | + } |
| 58 | + JiraApiWithOptions = require('jira').JiraApiWithOptions; |
| 59 | + |
| 60 | + var jira = new JiraApiWithOptions('https', 'server.com', '443', '2.0.alpha1', true, 'jira', options); |
| 61 | + |
| 62 | + |
36 | 63 | ### Find the status of an issue ###
|
37 | 64 |
|
38 | 65 | jira.findIssue(issueNumber, function(error, issue) {
|
|
0 commit comments