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
|
// contact:create
|
||||||
// ----------------------------------
|
// ----------------------------------
|
||||||
|
|
||||||
// https://docs.sendgrid.com/api-reference/contacts/add-or-update-a-contact
|
// https://docs.sendgrid.com/api-reference/contacts/add-or-update-a-contact
|
||||||
endpoint = '';
|
endpoint = '/marketing/contacts';
|
||||||
method = 'POST';
|
method = 'PUT';
|
||||||
const email = this.getNodeParameter('email', i) as string;
|
const email = this.getNodeParameter('email', i) as string;
|
||||||
additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
||||||
const data: IDataObject = { email };
|
const data: IDataObject = { email };
|
||||||
|
|
@ -151,11 +150,22 @@ export class FriendGrid implements INodeType {
|
||||||
body.contacts = [ data ];
|
body.contacts = [ data ];
|
||||||
break;
|
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;
|
break;
|
||||||
|
|
||||||
|
|
@ -165,20 +175,14 @@ export class FriendGrid implements INodeType {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'contractProducts':
|
case 'mail':
|
||||||
switch (operation) {
|
switch (operation) {
|
||||||
case 'createDirectInvoice':
|
case 'send':
|
||||||
// ----------------------------------
|
// ----------------------------------
|
||||||
// contractProducts:createDirectInvoice
|
// mail:send
|
||||||
// ----------------------------------
|
// ----------------------------------
|
||||||
|
endpoint = '/mail/send';
|
||||||
// .........
|
method = 'POST';
|
||||||
break;
|
|
||||||
case 'getDirectInvoice':
|
|
||||||
// ----------------------------------
|
|
||||||
// contractProducts:getDirectInvoice
|
|
||||||
// ----------------------------------
|
|
||||||
|
|
||||||
// .........
|
// .........
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,2 @@
|
||||||
// Generated by genversion.
|
// 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