@adkit/cli 1.12.1 → 1.12.4
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 +47 -7
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// ../shared/dist/utils/service-status.js
|
|
4
|
-
var ADKIT_STATUS_NOTICE =
|
|
4
|
+
var ADKIT_STATUS_NOTICE = null;
|
|
5
5
|
function getAdKitStatusNotice() {
|
|
6
6
|
const statusNotice = ADKIT_STATUS_NOTICE?.trim();
|
|
7
7
|
return statusNotice ? `Active AdKit status notice: ${statusNotice}` : void 0;
|
|
@@ -2650,12 +2650,13 @@ function buildGoogleTargetingResearchQuery(args, flags, missingQueryHint) {
|
|
|
2650
2650
|
import { readFileSync as readFileSync3 } from "node:fs";
|
|
2651
2651
|
import { basename as basename2, extname as extname2, resolve as resolve2 } from "node:path";
|
|
2652
2652
|
var MEDIA_UPLOAD_FLAGS2 = ["file", "url", "base64", "adkit-media", "temporary-upload", "filename", "content-type", "name"];
|
|
2653
|
+
var MEDIA_LIST_FLAGS = ["video-id", "material-id", "displayable", "width", "height", "ratio", "limit", "offset"];
|
|
2653
2654
|
var CAMPAIGN_LIST_FLAGS2 = ["campaign-ids", "fields", "limit", "offset"];
|
|
2654
2655
|
var PLATFORM_OVERRIDE_FLAG = "platform-overrides";
|
|
2655
2656
|
var CAMPAIGN_CREATE_FLAGS = ["name", "objective", "status", "budget-daily", "budget-lifetime", PLATFORM_OVERRIDE_FLAG];
|
|
2656
2657
|
var CAMPAIGN_UPDATE_FLAGS = ["name", "status", "budget-daily", "budget-lifetime", PLATFORM_OVERRIDE_FLAG];
|
|
2657
2658
|
var AD_GROUP_LIST_FLAGS2 = ["campaign-ids", "fields", "limit", "offset"];
|
|
2658
|
-
var AD_GROUP_CREATE_FLAGS = ["campaign", "name", "status", "budget-daily", "budget-lifetime", "billing-event", "optimization", "schedule-start-time", "schedule-end-time", "schedule-type", "pacing", "bid-amount", "event-type", "pixel", "placement", PLATFORM_OVERRIDE_FLAG];
|
|
2659
|
+
var AD_GROUP_CREATE_FLAGS = ["campaign", "name", "status", "budget-daily", "budget-lifetime", "billing-event", "bid-strategy", "optimization", "schedule-start-time", "schedule-end-time", "schedule-type", "pacing", "bid-amount", "event-type", "pixel", "placement", PLATFORM_OVERRIDE_FLAG];
|
|
2659
2660
|
var AD_GROUP_UPDATE_FLAGS = ["name", "status", "budget-daily", "budget-lifetime", "billing-event", "optimization", "schedule-start-time", "schedule-end-time", "schedule-type", "pacing", "bid-amount", "event-type", "pixel", PLATFORM_OVERRIDE_FLAG];
|
|
2660
2661
|
var AD_LIST_FLAGS2 = ["ad-group-ids", "campaign-ids", "fields", "limit", "offset"];
|
|
2661
2662
|
var AD_CREATE_FLAGS = ["ad-group", "name", "status", "media-id", "ad-text", "url", "cta", "display-name", "identity-id", "identity-type", "tracking-pixel", PLATFORM_OVERRIDE_FLAG];
|
|
@@ -2808,6 +2809,7 @@ function buildTikTokAdGroupPayload(flags, mode) {
|
|
|
2808
2809
|
if (budget) payload.budget = budget;
|
|
2809
2810
|
if (typeof flags.status === "string") payload.status = flags.status;
|
|
2810
2811
|
if (typeof flags["billing-event"] === "string") payload.billingEvent = flags["billing-event"];
|
|
2812
|
+
if (mode === "create" && typeof flags["bid-strategy"] === "string") payload.bidStrategy = flags["bid-strategy"];
|
|
2811
2813
|
if (typeof flags.optimization === "string") payload.optimization = flags.optimization;
|
|
2812
2814
|
if (typeof flags["schedule-end-time"] === "string") payload.scheduleEndTime = flags["schedule-end-time"];
|
|
2813
2815
|
if (typeof flags["schedule-type"] === "string") payload.scheduleType = flags["schedule-type"];
|
|
@@ -2885,10 +2887,32 @@ async function uploadTikTokMedia(client, _args, flags) {
|
|
|
2885
2887
|
const body = mergeAccountId({ assets: [source] }, flags);
|
|
2886
2888
|
return client.post("/manage/tiktok/media", body);
|
|
2887
2889
|
}
|
|
2890
|
+
async function listTikTokMedia(client, _args, flags) {
|
|
2891
|
+
validateFlags(flags, MEDIA_LIST_FLAGS, "manage tiktok media list");
|
|
2892
|
+
const videoIds = readRepeatedFlagList(flags, "video-id");
|
|
2893
|
+
const materialIds = readRepeatedFlagList(flags, "material-id");
|
|
2894
|
+
const displayable = readBooleanQueryFlag(flags.displayable);
|
|
2895
|
+
const width = typeof flags.width === "string" ? flags.width : void 0;
|
|
2896
|
+
const height = typeof flags.height === "string" ? flags.height : void 0;
|
|
2897
|
+
const ratio = typeof flags.ratio === "string" ? flags.ratio : void 0;
|
|
2898
|
+
const limit = typeof flags.limit === "string" ? flags.limit : void 0;
|
|
2899
|
+
const offset = typeof flags.offset === "string" ? flags.offset : void 0;
|
|
2900
|
+
const accountId = typeof flags.account === "string" ? flags.account : void 0;
|
|
2901
|
+
const qs = queryString({ accountId, videoIds, materialIds, displayable, width, height, ratio, limit, offset });
|
|
2902
|
+
return client.get(`/manage/tiktok/media${qs}`);
|
|
2903
|
+
}
|
|
2888
2904
|
async function listTikTokCampaigns(client, _args, flags) {
|
|
2889
2905
|
validateFlags(flags, CAMPAIGN_LIST_FLAGS2, "manage tiktok campaigns list");
|
|
2890
2906
|
return client.get(`/manage/tiktok/campaigns${buildTikTokListQuery(flags)}`);
|
|
2891
2907
|
}
|
|
2908
|
+
function readRepeatedFlagList(flags, key) {
|
|
2909
|
+
const values = collectFlagValues(flags, key);
|
|
2910
|
+
return values.length ? values.join(",") : void 0;
|
|
2911
|
+
}
|
|
2912
|
+
function readBooleanQueryFlag(value) {
|
|
2913
|
+
if (value === true) return "true";
|
|
2914
|
+
return typeof value === "string" ? value : void 0;
|
|
2915
|
+
}
|
|
2892
2916
|
async function getTikTokCampaign(client, args, flags) {
|
|
2893
2917
|
validateFlags(flags, ["fields"], "manage tiktok campaigns <id>");
|
|
2894
2918
|
const id = requireArg(args, 0, "campaign-id", "Run: adkit manage tiktok campaigns <campaign-id>");
|
|
@@ -5168,11 +5192,20 @@ Examples:
|
|
|
5168
5192
|
adkit manage tiktok accounts available
|
|
5169
5193
|
adkit manage tiktok accounts connect 1234567890
|
|
5170
5194
|
adkit manage tiktok accounts disconnect 1234567890`.trim(),
|
|
5171
|
-
"tiktok media": `adkit manage tiktok media \u2014 Upload creative media
|
|
5195
|
+
"tiktok media": `adkit manage tiktok media \u2014 Upload creative media and list TikTok Asset Library videos
|
|
5172
5196
|
|
|
5197
|
+
list List/search existing TikTok Asset Library videos
|
|
5173
5198
|
upload Upload an image or video and return TikTok asset IDs
|
|
5174
5199
|
|
|
5175
5200
|
Flags:
|
|
5201
|
+
--video-id <id> Filter by reusable TikTok video ID (repeatable)
|
|
5202
|
+
--material-id <id> Filter by TikTok material ID (repeatable)
|
|
5203
|
+
--displayable Filter to displayable materials
|
|
5204
|
+
--width <px> Filter by video width
|
|
5205
|
+
--height <px> Filter by video height
|
|
5206
|
+
--ratio <values> Comma-separated aspect ratio values
|
|
5207
|
+
--limit <n> Page size
|
|
5208
|
+
--offset <n> Offset; must be a multiple of limit
|
|
5176
5209
|
--file <path> Local image/video file
|
|
5177
5210
|
--url <url> Public image/video URL
|
|
5178
5211
|
--base64 <data> Base64 image/video data
|
|
@@ -5185,6 +5218,8 @@ Flags:
|
|
|
5185
5218
|
--data <json> Batch body: {"assets":[...]}
|
|
5186
5219
|
|
|
5187
5220
|
Examples:
|
|
5221
|
+
adkit manage tiktok media list --limit 100 --account 1234567890
|
|
5222
|
+
adkit manage tiktok media list --video-id 746839470948302856 --account 1234567890
|
|
5188
5223
|
adkit manage tiktok media upload --file ./hero-video.mp4 --account 1234567890
|
|
5189
5224
|
adkit manage tiktok media upload --url https://example.com/hero.png --account 1234567890
|
|
5190
5225
|
adkit manage tiktok media upload --adkit-media media_123 --account 1234567890`.trim(),
|
|
@@ -5234,15 +5269,16 @@ ${FLAG.data}
|
|
|
5234
5269
|
--schedule-start-time <value> Required for create, e.g. "2026-05-15 12:00:00"
|
|
5235
5270
|
--schedule-end-time <value> Optional end time
|
|
5236
5271
|
--billing-event <s> cpc, cpm, ocpm
|
|
5272
|
+
--bid-strategy <s> bid_type_no_bid, bid_type_custom, bid_type_max_conversion
|
|
5237
5273
|
--optimization <s> click, convert, lead_generation, video_view, reach
|
|
5238
|
-
--bid-amount <n>
|
|
5274
|
+
--bid-amount <n> Custom bid in account currency; conversion/OCPM maps to cost per conversion
|
|
5239
5275
|
--event-type <s> purchase, add_to_cart, view_content, complete_registration, lead, submit_form
|
|
5240
5276
|
--pixel <id> Pixel ID; falls back to account default pixel when conversion is used
|
|
5241
5277
|
--placement <ids> Override TikTok placement IDs (publish default: PLACEMENT_TIKTOK)
|
|
5242
5278
|
|
|
5243
5279
|
Examples:
|
|
5244
5280
|
adkit manage tiktok ad-groups create --campaign 1770 --name "US Broad" --budget-daily 50 --schedule-start-time "2026-05-15 12:00:00" --billing-event cpc --optimization click
|
|
5245
|
-
adkit manage tiktok ad-groups create --data '{"adGroups":[{"campaignId":"1770","name":"Purchase","budget":{"daily":50},"scheduleStartTime":"2026-05-15 12:00:00","conversion":{"eventType":"purchase"},"targeting":{"geoLocations":{"include":[{"type":"country","
|
|
5281
|
+
adkit manage tiktok ad-groups create --data '{"adGroups":[{"campaignId":"1770","name":"Purchase","budget":{"daily":50},"scheduleStartTime":"2026-05-15 12:00:00","bidAmount":80,"conversion":{"eventType":"purchase"},"targeting":{"geoLocations":{"include":[{"type":"country","country":"US"}]}}}]}'`.trim(),
|
|
5246
5282
|
"tiktok ads": `adkit manage tiktok ads \u2014 TikTok video ads
|
|
5247
5283
|
|
|
5248
5284
|
list List ads
|
|
@@ -6446,7 +6482,7 @@ async function selfUpdate(currentVersion) {
|
|
|
6446
6482
|
async function main() {
|
|
6447
6483
|
const printUpdateNotice = startUpdateCheck(CLI_VERSION);
|
|
6448
6484
|
const { args, flags } = parseArgs(process.argv.slice(2), {
|
|
6449
|
-
multi: ["media", "media-format", "primary-text", "headline", "headline-1", "headline-2", "headline-3", "description", "description-1", "description-2", "link-description", "interest", "ref", "callout", "sitelink", "value", "text", "match-type"]
|
|
6485
|
+
multi: ["media", "media-format", "primary-text", "headline", "headline-1", "headline-2", "headline-3", "description", "description-1", "description-2", "link-description", "interest", "ref", "callout", "sitelink", "value", "text", "match-type", "video-id", "material-id"]
|
|
6450
6486
|
});
|
|
6451
6487
|
if (args.length === 0 || flags.help && args.length === 0) {
|
|
6452
6488
|
printHelp(USAGE);
|
|
@@ -7033,11 +7069,15 @@ async function main() {
|
|
|
7033
7069
|
process.exit(0);
|
|
7034
7070
|
}
|
|
7035
7071
|
switch (action) {
|
|
7072
|
+
case "list":
|
|
7073
|
+
data = await listTikTokMedia(client, restArgs, flags);
|
|
7074
|
+
emptyHint = "No TikTok Asset Library videos found for this account.";
|
|
7075
|
+
break;
|
|
7036
7076
|
case "upload":
|
|
7037
7077
|
data = await uploadTikTokMedia(client, restArgs, flags);
|
|
7038
7078
|
break;
|
|
7039
7079
|
default:
|
|
7040
|
-
throw new CliError("UNKNOWN_COMMAND", `Unknown action: tiktok media ${action}`, "Available: upload");
|
|
7080
|
+
throw new CliError("UNKNOWN_COMMAND", `Unknown action: tiktok media ${action}`, "Available: list, upload");
|
|
7041
7081
|
}
|
|
7042
7082
|
break;
|
|
7043
7083
|
}
|
package/package.json
CHANGED