Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-generate api commands #533

Merged
merged 4 commits into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 30 additions & 30 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"/oclif.manifest.json"
],
"dependencies": {
"@autifyhq/autify-sdk": "^0.21.0",
"@autifyhq/autify-sdk": "^0.23.0",
"@oclif/core": "^3.27.0",
"@oclif/errors": "^1.3.6",
"@oclif/plugin-help": "^6.2.7",
Expand Down
2 changes: 1 addition & 1 deletion scripts/generate-api-commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const writeCommandSource = (service: string, apiMethod: MethodDeclaration) => {
[index].getCommentText();
const flagType = getFlagType(parameterType);
flags.push(
` '${name}': ${flagType}({description: '${flagDescription}', required: ${required}}),`
` '${name}': ${flagType}({description: ${JSON.stringify(flagDescription)}, required: ${required}}),`
);
const arg = `flags['${name}']`;
if (
Expand Down
6 changes: 3 additions & 3 deletions src/autify/web/runTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { CLIError } from "@oclif/errors";
import { WebClient } from "@autifyhq/autify-sdk";
import { TestPlan, TestScenario } from "./parseAutifyTestUrl";

type CapabilityOption = Parameters<
WebClient["executeScenarios"]
>[1]["capabilities"][number];
type CapabilityOption = Awaited<
ReturnType<WebClient["listCapabilities"]>
>["data"][number];
type CreateUrlReplacementRequest = Parameters<
WebClient["createUrlReplacement"]
>[1];
Expand Down
2 changes: 1 addition & 1 deletion src/commands/web/api/execute-schedule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { getWebClient } from "../../../autify/web/getWebClient";

export default class WebApiExecuteSchedule extends Command {
static description =
'"Schedule" is called as "Test Plan" now.\\ If you want to run a test plan, use this endpoint.';
'"Schedule" is called as "Test Plan" now. If you want to run a test plan, use this endpoint.';

static examples = ["<%= config.bin %> <%= command.id %>"];

Expand Down
6 changes: 3 additions & 3 deletions src/commands/web/api/get-credit-usage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { getWebClient } from "../../../autify/web/getWebClient";

export default class WebApiGetCreditUsage extends Command {
static description =
"Get the number of credits used in the project\\ \\ Notes:\\ This endpoint works only for organizations on credit-based plans. It always returns 0 for `credits_consumed` and `credit_consumption_event_count` if your organization is on a run-based plan.";
"Get the number of credits used in the project Notes: This endpoint works only for organizations on credit-based plans. It always returns 0 for `credits_consumed` and `credit_consumption_event_count` if your organization is on a run-based plan.";

static examples = ["<%= config.bin %> <%= command.id %>"];

Expand All @@ -15,12 +15,12 @@ export default class WebApiGetCreditUsage extends Command {
}),
"date-from": Flags.string({
description:
"The date to start counting used credits from.\\ If not specified, the date will be set to 1 week ago.\\ Up to 90 days in advance can be specified. If the specified date is more than 90 days in the past, the date will be set to 90 days ago.\\ Date must follow the format YYYY-MM-DD (example: &quot;2023-09-21&quot;).",
'The date to start counting used credits from. If not specified, the date will be set to 1 week ago. Up to 90 days in advance can be specified. If the specified date is more than 90 days in the past, the date will be set to 90 days ago. Date must follow the format YYYY-MM-DD (example: "2023-09-21").',
required: false,
}),
"date-to": Flags.string({
description:
"The date to end counting used credits from.\\ If not specified, the date will be set to today.\\ Date must follow the format YYYY-MM-DD (example: &quot;2023-09-28&quot;).",
'The date to end counting used credits from. If not specified, the date will be set to today. Date must follow the format YYYY-MM-DD (example: "2023-09-28").',
required: false,
}),
"scenario-id": Flags.integer({
Expand Down
21 changes: 17 additions & 4 deletions src/commands/web/api/list-capabilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,24 @@ export default class WebApiListCapabilities extends Command {
"For example, 1 for the following URL: https://app.autify.com/projects/1/capabilities",
required: true,
}),
os: Flags.string({ description: "os name to filter", required: false }),
os: Flags.string({
description: "os name to filter (deprecated)",
required: false,
}),
"os-type": Flags.string({
description: "Type of the os to filter",
required: false,
}),
browser: Flags.string({
description: "browser name to filter",
description: "browser name to filter (deprecated)",
required: false,
}),
"browser-type": Flags.string({
description: "Type of the browser to filter",
required: false,
}),
"device-type": Flags.string({
description: "device_type name to filter",
description: "device_type name to filter (mobile is deprecated)",
required: false,
}),
};
Expand All @@ -30,8 +41,10 @@ export default class WebApiListCapabilities extends Command {
const res = await client.listCapabilities(
flags["project-id"],
flags.os,
flags["os-type"] ? JSON.parse(flags["os-type"]) : undefined,
flags.browser,
flags["device-type"]
flags["browser-type"] ? JSON.parse(flags["browser-type"]) : undefined,
flags["device-type"] ? JSON.parse(flags["device-type"]) : undefined
);
console.log(JSON.stringify(res.data, null, 2));
}
Expand Down
2 changes: 1 addition & 1 deletion src/commands/web/api/update-test-plan-variable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default class WebApiUpdateTestPlanVariable extends Command {
}),
"update-test-plan-variable-request": Flags.string({
description:
"The variable&#39;s new key and/or default_value&#39;s value to register",
"The variable's new key and/or default_value's value to register",
required: true,
}),
};
Expand Down
2 changes: 1 addition & 1 deletion src/commands/web/test/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export default class WebTestRun extends Command {
browser: flags.browser,
device: flags.device,
// eslint-disable-next-line camelcase
device_type: flags["device-type"],
device_type: flags["device-type"] as any,
};
const urlReplacements = this.parseUrlReplacements(
flags["url-replacements"] ?? []
Expand Down
Loading