n8n/packages/nodes-base/nodes/Zoho/descriptions/AccountDescription.ts

402 lines
7.4 KiB
TypeScript
Raw Normal View History

2021-04-29 02:56:19 -07:00
import {
INodeProperties,
} from 'n8n-workflow';
import {
billingAddress,
makeCustomFieldsFixedCollection,
2021-04-29 02:56:19 -07:00
makeGetAllFields,
shippingAddress,
} from './SharedFields';
export const accountOperations = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
displayOptions: {
show: {
resource: [
'account',
],
},
},
options: [
{
name: 'Create',
value: 'create',
},
2021-06-15 07:54:21 -07:00
{
name: 'Create or update',
value: 'upsert',
2021-06-15 07:55:53 -07:00
description: 'Create a new record, or update the current one if it already exists (upsert)',
2021-06-15 07:54:21 -07:00
},
2021-04-29 02:56:19 -07:00
{
name: 'Delete',
value: 'delete',
},
{
name: 'Get',
value: 'get',
},
{
name: 'Get All',
value: 'getAll',
},
{
name: 'Update',
value: 'update',
},
],
default: 'create',
description: 'Operation to perform',
},
] as INodeProperties[];
export const accountFields = [
// ----------------------------------------
// account: create
2021-04-29 02:56:19 -07:00
// ----------------------------------------
{
displayName: 'Account Name',
name: 'accountName',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'account',
],
operation: [
'create',
],
},
},
},
// ----------------------------------------
// account: upsert
// ----------------------------------------
{
displayName: 'Account Name',
name: 'accountName',
description: 'Name of the account. If a record with this account name exists it will be updated, otherwise a new one will be created.',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'account',
],
operation: [
2021-05-31 02:01:13 -07:00
'upsert',
2021-04-29 02:56:19 -07:00
],
},
},
},
// ----------------------------------------
// account: create + upsert
// ----------------------------------------
2021-04-29 02:56:19 -07:00
{
displayName: 'Additional Fields',
name: 'additionalFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: [
'account',
],
operation: [
'create',
2021-05-31 02:01:13 -07:00
'upsert',
2021-04-29 02:56:19 -07:00
],
},
},
options: [
{
displayName: 'Account Number',
name: 'Account_Number',
type: 'string',
default: '',
},
{
displayName: 'Account Site',
name: 'Account_Site',
type: 'string',
default: '',
description: 'Name of the accounts location, e.g. Headquarters or London.',
},
{
displayName: 'Account Type',
name: 'Account_Type',
type: 'string',
default: '',
},
{
displayName: 'Annual Revenue',
name: 'Annual_Revenue',
2021-05-07 04:19:01 -07:00
type: 'number',
2021-04-29 02:56:19 -07:00
default: '',
},
billingAddress,
{
displayName: 'Contact Details',
name: 'Contact_Details',
type: 'string',
default: '',
},
{
displayName: 'Currency',
name: 'Currency',
type: 'string',
default: '',
description: 'Symbol of the currency in which revenue is generated.',
},
makeCustomFieldsFixedCollection('account'),
2021-04-29 02:56:19 -07:00
{
displayName: 'Description',
name: 'Description',
type: 'string',
default: '',
},
{
displayName: 'Employees',
name: 'Employees',
type: 'number',
default: '',
description: 'Number of employees in the accounts company.',
},
{
displayName: 'Exchange Rate',
name: 'Exchange_Rate',
2021-05-07 04:19:01 -07:00
type: 'number',
2021-04-29 02:56:19 -07:00
default: '',
description: 'Exchange rate of the default currency to the home currency.',
},
{
displayName: 'Fax',
name: 'Fax',
type: 'string',
default: '',
},
{
displayName: 'Industry',
name: 'Industry',
type: 'string',
default: '',
},
{
displayName: 'Phone',
name: 'Phone',
type: 'string',
default: '',
},
shippingAddress,
{
displayName: 'Ticker Symbol',
name: 'Ticker_Symbol',
type: 'string',
default: '',
},
{
displayName: 'Website',
name: 'Website',
type: 'string',
default: '',
},
],
},
// ----------------------------------------
// account: delete
// ----------------------------------------
{
displayName: 'Account ID',
name: 'accountId',
description: 'ID of the account to delete.',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'account',
],
operation: [
'delete',
],
},
},
},
// ----------------------------------------
// account: get
// ----------------------------------------
{
displayName: 'Account ID',
name: 'accountId',
description: 'ID of the account to retrieve.',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'account',
],
operation: [
'get',
],
},
},
},
// ----------------------------------------
// account: getAll
// ----------------------------------------
...makeGetAllFields('account'),
// ----------------------------------------
// account: update
// ----------------------------------------
{
displayName: 'Account ID',
name: 'accountId',
description: 'ID of the account to update.',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'account',
],
operation: [
'update',
],
},
},
},
{
displayName: 'Update Fields',
name: 'updateFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: [
'account',
],
operation: [
'update',
],
},
},
options: [
{
displayName: 'Account Name',
name: 'Account_Name',
type: 'string',
default: '',
},
{
displayName: 'Account Number',
name: 'Account_Number',
type: 'string',
default: '',
},
{
displayName: 'Account Site',
name: 'Account_Site',
type: 'string',
default: '',
description: 'Name of the accounts location, e.g. Headquarters or London.',
},
{
displayName: 'Account Type',
name: 'Account_Type',
type: 'string',
default: '',
},
{
displayName: 'Annual Revenue',
name: 'Annual_Revenue',
2021-05-07 04:19:01 -07:00
type: 'number',
2021-04-29 02:56:19 -07:00
default: '',
},
billingAddress,
{
displayName: 'Contact Details',
name: 'Contact_Details',
type: 'string',
default: '',
},
{
displayName: 'Currency',
name: 'Currency',
type: 'string',
default: '',
description: 'Symbol of the currency in which revenue is generated.',
},
makeCustomFieldsFixedCollection('account'),
2021-04-29 02:56:19 -07:00
{
displayName: 'Description',
name: 'Description',
type: 'string',
default: '',
},
{
displayName: 'Employees',
name: 'Employees',
type: 'number',
default: '',
description: 'Number of employees in the accounts company.',
},
{
displayName: 'Exchange Rate',
name: 'Exchange_Rate',
2021-05-07 04:19:01 -07:00
type: 'number',
2021-04-29 02:56:19 -07:00
default: '',
description: 'Exchange rate of the default currency to the home currency.',
},
{
displayName: 'Fax',
name: 'Fax',
type: 'string',
default: '',
},
{
displayName: 'Industry',
name: 'Industry',
type: 'string',
default: '',
},
{
displayName: 'Phone',
name: 'Phone',
type: 'string',
default: '',
},
shippingAddress,
{
displayName: 'Ticker Symbol',
name: 'Ticker_Symbol',
type: 'string',
default: '',
},
{
displayName: 'Website',
name: 'Website',
type: 'string',
default: '',
},
],
},
] as INodeProperties[];