@adkit/cli 1.13.0 → 1.13.1
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 +55 -15
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -3493,6 +3493,12 @@ function buildLinkedInMediaUploadSource(flags) {
|
|
|
3493
3493
|
return source;
|
|
3494
3494
|
}
|
|
3495
3495
|
|
|
3496
|
+
// src/commands/microsoft.ts
|
|
3497
|
+
async function listMicrosoftAvailableAccounts(client, _args, flags) {
|
|
3498
|
+
validateFlags(flags, [], "manage microsoft accounts available");
|
|
3499
|
+
return client.get("/manage/microsoft/accounts/available");
|
|
3500
|
+
}
|
|
3501
|
+
|
|
3496
3502
|
// src/commands/status.ts
|
|
3497
3503
|
function isStatusResponse(value) {
|
|
3498
3504
|
if (!value || typeof value !== "object") return false;
|
|
@@ -4456,7 +4462,7 @@ var FLAG = {
|
|
|
4456
4462
|
budgetDaily: " --budget-daily <n> Daily budget in account currency",
|
|
4457
4463
|
cta: " --cta <type> sign_up, learn_more, shop_now, download, get_offer, contact_us, subscribe, get_quote, book_now, apply_now"
|
|
4458
4464
|
};
|
|
4459
|
-
var RAW_PLATFORM_LABELS = { google: "Google", meta: "Meta", reddit: "Reddit", tiktok: "TikTok", x: "X", linkedin: "LinkedIn" };
|
|
4465
|
+
var RAW_PLATFORM_LABELS = { google: "Google", meta: "Meta", reddit: "Reddit", tiktok: "TikTok", x: "X", linkedin: "LinkedIn", microsoft: "Microsoft" };
|
|
4460
4466
|
function rawPlatformCommandLine(platform2) {
|
|
4461
4467
|
return `Raw ${RAW_PLATFORM_LABELS[platform2] ?? platform2} API calls use the shared command: adkit manage platform-api-requests --platform ${platform2} ...`;
|
|
4462
4468
|
}
|
|
@@ -6150,9 +6156,9 @@ Examples:
|
|
|
6150
6156
|
|
|
6151
6157
|
Flags:
|
|
6152
6158
|
--data <json> Full request object (preferred for agents)
|
|
6153
|
-
--platform <meta|google|tiktok|reddit|x|linkedin> Target platform (required)
|
|
6154
|
-
--endpoint <path> Relative API path (required)
|
|
6155
|
-
--payload <json> JSON body for POST/PUT/PATCH, query params for GET, omit for DELETE
|
|
6159
|
+
--platform <meta|google|tiktok|reddit|x|linkedin|microsoft> Target platform (required)
|
|
6160
|
+
--endpoint <path> Relative API path (required). Microsoft is the exception: pass the full https URL to a Bing Ads v13 host
|
|
6161
|
+
--payload <json> JSON body for POST/PUT/PATCH, query params for GET, omit for DELETE (exception: Microsoft DELETE takes a JSON body of ids)
|
|
6156
6162
|
--method <GET|POST|PUT|PATCH|DELETE> HTTP method (default: POST)
|
|
6157
6163
|
--request-description <text> What this request does (required)
|
|
6158
6164
|
--account <id> Ad account ID (required)
|
|
@@ -6168,7 +6174,8 @@ Examples:
|
|
|
6168
6174
|
adkit manage platform-api-requests --platform tiktok --endpoint "campaign/get/" --method GET --payload '{"advertiser_id":"123"}' --request-description "List TikTok campaigns" --account 123
|
|
6169
6175
|
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
|
|
6170
6176
|
adkit manage platform-api-requests --platform x --endpoint "accounts/18ce54d4x5t/campaigns" --method GET --request-description "List X campaigns" --account 18ce54d4x5t
|
|
6171
|
-
adkit manage platform-api-requests --platform linkedin --endpoint "adCampaignGroups/(account:urn:li:sponsoredAccount:512345678)" --method GET --request-description "List LinkedIn campaign groups" --account 512345678
|
|
6177
|
+
adkit manage platform-api-requests --platform linkedin --endpoint "adCampaignGroups/(account:urn:li:sponsoredAccount:512345678)" --method GET --request-description "List LinkedIn campaign groups" --account 512345678
|
|
6178
|
+
adkit manage platform-api-requests --platform microsoft --endpoint "https://campaign.api.bingads.microsoft.com/CampaignManagement/v13/Campaigns/QueryByAccountId" --payload '{"AccountId":187276743,"CampaignType":"Search"}' --request-description "List Microsoft campaigns" --account 187276743 --publish`.trim(),
|
|
6172
6179
|
manage: `adkit manage \u2014 Ad platform management
|
|
6173
6180
|
|
|
6174
6181
|
Platforms:
|
|
@@ -6178,6 +6185,7 @@ Platforms:
|
|
|
6178
6185
|
reddit Reddit Ads
|
|
6179
6186
|
x X Ads raw API access
|
|
6180
6187
|
linkedin LinkedIn Ads (campaigns, ad groups, ads, targeting, results)
|
|
6188
|
+
microsoft Microsoft Ads raw API access + account discovery
|
|
6181
6189
|
drafts Manage drafts across platforms
|
|
6182
6190
|
platform-api-requests Send raw API requests (escape hatch)
|
|
6183
6191
|
|
|
@@ -6270,6 +6278,21 @@ ${rawPlatformCommandLine("x")}
|
|
|
6270
6278
|
|
|
6271
6279
|
Examples:
|
|
6272
6280
|
adkit manage platform-api-requests --platform x --endpoint "accounts/18ce54d4x5t/campaigns" --method GET --request-description "List X campaigns" --account 18ce54d4x5t`.trim(),
|
|
6281
|
+
microsoft: `adkit manage microsoft \u2014 Microsoft Ads raw API access + account discovery
|
|
6282
|
+
|
|
6283
|
+
Microsoft (Bing) is currently exposed through Advanced Platform Access, plus account discovery.
|
|
6284
|
+
Endpoints are FULL https URLs to Bing Ads v13 hosts (campaign/reporting/bulk .api.bingads.microsoft.com) \u2014 not relative paths.
|
|
6285
|
+
Bing REST puts the operation in the HTTP verb; query reads are POST to .../Query* paths.
|
|
6286
|
+
Because query reads are POST, add --publish on read-only Query* calls \u2014 otherwise you get a draft instead of data.
|
|
6287
|
+
|
|
6288
|
+
${rawPlatformCommandLine("microsoft")}
|
|
6289
|
+
|
|
6290
|
+
Commands:
|
|
6291
|
+
accounts available List Microsoft ad accounts discoverable from the connected workspace login
|
|
6292
|
+
|
|
6293
|
+
Examples:
|
|
6294
|
+
adkit manage microsoft accounts available
|
|
6295
|
+
adkit manage platform-api-requests --platform microsoft --endpoint "https://campaign.api.bingads.microsoft.com/CampaignManagement/v13/Campaigns/QueryByAccountId" --payload '{"AccountId":187276743,"CampaignType":"Search"}' --request-description "List Microsoft campaigns" --account 187276743 --publish`.trim(),
|
|
6273
6296
|
linkedin: `adkit manage linkedin \u2014 LinkedIn Ads management
|
|
6274
6297
|
|
|
6275
6298
|
Entity groups:
|
|
@@ -7202,13 +7225,14 @@ function readRawRequestData(flags) {
|
|
|
7202
7225
|
const data = parseDataFlag(flags, `Run: adkit manage platform-api-requests --data '{"platform":"meta","endpoint":"act_123/campaigns","payload":{},"description":"Create campaign","accountId":"act_123"}'`);
|
|
7203
7226
|
if (!data || typeof data !== "object" || Array.isArray(data)) throw new CliError("INVALID_VALUE", "--data must be a JSON object", "Include platform, endpoint, payload, description, and accountId");
|
|
7204
7227
|
const input = data;
|
|
7228
|
+
const platform2 = readRawRequestPlatform(input.platform);
|
|
7205
7229
|
const method = readRawRequestMethod(input.method);
|
|
7206
7230
|
const publish = readRawRequestPublish({ data: input, flags });
|
|
7207
7231
|
const description = readRawRequestDataDescription(input);
|
|
7208
|
-
const payload = readRawRequestPayload({ method, payload: input.payload, source: "data" });
|
|
7232
|
+
const payload = readRawRequestPayload({ method, payload: input.payload, platform: platform2, source: "data" });
|
|
7209
7233
|
return {
|
|
7210
7234
|
body: {
|
|
7211
|
-
platform:
|
|
7235
|
+
platform: platform2,
|
|
7212
7236
|
endpoint: readRawRequestString({ value: input.endpoint, field: "endpoint", hint: "Include endpoint in --data" }),
|
|
7213
7237
|
payload,
|
|
7214
7238
|
method,
|
|
@@ -7219,13 +7243,14 @@ function readRawRequestData(flags) {
|
|
|
7219
7243
|
};
|
|
7220
7244
|
}
|
|
7221
7245
|
function readRawRequestFlags(flags) {
|
|
7222
|
-
const
|
|
7246
|
+
const platformFlag = requireFlag(flags, "platform", "Required: --platform meta, google, tiktok, reddit, x, linkedin, or microsoft");
|
|
7247
|
+
const platform2 = readRawRequestPlatform(platformFlag);
|
|
7223
7248
|
const method = readRawRequestMethod(flags.method);
|
|
7224
7249
|
const rawPayload = readRawRequestFlagPayload(flags);
|
|
7225
|
-
const payload = readRawRequestPayload({ method, payload: rawPayload, source: "flag" });
|
|
7250
|
+
const payload = readRawRequestPayload({ method, payload: rawPayload, platform: platform2, source: "flag" });
|
|
7226
7251
|
return {
|
|
7227
7252
|
body: {
|
|
7228
|
-
platform:
|
|
7253
|
+
platform: platform2,
|
|
7229
7254
|
endpoint: requireFlag(flags, "endpoint", "Required: --endpoint <api-path>"),
|
|
7230
7255
|
payload,
|
|
7231
7256
|
method,
|
|
@@ -7254,8 +7279,8 @@ function readRawRequestString(input) {
|
|
|
7254
7279
|
throw new CliError("MISSING_FLAG", `Missing required field: \`${input.field}\``, input.hint);
|
|
7255
7280
|
}
|
|
7256
7281
|
function readRawRequestPlatform(value) {
|
|
7257
|
-
if (value === "meta" || value === "google" || value === "tiktok" || value === "reddit" || value === "x" || value === "linkedin") return value;
|
|
7258
|
-
throw new CliError("INVALID_VALUE", `Invalid platform: ${String(value)}`, "Use meta, google, tiktok, reddit, x, or
|
|
7282
|
+
if (value === "meta" || value === "google" || value === "tiktok" || value === "reddit" || value === "x" || value === "linkedin" || value === "microsoft") return value;
|
|
7283
|
+
throw new CliError("INVALID_VALUE", `Invalid platform: ${String(value)}`, "Use meta, google, tiktok, reddit, x, linkedin, or microsoft");
|
|
7259
7284
|
}
|
|
7260
7285
|
function readRawRequestMethod(value) {
|
|
7261
7286
|
const method = typeof value === "string" ? value.toUpperCase() : "POST";
|
|
@@ -7280,7 +7305,7 @@ function readRawRequestPayload(input) {
|
|
|
7280
7305
|
if (input.source === "data") throw new CliError("MISSING_FLAG", "POST/PUT/PATCH requests require payload in --data", 'Include "payload": {"key":"value"}');
|
|
7281
7306
|
throw new CliError("MISSING_FLAG", "POST/PUT/PATCH requests require --payload", `Add --payload '{"key":"value"}'`);
|
|
7282
7307
|
}
|
|
7283
|
-
if (input.method === "DELETE" && input.payload !== void 0 && input.payload !== null) throw new CliError("INVALID_VALUE", "DELETE requests do not support payload", "Put identifiers in the endpoint path");
|
|
7308
|
+
if (input.method === "DELETE" && input.platform !== "microsoft" && input.payload !== void 0 && input.payload !== null) throw new CliError("INVALID_VALUE", "DELETE requests do not support payload", "Put identifiers in the endpoint path");
|
|
7284
7309
|
return input.payload ?? null;
|
|
7285
7310
|
}
|
|
7286
7311
|
function showHelp(key, full = false) {
|
|
@@ -7426,7 +7451,7 @@ async function main() {
|
|
|
7426
7451
|
return;
|
|
7427
7452
|
}
|
|
7428
7453
|
const platform2 = manageTarget;
|
|
7429
|
-
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");
|
|
7454
|
+
if (platform2 !== "meta" && platform2 !== "google" && platform2 !== "tiktok" && platform2 !== "reddit" && platform2 !== "x" && platform2 !== "linkedin" && platform2 !== "microsoft") throw new CliError("UNKNOWN_COMMAND", `Unknown platform: ${platform2}`, "Available: meta, google, tiktok, reddit, x, linkedin, microsoft, drafts, platform-api-requests");
|
|
7430
7455
|
const entity = args[2];
|
|
7431
7456
|
const action = args[3];
|
|
7432
7457
|
const restArgs = args.slice(4);
|
|
@@ -8164,8 +8189,23 @@ async function main() {
|
|
|
8164
8189
|
default:
|
|
8165
8190
|
throw new CliError("UNKNOWN_COMMAND", `Unknown entity: linkedin ${entity}`, "Available: accounts, media, campaigns, ad-groups, ads, targeting-search, results, platform-api-requests");
|
|
8166
8191
|
}
|
|
8192
|
+
} else if (platform2 === "microsoft") {
|
|
8193
|
+
switch (entity) {
|
|
8194
|
+
case "accounts":
|
|
8195
|
+
switch (action) {
|
|
8196
|
+
case "available":
|
|
8197
|
+
data = await listMicrosoftAvailableAccounts(client, restArgs, flags);
|
|
8198
|
+
emptyHint = "No Microsoft ad accounts available from the connected workspace login.";
|
|
8199
|
+
break;
|
|
8200
|
+
default:
|
|
8201
|
+
throw new CliError("UNKNOWN_COMMAND", `Unknown action: microsoft accounts ${action}`, "Available: available.");
|
|
8202
|
+
}
|
|
8203
|
+
break;
|
|
8204
|
+
default:
|
|
8205
|
+
throw new CliError("UNKNOWN_COMMAND", `Unknown entity: microsoft ${entity}`, "Available: accounts, platform-api-requests");
|
|
8206
|
+
}
|
|
8167
8207
|
} else if (platform2 === "x") throw new CliError("UNKNOWN_COMMAND", `Unknown entity: x ${entity}`, "Available: platform-api-requests");
|
|
8168
|
-
else throw new CliError("UNKNOWN_COMMAND", "Unknown platform", "Available: meta, google, tiktok, reddit, x, linkedin, drafts, platform-api-requests");
|
|
8208
|
+
else throw new CliError("UNKNOWN_COMMAND", "Unknown platform", "Available: meta, google, tiktok, reddit, x, linkedin, microsoft, drafts, platform-api-requests");
|
|
8169
8209
|
printResult(data, flags, emptyHint, detailEntity);
|
|
8170
8210
|
return;
|
|
8171
8211
|
}
|
package/package.json
CHANGED