⚡ Extended Jira Node (#1306)
* ⚡ Add Issue Attachment resource * ⚡ Add custom fields to issue:create and issue:update * ⚡ Filter custom fields by the project selected * ⚡ Change the logo to SVG * ⚡ Small improvement * ⚡ Minor improvements to Jira Node * ⚡ Add download field to issueAttachment get and getAll Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
import {
|
||||
BINARY_ENCODING,
|
||||
IExecuteFunctions,
|
||||
} from 'n8n-core';
|
||||
|
||||
import {
|
||||
IBinaryData,
|
||||
IBinaryKeyData,
|
||||
IDataObject,
|
||||
ILoadOptionsFunctions,
|
||||
INodeExecutionData,
|
||||
@@ -17,10 +20,15 @@ import {
|
||||
validateJSON,
|
||||
} from './GenericFunctions';
|
||||
|
||||
import {
|
||||
issueAttachmentFields,
|
||||
issueAttachmentOperations,
|
||||
} from './IssueAttachmentDescription';
|
||||
|
||||
import {
|
||||
issueCommentFields,
|
||||
issueCommentOperations,
|
||||
} from './IssueCommentDescription';
|
||||
} from './IssueCommentDescription';
|
||||
|
||||
import {
|
||||
issueFields,
|
||||
@@ -33,13 +41,13 @@ import {
|
||||
INotificationRecipients,
|
||||
INotify,
|
||||
NotificationRecipientsRestrictions,
|
||||
} from './IssueInterface';
|
||||
} from './IssueInterface';
|
||||
|
||||
export class Jira implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
displayName: 'Jira Software',
|
||||
name: 'jira',
|
||||
icon: 'file:jira.png',
|
||||
icon: 'file:jira.svg',
|
||||
group: ['output'],
|
||||
version: 1,
|
||||
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
|
||||
@@ -101,6 +109,11 @@ export class Jira implements INodeType {
|
||||
value: 'issue',
|
||||
description: 'Creates an issue or, where the option to create subtasks is enabled in Jira, a subtask',
|
||||
},
|
||||
{
|
||||
name: 'Issue Attachment',
|
||||
value: 'issueAttachment',
|
||||
description: 'Add, remove, and get an attachment from an issue.',
|
||||
},
|
||||
{
|
||||
name: 'Issue Comment',
|
||||
value: 'issueComment',
|
||||
@@ -112,6 +125,8 @@ export class Jira implements INodeType {
|
||||
},
|
||||
...issueOperations,
|
||||
...issueFields,
|
||||
...issueAttachmentOperations,
|
||||
...issueAttachmentFields,
|
||||
...issueCommentOperations,
|
||||
...issueCommentFields,
|
||||
],
|
||||
@@ -176,7 +191,7 @@ export class Jira implements INodeType {
|
||||
}
|
||||
} else {
|
||||
for (const issueType of issueTypes) {
|
||||
if (issueType.scope === undefined || issueType.scope.project.id === projectId) {
|
||||
if (issueType.scope !== undefined && issueType.scope.project.id === projectId) {
|
||||
const issueTypeName = issueType.name;
|
||||
const issueTypeId = issueType.id;
|
||||
|
||||
@@ -193,7 +208,6 @@ export class Jira implements INodeType {
|
||||
if (a.name > b.name) { return 1; }
|
||||
return 0;
|
||||
});
|
||||
|
||||
return returnData;
|
||||
},
|
||||
|
||||
@@ -342,6 +356,32 @@ export class Jira implements INodeType {
|
||||
|
||||
return returnData;
|
||||
},
|
||||
|
||||
// Get all the custom fields to display them to user so that he can
|
||||
// select them easily
|
||||
async getCustomFields(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||
const returnData: INodePropertyOptions[] = [];
|
||||
const operation = this.getCurrentNodeParameter('operation') as string;
|
||||
let projectId;
|
||||
if (operation === 'create') {
|
||||
projectId = this.getCurrentNodeParameter('project');
|
||||
} else {
|
||||
const issueKey = this.getCurrentNodeParameter('issueKey');
|
||||
const { fields: { project: { id } } } = await jiraSoftwareCloudApiRequest.call(this, `/api/2/issue/${issueKey}`, 'GET', {}, {});
|
||||
projectId = id;
|
||||
}
|
||||
|
||||
const fields = await jiraSoftwareCloudApiRequest.call(this, `/api/2/field`, 'GET');
|
||||
for (const field of fields) {
|
||||
if (field.custom === true && field.scope && field.scope.project && field.scope.project.id === projectId) {
|
||||
returnData.push({
|
||||
name: field.name,
|
||||
value: field.id,
|
||||
});
|
||||
}
|
||||
}
|
||||
return returnData;
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@@ -356,11 +396,10 @@ export class Jira implements INodeType {
|
||||
const operation = this.getNodeParameter('operation', 0) as string;
|
||||
const jiraVersion = this.getNodeParameter('jiraVersion', 0) as string;
|
||||
|
||||
|
||||
for (let i = 0; i < length; i++) {
|
||||
if (resource === 'issue') {
|
||||
//https://developer.atlassian.com/cloud/jira/platform/rest/v2/#api-rest-api-2-issue-post
|
||||
if (operation === 'create') {
|
||||
if (resource === 'issue') {
|
||||
//https://developer.atlassian.com/cloud/jira/platform/rest/v2/#api-rest-api-2-issue-post
|
||||
if (operation === 'create') {
|
||||
for (let i = 0; i < length; i++) {
|
||||
const summary = this.getNodeParameter('summary', i) as string;
|
||||
const projectId = this.getNodeParameter('project', i) as string;
|
||||
const issueTypeId = this.getNodeParameter('issueType', i) as string;
|
||||
@@ -403,6 +442,13 @@ export class Jira implements INodeType {
|
||||
if (additionalFields.updateHistory) {
|
||||
qs.updateHistory = additionalFields.updateHistory as boolean;
|
||||
}
|
||||
if (additionalFields.customFieldsUi) {
|
||||
const customFields = (additionalFields.customFieldsUi as IDataObject).customFieldsValues as IDataObject[];
|
||||
if (customFields) {
|
||||
const data = customFields.reduce((obj, value) => Object.assign(obj, { [`${value.fieldId}`]: value.fieldValue }), {});
|
||||
Object.assign(fields, data);
|
||||
}
|
||||
}
|
||||
const issueTypes = await jiraSoftwareCloudApiRequest.call(this, '/api/2/issuetype', 'GET', body, qs);
|
||||
const subtaskIssues = [];
|
||||
for (const issueType of issueTypes) {
|
||||
@@ -422,9 +468,12 @@ export class Jira implements INodeType {
|
||||
}
|
||||
body.fields = fields;
|
||||
responseData = await jiraSoftwareCloudApiRequest.call(this, '/api/2/issue', 'POST', body);
|
||||
returnData.push(responseData);
|
||||
}
|
||||
//https://developer.atlassian.com/cloud/jira/platform/rest/v2/#api-rest-api-2-issue-issueIdOrKey-put
|
||||
if (operation === 'update') {
|
||||
}
|
||||
//https://developer.atlassian.com/cloud/jira/platform/rest/v2/#api-rest-api-2-issue-issueIdOrKey-put
|
||||
if (operation === 'update') {
|
||||
for (let i = 0; i < length; i++) {
|
||||
const issueKey = this.getNodeParameter('issueKey', i) as string;
|
||||
const updateFields = this.getNodeParameter('updateFields', i) as IDataObject;
|
||||
const body: IIssue = {};
|
||||
@@ -462,6 +511,13 @@ export class Jira implements INodeType {
|
||||
if (updateFields.description) {
|
||||
fields.description = updateFields.description as string;
|
||||
}
|
||||
if (updateFields.customFieldsUi) {
|
||||
const customFields = (updateFields.customFieldsUi as IDataObject).customFieldsValues as IDataObject[];
|
||||
if (customFields) {
|
||||
const data = customFields.reduce((obj, value) => Object.assign(obj, { [`${value.fieldId}`]: value.fieldValue }), {});
|
||||
Object.assign(fields, data);
|
||||
}
|
||||
}
|
||||
const issueTypes = await jiraSoftwareCloudApiRequest.call(this, '/api/2/issuetype', 'GET', body);
|
||||
const subtaskIssues = [];
|
||||
for (const issueType of issueTypes) {
|
||||
@@ -486,10 +542,12 @@ export class Jira implements INodeType {
|
||||
}
|
||||
|
||||
responseData = await jiraSoftwareCloudApiRequest.call(this, `/api/2/issue/${issueKey}`, 'PUT', body);
|
||||
responseData = { success: true };
|
||||
returnData.push({ success: true });
|
||||
}
|
||||
//https://developer.atlassian.com/cloud/jira/platform/rest/v2/#api-rest-api-2-issue-issueIdOrKey-get
|
||||
if (operation === 'get') {
|
||||
}
|
||||
//https://developer.atlassian.com/cloud/jira/platform/rest/v2/#api-rest-api-2-issue-issueIdOrKey-get
|
||||
if (operation === 'get') {
|
||||
for (let i = 0; i < length; i++) {
|
||||
const issueKey = this.getNodeParameter('issueKey', i) as string;
|
||||
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
||||
if (additionalFields.fields) {
|
||||
@@ -507,12 +565,13 @@ export class Jira implements INodeType {
|
||||
if (additionalFields.updateHistory) {
|
||||
qs.updateHistory = additionalFields.updateHistory as string;
|
||||
}
|
||||
|
||||
responseData = await jiraSoftwareCloudApiRequest.call(this, `/api/2/issue/${issueKey}`, 'GET', {}, qs);
|
||||
|
||||
returnData.push(responseData);
|
||||
}
|
||||
//https://developer.atlassian.com/cloud/jira/platform/rest/v2/#api-rest-api-2-search-post
|
||||
if (operation === 'getAll') {
|
||||
}
|
||||
//https://developer.atlassian.com/cloud/jira/platform/rest/v2/#api-rest-api-2-search-post
|
||||
if (operation === 'getAll') {
|
||||
for (let i = 0; i < length; i++) {
|
||||
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
||||
const options = this.getNodeParameter('options', i) as IDataObject;
|
||||
const body: IDataObject = {};
|
||||
@@ -533,21 +592,27 @@ export class Jira implements INodeType {
|
||||
responseData = await jiraSoftwareCloudApiRequest.call(this, `/api/2/search`, 'POST', body);
|
||||
responseData = responseData.issues;
|
||||
}
|
||||
returnData.push.apply(returnData, responseData);
|
||||
}
|
||||
//https://developer.atlassian.com/cloud/jira/platform/rest/v2/#api-rest-api-2-issue-issueIdOrKey-changelog-get
|
||||
if (operation === 'changelog') {
|
||||
}
|
||||
//https://developer.atlassian.com/cloud/jira/platform/rest/v2/#api-rest-api-2-issue-issueIdOrKey-changelog-get
|
||||
if (operation === 'changelog') {
|
||||
for (let i = 0; i < length; i++) {
|
||||
const issueKey = this.getNodeParameter('issueKey', i) as string;
|
||||
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
||||
if (returnAll) {
|
||||
responseData = await jiraSoftwareCloudApiRequestAllItems.call(this, 'values',`/api/2/issue/${issueKey}/changelog`, 'GET');
|
||||
responseData = await jiraSoftwareCloudApiRequestAllItems.call(this, 'values', `/api/2/issue/${issueKey}/changelog`, 'GET');
|
||||
} else {
|
||||
qs.maxResults = this.getNodeParameter('limit', i) as number;
|
||||
responseData = await jiraSoftwareCloudApiRequest.call(this, `/api/2/issue/${issueKey}/changelog`, 'GET', {}, qs);
|
||||
responseData = responseData.values;
|
||||
}
|
||||
returnData.push.apply(returnData, responseData);
|
||||
}
|
||||
//https://developer.atlassian.com/cloud/jira/platform/rest/v2/#api-rest-api-2-issue-issueIdOrKey-notify-post
|
||||
if (operation === 'notify') {
|
||||
}
|
||||
//https://developer.atlassian.com/cloud/jira/platform/rest/v2/#api-rest-api-2-issue-issueIdOrKey-notify-post
|
||||
if (operation === 'notify') {
|
||||
for (let i = 0; i < length; i++) {
|
||||
const issueKey = this.getNodeParameter('issueKey', i) as string;
|
||||
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
||||
const jsonActive = this.getNodeParameter('jsonParameters', 0) as boolean;
|
||||
@@ -606,7 +671,7 @@ export class Jira implements INodeType {
|
||||
const notificationRecipientsRestrictions: NotificationRecipientsRestrictions = {};
|
||||
if (notificationRecipientsRestrictionsValues) {
|
||||
// @ts-ignore
|
||||
if (notificationRecipientsRestrictionsValues.groups. length > 0) {
|
||||
if (notificationRecipientsRestrictionsValues.groups.length > 0) {
|
||||
// @ts-ignore
|
||||
notificationRecipientsRestrictions.groups = notificationRecipientsRestrictionsValues.groups.map(group => {
|
||||
return {
|
||||
@@ -627,10 +692,12 @@ export class Jira implements INodeType {
|
||||
}
|
||||
}
|
||||
responseData = await jiraSoftwareCloudApiRequest.call(this, `/api/2/issue/${issueKey}/notify`, 'POST', body, qs);
|
||||
|
||||
returnData.push(responseData);
|
||||
}
|
||||
//https://developer.atlassian.com/cloud/jira/platform/rest/v2/#api-rest-api-2-issue-issueIdOrKey-transitions-get
|
||||
if (operation === 'transitions') {
|
||||
}
|
||||
//https://developer.atlassian.com/cloud/jira/platform/rest/v2/#api-rest-api-2-issue-issueIdOrKey-transitions-get
|
||||
if (operation === 'transitions') {
|
||||
for (let i = 0; i < length; i++) {
|
||||
const issueKey = this.getNodeParameter('issueKey', i) as string;
|
||||
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
||||
if (additionalFields.transitionId) {
|
||||
@@ -644,19 +711,118 @@ export class Jira implements INodeType {
|
||||
}
|
||||
responseData = await jiraSoftwareCloudApiRequest.call(this, `/api/2/issue/${issueKey}/transitions`, 'GET', {}, qs);
|
||||
responseData = responseData.transitions;
|
||||
|
||||
returnData.push.apply(returnData, responseData);
|
||||
}
|
||||
//https://developer.atlassian.com/cloud/jira/platform/rest/v2/#api-rest-api-2-issue-issueIdOrKey-delete
|
||||
if (operation === 'delete') {
|
||||
}
|
||||
//https://developer.atlassian.com/cloud/jira/platform/rest/v2/#api-rest-api-2-issue-issueIdOrKey-delete
|
||||
if (operation === 'delete') {
|
||||
for (let i = 0; i < length; i++) {
|
||||
const issueKey = this.getNodeParameter('issueKey', i) as string;
|
||||
const deleteSubtasks = this.getNodeParameter('deleteSubtasks', i) as boolean;
|
||||
qs.deleteSubtasks = deleteSubtasks;
|
||||
responseData = await jiraSoftwareCloudApiRequest.call(this, `/api/2/issue/${issueKey}`, 'DELETE', {}, qs);
|
||||
returnData.push({ success: true });
|
||||
}
|
||||
}
|
||||
if (resource === 'issueComment') {
|
||||
//https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-comments/#api-rest-api-3-issue-issueidorkey-comment-post
|
||||
if (operation === 'add') {
|
||||
}
|
||||
if (resource === 'issueAttachment') {
|
||||
//https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-attachments/#api-rest-api-3-issue-issueidorkey-attachments-post
|
||||
if (operation === 'add') {
|
||||
for (let i = 0; i < length; i++) {
|
||||
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i) as string;
|
||||
const issueKey = this.getNodeParameter('issueKey', i) as string;
|
||||
|
||||
if (items[i].binary === undefined) {
|
||||
throw new Error('No binary data exists on item!');
|
||||
}
|
||||
|
||||
const item = items[i].binary as IBinaryKeyData;
|
||||
|
||||
const binaryData = item[binaryPropertyName] as IBinaryData;
|
||||
|
||||
if (binaryData === undefined) {
|
||||
throw new Error(`No binary data property "${binaryPropertyName}" does not exists on item!`);
|
||||
}
|
||||
|
||||
responseData = await jiraSoftwareCloudApiRequest.call(
|
||||
this,
|
||||
`/api/3/issue/${issueKey}/attachments`,
|
||||
'POST',
|
||||
{},
|
||||
{},
|
||||
undefined,
|
||||
{
|
||||
formData: {
|
||||
file: {
|
||||
value: Buffer.from(binaryData.data, BINARY_ENCODING),
|
||||
options: {
|
||||
filename: binaryData.fileName,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
);
|
||||
returnData.push.apply(returnData, responseData);
|
||||
}
|
||||
}
|
||||
//https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-attachments/#api-rest-api-3-attachment-id-delete
|
||||
if (operation === 'remove') {
|
||||
for (let i = 0; i < length; i++) {
|
||||
const attachmentId = this.getNodeParameter('attachmentId', i) as string;
|
||||
responseData = await jiraSoftwareCloudApiRequest.call(this, `/api/3/attachment/${attachmentId}`, 'DELETE', {}, qs);
|
||||
returnData.push({ success: true });
|
||||
}
|
||||
}
|
||||
//https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-attachments/#api-rest-api-3-attachment-id-get
|
||||
if (operation === 'get') {
|
||||
const download = this.getNodeParameter('download', 0) as boolean;
|
||||
for (let i = 0; i < length; i++) {
|
||||
const attachmentId = this.getNodeParameter('attachmentId', i) as string;
|
||||
responseData = await jiraSoftwareCloudApiRequest.call(this, `/api/3/attachment/${attachmentId}`, 'GET', {}, qs);
|
||||
returnData.push({ json: responseData });
|
||||
}
|
||||
if (download) {
|
||||
const binaryPropertyName = this.getNodeParameter('binaryProperty', 0) as string;
|
||||
for (const [index, attachment] of returnData.entries()) {
|
||||
returnData[index]['binary'] = {};
|
||||
//@ts-ignore
|
||||
const buffer = await jiraSoftwareCloudApiRequest.call(this, '', 'GET', {}, {}, attachment?.json!.content, { json: false, encoding: null });
|
||||
//@ts-ignore
|
||||
returnData[index]['binary'][binaryPropertyName] = await this.helpers.prepareBinaryData(buffer, attachment.json.filename, attachment.json.mimeType);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (operation === 'getAll') {
|
||||
const download = this.getNodeParameter('download', 0) as boolean;
|
||||
for (let i = 0; i < length; i++) {
|
||||
const issueKey = this.getNodeParameter('issueKey', i) as string;
|
||||
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
||||
const { fields: { attachment } } = await jiraSoftwareCloudApiRequest.call(this, `/api/2/issue/${issueKey}`, 'GET', {}, qs);
|
||||
responseData = attachment;
|
||||
if (returnAll === false) {
|
||||
const limit = this.getNodeParameter('limit', i) as number;
|
||||
responseData = responseData.slice(0, limit);
|
||||
}
|
||||
responseData = responseData.map((data: IDataObject) => ({ json: data }));
|
||||
returnData.push.apply(returnData, responseData);
|
||||
}
|
||||
if (download) {
|
||||
const binaryPropertyName = this.getNodeParameter('binaryProperty', 0) as string;
|
||||
for (const [index, attachment] of returnData.entries()) {
|
||||
returnData[index]['binary'] = {};
|
||||
//@ts-ignore
|
||||
const buffer = await jiraSoftwareCloudApiRequest.call(this, '', 'GET', {}, {}, attachment.json.content, { json: false, encoding: null });
|
||||
//@ts-ignore
|
||||
returnData[index]['binary'][binaryPropertyName] = await this.helpers.prepareBinaryData(buffer, attachment.json.filename, attachment.json.mimeType);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (resource === 'issueComment') {
|
||||
//https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-comments/#api-rest-api-3-issue-issueidorkey-comment-post
|
||||
if (operation === 'add') {
|
||||
for (let i = 0; i < length; i++) {
|
||||
const jsonParameters = this.getNodeParameter('jsonParameters', 0) as boolean;
|
||||
const issueKey = this.getNodeParameter('issueKey', i) as string;
|
||||
const options = this.getNodeParameter('options', i) as IDataObject;
|
||||
@@ -697,18 +863,23 @@ export class Jira implements INodeType {
|
||||
}
|
||||
|
||||
responseData = await jiraSoftwareCloudApiRequest.call(this, `/api/3/issue/${issueKey}/comment`, 'POST', body, qs);
|
||||
returnData.push(responseData);
|
||||
}
|
||||
//https://developer.atlassian.com/cloud/jira/platform/rest/v2/#api-rest-api-2-issue-issueIdOrKey-get
|
||||
if (operation === 'get') {
|
||||
}
|
||||
//https://developer.atlassian.com/cloud/jira/platform/rest/v2/#api-rest-api-2-issue-issueIdOrKey-get
|
||||
if (operation === 'get') {
|
||||
for (let i = 0; i < length; i++) {
|
||||
const issueKey = this.getNodeParameter('issueKey', i) as string;
|
||||
const commentId = this.getNodeParameter('commentId', i) as string;
|
||||
const options = this.getNodeParameter('options', i) as IDataObject;
|
||||
Object.assign(qs, options);
|
||||
responseData = await jiraSoftwareCloudApiRequest.call(this, `/api/3/issue/${issueKey}/comment/${commentId}`, 'GET', {}, qs);
|
||||
|
||||
returnData.push(responseData);
|
||||
}
|
||||
//https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-comments/#api-rest-api-3-issue-issueidorkey-comment-get
|
||||
if (operation === 'getAll') {
|
||||
}
|
||||
//https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-comments/#api-rest-api-3-issue-issueidorkey-comment-get
|
||||
if (operation === 'getAll') {
|
||||
for (let i = 0; i < length; i++) {
|
||||
const issueKey = this.getNodeParameter('issueKey', i) as string;
|
||||
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
||||
const options = this.getNodeParameter('options', i) as IDataObject;
|
||||
@@ -722,16 +893,21 @@ export class Jira implements INodeType {
|
||||
responseData = await jiraSoftwareCloudApiRequest.call(this, `/api/3/issue/${issueKey}/comment`, 'GET', body, qs);
|
||||
responseData = responseData.comments;
|
||||
}
|
||||
returnData.push.apply(returnData, responseData);
|
||||
}
|
||||
//https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-comments/#api-rest-api-3-issue-issueidorkey-comment-id-delete
|
||||
if (operation === 'remove') {
|
||||
}
|
||||
//https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-comments/#api-rest-api-3-issue-issueidorkey-comment-id-delete
|
||||
if (operation === 'remove') {
|
||||
for (let i = 0; i < length; i++) {
|
||||
const issueKey = this.getNodeParameter('issueKey', i) as string;
|
||||
const commentId = this.getNodeParameter('commentId', i) as string;
|
||||
responseData = await jiraSoftwareCloudApiRequest.call(this, `/api/3/issue/${issueKey}/comment/${commentId}`, 'DELETE', {}, qs);
|
||||
responseData = { success: true };
|
||||
returnData.push({ success: true });
|
||||
}
|
||||
//https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-comments/#api-rest-api-3-issue-issueidorkey-comment-id-put
|
||||
if (operation === 'update') {
|
||||
}
|
||||
//https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-comments/#api-rest-api-3-issue-issueidorkey-comment-id-put
|
||||
if (operation === 'update') {
|
||||
for (let i = 0; i < length; i++) {
|
||||
const issueKey = this.getNodeParameter('issueKey', i) as string;
|
||||
const commentId = this.getNodeParameter('commentId', i) as string;
|
||||
const options = this.getNodeParameter('options', i) as IDataObject;
|
||||
@@ -771,14 +947,15 @@ export class Jira implements INodeType {
|
||||
Object.assign(body, { body: json });
|
||||
}
|
||||
responseData = await jiraSoftwareCloudApiRequest.call(this, `/api/3/issue/${issueKey}/comment/${commentId}`, 'PUT', body, qs);
|
||||
returnData.push(responseData);
|
||||
}
|
||||
}
|
||||
if (Array.isArray(responseData)) {
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
} else {
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
}
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
|
||||
if (resource === 'issueAttachment' && (operation === 'getAll' || operation === 'get')) {
|
||||
return this.prepareOutputData(returnData as unknown as INodeExecutionData[]);
|
||||
} else {
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user