2022-08-17 08:50:24 -07:00
import { INodeProperties } from 'n8n-workflow' ;
2020-07-12 09:12:32 -07:00
2021-12-03 00:44:16 -08:00
export const contactOperations : INodeProperties [ ] = [
2020-07-12 09:12:32 -07:00
{
displayName : 'Operation' ,
name : 'operation' ,
type : 'options' ,
2022-05-20 14:47:24 -07:00
noDataExpression : true ,
2020-07-12 09:12:32 -07:00
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'contact' ] ,
2020-07-12 09:12:32 -07:00
} ,
} ,
options : [
{
name : 'Create' ,
value : 'create' ,
2022-06-03 10:23:49 -07:00
description : 'Create a contact' ,
2022-07-10 13:50:51 -07:00
action : 'Create a contact' ,
2020-07-12 09:12:32 -07:00
} ,
{
name : 'Get' ,
value : 'get' ,
description : 'Get a contact' ,
2022-07-10 13:50:51 -07:00
action : 'Get a contact' ,
2020-07-12 09:12:32 -07:00
} ,
{
2022-09-07 07:51:14 -07:00
name : 'Get Many' ,
2020-07-12 09:12:32 -07:00
value : 'getAll' ,
2022-09-13 03:36:36 -07:00
description : 'Get many contacts' ,
2022-09-08 08:10:13 -07:00
action : 'Get many contacts' ,
2020-07-12 09:12:32 -07:00
} ,
{
name : 'Update' ,
value : 'update' ,
description : 'Update a contact' ,
2022-07-10 13:50:51 -07:00
action : 'Update a contact' ,
2020-07-12 09:12:32 -07:00
} ,
] ,
default : 'create' ,
} ,
2021-12-03 00:44:16 -08:00
] ;
2020-07-12 09:12:32 -07:00
2021-12-03 00:44:16 -08:00
export const contactFields : INodeProperties [ ] = [
2022-03-27 01:38:49 -07:00
/* -------------------------------------------------------------------------- */
/* contact:create */
/* -------------------------------------------------------------------------- */
2020-07-12 09:12:32 -07:00
{
2022-06-03 10:23:49 -07:00
displayName : 'Organization Name or ID' ,
2020-07-12 09:12:32 -07:00
name : 'organizationId' ,
type : 'options' ,
2022-08-17 08:50:24 -07:00
description :
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>' ,
2020-07-12 09:12:32 -07:00
typeOptions : {
loadOptionsMethod : 'getTenants' ,
} ,
default : '' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'contact' ] ,
operation : [ 'create' ] ,
2020-07-12 09:12:32 -07:00
} ,
} ,
required : true ,
} ,
{
displayName : 'Name' ,
name : 'name' ,
type : 'string' ,
default : '' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'contact' ] ,
operation : [ 'create' ] ,
2020-07-12 09:12:32 -07:00
} ,
} ,
description : 'Full name of contact/organisation' ,
required : true ,
} ,
{
displayName : 'Additional Fields' ,
name : 'additionalFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
default : { } ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'contact' ] ,
operation : [ 'create' ] ,
2020-07-12 09:12:32 -07:00
} ,
} ,
options : [
{
displayName : 'Account Number' ,
name : 'accountNumber' ,
type : 'string' ,
default : '' ,
description : 'A user defined account number' ,
} ,
2022-03-27 01:38:49 -07:00
{
displayName : 'Addresses' ,
name : 'addressesUi' ,
type : 'fixedCollection' ,
typeOptions : {
multipleValues : true ,
} ,
2022-04-22 09:29:51 -07:00
default : { } ,
2022-03-27 01:38:49 -07:00
placeholder : 'Add Address' ,
options : [
{
name : 'addressesValues' ,
displayName : 'Address' ,
values : [
{
displayName : 'Type' ,
name : 'type' ,
type : 'options' ,
options : [
{
name : 'PO Box' ,
value : 'POBOX' ,
} ,
{
name : 'Street' ,
value : 'STREET' ,
} ,
] ,
default : '' ,
} ,
{
displayName : 'Line 1' ,
name : 'line1' ,
type : 'string' ,
default : '' ,
} ,
{
displayName : 'Line 2' ,
name : 'line2' ,
type : 'string' ,
default : '' ,
} ,
{
displayName : 'City' ,
name : 'city' ,
type : 'string' ,
default : '' ,
} ,
{
displayName : 'Region' ,
name : 'region' ,
type : 'string' ,
default : '' ,
} ,
{
displayName : 'Postal Code' ,
name : 'postalCode' ,
type : 'string' ,
default : '' ,
} ,
{
displayName : 'Country' ,
name : 'country' ,
type : 'string' ,
default : '' ,
} ,
{
displayName : 'Attention To' ,
name : 'attentionTo' ,
type : 'string' ,
default : '' ,
} ,
] ,
} ,
] ,
} ,
2020-07-12 09:12:32 -07:00
{
displayName : 'Bank Account Details' ,
name : 'bankAccountDetails' ,
type : 'string' ,
default : '' ,
description : 'Bank account number of contact' ,
} ,
{
displayName : 'Contact Number' ,
name : 'contactNumber' ,
type : 'string' ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
'This field is read only on the Xero contact screen, used to identify contacts in external systems' ,
2020-07-12 09:12:32 -07:00
} ,
{
displayName : 'Contact Status' ,
name : 'contactStatus' ,
type : 'options' ,
options : [
{
name : 'Active' ,
value : 'ACTIVE' ,
description : 'The Contact is active and can be used in transactions' ,
} ,
{
name : 'Archived' ,
value : 'ARCHIVED' ,
description : 'The Contact is archived and can no longer be used in transactions' ,
} ,
{
name : 'GDPR Request' ,
value : 'GDPRREQUEST' ,
description : 'The Contact is the subject of a GDPR erasure request' ,
} ,
] ,
default : '' ,
description : 'Current status of a contact - see contact status types' ,
} ,
{
displayName : 'Default Currency' ,
name : 'defaultCurrency' ,
type : 'string' ,
default : '' ,
description : 'Default currency for raising invoices against contact' ,
} ,
{
displayName : 'Email' ,
name : 'emailAddress' ,
type : 'string' ,
default : '' ,
description : 'Email address of contact person (umlauts not supported) (max length = 255)' ,
} ,
{
displayName : 'First Name' ,
name : 'firstName' ,
type : 'string' ,
default : '' ,
description : 'First name of contact person (max length = 255)' ,
} ,
{
displayName : 'Last Name' ,
name : 'lastName' ,
type : 'string' ,
default : '' ,
description : 'Last name of contact person (max length = 255)' ,
} ,
2022-03-27 01:38:49 -07:00
{
displayName : 'Phones' ,
name : 'phonesUi' ,
type : 'fixedCollection' ,
typeOptions : {
multipleValues : true ,
} ,
2022-04-22 09:29:51 -07:00
default : { } ,
2022-03-27 01:38:49 -07:00
placeholder : 'Add Phone' ,
options : [
{
name : 'phonesValues' ,
displayName : 'Phones' ,
values : [
{
displayName : 'Type' ,
name : 'phoneType' ,
type : 'options' ,
options : [
{
name : 'Default' ,
value : 'DEFAULT' ,
} ,
{
name : 'DDI' ,
value : 'DDI' ,
} ,
{
name : 'Mobile' ,
value : 'MOBILE' ,
} ,
{
name : 'Fax' ,
value : 'FAX' ,
} ,
] ,
default : '' ,
} ,
{
displayName : 'Number' ,
name : 'phoneNumber' ,
type : 'string' ,
default : '' ,
} ,
{
displayName : 'Area Code' ,
name : 'phoneAreaCode' ,
type : 'string' ,
default : '' ,
} ,
{
displayName : 'Country Code' ,
name : 'phoneCountryCode' ,
type : 'string' ,
default : '' ,
} ,
] ,
} ,
] ,
} ,
2020-07-12 09:12:32 -07:00
{
2022-06-03 10:23:49 -07:00
displayName : 'Purchase Default Account Code Name or ID' ,
2020-07-12 09:12:32 -07:00
name : 'purchasesDefaultAccountCode' ,
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'getAccountCodes' ,
} ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
'The default purchases account code for contacts. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2020-07-12 09:12:32 -07:00
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Sales Default Account Code Name or ID' ,
2020-07-12 09:12:32 -07:00
name : 'salesDefaultAccountCode' ,
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'getAccountCodes' ,
} ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
'The default sales account code for contacts. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2020-07-12 09:12:32 -07:00
} ,
{
displayName : 'Skype' ,
name : 'skypeUserName' ,
type : 'string' ,
default : '' ,
description : 'Skype user name of contact' ,
} ,
{
displayName : 'Tax Number' ,
name : 'taxNumber' ,
type : 'string' ,
default : '' ,
description : 'Tax number of contact' ,
} ,
{
displayName : 'Xero Network Key' ,
name : 'xeroNetworkKey' ,
type : 'string' ,
default : '' ,
description : 'Store XeroNetworkKey for contacts' ,
} ,
] ,
} ,
2022-03-27 01:38:49 -07:00
/* -------------------------------------------------------------------------- */
/* contact:get */
/* -------------------------------------------------------------------------- */
2020-07-12 09:12:32 -07:00
{
2022-06-03 10:23:49 -07:00
displayName : 'Organization Name or ID' ,
2020-07-12 09:12:32 -07:00
name : 'organizationId' ,
type : 'options' ,
2022-08-17 08:50:24 -07:00
description :
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>' ,
2020-07-12 09:12:32 -07:00
typeOptions : {
loadOptionsMethod : 'getTenants' ,
} ,
default : '' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'contact' ] ,
operation : [ 'get' ] ,
2020-07-12 09:12:32 -07:00
} ,
} ,
required : true ,
} ,
{
displayName : 'Contact ID' ,
name : 'contactId' ,
type : 'string' ,
default : '' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'contact' ] ,
operation : [ 'get' ] ,
2020-07-12 09:12:32 -07:00
} ,
} ,
required : true ,
} ,
2022-03-27 01:38:49 -07:00
/* -------------------------------------------------------------------------- */
/* contact:getAll */
/* -------------------------------------------------------------------------- */
2020-07-12 09:12:32 -07:00
{
2022-06-03 10:23:49 -07:00
displayName : 'Organization Name or ID' ,
2020-07-12 09:12:32 -07:00
name : 'organizationId' ,
type : 'options' ,
2022-08-17 08:50:24 -07:00
description :
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>' ,
2020-07-12 09:12:32 -07:00
typeOptions : {
loadOptionsMethod : 'getTenants' ,
} ,
default : '' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'contact' ] ,
operation : [ 'getAll' ] ,
2020-07-12 09:12:32 -07:00
} ,
} ,
required : true ,
} ,
{
displayName : 'Return All' ,
name : 'returnAll' ,
type : 'boolean' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'contact' ] ,
operation : [ 'getAll' ] ,
2020-07-12 09:12:32 -07:00
} ,
} ,
default : false ,
2022-05-06 14:01:25 -07:00
description : 'Whether to return all results or only up to a given limit' ,
2020-07-12 09:12:32 -07:00
} ,
{
displayName : 'Limit' ,
name : 'limit' ,
type : 'number' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'contact' ] ,
operation : [ 'getAll' ] ,
returnAll : [ false ] ,
2020-07-12 09:12:32 -07:00
} ,
} ,
typeOptions : {
minValue : 1 ,
maxValue : 100 ,
} ,
default : 100 ,
2022-05-06 14:01:25 -07:00
description : 'Max number of results to return' ,
2020-07-12 09:12:32 -07:00
} ,
{
displayName : 'Options' ,
name : 'options' ,
type : 'collection' ,
placeholder : 'Add Option' ,
default : { } ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'contact' ] ,
operation : [ 'getAll' ] ,
2020-07-12 09:12:32 -07:00
} ,
} ,
options : [
{
displayName : 'Include Archived' ,
name : 'includeArchived' ,
type : 'boolean' ,
default : false ,
2022-06-20 07:54:01 -07:00
description : 'Whether contacts with a status of ARCHIVED will be included in the response' ,
2020-07-12 09:12:32 -07:00
} ,
{
displayName : 'Order By' ,
name : 'orderBy' ,
type : 'string' ,
placeholder : 'contactID' ,
default : '' ,
description : 'Order by any element returned' ,
} ,
{
displayName : 'Sort Order' ,
name : 'sortOrder' ,
type : 'options' ,
options : [
{
name : 'Asc' ,
value : 'ASC' ,
} ,
{
name : 'Desc' ,
value : 'DESC' ,
} ,
] ,
default : '' ,
} ,
{
displayName : 'Where' ,
name : 'where' ,
type : 'string' ,
typeOptions : {
alwaysOpenEditWindow : true ,
} ,
placeholder : 'EmailAddress!=null&&EmailAddress.StartsWith("boom")' ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
'The where parameter allows you to filter on endpoints and elements that don\'t have explicit parameters. <a href="https://developer.xero.com/documentation/api/requests-and-responses#get-modified">Examples Here</a>.' ,
2020-07-12 09:12:32 -07:00
} ,
] ,
} ,
2022-03-27 01:38:49 -07:00
/* -------------------------------------------------------------------------- */
/* contact:update */
/* -------------------------------------------------------------------------- */
2020-07-12 09:12:32 -07:00
{
2022-06-03 10:23:49 -07:00
displayName : 'Organization Name or ID' ,
2020-07-12 09:12:32 -07:00
name : 'organizationId' ,
type : 'options' ,
2022-08-17 08:50:24 -07:00
description :
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>' ,
2020-07-12 09:12:32 -07:00
typeOptions : {
loadOptionsMethod : 'getTenants' ,
} ,
default : '' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'contact' ] ,
operation : [ 'update' ] ,
2020-07-12 09:12:32 -07:00
} ,
} ,
required : true ,
} ,
{
displayName : 'Contact ID' ,
name : 'contactId' ,
type : 'string' ,
default : '' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'contact' ] ,
operation : [ 'update' ] ,
2020-07-12 09:12:32 -07:00
} ,
} ,
required : true ,
} ,
{
displayName : 'Update Fields' ,
name : 'updateFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
default : { } ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'contact' ] ,
operation : [ 'update' ] ,
2020-07-12 09:12:32 -07:00
} ,
} ,
options : [
{
displayName : 'Account Number' ,
name : 'accountNumber' ,
type : 'string' ,
default : '' ,
description : 'A user defined account number' ,
} ,
2022-03-27 01:38:49 -07:00
{
displayName : 'Addresses' ,
name : 'addressesUi' ,
type : 'fixedCollection' ,
typeOptions : {
multipleValues : true ,
} ,
2022-04-22 09:29:51 -07:00
default : { } ,
2022-03-27 01:38:49 -07:00
placeholder : 'Add Address' ,
options : [
{
name : 'addressesValues' ,
displayName : 'Address' ,
values : [
{
displayName : 'Type' ,
name : 'type' ,
type : 'options' ,
options : [
{
name : 'PO Box' ,
value : 'POBOX' ,
} ,
{
name : 'Street' ,
value : 'STREET' ,
} ,
] ,
default : '' ,
} ,
{
displayName : 'Line 1' ,
name : 'line1' ,
type : 'string' ,
default : '' ,
} ,
{
displayName : 'Line 2' ,
name : 'line2' ,
type : 'string' ,
default : '' ,
} ,
{
displayName : 'City' ,
name : 'city' ,
type : 'string' ,
default : '' ,
} ,
{
displayName : 'Region' ,
name : 'region' ,
type : 'string' ,
default : '' ,
} ,
{
displayName : 'Postal Code' ,
name : 'postalCode' ,
type : 'string' ,
default : '' ,
} ,
{
displayName : 'Country' ,
name : 'country' ,
type : 'string' ,
default : '' ,
} ,
{
displayName : 'Attention To' ,
name : 'attentionTo' ,
type : 'string' ,
default : '' ,
} ,
] ,
} ,
] ,
} ,
2020-07-12 09:12:32 -07:00
{
displayName : 'Bank Account Details' ,
name : 'bankAccountDetails' ,
type : 'string' ,
default : '' ,
description : 'Bank account number of contact' ,
} ,
{
displayName : 'Contact Number' ,
name : 'contactNumber' ,
type : 'string' ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
'This field is read only on the Xero contact screen, used to identify contacts in external systems' ,
2020-07-12 09:12:32 -07:00
} ,
{
displayName : 'Contact Status' ,
name : 'contactStatus' ,
type : 'options' ,
options : [
{
name : 'Active' ,
value : 'ACTIVE' ,
description : 'The Contact is active and can be used in transactions' ,
} ,
{
name : 'Archived' ,
value : 'ARCHIVED' ,
description : 'The Contact is archived and can no longer be used in transactions' ,
} ,
{
name : 'GDPR Request' ,
value : 'GDPRREQUEST' ,
description : 'The Contact is the subject of a GDPR erasure request' ,
} ,
] ,
default : '' ,
description : 'Current status of a contact - see contact status types' ,
} ,
{
displayName : 'Default Currency' ,
name : 'defaultCurrency' ,
type : 'string' ,
default : '' ,
description : 'Default currency for raising invoices against contact' ,
} ,
{
displayName : 'Email' ,
name : 'emailAddress' ,
type : 'string' ,
default : '' ,
description : 'Email address of contact person (umlauts not supported) (max length = 255)' ,
} ,
{
displayName : 'First Name' ,
name : 'firstName' ,
type : 'string' ,
default : '' ,
description : 'First name of contact person (max length = 255)' ,
} ,
{
displayName : 'Last Name' ,
name : 'lastName' ,
type : 'string' ,
default : '' ,
description : 'Last name of contact person (max length = 255)' ,
} ,
{
displayName : 'Name' ,
name : 'name' ,
type : 'string' ,
default : '' ,
description : 'Full name of contact/organisation' ,
} ,
2022-03-27 01:38:49 -07:00
{
displayName : 'Phones' ,
name : 'phonesUi' ,
type : 'fixedCollection' ,
typeOptions : {
multipleValues : true ,
} ,
2022-04-22 09:29:51 -07:00
default : { } ,
2022-03-27 01:38:49 -07:00
placeholder : 'Add Phone' ,
options : [
{
name : 'phonesValues' ,
displayName : 'Phones' ,
values : [
{
displayName : 'Type' ,
name : 'phoneType' ,
type : 'options' ,
options : [
{
name : 'Default' ,
value : 'DEFAULT' ,
} ,
{
name : 'DDI' ,
value : 'DDI' ,
} ,
{
name : 'Mobile' ,
value : 'MOBILE' ,
} ,
{
name : 'Fax' ,
value : 'FAX' ,
} ,
] ,
default : '' ,
} ,
{
displayName : 'Number' ,
name : 'phoneNumber' ,
type : 'string' ,
default : '' ,
} ,
{
displayName : 'Area Code' ,
name : 'phoneAreaCode' ,
type : 'string' ,
default : '' ,
} ,
{
displayName : 'Country Code' ,
name : 'phoneCountryCode' ,
type : 'string' ,
default : '' ,
} ,
] ,
} ,
] ,
} ,
2020-07-12 09:12:32 -07:00
{
2022-06-03 10:23:49 -07:00
displayName : 'Purchase Default Account Code Name or ID' ,
2020-07-12 09:12:32 -07:00
name : 'purchasesDefaultAccountCode' ,
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'getAccountCodes' ,
} ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
'The default purchases account code for contacts. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2020-07-12 09:12:32 -07:00
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Sales Default Account Code Name or ID' ,
2020-07-12 09:12:32 -07:00
name : 'salesDefaultAccountCode' ,
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'getAccountCodes' ,
} ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
'The default sales account code for contacts. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2020-07-12 09:12:32 -07:00
} ,
{
displayName : 'Skype' ,
name : 'skypeUserName' ,
type : 'string' ,
default : '' ,
description : 'Skype user name of contact' ,
} ,
{
displayName : 'Tax Number' ,
name : 'taxNumber' ,
type : 'string' ,
default : '' ,
description : 'Tax number of contact' ,
} ,
{
displayName : 'Xero Network Key' ,
name : 'xeroNetworkKey' ,
type : 'string' ,
default : '' ,
description : 'Store XeroNetworkKey for contacts' ,
} ,
] ,
} ,
2021-12-03 00:44:16 -08:00
] ;