Skip to content

Commit e680eef

Browse files
committed
Adjustments
1 parent b6e8582 commit e680eef

File tree

4 files changed

+25
-18
lines changed

4 files changed

+25
-18
lines changed

components/the_magic_drip/actions/list_campaigns/list_campaigns.mjs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ export default {
1010
app,
1111
},
1212
async run({ $ }) {
13-
const { campaigns } = await this.app.listCampaigns();
13+
const { campaigns } = await this.app.listCampaigns({
14+
$,
15+
});
1416
$.export("$summary", `Sucessfully retrieved ${campaigns?.length ?? 0} campaigns`);
1517
return campaigns;
1618
},

components/the_magic_drip/actions/list_templates/list_templates.mjs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ export default {
1010
app,
1111
},
1212
async run({ $ }) {
13-
const { templates } = await this.app.listTemplates();
13+
const { templates } = await this.app.listTemplates({
14+
$,
15+
});
1416
$.export("$summary", `Sucessfully retrieved ${templates?.length ?? 0} templates`);
1517
return templates;
1618
},

components/the_magic_drip/actions/mark_campaign_active_or_inactive/mark_campaign_active_or_inactive.mjs

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import app from "../../the_magic_drip.app.mjs";
22

33
export default {
44
key: "the_magic_drip-mark-campaign-active-inactive",
5-
name: "Mark Campaign Active/Inactive",
6-
description: "Marks a campaign as active or inactive. [See the documentation]()",
5+
name: "Mark Campaign Active or Inactive",
6+
description: "Marks a campaign as active or inactive. [See the documentation](https://docs.themagicdrip.com/api-reference/endpoint/post-v1campaign-active)",
77
version: "0.0.{{ts}}",
88
type: "action",
99
props: {
@@ -14,21 +14,25 @@ export default {
1414
"campaignId",
1515
],
1616
},
17-
desiredState: {
17+
activate: {
1818
type: "boolean",
19-
label: "Desired State",
20-
description: "Set to true to activate, false to deactivate the campaign",
19+
label: "Activate",
20+
description: "Set to `true` to activate, or `false` to deactivate the campaign",
2121
},
2222
},
2323
async run({ $ }) {
24+
const {
25+
campaignId, activate,
26+
} = this;
2427
const response = await this.app.markCampaignActiveInactive({
25-
campaignId: this.campaignId,
26-
desiredState: this.desiredState,
28+
$,
29+
campaignId,
30+
activate,
2731
});
2832

29-
$.export("$summary", `Marked campaign ${this.campaignId} as ${this.desiredState
30-
? "active"
31-
: "inactive"}.`);
33+
$.export("$summary", `Successfully ${activate
34+
? ""
35+
: "de"}activated campaign ${campaignId}`);
3236

3337
return response;
3438
},

components/the_magic_drip/the_magic_drip.app.mjs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,13 @@ export default {
7575
});
7676
},
7777
async markCampaignActiveInactive({
78-
campaignId, desiredState,
79-
}, opts = {}) {
80-
const path = desiredState
81-
? `/campaign/${campaignId}/active`
82-
: `/campaign/${campaignId}/inactive`;
78+
campaignId, activate, ...opts
79+
}) {
8380
return this._makeRequest({
8481
method: "POST",
85-
path,
82+
path: `/campaign/${campaignId}/${activate
83+
? "active"
84+
: "inactive"}`,
8685
...opts,
8786
});
8887
},

0 commit comments

Comments
 (0)