@adkit/cli 1.12.25 → 1.12.27

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.
Files changed (2) hide show
  1. package/dist/cli.js +61 -14
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -2827,7 +2827,7 @@ var AD_GROUP_LIST_FLAGS2 = ["campaign-ids", "fields", "limit", "offset"];
2827
2827
  var AD_GROUP_CREATE_FLAGS = ["campaign", "name", "status", "budget-daily", "budget-lifetime", "billing-event", "bid-strategy", "optimization", "start-date", "end-date", "pacing", "bid-amount", "event-type", "pixel", "placement", PLATFORM_OVERRIDE_FLAG];
2828
2828
  var AD_GROUP_UPDATE_FLAGS = ["name", "status", "budget-daily", "budget-lifetime", "billing-event", "optimization", "start-date", "end-date", "pacing", "bid-amount", "event-type", "pixel", PLATFORM_OVERRIDE_FLAG];
2829
2829
  var AD_LIST_FLAGS2 = ["ad-group-ids", "campaign-ids", "fields", "limit", "offset"];
2830
- 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];
2830
+ var AD_CREATE_FLAGS = ["ad-group", "name", "status", "media-id", "existing-post-id", "ad-text", "url", "cta", "display-name", "identity-id", "identity-type", "tracking-pixel", PLATFORM_OVERRIDE_FLAG];
2831
2831
  var AD_UPDATE_FLAGS = ["ad-group", "name", "status", "media-id", "ad-text", "url", "cta", "display-name", "identity-id", "identity-type", "tracking-pixel", PLATFORM_OVERRIDE_FLAG];
2832
2832
  var RESULTS_FLAGS = ["level", "fields", "breakdowns", "from", "to", "sort", "sort-direction", "limit", "offset"];
