@erdoai/cli 0.157.0 → 0.158.0

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/index.js +50 -0
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -275,10 +275,22 @@ var ErdoClient = class {
275
275
  input
276
276
  );
277
277
  }
278
+ listPaidMediaAudiences(customerId, provider = "google_ads") {
279
+ const query = new URLSearchParams({ provider });
280
+ if (customerId) query.set("customer_id", customerId);
281
+ return this.request("GET", `/v1/paid-media/audiences?${query}`);
282
+ }
278
283
  listPaidMediaCampaigns(customerId) {
279
284
  const query = customerId ? `?customer_id=${encodeURIComponent(customerId)}` : "";
280
285
  return this.request("GET", `/v1/paid-media/campaigns${query}`);
281
286
  }
287
+ setPaidMediaAudienceMode(campaignId, input) {
288
+ return this.request(
289
+ "POST",
290
+ `/v1/paid-media/campaigns/${encodeURIComponent(campaignId)}/audience-mode`,
291
+ input
292
+ );
293
+ }
282
294
  setPaidMediaCampaignConversionGoals(campaignId, input) {
283
295
  return this.request(
284
296
  "POST",
@@ -2779,7 +2791,45 @@ program.command(REFRESH_COMMAND, { hidden: true }).description("Internal: refres
2779
2791
  await refreshVersionCache();
2780
2792
  });
2781
2793
  var paidMedia = program.command("paid-media").description("Paid media setup and operations");
2794
+ paidMedia.command("audiences").description("Read live audience lists, eligibility, attachments and targeting mode").option("--provider <provider>", "ad platform", "google_ads").option("--customer-id <id>", "Google Ads customer id (defaults to the selected account)").option("--json", "print the raw JSON result, including partial-read errors").action(async (opts) => {
2795
+ try {
2796
+ const result = await new ErdoClient().listPaidMediaAudiences(opts.customerId, opts.provider);
2797
+ if (opts.json) {
2798
+ print(result);
2799
+ return;
2800
+ }
2801
+ console.log(`${result.provider} customer ${result.customer_id}: ${result.status}`);
2802
+ console.log(`lists: ${result.list_presence}; attachments: ${result.attachment_state}`);
2803
+ for (const list of result.lists) {
2804
+ console.log(`${list.id} ${list.name} ${list.type} ${list.membership_status} ${list.population_state} search=${list.size_for_search ?? "unknown"} display=${list.size_for_display ?? "unknown"}`);
2805
+ }
2806
+ for (const link of result.attachments) {
2807
+ console.log(`${link.campaign_id}${link.ad_group_id ? "/" + link.ad_group_id : ""} ${link.user_list_resource_name} ${link.negative ? "EXCLUSION" : link.mode} ${link.enabled ? "enabled" : "inactive"}`);
2808
+ }
2809
+ for (const read of result.reads) {
2810
+ if (read.status !== "available") console.log(`${read.resource}: ${read.status} \u2014 ${read.error}`);
2811
+ }
2812
+ console.log(`Customer Match: ${result.customer_match.status} \u2014 ${result.customer_match.detail}`);
2813
+ for (const fact of result.facts) console.log(fact);
2814
+ } catch (e) {
2815
+ fail(e);
2816
+ }
2817
+ });
2782
2818
  var paidMediaCampaigns = paidMedia.command("campaigns").description("Google Ads campaigns and their conversion goals");
2819
+ paidMedia.command("audience-mode <campaignId>").description("Set audience Observation or Targeting, preserving other targeting dimensions (approval-gated)").requiredOption("--customer-id <id>", "Google Ads customer ID").requiredOption("--mode <mode>", "observation or targeting").option("--adgroup-id <id>", "update this ad group instead of its parent campaign").option("--reason <text>", "reason shown on the approval card").action(async (campaignId, opts) => {
2820
+ try {
2821
+ if (opts.mode !== "observation" && opts.mode !== "targeting") throw new Error("--mode must be observation or targeting");
2822
+ print(await new ErdoClient().setPaidMediaAudienceMode(campaignId, {
2823
+ provider: "google_ads",
2824
+ customer_id: opts.customerId,
2825
+ adgroup_id: opts.adgroupId,
2826
+ mode: opts.mode,
2827
+ reason: opts.reason
2828
+ }));
2829
+ } catch (e) {
2830
+ fail(e);
2831
+ }
2832
+ });
2783
2833
  paidMediaCampaigns.command("list").description("List the organization's owned Google Ads campaigns and owned conversion actions").option("--customer-id <id>", "Google Ads customer id (defaults to the selected account)").option("--json", "print the raw JSON result").action(async (opts) => {
2784
2834
  try {
2785
2835
  const result = await new ErdoClient().listPaidMediaCampaigns(opts.customerId);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@erdoai/cli",
3
- "version": "0.157.0",
3
+ "version": "0.158.0",
4
4
  "description": "Erdo CLI \u2014 drive datasets, pages, and evals from the terminal or CI",
5
5
  "type": "module",
6
6
  "bin": {