mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-25 04:34:06 -08:00
🚧 Add Get and Delete operation
This commit is contained in:
parent
016102a647
commit
49914559f5
|
@ -113,6 +113,10 @@ export class Mailchimp implements INodeType {
|
|||
name: 'resource',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'Campaign',
|
||||
value: 'campaign'
|
||||
},
|
||||
{
|
||||
name: 'List Group',
|
||||
value: 'listGroup',
|
||||
|
@ -125,10 +129,6 @@ export class Mailchimp implements INodeType {
|
|||
name: 'Member Tag',
|
||||
value: 'memberTag',
|
||||
},
|
||||
{
|
||||
name: 'Campaign',
|
||||
value: 'campaign'
|
||||
}
|
||||
],
|
||||
default: 'member',
|
||||
required: true,
|
||||
|
@ -239,6 +239,16 @@ export class Mailchimp implements INodeType {
|
|||
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Delete',
|
||||
value: 'delete',
|
||||
description: 'Delete a campaign'
|
||||
},
|
||||
{
|
||||
name: 'Get',
|
||||
value: 'get',
|
||||
description: 'Get a campaign'
|
||||
},
|
||||
{
|
||||
name: 'Get All',
|
||||
value: 'getAll',
|
||||
|
@ -1688,7 +1698,9 @@ export class Mailchimp implements INodeType {
|
|||
'campaign'
|
||||
],
|
||||
operation: [
|
||||
'send'
|
||||
'send',
|
||||
'get',
|
||||
'delete'
|
||||
]
|
||||
}
|
||||
},
|
||||
|
@ -1697,11 +1709,6 @@ export class Mailchimp implements INodeType {
|
|||
description: 'List of Campaigns',
|
||||
options:[],
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* campaign:create */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
],
|
||||
};
|
||||
|
||||
|
@ -2145,6 +2152,19 @@ export class Mailchimp implements INodeType {
|
|||
const campaignId = this.getNodeParameter('campaignId', i) as string;
|
||||
responseData = await mailchimpApiRequest.call(this, `/campaigns/${campaignId}/actions/send`, 'POST', {})
|
||||
}
|
||||
if (operation === 'get') {
|
||||
const campaignId = this.getNodeParameter('campaignId', i) as string;
|
||||
if(!campaignId){
|
||||
// TODO
|
||||
// Display error message.
|
||||
throw new Error("Campaign ID is required");
|
||||
}
|
||||
responseData = await mailchimpApiRequest.call(this, `/campaigns/${campaignId}`, 'GET', {})
|
||||
}
|
||||
if (operation === 'delete') {
|
||||
const campaignId = this.getNodeParameter('campaignId', i) as string;
|
||||
responseData = await mailchimpApiRequest.call(this, `/campaigns/${campaignId}`, 'Delete', {})
|
||||
}
|
||||
}
|
||||
|
||||
if (Array.isArray(responseData)) {
|
||||
|
|
Loading…
Reference in a new issue