mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
feat(Jira Node): Use Jira rendered fields with simplify option (#3323)
* 💄 Use Jira rendered fields with simplify * 🐛 Merge the renderedField results with fields * ⚡ improvements * ⚡ Improvements Co-authored-by: Michael Kret <michael.k@radency.com> Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
This commit is contained in:
@@ -18,28 +18,22 @@ import {
|
||||
} from 'n8n-workflow';
|
||||
|
||||
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;
|
||||
|
||||
let jiraCredentials: ICredentialDataDecryptedObject;
|
||||
if (jiraVersion === 'server') {
|
||||
jiraCredentials = await this.getCredentials('jiraSoftwareServerApi');
|
||||
} else {
|
||||
jiraCredentials = await this.getCredentials('jiraSoftwareCloudApi');
|
||||
}
|
||||
let domain = '';
|
||||
let credentialType: string;
|
||||
|
||||
if (jiraVersion === 'server') {
|
||||
domain = jiraCredentials!.domain;
|
||||
data = Buffer.from(`${jiraCredentials!.email}:${jiraCredentials!.password}`).toString('base64');
|
||||
domain = (await this.getCredentials('jiraSoftwareServerApi')).domain as string;
|
||||
credentialType = 'jiraSoftwareServerApi';
|
||||
} else {
|
||||
domain = jiraCredentials!.domain;
|
||||
data = Buffer.from(`${jiraCredentials!.email}:${jiraCredentials!.apiToken}`).toString('base64');
|
||||
domain = (await this.getCredentials('jiraSoftwareCloudApi')).domain as string;
|
||||
credentialType = 'jiraSoftwareCloudApi';
|
||||
}
|
||||
|
||||
const options: OptionsWithUri = {
|
||||
headers: {
|
||||
Authorization: `Basic ${data}`,
|
||||
Accept: 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
'X-Atlassian-Token': 'no-check',
|
||||
@@ -64,7 +58,7 @@ export async function jiraSoftwareCloudApiRequest(this: IHookFunctions | IExecut
|
||||
}
|
||||
|
||||
try {
|
||||
return await this.helpers.request!(options);
|
||||
return await this.helpers.requestWithAuthentication.call(this, credentialType, options);
|
||||
} catch (error) {
|
||||
throw new NodeApiError(this.getNode(), error as JsonObject);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user