mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
refactor: Format nodes-base package (A-F) (#3800)
* 🔨 prettier formated nodes - A * 🔨 prettier formated nodes - B * ⚡ prettier formated nodes - C * ⚡ prettier formated nodes - D * ⚡ prettier formated nodes - E-F * 🎨 Adjust nodes-base formatting command (#3805) * Format additional files in nodes A-F (#3811) * ⚡ fixes * 🎨 Add Mindee to ignored dirs Co-authored-by: Iván Ovejero <ivov.src@gmail.com>
This commit is contained in:
@@ -1,6 +1,4 @@
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
} from 'n8n-core';
|
||||
import { IExecuteFunctions } from 'n8n-core';
|
||||
|
||||
import {
|
||||
IDataObject,
|
||||
@@ -11,20 +9,11 @@ import {
|
||||
INodeTypeDescription,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
automizyApiRequest,
|
||||
automizyApiRequestAllItems,
|
||||
} from './GenericFunctions';
|
||||
import { automizyApiRequest, automizyApiRequestAllItems } from './GenericFunctions';
|
||||
|
||||
import {
|
||||
contactFields,
|
||||
contactOperations,
|
||||
} from './ContactDescription';
|
||||
import { contactFields, contactOperations } from './ContactDescription';
|
||||
|
||||
import {
|
||||
listFields,
|
||||
listOperations,
|
||||
} from './ListDescription';
|
||||
import { listFields, listOperations } from './ListDescription';
|
||||
|
||||
export class Automizy implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
@@ -78,9 +67,7 @@ export class Automizy implements INodeType {
|
||||
loadOptions: {
|
||||
// Get all the tags to display them to user so that he can
|
||||
// select them easily
|
||||
async getLists(
|
||||
this: ILoadOptionsFunctions,
|
||||
): Promise<INodePropertyOptions[]> {
|
||||
async getLists(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||
const returnData: INodePropertyOptions[] = [];
|
||||
const lists = await automizyApiRequestAllItems.call(
|
||||
this,
|
||||
@@ -96,9 +83,7 @@ export class Automizy implements INodeType {
|
||||
}
|
||||
return returnData;
|
||||
},
|
||||
async getTags(
|
||||
this: ILoadOptionsFunctions,
|
||||
): Promise<INodePropertyOptions[]> {
|
||||
async getTags(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||
const returnData: INodePropertyOptions[] = [];
|
||||
const tags = await automizyApiRequestAllItems.call(
|
||||
this,
|
||||
@@ -114,9 +99,7 @@ export class Automizy implements INodeType {
|
||||
}
|
||||
return returnData;
|
||||
},
|
||||
async getCustomFields(
|
||||
this: ILoadOptionsFunctions,
|
||||
): Promise<INodePropertyOptions[]> {
|
||||
async getCustomFields(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||
const returnData: INodePropertyOptions[] = [];
|
||||
const customFields = await automizyApiRequestAllItems.call(
|
||||
this,
|
||||
@@ -144,9 +127,7 @@ export class Automizy implements INodeType {
|
||||
const resource = this.getNodeParameter('resource', 0) as string;
|
||||
const operation = this.getNodeParameter('operation', 0) as string;
|
||||
for (let i = 0; i < length; i++) {
|
||||
|
||||
if (resource === 'contact') {
|
||||
|
||||
if (operation === 'create') {
|
||||
const listId = this.getNodeParameter('listId', i) as string;
|
||||
|
||||
@@ -161,12 +142,12 @@ export class Automizy implements INodeType {
|
||||
Object.assign(body, additionalFields);
|
||||
|
||||
if (body.customFieldsUi) {
|
||||
const customFieldsValues = (body.customFieldsUi as IDataObject).customFieldsValues as IDataObject[];
|
||||
const customFieldsValues = (body.customFieldsUi as IDataObject)
|
||||
.customFieldsValues as IDataObject[];
|
||||
|
||||
body.customFields = {};
|
||||
|
||||
for (const customField of customFieldsValues) {
|
||||
|
||||
//@ts-ignore
|
||||
body.customFields[customField.key] = customField.value;
|
||||
}
|
||||
@@ -185,11 +166,7 @@ export class Automizy implements INodeType {
|
||||
if (operation === 'delete') {
|
||||
const contactId = this.getNodeParameter('contactId', i) as string;
|
||||
|
||||
responseData = await automizyApiRequest.call(
|
||||
this,
|
||||
'DELETE',
|
||||
`/contacts/${contactId}`,
|
||||
);
|
||||
responseData = await automizyApiRequest.call(this, 'DELETE', `/contacts/${contactId}`);
|
||||
|
||||
responseData = { success: true };
|
||||
}
|
||||
@@ -197,11 +174,7 @@ export class Automizy implements INodeType {
|
||||
if (operation === 'get') {
|
||||
const contactId = this.getNodeParameter('contactId', i) as string;
|
||||
|
||||
responseData = await automizyApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
`/contacts/${contactId}`,
|
||||
);
|
||||
responseData = await automizyApiRequest.call(this, 'GET', `/contacts/${contactId}`);
|
||||
}
|
||||
|
||||
if (operation === 'getAll') {
|
||||
@@ -220,7 +193,6 @@ export class Automizy implements INodeType {
|
||||
}
|
||||
|
||||
if (returnAll) {
|
||||
|
||||
responseData = await automizyApiRequestAllItems.call(
|
||||
this,
|
||||
'contacts',
|
||||
@@ -229,7 +201,6 @@ export class Automizy implements INodeType {
|
||||
{},
|
||||
qs,
|
||||
);
|
||||
|
||||
} else {
|
||||
qs.limit = this.getNodeParameter('limit', i) as number;
|
||||
|
||||
@@ -255,12 +226,12 @@ export class Automizy implements INodeType {
|
||||
Object.assign(body, updateFields);
|
||||
|
||||
if (body.customFieldsUi) {
|
||||
const customFieldsValues = (body.customFieldsUi as IDataObject).customFieldsValues as IDataObject[];
|
||||
const customFieldsValues = (body.customFieldsUi as IDataObject)
|
||||
.customFieldsValues as IDataObject[];
|
||||
|
||||
body.customFields = {};
|
||||
|
||||
for (const customField of customFieldsValues) {
|
||||
|
||||
//@ts-ignore
|
||||
body.customFields[customField.key] = customField.value;
|
||||
}
|
||||
@@ -268,17 +239,11 @@ export class Automizy implements INodeType {
|
||||
delete body.customFieldsUi;
|
||||
}
|
||||
|
||||
responseData = await automizyApiRequest.call(
|
||||
this,
|
||||
'PATCH',
|
||||
`/contacts/${email}`,
|
||||
body,
|
||||
);
|
||||
responseData = await automizyApiRequest.call(this, 'PATCH', `/contacts/${email}`, body);
|
||||
}
|
||||
}
|
||||
|
||||
if (resource === 'list') {
|
||||
|
||||
if (operation === 'create') {
|
||||
const name = this.getNodeParameter('name', i) as string;
|
||||
|
||||
@@ -286,22 +251,13 @@ export class Automizy implements INodeType {
|
||||
name,
|
||||
};
|
||||
|
||||
responseData = await automizyApiRequest.call(
|
||||
this,
|
||||
'POST',
|
||||
`/smart-lists`,
|
||||
body,
|
||||
);
|
||||
responseData = await automizyApiRequest.call(this, 'POST', `/smart-lists`, body);
|
||||
}
|
||||
|
||||
if (operation === 'delete') {
|
||||
const listId = this.getNodeParameter('listId', i) as string;
|
||||
|
||||
responseData = await automizyApiRequest.call(
|
||||
this,
|
||||
'DELETE',
|
||||
`/smart-lists/${listId}`,
|
||||
);
|
||||
responseData = await automizyApiRequest.call(this, 'DELETE', `/smart-lists/${listId}`);
|
||||
|
||||
responseData = { success: true };
|
||||
}
|
||||
@@ -309,11 +265,7 @@ export class Automizy implements INodeType {
|
||||
if (operation === 'get') {
|
||||
const listId = this.getNodeParameter('listId', i) as string;
|
||||
|
||||
responseData = await automizyApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
`/smart-lists/${listId}`,
|
||||
);
|
||||
responseData = await automizyApiRequest.call(this, 'GET', `/smart-lists/${listId}`);
|
||||
}
|
||||
|
||||
if (operation === 'getAll') {
|
||||
@@ -330,7 +282,6 @@ export class Automizy implements INodeType {
|
||||
}
|
||||
|
||||
if (returnAll) {
|
||||
|
||||
responseData = await automizyApiRequestAllItems.call(
|
||||
this,
|
||||
'smartLists',
|
||||
@@ -339,17 +290,10 @@ export class Automizy implements INodeType {
|
||||
{},
|
||||
qs,
|
||||
);
|
||||
|
||||
} else {
|
||||
qs.limit = this.getNodeParameter('limit', i) as number;
|
||||
|
||||
responseData = await automizyApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
`/smart-lists`,
|
||||
{},
|
||||
qs,
|
||||
);
|
||||
responseData = await automizyApiRequest.call(this, 'GET', `/smart-lists`, {}, qs);
|
||||
|
||||
responseData = responseData.smartLists;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import {
|
||||
INodeProperties,
|
||||
} from 'n8n-workflow';
|
||||
import { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
export const contactOperations: INodeProperties[] = [
|
||||
{
|
||||
@@ -10,9 +8,7 @@ export const contactOperations: INodeProperties[] = [
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'contact',
|
||||
],
|
||||
resource: ['contact'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -52,7 +48,6 @@ export const contactOperations: INodeProperties[] = [
|
||||
];
|
||||
|
||||
export const contactFields: INodeProperties[] = [
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* contact:create */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
@@ -64,12 +59,8 @@ export const contactFields: INodeProperties[] = [
|
||||
placeholder: 'name@email.com',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: [
|
||||
'contact',
|
||||
],
|
||||
operation: ['create'],
|
||||
resource: ['contact'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
@@ -80,18 +71,15 @@ export const contactFields: INodeProperties[] = [
|
||||
name: 'listId',
|
||||
required: true,
|
||||
type: 'options',
|
||||
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
|
||||
description:
|
||||
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getLists',
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: [
|
||||
'contact',
|
||||
],
|
||||
operation: ['create'],
|
||||
resource: ['contact'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
@@ -102,12 +90,8 @@ export const contactFields: INodeProperties[] = [
|
||||
type: 'collection',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: [
|
||||
'contact',
|
||||
],
|
||||
operation: ['create'],
|
||||
resource: ['contact'],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
@@ -135,7 +119,8 @@ export const contactFields: INodeProperties[] = [
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getCustomFields',
|
||||
},
|
||||
description: 'The end user specified key of the user defined data. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
description:
|
||||
'The end user specified key of the user defined data. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
@@ -177,7 +162,8 @@ export const contactFields: INodeProperties[] = [
|
||||
},
|
||||
],
|
||||
default: '',
|
||||
description: 'The status of the contact. You can only send email to contacts with ACTIVE status.',
|
||||
description:
|
||||
'The status of the contact. You can only send email to contacts with ACTIVE status.',
|
||||
},
|
||||
{
|
||||
displayName: 'Tag Names or IDs',
|
||||
@@ -187,7 +173,8 @@ export const contactFields: INodeProperties[] = [
|
||||
loadOptionsMethod: 'getTags',
|
||||
},
|
||||
default: [],
|
||||
description: 'The tags you want to set to the contact. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
description:
|
||||
'The tags you want to set to the contact. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -202,12 +189,8 @@ export const contactFields: INodeProperties[] = [
|
||||
type: 'string',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'delete',
|
||||
],
|
||||
resource: [
|
||||
'contact',
|
||||
],
|
||||
operation: ['delete'],
|
||||
resource: ['contact'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
@@ -224,12 +207,8 @@ export const contactFields: INodeProperties[] = [
|
||||
type: 'string',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'get',
|
||||
],
|
||||
resource: [
|
||||
'contact',
|
||||
],
|
||||
operation: ['get'],
|
||||
resource: ['contact'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
@@ -244,18 +223,15 @@ export const contactFields: INodeProperties[] = [
|
||||
name: 'listId',
|
||||
required: true,
|
||||
type: 'options',
|
||||
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
|
||||
description:
|
||||
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getLists',
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: [
|
||||
'contact',
|
||||
],
|
||||
operation: ['getAll'],
|
||||
resource: ['contact'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
@@ -266,12 +242,8 @@ export const contactFields: INodeProperties[] = [
|
||||
type: 'boolean',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: [
|
||||
'contact',
|
||||
],
|
||||
operation: ['getAll'],
|
||||
resource: ['contact'],
|
||||
},
|
||||
},
|
||||
default: false,
|
||||
@@ -283,15 +255,9 @@ export const contactFields: INodeProperties[] = [
|
||||
type: 'number',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: [
|
||||
'contact',
|
||||
],
|
||||
returnAll: [
|
||||
false,
|
||||
],
|
||||
operation: ['getAll'],
|
||||
resource: ['contact'],
|
||||
returnAll: [false],
|
||||
},
|
||||
},
|
||||
typeOptions: {
|
||||
@@ -308,12 +274,8 @@ export const contactFields: INodeProperties[] = [
|
||||
placeholder: 'Add Field',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: [
|
||||
'contact',
|
||||
],
|
||||
operation: ['getAll'],
|
||||
resource: ['contact'],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
@@ -333,7 +295,8 @@ export const contactFields: INodeProperties[] = [
|
||||
},
|
||||
],
|
||||
default: 'desc',
|
||||
description: 'Defines the direction in which search results are ordered. Default value is DESC. Note: It has to be using with the Sort By parameter',
|
||||
description:
|
||||
'Defines the direction in which search results are ordered. Default value is DESC. Note: It has to be using with the Sort By parameter',
|
||||
},
|
||||
{
|
||||
displayName: 'Fields',
|
||||
@@ -346,7 +309,8 @@ export const contactFields: INodeProperties[] = [
|
||||
displayName: 'Sort By',
|
||||
name: 'sortBy',
|
||||
type: 'string',
|
||||
default: 'Defines the field in which search results are sort by. Note: It has to be using with the Direcction parameter',
|
||||
default:
|
||||
'Defines the field in which search results are sort by. Note: It has to be using with the Direcction parameter',
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -362,12 +326,8 @@ export const contactFields: INodeProperties[] = [
|
||||
placeholder: 'name@email.com',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'update',
|
||||
],
|
||||
resource: [
|
||||
'contact',
|
||||
],
|
||||
operation: ['update'],
|
||||
resource: ['contact'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
@@ -378,12 +338,8 @@ export const contactFields: INodeProperties[] = [
|
||||
type: 'collection',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'update',
|
||||
],
|
||||
resource: [
|
||||
'contact',
|
||||
],
|
||||
operation: ['update'],
|
||||
resource: ['contact'],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
@@ -397,7 +353,8 @@ export const contactFields: INodeProperties[] = [
|
||||
loadOptionsMethod: 'getTags',
|
||||
},
|
||||
default: [],
|
||||
description: 'The tags you want to add to the contact. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
description:
|
||||
'The tags you want to add to the contact. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Custom Fields',
|
||||
@@ -421,7 +378,8 @@ export const contactFields: INodeProperties[] = [
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getCustomFields',
|
||||
},
|
||||
description: 'The end user specified key of the user defined data. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
description:
|
||||
'The end user specified key of the user defined data. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
@@ -444,7 +402,8 @@ export const contactFields: INodeProperties[] = [
|
||||
loadOptionsMethod: 'getTags',
|
||||
},
|
||||
default: [],
|
||||
description: 'The tags you want to add to the contact. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
description:
|
||||
'The tags you want to add to the contact. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Status',
|
||||
@@ -473,7 +432,8 @@ export const contactFields: INodeProperties[] = [
|
||||
},
|
||||
],
|
||||
default: '',
|
||||
description: 'The status of the contact. You can only send email to contacts with ACTIVE status.',
|
||||
description:
|
||||
'The status of the contact. You can only send email to contacts with ACTIVE status.',
|
||||
},
|
||||
{
|
||||
displayName: 'Tag Names or IDs',
|
||||
@@ -483,7 +443,8 @@ export const contactFields: INodeProperties[] = [
|
||||
loadOptionsMethod: 'getTags',
|
||||
},
|
||||
default: [],
|
||||
description: 'The tags you want to set to the contact. Will replace all existing ones. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
description:
|
||||
'The tags you want to set to the contact. Will replace all existing ones. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
import {
|
||||
OptionsWithUri,
|
||||
} from 'request';
|
||||
import { OptionsWithUri } from 'request';
|
||||
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
IExecuteSingleFunctions,
|
||||
ILoadOptionsFunctions,
|
||||
} from 'n8n-core';
|
||||
import { IExecuteFunctions, IExecuteSingleFunctions, ILoadOptionsFunctions } from 'n8n-core';
|
||||
|
||||
import {
|
||||
IDataObject, NodeApiError,
|
||||
} from 'n8n-workflow';
|
||||
import { IDataObject, NodeApiError } from 'n8n-workflow';
|
||||
|
||||
export async function automizyApiRequest(this: IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, method: string, path: string, body: any = {}, qs: IDataObject = {}, option = {}): Promise<any> { // tslint:disable-line:no-any
|
||||
|
||||
const credentials = await this.getCredentials('automizyApi') as IDataObject;
|
||||
export async function automizyApiRequest(
|
||||
this: IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions,
|
||||
method: string,
|
||||
path: string,
|
||||
// tslint:disable-next-line:no-any
|
||||
body: any = {},
|
||||
qs: IDataObject = {},
|
||||
option = {},
|
||||
// tslint:disable-next-line:no-any
|
||||
): Promise<any> {
|
||||
const credentials = (await this.getCredentials('automizyApi')) as IDataObject;
|
||||
|
||||
const options: OptionsWithUri = {
|
||||
headers: {
|
||||
'Authorization': `Bearer ${credentials.apiToken}`,
|
||||
Authorization: `Bearer ${credentials.apiToken}`,
|
||||
},
|
||||
method,
|
||||
body,
|
||||
@@ -44,8 +44,16 @@ export async function automizyApiRequest(this: IExecuteFunctions | IExecuteSingl
|
||||
}
|
||||
}
|
||||
|
||||
export async function automizyApiRequestAllItems(this: IExecuteFunctions | ILoadOptionsFunctions, propertyName: string, method: string, endpoint: string, body: any = {}, query: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
||||
|
||||
export async function automizyApiRequestAllItems(
|
||||
this: IExecuteFunctions | ILoadOptionsFunctions,
|
||||
propertyName: string,
|
||||
method: string,
|
||||
endpoint: string,
|
||||
// tslint:disable-next-line:no-any
|
||||
body: any = {},
|
||||
query: IDataObject = {},
|
||||
// tslint:disable-next-line:no-any
|
||||
): Promise<any> {
|
||||
const returnData: IDataObject[] = [];
|
||||
|
||||
let responseData;
|
||||
@@ -55,9 +63,7 @@ export async function automizyApiRequestAllItems(this: IExecuteFunctions | ILoad
|
||||
responseData = await automizyApiRequest.call(this, method, endpoint, body, query);
|
||||
query.page++;
|
||||
returnData.push.apply(returnData, responseData[propertyName]);
|
||||
} while (
|
||||
responseData.pageCount !== responseData.page
|
||||
);
|
||||
} while (responseData.pageCount !== responseData.page);
|
||||
|
||||
return returnData;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import {
|
||||
INodeProperties,
|
||||
} from 'n8n-workflow';
|
||||
import { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
export const listOperations: INodeProperties[] = [
|
||||
{
|
||||
@@ -10,9 +8,7 @@ export const listOperations: INodeProperties[] = [
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'list',
|
||||
],
|
||||
resource: ['list'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -52,7 +48,6 @@ export const listOperations: INodeProperties[] = [
|
||||
];
|
||||
|
||||
export const listFields: INodeProperties[] = [
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* list:create */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
@@ -63,12 +58,8 @@ export const listFields: INodeProperties[] = [
|
||||
type: 'string',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: [
|
||||
'list',
|
||||
],
|
||||
operation: ['create'],
|
||||
resource: ['list'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
@@ -83,17 +74,13 @@ export const listFields: INodeProperties[] = [
|
||||
type: 'string',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'delete',
|
||||
],
|
||||
resource: [
|
||||
'list',
|
||||
],
|
||||
operation: ['delete'],
|
||||
resource: ['list'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* list:get */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
@@ -103,12 +90,8 @@ export const listFields: INodeProperties[] = [
|
||||
type: 'string',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'get',
|
||||
],
|
||||
resource: [
|
||||
'list',
|
||||
],
|
||||
operation: ['get'],
|
||||
resource: ['list'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
@@ -122,12 +105,8 @@ export const listFields: INodeProperties[] = [
|
||||
type: 'boolean',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: [
|
||||
'list',
|
||||
],
|
||||
operation: ['getAll'],
|
||||
resource: ['list'],
|
||||
},
|
||||
},
|
||||
default: false,
|
||||
@@ -139,15 +118,9 @@ export const listFields: INodeProperties[] = [
|
||||
type: 'number',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: [
|
||||
'list',
|
||||
],
|
||||
returnAll: [
|
||||
false,
|
||||
],
|
||||
operation: ['getAll'],
|
||||
resource: ['list'],
|
||||
returnAll: [false],
|
||||
},
|
||||
},
|
||||
typeOptions: {
|
||||
@@ -164,12 +137,8 @@ export const listFields: INodeProperties[] = [
|
||||
placeholder: 'Add Field',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: [
|
||||
'list',
|
||||
],
|
||||
operation: ['getAll'],
|
||||
resource: ['list'],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
@@ -189,7 +158,8 @@ export const listFields: INodeProperties[] = [
|
||||
},
|
||||
],
|
||||
default: 'desc',
|
||||
description: 'Defines the direction in which search results are ordered. Default value is DESC. Note: It has to be using with the Sort By parameter',
|
||||
description:
|
||||
'Defines the direction in which search results are ordered. Default value is DESC. Note: It has to be using with the Sort By parameter',
|
||||
},
|
||||
{
|
||||
displayName: 'Fields',
|
||||
@@ -202,7 +172,8 @@ export const listFields: INodeProperties[] = [
|
||||
displayName: 'Sort By',
|
||||
name: 'sortBy',
|
||||
type: 'string',
|
||||
default: 'Defines the field in which search results are sort by. Note: It has to be using with the Direcction parameter',
|
||||
default:
|
||||
'Defines the field in which search results are sort by. Note: It has to be using with the Direcction parameter',
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -216,12 +187,8 @@ export const listFields: INodeProperties[] = [
|
||||
type: 'string',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'update',
|
||||
],
|
||||
resource: [
|
||||
'list',
|
||||
],
|
||||
operation: ['update'],
|
||||
resource: ['list'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
@@ -233,12 +200,8 @@ export const listFields: INodeProperties[] = [
|
||||
type: 'string',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'update',
|
||||
],
|
||||
resource: [
|
||||
'list',
|
||||
],
|
||||
operation: ['update'],
|
||||
resource: ['list'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
|
||||
Reference in New Issue
Block a user