mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-21 03:42:16 +00:00
⚡ 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,6 +1,6 @@
|
||||
import {
|
||||
OptionsWithUri,
|
||||
} from 'request';
|
||||
} from 'request';
|
||||
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
@@ -14,7 +14,7 @@ import {
|
||||
IDataObject,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
export async function jiraSoftwareCloudApiRequest(this: IHookFunctions | IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, endpoint: string, method: string, body: any = {}, query?: IDataObject, uri?: string): Promise<any> { // tslint:disable-line:no-any
|
||||
export async function jiraSoftwareCloudApiRequest(this: IHookFunctions | IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, endpoint: string, method: string, body: any = {}, query?: IDataObject, uri?: string, option: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
||||
let data; let domain;
|
||||
|
||||
const jiraVersion = this.getNodeParameter('jiraVersion', 0) as string;
|
||||
@@ -43,6 +43,7 @@ export async function jiraSoftwareCloudApiRequest(this: IHookFunctions | IExecut
|
||||
Authorization: `Basic ${data}`,
|
||||
Accept: 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
'X-Atlassian-Token': 'no-check',
|
||||
},
|
||||
method,
|
||||
qs: query,
|
||||
@@ -51,6 +52,18 @@ export async function jiraSoftwareCloudApiRequest(this: IHookFunctions | IExecut
|
||||
json: true,
|
||||
};
|
||||
|
||||
if (Object.keys(option).length !== 0) {
|
||||
Object.assign(options, option);
|
||||
}
|
||||
|
||||
if (Object.keys(body).length === 0) {
|
||||
delete options.body;
|
||||
}
|
||||
|
||||
if (Object.keys(query || {}).length === 0) {
|
||||
delete options.qs;
|
||||
}
|
||||
|
||||
try {
|
||||
return await this.helpers.request!(options);
|
||||
} catch (error) {
|
||||
@@ -82,7 +95,7 @@ export async function jiraSoftwareCloudApiRequestAllItems(this: IHookFunctions |
|
||||
query.startAt = 0;
|
||||
body.startAt = 0;
|
||||
query.maxResults = 100;
|
||||
body.maxResults = 100;
|
||||
body.maxResults = 100;
|
||||
|
||||
do {
|
||||
responseData = await jiraSoftwareCloudApiRequest.call(this, endpoint, method, body, query);
|
||||
@@ -106,7 +119,7 @@ export function validateJSON(json: string | undefined): any { // tslint:disable-
|
||||
return result;
|
||||
}
|
||||
|
||||
export function eventExists (currentEvents : string[], webhookEvents: string[]) {
|
||||
export function eventExists(currentEvents: string[], webhookEvents: string[]) {
|
||||
for (const currentEvent of currentEvents) {
|
||||
if (!webhookEvents.includes(currentEvent)) {
|
||||
return false;
|
||||
@@ -115,7 +128,7 @@ export function eventExists (currentEvents : string[], webhookEvents: string[])
|
||||
return true;
|
||||
}
|
||||
|
||||
export function getId (url: string) {
|
||||
export function getId(url: string) {
|
||||
return url.split('/').pop();
|
||||
}
|
||||
|
||||
@@ -159,4 +172,4 @@ export const allEvents = [
|
||||
'worklog_created',
|
||||
'worklog_updated',
|
||||
'worklog_deleted',
|
||||
];
|
||||
];
|
||||
Reference in New Issue
Block a user