@erdoai/cli 0.153.0 → 0.154.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.
- package/dist/index.js +86 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1264,6 +1264,33 @@ var ErdoClient = class {
|
|
|
1264
1264
|
setDatasetRowAction(input) {
|
|
1265
1265
|
return this.request("PUT", "/v1/dataset-row-actions", input, false);
|
|
1266
1266
|
}
|
|
1267
|
+
listProviderLeadSources(opts) {
|
|
1268
|
+
const q = new URLSearchParams();
|
|
1269
|
+
if (opts?.provider) q.set("provider", opts.provider);
|
|
1270
|
+
if (opts?.account_id) q.set("account_id", opts.account_id);
|
|
1271
|
+
const qs = q.toString();
|
|
1272
|
+
return this.request(
|
|
1273
|
+
"GET",
|
|
1274
|
+
`/v1/provider-lead-sources${qs ? `?${qs}` : ""}`
|
|
1275
|
+
);
|
|
1276
|
+
}
|
|
1277
|
+
listProviderLeadSourceForms(connectionId, accountId) {
|
|
1278
|
+
const q = new URLSearchParams({ connection_id: connectionId, account_id: accountId });
|
|
1279
|
+
return this.request(
|
|
1280
|
+
"GET",
|
|
1281
|
+
`/v1/provider-lead-sources/forms?${q.toString()}`
|
|
1282
|
+
);
|
|
1283
|
+
}
|
|
1284
|
+
setProviderLeadSource(input) {
|
|
1285
|
+
return this.request("PUT", "/v1/provider-lead-sources", input, false);
|
|
1286
|
+
}
|
|
1287
|
+
deleteProviderLeadSource(provider, accountId) {
|
|
1288
|
+
const q = new URLSearchParams({ provider, account_id: accountId });
|
|
1289
|
+
return this.request(
|
|
1290
|
+
"DELETE",
|
|
1291
|
+
`/v1/provider-lead-sources?${q.toString()}`
|
|
1292
|
+
);
|
|
1293
|
+
}
|
|
1267
1294
|
listDatasetUserPermissions(slug) {
|
|
1268
1295
|
return this.request("GET", `/v1/datasets/${encodeURIComponent(slug)}/permissions/users`);
|
|
1269
1296
|
}
|
|
@@ -7316,6 +7343,65 @@ voiceAgentsCmd.command("whatsapp-replies <slug>").description("Turn a voice agen
|
|
|
7316
7343
|
}
|
|
7317
7344
|
});
|
|
7318
7345
|
var datasetsCmd = program.command("datasets").description("Datasets");
|
|
7346
|
+
var providerLeadSourcesCmd = program.command("provider-lead-sources").description("Ingest ad-platform lead form responses into a lead dataset");
|
|
7347
|
+
providerLeadSourcesCmd.command("list").description("List LinkedIn lead form source declarations").option("--provider <provider>", "filter by ad platform provider").option("--account-id <id>", "filter by provider ad account id").action(async (opts) => {
|
|
7348
|
+
try {
|
|
7349
|
+
print(await new ErdoClient().listProviderLeadSources({ provider: opts.provider, account_id: opts.accountId }));
|
|
7350
|
+
} catch (e) {
|
|
7351
|
+
fail(e);
|
|
7352
|
+
}
|
|
7353
|
+
});
|
|
7354
|
+
providerLeadSourcesCmd.command("forms").description("List LinkedIn lead forms available on a connected ad account").requiredOption("--connection-id <id>", "LinkedIn Ads connector account id from /connectors/my-connections").requiredOption("--account-id <id>", "numeric LinkedIn ad account id").action(async (opts) => {
|
|
7355
|
+
try {
|
|
7356
|
+
print(await new ErdoClient().listProviderLeadSourceForms(opts.connectionId, opts.accountId));
|
|
7357
|
+
} catch (e) {
|
|
7358
|
+
fail(e);
|
|
7359
|
+
}
|
|
7360
|
+
});
|
|
7361
|
+
providerLeadSourcesCmd.command("set").description("Replace a provider lead form source declaration from JSON or flags").option("-f, --file <path>", "one JSON declaration object; use - to read from stdin").option("--dataset <slug>", "lead dataset slug").option("--provider <provider>", "ad platform provider", "linkedin_ads").option("--connection-id <id>", "LinkedIn Ads connector account id from /connectors/my-connections").option("--account-id <id>", "numeric LinkedIn ad account id").option("--form <id>", "LinkedIn lead gen form id (repeatable)", collect, []).option("--disabled", "save the declaration disabled").action(async (opts) => {
|
|
7362
|
+
try {
|
|
7363
|
+
let input;
|
|
7364
|
+
if (opts.file) {
|
|
7365
|
+
input = await readJSONInput(opts.file, "--file");
|
|
7366
|
+
} else {
|
|
7367
|
+
input = {
|
|
7368
|
+
dataset: opts.dataset,
|
|
7369
|
+
provider: opts.provider,
|
|
7370
|
+
connection_id: opts.connectionId,
|
|
7371
|
+
account_id: opts.accountId,
|
|
7372
|
+
forms: opts.form,
|
|
7373
|
+
...opts.disabled ? { enabled: false } : {}
|
|
7374
|
+
};
|
|
7375
|
+
}
|
|
7376
|
+
const dataset = typeof input.dataset === "string" ? input.dataset.trim() : "";
|
|
7377
|
+
const provider = typeof input.provider === "string" ? input.provider.trim() : "";
|
|
7378
|
+
const connectionID = typeof input.connection_id === "string" ? input.connection_id.trim() : "";
|
|
7379
|
+
const accountID = typeof input.account_id === "string" ? input.account_id.trim() : "";
|
|
7380
|
+
const forms = Array.isArray(input.forms) ? input.forms.filter((form) => typeof form === "string" && form.trim().length > 0) : [];
|
|
7381
|
+
if (!dataset) throw new Error("dataset must be a non-empty string");
|
|
7382
|
+
if (!provider) throw new Error("provider must be a non-empty string");
|
|
7383
|
+
if (!connectionID) throw new Error("connection_id must be a non-empty string");
|
|
7384
|
+
if (!accountID) throw new Error("account_id must be a non-empty string");
|
|
7385
|
+
if (forms.length === 0) throw new Error("forms must contain at least one form");
|
|
7386
|
+
print(await new ErdoClient().setProviderLeadSource({
|
|
7387
|
+
...input,
|
|
7388
|
+
dataset,
|
|
7389
|
+
provider,
|
|
7390
|
+
connection_id: connectionID,
|
|
7391
|
+
account_id: accountID,
|
|
7392
|
+
forms
|
|
7393
|
+
}));
|
|
7394
|
+
} catch (e) {
|
|
7395
|
+
fail(e);
|
|
7396
|
+
}
|
|
7397
|
+
});
|
|
7398
|
+
providerLeadSourcesCmd.command("delete").description("Delete a provider lead form source declaration").option("--provider <provider>", "ad platform provider", "linkedin_ads").requiredOption("--account-id <id>", "numeric provider ad account id").action(async (opts) => {
|
|
7399
|
+
try {
|
|
7400
|
+
print(await new ErdoClient().deleteProviderLeadSource(opts.provider, opts.accountId));
|
|
7401
|
+
} catch (e) {
|
|
7402
|
+
fail(e);
|
|
7403
|
+
}
|
|
7404
|
+
});
|
|
7319
7405
|
var datasetRowActionsCmd = datasetsCmd.command("row-actions").description("Read and replace actions for arriving or excluded dataset rows");
|
|
7320
7406
|
datasetRowActionsCmd.command("get <slug>").description("Read the row-action declarations and optional bounded diagnostics for a dataset").option("--include-receipts", "include bounded provider receipt diagnostics").option("--include-unresolved", "include bounded unresolved lookup diagnostics").action(async (slug, opts) => {
|
|
7321
7407
|
try {
|