n8n-nodes-imobzi
Version:
Nodes para integração com a API da Imobzi no n8n
1,172 lines • 76.6 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Imobzi = void 0;
const n8n_workflow_1 = require("n8n-workflow");
const resourceEndpoint = {
lead: 'v1/leads',
property: 'v1/properties',
contact: 'v1/contacts',
contrato: 'v1/contracts',
financeiro: 'v1/financial/accounts',
locacao: 'v1/rentals',
documento: 'v1/documents',
tarefa: 'v1/tasks',
agenda: 'v1/agendas',
evento: 'v1/events',
integracao: 'v1/integrations',
usuario: 'v1/users',
account: 'v1/account',
};
const createCreateFieldsProperty = (resourceName) => {
const baseOptions = [
{
displayName: 'Name',
name: 'name',
type: 'string',
default: '',
description: 'Name of the item',
},
{
displayName: 'Email',
name: 'email',
type: 'string',
placeholder: 'name@email.com',
default: '',
description: 'Email address',
},
{
displayName: 'Phone',
name: 'phone',
type: 'string',
default: '',
description: 'Phone number',
},
{
displayName: 'Description',
name: 'description',
type: 'string',
default: '',
description: 'Description of the item',
},
];
const resourceSpecificOptions = {
lead: [
...baseOptions,
{
displayName: 'Source',
name: 'source',
type: 'string',
default: '',
description: 'Lead source',
},
{
displayName: 'Status',
name: 'status',
type: 'string',
default: '',
description: 'Lead status',
},
],
property: [
{
displayName: 'Title',
name: 'title',
type: 'string',
default: '',
description: 'Property title',
},
{
displayName: 'Type',
name: 'type',
type: 'string',
default: '',
description: 'Property type (house, apartment, etc.)',
},
{
displayName: 'Price',
name: 'price',
type: 'number',
default: 0,
description: 'Property price',
},
{
displayName: 'Address',
name: 'address',
type: 'string',
default: '',
description: 'Property address',
},
{
displayName: 'City',
name: 'city',
type: 'string',
default: '',
description: 'Property city',
},
{
displayName: 'State',
name: 'state',
type: 'string',
default: '',
description: 'Property state',
},
],
contact: [
...baseOptions,
{
displayName: 'Company',
name: 'company',
type: 'string',
default: '',
description: 'Company name',
},
],
tarefa: [
{
displayName: 'Title',
name: 'title',
type: 'string',
default: '',
description: 'Task title',
},
{
displayName: 'Description',
name: 'description',
type: 'string',
default: '',
description: 'Task description',
},
{
displayName: 'Due Date',
name: 'dueDate',
type: 'string',
default: '',
description: 'Task due date',
},
{
displayName: 'Priority',
name: 'priority',
type: 'string',
default: '',
description: 'Task priority',
},
],
agenda: [
{
displayName: 'Title',
name: 'title',
type: 'string',
default: '',
description: 'Agenda title',
},
{
displayName: 'Description',
name: 'description',
type: 'string',
default: '',
description: 'Agenda description',
},
],
evento: [
{
displayName: 'Title',
name: 'title',
type: 'string',
default: '',
description: 'Event title',
},
{
displayName: 'Description',
name: 'description',
type: 'string',
default: '',
description: 'Event description',
},
{
displayName: 'Start Date',
name: 'startDate',
type: 'string',
default: '',
description: 'Event start date',
},
{
displayName: 'End Date',
name: 'endDate',
type: 'string',
default: '',
description: 'Event end date',
},
],
};
return {
displayName: 'Create Fields',
name: 'createFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: [resourceName],
operation: ['create'],
},
},
options: resourceSpecificOptions[resourceName] || baseOptions,
};
};
const createUpdateFieldsProperty = (resourceName) => {
const baseOptions = [
{
displayName: 'Name',
name: 'name',
type: 'string',
default: '',
description: 'Name of the item',
},
{
displayName: 'Email',
name: 'email',
type: 'string',
placeholder: 'name@email.com',
default: '',
description: 'Email address',
},
{
displayName: 'Phone',
name: 'phone',
type: 'string',
default: '',
description: 'Phone number',
},
{
displayName: 'Description',
name: 'description',
type: 'string',
default: '',
description: 'Description of the item',
},
];
const resourceSpecificOptions = {
lead: [
...baseOptions,
{
displayName: 'Source',
name: 'source',
type: 'string',
default: '',
description: 'Lead source',
},
{
displayName: 'Status',
name: 'status',
type: 'string',
default: '',
description: 'Lead status',
},
],
property: [
{
displayName: 'Title',
name: 'title',
type: 'string',
default: '',
description: 'Property title',
},
{
displayName: 'Type',
name: 'type',
type: 'string',
default: '',
description: 'Property type (house, apartment, etc.)',
},
{
displayName: 'Price',
name: 'price',
type: 'number',
default: 0,
description: 'Property price',
},
{
displayName: 'Address',
name: 'address',
type: 'string',
default: '',
description: 'Property address',
},
{
displayName: 'City',
name: 'city',
type: 'string',
default: '',
description: 'Property city',
},
{
displayName: 'State',
name: 'state',
type: 'string',
default: '',
description: 'Property state',
},
],
contact: [
...baseOptions,
{
displayName: 'Company',
name: 'company',
type: 'string',
default: '',
description: 'Company name',
},
],
tarefa: [
{
displayName: 'Title',
name: 'title',
type: 'string',
default: '',
description: 'Task title',
},
{
displayName: 'Description',
name: 'description',
type: 'string',
default: '',
description: 'Task description',
},
{
displayName: 'Due Date',
name: 'dueDate',
type: 'string',
default: '',
description: 'Task due date',
},
{
displayName: 'Priority',
name: 'priority',
type: 'string',
default: '',
description: 'Task priority',
},
],
agenda: [
{
displayName: 'Title',
name: 'title',
type: 'string',
default: '',
description: 'Agenda title',
},
{
displayName: 'Description',
name: 'description',
type: 'string',
default: '',
description: 'Agenda description',
},
],
evento: [
{
displayName: 'Title',
name: 'title',
type: 'string',
default: '',
description: 'Event title',
},
{
displayName: 'Description',
name: 'description',
type: 'string',
default: '',
description: 'Event description',
},
{
displayName: 'Start Date',
name: 'startDate',
type: 'string',
default: '',
description: 'Event start date',
},
{
displayName: 'End Date',
name: 'endDate',
type: 'string',
default: '',
description: 'Event end date',
},
],
};
return {
displayName: 'Update Fields',
name: 'updateFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: [resourceName],
operation: ['update'],
},
},
options: resourceSpecificOptions[resourceName] || baseOptions,
};
};
class Imobzi {
constructor() {
this.methods = {
loadOptions: {
async getLeads() {
const response = await this.helpers.requestWithAuthentication.call(this, 'imobziApi', { method: 'GET', url: '/v1/leads' });
return (response.data || []).map((item) => ({
name: item.name || `ID ${item.id}`,
value: item.id,
}));
},
async getLeadFields() {
const response = await this.helpers.requestWithAuthentication.call(this, 'imobziApi', { method: 'GET', url: '/v1/leads', qs: { limit: 1 } });
const item = (response.data || [])[0] || {};
return Object.keys(item).map(key => ({
name: key,
value: key,
}));
},
async getProperties() {
const response = await this.helpers.requestWithAuthentication.call(this, 'imobziApi', { method: 'GET', url: '/v1/properties' });
return (response.data || []).map((item) => ({
name: item.title || item.titulo || `ID ${item.id}`,
value: item.id,
}));
},
async getPropertyFields() {
const response = await this.helpers.requestWithAuthentication.call(this, 'imobziApi', { method: 'GET', url: '/v1/properties', qs: { limit: 1 } });
const item = (response.data || [])[0] || {};
return Object.keys(item).map(key => ({
name: key,
value: key,
}));
},
async getContacts() {
const response = await this.helpers.requestWithAuthentication.call(this, 'imobziApi', { method: 'GET', url: '/v1/contacts' });
return (response.data || []).map((item) => ({
name: item.name || `ID ${item.id}`,
value: item.id,
}));
},
async getContactFields() {
const response = await this.helpers.requestWithAuthentication.call(this, 'imobziApi', { method: 'GET', url: '/v1/contacts', qs: { limit: 1 } });
const item = (response.data || [])[0] || {};
return Object.keys(item).map(key => ({
name: key,
value: key,
}));
},
async getContracts() {
const response = await this.helpers.requestWithAuthentication.call(this, 'imobziApi', { method: 'GET', url: '/v1/contracts' });
return (response.data || []).map((item) => ({
name: item.client || item.cliente || `ID ${item.id}`,
value: item.id,
}));
},
async getContractFields() {
const response = await this.helpers.requestWithAuthentication.call(this, 'imobziApi', { method: 'GET', url: '/v1/contracts', qs: { limit: 1 } });
const item = (response.data || [])[0] || {};
return Object.keys(item).map(key => ({
name: key,
value: key,
}));
},
async getFinancialAccounts() {
const response = await this.helpers.requestWithAuthentication.call(this, 'imobziApi', { method: 'GET', url: '/v1/financial/accounts' });
return (response.data || []).map((item) => ({
name: item.description || item.descricao || `ID ${item.id}`,
value: item.id,
}));
},
async getFinancialAccountFields() {
const response = await this.helpers.requestWithAuthentication.call(this, 'imobziApi', { method: 'GET', url: '/v1/financial/accounts', qs: { limit: 1 } });
const item = (response.data || [])[0] || {};
return Object.keys(item).map(key => ({
name: key,
value: key,
}));
},
async getRentals() {
const response = await this.helpers.requestWithAuthentication.call(this, 'imobziApi', { method: 'GET', url: '/v1/rentals' });
return (response.data || []).map((item) => ({
name: item.tenant || item.inquilino || `ID ${item.id}`,
value: item.id,
}));
},
async getRentalFields() {
const response = await this.helpers.requestWithAuthentication.call(this, 'imobziApi', { method: 'GET', url: '/v1/rentals', qs: { limit: 1 } });
const item = (response.data || [])[0] || {};
return Object.keys(item).map(key => ({
name: key,
value: key,
}));
},
async getDocuments() {
const response = await this.helpers.requestWithAuthentication.call(this, 'imobziApi', { method: 'GET', url: '/v1/documents' });
return (response.data || []).map((item) => ({
name: item.filename || item.nomeArquivo || `ID ${item.id}`,
value: item.id,
}));
},
async getDocumentFields() {
const response = await this.helpers.requestWithAuthentication.call(this, 'imobziApi', { method: 'GET', url: '/v1/documents', qs: { limit: 1 } });
const item = (response.data || [])[0] || {};
return Object.keys(item).map(key => ({
name: key,
value: key,
}));
},
async getTasks() {
const response = await this.helpers.requestWithAuthentication.call(this, 'imobziApi', { method: 'GET', url: '/v1/tasks' });
return (response.data || []).map((item) => ({
name: item.title || item.titulo || `ID ${item.id}`,
value: item.id,
}));
},
async getTaskFields() {
const response = await this.helpers.requestWithAuthentication.call(this, 'imobziApi', { method: 'GET', url: '/v1/tasks', qs: { limit: 1 } });
const item = (response.data || [])[0] || {};
return Object.keys(item).map(key => ({
name: key,
value: key,
}));
},
async getAgendas() {
const response = await this.helpers.requestWithAuthentication.call(this, 'imobziApi', { method: 'GET', url: '/v1/agendas' });
return (response.data || []).map((item) => ({
name: item.title || item.titulo || `ID ${item.id}`,
value: item.id,
}));
},
async getAgendaFields() {
const response = await this.helpers.requestWithAuthentication.call(this, 'imobziApi', { method: 'GET', url: '/v1/agendas', qs: { limit: 1 } });
const item = (response.data || [])[0] || {};
return Object.keys(item).map(key => ({
name: key,
value: key,
}));
},
async getEvents() {
const response = await this.helpers.requestWithAuthentication.call(this, 'imobziApi', { method: 'GET', url: '/v1/events' });
return (response.data || []).map((item) => ({
name: item.title || item.titulo || `ID ${item.id}`,
value: item.id,
}));
},
async getEventFields() {
const response = await this.helpers.requestWithAuthentication.call(this, 'imobziApi', { method: 'GET', url: '/v1/events', qs: { limit: 1 } });
const item = (response.data || [])[0] || {};
return Object.keys(item).map(key => ({
name: key,
value: key,
}));
},
async getIntegrations() {
const response = await this.helpers.requestWithAuthentication.call(this, 'imobziApi', { method: 'GET', url: '/v1/integrations' });
return (response.data || []).map((item) => ({
name: item.name || item.nome || `ID ${item.id}`,
value: item.id,
}));
},
async getIntegrationFields() {
const response = await this.helpers.requestWithAuthentication.call(this, 'imobziApi', { method: 'GET', url: '/v1/integrations', qs: { limit: 1 } });
const item = (response.data || [])[0] || {};
return Object.keys(item).map(key => ({
name: key,
value: key,
}));
},
async getUsers() {
const response = await this.helpers.requestWithAuthentication.call(this, 'imobziApi', { method: 'GET', url: '/v1/users' });
return (response.data || []).map((item) => ({
name: item.name || item.nome || `ID ${item.id}`,
value: item.id,
}));
},
async getUserFields() {
const response = await this.helpers.requestWithAuthentication.call(this, 'imobziApi', { method: 'GET', url: '/v1/users', qs: { limit: 1 } });
const item = (response.data || [])[0] || {};
return Object.keys(item).map(key => ({
name: key,
value: key,
}));
},
},
};
this.description = {
displayName: 'Imobzi',
name: 'imobzi',
icon: 'file:imobzi.svg',
group: ['transform'],
version: 2,
description: 'Interagir com a API da Imobzi',
defaults: {
name: 'Imobzi',
},
inputs: ["main"],
outputs: ["main"],
credentials: [
{
name: 'imobziApi',
required: true,
},
],
properties: [
{
displayName: 'Resource',
name: 'resource',
type: 'options',
noDataExpression: true,
options: [
{ name: 'Account', value: 'account' },
{ name: 'Agenda', value: 'agenda' },
{ name: 'Contact', value: 'contact' },
{ name: 'Contrato', value: 'contrato' },
{ name: 'Documento', value: 'documento' },
{ name: 'Evento', value: 'evento' },
{ name: 'Financeiro', value: 'financeiro' },
{ name: 'Imovel', value: 'property' },
{ name: 'Integracao', value: 'integracao' },
{ name: 'Lead', value: 'lead' },
{ name: 'Locacao', value: 'locacao' },
{ name: 'Tarefa', value: 'tarefa' },
{ name: 'Usuario', value: 'usuario' },
],
default: 'lead',
},
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
options: [
{ name: 'Create', value: 'create', action: 'Create a new item' },
{ name: 'Delete', value: 'delete', action: 'Delete an item' },
{ name: 'Get', value: 'get', action: 'Get an item by ID' },
{ name: 'Get Many', value: 'getAll', action: 'Get many items' },
{ name: 'Update', value: 'update', action: 'Update an item' },
],
default: 'create',
},
{
displayName: 'Lead Name or ID',
name: 'id',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getLeads',
},
required: true,
default: '',
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
displayOptions: {
show: {
operation: ['get', 'update', 'delete'],
resource: ['lead'],
},
},
},
{
displayName: 'Property Name or ID',
name: 'id',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getProperties',
},
required: true,
default: '',
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
displayOptions: {
show: {
operation: ['get', 'update', 'delete'],
resource: ['property'],
},
},
},
{
displayName: 'Contact Name or ID',
name: 'id',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getContacts',
},
required: true,
default: '',
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
displayOptions: {
show: {
operation: ['get', 'update', 'delete'],
resource: ['contact'],
},
},
},
{
displayName: 'Contract Name or ID',
name: 'id',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getContracts',
},
required: true,
default: '',
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
displayOptions: {
show: {
operation: ['get', 'update', 'delete'],
resource: ['contrato'],
},
},
},
{
displayName: 'Financial Account Name or ID',
name: 'id',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getFinancialAccounts',
},
required: true,
default: '',
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
displayOptions: {
show: {
operation: ['get', 'update', 'delete'],
resource: ['financeiro'],
},
},
},
{
displayName: 'Rental Name or ID',
name: 'id',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getRentals',
},
required: true,
default: '',
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
displayOptions: {
show: {
operation: ['get', 'update', 'delete'],
resource: ['locacao'],
},
},
},
{
displayName: 'Document Name or ID',
name: 'id',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getDocuments',
},
required: true,
default: '',
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
displayOptions: {
show: {
operation: ['get', 'update', 'delete'],
resource: ['documento'],
},
},
},
{
displayName: 'Task Name or ID',
name: 'id',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getTasks',
},
required: true,
default: '',
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
displayOptions: {
show: {
operation: ['get', 'update', 'delete'],
resource: ['tarefa'],
},
},
},
{
displayName: 'Agenda Name or ID',
name: 'id',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getAgendas',
},
required: true,
default: '',
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
displayOptions: {
show: {
operation: ['get', 'update', 'delete'],
resource: ['agenda'],
},
},
},
{
displayName: 'Event Name or ID',
name: 'id',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getEvents',
},
required: true,
default: '',
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
displayOptions: {
show: {
operation: ['get', 'update', 'delete'],
resource: ['evento'],
},
},
},
{
displayName: 'Integration Name or ID',
name: 'id',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getIntegrations',
},
required: true,
default: '',
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
displayOptions: {
show: {
operation: ['get', 'update', 'delete'],
resource: ['integracao'],
},
},
},
{
displayName: 'User Name or ID',
name: 'id',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getUsers',
},
required: true,
default: '',
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
displayOptions: {
show: {
operation: ['get', 'update', 'delete'],
resource: ['usuario'],
},
},
},
{
displayName: 'Filtros',
name: 'filters',
type: 'fixedCollection',
typeOptions: { multipleValues: true },
placeholder: 'Adicionar filtro',
default: {},
displayOptions: {
show: {
resource: ['lead'],
operation: ['getAll'],
},
},
options: [
{
name: 'filter',
displayName: 'Condição',
values: [
{
displayName: 'Campo Name or ID',
name: 'field',
type: 'options',
typeOptions: { loadOptionsMethod: 'getLeadFields' },
default: '',
description: 'Campo para filtrar. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'Operador',
name: 'operator',
type: 'options',
options: [
{ name: 'Começa Com', value: 'starts_with' },
{ name: 'Contém', value: 'contains' },
{ name: 'Diferente', value: 'neq' },
{ name: 'Igual', value: 'eq' },
{ name: 'Maior Ou Igual', value: 'gte' },
{ name: 'Maior Que', value: 'gt' },
{ name: 'Menor Ou Igual', value: 'lte' },
{ name: 'Menor Que', value: 'lt' },
{ name: 'Não Contém', value: 'not_contains' },
{ name: 'Termina Com', value: 'ends_with' },
],
default: 'eq',
description: 'Operador de comparação',
},
{
displayName: 'Valor',
name: 'value',
type: 'string',
default: '',
description: 'Valor para comparar',
},
],
},
],
},
{
displayName: 'Filtros',
name: 'filters',
type: 'fixedCollection',
typeOptions: { multipleValues: true },
placeholder: 'Adicionar filtro',
default: {},
displayOptions: {
show: {
resource: ['property'],
operation: ['getAll'],
},
},
options: [
{
name: 'filter',
displayName: 'Condição',
values: [
{
displayName: 'Campo Name or ID',
name: 'field',
type: 'options',
typeOptions: { loadOptionsMethod: 'getPropertyFields' },
default: '',
description: 'Campo para filtrar. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'Operador',
name: 'operator',
type: 'options',
options: [
{ name: 'Começa Com', value: 'starts_with' },
{ name: 'Contém', value: 'contains' },
{ name: 'Diferente', value: 'neq' },
{ name: 'Igual', value: 'eq' },
{ name: 'Maior Ou Igual', value: 'gte' },
{ name: 'Maior Que', value: 'gt' },
{ name: 'Menor Ou Igual', value: 'lte' },
{ name: 'Menor Que', value: 'lt' },
{ name: 'Não Contém', value: 'not_contains' },
{ name: 'Termina Com', value: 'ends_with' },
],
default: 'eq',
description: 'Operador de comparação',
},
{
displayName: 'Valor',
name: 'value',
type: 'string',
default: '',
description: 'Valor para comparar',
},
],
},
],
},
{
displayName: 'Filtros',
name: 'filters',
type: 'fixedCollection',
typeOptions: { multipleValues: true },
placeholder: 'Adicionar filtro',
default: {},
displayOptions: {
show: {
resource: ['contact'],
operation: ['getAll'],
},
},
options: [
{
name: 'filter',
displayName: 'Condição',
values: [
{
displayName: 'Campo Name or ID',
name: 'field',
type: 'options',
typeOptions: { loadOptionsMethod: 'getContactFields' },
default: '',
description: 'Campo para filtrar. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'Operador',
name: 'operator',
type: 'options',
options: [
{ name: 'Começa Com', value: 'starts_with' },
{ name: 'Contém', value: 'contains' },
{ name: 'Diferente', value: 'neq' },
{ name: 'Igual', value: 'eq' },
{ name: 'Maior Ou Igual', value: 'gte' },
{ name: 'Maior Que', value: 'gt' },
{ name: 'Menor Ou Igual', value: 'lte' },
{ name: 'Menor Que', value: 'lt' },
{ name: 'Não Contém', value: 'not_contains' },
{ name: 'Termina Com', value: 'ends_with' },
],
default: 'eq',
description: 'Operador de comparação',
},
{
displayName: 'Valor',
name: 'value',
type: 'string',
default: '',
description: 'Valor para comparar',
},
],
},
],
},
{
displayName: 'Filtros',
name: 'filters',
type: 'fixedCollection',
typeOptions: { multipleValues: true },
placeholder: 'Adicionar filtro',
default: {},
displayOptions: {
show: {
resource: ['contrato'],
operation: ['getAll'],
},
},
options: [
{
name: 'filter',
displayName: 'Condição',
values: [
{
displayName: 'Campo Name or ID',
name: 'field',
type: 'options',
typeOptions: { loadOptionsMethod: 'getContractFields' },
default: '',
description: 'Campo para filtrar. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'Operador',
name: 'operator',
type: 'options',
options: [
{ name: 'Começa Com', value: 'starts_with' },
{ name: 'Contém', value: 'contains' },
{ name: 'Diferente', value: 'neq' },
{ name: 'Igual', value: 'eq' },
{ name: 'Maior Ou Igual', value: 'gte' },
{ name: 'Maior Que', value: 'gt' },
{ name: 'Menor Ou Igual', value: 'lte' },
{ name: 'Menor Que', value: 'lt' },
{ name: 'Não Contém', value: 'not_contains' },
{ name: 'Termina Com', value: 'ends_with' },
],
default: 'eq',
description: 'Operador de comparação',
},
{
displayName: 'Valor',
name: 'value',
type: 'string',
default: '',
description: 'Valor para comparar',
},
],
},
],
},
{
displayName: 'Filtros',
name: 'filters',
type: 'fixedCollection',
typeOptions: { multipleValues: true },
placeholder: 'Adicionar filtro',
default: {},
displayOptions: {
show: {
resource: ['financeiro'],
operation: ['getAll'],
},
},
options: [
{
name: 'filter',
displayName: 'Condição',
values: [
{
displayName: 'Campo Name or ID',
name: 'field',
type: 'options',
typeOptions: { loadOptionsMethod: 'getFinancialAccountFields' },
default: '',
description: 'Campo para filtrar. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'Operador',
name: 'operator',
type: 'options',
options: [
{ name: 'Começa Com', value: 'starts_with' },
{ name: 'Contém', value: 'contains' },
{ name: 'Diferente', value: 'neq' },
{ name: 'Igual', value: 'eq' },
{ name: 'Maior Ou Igual', value: 'gte' },
{ name: 'Maior Que', value: 'gt' },
{ name: 'Menor Ou Igual', value: 'lte' },
{ name: 'Menor Que', value: 'lt' },
{ name: 'Não Contém', value: 'not_contains' },
{ name: 'Termina Com', value: 'ends_with' },
],
default: 'eq',
description: 'Operador de comparação',
},
{
displayName: 'Valor',
name: 'value',
type: 'string',
default: '',
description: 'Valor para comparar',
},
],
},
],
},
{
displayName: 'Filtros',
name: 'filters',
type: 'fixedCollection',
typeOptions: { multipleValues: true },
placeholder: 'Adicionar filtro',
default: {},
displayOptions: {
show: {
resource: ['locacao'],
operation: ['getAll'],
},
},
options: [
{
name: 'filter',
displayName: 'Condição',
values: [
{
displayName: 'Campo Name or ID',
name: 'field',
type: 'options',
typeOptions: { loadOptionsMethod: 'getRentalFields' },
default: '',
description: 'Campo para filtrar. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'Operador',
name: 'operator',
type: 'options',
options: [
{ name: 'Começa Com', value: 'starts_with' },
{ name: 'Contém', value: 'contains' },
{ name: 'Diferente', value: 'neq' },
{ name: 'Igual', value: 'eq' },
{ name: 'Maior Ou Igual'