/
execute-scenarios.ts
32 lines (28 loc) · 1.1 KB
/
execute-scenarios.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import { Command, Flags } from "@oclif/core";
import { getWebClient } from "../../../autify/web/getWebClient";
export default class WebApiExecuteScenarios extends Command {
static description =
'You can execute any scenarios in your workspace using any execution environments (which is called "capabilities" here).';
static examples = ["<%= config.bin %> <%= command.id %>"];
static flags = {
"project-id": Flags.integer({
description:
"For example, 1 for the following URL: https://app.autify.com/projects/1/scenarios",
required: true,
}),
"execute-scenarios-request": Flags.string({
description: "The scenarios and settings to execute",
required: true,
}),
};
public async run(): Promise<void> {
const { flags } = await this.parse(WebApiExecuteScenarios);
const { configDir, userAgent } = this.config;
const client = getWebClient(configDir, userAgent);
const res = await client.executeScenarios(
flags["project-id"],
JSON.parse(flags["execute-scenarios-request"])
);
console.log(JSON.stringify(res.data, null, 2));
}
}