mirror of
https://github.com/n8n-io/n8n-nodes-starter.git
synced 2025-10-30 06:42:25 -05:00
Refactor switch statement
This commit is contained in:
parent
a11487479a
commit
9573fe070d
2 changed files with 21 additions and 17 deletions
|
|
@ -140,10 +140,9 @@ export class FriendGrid implements INodeType {
|
|||
// ----------------------------------
|
||||
// contact:create
|
||||
// ----------------------------------
|
||||
|
||||
// https://docs.sendgrid.com/api-reference/contacts/add-or-update-a-contact
|
||||
endpoint = '';
|
||||
method = 'POST';
|
||||
endpoint = '/marketing/contacts';
|
||||
method = 'PUT';
|
||||
const email = this.getNodeParameter('email', i) as string;
|
||||
additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
||||
const data: IDataObject = { email };
|
||||
|
|
@ -151,11 +150,22 @@ export class FriendGrid implements INodeType {
|
|||
body.contacts = [ data ];
|
||||
break;
|
||||
|
||||
case 'directContractInsert':
|
||||
case 'get':
|
||||
// ----------------------------------
|
||||
// contract:directContractInsert
|
||||
// contact:get
|
||||
// ----------------------------------
|
||||
const contactId = this.getNodeParameter('contactId', i) as string;
|
||||
endpoint = `/marketing/contacts/${contactId}`;
|
||||
method = 'GET';
|
||||
// .........
|
||||
break;
|
||||
|
||||
case 'getAll':
|
||||
// ----------------------------------
|
||||
// contact:getAll
|
||||
// ----------------------------------
|
||||
endpoint = '/marketing/contacts';
|
||||
method = 'GET';
|
||||
// .........
|
||||
break;
|
||||
|
||||
|
|
@ -165,20 +175,14 @@ export class FriendGrid implements INodeType {
|
|||
}
|
||||
break;
|
||||
|
||||
case 'contractProducts':
|
||||
case 'mail':
|
||||
switch (operation) {
|
||||
case 'createDirectInvoice':
|
||||
case 'send':
|
||||
// ----------------------------------
|
||||
// contractProducts:createDirectInvoice
|
||||
// mail:send
|
||||
// ----------------------------------
|
||||
|
||||
// .........
|
||||
break;
|
||||
case 'getDirectInvoice':
|
||||
// ----------------------------------
|
||||
// contractProducts:getDirectInvoice
|
||||
// ----------------------------------
|
||||
|
||||
endpoint = '/mail/send';
|
||||
method = 'POST';
|
||||
// .........
|
||||
break;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
// Generated by genversion.
|
||||
export const version = '0.1.1';
|
||||
export const version = '0.1.0';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue