@adkit/cli 1.13.30 → 1.13.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +23 -14
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1576,25 +1576,26 @@ async function listMetaConversions(client, _args, flags) {
|
|
|
1576
1576
|
const qs = queryString({ accountId, limit, offset, raw });
|
|
1577
1577
|
return client.get(`/manage/meta/conversions${qs}`);
|
|
1578
1578
|
}
|
|
1579
|
-
function buildCampaignPayload(flags) {
|
|
1579
|
+
function buildCampaignPayload(flags, { defaultCbo }) {
|
|
1580
1580
|
const payload = {};
|
|
1581
1581
|
if (typeof flags.name === "string") payload.name = flags.name;
|
|
1582
1582
|
if (typeof flags.objective === "string") payload.objective = flags.objective;
|
|
1583
1583
|
if (typeof flags.status === "string") payload.status = flags.status;
|
|
1584
1584
|
if (typeof flags["bid-strategy"] === "string") payload.bidStrategy = flags["bid-strategy"];
|
|
1585
1585
|
if (flags.abo === true) payload.advantageCampaignBudget = false;
|
|
1586
|
-
else payload.advantageCampaignBudget = true;
|
|
1586
|
+
else if (defaultCbo) payload.advantageCampaignBudget = true;
|
|
1587
1587
|
if (typeof flags["budget-daily"] === "string") payload.budget = { daily: parseFloat(flags["budget-daily"]) };
|
|
1588
1588
|
if (typeof flags["budget-total"] === "string") payload.budget = { ...payload.budget, lifetime: parseFloat(flags["budget-total"]) };
|
|
1589
1589
|
if (typeof flags["platform-overrides"] === "string") payload.platformOverrides = parseJsonObject(flags["platform-overrides"], "platform-overrides");
|
|
1590
1590
|
return payload;
|
|
1591
1591
|
}
|
|
1592
1592
|
async function listMetaCampaigns(client, _args, flags) {
|
|
1593
|
-
validateFlags(flags, ["account", "status", "raw"], "manage meta campaigns list");
|
|
1593
|
+
validateFlags(flags, ["account", "status", "limit", "raw"], "manage meta campaigns list");
|
|
1594
1594
|
const accountId = typeof flags.account === "string" ? flags.account : void 0;
|
|
1595
1595
|
const status2 = typeof flags.status === "string" ? flags.status : void 0;
|
|
1596
|
+
const limit = typeof flags.limit === "string" ? flags.limit : void 0;
|
|
1596
1597
|
const raw = flags.raw === true ? "true" : void 0;
|
|
1597
|
-
const qs = queryString({ accountId, status: status2, raw });
|
|
1598
|
+
const qs = queryString({ accountId, status: status2, limit, raw });
|
|
1598
1599
|
return client.get(`/manage/meta/campaigns${qs}`);
|
|
1599
1600
|
}
|
|
1600
1601
|
var CAMPAIGN_FLAGS = ["name", "objective", "status", "budget-daily", "budget-total", "abo", "bid-strategy"];
|
|
@@ -1612,7 +1613,7 @@ async function createCampaign(client, _args, flags) {
|
|
|
1612
1613
|
return client.post(`/manage/meta/campaigns${publish2}`, body2);
|
|
1613
1614
|
}
|
|
1614
1615
|
validateFlags(flags, CAMPAIGN_FLAGS, "manage meta campaigns create");
|
|
1615
|
-
const payload = buildCampaignPayload(flags);
|
|
1616
|
+
const payload = buildCampaignPayload(flags, { defaultCbo: true });
|
|
1616
1617
|
if (!payload.name) payload.name = generateCampaignName();
|
|
1617
1618
|
const body = { campaigns: [payload] };
|
|
1618
1619
|
mergeAccountId(body, flags);
|
|
@@ -1621,15 +1622,16 @@ async function createCampaign(client, _args, flags) {
|
|
|
1621
1622
|
}
|
|
1622
1623
|
async function updateCampaign(client, args, flags) {
|
|
1623
1624
|
const id = requireArg(args, 0, "campaign-id", `Run: adkit manage meta campaigns update <campaign-id> --status paused`);
|
|
1625
|
+
const publish = flags.publish === true ? "?publish=true" : "";
|
|
1624
1626
|
if (typeof flags.data === "string") {
|
|
1625
1627
|
const body = parseDataFlag(flags, "Check JSON syntax in --data");
|
|
1626
1628
|
mergeAccountId(body, flags);
|
|
1627
|
-
return client.patch(`/manage/meta/campaigns/${id}`, body);
|
|
1629
|
+
return client.patch(`/manage/meta/campaigns/${id}${publish}`, body);
|
|
1628
1630
|
}
|
|
1629
1631
|
validateFlags(flags, CAMPAIGN_FLAGS, "manage meta campaigns update");
|
|
1630
|
-
const payload = buildCampaignPayload(flags);
|
|
1632
|
+
const payload = buildCampaignPayload(flags, { defaultCbo: false });
|
|
1631
1633
|
mergeAccountId(payload, flags);
|
|
1632
|
-
return client.patch(`/manage/meta/campaigns/${id}`, payload);
|
|
1634
|
+
return client.patch(`/manage/meta/campaigns/${id}${publish}`, payload);
|
|
1633
1635
|
}
|
|
1634
1636
|
async function deleteCampaign(client, args, flags) {
|
|
1635
1637
|
const id = requireArg(args, 0, "campaign-id", "Run: adkit manage meta campaigns delete <campaign-id>");
|
|
@@ -1702,15 +1704,16 @@ async function createAdSet(client, _args, flags) {
|
|
|
1702
1704
|
}
|
|
1703
1705
|
async function updateAdSet(client, args, flags) {
|
|
1704
1706
|
const id = requireArg(args, 0, "adset-id", `Run: adkit manage meta adsets update <adset-id> --budget-daily 50`);
|
|
1707
|
+
const publish = flags.publish === true ? "?publish=true" : "";
|
|
1705
1708
|
if (typeof flags.data === "string") {
|
|
1706
1709
|
const body = parseDataFlag(flags, "Check JSON syntax in --data");
|
|
1707
1710
|
mergeAccountId(body, flags);
|
|
1708
|
-
return client.patch(`/manage/meta/adsets/${id}`, body);
|
|
1711
|
+
return client.patch(`/manage/meta/adsets/${id}${publish}`, body);
|
|
1709
1712
|
}
|
|
1710
1713
|
validateFlags(flags, ADSET_FLAGS, "manage meta adsets update");
|
|
1711
1714
|
const payload = buildAdSetPayload(flags);
|
|
1712
1715
|
mergeAccountId(payload, flags);
|
|
1713
|
-
return client.patch(`/manage/meta/adsets/${id}`, payload);
|
|
1716
|
+
return client.patch(`/manage/meta/adsets/${id}${publish}`, payload);
|
|
1714
1717
|
}
|
|
1715
1718
|
async function deleteAdSet(client, args, flags) {
|
|
1716
1719
|
const id = requireArg(args, 0, "adset-id", "Run: adkit manage meta adsets delete <adset-id>");
|
|
@@ -1873,7 +1876,8 @@ async function updateAd(client, args, flags) {
|
|
|
1873
1876
|
const id = requireArg(args, 0, "ad-id", `Run: adkit manage meta ads update <ad-id> --data '{"status":"paused"}'`);
|
|
1874
1877
|
const body = parseDataFlag(flags, "Check JSON syntax in --data");
|
|
1875
1878
|
mergeAccountId(body, flags);
|
|
1876
|
-
|
|
1879
|
+
const publish = flags.publish === true ? "?publish=true" : "";
|
|
1880
|
+
return client.patch(`/manage/meta/ads/${id}${publish}`, body);
|
|
1877
1881
|
}
|
|
1878
1882
|
async function deleteAd(client, args, flags) {
|
|
1879
1883
|
const id = requireArg(args, 0, "ad-id", "Run: adkit manage meta ads delete <ad-id>");
|
|
@@ -1927,15 +1931,16 @@ async function createCreative(client, _args, flags) {
|
|
|
1927
1931
|
}
|
|
1928
1932
|
async function updateCreative(client, args, flags) {
|
|
1929
1933
|
const id = requireArg(args, 0, "creative-id", `Run: adkit manage meta creatives update <creative-id> --primary-text "Start free trial"`);
|
|
1934
|
+
const publish = flags.publish === true ? "?publish=true" : "";
|
|
1930
1935
|
if (typeof flags.data === "string") {
|
|
1931
1936
|
const body = parseDataFlag(flags, "Check JSON syntax in --data");
|
|
1932
1937
|
mergeAccountId(body, flags);
|
|
1933
|
-
return client.patch(`/manage/meta/creatives/${id}`, body);
|
|
1938
|
+
return client.patch(`/manage/meta/creatives/${id}${publish}`, body);
|
|
1934
1939
|
}
|
|
1935
1940
|
validateFlags(flags, CREATIVE_FLAGS, "manage meta creatives update");
|
|
1936
1941
|
const payload = buildCreativePayload(flags);
|
|
1937
1942
|
mergeAccountId(payload, flags);
|
|
1938
|
-
return client.patch(`/manage/meta/creatives/${id}`, payload);
|
|
1943
|
+
return client.patch(`/manage/meta/creatives/${id}${publish}`, payload);
|
|
1939
1944
|
}
|
|
1940
1945
|
async function deleteCreative(client, args, flags) {
|
|
1941
1946
|
const id = requireArg(args, 0, "creative-id", "Run: adkit manage meta creatives delete <creative-id>");
|
|
@@ -5180,6 +5185,7 @@ ${FLAG.budgetDaily}
|
|
|
5180
5185
|
Flags (list):
|
|
5181
5186
|
${FLAG.account}
|
|
5182
5187
|
--status <s> Filter by effective status (default: active,paused,in_process,with_issues; use "all" for every status)
|
|
5188
|
+
--limit <n> Maximum campaigns to return
|
|
5183
5189
|
|
|
5184
5190
|
Flags (list/get):
|
|
5185
5191
|
--raw Return raw Meta API response (no conversion)
|
|
@@ -5215,6 +5221,7 @@ ${FLAG.budgetDaily}
|
|
|
5215
5221
|
Flags (list):
|
|
5216
5222
|
${FLAG.account}
|
|
5217
5223
|
--status <s> Filter by effective status (default: active,paused,in_process,with_issues; use "all" for every status)
|
|
5224
|
+
--limit <n> Maximum campaigns to return
|
|
5218
5225
|
|
|
5219
5226
|
Flags (list/get):
|
|
5220
5227
|
--raw Return raw Meta API response (no conversion)
|
|
@@ -5569,7 +5576,9 @@ Flags:
|
|
|
5569
5576
|
--adset-ids <ids> Comma-separated ad set IDs
|
|
5570
5577
|
--ad-ids <ids> Comma-separated ad IDs
|
|
5571
5578
|
--statuses <s> active, paused (filter by entity status)
|
|
5572
|
-
--period <range>
|
|
5579
|
+
--period <range> 3d, 7d, 14d, 28d, 30d, 90d, or a named preset (default: 30d)
|
|
5580
|
+
Named presets: today, yesterday, this_month, last_month, this_quarter, last_quarter, this_year, last_year, maximum
|
|
5581
|
+
Use --from/--to for any other date range.
|
|
5573
5582
|
--from <date> Start date, YYYY-MM-DD
|
|
5574
5583
|
--to <date> End date, YYYY-MM-DD
|
|
5575
5584
|
--fields <list> Normalized fields, e.g. spend, impressions, clicks, conversionEvents, etc
|
package/package.json
CHANGED