2833
2833
  function readSingleFlagValue2(flags, key, duplicateHint) {
@@ -2941,7 +2941,8 @@ function buildTikTokBudget(flags) {
2941
2941
  function readTikTokPlacementFlag(flags) {
2942
2942
  const value = readSingleFlagValue2(flags, "placement", "Use comma-separated TikTok placement IDs, or switch to --data for full targeting");
2943
2943
  if (value === void 0) return void 0;
2944
- const placements = value.split(",").map((entry) => entry.trim()).filter(Boolean);
2944
+ const rawParts = value.split(",");
2945
+ const placements = rawParts.map((entry) => entry.trim()).filter(Boolean);
2945
2946
  if (placements.length === 0) throw new CliError("INVALID_VALUE", "--placement must contain at least one placement ID", "Example: --placement PLACEMENT_TIKTOK");
2946
2947
  return placements;
2947
2948
  }
@@ -2994,14 +2995,20 @@ function buildTikTokAdGroupPayload(flags, mode) {
2994
2995
  return payload;
2995
2996
  }
2996
2997
  function buildTikTokAdCreative(flags) {
2998
+ const isSparkAd = typeof flags["existing-post-id"] === "string";
2999
+ if (isSparkAd && flags["media-id"] !== void 0) throw new CliError("INVALID_VALUE", "Use --existing-post-id or --media-id, not both", "Spark Ads promote an existing post; drop --media-id, or drop --existing-post-id to upload a video");
2997
3000
  const hasCreativeFlag = ["media-id", "ad-text", "url", "cta", "display-name", "identity-id", "identity-type", "tracking-pixel"].some((key) => flags[key] !== void 0);
2998
- if (!hasCreativeFlag) return void 0;
2999
- const mediaId = requireFlag(flags, "media-id", "Run: adkit manage tiktok ads create --media-id <uploaded-video-id>");
3001
+ if (!hasCreativeFlag && !isSparkAd) return void 0;
3000
3002
  const creative = {
3001
- adText: requireFlag(flags, "ad-text", "Provide the TikTok ad text"),
3002
- media: [{ id: mediaId, role: "video" }],
3003
3003
  url: requireFlag(flags, "url", "Provide the destination URL for the ad")
3004
3004
  };
3005
+ if (isSparkAd) {
3006
+ if (typeof flags["ad-text"] === "string") creative.adText = flags["ad-text"];
3007
+ } else {
3008
+ const mediaId = requireFlag(flags, "media-id", "Run: adkit manage tiktok ads create --media-id <uploaded-video-id>");
3009
+ creative.adText = requireFlag(flags, "ad-text", "Provide the TikTok ad text");
3010
+ creative.media = [{ id: mediaId, role: "video" }];
3011
+ }
3005
3012
  if (typeof flags.cta === "string") creative.cta = flags.cta;
3006
3013
  if (typeof flags["display-name"] === "string") creative.displayName = flags["display-name"];
3007
3014
  if (typeof flags["identity-id"] === "string") creative.identityId = flags["identity-id"];
@@ -3017,6 +3024,7 @@ function buildTikTokAdPayload(flags, mode) {
3017
3024
  if (typeof flags.name === "string") payload.name = flags.name;
3018
3025
  if (typeof flags.status === "string") payload.status = flags.status;
3019
3026
  payload.adType = "video";
3027
+ if (typeof flags["existing-post-id"] === "string") payload.existingPostId = flags["existing-post-id"];
3020
3028
  const creative = buildTikTokAdCreative(flags);
3021
3029
  if (creative) payload.creative = creative;
3022
3030
  if (platformOverrides) payload.platformOverrides = platformOverrides;
@@ -3183,6 +3191,12 @@ async function disconnectRedditAccount(client, args, flags) {
3183
3191
  return client.delete(`/manage/reddit/accounts/${adAccountId}`);
3184
3192
  }
3185
3193
 
3194
+ // src/commands/linkedin.ts
3195
+ async function listLinkedInAvailableAccounts(client, _args, flags) {
3196
+ validateFlags(flags, [], "manage linkedin accounts available");
3197
+ return client.get("/manage/linkedin/accounts/available");
3198
+ }
3199
+
3186
3200
  // src/commands/status.ts
3187
3201
  function isStatusResponse(value) {
3188
3202
  if (!value || typeof value !== "object") return false;
@@ -4131,6 +4145,7 @@ Manage platforms:
4131
4145
  google Google Ads
4132
4146
  tiktok TikTok Ads
4133
4147
  reddit Reddit Ads
4148
+ linkedin LinkedIn Ads
4134
4149
  drafts Drafts across platforms
4135
4150
 
4136
4151
  Run \`adkit <command> --help\` for details.
@@ -4144,7 +4159,7 @@ var FLAG = {
4144
4159
  budgetDaily: " --budget-daily <n> Daily budget in account currency",
4145
4160
  cta: " --cta <type> sign_up, learn_more, shop_now, download, get_offer, contact_us, subscribe, get_quote, book_now, apply_now"
4146
4161
  };
4147
- var RAW_PLATFORM_LABELS = { google: "Google", meta: "Meta", reddit: "Reddit", tiktok: "TikTok", x: "X" };
4162
+ var RAW_PLATFORM_LABELS = { google: "Google", meta: "Meta", reddit: "Reddit", tiktok: "TikTok", x: "X", linkedin: "LinkedIn" };
4148
4163
  function rawPlatformCommandLine(platform2) {
4149
4164
  return `Raw ${RAW_PLATFORM_LABELS[platform2] ?? platform2} API calls use the shared command: adkit manage platform-api-requests --platform ${platform2} ...`;
4150
4165
  }
@@ -5600,6 +5615,7 @@ ${FLAG.data}
5600
5615
  --name <name> Ad name
5601
5616
  --status <s> active, paused
5602
5617
  --media-id <id> TikTok video ID from tiktok media upload
5618
+ --existing-post-id <id> Spark Ad: promote an existing organic post instead of an uploaded video (needs a BC_AUTH_TT identity)
5603
5619
  --ad-text <text> Ad text
5604
5620
  --url <url> Destination URL
5605
5621
  --cta <type> learn_more, shop_now, sign_up, download, contact_us, apply_now, book_now
@@ -5608,6 +5624,7 @@ ${FLAG.data}
5608
5624
 
5609
5625
  Examples:
5610
5626
  adkit manage tiktok ads create --ad-group 1770 --name "Hero video" --media-id v123 --ad-text "Try it today" --url https://example.com --cta learn_more
5627
+ adkit manage tiktok ads create --ad-group 1770 --name "Spark Ad" --existing-post-id 7412 --url https://example.com --cta learn_more
5611
5628
  adkit manage tiktok ads update 1770000000000000000 --status paused --publish`.trim(),
5612
5629
  "tiktok results": `adkit manage tiktok results \u2014 TikTok performance reporting
5613
5630
 
@@ -5663,7 +5680,7 @@ Examples:
5663
5680
 
5664
5681
  Flags:
5665
5682
  --data <json> Full request object (preferred for agents)
5666
- --platform <meta|google|tiktok|reddit|x> Target platform (required)
5683
+ --platform <meta|google|tiktok|reddit|x|linkedin> Target platform (required)
5667
5684
  --endpoint <path> Relative API path (required)
5668
5685
  --payload <json> JSON body for POST/PUT/PATCH, query params for GET, omit for DELETE
5669
5686
  --method <GET|POST|PUT|PATCH|DELETE> HTTP method (default: POST)
@@ -5680,7 +5697,8 @@ Examples:
5680
5697
  adkit manage platform-api-requests --platform google --endpoint "customers/123/googleAds:mutate" --payload '{"mutateOperations":[...]}' --request-description "Pause ad" --account 123
5681
5698
  adkit manage platform-api-requests --platform tiktok --endpoint "campaign/get/" --method GET --payload '{"advertiser_id":"123"}' --request-description "List TikTok campaigns" --account 123
5682
5699
  adkit manage platform-api-requests --platform reddit --endpoint "ad_accounts/a2_example/campaigns" --payload '{"name":"Test","objective":"TRAFFIC","configured_status":"PAUSED"}' --request-description "Create paused Reddit campaign" --account a2_example
5683
- adkit manage platform-api-requests --platform x --endpoint "accounts/18ce54d4x5t/campaigns" --method GET --request-description "List X campaigns" --account 18ce54d4x5t`.trim(),
5700
+ adkit manage platform-api-requests --platform x --endpoint "accounts/18ce54d4x5t/campaigns" --method GET --request-description "List X campaigns" --account 18ce54d4x5t
5701
+ adkit manage platform-api-requests --platform linkedin --endpoint "adCampaignGroups/(account:urn:li:sponsoredAccount:512345678)" --method GET --request-description "List LinkedIn campaign groups" --account 512345678`.trim(),
5684
5702
  manage: `adkit manage \u2014 Ad platform management
5685
5703
 
5686
5704
  Platforms:
@@ -5689,6 +5707,7 @@ Platforms:
5689
5707
  tiktok TikTok Ads
5690
5708
  reddit Reddit Ads
5691
5709
  x X Ads raw API access
5710
+ linkedin LinkedIn Ads (account discovery + raw API access)
5692
5711
  drafts Manage drafts across platforms
5693
5712
  platform-api-requests Send raw API requests (escape hatch)
5694
5713
 
@@ -5781,6 +5800,19 @@ ${rawPlatformCommandLine("x")}
5781
5800
 
5782
5801
  Examples:
5783
5802
  adkit manage platform-api-requests --platform x --endpoint "accounts/18ce54d4x5t/campaigns" --method GET --request-description "List X campaigns" --account 18ce54d4x5t`.trim(),
5803
+ linkedin: `adkit manage linkedin \u2014 LinkedIn Ads management
5804
+
5805
+ Entity groups:
5806
+ accounts available List LinkedIn ad accounts discoverable from connected workspace logins
5807
+
5808
+ Account discovery currently supports "available" only \u2014 connect/disconnect/list are not exposed yet.
5809
+ First-class LinkedIn campaign/ad reads and writes are not enabled yet.
5810
+ ${rawPlatformCommandLine("linkedin")}
5811
+
5812
+ General flags:
5813
+ ${FLAG.account}
5814
+
5815
+ Run adkit manage linkedin accounts available to discover ad accounts.`.trim(),
5784
5816
  drafts: `adkit manage drafts \u2014 Manage drafts
5785
5817
 
5786
5818
  list List all drafts
@@ -6707,7 +6739,7 @@ function readRawRequestData(flags) {
6707
6739
  };
6708
6740
  }
6709
6741
  function readRawRequestFlags(flags) {
6710
- const platform2 = requireFlag(flags, "platform", "Required: --platform meta, google, tiktok, reddit, or x");
6742
+ const platform2 = requireFlag(flags, "platform", "Required: --platform meta, google, tiktok, reddit, x, or linkedin");
6711
6743
  const method = readRawRequestMethod(flags.method);
6712
6744
  const rawPayload = readRawRequestFlagPayload(flags);
6713
6745
  const payload = readRawRequestPayload({ method, payload: rawPayload, source: "flag" });
@@ -6742,8 +6774,8 @@ function readRawRequestString(input) {
6742
6774
  throw new CliError("MISSING_FLAG", `Missing required field: \`${input.field}\``, input.hint);
6743
6775
  }
6744
6776
  function readRawRequestPlatform(value) {
6745
- if (value === "meta" || value === "google" || value === "tiktok" || value === "reddit" || value === "x") return value;
6746
- throw new CliError("INVALID_VALUE", `Invalid platform: ${String(value)}`, "Use meta, google, tiktok, reddit, or x");
6777
+ if (value === "meta" || value === "google" || value === "tiktok" || value === "reddit" || value === "x" || value === "linkedin") return value;
6778
+ throw new CliError("INVALID_VALUE", `Invalid platform: ${String(value)}`, "Use meta, google, tiktok, reddit, x, or linkedin");
6747
6779
  }
6748
6780
  function readRawRequestMethod(value) {
6749
6781
  const method = typeof value === "string" ? value.toUpperCase() : "POST";
@@ -6914,7 +6946,7 @@ async function main() {
6914
6946
  return;
6915
6947
  }
6916
6948
  const platform2 = manageTarget;
6917
- if (platform2 !== "meta" && platform2 !== "google" && platform2 !== "tiktok" && platform2 !== "reddit" && platform2 !== "x") throw new CliError("UNKNOWN_COMMAND", `Unknown platform: ${platform2}`, "Available: meta, google, tiktok, reddit, x, drafts, platform-api-requests");
6949
+ if (platform2 !== "meta" && platform2 !== "google" && platform2 !== "tiktok" && platform2 !== "reddit" && platform2 !== "x" && platform2 !== "linkedin") throw new CliError("UNKNOWN_COMMAND", `Unknown platform: ${platform2}`, "Available: meta, google, tiktok, reddit, x, linkedin, drafts, platform-api-requests");
6918
6950
  const entity = args[2];
6919
6951
  const action = args[3];
6920
6952
  const restArgs = args.slice(4);
@@ -7541,8 +7573,23 @@ async function main() {
7541
7573
  default:
7542
7574
  throw new CliError("UNKNOWN_COMMAND", `Unknown entity: reddit ${entity}`, "Available: accounts, platform-api-requests");
7543
7575
  }
7576
+ } else if (platform2 === "linkedin") {
7577
+ switch (entity) {
7578
+ case "accounts":
7579
+ switch (action) {
7580
+ case "available":
7581
+ data = await listLinkedInAvailableAccounts(client, restArgs, flags);
7582
+ emptyHint = "No LinkedIn ad accounts available from the connected workspace login.";
7583
+ break;
7584
+ default:
7585
+ throw new CliError("UNKNOWN_COMMAND", `Unknown action: linkedin accounts ${action}`, "Available: available.");
7586
+ }
7587
+ break;
7588
+ default:
7589
+ throw new CliError("UNKNOWN_COMMAND", `Unknown entity: linkedin ${entity}`, "Available: accounts, platform-api-requests");
7590
+ }
7544
7591
  } else if (platform2 === "x") throw new CliError("UNKNOWN_COMMAND", `Unknown entity: x ${entity}`, "Available: platform-api-requests");
7545
- else throw new CliError("UNKNOWN_COMMAND", "Unknown platform", "Available: meta, google, tiktok, reddit, x, drafts, platform-api-requests");
7592
+ else throw new CliError("UNKNOWN_COMMAND", "Unknown platform", "Available: meta, google, tiktok, reddit, x, linkedin, drafts, platform-api-requests");
7546
7593
  printResult(data, flags, emptyHint, detailEntity);
7547
7594
  return;
7548
7595
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adkit/cli",
3
- "version": "1.12.25",
3
+ "version": "1.12.27",
4
4
  "description": "The Ads CLI for AI agents — manage Meta & Google ad campaigns, browse the ad library, and generate creatives from your terminal.",
5
5
  "keywords": [
6
6
  "ads cli",