feat(Jira Software Node): Personal Access Token credential type (#11038)

This commit is contained in:
Gerard de Vries
2025-01-22 12:43:13 +01:00
committed by GitHub
parent 69c2153279
commit 1c7a38f6ba
5 changed files with 92 additions and 11 deletions

View File

@@ -67,6 +67,15 @@ export class Jira implements INodeType {
},
},
},
{
name: 'jiraSoftwareServerPatApi',
required: true,
displayOptions: {
show: {
jiraVersion: ['serverPat'],
},
},
},
],
properties: [
{
@@ -82,6 +91,10 @@ export class Jira implements INodeType {
name: 'Server (Self Hosted)',
value: 'server',
},
{
name: 'Server Pat (Self Hosted)',
value: 'serverPat',
},
],
default: 'cloud',
},
@@ -139,7 +152,7 @@ export class Jira implements INodeType {
let endpoint = '';
let projects;
if (jiraVersion === 'server') {
if (jiraVersion === 'server' || jiraVersion === 'serverPat') {
endpoint = '/api/2/project';
projects = await jiraSoftwareCloudApiRequest.call(this, endpoint, 'GET');
} else {
@@ -502,7 +515,7 @@ export class Jira implements INodeType {
};
}
if (additionalFields.assignee) {
if (jiraVersion === 'server') {
if (jiraVersion === 'server' || jiraVersion === 'serverPat') {
fields.assignee = {
name: additionalFields.assignee as string,
};
@@ -513,7 +526,7 @@ export class Jira implements INodeType {
}
}
if (additionalFields.reporter) {
if (jiraVersion === 'server') {
if (jiraVersion === 'server' || jiraVersion === 'serverPat') {
fields.reporter = {
name: additionalFields.reporter as string,
};
@@ -632,7 +645,7 @@ export class Jira implements INodeType {
};
}
if (updateFields.assignee) {
if (jiraVersion === 'server') {
if (jiraVersion === 'server' || jiraVersion === 'serverPat') {
fields.assignee = {
name: updateFields.assignee as string,
};
@@ -643,7 +656,7 @@ export class Jira implements INodeType {
}
}
if (updateFields.reporter) {
if (jiraVersion === 'server') {
if (jiraVersion === 'server' || jiraVersion === 'serverPat') {
fields.reporter = {
name: updateFields.reporter as string,
};
@@ -1025,7 +1038,8 @@ export class Jira implements INodeType {
}
}
if (resource === 'issueAttachment') {
const apiVersion = jiraVersion === 'server' ? '2' : ('3' as string);
const apiVersion =
jiraVersion === 'server' || jiraVersion === 'serverPat' ? '2' : ('3' as string);
//https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-attachments/#api-rest-api-3-issue-issueidorkey-attachments-post
if (operation === 'add') {
@@ -1183,7 +1197,8 @@ export class Jira implements INodeType {
}
if (resource === 'issueComment') {
let apiVersion = jiraVersion === 'server' ? '2' : ('3' as string);
let apiVersion =
jiraVersion === 'server' || jiraVersion === 'serverPat' ? '2' : ('3' as string);
//https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-comments/#api-rest-api-3-issue-issueidorkey-comment-post
if (operation === 'add') {
@@ -1205,7 +1220,7 @@ export class Jira implements INodeType {
Object.assign(body, options);
if (!jsonParameters) {
const comment = this.getNodeParameter('comment', i) as string;
if (jiraVersion === 'server' || options.wikiMarkup) {
if (jiraVersion === 'server' || jiraVersion === 'serverPat' || options.wikiMarkup) {
Object.assign(body, { body: comment });
} else {
Object.assign(body, {
@@ -1356,7 +1371,7 @@ export class Jira implements INodeType {
Object.assign(qs, options);
if (!jsonParameters) {
const comment = this.getNodeParameter('comment', i) as string;
if (jiraVersion === 'server' || options.wikiMarkup) {
if (jiraVersion === 'server' || jiraVersion === 'serverPat' || options.wikiMarkup) {
Object.assign(body, { body: comment });
} else {
Object.assign(body, {
@@ -1407,7 +1422,8 @@ export class Jira implements INodeType {
}
if (resource === 'user') {
const apiVersion = jiraVersion === 'server' ? '2' : ('3' as string);
const apiVersion =
jiraVersion === 'server' || jiraVersion === 'serverPat' ? '2' : ('3' as string);
if (operation === 'create') {
// https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-users/#api-rest-api-3-user-post