Minor improvements to Taiga-Node

This commit is contained in:
Jan Oberhauser 2020-09-17 23:20:27 +02:00
parent bbfe59c211
commit 219a0d2560
3 changed files with 12 additions and 12 deletions

View file

@ -1,6 +1,6 @@
import { import {
OptionsWithUri, OptionsWithUri,
} from 'request'; } from 'request';
import { import {
IExecuteFunctions, IExecuteFunctions,
@ -13,9 +13,9 @@ import {
import { import {
ICredentialDataDecryptedObject, ICredentialDataDecryptedObject,
IDataObject, IDataObject,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { import {
createHash, createHash,
} from 'crypto'; } from 'crypto';
@ -101,7 +101,7 @@ export async function taigaApiRequest(
} }
} }
export async function taigaApiRequestAllItems(this: IHookFunctions | IExecuteFunctions| ILoadOptionsFunctions, method: string, resource: string, body: any = {}, query: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any export async function taigaApiRequestAllItems(this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, method: string, resource: string, body: any = {}, query: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
const returnData: IDataObject[] = []; const returnData: IDataObject[] = [];

View file

@ -126,7 +126,7 @@ export class Taiga implements INodeType {
const projectId = this.getCurrentNodeParameter('projectId') as string; const projectId = this.getCurrentNodeParameter('projectId') as string;
const statuses = await taigaApiRequest.call(this,'GET', '/issue-statuses', {}, { project: projectId }); const statuses = await taigaApiRequest.call(this, 'GET', '/issue-statuses', {}, { project: projectId });
for (const status of statuses) { for (const status of statuses) {
const statusName = status.name; const statusName = status.name;
const statusId = status.id; const statusId = status.id;
@ -145,7 +145,7 @@ export class Taiga implements INodeType {
const projectId = this.getCurrentNodeParameter('projectId') as string; const projectId = this.getCurrentNodeParameter('projectId') as string;
const users = await taigaApiRequest.call(this,'GET', '/users', {}, { project: projectId }); const users = await taigaApiRequest.call(this, 'GET', '/users', {}, { project: projectId });
for (const user of users) { for (const user of users) {
const userName = user.username; const userName = user.username;
const userId = user.id; const userId = user.id;
@ -164,7 +164,7 @@ export class Taiga implements INodeType {
const projectId = this.getCurrentNodeParameter('projectId') as string; const projectId = this.getCurrentNodeParameter('projectId') as string;
const priorities = await taigaApiRequest.call(this,'GET', '/priorities', {}, { project: projectId }); const priorities = await taigaApiRequest.call(this, 'GET', '/priorities', {}, { project: projectId });
for (const priority of priorities) { for (const priority of priorities) {
const priorityName = priority.name; const priorityName = priority.name;
const priorityId = priority.id; const priorityId = priority.id;
@ -183,7 +183,7 @@ export class Taiga implements INodeType {
const projectId = this.getCurrentNodeParameter('projectId') as string; const projectId = this.getCurrentNodeParameter('projectId') as string;
const severities = await taigaApiRequest.call(this,'GET', '/severities', {}, { project: projectId }); const severities = await taigaApiRequest.call(this, 'GET', '/severities', {}, { project: projectId });
for (const severity of severities) { for (const severity of severities) {
const severityName = severity.name; const severityName = severity.name;
const severityId = severity.id; const severityId = severity.id;
@ -202,7 +202,7 @@ export class Taiga implements INodeType {
const projectId = this.getCurrentNodeParameter('projectId') as string; const projectId = this.getCurrentNodeParameter('projectId') as string;
const milestones = await taigaApiRequest.call(this,'GET', '/milestones', {}, { project: projectId }); const milestones = await taigaApiRequest.call(this, 'GET', '/milestones', {}, { project: projectId });
for (const milestone of milestones) { for (const milestone of milestones) {
const milestoneName = milestone.name; const milestoneName = milestone.name;
const milestoneId = milestone.id; const milestoneId = milestone.id;
@ -221,7 +221,7 @@ export class Taiga implements INodeType {
const { id } = await taigaApiRequest.call(this, 'GET', '/users/me'); const { id } = await taigaApiRequest.call(this, 'GET', '/users/me');
const projects = await taigaApiRequest.call(this,'GET', '/projects', {}, { member: id }); const projects = await taigaApiRequest.call(this, 'GET', '/projects', {}, { member: id });
for (const project of projects) { for (const project of projects) {
const projectName = project.name; const projectName = project.name;
const projectId = project.id; const projectId = project.id;

View file

@ -109,7 +109,7 @@ export class TaigaTrigger implements INodeType {
const { id } = await taigaApiRequest.call(this, 'GET', '/users/me'); const { id } = await taigaApiRequest.call(this, 'GET', '/users/me');
const projects = await taigaApiRequest.call(this,'GET', '/projects', {}, { member: id }); const projects = await taigaApiRequest.call(this, 'GET', '/projects', {}, { member: id });
for (const project of projects) { for (const project of projects) {
const projectName = project.name; const projectName = project.name;
const projectId = project.id; const projectId = project.id;
@ -181,7 +181,7 @@ export class TaigaTrigger implements INodeType {
const webhookData = this.getWorkflowStaticData('node'); const webhookData = this.getWorkflowStaticData('node');
try { try {
await taigaApiRequest.call(this, 'DELETE', `/webhooks/${webhookData.webhookId}`); await taigaApiRequest.call(this, 'DELETE', `/webhooks/${webhookData.webhookId}`);
} catch(error) { } catch (error) {
return false; return false;
} }
delete webhookData.webhookId; delete webhookData.webhookId;